get_dhcp_leases returns [] when Kea, ISC and the ARP fallback all fail #27

Closed
opened 2026-10-20 22:28:25 +00:00 by christianmanivong · 0 comments
Owner

Priority: P2 (important and urgent — blocks NetOrk/netork#1189).

get_dhcp_leases() (napalm_opnsense/opnsense.py, ~L1309-1385) tries Kea, then ISC, then the ARP table as a fallback. When all three fail, the last except logs and returns [].

netOrk is changing its poll so that a failed read (None / exception) keeps the stored leases and an empty list means "the server has no leases" and clears them (NetOrk/netork#1189). With the current driver, an outage of the firewall's API during a poll would then delete every stored lease of that firewall.

Fix: raise (e.g. RuntimeError naming all three failures) when no source could be read; return [] only when a source answered and had nothing. Note that Kea/ISC answering [] currently falls through to the ARP fallback — keep that behaviour unless a source answered successfully with no leases and the others failed; document the decision in the docstring.

Found during NetOrk/netork#1189 (2026-10-21).

**Priority: P2** (important and urgent — blocks NetOrk/netork#1189). `get_dhcp_leases()` (`napalm_opnsense/opnsense.py`, ~L1309-1385) tries Kea, then ISC, then the ARP table as a fallback. When all three fail, the last `except` logs and returns `[]`. netOrk is changing its poll so that a failed read (`None` / exception) keeps the stored leases and an empty list means "the server has no leases" and clears them (NetOrk/netork#1189). With the current driver, an outage of the firewall's API during a poll would then delete every stored lease of that firewall. **Fix:** raise (e.g. `RuntimeError` naming all three failures) when no source could be read; return `[]` only when a source answered and had nothing. Note that Kea/ISC answering `[]` currently falls through to the ARP fallback — keep that behaviour unless a source answered successfully with no leases and the others failed; document the decision in the docstring. Found during NetOrk/netork#1189 (2026-10-21).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: NAPALM/napalm-opnsense#27