Пример #1
0

if __name__ == "__main__":

    # Read Controller info from the local configuration file
    ctrl_cfg_path = "../config/ctrl.yml"
    ctrl_cfg = yaml_cfg_load(ctrl_cfg_path)
    if(ctrl_cfg is None):
        print("!!!Error, reason: failed to get Controller configuration")
        exit(1)

    # Following is a hard-coded value used by the Controller
    # for self-identification as a NETCONF node
    NC_NODE_ID = "controller-config"
    # Allocate object instance that represents the Controller
    ctrl = ODLController(ctrl_cfg['ip_addr'], ctrl_cfg['http_port'],
                         ctrl_cfg['admin_name'], ctrl_cfg['admin_pswd'])

    # Hard coded references to the "network-topology" YANG model data schema
    SCHEMA_ID = "network-topology"
    SCHEMA_VERSION = "2013-10-21"
    # Communicate to the Controller and display the result of communication
    result = ctrl.schema_info(NC_NODE_ID, SCHEMA_ID, SCHEMA_VERSION)
    print("\n").strip()
    if(result.status == http.OK):
        print("Controller : '%s:%s'" % (ctrl.ip_addr, ctrl.port))
        print("Node ID    : '%s'" % NC_NODE_ID)
        print("YANG model : '%s@%s'" % (SCHEMA_ID, SCHEMA_VERSION))
        print "\n".strip()
        print result.data
    else:
        print("!!!Error, reason: %s" % result.brief)
Пример #2
0
    # Read Controller info from the local configuration file
    ctrl_cfg_path = "../config/ctrl.yml"
    ctrl_cfg = yaml_cfg_load(ctrl_cfg_path)
    if(ctrl_cfg is None):
        print("!!!Error, reason: failed to get Controller configuration")
        exit(1)

    # Read NETCONF devices info from the local configuration file
    nc_dev_cfg_path = "../config/netconf.yml"
    nc_dev_cfg = yaml_cfg_load(nc_dev_cfg_path)
    if(nc_dev_cfg is None):
        print("!!!Error, reason: failed to get NETCONF devices configuration")
        exit(1)

    # Allocate object instance that represents the Controller
    ctrl = ODLController(ctrl_cfg['ip_addr'], ctrl_cfg['http_port'],
                         ctrl_cfg['admin_name'], ctrl_cfg['admin_pswd'])

    print("\n").strip()
    print("Controller: '%s:%s'" % (ctrl.ip_addr, ctrl.port))
    print("\n").strip()

    # Communicate to the Controller and display the result of communication
    for item in nc_dev_cfg:
        node_id = item['name']
        result = ctrl.netconf_node_is_mounted(node_id)
        if(result.status == http.SERVICE_UNAVAILABLE or
           result.status == http.UNAUTHORIZED):
            print("!!!Error, reason: %s" % result.brief)
            print ("\n").strip()
            break
        elif(result.status == http.NOT_FOUND):
Пример #3
0
    # Read Controller info from the local configuration file
    ctrl_cfg_path = "../config/ctrl.yml"
    ctrl_cfg = yaml_cfg_load(ctrl_cfg_path)
    if(ctrl_cfg is None):
        print("!!!Error, reason: failed to get Controller configuration")
        exit(1)

    # Read NETCONF devices info from the local configuration file
    nc_dev_cfg_path = "../config/netconf.yml"
    nc_dev_cfg = yaml_cfg_load(nc_dev_cfg_path)
    if(nc_dev_cfg is None):
        print("!!!Error, reason: failed to get NETCONF devices configuration")
        exit(1)

    # Allocate object instance that represents the Controller
    ctrl = ODLController(ctrl_cfg['ip_addr'], ctrl_cfg['http_port'],
                         ctrl_cfg['admin_name'], ctrl_cfg['admin_pswd'])

    print("\n").strip()
    print("Controller: '%s:%s'" % (ctrl.ip_addr, ctrl.port))
    print("\n").strip()

    # Communicate to the Controller and display the result of communication
    SCHEMA_ID = "ietf-yang-types"
    SCHEMA_VERSION = "2013-07-15"
    for item in nc_dev_cfg:
        node_id = item['name']
        result = ctrl.netconf_node_is_mounted(node_id)
        if(result.status == http.SERVICE_UNAVAILABLE or
           result.status == http.UNAUTHORIZED):
            print("!!!Error, reason: %s" % result.brief)
            print ("\n").strip()
