diff --git a/inventory_provider/routes/classifier.py b/inventory_provider/routes/classifier.py index 027a47bf7f202bbf45a1f1a0f530e7ef90204073..0f271d713a450989f00a6178a543eed765fcaa68 100644 --- a/inventory_provider/routes/classifier.py +++ b/inventory_provider/routes/classifier.py @@ -658,6 +658,20 @@ def get_trap_metadata(source_equipment: str, interface: str, circuit_id: str) \ t_interface, r )) + if result: + order = ['operational', 'installed', 'planned'] + gl = list(filter( + lambda x: x['service_type'] == 'GEANT LAMBDA' + and x['status'] in order, + result.get('services', []))) + if gl: + gl.sort(key=lambda x: order.index(x['status'])) + result['geant-lambda'] = { + 'id': gl[0]['id'], + 'name': gl[0]['name'], + 'status': gl[0]['status'], + 'project': gl[0]['project'] + } if not result: return Response(