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

add reverse ip lookups to cache

parent 46040596
No related branches found
No related tags found
No related merge requests found
......@@ -292,6 +292,22 @@ def vpn_rr_peers(netconf_config):
neighbor['peer-as'] = int(r.find('peer-as').text)
yield neighbor
def interface_addresses(netconf_config):
"""
yields a list of all distinct interface addresses
:param netconf_config:
:return:
"""
for ifc in list_interfaces(netconf_config):
for address in ifc['ipv4'] + ifc['ipv6']:
yield {
"name": ipaddress.ip_interface(address).ip.exploded,
"interface address": address,
"interface name": ifc['name']
}
# note for enabling vrr data parsing ...
# def fetch_vrr_config(hostname, ssh_params):
#
......
......@@ -298,6 +298,13 @@ def refresh_vpn_rr_peers(hostname, netconf):
juniper.vpn_rr_peers(netconf))
def refresh_interface_address_lookups(hostname, netconf):
_refresh_peers(
hostname,
'reverse_interface_addresses',
juniper.interface_addresses(netconf))
@app.task(base=InventoryTask, bind=True)
def reload_router_config(self, hostname):
logger = logging.getLogger(__name__)
......@@ -351,6 +358,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)
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