Methods of authomations
WaterfallÂ
AgillÂ
Methods of authomations
WaterfallÂ
AgillÂ
Ansible and pupped are supported by the Junos devices
IAC -infra as a code - configure networks using code
Devops practicesÂ
VCS - VERSION CONTROL SYSTEMÂ
https://www.juniper.net/documentation/us/en/software/junos-pyez/junos-pyez-developer/topics/topic-map/junos-pyez-connection-methods.html
import socket
from jnpr.junos import Device
from jnpr.junos.exception import ConnectError
from getpass import getpass
from pprint import pprint
"""
  Listen on TCP port 2200 for incoming SSH session with a Junos device.Â
  Upon connecting, collect and print the devices facts,Â
  then disconnect from that device and wait for more connections.
"""
def launch_junos_proxy(client, addr):
    val = {
            'MSG-ID': None,
            'MSG-VER': None,
            'DEVICE-ID': None
            }
    msg = ''
    count = 3
    while len(msg) < 100 and count > 0:
        c = client.recv(1)
        if c == '\r':
            continue
        if c == '\n':
            count -= 1
            if msg.find(':'):
                (key, value) = msg.split(': ')
                val[key] = value
                msg = ''
        else:
            msg += str(c)
    print('MSG %s %s %s' %
            (val['MSG-ID'], val['MSG-VER'], val['DEVICE-ID']))
    return client.fileno()
def main():
   Â
    PORT = 2200
    junos_username = input('Junos OS username: ')
    junos_password = getpass('Junos OS password: ')
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    s.bind(('', PORT))
    s.listen(5)
    print('\nListening on port %d for incoming sessions ...' % (PORT))
    sock_fd = 0   Â
    while True:
        client, addr = s.accept()
        print('\nGot a connection from %s:%d' % (addr[0], addr[1]))
        sock_fd = launch_junos_proxy(client, addr)
        print('Logging in ...')
        try:
            with Device(host=None, sock_fd=sock_fd, user=junos_username, passwd=junos_password) as dev:
                pprint(dev.facts)
        except ConnectError as err:
            print ("Cannot connect to device: {0}".format(err))               Â
if __name__ == "__main__":
    main()
PRECISA INSTALAR UM MODULO NO JUNOS E PARA USAR UM AGENTEÂ
https://apps.juniper.net/xmlapi/#