Exemplo n.º 1
0
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 + " ***")
Exemplo n.º 2
0
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 ***")
Exemplo n.º 3
0
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)
    '''
Exemplo n.º 4
0
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 !"
Exemplo n.º 5
0
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)