예제 #1
0
     ctrlPswd = d['ctrlPswd']
 except:
     print ("Failed to get Controller device attributes")
     exit(0)
 
 
 print ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
 print ("<<< Demo Start")
 print ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
 
 rundelay = 5
 
 print ("\n")
 print ("<<< Creating Controller instance")
 time.sleep(rundelay)
 ctrl = Controller(ctrlIpAddr, ctrlPortNum, ctrlUname, ctrlPswd)
 print ("'Controller':")
 print ctrl.to_json()
 
 
 print "\n"
 print ("<<< Get list of service provider applications available on the Controller")
 time.sleep(rundelay)
 result = ctrl.get_service_providers_info()
 status = result.get_status()
 if(status.eq(STATUS.OK)):
     services = result.get_data()
     print "Service providers:"
     print json.dumps(services, default=lambda o: o.__dict__, sort_keys=True, indent=4)
 else:
     print ("\n")
예제 #2
0
                   " establishes permanent connection to the events notification\n" \
                   " stream. Once a data change event in the topology tree (such\n" \
                   " as add/remove switch, host or link) is detected it will be\n" \
                   " reported to the screen.\n" \
                   "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n"

    print "\n".strip()
    print description
    print "\n".strip()
    time.sleep(rundelay)

    print("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
    print("<<< Demo Start")
    print("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")

    ctrl = Controller(ctrlIpAddr, ctrlPortNum, ctrlUname, ctrlPswd)
    # Identifier of the network topology to be traced
    # (name used by Controller for default topology instance)
    topo_id = 'flow:1'
    print "\n".strip()
    print("<<< 'Controller': %s, Topology Identifier: '%s'" %
          (ctrlIpAddr, topo_id))
    time.sleep(rundelay)

    # Data store for the changes
    # Can be one of:
    # - CONFIGURATION: Logical data store representing configuration
    #                  state of the system and it's components.
    # - OPERATIONAL:   Logical data store representing operational
    #                  state of the system and it's components
    datastore = "OPERATIONAL"
예제 #3
0
     ctrlPswd = d['ctrlPswd']
 except:
     print ("Failed to get Controller device attributes")
     exit(0)
 
 
 print ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
 print ("<<< Demo Start")
 print ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
 
 rundelay = 5
 
 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 a particular configuration module on the Controller")
 moduleType = "opendaylight-rest-connector:rest-connector-impl"
 moduleName = "rest-connector-default-impl"
 print ("    (module type: %s,\n     module name: %s)"  % (moduleType, moduleName))
 time.sleep(rundelay)
 result = ctrl.get_module_operational_state(moduleType, moduleName)
 status = result.get_status()
 if(status.eq(STATUS.OK)):
     print "Module:"
     slist = result.get_data()
예제 #4
0
파일: demo28.py 프로젝트: Elbrys/pydevodl
        ctrlUname = d['ctrlUname']
        ctrlPswd = d['ctrlPswd']
    except:
        print ("Failed to get Controller device attributes")
        exit(0)

    openflow_nodes = []

    print ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
    print ("<<< Demo Start")
    print ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")

    rundelay = 2

    print "\n"
    ctrl = Controller(ctrlIpAddr, ctrlPortNum, ctrlUname, ctrlPswd)
    print ("<<< Controller '%s:%s'" % (ctrlIpAddr, ctrlPortNum))
    time.sleep(rundelay)

    print "\n"
    print ("<<< Get OpenFlow Inventory Information")
    time.sleep(rundelay)

    inv_obj = None
    result = ctrl.build_inventory_object()
    status = result.get_status()
    if(status.eq(STATUS.OK)):
        inv_obj = result.get_data()
        assert(isinstance(inv_obj, Inventory))
    else:
        print ("\n")
예제 #5
0
        nodePswd = d['nodePswd']
    except:
        print ("Failed to get Controller device attributes")
        exit(0)

    print ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
    print ("<<< Demo Start")
    print ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")

    print("\n")
    print("<<< OpenVPN configuration example: Site-to-Site Mode with TLS")
    print("\n")

    rundelay = 3

    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)
    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
