feat(access-point): declared AP writes, apply_ap_config and DHCP leases, 0.11.0 (NetOrk/netork#695) #55

Merged
christianmanivong merged 4 commits from feature/declared-ap-methods-695 into main 2026-11-29 22:45:01 +00:00
Owner

Implements napalm-device-types' declared AP writes and the DHCP lease reader (NetOrk/netork#695), so that netOrk no longer builds UCI itself. This is the 0.11.0 release.

Added

  • push_ssid_config(ssid, config): a partial write to every wifi-iface carrying the SSID, then wifi reload.
  • set_radio_channels({radio: channel}): one commit and one full wifi restart.
  • set_vlan_name(vlan_id, name): names the VLAN's bridge-vlan sections; False where none carries it.
    All three run as checked uci steps (#35): a refused step raises and reverts what was staged.
  • apply_ap_config(config, parts): netOrk's UCI builder, moved here (napalm_openwrt/ap_config/), with the changes it writes unchanged.
    • The changes are staged by a script the call waits for. A change uci refuses raises CommandErrorException naming its part, and every config is reverted, so nothing is applied (#54).
    • The commits, LuCI's service, the reloads and the restart (after a bridge rebuild) then run detached.
    • Passphrases are masked in what it returns.
    • wireless/<ssid>/passphrase now writes the key.
  • get_dhcp_leases(): dnsmasq's DHCPv4 leases from its lease file; [] where dnsmasq never ran.

Removed: the undeclared push_radio_channel; set_radio_channels replaces it. This is breaking, before 1.0.0.

Needs napalm-device-types 4.54.0 (NAPALM/napalm-device-types#142). ci.yml pre-installs it from that branch's commit until 4.54.0 is on PyPI; drop the pre-install line after the release.

Tested: fixtures only: recorded uci show and dnsmasq output, and the stage script run through /bin/sh against a fake uci. 530 passed, coverage 83 %. mypy strict, ruff, and napalm-standard check --tag v0.11.0 plus ratchet are clean. A test on a real AP follows after the netOrk merge.

Closes #54

Implements napalm-device-types' declared AP writes and the DHCP lease reader (NetOrk/netork#695), so that netOrk no longer builds UCI itself. This is the 0.11.0 release. **Added** - `push_ssid_config(ssid, config)`: a partial write to every wifi-iface carrying the SSID, then `wifi reload`. - `set_radio_channels({radio: channel})`: one commit and one full `wifi` restart. - `set_vlan_name(vlan_id, name)`: names the VLAN's `bridge-vlan` sections; False where none carries it. All three run as checked uci steps (#35): a refused step raises and reverts what was staged. - `apply_ap_config(config, parts)`: netOrk's UCI builder, moved here (`napalm_openwrt/ap_config/`), with the changes it writes unchanged. - The changes are staged by a script the call waits for. A change uci refuses raises `CommandErrorException` naming its part, and every config is reverted, so nothing is applied (#54). - The commits, LuCI's service, the reloads and the restart (after a bridge rebuild) then run detached. - Passphrases are masked in what it returns. - `wireless/<ssid>/passphrase` now writes the key. - `get_dhcp_leases()`: dnsmasq's DHCPv4 leases from its lease file; `[]` where dnsmasq never ran. **Removed:** the undeclared `push_radio_channel`; `set_radio_channels` replaces it. This is breaking, before 1.0.0. **Needs** napalm-device-types 4.54.0 (NAPALM/napalm-device-types#142). `ci.yml` pre-installs it from that branch's commit until 4.54.0 is on PyPI; drop the `pre-install` line after the release. **Tested:** fixtures only: recorded `uci show` and dnsmasq output, and the stage script run through /bin/sh against a fake `uci`. 530 passed, coverage 83 %. mypy strict, ruff, and `napalm-standard check --tag v0.11.0` plus ratchet are clean. A test on a real AP follows after the netOrk merge. Closes #54
christianmanivong added 3 commits 2026-11-29 21:56:02 +00:00
push_ssid_config, set_radio_channels and set_vlan_name run as checked
uci steps (#35): a refused step raises naming itself and reverts what
was staged. set_radio_channels replaces the undeclared push_radio_channel.

apply_ap_config takes napalm-device-types' ApConfigDict and the parts
the caller found different and writes them as one detached script: the
builder netOrk had in _uci_builders.py, moved here. It answers which
parts it wrote and which it could not, whether the AP restarts, and the
script with every passphrase masked. A passphrase part now writes the
key.

get_dhcp_leases reads dnsmasq's lease file.

Needs napalm-device-types 4.54.0; CI pre-installs it from its branch
until it is on PyPI.
fix(access-point): a change the AP refuses in apply_ap_config is raised, and nothing applied (#54)
driver / standard (pull_request) Successful in 16s
driver / lint (pull_request) Successful in 11s
driver / lowest (pull_request) Successful in 28s
driver / types (pull_request) Successful in 1m4s
driver / test (3.13) (pull_request) Successful in 54s
driver / test (3.12) (pull_request) Successful in 1m8s
driver / build (pull_request) Successful in 28s
driver / security (pull_request) Successful in 59s
CI / driver (pull_request) Successful in 2m8s
driver / publish (pull_request) Skipped
9bac9bd1af
The configuration ran as one detached script, so a refused uci step
only reached its log while the call reported the part as applied. The
changes are now staged by a script the call waits for: a uci wrapper
records each refused set, add, add_list or delete with its part, and at
the end every config is reverted and the script exits 3, which raises
CommandErrorException naming each part, passphrases masked. Quiet -q
calls stay tests. The commits, LuCI's service, the reloads and the
restart run detached afterwards, as before.

Closes #54
christianmanivong added 1 commit 2026-11-29 22:12:17 +00:00
ci: build against the released napalm-device-types 4.54.0
driver / standard (pull_request) Successful in 16s
driver / lint (pull_request) Successful in 12s
driver / types (pull_request) Successful in 1m4s
driver / test (3.12) (pull_request) Successful in 1m4s
driver / lowest (pull_request) Successful in 34s
driver / test (3.13) (pull_request) Successful in 1m4s
driver / build (pull_request) Successful in 27s
driver / security (pull_request) Successful in 1m14s
CI / driver (pull_request) Successful in 2m34s
driver / publish (pull_request) Skipped
8132d89d99
christianmanivong merged commit 10a58797d3 into main 2026-11-29 22:45:01 +00:00
christianmanivong deleted branch feature/declared-ap-methods-695 2026-11-29 22:45:02 +00:00
Sign in to join this conversation.