fix: an unknown ARP age is -1.0, not 0.0 #23
No files matched your search
@@ -13,6 +13,11 @@ recorded here; their history is the git log.
|
||||
- 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": neither
|
||||
`ip neigh` nor `/proc/net/arp` has an age (NetOrk/netork#1327).
|
||||
|
||||
## [0.7.0] - 2026-10-23
|
||||
|
||||
The first release on PyPI.
|
||||
|
||||
@@ -234,7 +234,7 @@ class OpenWrtInterfaceMixin:
|
||||
"interface": interface,
|
||||
"mac": mac_addr,
|
||||
"ip": ip_addr,
|
||||
"age": 0.0,
|
||||
"age": -1.0, # no age reported: unknown, never 0.0 ("just now")
|
||||
}
|
||||
)
|
||||
continue
|
||||
@@ -267,7 +267,7 @@ class OpenWrtInterfaceMixin:
|
||||
"interface": interface,
|
||||
"mac": mac_addr,
|
||||
"ip": ip_addr,
|
||||
"age": 0.0,
|
||||
"age": -1.0, # no age reported: unknown, never 0.0 ("just now")
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -274,6 +274,19 @@ class TestGetArpTable:
|
||||
assert "192.168.1.100" in ips
|
||||
assert "192.168.1.101" in ips
|
||||
|
||||
def test_ip_neigh_reports_no_age(self, driver):
|
||||
# REACHABLE or STALE, `ip neigh` says nothing about when the neighbour
|
||||
# was last confirmed; 0.0 would read as "just now" (NetOrk/netork#1327).
|
||||
driver._send_command = lambda cmd, **kw: IP_NEIGH_SHOW
|
||||
assert {e["age"] for e in driver.get_arp_table()} == {-1.0}
|
||||
|
||||
def test_proc_net_arp_reports_no_age(self, driver):
|
||||
driver._send_command = lambda cmd, **kw: (
|
||||
"IP address HW type Flags HW address Mask Device\n"
|
||||
"192.168.1.100 0x1 0x2 aa:bb:cc:dd:ee:ff * br-lan\n"
|
||||
)
|
||||
assert [e["age"] for e in driver.get_arp_table()] == [-1.0]
|
||||
|
||||
|
||||
class TestGetMacAddressTable:
|
||||
def test_returns_list(self, driver):
|
||||
|
||||
Reference in new issue
Block a user