fix(lldp): read neighbours without starting or reconfiguring lldpd
driver / standard (pull_request) Successful in 15s
driver / lint (pull_request) Successful in 13s
driver / types (pull_request) Successful in 59s
driver / test (3.12) (pull_request) Successful in 1m0s
driver / test (3.13) (pull_request) Successful in 53s
driver / lowest (pull_request) Successful in 24s
driver / build (pull_request) Successful in 30s
driver / security (pull_request) Successful in 56s
CI / driver (pull_request) Successful in 2m19s
driver / publish (pull_request) Skipped

get_lldp_neighbors, which a poll calls every time, enabled and started a
stopped lldpd and rewrote lldpd's interface list with uci, restarting
the daemon. A getter must not change the device. Both LLDP getters now
only run lldpctl; installing and starting lldpd are ensure_package and
manage_service.

Closes #8
This commit is contained in:
Christian Manivong committed 2026-11-01 21:48:31 +01:00
1 parent 5e71f0b471
commit 783a4ee0cb
4 files changed
+39 -41

No files matched your search

+28
View File
@@ -365,6 +365,34 @@ lldp.eth0.port.ifname=ether1
"""
class TestLldpGettersOnlyRead:
"""Reading the neighbours neither starts lldpd nor rewrites its configuration (#8)."""
def _answer(self, driver) -> list:
sent: list = []
def send(cmd, **kw):
sent.append(cmd)
# A default route on a VLAN of another bridge: the old code rewrote
# lldpd's interface list for it and restarted the daemon.
if "ip route" in cmd:
return "br-ap"
if "uci get lldpd" in cmd:
return "br-lan"
return LLDPCTL_KV
driver._send_command = send
return sent
@pytest.mark.parametrize("getter", ["get_lldp_neighbors", "get_lldp_neighbors_detail"])
def test_only_lldpctl_is_asked(self, driver, getter):
sent = self._answer(driver)
getattr(driver, getter)()
assert sent == ["lldpctl -f keyvalue"]
class TestLldpSeveralNeighboursOnOnePort:
"""Each neighbour on a port is its own entry; none is lost (#9)."""