diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b30500..068954f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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`. diff --git a/napalm_netgear/netgear_smart.py b/napalm_netgear/netgear_smart.py index 915d21f..395916a 100644 --- a/napalm_netgear/netgear_smart.py +++ b/napalm_netgear/netgear_smart.py @@ -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") } ) diff --git a/tests/unit/test_driver.py b/tests/unit/test_driver.py index d684dbe..cbc6586 100644 --- a/tests/unit/test_driver.py +++ b/tests/unit/test_driver.py @@ -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