From 3d9f3f204a20ea37f2ab4f3ffc553f5f18062fea Mon Sep 17 00:00:00 2001 From: Erik Reid <erik.reid@geant.org> Date: Thu, 27 Jun 2019 17:21:16 +0200 Subject: [PATCH] use new snmp-interfaces cache format --- inventory_provider/routes/poller.py | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/inventory_provider/routes/poller.py b/inventory_provider/routes/poller.py index a48de48b..bb0b44c8 100644 --- a/inventory_provider/routes/poller.py +++ b/inventory_provider/routes/poller.py @@ -32,17 +32,7 @@ def poller_interface_oids(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' - - snmp_indexes = dict([ - (_ifc_name(ifc), int(ifc['index'])) for ifc in - json.loads(snmp_data_string.decode('utf-8')) - ]) + snmp_indexes = json.loads(snmp_data_string.decode('utf-8')) interfaces = list(juniper.list_interfaces( etree.XML(netconf_string.decode('utf-8')))) -- GitLab