December 2018
Intermediate to advanced
226 pages
4h 57m
English
Let us see another example, in which we validate if the Loopback45 interface is created on all routers. If not, the script should automatically create the Loopback45 interface and finally validate the availability of that interface on routers.
Let us first write a code to validate a given interface on all the routers:
#usecase_loopback.pyfrom netmiko import ConnectHandlerfrom threading import Threadfrom pysnmp.entity.rfc3413.oneliner import cmdgencmdGen = cmdgen.CommandGenerator()threads = []def checkloopback45(ip,interface): loopbackpresent=False cmdGen = cmdgen.CommandGenerator() errorIndication, errorStatus, errorIndex, varBindTable = cmdGen.bulkCmd( cmdgen.CommunityData('mytest'), cmdgen.UdpTransportTarget((ip, ...Read now
Unlock full access