feat(access-point): declared AP writes and a DHCP lease reader, 4.54.0 (NetOrk/netork#695) #142

Merged
christianmanivong merged 4 commits from feature/ap-dhcp-contracts-695 into main 2026-11-29 22:03:14 +00:00
Owner

Declares an access point's writes and a DHCP lease reader, so that an application no longer builds UCI itself (NetOrk/netork#695). The contract is the one decided on 2026-11-07 (NetOrk/netork#695, comment 27096). This is the 4.54.0 release.

Added

  • WirelessWritesMixin, on AccessPointDriver and ResidentialGatewayDriver:
    • push_ssid_config(ssid, SsidConfigDict), a partial write (encryption, key, hidden, enabled, disassoc_low_ack, max_inactivity);
    • set_radio_channels({radio: channel}): every radio in one go, with one restart of the wireless stack; AUTO_CHANNEL (0) lets a radio choose.
  • AccessPointDriver.set_vlan_name(vlan_id, name) -> bool: a narrow write instead of the switch's set_vlan.
  • ApConfigMixin.apply_ap_config(ApConfigDict, parts) -> ApConfigResultDict, on AccessPointDriver. It takes the AP's desired state in vendor-neutral terms (ApSsidConfigDict per SSID); the driver writes the parts the caller found different. The part names and their I/O-free readers are AP_CONFIG_PARTS, AP_CONFIG_SSID_ATTRIBUTES, ap_config_ssid_part, ap_config_vlan_part and is_ap_config_part.
  • DhcpLeasesMixin.get_dhcp_leases() -> list[DhcpLeaseDict], apart from DhcpServerMixin, so that an access point can report the leases it serves. A failed read raises.
  • UpdateMixin.apply_updates(packages, *, log=None): an optional keyword-only line callback, for NetOrk/netork#1112 (napalm-bsd).

All new methods are declared under TYPE_CHECKING, so callable(getattr(driver, name, None)) stays truthful. The new TypedDicts live in access_point_models and dhcp_leases, not in models.py, which stays within its ratchet size. Drivers that already have get_dhcp_leases (OPNsense) keep working; they declare the mixin by adding it to their bases.

Tested: fixtures only. Full suite: 2206 passed, coverage 97.4 %. mypy strict, ruff, and napalm-standard check --tag v4.54.0 plus ratchet are clean.

The implementation is NAPALM/napalm-openwrt feature/declared-ap-methods-695.

Declares an access point's writes and a DHCP lease reader, so that an application no longer builds UCI itself (NetOrk/netork#695). The contract is the one decided on 2026-11-07 (NetOrk/netork#695, comment 27096). This is the 4.54.0 release. **Added** - `WirelessWritesMixin`, on `AccessPointDriver` and `ResidentialGatewayDriver`: - `push_ssid_config(ssid, SsidConfigDict)`, a partial write (encryption, key, hidden, enabled, disassoc_low_ack, max_inactivity); - `set_radio_channels({radio: channel})`: every radio in one go, with one restart of the wireless stack; `AUTO_CHANNEL` (0) lets a radio choose. - `AccessPointDriver.set_vlan_name(vlan_id, name) -> bool`: a narrow write instead of the switch's `set_vlan`. - `ApConfigMixin.apply_ap_config(ApConfigDict, parts) -> ApConfigResultDict`, on `AccessPointDriver`. It takes the AP's desired state in vendor-neutral terms (`ApSsidConfigDict` per SSID); the driver writes the parts the caller found different. The part names and their I/O-free readers are `AP_CONFIG_PARTS`, `AP_CONFIG_SSID_ATTRIBUTES`, `ap_config_ssid_part`, `ap_config_vlan_part` and `is_ap_config_part`. - `DhcpLeasesMixin.get_dhcp_leases() -> list[DhcpLeaseDict]`, apart from `DhcpServerMixin`, so that an access point can report the leases it serves. A failed read raises. - `UpdateMixin.apply_updates(packages, *, log=None)`: an optional keyword-only line callback, for NetOrk/netork#1112 (napalm-bsd). All new methods are declared under `TYPE_CHECKING`, so `callable(getattr(driver, name, None))` stays truthful. The new TypedDicts live in `access_point_models` and `dhcp_leases`, not in `models.py`, which stays within its ratchet size. Drivers that already have `get_dhcp_leases` (OPNsense) keep working; they declare the mixin by adding it to their bases. **Tested:** fixtures only. Full suite: 2206 passed, coverage 97.4 %. mypy strict, ruff, and `napalm-standard check --tag v4.54.0` plus ratchet are clean. The implementation is NAPALM/napalm-openwrt `feature/declared-ap-methods-695`.
christianmanivong added 4 commits 2026-11-29 21:48:10 +00:00
UpdateMixin.apply_updates declares a keyword-only log, as
harden_ssh_server does: it receives each line of the package manager's
output as the host prints it. A driver that cannot stream does not call
it and returns the output at the end, as before; the declaration stays
compatible with every driver that implements it without the keyword.
WirelessWritesMixin declares push_ssid_config(ssid, SsidConfigDict), a
partial write, and set_radio_channels({radio: channel}), every radio in
one restart; AccessPointDriver and ResidentialGatewayDriver carry it.
AccessPointDriver declares set_vlan_name(vlan_id, name) and, through
ApConfigMixin, apply_ap_config(ApConfigDict, parts): the desired state
in vendor-neutral terms, of which the driver writes the parts the caller
found different, answered by ApConfigResultDict. The part names and
their I/O-free readers live in ap_config.

DhcpLeasesMixin declares get_dhcp_leases() with DhcpLeaseDict, apart
from DhcpServerMixin, so an access point can report the leases it serves.
DhcpLeaseDict lives in dhcp_leases, the AP shapes in
access_point_models; models.py stays at its recorded size.
chore(release): 4.54.0
driver / lint (pull_request) Successful in 15s
driver / standard (pull_request) Successful in 18s
driver / types (pull_request) Successful in 56s
driver / lowest (pull_request) Successful in 42s
driver / test (3.12) (pull_request) Successful in 1m11s
driver / test (3.13) (pull_request) Successful in 1m14s
driver / build (pull_request) Successful in 29s
driver / security (pull_request) Successful in 53s
CI / driver (pull_request) Successful in 1m49s
driver / publish (pull_request) Skipped
eb8b2dbea7
christianmanivong merged commit 5b26e7d2bc into main 2026-11-29 22:03:14 +00:00
christianmanivong deleted branch feature/ap-dhcp-contracts-695 2026-11-29 22:03:14 +00:00
Sign in to join this conversation.