예제 #6
0
    d = {}
    if (load_dict_from_file(f, d) == 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) == True):
        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"
예제 #7
0
                " as add/remove switch, host or link) is detected it will be\n" \
                " reported to the screen.\n" \
                "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n"
 
 print "\n".strip()
 print description
 print "\n".strip()
 time.sleep(rundelay)
 
 
 print ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
 print ("<<< Demo Start")
 print ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
 
 
 ctrl = Controller(ctrlIpAddr, ctrlPortNum, ctrlUname, ctrlPswd)
 # Identifier of the network topology to be traced
 # (name used by Controller for default topology instance)
 topo_id = 'flow:1'
 print "\n".strip()
 print ("<<< 'Controller': %s, Topology Identifier: '%s'" % (ctrlIpAddr, topo_id))
 time.sleep(rundelay)
 
 
 # Data store for the changes
 # Can be one of:
 # - CONFIGURATION: Logical data store representing configuration
 #                  state of the system and it's components.
 # - OPERATIONAL:   Logical data store representing operational
 #                  state of the system and it's components
 datastore = "OPERATIONAL"
예제 #8
0
        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)
    
    
    print "\n"
    print ("<<< NETCONF nodes configured on the Controller")
    ctrl = Controller(ctrlIpAddr, ctrlPortNum, ctrlUname, ctrlPswd)
    result = ctrl.get_netconf_nodes_in_config()
    status = result.get_status()
    if(status.eq(STATUS.OK) == True):
        print "Nodes configured:"
        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"
    print ("<<< NETCONF nodes connection status on the Controller")
    result = ctrl.get_netconf_nodes_conn_status()
예제 #9
0
        exit()

    try:
        ctrlIpAddr = d['ctrlIpAddr']
        ctrlPortNum = d['ctrlPortNum']
        ctrlUname = d['ctrlUname']
        ctrlPswd = d['ctrlPswd']

        nodeId = "openflow:1"
    except:
        print ("Failed to get Controller device attributes")
        exit(0)
    
    
    print "\n"
    print ("<<< Get info about '%s' node on the Controller" % nodeId)
    ctrl = Controller(ctrlIpAddr, ctrlPortNum, ctrlUname, ctrlPswd)
    result = ctrl.get_node_info(nodeId)
    status = result.get_status()
    if(status.eq(STATUS.OK) == True):
        print ("'%s' node info:" % nodeId)
        info = result.get_data()
        print json.dumps(info, indent=4)
    else:
        print ("\n")
        print ("!!!Failed, reason: %s" % status.brief().lower())
        exit(0)
    
    
    print "\n"
    
예제 #10
0
파일: demo1.py 프로젝트: jebpublic/pydevodl
     nodeName = d['nodeName']
 except:
     print ("Failed to get Controller device attributes")
     exit(0)
 
 
 print ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
 print ("<<< Demo Start")
 print ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
 
 rundelay = 5
 
 print ("\n")
 print ("<<< Creating Controller instance")
 time.sleep(rundelay)
 ctrl = Controller(ctrlIpAddr, ctrlPortNum, ctrlUname, ctrlPswd, None)
 print ("'Controller':")
 print ctrl.brief_json()
 
 print "\n"
 print ("<<< Get list of OpenFlow nodes connected to the Controller")
 time.sleep(rundelay)
 result = ctrl.get_openflow_nodes_operational_list()
 status = result.get_status()
 if(status.eq(STATUS.OK) == True):
     print ("OpenFlow node names (composed as \"openflow:datapathid\"):")
     nodenames = result.get_data()
     print json.dumps(nodenames, indent=4)
 else:
     print ("\n")
     print ("!!!Demo terminated, reason: %s" % status.brief().lower())
