The LLDP getters read lldpd through napalm-device-types' shared parser (NAPALM/napalm-device-types#78) instead of parsing lldpcli show neighbors text:
the node runs LLDPCTL_KEYVALUE_COMMAND (lldpctl -f keyvalue 2>&1; echo __LLDPCTL_RC=$?) through _exec_ssh_command (only called, the transport is unchanged)
parse_lldpctl_keyvalue gives one row per neighbour; lldp_neighbors / lldp_neighbors_detail project them
the floor on napalm-device-types rises to 4.24.0; lldp_mixin is under strict mypy now (dropped from the relaxed list and the baseline, with its 52-line function)
2>/dev/null || true turned every failure (lldpd not running, lldpctl missing, the command not running at all) into "no neighbours". Now a non-zero lldpctl status raises ValueError with lldpctl's message, and an empty answer raises too: the command always prints its exit status, so nothing at all means it never ran. {} only when lldpctl ran and listed nobody.
Capabilities were lldpd's symbols lower-cased (tel, wlan, docsis); they are NAPALM's names now (telephone, wlan-access-point, docsis-cable-device). bridge stays bridge, so _find_switch_uplink keeps finding the switch.
On the way: a neighbour named by its chassis MAC carries mac in get_lldp_neighbors (netOrk matches neighbours by it first), and the detail gains the system description.
For callers: _find_switch_uplink (sdn_mixin.py) already wraps both getters in try/except and falls through to "no uplink found", as with an empty result. netOrk's poll wraps get_lldp_neighbors() in except Exception with a warning (netork/jobs/tasks/poll/_collect.py:108), so a failure is now logged; what is stored does not change.
Tests
Fixtures only. tests/test_lldp.py uses keyvalue output laid out per lldpd's source (two neighbours on eno1, a phone with Tel, a switch, an AP with Wlan); it covers the projections, the capability names, the command sent, lldpctl failing, lldpctl missing and an empty answer. All 13 new or changed tests failed before the change. TestLLDPNeighbors in test_misc.py now feeds keyvalue output through a patched _exec_ssh_command. pytest 505 passed, ruff format --check, ruff check, mypy, napalm-standard ratchet within the baseline, all run against the device-types branch of NAPALM/napalm-device-types#78.
fix/bugs-2026-11-02 (#17) also edits TestLLDPNeighbors.test_empty_when_no_lldp in tests/test_misc.py, so whichever merges second gets a small conflict there. Keep this branch's version: it patches _exec_ssh_command and works with either transport.
CI stays red until NAPALM/napalm-device-types#78 is merged (CI installs napalm-device-types from git main), and the lowest job needs napalm-device-types 4.24.0 on PyPI. Merge order: device-types #78, release 4.24.0, then this.
## What
The LLDP getters read lldpd through napalm-device-types' shared parser (NAPALM/napalm-device-types#78) instead of parsing `lldpcli show neighbors` text:
- the node runs `LLDPCTL_KEYVALUE_COMMAND` (`lldpctl -f keyvalue 2>&1; echo __LLDPCTL_RC=$?`) through `_exec_ssh_command` (only called, the transport is unchanged)
- `parse_lldpctl_keyvalue` gives one row per neighbour; `lldp_neighbors` / `lldp_neighbors_detail` project them
- the floor on napalm-device-types rises to 4.24.0; `lldp_mixin` is under strict mypy now (dropped from the relaxed list and the baseline, with its 52-line function)
## Why (#44)
- `2>/dev/null || true` turned every failure (lldpd not running, lldpctl missing, the command not running at all) into "no neighbours". Now a non-zero lldpctl status raises `ValueError` with lldpctl's message, and an empty answer raises too: the command always prints its exit status, so nothing at all means it never ran. `{}` only when lldpctl ran and listed nobody.
- Capabilities were lldpd's symbols lower-cased (`tel`, `wlan`, `docsis`); they are NAPALM's names now (`telephone`, `wlan-access-point`, `docsis-cable-device`). `bridge` stays `bridge`, so `_find_switch_uplink` keeps finding the switch.
- On the way: a neighbour named by its chassis MAC carries `mac` in `get_lldp_neighbors` (netOrk matches neighbours by it first), and the detail gains the system description.
For callers: `_find_switch_uplink` (`sdn_mixin.py`) already wraps both getters in `try/except` and falls through to "no uplink found", as with an empty result. netOrk's poll wraps `get_lldp_neighbors()` in `except Exception` with a warning (`netork/jobs/tasks/poll/_collect.py:108`), so a failure is now logged; what is stored does not change.
## Tests
Fixtures only. `tests/test_lldp.py` uses keyvalue output laid out per lldpd's source (two neighbours on `eno1`, a phone with `Tel`, a switch, an AP with `Wlan`); it covers the projections, the capability names, the command sent, lldpctl failing, lldpctl missing and an empty answer. All 13 new or changed tests failed before the change. `TestLLDPNeighbors` in `test_misc.py` now feeds keyvalue output through a patched `_exec_ssh_command`. `pytest` 505 passed, `ruff format --check`, `ruff check`, `mypy`, `napalm-standard ratchet` within the baseline, all run against the device-types branch of NAPALM/napalm-device-types#78.
`fix/bugs-2026-11-02` (#17) also edits `TestLLDPNeighbors.test_empty_when_no_lldp` in `tests/test_misc.py`, so whichever merges second gets a small conflict there. Keep this branch's version: it patches `_exec_ssh_command` and works with either transport.
**CI stays red until NAPALM/napalm-device-types#78 is merged** (CI installs napalm-device-types from git main), and the `lowest` job needs napalm-device-types 4.24.0 on PyPI. Merge order: device-types #78, release 4.24.0, then this.
Closes #44
lldpcli's text was read with 2>/dev/null || true, so lldpd not running,
lldpctl missing or the command not running at all came back as a node
without neighbours. Capabilities were lldpd's symbols lower-cased (tel,
wlan, docsis) rather than NAPALM's names.
The node now runs napalm-device-types' LLDPCTL_KEYVALUE_COMMAND, whose
output carries lldpctl's exit status; parse_lldpctl_keyvalue raises on a
failure, an empty answer raises too, and the lldp_neighbors projections
give NAPALM's capability names and the chassis MAC. The module is under
strict mypy now; the floor on napalm-device-types rises to 4.24.0.
Closes#44
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
What
The LLDP getters read lldpd through napalm-device-types' shared parser (NAPALM/napalm-device-types#78) instead of parsing
lldpcli show neighborstext:LLDPCTL_KEYVALUE_COMMAND(lldpctl -f keyvalue 2>&1; echo __LLDPCTL_RC=$?) through_exec_ssh_command(only called, the transport is unchanged)parse_lldpctl_keyvaluegives one row per neighbour;lldp_neighbors/lldp_neighbors_detailproject themlldp_mixinis under strict mypy now (dropped from the relaxed list and the baseline, with its 52-line function)Why (#44)
2>/dev/null || trueturned every failure (lldpd not running, lldpctl missing, the command not running at all) into "no neighbours". Now a non-zero lldpctl status raisesValueErrorwith lldpctl's message, and an empty answer raises too: the command always prints its exit status, so nothing at all means it never ran.{}only when lldpctl ran and listed nobody.tel,wlan,docsis); they are NAPALM's names now (telephone,wlan-access-point,docsis-cable-device).bridgestaysbridge, so_find_switch_uplinkkeeps finding the switch.macinget_lldp_neighbors(netOrk matches neighbours by it first), and the detail gains the system description.For callers:
_find_switch_uplink(sdn_mixin.py) already wraps both getters intry/exceptand falls through to "no uplink found", as with an empty result. netOrk's poll wrapsget_lldp_neighbors()inexcept Exceptionwith a warning (netork/jobs/tasks/poll/_collect.py:108), so a failure is now logged; what is stored does not change.Tests
Fixtures only.
tests/test_lldp.pyuses keyvalue output laid out per lldpd's source (two neighbours oneno1, a phone withTel, a switch, an AP withWlan); it covers the projections, the capability names, the command sent, lldpctl failing, lldpctl missing and an empty answer. All 13 new or changed tests failed before the change.TestLLDPNeighborsintest_misc.pynow feeds keyvalue output through a patched_exec_ssh_command.pytest505 passed,ruff format --check,ruff check,mypy,napalm-standard ratchetwithin the baseline, all run against the device-types branch of NAPALM/napalm-device-types#78.fix/bugs-2026-11-02(#17) also editsTestLLDPNeighbors.test_empty_when_no_lldpintests/test_misc.py, so whichever merges second gets a small conflict there. Keep this branch's version: it patches_exec_ssh_commandand works with either transport.CI stays red until NAPALM/napalm-device-types#78 is merged (CI installs napalm-device-types from git main), and the
lowestjob needs napalm-device-types 4.24.0 on PyPI. Merge order: device-types #78, release 4.24.0, then this.Closes #44