fix(lldp): keep dotted interface names and read every id type

The local interface was the second dotted part of the key, so the
neighbours of eth0.1 landed under eth0 with every field missed. The
remote port was read from port.ifname or port.id.value, and lldpd
prints a port given by MAC or local id as port.mac / port.local, never
as id.value, so that port came back empty.

lldpd's output now goes through napalm-device-types'
parse_lldpctl_keyvalue and its two NAPALM projections, which keep the
interface name up to the neighbour's first field and read the ids under
whatever type lldpd prints. The detail gains the system description and
capabilities on the way. The module is under strict mypy now; the floor
on napalm-device-types rises to 4.24.0.

Closes #26
This commit is contained in:
Christian Manivong committed 2026-11-02 08:45:51 +01:00
1 parent d04a969eb1
commit 231def768e
5 files changed
+92 -73

No files matched your search

+9 -1
View File
@@ -15,7 +15,8 @@ recorded here; their history is the git log.
to do on every poll (#8). Needs napalm-device-types with `LldpAgentMixin`.
### Changed
- The floor on napalm-device-types is 4.23.0, the first release with what this driver uses.
- The floor on napalm-device-types is 4.24.0, the first release with what this driver
uses (its shared `lldpctl` parser).
- Python 3.12 is the floor (`requires-python = ">=3.12"`): netOrk runs every driver
on 3.12, so 3.10 and 3.11 are no longer tested (NAPALM/driver-standard#6).
- The floor on napalm is 5.1: older releases import `pkg_resources`, which a Python
@@ -27,6 +28,13 @@ recorded here; their history is the git log.
`manage_service("lldpd", "enable")` and `manage_service("lldpd", "start")` (#8).
### Fixed
- `get_lldp_neighbors()` and `get_lldp_neighbors_detail()` keep an interface name with
a dot whole: the neighbours of a VLAN interface such as `eth0.1` used to come back
under `eth0` with every field empty (#26). A neighbour that names its port by MAC
address or a local id is reported with that port instead of an empty one, and a
chassis named by a local id or an address with that id. The detail now also
carries the neighbour's system description and capabilities, which were always
empty. lldpd's output is parsed by napalm-device-types' shared parser.
- `get_arp_table()` reports an unknown age as `-1.0` (napalm-device-types'
`ARP_AGE_UNKNOWN`) instead of `0.0`, which means "confirmed just now": neither
`ip neigh` nor `/proc/net/arp` has an age (NetOrk/netork#1327).