Skip to content
Snippets Groups Projects
Commit c43dc66b authored by Robert Latta's avatar Robert Latta
Browse files

added epipe sap extraction and mapping. RE.DBOARD3-1104

parent 3ba564ae
No related branches found
No related tags found
No related merge requests found
......@@ -255,6 +255,19 @@ def get_epipes_state(state_doc):
}
def get_epipe_sap_details(netconf_config):
for epipe in netconf_config.xpath('configure/service/epipe'):
service_id = epipe.find('service-id').text
vpn_id = epipe.find('vpn-id').text
sap = epipe.find('sap')
if sap is not None:
yield {
'service-id': service_id,
'vpn-id': vpn_id,
'sap-id': sap.find('sap-id').text,
}
@lru_cache
def get_pxc_ports(netconf_config):
# these ports will be ignored for the purposes of the update
......
......@@ -618,12 +618,32 @@ def _reload_router_config_nokia(
return
r = get_next_redis(InventoryTask.config)
refresh_nokia_interface_list(hostname, netconf_doc, r, lab)
refresh_epipe_to_sap_mappings(hostname, netconf_doc, r)
communities = _nokia_community_strings(InventoryTask.config)
snmp_refresh_interfaces_nokia(hostname, state_doc, communities, r, info_callback)
refresh_nokia_bgp_peers(hostname, netconf_doc)
snmp_refresh_peerings_nokia(hostname, communities)
def refresh_epipe_to_sap_mappings(hostname, netconf, redis):
epipe_to_saps_key_base = f'ims:epipe-sapid_mappings:{hostname}'
# clear cached epipe to sap mappings
logger.debug(f'removing cached epipe to sap mappings for {hostname}')
rp = redis.pipeline()
for k in redis.scan_iter(f'{epipe_to_saps_key_base}:*', count=1000):
rp.delete(k)
rp.execute()
epipe_saps = nokia.get_epipe_sap_details(netconf)
rp = redis.pipeline()
for details in epipe_saps:
key = f'{details["service-id"]}:{details["vpn-id"]}'
rp.set(
f'{epipe_to_saps_key_base}:{key}',
details['sap-id'])
rp.execute()
def snmp_refresh_peerings_nokia(hostname, communities, update_callback=lambda S: None):
get_peerings_func = functools.partial(
snmp.get_peer_state_info_nokia,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment