Ejemplo n.º 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")
Ejemplo 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"
Ejemplo n.º 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()
Ejemplo n.º 4
0
        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")
Ejemplo 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
Ejemplo n.º 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"
Ejemplo 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"
Ejemplo n.º 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()
Ejemplo n.º 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"
    
Ejemplo n.º 10
0
     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())
Ejemplo n.º 11
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 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)
Ejemplo n.º 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"
    
Ejemplo 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()
Ejemplo n.º 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")
Ejemplo 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")
    
Ejemplo n.º 16
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))
    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())
Ejemplo n.º 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)
Ejemplo n.º 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:
Ejemplo n.º 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:
Ejemplo n.º 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"
    
Ejemplo 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, "
Ejemplo n.º 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")
Ejemplo 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()
Ejemplo n.º 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")
Ejemplo 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,
Ejemplo n.º 26
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 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")
Ejemplo 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")
Ejemplo 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"
    
Ejemplo 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"
Ejemplo 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
Ejemplo n.º 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")
Ejemplo 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)
Ejemplo n.º 33
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()
Ejemplo n.º 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:
Ejemplo n.º 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
Ejemplo n.º 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")
Ejemplo 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())
Ejemplo n.º 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"
Ejemplo 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()
Ejemplo n.º 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)
Ejemplo n.º 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:
Ejemplo n.º 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'" %
Ejemplo n.º 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(