From 5d84547818f66d0680f8ffcb132cc074a3e654b6 Mon Sep 17 00:00:00 2001 From: Erik Reid <erik.reid@geant.org> Date: Thu, 27 Jun 2019 17:21:41 +0200 Subject: [PATCH] use new snmp-interfaces cache format --- inventory_provider/routes/testing.py | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/inventory_provider/routes/testing.py b/inventory_provider/routes/testing.py index 5362f4a9..2ee9da12 100644 --- a/inventory_provider/routes/testing.py +++ b/inventory_provider/routes/testing.py @@ -153,24 +153,8 @@ def bgp_configs(hostname): def snmp_ids(hostname): r = common.get_redis() ifc_data_string = r.get('snmp-interfaces:' + hostname) - if not ifc_data_string: - return Response( - response="no available info for '%s'" % hostname, - status=404, - mimetype="text/html") - - def _ifc_name(ifc): - if 'v4InterfaceName' in ifc: - return ifc['v4InterfaceName'] - if 'v6InterfaceName' in ifc: - return ifc['v6InterfaceName'] - assert False, "sanity failure: no interface name found" - ifc_data = json.loads(ifc_data_string.decode('utf-8')) - result = [ - {'index': i['index'], 'name': _ifc_name(i)} - for i in ifc_data] - return jsonify(result) + return jsonify(ifc_data) # TODO: remove all alarmsdb i/o, and then remove the following -- GitLab