2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-01-12 10:49:17 +00:00

Ignore broken lldp results

Some switches may have broken incomplete records,
skip such records to focus on viable complete records.
This commit is contained in:
Jarrod Johnson 2021-09-16 15:49:36 -04:00
parent f881f955d4
commit 1b88e44c59

View File

@ -239,22 +239,30 @@ def _extract_neighbor_data_b(args):
idxtoifname[idx] = _lldpdesc_to_ifname(sid, idx, str(oidindex[1]))
for remotedesc in conn.walk('1.0.8802.1.1.2.1.4.1.1.10'):
iname = idxtoifname.get(remotedesc[0][-2],
idxtoportid[remotedesc[0][-2]])
idxtoportid.get(remotedesc[0][-2], None))
if iname is None:
continue
_init_lldp(lldpdata, iname, remotedesc[0][-2], idxtoportid, switch)
_extract_extended_desc(lldpdata[iname], remotedesc[1], user)
for remotename in conn.walk('1.0.8802.1.1.2.1.4.1.1.9'):
iname = idxtoifname.get(remotename[0][-2],
idxtoportid[remotename[0][-2]])
idxtoportid.get(remotename[0][-2], None))
if iname is None:
continue
_init_lldp(lldpdata, iname, remotename[0][-2], idxtoportid, switch)
lldpdata[iname]['peername'] = str(remotename[1])
for remotename in conn.walk('1.0.8802.1.1.2.1.4.1.1.7'):
iname = idxtoifname.get(remotename[0][-2],
idxtoportid[remotename[0][-2]])
idxtoportid.get(remotename[0][-2], None))
if iname is None:
continue
_init_lldp(lldpdata, iname, remotename[0][-2], idxtoportid, switch)
lldpdata[iname]['peerportid'] = sanitize(remotename[1])
for remoteid in conn.walk('1.0.8802.1.1.2.1.4.1.1.5'):
iname = idxtoifname.get(remoteid[0][-2],
idxtoportid[remoteid[0][-2]])
idxtoportid.get(remoteid[0][-2], None))
if iname is None:
continue
_init_lldp(lldpdata, iname, remoteid[0][-2], idxtoportid, switch)
lldpdata[iname]['peerchassisid'] = sanitize(remoteid[1])
for entry in lldpdata: