fix: an unknown ARP age is -1.0, not 0.0
driver / standard (pull_request) Successful in 18s
driver / lint (pull_request) Successful in 13s
driver / types (pull_request) Successful in 1m14s
driver / test (3.12) (pull_request) Successful in 1m14s
driver / test (3.13) (pull_request) Successful in 1m6s
driver / lowest (pull_request) Successful in 31s
driver / build (pull_request) Successful in 32s
driver / security (pull_request) Successful in 1m9s
CI / driver (pull_request) Successful in 2m54s
driver / publish (pull_request) Skipped

ip neigh has no age, and a STALE entry may be hours old, so get_arp_table
reports ARP_AGE_UNKNOWN instead of 0.0 ("confirmed just now").

NetOrk/netork#1327
This commit is contained in:
Christian Manivong committed 2026-10-30 08:37:08 +01:00
1 parent 2ffad23bf0
commit 05cef25e9b
3 files changed
+29 -1

No files matched your search

+5
View File
@@ -19,6 +19,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Python 3.12 is the floor (`requires-python = ">=3.12"`): netOrk runs every driver
on 3.12, so 3.10 and 3.11 are no longer tested (NAPALM/driver-standard#6).
### Fixed
- `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": `ip neigh`
has no age, and a STALE entry may be hours old (NetOrk/netork#1327).
## [0.15.1] - 2026-10-23
### Fixed
+1 -1
View File
@@ -1076,7 +1076,7 @@ class LinuxDriver(
"interface": m.group(2),
"mac": m.group(3),
"ip": m.group(1),
"age": 0.0,
"age": -1.0, # `ip neigh` has no age: unknown, never 0.0 ("just now")
}
)
return entries
+23
View File
@@ -169,6 +169,29 @@ def test_get_interfaces_parses_state(driver):
assert result["eth1"]["is_up"] is False
# ---------------------------------------------------------------------------
# get_arp_table
# ---------------------------------------------------------------------------
IP_NEIGH_OUTPUT = """\
192.168.1.1 dev eth0 lladdr aa:bb:cc:dd:ee:01 REACHABLE
192.168.1.20 dev eth0 lladdr aa:bb:cc:dd:ee:02 STALE
"""
def test_get_arp_table_reports_no_age(driver):
"""`ip neigh show` says nothing about when a neighbour was last confirmed --
a STALE entry may be hours old. 0.0 would read as "just now" to a caller
that ranks sightings by freshness (NetOrk/netork#1327)."""
with patch.object(driver, "_send", return_value=IP_NEIGH_OUTPUT):
result = driver.get_arp_table()
assert [(e["ip"], e["age"]) for e in result] == [
("192.168.1.1", -1.0),
("192.168.1.20", -1.0),
]
# ---------------------------------------------------------------------------
# get_config
# ---------------------------------------------------------------------------