def nc_demo_5(): f = "cfg1.yml" 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'] rundelay = d['rundelay'] except: print ("Failed to get Controller device attributes") exit(0) print ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<") print ("<<< Demo Start") print ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<") print ("\n") print ("<<< Creating Controller instance") time.sleep(rundelay) ctrl = Controller(ctrlIpAddr, ctrlPortNum, ctrlUname, ctrlPswd) print ("'Controller':") print ctrl.to_json() print "\n" print ("<<< Show list of all NETCONF operations " "supported by the Controller") time.sleep(rundelay) result = ctrl.get_netconf_operations("controller-config") status = result.get_status() if(status.eq(STATUS.OK)): print "NETCONF operations:" slist = result.get_data() print json.dumps(slist, default=lambda o: o.__dict__, sort_keys=True, indent=4) else: print ("\n") print ("!!!Demo terminated, reason: %s" % status.brief()) exit(0) print ("\n") print (">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>") print (">>> Demo End") print (">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")