fix(getters): raise on a failed LLDP or environment read
driver / standard (pull_request) Successful in 18s
driver / lint (pull_request) Successful in 21s
driver / types (pull_request) Failing after 6s
driver / test (3.12) (pull_request) Failing after 17s
driver / test (3.13) (pull_request) Failing after 15s
driver / lowest (pull_request) Failing after 6s
driver / build (pull_request) Successful in 33s
driver / security (pull_request) Failing after 38s
CI / driver (pull_request) Failing after 1m36s
driver / publish (pull_request) Skipped

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
This commit is contained in:
Christian Manivong committed 2026-11-02 08:47:15 +01:00
1 parent 231def768e
commit aafb5636a9
5 files changed
+111 -32

No files matched your search

+6
View File
@@ -35,6 +35,12 @@ recorded here; their history is the git log.
chassis named by a local id or an address with that id. The detail now also
carries the neighbour's system description and capabilities, which were always
empty. lldpd's output is parsed by napalm-device-types' shared parser.
- `get_lldp_neighbors()` and `get_lldp_neighbors_detail()` raise when lldpctl fails
(not installed, lldpd not running or unreachable), with lldpctl's message; they used
to return no neighbours, the same answer as a device without any (#27). An empty
result now means lldpctl ran and listed none. `get_environment()` raises when
`/proc/stat` or `/proc/meminfo` cannot be read or parsed, instead of reporting 0 %
CPU and 0 bytes of memory.
- `get_arp_table()` reports an unknown age as `-1.0` (napalm-device-types'
`ARP_AGE_UNKNOWN`) instead of `0.0`, which means "confirmed just now": neither
`ip neigh` nor `/proc/net/arp` has an age (NetOrk/netork#1327).