fix(lldp): report the neighbour's chassis MAC
driver / standard (pull_request) Successful in 18s
driver / lint (pull_request) Successful in 28s
driver / types (pull_request) Failing after 30s
driver / test (3.13) (pull_request) Failing after 15s
driver / test (3.12) (pull_request) Failing after 17s
driver / lowest (pull_request) Failing after 18s
driver / build (pull_request) Successful in 35s
driver / security (pull_request) Failing after 40s
CI / driver (pull_request) Failing after 1m41s
driver / publish (pull_request) Skipped

lldpd tells the chassis MAC, but get_lldp_neighbors reported only name
and port, so netOrk, which matches a neighbour by MAC first, could match
OpenWrt's neighbours by name only. napalm-device-types' lldp_neighbors
projection now carries mac (lower case) when the chassis id is a MAC
address, as napalm-linux reports it.

Closes #31
This commit is contained in:
Christian Manivong committed 2026-11-02 08:51:27 +01:00
1 parent aafb5636a9
commit 071beeb68a
3 files changed
+23 -6

No files matched your search

+5 -2
View File
@@ -14,9 +14,10 @@ from __future__ import annotations
from typing import TYPE_CHECKING
from napalm.base.models import LLDPNeighborDetailDict, LLDPNeighborDict
from napalm.base.models import LLDPNeighborDetailDict
from napalm_device_types import (
LLDPCTL_KEYVALUE_COMMAND,
LldpNeighborDict,
LldpNeighborRow,
lldp_neighbors,
lldp_neighbors_detail,
@@ -27,9 +28,11 @@ from napalm_device_types import (
class OpenWrtLLDPMixin:
"""Mixin providing LLDP NAPALM getters."""
def get_lldp_neighbors(self) -> dict[str, list[LLDPNeighborDict]]:
def get_lldp_neighbors(self) -> dict[str, list[LldpNeighborDict]]:
"""Return LLDP neighbors (requires ``lldpd`` installed and running on the device).
A neighbour that names its chassis by a MAC address carries it as ``mac``.
Uses ``lldpctl -f keyvalue`` output::
lldp.eth0.port.ifname=eth1