Пример #4
0
    # Read Controller info from the local configuration file
    ctrl_cfg_path = "../config/ctrl.yml"
    ctrl_cfg = yaml_cfg_load(ctrl_cfg_path)
    if(ctrl_cfg is None):
        print("!!!Error, reason: failed to get Controller configuration")
        exit(1)

    # Read NETCONF devices info from the local configuration file
    nc_dev_cfg_path = "../config/netconf.yml"
    nc_dev_cfg = yaml_cfg_load(nc_dev_cfg_path)
    if(nc_dev_cfg is None):
        print("!!!Error, reason: failed to get NETCONF devices configuration")
        exit(1)

    # Allocate object instance that represents the Controller
    ctrl = ODLController(ctrl_cfg['ip_addr'], ctrl_cfg['http_port'],
                         ctrl_cfg['admin_name'], ctrl_cfg['admin_pswd'])

    print("\n").strip()
    print("Controller: '%s:%s'" % (ctrl.ip_addr, ctrl.port))
    print("\n").strip()

    # Communicate to the Controller and display the result of communication
    for item in nc_dev_cfg:
        node_id = item['name']
        result = ctrl.netconf_node_is_mounted(node_id)
        if(result.status == http.SERVICE_UNAVAILABLE or
           result.status == http.UNAUTHORIZED):
            print("!!!Error, reason: %s" % result.brief)
            print ("\n").strip()
            break
        elif(result.status == http.NOT_FOUND):
Пример #5
0
# this package local modules
from Module9.controllers.odl.controller import ODLController
from Module9.utils.utilities import yaml_cfg_load


if __name__ == "__main__":

    # Read Controller info from the local configuration file
    ctrl_cfg_path = "../config/ctrl.yml"
    ctrl_cfg = yaml_cfg_load(ctrl_cfg_path)
    if ctrl_cfg is None:
        print ("!!!Error, reason: failed to get Controller configuration")
        exit(1)

    # Allocate object instance that represents the Controller
    ctrl = ODLController(ctrl_cfg["ip_addr"], ctrl_cfg["http_port"], ctrl_cfg["admin_name"], ctrl_cfg["admin_pswd"])

    # Communicate to the Controller and display the result of communication
    result = ctrl.netconf_nodes_ids()
    print ("\n").strip()
    if result.status == http.OK:
        assert isinstance(result.data, list)
        print ("Controller: '%s:%s'" % (ctrl.ip_addr, ctrl.port))
        print "\n".strip()
        print ("NETCONF Nodes Identifiers:")
        print "\n".strip()
        for item in result.data:
            print "  '%s'" % item
    else:
        print ("!!!Error, reason: %s" % result.brief)
    print ("\n").strip()
Пример #6
0
    # Read Controller info from the local configuration file
    ctrl_cfg_path = "../config/ctrl.yml"
    ctrl_cfg = yaml_cfg_load(ctrl_cfg_path)
    if ctrl_cfg is None:
        print ("!!!Error, reason: failed to get Controller configuration")
        exit(1)

    # Read NETCONF devices info from the local configuration file
    nc_dev_cfg_path = "../config/netconf.yml"
    nc_dev_cfg = yaml_cfg_load(nc_dev_cfg_path)
    if nc_dev_cfg is None:
        print ("!!!Error, reason: failed to get NETCONF devices configuration")
        exit(1)

    # Allocate object instance that represents the Controller
    ctrl = ODLController(ctrl_cfg["ip_addr"], ctrl_cfg["http_port"], ctrl_cfg["admin_name"], ctrl_cfg["admin_pswd"])

    print ("\n").strip()
    print ("Controller: '%s:%s'" % (ctrl.ip_addr, ctrl.port))
    print ("\n").strip()

    # Communicate to the Controller and display the result of communication
    for item in nc_dev_cfg:
        node_id = item["name"]
        result = ctrl.netconf_node_topo_info(node_id)
        if result.status == http.OK:
            assert isinstance(result.data, NETCONFNodeTopoInfo)
            device_info = result.data
            clist = device_info.capabilities_available
            print ("  NETCONF Node '%s'" % node_id)
            print ("\n").strip()
Пример #7
0
from Module9.controllers.odl.controller import ODLController
from Module9.controllers.odl.netconf_topology import NETCONFNodeTopoInfo
from Module9.utils.utilities import yaml_cfg_load


if __name__ == "__main__":

    # Read Controller info from the local configuration file
    ctrl_cfg_path = "../config/ctrl.yml"
    ctrl_cfg = yaml_cfg_load(ctrl_cfg_path)
    if(ctrl_cfg is None):
        print("!!!Error, reason: failed to get Controller configuration")
        exit(1)

    # Allocate object instance that represents the Controller
    ctrl = ODLController(ctrl_cfg['ip_addr'], ctrl_cfg['http_port'],
                         ctrl_cfg['admin_name'], ctrl_cfg['admin_pswd'])

    # Following is a hard-coded value used by the Controller
    # for self-identification as a NETCONF node
    NC_NODE_ID = "controller-config"
    print("\n").strip()
    print("Controller: '%s:%s'" % (ctrl.ip_addr, ctrl.port))
    print("\n").strip()
    print("  NETCONF Node '%s'" % NC_NODE_ID)
    print("\n").strip()

    # Communicate to the Controller and display the result of communication
    result = ctrl.netconf_node_topo_info(NC_NODE_ID)
    if(result.status == http.OK):
        assert(isinstance(result.data, NETCONFNodeTopoInfo))
        device_info = result.data
Пример #8
0

if __name__ == "__main__":

    # Read Controller info from the local configuration file
    ctrl_cfg_path = "../config/ctrl.yml"
    ctrl_cfg = yaml_cfg_load(ctrl_cfg_path)
    if(ctrl_cfg is None):
        print("!!!Error, reason: failed to get Controller configuration")
        exit(1)

    # Following is a hard-coded value used by the Controller
    # for identification of the NETCONF topology
    NC_TOPO_ID = 'topology-netconf'
    # Allocate object instance that represents the Controller
    ctrl = ODLController(ctrl_cfg['ip_addr'], ctrl_cfg['http_port'],
                         ctrl_cfg['admin_name'], ctrl_cfg['admin_pswd'])

    print("\n").strip()
    print("Controller: '%s:%s'" % (ctrl.ip_addr, ctrl.port))
    print("\n").strip()
    print("NETCONF Topology information")

    # Communicate to the Controller and display the result of communication
    result = ctrl.topology_info(NC_TOPO_ID)
    if(result.status == http.OK):
        assert(isinstance(result.data, NETCONFTopoInfo))
        topo_info = result.data
        print("\n").strip()
        nodes_list = topo_info.nodes_list
        print("  Topology ID : '%s'" % topo_info.identifier)
        print("  Nodes Count : %s" % len(nodes_list))
Пример #9
0
    # Read Controller info from the local configuration file
    ctrl_cfg_path = "../config/ctrl.yml"
    ctrl_cfg = yaml_cfg_load(ctrl_cfg_path)
    if(ctrl_cfg is None):
        print("!!!Error, reason: failed to get Controller configuration")
        exit(1)

    # Read NETCONF devices info from the local configuration file
    nc_dev_cfg_path = "../config/netconf.yml"
    nc_dev_cfg = yaml_cfg_load(nc_dev_cfg_path)
    if(nc_dev_cfg is None):
        print("!!!Error, reason: failed to get NETCONF devices configuration")
        exit(1)

    # Allocate object instance that represents the Controller
    ctrl = ODLController(ctrl_cfg['ip_addr'], ctrl_cfg['http_port'],
                         ctrl_cfg['admin_name'], ctrl_cfg['admin_pswd'])

    print("\n").strip()
    print("Controller: '%s:%s'" % (ctrl.ip_addr, ctrl.port))
    print("\n").strip()

    # Communicate to the Controller and display the result of communication
    for item in nc_dev_cfg:
        node_id = item['name']
        result = ctrl.netconf_node_is_mounted(node_id)
        if(result.status == http.SERVICE_UNAVAILABLE or
           result.status == http.UNAUTHORIZED):
            print("!!!Error: Controller access failure, reason: %s"
                  % result.brief)
            print ("\n").strip()
            break