Merge pull request 'fix: an unknown ARP age is -1.0, not 0.0' (#47) from fix/arp-unknown-age into main
driver / standard (push) Successful in 18s
driver / lint (push) Successful in 16s
driver / types (push) Successful in 1m8s
driver / test (3.12) (push) Successful in 1m8s
driver / test (3.13) (push) Successful in 1m2s
driver / lowest (push) Successful in 37s
driver / build (push) Successful in 33s
driver / security (push) Successful in 1m20s
CI / driver (push) Successful in 2m55s
driver / publish (push) Skipped
driver / standard (push) Successful in 18s
driver / lint (push) Successful in 16s
driver / types (push) Successful in 1m8s
driver / test (3.12) (push) Successful in 1m8s
driver / test (3.13) (push) Successful in 1m2s
driver / lowest (push) Successful in 37s
driver / build (push) Successful in 33s
driver / security (push) Successful in 1m20s
CI / driver (push) Successful in 2m55s
driver / publish (push) Skipped
This commit was merged in pull request #47.
This commit is contained in:
commit
4cd1710e19
3 files changed
+29
-1
No files matched your search
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in new issue
Block a user