Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions suzieq/poller/worker/services/bgp.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,18 +324,23 @@ def _clean_nxos_data(self, processed_data, raw_data):
continue

if 'afiSafi' in entry:
afis = entry.get('afiSafi') or []
af_adv = entry.get('afAdvertised') or []
af_rcv = entry.get('afRcvd') or []

entry['afisAdvOnly'] = []
entry['afisRcvOnly'] = []
for i, item in enumerate(entry['afiSafi']):
if entry['afAdvertised'][i] != entry['afRcvd'][i]:
if entry['afAdvertised'][i] == 'true':
entry['afisAdvOnly'].append(entry['afiSafi'])
else:
entry['afisRcvOnly'].append(entry['afiSafi'])

entry.pop('afiSafi')
entry.pop('afAdvertised')
entry.pop('afRcvd')

for i, item in enumerate(afis):
adv = af_adv[i] if i < len(af_adv) else None
rcv = af_rcv[i] if i < len(af_rcv) else None

if adv and rcv and adv != rcv:
entry['afisAdvOnly' if adv == 'true' else 'afisRcvOnly'].append(item)

entry.pop('afiSafi', None)
entry.pop('afAdvertised', None)
entry.pop('afRcvd', None)

rrclient = entry.get('rrclient', [])
if rrclient and 'true' in rrclient:
Expand Down