예제 #1
0
    try:
        ctrlIpAddr = d['ctrlIpAddr']
        ctrlPortNum = d['ctrlPortNum']
        ctrlUname = d['ctrlUname']
        ctrlPswd = d['ctrlPswd']

        nodeName = d['nodeName']
        nodeIpAddr = d['nodeIpAddr']
        nodePortNum = d['nodePortNum']
        nodeUname = d['nodeUname']
        nodePswd = d['nodePswd']
    except:
        print ("Failed to get Controller device attributes")
        exit(0)

    ctrl = Controller(ctrlIpAddr, ctrlPortNum, ctrlUname, ctrlPswd)
    node = NetconfNode(ctrl, nodeName, nodeIpAddr, nodePortNum, nodeUname, nodePswd)

    print (">>> Adding '%s' to the Controller '%s'" % (nodeName, ctrlIpAddr))
    result = ctrl.add_netconf_node(node)
    status = result.get_status()
    if(status.eq(STATUS.OK) == True):
        print ("'%s' was successfully added to the Controller" % nodeName)
    else:
        print ("\n")
        print ("!!!Failed, reason: %s" % status.brief().lower())
        exit(0)

    print "\n"
    
예제 #2
0
    result = ctrl.get_netconf_nodes_in_config()
    status = result.get_status()
    if(status.eq(STATUS.OK)):
        print "Nodes configured:"
        nlist = result.get_data()
        for item in nlist:
            print "   '{}'".format(item)
    else:
        print ("\n")
        print ("!!!Demo terminated, reason: %s" % status.brief())
        exit(0)

    print ("\n")
    time.sleep(rundelay)
    print ("<<< Creating new '%s' NETCONF node" % nodeName)
    node = NetconfNode(ctrl, nodeName, nodeIpAddr, nodePortNum,
                       nodeUname, nodePswd)
    print ("'%s':" % nodeName)
    print node.to_json()

    print ("\n")
    print ("<<< Check '%s' NETCONF node availability "
           "on the network" % nodeName)
    time.sleep(rundelay)
    response = os.system("ping -c 1 " + nodeIpAddr)

    if response == 0:
        print nodeIpAddr, 'is up!'
    else:
        print nodeIpAddr, 'is down!'
        print ("!!!Demo terminated")
        exit(0)
예제 #3
0
    result = ctrl.get_netconf_nodes_in_config()
    status = result.get_status()
    if (status.eq(STATUS.OK)):
        print "Nodes configured:"
        nlist = result.get_data()
        for item in nlist:
            print "   '{}'".format(item)
    else:
        print("\n")
        print("!!!Demo terminated, reason: %s" % status.brief())
        exit(0)

    print("\n")
    time.sleep(rundelay)
    print("<<< Creating new '%s' NETCONF node" % nodeName)
    node = NetconfNode(ctrl, nodeName, nodeIpAddr, nodePortNum, nodeUname,
                       nodePswd)
    print("'%s':" % nodeName)
    print node.to_json()

    print("\n")
    print("<<< Check '%s' NETCONF node availability on the network" % nodeName)
    time.sleep(rundelay)
    response = os.system("ping -c 1 " + nodeIpAddr)

    if response == 0:
        print nodeIpAddr, 'is up!'
    else:
        print nodeIpAddr, 'is down!'
        print("!!!Demo terminated")
        exit(0)
예제 #4
0
 def __init__(self, ctrl, name, ip_address, port_number, admin_name,
              admin_password, tcp_only=False):
     NetconfNode.__init__(self, ctrl. name, ip_address, port_number, admin_name, admin_name, tcp_only)