December 2018
Intermediate to advanced
226 pages
4h 57m
English
Let's see an example of how to configure basic OSPF in Python. As a prerequisite, we need to ensure both routers are pingable to each other:

Next, we perform the base configuration and validate whether the OSPF is in the full state:
from netmiko import ConnectHandlerimport timeospfbaseconfig="""router ospf 1network 192.168.20.0 0.0.0.255 area 0"""###convert to a list to send to routersospfbaseconfig=ospfbaseconfig.split("\n")def pushospfconfig(routerip,ospfbaseconfig): uname="test" passwd="test" device = ConnectHandler(device_type='cisco_ios', ip=routerip, username=uname, password=passwd) ...Read now
Unlock full access