(iface)
| 488 | |
| 489 | |
| 490 | # -------------------------------------------------------------------------- |
| 491 | # Switch & L2: LLDP/CDP/EDP neighbor discovery + ARP scan |
| 492 | # -------------------------------------------------------------------------- |
| 493 | |
| 494 | def 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 ' |
no test coverage detected