fix: an unknown ARP age is -1.0, not 0.0 #47
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
|
- 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).
|
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
|
## [0.15.1] - 2026-10-23
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|||||||
@@ -1076,7 +1076,7 @@ class LinuxDriver(
|
|||||||
"interface": m.group(2),
|
"interface": m.group(2),
|
||||||
"mac": m.group(3),
|
"mac": m.group(3),
|
||||||
"ip": m.group(1),
|
"ip": m.group(1),
|
||||||
"age": 0.0,
|
"age": -1.0, # `ip neigh` has no age: unknown, never 0.0 ("just now")
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
return entries
|
return entries
|
||||||
|
|||||||
@@ -169,6 +169,29 @@ def test_get_interfaces_parses_state(driver):
|
|||||||
assert result["eth1"]["is_up"] is False
|
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
|
# get_config
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in new issue
Block a user