print( "<<< OpenVPN configuration example: Site-to-Site Mode with Preshared Secret" ) print("\n") rundelay = 5 ctrl = Controller(ctrlIpAddr, ctrlPortNum, ctrlUname, ctrlPswd) vrouter = VRouter5600(ctrl, nodeName, nodeIpAddr, nodePortNum, nodeUname, nodePswd) print("<<< 'Controller': %s, '%s': %s" % (ctrlIpAddr, nodeName, nodeIpAddr)) print("\n") time.sleep(rundelay) result = ctrl.add_netconf_node(vrouter) status = result.get_status() if (status.eq(STATUS.OK) == True): print("<<< '%s' added to the Controller" % nodeName) else: print("\n") print("!!!Demo terminated, reason: %s" % status.brief().lower()) exit(0) print("\n") time.sleep(rundelay) result = ctrl.check_node_conn_status(nodeName) status = result.get_status() if (status.eq(STATUS.NODE_CONNECTED) == True): print("<<< '%s' is connected to the Controller" % nodeName) else:
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"
node_configured = False result = ctrl.check_node_config_status(nodeName) status = result.get_status() if(status.eq(STATUS.NODE_CONFIGURED)): node_configured = True print ("<<< '%s' is configured on the Controller" % nodeName) elif(status.eq(STATUS.DATA_NOT_FOUND)): node_onfigured = False else: print ("\n") print "Failed to get configuration status for the '%s'" % nodeName print ("!!!Demo terminated, reason: %s" % status.detailed()) exit(0) if node_configured is False: result = ctrl.add_netconf_node(vrouter) status = result.get_status() if(status.eq(STATUS.OK)): print ("<<< '%s' added to the Controller" % nodeName) else: print ("\n") print ("!!!Demo terminated, reason: %s" % status.detailed()) exit(0) print ("\n") time.sleep(rundelay) result = ctrl.check_node_conn_status(nodeName) status = result.get_status() if(status.eq(STATUS.NODE_CONNECTED)): print ("<<< '%s' is connected to the Controller" % nodeName) else: