diff --git a/inventory_provider/routes/classifier.py b/inventory_provider/routes/classifier.py index 40a20f3777ed2aa5ff8746cc19aea8561ff74aad..5a7dd631009b36ab77171669b576f4f3f76041b2 100644 --- a/inventory_provider/routes/classifier.py +++ b/inventory_provider/routes/classifier.py @@ -618,9 +618,8 @@ def get_trap_metadata(source_equipment: str, interface: str, circuit_id: str) \ result = _ignore_cache_or_retrieve(request, cache_key, r) if not result: - result = { - 'locations': [] - } + + result = {} result.update(get_interface_services_and_loc( ims_source_equipment, @@ -628,6 +627,30 @@ def get_trap_metadata(source_equipment: str, interface: str, circuit_id: str) \ r )) + # rubbish hack to cope with Dashboard Classifier removing piece of + # interface name. Once Dashboard is fully driven by IMS we can remove that # noqa + # part of the classifier and then this + # As of 2021-04-21 the Dashboard line that will need removing is + # https://gitlab.geant.net/live-projects/dashboardv3/dashboard-v3-python/-/blob/develop/dashboard/classification/classifier.py#L207 # noqa + if not result or not result.get('services', []): + interface_parts = interface.split('-') + interface_parts[-2] = 'T' + interface_parts[-2] + t_interface = '-'.join(interface_parts) + result.update(get_interface_services_and_loc( + ims_source_equipment, + t_interface, + r + )) + if not result or not result.get('services', []): + interface_parts = interface.split('-') + interface_parts[-1] = 'T' + interface_parts[-1] + t_interface = '-'.join(interface_parts) + result.update(get_interface_services_and_loc( + ims_source_equipment, + t_interface, + r + )) + if not result: return Response( response="no available info for {} {}".format( diff --git a/inventory_provider/routes/classifier_schema.py b/inventory_provider/routes/classifier_schema.py index e4e9e0d1068e829017b3e5ae5c51ee18a0f7c555..fe2ed7c7f761667d666d87fe775bec9bb76459ff 100644 --- a/inventory_provider/routes/classifier_schema.py +++ b/inventory_provider/routes/classifier_schema.py @@ -541,7 +541,11 @@ INFINERA_LAMBDA_INFO_RESPONSE_SCHEMA = { "geant-lambda": { "$ref": "#/definitions/geant-lambda" }, - "locations": {"$ref": "#/definitions/locations-list"} + "locations": {"$ref": "#/definitions/locations-list"}, + "contacts": { + "type": "array", + "items": {"type": "string"} + } }, "additionalProperties": False }