"Want more expert insights and updates? Follow us on LinkedIn and explore our company page to connect with us directly. Don’t miss out - click the link and join the conversation!"
Follow us on LinkedIn / plexinor
Company Website Https://www.plexinor.com
Configuring ROUTERS and SWITCHES using very basic PYTHON SCRIPT
Full Script is below for reference.
lab@admin:~$ cat Config-single-device-using-set-of-commands
from netmiko import Netmiko
from getpass import getpass
username = input('Enter your SSH username: ')
password=getpass()
device = {
"host": "192.168.0.128",
"username": username,
"password": password,
"device_type":"juniper_junos",
}
commands = ["set system syslog archive size 240k files 3 ", "set system domain-name POP"]
net_connect = Netmiko(**device)
print(net_connect.find_prompt())
output = net_connect.send_config_set(commands, exit_config_mode=False)
output += net_connect.commit(and_quit=True)
print(output)
net_connect.disconnect()