Пример #1
0
    def test_ControllerGetNodeList(self, controller):

        print ("--------------------------------------------------------- ")
        print ("<< Test ControllerNodeList Start")
        print ("--------------------------------------------------------- ")
        print ("<< Getting list of all nodes registered on the Controller ")

        ctrl = Controller(self.ctrlIpAddr, self.ctrlPortNum, self.ctrlUname, self.ctrlPswd)
        result = ctrl.get_nodes_operational_list()
        status = result.get_status()

        if(status.eq(STATUS.OK)):
            print "Nodes:"
            nlist = result.get_data()
            for item in nlist:
                print "   * {} *".format(item)
        else:
            print ("\n")
            print ("!!!Failed, reason: %s" % status.brief().lower())
            exit(0)
        print "<  Number of nodes in list: %s > " % len(nlist)
        print "\n"

        # and verify the results
        self.assertEquals(3, len(nlist))
Пример #2
0
    d = {}
    if(load_dict_from_file(f, d) is False):
        print("Config file '%s' read error: " % f)
        exit()

    try:
        ctrlIpAddr = d['ctrlIpAddr']
        ctrlPortNum = d['ctrlPortNum']
        ctrlUname = d['ctrlUname']
        ctrlPswd = d['ctrlPswd']
    except:
        print ("Failed to get Controller device attributes")
        exit(0)

    print "\n"
    print ("<<< Get list of all nodes registered on the Controller")
    ctrl = Controller(ctrlIpAddr, ctrlPortNum, ctrlUname, ctrlPswd)
    result = ctrl.get_nodes_operational_list()
    status = result.get_status()
    if(status.eq(STATUS.OK)):
        print "Nodes:"
        nlist = result.get_data()
        for item in nlist:
            print "   '{}'".format(item)
    else:
        print ("\n")
        print ("!!!Failed, reason: %s" % status.brief().lower())
        exit(0)

    print "\n"