The LLDP getters use napalm-device-types' shared lldpctl parser and LLDP projections (NAPALM/napalm-device-types#78), and the LLDP and environment getters raise on a failed read. Three commits, one per issue. The floor on napalm-device-types rises to 4.24.0.
The local interface was the second dotted part of the key: the neighbours of eth0.1 came back under eth0 with every field empty. It now runs up to the neighbour's first field.
The remote port was read from port.ifname or port.id.value; lldpd prints a MAC or local port id as port.mac= / port.local= and never prints id.value, so those ports came back empty. The chassis id is read under any type too (chassis.local, chassis.ip).
With the shared projection the detail also carries the system description and capabilities, which were always empty.
lldp_mixin is under strict mypy now (dropped from the relaxed list and the baseline).
lldpctl runs as LLDPCTL_KEYVALUE_COMMAND (lldpctl -f keyvalue 2>&1; echo __LLDPCTL_RC=$?). A non-zero status (lldpctl missing, lldpd not running) raises ValueError with lldpctl's message instead of returning {}; {} now means lldpctl ran and listed nobody.
get_environment() raises ValueError when /proc/stat gives no two readable cpu lines or /proc/meminfo lacks MemTotal/MemAvailable, instead of 0 % CPU and 0 bytes of memory. 0 % stays for counters that did not move. The #10 test that took a single read as 0 % now expects the raise.
For netOrk: the poll calls get_lldp_neighbors() in try/except Exception (netork/jobs/tasks/poll/_collect.py:108), logs a warning and goes on with no neighbours, so a failure is now logged instead of silent. get_environment() is only called for BMC drivers (_bmc.py), not for OpenWrt.
get_lldp_neighbors() carries mac (lower case) when the chassis id is a MAC address, as napalm-linux does. netOrk matches a neighbour by it first (netork/core/lldp_neighbors.py:135). The rule lives in device-types' lldp_neighbors projection (second commit of NAPALM/napalm-device-types#78); here the getter returns its LldpNeighborDict.
Tests
Fixtures only (tests/unit/test_driver.py: TestLldpDottedInterfaceAndPortIds, TestLldpFailedRead, TestGetEnvironmentCpu). The #26 tests and the #27 command and environment tests failed before their commit; the "lldpctl not found raises" cases already passed after the #26 commit, because the shared parser refuses output without a single neighbour line. test_the_chassis_mac_is_reported (#31) failed against the first device-types commit and passes with the second. pytest 239 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.
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 use napalm-device-types' shared lldpctl parser and LLDP projections (NAPALM/napalm-device-types#78), and the LLDP and environment getters raise on a failed read. Three commits, one per issue. The floor on napalm-device-types rises to 4.24.0.
### #26: dotted interface names, port ids by type
- The local interface was the second dotted part of the key: the neighbours of `eth0.1` came back under `eth0` with every field empty. It now runs up to the neighbour's first field.
- The remote port was read from `port.ifname` or `port.id.value`; lldpd prints a MAC or local port id as `port.mac=` / `port.local=` and never prints `id.value`, so those ports came back empty. The chassis id is read under any type too (`chassis.local`, `chassis.ip`).
- With the shared projection the detail also carries the system description and capabilities, which were always empty.
- `lldp_mixin` is under strict mypy now (dropped from the relaxed list and the baseline).
### #27: a failed read raises
- lldpctl runs as `LLDPCTL_KEYVALUE_COMMAND` (`lldpctl -f keyvalue 2>&1; echo __LLDPCTL_RC=$?`). A non-zero status (lldpctl missing, lldpd not running) raises `ValueError` with lldpctl's message instead of returning `{}`; `{}` now means lldpctl ran and listed nobody.
- `get_environment()` raises `ValueError` when `/proc/stat` gives no two readable `cpu` lines or `/proc/meminfo` lacks `MemTotal`/`MemAvailable`, instead of 0 % CPU and 0 bytes of memory. 0 % stays for counters that did not move. The #10 test that took a single read as 0 % now expects the raise.
For netOrk: the poll calls `get_lldp_neighbors()` in `try/except Exception` (`netork/jobs/tasks/poll/_collect.py:108`), logs a warning and goes on with no neighbours, so a failure is now logged instead of silent. `get_environment()` is only called for BMC drivers (`_bmc.py`), not for OpenWrt.
### #31: the neighbour's chassis MAC
`get_lldp_neighbors()` carries `mac` (lower case) when the chassis id is a MAC address, as napalm-linux does. netOrk matches a neighbour by it first (`netork/core/lldp_neighbors.py:135`). The rule lives in device-types' `lldp_neighbors` projection (second commit of NAPALM/napalm-device-types#78); here the getter returns its `LldpNeighborDict`.
## Tests
Fixtures only (`tests/unit/test_driver.py`: `TestLldpDottedInterfaceAndPortIds`, `TestLldpFailedRead`, `TestGetEnvironmentCpu`). The #26 tests and the #27 command and environment tests failed before their commit; the "lldpctl not found raises" cases already passed after the #26 commit, because the shared parser refuses output without a single neighbour line. `test_the_chassis_mac_is_reported` (#31) failed against the first device-types commit and passes with the second. `pytest` 239 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.
**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 #26
Closes #27
Closes #31
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
lldpctl's error text has no "=", so a missing lldpctl or a stopped
lldpd read as a device without neighbours. lldpctl now runs as
napalm-device-types' LLDPCTL_KEYVALUE_COMMAND, which brings its exit
status and message back, and the shared parser raises on a failure.
get_environment swallowed an unreadable /proc/stat or /proc/meminfo
and reported 0 % CPU and 0 bytes of memory, a plausible value instead
of a failure. Both now raise ValueError; 0 % stays for counters that
did not move between the two reads.
Closes#27
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
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 use napalm-device-types' shared lldpctl parser and LLDP projections (NAPALM/napalm-device-types#78), and the LLDP and environment getters raise on a failed read. Three commits, one per issue. The floor on napalm-device-types rises to 4.24.0.
#26: dotted interface names, port ids by type
eth0.1came back undereth0with every field empty. It now runs up to the neighbour's first field.port.ifnameorport.id.value; lldpd prints a MAC or local port id asport.mac=/port.local=and never printsid.value, so those ports came back empty. The chassis id is read under any type too (chassis.local,chassis.ip).lldp_mixinis under strict mypy now (dropped from the relaxed list and the baseline).#27: a failed read raises
LLDPCTL_KEYVALUE_COMMAND(lldpctl -f keyvalue 2>&1; echo __LLDPCTL_RC=$?). A non-zero status (lldpctl missing, lldpd not running) raisesValueErrorwith lldpctl's message instead of returning{};{}now means lldpctl ran and listed nobody.get_environment()raisesValueErrorwhen/proc/statgives no two readablecpulines or/proc/meminfolacksMemTotal/MemAvailable, instead of 0 % CPU and 0 bytes of memory. 0 % stays for counters that did not move. The #10 test that took a single read as 0 % now expects the raise.For netOrk: the poll calls
get_lldp_neighbors()intry/except Exception(netork/jobs/tasks/poll/_collect.py:108), logs a warning and goes on with no neighbours, so a failure is now logged instead of silent.get_environment()is only called for BMC drivers (_bmc.py), not for OpenWrt.#31: the neighbour's chassis MAC
get_lldp_neighbors()carriesmac(lower case) when the chassis id is a MAC address, as napalm-linux does. netOrk matches a neighbour by it first (netork/core/lldp_neighbors.py:135). The rule lives in device-types'lldp_neighborsprojection (second commit of NAPALM/napalm-device-types#78); here the getter returns itsLldpNeighborDict.Tests
Fixtures only (
tests/unit/test_driver.py:TestLldpDottedInterfaceAndPortIds,TestLldpFailedRead,TestGetEnvironmentCpu). The #26 tests and the #27 command and environment tests failed before their commit; the "lldpctl not found raises" cases already passed after the #26 commit, because the shared parser refuses output without a single neighbour line.test_the_chassis_mac_is_reported(#31) failed against the first device-types commit and passes with the second.pytest239 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.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 #26
Closes #27
Closes #31