diff --git a/src/device/service/drivers/__init__.py b/src/device/service/drivers/__init__.py index 5fe786667840916a2cbe780e518102ce1c0858ca..535b553a81c24ea12c4b9fefc1563541e45f77fa 100644 --- a/src/device/service/drivers/__init__.py +++ b/src/device/service/drivers/__init__.py @@ -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: diff --git a/src/device/service/drivers/transport_api/Tools.py b/src/device/service/drivers/transport_api/Tools.py index 8f18c56b3ac6ae79ead86199c56486cf9c00eae4..6faee37ce540443b982b523239e37a2edc779659 100644 --- a/src/device/service/drivers/transport_api/Tools.py +++ b/src/device/service/drivers/transport_api/Tools.py @@ -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