fix: an unknown ARP age is -1.0, not 0.0
driver / standard (pull_request) Successful in 16s
driver / lint (pull_request) Successful in 14s
driver / test (3.12) (pull_request) Successful in 1m1s
driver / types (pull_request) Successful in 1m7s
driver / test (3.13) (pull_request) Successful in 57s
driver / lowest (pull_request) Successful in 30s
driver / build (pull_request) Successful in 30s
driver / security (pull_request) Successful in 1m7s
CI / driver (pull_request) Successful in 2m42s
driver / publish (pull_request) Skipped

get_arp_table on Smart switches wrote 0.0 ("confirmed just now") and
ignored the "Age (min)" column of show arp. It now reports ARP_AGE_UNKNOWN;
parsing the column waits for real switch output, since the docstring
example and the test fixture are not taken from a switch.

NetOrk/netork#1327
This commit is contained in:
Christian Manivong committed 2026-10-30 08:37:08 +01:00
1 parent c4facc1105
commit 7b179383c6
3 files changed
+16 -3

No files matched your search

+7
View File
@@ -322,6 +322,13 @@ class TestGetArpTable:
# napalm_helpers.mac normalises to "AA:BB:CC:DD:EE:FF" format
assert any(":" in mac for mac in macs)
def test_age_is_unknown(self, driver):
"""The "Age (min)" column is not parsed yet (the fixture is not real switch
output), so the age is unknown: -1.0, never 0.0, which reads as "just now"
to a caller that ranks sightings by freshness (NetOrk/netork#1327)."""
driver._send_command = lambda cmd: SHOW_ARP
assert [e["age"] for e in driver.get_arp_table()] == [-1.0, -1.0]
# ---------------------------------------------------------------------------
# Tests: get_mac_address_table