예제 #11
0
파일: demo3.py 프로젝트: jebpublic/pydevodl
        ctrlPswd = d['ctrlPswd']
        nodeName = d['nodeName']
    except:
        print("Failed to get Controller device attributes")
        exit(0)

    print("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
    print("<<< Demo Start")
    print("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")

    rundelay = 5

    print("\n")
    print("<<< Creating Controller instance")
    time.sleep(rundelay)
    ctrl = Controller(ctrlIpAddr, ctrlPortNum, ctrlUname, ctrlPswd, None)
    print("'Controller':")
    print ctrl.brief_json()

    print("\n")
    print("<<< Get detailed information about ports on OpenFlow node '%s'" %
          nodeName)
    time.sleep(rundelay)
    ofswitch = OFSwitch(ctrl, nodeName)

    result = ofswitch.get_ports_list()
    status = result.get_status()
    if (status.eq(STATUS.OK) == True):
        ports = result.get_data()
        for port in ports:
            result = ofswitch.get_port_detail_info(port)
예제 #12
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)
    result = ctrl.get_schemas("controller-config")
    status = result.get_status()
    if(status.eq(STATUS.OK) == True):
        print "YANG models list:"
        slist = result.get_data()
        print json.dumps(slist, default=lambda o: o.__dict__, sort_keys=True, indent=4)
    else:
        print ("\n")
        print ("!!!Failed, reason: %s" % status.brief().lower())
        print ("%s" % status.detailed())
        sys.exit(0)

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

    print("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
    print("<<< Demo Start")
    print("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")

    rundelay = 2

    ctrl = Controller(ctrlIpAddr, ctrlPortNum, ctrlUname, ctrlPswd)

    print "\n"
    print("<<< Controller '%s:%s'" % (ctrlIpAddr, ctrlPortNum))
    time.sleep(rundelay)

    print("\n")
    print("<<< Get OpenFlow Network Topology information")
    time.sleep(rundelay)

    topology_ids = []
    topologies = []
    inventory = None

    result = ctrl.build_inventory_object()
    status = result.get_status()
예제 #14
0
     ctrlPswd = d['ctrlPswd']
 except:
     print ("Failed to get Controller device attributes")
     exit(0)
 
 
 print ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
 print ("<<< Demo Start")
 print ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
 
 rundelay = 5
 
 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 notification event streams registered on the Controller")
 time.sleep(rundelay)
 result = ctrl.get_streams_info()
 status = result.get_status()
 if(status.eq(STATUS.OK)):
     print "Streams:"
     slist = result.get_data()
     print json.dumps(slist, default=lambda o: o.__dict__, sort_keys=True, indent=4)
 else:
     print ("\n")
예제 #15
0
    for opt, arg in opts:
        if opt in ("-h", "--help"):
            usage(sys.argv[0])
        elif opt in ("-i", "--identifier"):
            model_identifier = arg
        elif opt in ("-v", "--version"):
            model_version = arg
        else:
            print("Error: failed to parse option %s" % opt)
            usage(sys.argv[0])

    if(model_identifier == None) or (model_version == None):
        print("Error: incomplete command")
        usage(sys.argv[0])

    ctrl = Controller(ctrlIpAddr, ctrlPortNum, ctrlUname, ctrlPswd)
    print ("<<< 'Controller': %s" % (ctrlIpAddr))
    result = ctrl.get_schema("controller-config", model_identifier, model_version)
    status = result.get_status()
    if(status.eq(STATUS.OK) == True):
        print "YANG model definition:"
        schema = result.get_data()
        print schema.encode('utf-8', 'replace')
    else:
        print ("\n")
        print ("!!!Failed, reason: %s" % status.brief().lower())
        print ("%s" % status.detailed())
        exit(0)

    print ("\n")
    
예제 #16
0
파일: mount.py 프로젝트: Elbrys/pydevodl
    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))
    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 already configured on the Controller" % nodeName)
    elif(status.eq(STATUS.DATA_NOT_FOUND)):
        node_configured = False
    else:
        print ("\n")
        print ("!!!Failed, reason: %s" % status.brief().lower())
