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

parse netconf interfaces & cache

parent 5b7f7136
No related branches found
No related tags found
No related merge requests found
......@@ -305,6 +305,21 @@ def refresh_interface_address_lookups(hostname, netconf):
juniper.interface_addresses(netconf))
def refresh_juniper_interface_list(hostname, netconf):
logger = logging.getLogger(__name__)
logger.debug(
'removing cached netconf-interfaces for %r' % hostname)
r = get_redis(InventoryTask.config)
for k in r.keys('netconf-interfaces:%s:*' % hostname):
r.delete(k)
for ifc in juniper.list_interfaces(netconf):
r.set(
'netconf-interfaces:%s:%s' % (hostname, ifc['name']),
json.dumps(ifc))
@app.task(base=InventoryTask, bind=True)
def reload_router_config(self, hostname):
logger = logging.getLogger(__name__)
......@@ -359,6 +374,7 @@ def reload_router_config(self, hostname):
refresh_ix_public_peers(hostname, netconf_doc)
refresh_vpn_rr_peers(hostname, netconf_doc)
refresh_interface_address_lookups(hostname, netconf_doc)
refresh_juniper_interface_list(hostname, netconf_doc)
clear_cached_classifier_responses(hostname)
# load snmp indexes
......
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