fix: an unknown ARP age is -1.0, not 0.0 #9

Merged
christianmanivong merged 1 commits from fix/arp-unknown-age into main 2026-10-30 09:11:36 +00:00
3 changed files with 14 additions and 2 deletions

No files matched your search

+5
View File
@@ -12,6 +12,11 @@ All notable changes to this driver. The format follows
- The floor on napalm is 5.1: older releases import `pkg_resources`, which a Python
3.12 venv no longer has.
### 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": the host
list says a host is active, not when the box last saw it (NetOrk/netork#1327).
## [0.3.0] - 2026-10-23
The first release on PyPI.
+4 -2
View File
@@ -411,7 +411,9 @@ class FritzBoxDriver(ResidentialGatewayDriver):
def get_arp_table(self, vrf: str = "") -> list[dict[str, Any]]:
"""Return the ARP table, derived from :meth:`get_hosts`.
Each entry contains: ``interface``, ``mac``, ``ip``, ``age``.
Each entry contains: ``interface``, ``mac``, ``ip``, ``age``. The host
list says whether a host is active, not when the box last saw it, so
``age`` is ``-1.0`` (unknown, napalm-device-types' ``ARP_AGE_UNKNOWN``).
"""
arp_table: list[dict[str, Any]] = []
for host in self.get_hosts():
@@ -422,7 +424,7 @@ class FritzBoxDriver(ResidentialGatewayDriver):
"interface": host["interface_type"],
"mac": host["mac"],
"ip": host["ip"],
"age": 0.0,
"age": -1.0,
}
)
return arp_table
+5
View File
@@ -440,6 +440,11 @@ class TestGetArpTable:
assert arp_table[0]["mac"] == "11:22:33:44:55:66"
assert arp_table[0]["ip"] == "192.168.1.50"
def test_age_is_unknown(self, driver):
# The host list says a host is active, not when the box last saw it;
# 0.0 would read as "confirmed just now" (NetOrk/netork#1327).
assert [e["age"] for e in driver.get_arp_table()] == [-1.0]
# ---------------------------------------------------------------------------
# get_wan_status()