Config Push using Netmiko
import netmiko
device_ip = input ("Enter Router IP address : ")
ssh_user = input("Enter user name : ")
ssh_password = input("Enter ssh password : ")
enable_pass = input("Enter enable password : ")
session = netmiko.ConnectHandler(ip = device_ip, username = ssh_user, password = ssh_password, secret = enable_pass, device_type = "cisco_xe")
session.enable()
print ("Before config change")
print (session.send_command("sh run int GigabitEthernet1"))
config_change = ["int GigabitEthernet1", "description OSPF enabled interface" ]
session.send_config_set(config_change)
print ("After config change")
print (session.send_command("sh run int GigabitEthernet1"))
session.save_config()
session.disconnect()
Comments
Post a Comment