def Task(ipAddress, username, password): myClient = common.EstablishConn(ipAddress, username, password) if not myClient: return time.sleep(1) ApplyConf(myClient) print("*** Configuration had been applied " + ipAddress + " ***")
def Task(ipAddress, username, password): myClient = common.EstablishConn(ipAddress, username, password) if not myClient: return hostname = GetHostName(myClient) time.sleep(1) response = ApplyConf(myClient) common.WriteToFile(hostname+"_"+ipAddress, response) print ("*** Getting Information from Device " + hostname+" is Compelet ***")
def CallRouter(ipAddress, username, password, power): myClient = common.EstablishConn(ipAddress, username, password) if not myClient: return router = cisco.Router(myClient) router.GetInterfacesByPower() result = filter( lambda port: port.Power == float(power) and port.Admin == cisco. InterfaceAdmin.Auto, router.Interfaces) if len(result) > 0: print 'Found **', len(result), '** interfaces' ApplyConf(myClient, result) '''
def CallRouter(ipAddress, username, password, neighbor): myClient = common.EstablishConn(ipAddress, username, password) if not myClient: return router = cisco.Router(myClient) router.GetInterfacesByNeighbor() result = filter(lambda port: neighbor.lower() in port.Neighbor.lower(), router.Interfaces) if len(result) > 0: print 'Found **', len(result), '** interfaces' for item in result: print "Platform: " + item.Neighbor print "Interface: " + item.Name print "=============================" ApplyConf(myClient, result) else: print "No matched Device !"
def CallRouter(ipAddress, username, password, neighbor): myClient = common.EstablishConn(ipAddress, username, password) if not myClient: return router = cisco.Router(myClient) router.GetInterfacesByNeighbor() result = filter(lambda port: neighbor.lower() in port.Neighbor.lower(), router.Interfaces) if len(result) > 0: print 'Found **', len(result), '** interfaces' for item in result: print "Platform: " + item.Neighbor print "Interface: " + item.Name print "=============================" #input = raw_input("Would you like to configure, press[Y/y] ") # if(input.lower()== "y"): ApplyConf(myClient, result)