예제 #17
0
        ctrlUname = d['ctrlUname']
        ctrlPswd = d['ctrlPswd']
    except:
        print("Failed to get Controller device attributes")
        exit(0)

    print("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
    print("<<< Demo Start")
    print("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")

    rundelay = 5

    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 notification event streams registered on the Controller")
    time.sleep(rundelay)
    result = ctrl.get_streams_info()
    status = result.get_status()
    if (status.eq(STATUS.OK)):
        print "Streams:"
        slist = result.get_data()
        print json.dumps(slist,
                         default=lambda o: o.__dict__,
                         sort_keys=True,
                         indent=4)
예제 #18
0
        ctrlUname = d['ctrlUname']
        ctrlPswd = d['ctrlPswd']
    except:
        print ("Failed to get Controller device attributes")
        exit(0)

    print ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
    print ("<<< Demo Start")
    print ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")

    rundelay = 3

    print ("\n")
    print ("<<< Creating Controller instance")
    time.sleep(rundelay)
    ctrl = Controller(ctrlIpAddr, ctrlPortNum, ctrlUname, ctrlPswd)
    print ("'Controller':")
    print ctrl.to_json()

    print "\n"
    print ("<<< Get list of service provider applications "
           "available on the Controller")
    time.sleep(rundelay)
    result = ctrl.get_service_providers_info()
    status = result.get_status()
    if(status.eq(STATUS.OK)):
        services = result.get_data()
        print "Service providers:"
        print json.dumps(services, default=lambda o: o.__dict__,
                         sort_keys=True, indent=4)
    else:
예제 #19
0
     ctrlPswd = d['ctrlPswd']
 except:
     print ("Failed to get Controller device attributes")
     exit(0)
 
 
 print ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
 print ("<<< Demo Start")
 print ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
 
 rundelay = 5
 
 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 sessions running on the Controller ")
 nodeName = "controller-config"
 time.sleep(rundelay)
 result = ctrl.get_sessions_info(nodeName)
 status = result.get_status()
 if(status.eq(STATUS.OK)):
     print "Sessions:"
     slist = result.get_data()
     print json.dumps(slist, default=lambda o: o.__dict__, sort_keys=True, indent=4)
 else:
예제 #20
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"
    
예제 #21
0
    ctrlIpAddr = '172.22.18.186'
    ctrlPortNum = '8181'
    ctrlUname = 'admin'
    ctrlPswd = 'admin'

    netconf_ids = []
    netconf_nodes = []

    print("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
    print("<<< Demo Start")
    print("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")

    rundelay = 2

    print "\n"
    ctrl = Controller(ctrlIpAddr, ctrlPortNum, ctrlUname, ctrlPswd)
    print("<<< Controller '%s:%s'" % (ctrlIpAddr, ctrlPortNum))
    time.sleep(rundelay)

    print "\n"
    print("<<< Get NETCONF Inventory Information")
    time.sleep(rundelay)

    result = ctrl.get_netconf_nodes_in_config()
    status = result.get_status()
    if (status.eq(STATUS.OK)):
        netconf_ids = result.get_data()
    else:
        print("\n")
        print(
            "!!!Demo terminated, "
예제 #22
0
     ctrlPswd = d['ctrlPswd']
 except:
     print ("Failed to get Controller device attributes")
     exit(0)
 
 
 print ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
 print ("<<< Demo Start")
 print ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
 
 rundelay = 5
 
 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")
예제 #23
0
     ctrlPswd = d['ctrlPswd']
 except:
     print ("Failed to get Controller device attributes")
     exit(0)
 
 
 print ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
 print ("<<< Demo Start")
 print ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
 
 rundelay = 5
 
 print ("\n")
 print ("<<< Creating Controller instance")
 time.sleep(rundelay)
 ctrl = Controller(ctrlIpAddr, ctrlPortNum, ctrlUname, ctrlPswd)
 print ("'Controller':")
 print ctrl.to_json()
 
 
 print "\n"
 yangModelName = "flow-topology-discovery"
 yangModelVerson = "2013-08-19"
 print ("<<< Retrieve '%s' YANG model definition from the Controller" % yangModelName)
 time.sleep(rundelay)
 nodeName = "controller-config"
 result = ctrl.get_schema(nodeName, yangModelName, yangModelVerson)
 status = result.get_status()
 if(status.eq(STATUS.OK)):
     print ("YANG model:")
     schema = result.get_data()
예제 #24
0
        nodePortNum = d['nodePortNum']
        nodeUname = d['nodeUname']
        nodePswd = d['nodePswd']
    except:
        print("Failed to get Controller or NETCONF device attributes")
        exit(0)

    print("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
    print("<<< Demo Start")
    print("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")

    rundelay = 5

    print("\n")
    print("<<< Creating Controller instance")
    ctrl = Controller(ctrlIpAddr, ctrlPortNum, ctrlUname, ctrlPswd)
    print("'Controller':")
    print ctrl.to_json()

    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)):
        print "Nodes configured:"
        nlist = result.get_data()
        for item in nlist:
            print "   '{}'".format(item)
    else:
        print("\n")
예제 #25
0
        ctrlUname = d['ctrlUname']
        ctrlPswd = d['ctrlPswd']
    except:
        print("Failed to get Controller device attributes")
        exit(0)

    print("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
    print("<<< Demo Start")
    print("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")

    rundelay = 5

    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 sessions running on the Controller ")
    nodeName = "controller-config"
    time.sleep(rundelay)
    result = ctrl.get_sessions_info(nodeName)
    status = result.get_status()
    if (status.eq(STATUS.OK)):
        print "Sessions:"
        slist = result.get_data()
        print json.dumps(slist,
                         default=lambda o: o.__dict__,
                         sort_keys=True,
예제 #26
0
파일: demo2.py 프로젝트: jebpublic/pydevodl
        ctrlPswd = d["ctrlPswd"]
        nodeName = d["nodeName"]
    except:
        print ("Failed to get Controller device attributes")
        exit(0)

    print ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
    print ("<<< Demo Start")
    print ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")

    rundelay = 5

    print ("\n")
    print ("<<< Creating Controller instance")
    time.sleep(rundelay)
    ctrl = Controller(ctrlIpAddr, ctrlPortNum, ctrlUname, ctrlPswd, None)
    print ("'Controller':")
    print ctrl.brief_json()

    print ("\n")
    print ("<<< Get information about OpenFlow node '%s'" % nodeName)
    time.sleep(rundelay)
    ofswitch = OFSwitch(ctrl, nodeName)
    result = ofswitch.get_switch_info()
    status = result.get_status()
    if status.eq(STATUS.OK) == True:
        print ("Node '%s' generic info:" % nodeName)
        info = result.get_data()
        print json.dumps(info, indent=4)
    else:
        print ("\n")
예제 #27
0
 ctrlUname = 'admin'
 ctrlPswd = 'admin'
 
 netconf_ids = []
 netconf_nodes = []
 
 print ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
 print ("<<< Demo Start")
 print ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
 
 
 rundelay = 2
 
 
 print "\n"
 ctrl = Controller(ctrlIpAddr, ctrlPortNum, ctrlUname, ctrlPswd)
 print ("<<< Controller '%s:%s'" % (ctrlIpAddr, ctrlPortNum))
 time.sleep(rundelay)
 
 
 print "\n"
 print ("<<< Get NETCONF Inventory Information")
 time.sleep(rundelay)
 
 
 result = ctrl.get_netconf_nodes_in_config()
 status = result.get_status()
 if(status.eq(STATUS.OK)):
     netconf_ids = result.get_data()
 else:
     print ("\n")
예제 #28
0
        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) == True):
        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"
    
예제 #29
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 (">>> Removing '%s' from the Controller '%s'" % (nodeName, ctrlIpAddr))
    result = ctrl.delete_netconf_node(node)
    status = result.get_status()
    if status.eq(STATUS.OK) == True:
        print ("'%s' was successfully removed from the Controller" % nodeName)
    else:
        print ("\n")
        print ("!!!Failed, reason: %s" % status.brief().lower())
        exit(0)

    print "\n"
예제 #30
0
                   " establishes permanent connection to the events notification\n"\
                   " stream. Once a data change event in the inventory data store\n"\
                   " (such as add/remove node or flow entry) is detected\n"\
                   " it will be reported to the screen.\n"\
                   "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n"

    print "\n".strip()
    print description
    print "\n".strip()
    time.sleep(rundelay)

    print("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
    print("<<< Demo Start")
    print("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")

    ctrl = Controller(ctrlIpAddr, ctrlPortNum, ctrlUname, ctrlPswd)
    print "\n".strip()
    print("<<< 'Controller': %s" % (ctrlIpAddr))
    time.sleep(rundelay)

    # Data store for the changes
    # Can be one of:
    # - CONFIGURATION: Logical data store representing configuration
    #                  state of the system and it's components.
    # - OPERATIONAL:   Logical data store representing operational
    #                  state of the system and it's components
    datastore = "OPERATIONAL"

    # Scope of the data changes
    # Can be one of:
    # - BASE:    Represents only a direct change of the node, such as
예제 #31
0
        nodePortNum = d['nodePortNum']
        nodeUname = d['nodeUname']
        nodePswd = d['nodePswd']
    except:
        print ("Failed to get Controller or NETCONF device attributes")
        exit(0)

    print ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
    print ("<<< Demo Start")
    print ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")

    rundelay = 3

    print ("\n")
    print ("<<< Creating Controller instance")
    ctrl = Controller(ctrlIpAddr, ctrlPortNum, ctrlUname, ctrlPswd)
    print ("'Controller':")
    print ctrl.to_json()

    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)):
        print "Nodes configured:"
        nlist = result.get_data()
        for item in nlist:
            print "   '{}'".format(item)
    else:
        print ("\n")
예제 #32
0
        ctrlUname = d['ctrlUname']
        ctrlPswd = d['ctrlPswd']
    except:
        print("Failed to get Controller device attributes")
        exit(0)

    print("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
    print("<<< Demo Start")
    print("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")

    rundelay = 5

    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 all configuration modules on the Controller")
    time.sleep(rundelay)
    result = ctrl.get_config_modules()
    status = result.get_status()
    if (status.eq(STATUS.OK)):
        print "Modules:"
        slist = result.get_data()
        print json.dumps(slist,
                         default=lambda o: o.__dict__,
                         sort_keys=True,
                         indent=4)
예제 #33
0
파일: demo27.py 프로젝트: Elbrys/pydevodl
    try:
        ctrlIpAddr = d['ctrlIpAddr']
        ctrlPortNum = d['ctrlPortNum']
        ctrlUname = d['ctrlUname']
        ctrlPswd = d['ctrlPswd']
    except:
        print ("Failed to get Controller device attributes")
        exit(0)

    print ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
    print ("<<< Demo Start")
    print ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")

    rundelay = 2

    ctrl = Controller(ctrlIpAddr, ctrlPortNum, ctrlUname, ctrlPswd)

    print "\n"
    print ("<<< Controller '%s:%s'" % (ctrlIpAddr, ctrlPortNum))
    time.sleep(rundelay)

    print ("\n")
    print ("<<< Get OpenFlow Network Topology information")
    time.sleep(rundelay)

    topology_ids = []
    topologies = []
    inventory = None

    result = ctrl.build_inventory_object()
    status = result.get_status()
예제 #34
0
 ctrlIpAddr = '172.22.18.186'
 ctrlPortNum = '8181'
 ctrlUname = 'admin'
 ctrlPswd = 'admin'
 
 
 print ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
 print ("<<< Demo Start")
 print ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
 
 
 rundelay = 2
 
 
 print "\n"
 ctrl = Controller(ctrlIpAddr, ctrlPortNum, ctrlUname, ctrlPswd)
 print ("<<< Controller '%s:%s'" % (ctrlIpAddr, ctrlPortNum))
 time.sleep(rundelay)
 
 
 print "\n"
 print ("<<< Get NETCONF Configuration Information")
 time.sleep(rundelay)
 
 
 netconf_cfg_modules = []
 result = ctrl.build_netconf_config_objects()
 status = result.get_status()
 if(status.eq(STATUS.OK) == True):
     netconf_cfg_modules  = result.get_data()
 else:
예제 #35
0
        " stream. Once a data change event in the inventory data store\n"
        " (such as add/remove node or flow entry) is detected\n"
        " it will be reported to the screen.\n"
        "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n"
    )

    print "\n".strip()
    print description
    print "\n".strip()
    time.sleep(rundelay)

    print ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
    print ("<<< Demo Start")
    print ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")

    ctrl = Controller(ctrlIpAddr, ctrlPortNum, ctrlUname, ctrlPswd)
    print "\n".strip()
    print ("<<< 'Controller': %s" % (ctrlIpAddr))
    time.sleep(rundelay)

    # Data store for the changes
    # Can be one of:
    # - CONFIGURATION: Logical data store representing configuration
    #                  state of the system and it's components.
    # - OPERATIONAL:   Logical data store representing operational
    #                  state of the system and it's components
    datastore = "OPERATIONAL"

    # Scope of the data changes
    # Can be one of:
    # - BASE:    Represents only a direct change of the node, such as
예제 #36
0
        ctrlPswd = d['ctrlPswd']
    except:
        print("Failed to get Controller device attributes")
        exit(0)

    openflow_node_ids = []
    openflow_nodes = []

    print("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
    print("<<< Demo Start")
    print("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")

    rundelay = 2

    print "\n"
    ctrl = Controller(ctrlIpAddr, ctrlPortNum, ctrlUname, ctrlPswd)
    print("<<< Controller '%s:%s'" % (ctrlIpAddr, ctrlPortNum))
    time.sleep(rundelay)

    print "\n"
    print("<<< Get OpenFlow Inventory Information")
    time.sleep(rundelay)

    inv_obj = None
    result = ctrl.build_inventory_object()
    status = result.get_status()
    if (status.eq(STATUS.OK) == True):
        inv_obj = result.get_data()
        assert (isinstance(inv_obj, Inventory))
    else:
        print("\n")
예제 #37
0
        ctrlPswd = d['ctrlPswd']
        nodeName = d['nodeName']
    except:
        print("Failed to get Controller device attributes")
        exit(0)

    print("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
    print("<<< Demo Start")
    print("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")

    rundelay = 5

    print("\n")
    print("<<< Creating Controller instance")
    time.sleep(rundelay)
    ctrl = Controller(ctrlIpAddr, ctrlPortNum, ctrlUname, ctrlPswd, None)
    print("'Controller':")
    print ctrl.brief_json()

    print "\n"
    print("<<< Get list of OpenFlow nodes connected to the Controller")
    time.sleep(rundelay)
    result = ctrl.get_openflow_nodes_operational_list()
    status = result.get_status()
    if (status.eq(STATUS.OK) == True):
        print("OpenFlow node names (composed as \"openflow:datapathid\"):")
        nodenames = result.get_data()
        print json.dumps(nodenames, indent=4)
    else:
        print("\n")
        print("!!!Demo terminated, reason: %s" % status.brief().lower())
예제 #38
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)
    result = ctrl.get_schemas("controller-config")
    status = result.get_status()
    if(status.eq(STATUS.OK)):
        print "YANG models list:"
        slist = result.get_data()
        print json.dumps(slist, default=lambda o: o.__dict__,
                         sort_keys=True, indent=4)
    else:
        print ("\n")
        print ("!!!Failed, reason: %s" % status.brief().lower())
        print ("%s" % status.detailed())
        sys.exit(0)

    print "\n"
예제 #39
0
        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)

    print "\n"
    print("<<< NETCONF nodes configured on the Controller")
    ctrl = Controller(ctrlIpAddr, ctrlPortNum, ctrlUname, ctrlPswd)
    result = ctrl.get_netconf_nodes_in_config()
    status = result.get_status()
    if (status.eq(STATUS.OK) == True):
        print "Nodes configured:"
        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"
    print("<<< NETCONF nodes connection status on the Controller")
    result = ctrl.get_netconf_nodes_conn_status()
예제 #40
0
        print("Failed to get Controller device attributes")
        exit(0)

    print("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
    print("<<< Demo Start")
    print("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")

    print("\n")
    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)
예제 #41
0
     ctrlPswd = d['ctrlPswd']
 except:
     print ("Failed to get Controller device attributes")
     exit(0)
 
 
 print ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
 print ("<<< Demo Start")
 print ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
 
 rundelay = 5
 
 print ("\n")
 print ("<<< Creating Controller instance")
 time.sleep(rundelay)
 ctrl = Controller(ctrlIpAddr, ctrlPortNum, ctrlUname, ctrlPswd)
 print ("'Controller':")
 print ctrl.to_json()
 
 
 print "\n"
 print ("<<< Get list of YANG models supported by the Controller")
 time.sleep(rundelay)
 nodeName = "controller-config"
 result = ctrl.get_schemas(nodeName)
 status = result.get_status()
 if(status.eq(STATUS.OK)):
     print "YANG models list:"
     slist = result.get_data()
     print json.dumps(slist, default=lambda o: o.__dict__, sort_keys=True, indent=4)
 else:
예제 #42
0
        ctrlIpAddr = d['ctrlIpAddr']
        ctrlPortNum = d['ctrlPortNum']
        ctrlUname = d['ctrlUname']
        ctrlPswd = d['ctrlPswd']
        nodeName = d['nodeName']
    except:
        print("Failed to get Controller device attributes")
        exit(0)

    print("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
    print("<<< Demo Start")
    print("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")

    rundelay = 5

    ctrl = Controller(ctrlIpAddr, ctrlPortNum, ctrlUname, ctrlPswd)
    ofswitch = OFSwitch(ctrl, nodeName)

    # --- Flow Match: Ethernet Type
    #                 Input Port
    #                 IPv4 Destination Address
    eth_type = ETH_TYPE_MPLS_UCAST
    in_port = 13
    mpls_label = 27

    # --- Flow Actions: Set Field
    #                   Output
    new_mpls_label = 44
    output_port = 14

    print("<<< 'Controller': %s, 'OpenFlow' switch: '%s'" %
예제 #43
0
from framework.controller.inventory import NetconfConfigModule

if __name__ == "__main__":
    ctrlIpAddr = '172.22.18.186'
    ctrlPortNum = '8181'
    ctrlUname = 'admin'
    ctrlPswd = 'admin'

    print("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
    print("<<< Demo Start")
    print("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")

    rundelay = 2

    print "\n"
    ctrl = Controller(ctrlIpAddr, ctrlPortNum, ctrlUname, ctrlPswd)
    print("<<< Controller '%s:%s'" % (ctrlIpAddr, ctrlPortNum))
    time.sleep(rundelay)

    print "\n"
    print("<<< Get NETCONF Configuration Information")
    time.sleep(rundelay)

    netconf_cfg_modules = []
    result = ctrl.build_netconf_config_objects()
    status = result.get_status()
    if (status.eq(STATUS.OK) == True):
        netconf_cfg_modules = result.get_data()
    else:
        print("\n")
        print(