MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / _iface_addrs

Function _iface_addrs

network_diagnostics.py:490–503  ·  view source on GitHub ↗
(iface)

Source from the content-addressed store, hash-verified

488
489
490# --------------------------------------------------------------------------
491# Switch & L2: LLDP/CDP/EDP neighbor discovery + ARP scan
492# --------------------------------------------------------------------------
493
494def do_lldp(interface=None):
495 """Return discovered switch neighbors via lldpctl. lldpd (configured with
496 -c -e -f -s) also decodes CDPv1/v2 (Cisco), EDP (Extreme), FDP (Foundry)
497 and SONMP (Nortel) in addition to LLDP. VLAN id/name are included when the
498 neighbor advertises them.
499
500 `interface` limits discovery to one local port; '' / None reports every
501 interface (the default). On a multi-homed box — a Ragnar with a LAN cable,
502 a USB NIC and WiFi — that is the difference between "which switch am I
503 plugged into on *this* port" and a merged list you have to eyeball."""
504 if not _have('lldpctl'):
505 return {'success': False,
506 'error': 'lldpd/lldpctl is not installed. Click Install to add it '

Callers 2

_local_ipv4_addrsFunction · 0.85
do_interfacesFunction · 0.85

Calls 2

_runFunction · 0.85
appendMethod · 0.80

Tested by

no test coverage detected