Commit 45f01d3e authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Device component:

- refined TrandportAPIDriver endpoint retrieval
- refined Driver selection
parent bc0c90f3
Loading
Loading
Loading
Loading
+30 −30
Original line number Diff line number Diff line
@@ -25,8 +25,8 @@ DRIVERS = []
from .emulated.EmulatedDriver import EmulatedDriver # pylint: disable=wrong-import-position
DRIVERS.append(
    (EmulatedDriver, [
        # TODO: multi-filter is not working
        {
            # Driver==EMULATED, all device types => use Emulated
            FilterFieldEnum.DEVICE_TYPE: [
                DeviceTypeEnum.EMULATED_DATACENTER,
                DeviceTypeEnum.EMULATED_MICROVAWE_RADIO_SYSTEM,
@@ -37,40 +37,40 @@ DRIVERS.append(
                DeviceTypeEnum.EMULATED_PACKET_ROUTER,
                DeviceTypeEnum.EMULATED_PACKET_SWITCH,

                DeviceTypeEnum.DATACENTER,
                DeviceTypeEnum.MICROVAWE_RADIO_SYSTEM,
                DeviceTypeEnum.OPEN_LINE_SYSTEM,
                DeviceTypeEnum.OPTICAL_ROADM,
                DeviceTypeEnum.OPTICAL_TRANSPONDER,
                DeviceTypeEnum.P4_SWITCH,
                DeviceTypeEnum.PACKET_ROUTER,
                DeviceTypeEnum.PACKET_SWITCH,
                #DeviceTypeEnum.DATACENTER,
                #DeviceTypeEnum.MICROVAWE_RADIO_SYSTEM,
                #DeviceTypeEnum.OPEN_LINE_SYSTEM,
                #DeviceTypeEnum.OPTICAL_ROADM,
                #DeviceTypeEnum.OPTICAL_TRANSPONDER,
                #DeviceTypeEnum.P4_SWITCH,
                #DeviceTypeEnum.PACKET_ROUTER,
                #DeviceTypeEnum.PACKET_SWITCH,
            ],
            FilterFieldEnum.DRIVER: [
                ORM_DeviceDriverEnum.UNDEFINED,
            ],
        },
        {
            # Emulated devices, all drivers => use Emulated
            FilterFieldEnum.DEVICE_TYPE: [
                DeviceTypeEnum.EMULATED_DATACENTER,
                DeviceTypeEnum.EMULATED_MICROVAWE_RADIO_SYSTEM,
                DeviceTypeEnum.EMULATED_OPEN_LINE_SYSTEM,
                DeviceTypeEnum.EMULATED_OPTICAL_ROADM,
                DeviceTypeEnum.EMULATED_OPTICAL_TRANSPONDER,
                DeviceTypeEnum.EMULATED_P4_SWITCH,
                DeviceTypeEnum.EMULATED_PACKET_ROUTER,
                DeviceTypeEnum.EMULATED_PACKET_SWITCH,
            ],
            FilterFieldEnum.DRIVER: [
                ORM_DeviceDriverEnum.UNDEFINED,
                ORM_DeviceDriverEnum.OPENCONFIG,
                ORM_DeviceDriverEnum.TRANSPORT_API,
                ORM_DeviceDriverEnum.P4,
                ORM_DeviceDriverEnum.IETF_NETWORK_TOPOLOGY,
                ORM_DeviceDriverEnum.ONF_TR_352,
            ],
        }
        #{
        #    # Emulated devices, all drivers => use Emulated
        #    FilterFieldEnum.DEVICE_TYPE: [
        #        DeviceTypeEnum.EMULATED_DATACENTER,
        #        DeviceTypeEnum.EMULATED_MICROVAWE_RADIO_SYSTEM,
        #        DeviceTypeEnum.EMULATED_OPEN_LINE_SYSTEM,
        #        DeviceTypeEnum.EMULATED_OPTICAL_ROADM,
        #        DeviceTypeEnum.EMULATED_OPTICAL_TRANSPONDER,
        #        DeviceTypeEnum.EMULATED_P4_SWITCH,
        #        DeviceTypeEnum.EMULATED_PACKET_ROUTER,
        #        DeviceTypeEnum.EMULATED_PACKET_SWITCH,
        #    ],
        #    FilterFieldEnum.DRIVER: [
        #        ORM_DeviceDriverEnum.UNDEFINED,
        #        ORM_DeviceDriverEnum.OPENCONFIG,
        #        ORM_DeviceDriverEnum.TRANSPORT_API,
        #        ORM_DeviceDriverEnum.P4,
        #        ORM_DeviceDriverEnum.IETF_NETWORK_TOPOLOGY,
        #        ORM_DeviceDriverEnum.ONF_TR_352,
        #    ],
        #}
    ]))

if LOAD_ALL_DEVICE_DRIVERS:
+9 −3
Original line number Diff line number Diff line
@@ -36,9 +36,15 @@ def config_getter(root_url, resource_key, timeout):
        context = json.loads(response.content)

        if resource_key == RESOURCE_ENDPOINTS:
            for sip in context['tapi-common:context']['service-interface-point']:
                result.append(
                    ('/endpoints/endpoint[{:s}]'.format(sip['uuid']), {'uuid': sip['uuid'], 'type': '10Gbps'}))
            if 'tapi-common:context' in context:
                context = context['tapi-common:context']
            elif 'context' in context:
                context = context['context']
            for sip in context['service-interface-point']:
                endpoint_type = sip.get('layer-protocol-name', '10Gbps')
                endpoint_url = '/endpoints/endpoint[{:s}]'.format(sip['uuid'])
                endpoint_data = {'uuid': sip['uuid'], 'type': endpoint_type}
                result.append((endpoint_url, endpoint_data))

    return result