fix: an unknown ARP age is -1.0, not 0.0 #17
No files matched your search
@@ -12,6 +12,12 @@ 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()` on Smart switches reports the age as `-1.0` (unknown,
|
||||
napalm-device-types' `ARP_AGE_UNKNOWN`) instead of `0.0`, which means "confirmed
|
||||
just now". The "Age (min)" column of `show arp` is not parsed until real switch
|
||||
output confirms its format (NetOrk/netork#1327).
|
||||
|
||||
## [0.6.0] - 2026-10-23
|
||||
|
||||
The first release on PyPI, under the new name `napalm-netgear-switches`.
|
||||
|
||||
@@ -894,9 +894,9 @@ class NetgearSmartDriver(ConfigLifecycleMixin, SnmpAgentMixin, SwitchDriver):
|
||||
return configs
|
||||
|
||||
def get_arp_table(self, vrf: str = "") -> list[dict]:
|
||||
"""Return the ARP table.
|
||||
"""Return the ARP table. ``age`` is -1.0 (napalm-device-types' ``ARP_AGE_UNKNOWN``).
|
||||
|
||||
Example ``show arp`` output::
|
||||
Example ``show arp`` output (not from a real switch: "Age (min)" waits for one)::
|
||||
|
||||
IP Address MAC Address Interface Age (min) Type
|
||||
--------- ---------------- --------- --------- -------
|
||||
@@ -940,7 +940,7 @@ class NetgearSmartDriver(ConfigLifecycleMixin, SnmpAgentMixin, SwitchDriver):
|
||||
"interface": interface,
|
||||
"mac": mac_addr,
|
||||
"ip": ip_addr,
|
||||
"age": 0.0,
|
||||
"age": -1.0, # unknown, never 0.0 ("just now")
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user