feat: ARP_AGE_UNKNOWN, the age of a neighbour the device does not report
driver / standard (pull_request) Successful in 17s
driver / lint (pull_request) Successful in 18s
driver / types (pull_request) Successful in 1m12s
driver / test (3.12) (pull_request) Successful in 1m13s
driver / test (3.13) (pull_request) Successful in 1m8s
driver / lowest (pull_request) Successful in 31s
driver / build (pull_request) Successful in 35s
driver / security (pull_request) Successful in 1m15s
CI / driver (pull_request) Successful in 3m3s
driver / publish (pull_request) Skipped

NAPALM requires an age on every entry of get_arp_table and
get_ipv6_neighbors_table. Many devices do not report one, and drivers
filled in 0.0, which means "confirmed just now". ARP_AGE_UNKNOWN (-1.0, as
NAPALM's IOS driver reports) is the value for "not reported"; the README
states the contract.

NetOrk/netork#1327
This commit is contained in:
christianmanivong committed 2026-10-30 08:37:08 +01:00
1 parent 145c2c668b
commit 874c6c5a92
5 files changed
+57

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
"""An ARP or neighbour entry whose age the device does not report says so.
NAPALM's ``get_arp_table`` and ``get_ipv6_neighbors_table`` require an ``age``
on every entry, and a driver that could not read one used to fill in ``0.0``.
To a caller that is the freshest sighting there is: netOrk took a neighbour the
device had not confirmed for hours as seen this second (NetOrk/netork#1327).
Unknown is ``-1.0``, as in NAPALM's own IOS driver; ``0.0`` means "just now".
"""
from __future__ import annotations
from napalm_device_types import ARP_AGE_UNKNOWN
from napalm_device_types.arp import ARP_AGE_UNKNOWN as FROM_MODULE
def test_an_unknown_age_is_minus_one():
assert ARP_AGE_UNKNOWN == -1.0
assert isinstance(ARP_AGE_UNKNOWN, float)
def test_the_package_exports_the_modules_constant():
assert ARP_AGE_UNKNOWN is FROM_MODULE
def test_no_real_age_can_be_mistaken_for_unknown():
# An age is seconds since the entry was last confirmed: never negative.
assert ARP_AGE_UNKNOWN < 0