DevNet 103: Network Automation Using Python
Configure OSPF on Cisco Router by Python Configure R1: import paramiko import time import getpass ip_address = "192.168.23.103" username = raw_input("Enter your username of : " + ip_address + ": ") password = getpass.getpass() ssh_client = paramiko.SSHClient() ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh_client.connect(hostname=ip_address,username=username,password=password) print "Successful connection " + ip_address remote_connection = ssh_client.invoke_shell() print "Configure OSPF " remote_connection.send('en\n') time.sleep(1) recv = remote_connection.recv(9999) remote_connection.send('cisco\n') time.sleep(1) recv = remote_connection.recv(9999) remote_connection.send("configure terminal\n") remote_connection.send("interface loop 0\n") remote_connection.send("ip address 1.1.1.1 255.255.255.0\n") remote_connection.send("interface g1/0\n...