diff --git a/inventory_provider/routes/classifier.py b/inventory_provider/routes/classifier.py index 5e6f2c9d906a95975af360e4d0fb155884070ea8..6a604491242dd778ef6a72c456d1654c1cf016ed 100644 --- a/inventory_provider/routes/classifier.py +++ b/inventory_provider/routes/classifier.py @@ -238,10 +238,11 @@ def peer_info(address): return Response(result, mimetype="application/json") -@routes.route("/infinera-lambda-info/<source_equipment>/<path:interface>", +@routes.route("/infinera-lambda-info/" + "<source_equipment>/<interface>/<circuit_id>", methods=['GET', 'POST']) @common.require_accepts_json -def get_trap_metadata(source_equipment, interface): +def get_trap_metadata(source_equipment, interface, circuit_id): r = common.get_redis() cache_key = 'classifier-cache:infinera:%s:%s' % ( @@ -257,16 +258,12 @@ def get_trap_metadata(source_equipment, interface): 'opsdb:interface_services:%s:%s' % (source_equipment, interface)) if services: result['services'] = json.loads(services.decode('utf=8')) - geant_lambdas = [] - for s in result['services']: - gl = r.get('opsdb:geant_lambdas:%s' % s['name']) - if gl: - t_gl = json.loads(gl.decode('utf=8')) - t_gl['status'] = t_gl['status'].lower() - geant_lambdas.append(t_gl) - - if geant_lambdas: - result['geant-lambdas'] = geant_lambdas + + gl = r.get('opsdb:geant_lambdas:%s' % circuit_id.lower()) + if gl: + t_gl = json.loads(gl.decode('utf=8')) + t_gl['status'] = t_gl['status'].lower() + result['geant-lambda'] = t_gl if not result: return Response(