示例#1
0
    print("<<< Show OpenVPN interfaces configuration on the '%s'" % nodeName)
    result = vrouter.get_openvpn_interfaces_cfg()
    time.sleep(rundelay)
    status = result.get_status()
    if (status.eq(STATUS.OK) == True):
        print("'%s' OpenVPN interfaces configuration:" % nodeName)
        iflist = result.get_data()
        assert (isinstance(iflist, list))
        for item in iflist:
            print json.dumps(item, indent=4, sort_keys=True)
    elif (status.eq(STATUS.DATA_NOT_FOUND) == True):
        print("No OpenVPN interfaces configuration found")
    else:
        print("\n")
        print("!!!Demo terminated, reason: %s" % status.detailed())
        ctrl.delete_netconf_node(vrouter)
        exit(0)

    print "\n"
    ifname = 'vtun0'
    print(">>> Configure new '%s' OpenVPN tunnel interface on the '%s'" %
          (ifname, nodeName))
    time.sleep(rundelay)

    # Create OpenVPN interface
    vpnif = OpenVpnInterface(ifname)

    # Set the OpenVPN mode to 'site-to-site'
    mode = 'site-to-site'
    vpnif.set_mode(mode)
示例#2
0
    status = result.get_status()
    if (status.eq(STATUS.NODE_CONNECTED)):
        print("'%s' node is connected" % nodeName)
    elif (status.eq(STATUS.NODE_DISONNECTED)):
        print("'%s' node is not connected" % nodeName)
    elif (status.eq(STATUS.NODE_NOT_FOUND)):
        print("'%s' node is not found" % nodeName)
    else:
        print("\n")
        print("!!!Demo terminated, reason: %s" % status.brief())
        exit(0)

    print "\n"
    print(">>> Remove '%s' NETCONF node from the Controller" % nodeName)
    time.sleep(rundelay)
    result = ctrl.delete_netconf_node(node)
    status = result.get_status()
    if (status.eq(STATUS.OK)):
        print(
            "'%s' NETCONF node was successfully removed from the Controller" %
            nodeName)
    else:
        print("\n")
        print("!!!Demo terminated, reason: %s" % status.brief())
        exit(0)

    print "\n"
    print("<<< Show NETCONF nodes configured on the Controller")
    time.sleep(rundelay)
    result = ctrl.get_netconf_nodes_in_config()
    status = result.get_status()
示例#3
0
    print ("<<< Show OpenVPN interfaces configuration on the '%s'" % nodeName)
    result = vrouter.get_openvpn_interfaces_cfg()
    time.sleep(rundelay)
    status = result.get_status()
    if (status.eq(STATUS.OK)):
        print ("'%s' OpenVPN interfaces configuration:" % nodeName)
        iflist = result.get_data()
        assert(isinstance(iflist, list))
        for item in iflist:
            print json.dumps(item, indent=4, sort_keys=True)
    elif (status.eq(STATUS.DATA_NOT_FOUND)):
        print ("No OpenVPN interfaces configuration found")
    else:
        print ("\n")
        print ("!!!Demo terminated, reason: %s" % status.detailed())
        ctrl.delete_netconf_node(vrouter)
        exit(0)

    print "\n"
    ifname = 'vtun0'
    print (">>> Configure new '%s' OpenVPN tunnel interface on the '%s'"
           % (ifname, nodeName))
    time.sleep(rundelay)

    # Create OpenVPN interface
    vpnif = OpenVpnInterface(ifname)

    # Set the OpenVPN mode to 'site-to-site'
    mode = 'site-to-site'
    vpnif.set_mode(mode)
示例#4
0
    status = result.get_status()
    if(status.eq(STATUS.NODE_CONNECTED)):
        print ("'%s' node is connected" % nodeName)
    elif (status.eq(STATUS.NODE_DISONNECTED)):
        print ("'%s' node is not connected" % nodeName)
    elif (status.eq(STATUS.NODE_NOT_FOUND)):
        print ("'%s' node is not found" % nodeName)
    else:
        print ("\n")
        print ("!!!Demo terminated, reason: %s" % status.brief())
        exit(0)

    print "\n"
    print (">>> Remove '%s' NETCONF node from the Controller" % nodeName)
    time.sleep(rundelay)
    result = ctrl.delete_netconf_node(node)
    status = result.get_status()
    if(status.eq(STATUS.OK)):
        print ("'%s' NETCONF node was successfully removed "
               "from the Controller" % nodeName)
    else:
        print ("\n")
        print ("!!!Demo terminated, reason: %s" % status.brief())
        exit(0)

    print "\n"
    print ("<<< Show NETCONF nodes configured on the Controller")
    time.sleep(rundelay)
    result = ctrl.get_netconf_nodes_in_config()
    status = result.get_status()
    if(status.eq(STATUS.OK)):