LLDP: interface names with a dot are split, and a port id given as MAC or local id is lost #26

Closed
opened 2026-11-01 21:44:46 +00:00 by christianmanivong · 0 comments
Owner

What happens

_get_lldp_table (napalm_openwrt/lldp_mixin.py ~80-101), in addition to #9 (neighbours on one port collapse):

  1. The local interface is the second dot-separated part of the key (line 92: iface = parts[1]). For lldp.eth0.1.port.ifname=… (swconfig VLAN interfaces such as eth0.1 are common on OpenWrt) the interface becomes eth0 and the subkey 1.port.ifname, so none of the fields is found.
  2. The remote port is read as (line 101)
    "port_id": data.get("port.ifname", data.get("port.id.value", "")),
    
    lldpctl's keyvalue output names the id by its type (chassis.mac= in the recorded output, tests/unit/test_driver.py:109), so a neighbour whose port id is a MAC or a locally assigned id prints port.mac= / port.local=, and port.id.value never exists: the port comes back empty. (The chassis id is read from chassis.mac first and is fine for MAC ids; chassis.local/chassis.ip are not read.)

Expected

The interface name is everything between lldp. and the first known category (via, rid, age, chassis, port, vlan, ppvid, pi, lldp-med, …); port and chassis ids are read from whichever of ifname/mac/local/ip is present. Test-first: keyvalue lines for eth0.1 and a neighbour with port.mac=. The parser is to move to napalm-unix (NAPALM/napalm-device-types#35, see #13), where #9, this and the napalm-linux twin can be fixed once.

Priority: P4 — affects neighbours on dotted interfaces and neighbours that send a non-ifname port id.

Found during the bug sweep of 2026-11-01.

## What happens `_get_lldp_table` (`napalm_openwrt/lldp_mixin.py` ~80-101), in addition to #9 (neighbours on one port collapse): 1. The local interface is the second dot-separated part of the key (line 92: `iface = parts[1]`). For `lldp.eth0.1.port.ifname=…` (swconfig VLAN interfaces such as `eth0.1` are common on OpenWrt) the interface becomes `eth0` and the subkey `1.port.ifname`, so none of the fields is found. 2. The remote port is read as (line 101) ```python "port_id": data.get("port.ifname", data.get("port.id.value", "")), ``` lldpctl's keyvalue output names the id by its type (`chassis.mac=` in the recorded output, `tests/unit/test_driver.py:109`), so a neighbour whose port id is a MAC or a locally assigned id prints `port.mac=` / `port.local=`, and `port.id.value` never exists: the port comes back empty. (The chassis id is read from `chassis.mac` first and is fine for MAC ids; `chassis.local`/`chassis.ip` are not read.) ## Expected The interface name is everything between `lldp.` and the first known category (`via`, `rid`, `age`, `chassis`, `port`, `vlan`, `ppvid`, `pi`, `lldp-med`, …); port and chassis ids are read from whichever of `ifname`/`mac`/`local`/`ip` is present. Test-first: keyvalue lines for `eth0.1` and a neighbour with `port.mac=`. The parser is to move to napalm-unix (NAPALM/napalm-device-types#35, see #13), where #9, this and the napalm-linux twin can be fixed once. Priority: P4 — affects neighbours on dotted interfaces and neighbours that send a non-ifname port id. Found during the bug sweep of 2026-11-01.
christianmanivong added the
prio
P4
bug
labels 2026-11-01 21:44:46 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: NAPALM/napalm-openwrt#26