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

save peerings per router

parent 6b458152
No related branches found
No related tags found
No related merge requests found
...@@ -96,7 +96,7 @@ def snmp_refresh_peerings(self, hostname, community, logical_systems): ...@@ -96,7 +96,7 @@ def snmp_refresh_peerings(self, hostname, community, logical_systems):
logger.exception(msg) logger.exception(msg)
self.log_warning(msg) self.log_warning(msg)
r = get_current_redis(InventoryTask.config) r = get_current_redis(InventoryTask.config)
peerings = r.get(f'snmp-peerings:{hostname}') peerings = r.get(f'snmp-peerings:{hostname}:all')
if peerings is None: if peerings is None:
raise InventoryTaskError( raise InventoryTaskError(
f'snmp error with {peerings}' f'snmp error with {peerings}'
...@@ -108,10 +108,12 @@ def snmp_refresh_peerings(self, hostname, community, logical_systems): ...@@ -108,10 +108,12 @@ def snmp_refresh_peerings(self, hostname, community, logical_systems):
r = get_next_redis(InventoryTask.config) r = get_next_redis(InventoryTask.config)
rp = r.pipeline() rp = r.pipeline()
rp.set(f'snmp-peerings:{hostname}', json.dumps(peerings)) rp.set(f'snmp-peerings:{hostname}:all', json.dumps(peerings))
for session in peerings: for session in peerings:
rp.set(f'snmp-peerings:{session["remote"]}', json.dumps(session)) rp.set(
f'snmp-peerings:{hostname}:{session["remote"]}',
json.dumps(session))
rp.execute() rp.execute()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment