From c3f2535499de45c84864e4f27ceac266cc699308 Mon Sep 17 00:00:00 2001 From: Robert Latta <robert.latta@geant.org> Date: Wed, 28 Apr 2021 11:49:54 +0000 Subject: [PATCH] added geant-lamda info to endpoint --- inventory_provider/routes/classifier.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/inventory_provider/routes/classifier.py b/inventory_provider/routes/classifier.py index 027a47bf..0f271d71 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( -- GitLab