Skip to content
Snippets Groups Projects
Commit 5d845478 authored by Erik Reid's avatar Erik Reid
Browse files

use new snmp-interfaces cache format

parent 3d9f3f20
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment