Commit Graph
61 Commits
Author SHA1 Message Date
Christian Manivong 231def768e fix(lldp): keep dotted interface names and read every id type
The local interface was the second dotted part of the key, so the
neighbours of eth0.1 landed under eth0 with every field missed. The
remote port was read from port.ifname or port.id.value, and lldpd
prints a port given by MAC or local id as port.mac / port.local, never
as id.value, so that port came back empty.

lldpd's output now goes through napalm-device-types'
parse_lldpctl_keyvalue and its two NAPALM projections, which keep the
interface name up to the neighbour's first field and read the ids under
whatever type lldpd prints. The detail gains the system description and
capabilities on the way. The module is under strict mypy now; the floor
on napalm-device-types rises to 4.24.0.

Closes #26
2026-11-02 08:45:51 +01:00
christianmanivong d04a969eb1 Merge pull request 'feat(lldp): configure_lldp_agent sets up lldpd on the given interfaces' (#25) from feat/lldp-agent-setup into main
driver / lint (push) Successful in 16s
driver / standard (push) Successful in 19s
driver / types (push) Successful in 58s
driver / test (3.13) (push) Successful in 55s
driver / test (3.12) (push) Successful in 1m3s
driver / lowest (push) Successful in 54s
driver / build (push) Successful in 46s
driver / security (push) Successful in 1m24s
driver / publish (push) Skipped
CI / driver (push) Successful in 2m40s
2026-11-02 00:08:09 +00:00
Christian Manivong 6802e4d7df chore(deps): floor napalm-device-types at 4.23.0
driver / standard (pull_request) Successful in 18s
driver / lint (pull_request) Successful in 14s
driver / types (pull_request) Successful in 59s
driver / test (3.12) (pull_request) Successful in 1m5s
driver / lowest (pull_request) Successful in 27s
driver / test (3.13) (pull_request) Successful in 55s
driver / build (pull_request) Successful in 25s
driver / security (pull_request) Successful in 59s
CI / driver (pull_request) Successful in 2m36s
driver / publish (pull_request) Skipped
4.23.0 is on PyPI with everything this branch uses; the git pre-install
in CI is no longer needed.
2026-11-02 00:31:50 +01:00
Christian Manivong 1e988c87f4 Merge remote-tracking branch 'origin/main' into feat/lldp-agent-setup 2026-11-02 00:31:35 +01:00
christianmanivong 004c3e9322 Merge pull request 'fix: six open bugs (#19, #3, #11, #10, #9, #8)' (#24) from fix/bugs-2026-11 into main
driver / standard (push) Successful in 20s
driver / lint (push) Successful in 18s
driver / types (push) Successful in 1m14s
driver / test (3.12) (push) Successful in 1m15s
driver / test (3.13) (push) Successful in 1m3s
driver / lowest (push) Successful in 28s
driver / build (push) Successful in 28s
driver / security (push) Successful in 1m6s
CI / driver (push) Successful in 2m46s
driver / publish (push) Skipped
2026-11-01 22:00:02 +00:00
Christian Manivong 5cce38b2bb feat(lldp): configure_lldp_agent sets up lldpd on the given interfaces
driver / standard (pull_request) Successful in 16s
driver / lint (pull_request) Successful in 12s
driver / types (pull_request) Failing after 1m1s
driver / test (3.12) (pull_request) Failing after 59s
driver / test (3.13) (pull_request) Failing after 49s
driver / lowest (pull_request) Failing after 25s
driver / build (pull_request) Successful in 27s
driver / security (pull_request) Successful in 1m1s
CI / driver (pull_request) Failing after 2m28s
driver / publish (pull_request) Skipped
The LLDP getters started lldpd and rewrote its interface list on every
poll; with read-only getters that setup needs an action. The driver
mixes in napalm-device-types' LldpAgentMixin and writes the step the
template leaves to it: lldpd.config.interface in UCI. A VLAN device is
written as the device under it, as the old helper did, since lldpd
sends on the L2 device. Which interfaces is the caller's choice.

Refs #8
2026-11-01 22:13:56 +01:00
Christian Manivong 783a4ee0cb fix(lldp): read neighbours without starting or reconfiguring lldpd
driver / standard (pull_request) Successful in 15s
driver / lint (pull_request) Successful in 13s
driver / types (pull_request) Successful in 59s
driver / test (3.12) (pull_request) Successful in 1m0s
driver / test (3.13) (pull_request) Successful in 53s
driver / lowest (pull_request) Successful in 24s
driver / build (pull_request) Successful in 30s
driver / security (pull_request) Successful in 56s
CI / driver (pull_request) Successful in 2m19s
driver / publish (pull_request) Skipped
get_lldp_neighbors, which a poll calls every time, enabled and started a
stopped lldpd and rewrote lldpd's interface list with uci, restarting
the daemon. A getter must not change the device. Both LLDP getters now
only run lldpctl; installing and starting lldpd are ensure_package and
manage_service.

Closes #8
2026-11-01 21:48:31 +01:00
Christian Manivong 5e71f0b471 fix(lldp): keep every neighbour on a port
The keyvalue output was grouped by local interface only, so with several
neighbours on one port their keys overwrote each other and one mixed
entry came back. A neighbour now ends where the next one opens (alias,
then via, as lldpd prints it); a key repeated inside one neighbour, such
as one mgmt-ip per address, does not start a new one.

Closes #9
2026-11-01 21:47:34 +01:00
Christian Manivong 097d9b9581 fix(environment): CPU usage from two reads a second apart
get_environment promised two samples one second apart but read
/proc/stat once, so the figure was the average since boot: a box at
100 % for the last minute showed its lifetime average. It now reads the
cpu line twice, a second apart, and uses the difference.

Closes #10
2026-11-01 21:45:24 +01:00
Christian Manivong c211ba0d9e fix(updates): only the exit status decides apply_updates
apply_updates ran apk/opkg upgrade and returned success whatever
happened, so a failed upgrade was reported as done. The command now
prints its exit status after the marker get_available_updates already
uses; a non-zero or missing status is a failure, named in "error".

Closes #11
2026-11-01 21:44:26 +01:00
Christian Manivong 16e0fa9d5e fix(services): only the exit status decides manage_service
manage_service returned success for every action, so a failed start or
a missing init script showed up as done. The command now prints its
exit status after a marker, and only that status decides.

Closes #3
2026-11-01 21:43:56 +01:00
Christian Manivong 45f5b65427 fix(driver): leave the caller's optional_args unchanged
__init__ popped "port" out of the dict it was handed, so the caller's
own optional_args lost its port. The driver now works on a copy.

Closes #19
2026-11-01 21:43:09 +01:00
christianmanivong d78a55dd1a Merge pull request 'fix: an unknown ARP age is -1.0, not 0.0' (#23) from fix/arp-unknown-age into main
driver / standard (push) Successful in 22s
driver / lint (push) Successful in 14s
driver / test (3.12) (push) Successful in 1m15s
driver / types (push) Successful in 1m17s
driver / lowest (push) Successful in 32s
driver / test (3.13) (push) Successful in 1m21s
driver / build (push) Successful in 31s
driver / security (push) Successful in 1m13s
driver / publish (push) Skipped
CI / driver (push) Successful in 3m5s
2026-10-30 09:20:24 +00:00
Christian Manivong b0270d3430 fix: an unknown ARP age is -1.0, not 0.0
driver / lint (pull_request) Successful in 17s
driver / standard (pull_request) Successful in 19s
driver / types (pull_request) Successful in 1m5s
driver / test (3.13) (pull_request) Successful in 1m2s
driver / test (3.12) (pull_request) Successful in 1m8s
driver / lowest (pull_request) Successful in 31s
driver / build (pull_request) Successful in 33s
driver / security (pull_request) Successful in 1m7s
CI / driver (pull_request) Successful in 2m28s
driver / publish (pull_request) Skipped
Neither ip neigh nor /proc/net/arp has an age, so get_arp_table reports
ARP_AGE_UNKNOWN instead of 0.0 ("confirmed just now").

NetOrk/netork#1327
2026-10-30 08:37:08 +01:00
christianmanivong b1a2950d9d Merge pull request 'chore: Python 3.12 is the floor (NAPALM/driver-standard#6)' (#22) from chore/python-312-floor into main
driver / standard (push) Successful in 15s
driver / lint (push) Successful in 12s
driver / types (push) Successful in 55s
driver / test (3.12) (push) Successful in 57s
driver / lowest (push) Successful in 24s
driver / test (3.13) (push) Successful in 54s
driver / build (push) Successful in 26s
driver / security (push) Successful in 1m2s
CI / driver (push) Successful in 2m26s
driver / publish (push) Skipped
2026-10-27 10:33:09 +00:00
Christian Manivong 14ab92b80b fix: the floor on napalm is 5.1 (NAPALM/driver-standard#6)
driver / standard (pull_request) Successful in 16s
driver / lint (pull_request) Successful in 14s
driver / types (pull_request) Successful in 1m0s
driver / test (3.12) (pull_request) Successful in 59s
driver / test (3.13) (pull_request) Successful in 51s
driver / lowest (pull_request) Successful in 24s
driver / build (pull_request) Successful in 27s
driver / security (pull_request) Successful in 1m5s
CI / driver (pull_request) Successful in 2m34s
driver / publish (pull_request) Skipped
napalm 5.0 and older import pkg_resources, which a Python 3.12 venv no
longer has, so the lowest job failed on them.
2026-10-27 10:49:29 +01:00
Christian Manivong 20d2670759 chore: Python 3.12 is the floor (NAPALM/driver-standard#6)
driver / standard (pull_request) Successful in 15s
driver / lint (pull_request) Successful in 13s
driver / types (pull_request) Successful in 1m9s
driver / test (3.12) (pull_request) Successful in 1m3s
driver / lowest (pull_request) Failing after 24s
driver / test (3.13) (pull_request) Successful in 51s
driver / build (pull_request) Successful in 25s
driver / security (pull_request) Successful in 1m1s
CI / driver (pull_request) Failing after 2m32s
driver / publish (pull_request) Skipped
netOrk runs every driver in its own containers on Python 3.12, so 3.10
and 3.11 are no longer supported or tested. requires-python, mypy and
ruff move to 3.12, along with what ruff's pyupgrade rules then rewrite.
2026-10-27 10:18:58 +01:00
christianmanivong 7ae94a27e2 Merge pull request 'chore: adopt the NAPALM driver standard' (#21) from chore/driver-standard into main
driver / lint (push) Successful in 14s
driver / standard (push) Successful in 19s
driver / types (push) Successful in 1m6s
driver / test (3.10) (push) Successful in 1m5s
driver / test (3.11) (push) Successful in 1m4s
driver / lowest (push) Successful in 30s
driver / test (3.12) (push) Successful in 1m8s
driver / test (3.13) (push) Successful in 58s
driver / build (push) Successful in 29s
driver / security (push) Successful in 1m14s
driver / publish (push) Successful in 28s
CI / driver (push) Successful in 3m37s
v0.7.0
2026-10-23 11:52:51 +00:00
Christian Manivong d576357f9c chore(release): 0.7.0
driver / standard (pull_request) Successful in 14s
driver / lint (pull_request) Successful in 10s
driver / types (pull_request) Successful in 43s
driver / test (3.10) (pull_request) Successful in 45s
driver / test (3.11) (pull_request) Successful in 45s
driver / test (3.12) (pull_request) Successful in 44s
driver / test (3.13) (pull_request) Successful in 38s
driver / lowest (pull_request) Successful in 21s
driver / security (pull_request) Successful in 53s
driver / build (pull_request) Successful in 21s
CI / driver (pull_request) Successful in 5m35s
driver / publish (pull_request) Skipped
2026-10-23 11:37:05 +02:00
Christian Manivong 51bcfc5724 fix(deps): a floor on netaddr the lowest versions can import
driver / standard (pull_request) Successful in 14s
driver / lint (pull_request) Successful in 11s
driver / types (pull_request) Successful in 43s
driver / test (3.10) (pull_request) Successful in 58s
driver / test (3.11) (pull_request) Successful in 56s
driver / test (3.12) (pull_request) Successful in 59s
driver / test (3.13) (pull_request) Successful in 48s
driver / lowest (pull_request) Successful in 32s
driver / security (pull_request) Successful in 1m1s
driver / build (pull_request) Successful in 32s
CI / driver (pull_request) Successful in 6m55s
driver / publish (pull_request) Skipped
Unfloored, the CI lowest job installs netaddr 0.3.1, which has no
IPAddress, and every test module fails to import. 0.7.19 has it; 194 tests
pass at the lowest declared versions.
2026-10-23 09:05:22 +02:00
Christian Manivong 6d884898c7 chore: adopt the NAPALM driver standard
driver / standard (pull_request) Successful in 18s
driver / lint (pull_request) Successful in 19s
driver / types (pull_request) Successful in 1m0s
driver / test (3.10) (pull_request) Successful in 1m9s
driver / test (3.11) (pull_request) Successful in 59s
driver / test (3.12) (pull_request) Successful in 46s
driver / test (3.13) (pull_request) Successful in 55s
driver / lowest (pull_request) Failing after 25s
driver / security (pull_request) Successful in 1m0s
driver / build (pull_request) Successful in 26s
CI / driver (pull_request) Failing after 7m18s
driver / publish (pull_request) Skipped
- CI moves to .gitea/workflows/ci.yml and calls the shared driver workflow
  of NAPALM/driver-standard; .github/ is gone.
- requires-python >=3.10 (napalm-device-types needs it), napalm-device-types
  >=4.21.1, LICENSE file, py.typed, SPDX license string, a dev extra with
  floors, links to git.netork.io (README included), CHANGELOG.md.
- mypy strict for the package; exempt for now, with 130 errors between
  them: napalm_openwrt.config_mixin, .interfaces_mixin, .lldp_mixin,
  .openwrt, .packages_mixin, .routing_mixin, .system_mixin, .vlan_mixin and
  .wireless_mixin. They are recorded in the quality baseline with the long
  and complex functions and the one unannotated public method.
- Coverage floor 65 % (measured 65.03 %).
2026-10-23 08:35:03 +02:00
Christian Manivong 8b8905f0c7 fix: what bandit and the remaining lint rules found
- Long lines are wrapped: the get_environment awk command is split into
  adjacent string literals, the rollback message and the system mixin's
  docstring are wrapped; the command and the text are unchanged.
- The two except Exception: pass (the snmpd community in get_snmp_config,
  the network VLANs in get_ssids) now log at debug level (B110), so a
  swallowed failure leaves a trace.
- tests: raise ... from exc, unused loop variable.
2026-10-23 08:33:29 +02:00
Christian Manivong a212bc8715 style: ruff format and the lint rules of the driver standard
Mechanical: ruff format, and ruff check --fix with the rule set every NAPALM
driver uses (E, F, I, UP, B at line length 100, Python 3.10). What ruff
cannot fix comes in the next commit.
2026-10-23 08:32:47 +02:00
christianmanivong 7f2ae6ac58 Merge pull request 'fix(ssh): verify the host key netOrk expects, report the one seen (NetOrk/netork#1167)' (#18) from fix/ssh-host-key-tofu-1167 into master
CI / test (3.10) (push) Successful in 32s
CI / test (3.11) (push) Successful in 30s
CI / test (3.12) (push) Successful in 39s
2026-10-18 19:23:41 +00:00
Christian Manivong cb14f1f00f fix(ssh): verify the host key netOrk expects, report the one seen (NetOrk/netork#1167)
CI / test (3.10) (push) Successful in 34s
CI / test (3.11) (push) Successful in 40s
CI / test (3.12) (push) Successful in 34s
CI / test (3.10) (pull_request) Successful in 36s
CI / test (3.11) (pull_request) Successful in 29s
CI / test (3.12) (pull_request) Successful in 27s
The driver accepted any SSH host key. It now verifies through
napalm-device-types' HostKeyCheck (>= 4.19.0): with a known key in
optional_args["ssh_host_keys"] any other key is refused before login, and
every key seen is reported to optional_args["ssh_host_key_observer"].
Without either argument it connects as before (first use).
2026-10-18 21:23:40 +02:00
christianmanivong fddb5c6772 Merge pull request 'feat: reboot_host (0.5.0)' (#17) from feat/reboot-host into master
CI / test (3.10) (push) Successful in 25s
CI / test (3.11) (push) Successful in 23s
CI / test (3.12) (push) Successful in 26s
2026-10-18 12:48:20 +00:00
Christian Manivong d89bb38688 feat: reboot_host (0.5.0)
CI / test (3.10) (push) Successful in 26s
CI / test (3.11) (push) Successful in 23s
CI / test (3.12) (push) Successful in 26s
CI / test (3.10) (pull_request) Successful in 25s
CI / test (3.11) (pull_request) Successful in 24s
CI / test (3.12) (pull_request) Successful in 25s
HostRebootMixin's reboot_host over the command channel: reboot detached
and two seconds late, so the answer comes back before the session goes
down, and a refusal is raised instead of being mistaken for the dropped
session. netOrk sent /sbin/reboot through the private _send_command and
could not tell the two apart (netOrk #1113). A login other than root is
refused before anything runs.
2026-10-18 14:45:44 +02:00
christianmanivong 5169d2438f Merge pull request 'feat: a public command channel; no warnings of its own (0.4.0)' (#16) from feat/command-channel into master
CI / test (3.10) (push) Successful in 26s
CI / test (3.11) (push) Successful in 23s
CI / test (3.12) (push) Successful in 25s
2026-10-18 12:10:50 +00:00
Christian Manivong 595496549b feat: a public command channel; no warnings of its own (0.4.0)
CI / test (3.10) (push) Successful in 25s
CI / test (3.11) (push) Successful in 24s
CI / test (3.12) (push) Successful in 25s
CI / test (3.10) (pull_request) Successful in 25s
CI / test (3.11) (pull_request) Successful in 24s
CI / test (3.12) (pull_request) Successful in 25s
run_command and open_stream (napalm-device-types CommandChannelMixin,
which AccessPointDriver carries) run on an SSH exec channel next to
netmiko's shell: stdin, stderr apart, a real exit code. netOrk sent UCI
scripts and the wifi channel through the private _send_command, typing
a file in base64 chunks or printf lines; with stdin it writes it with
cat, and base64 is needed for nothing (netOrk #1113). OpenWrt has no
sudo, so a privileged command from a login other than root is refused
before it runs.

get_device_warnings goes with it: no_base64 was its last code.
2026-10-18 14:08:09 +02:00
christianmanivong 100a6d36c5 Merge pull request 'feat: name only a missing base64; lldpd, auc and updates are facts (0.3.0)' (#15) from feat/facts-not-warnings into master
CI / test (3.10) (push) Successful in 26s
CI / test (3.11) (push) Successful in 24s
CI / test (3.12) (push) Successful in 25s
2026-10-17 08:34:56 +00:00
Christian Manivong 34d80bd994 feat: name only a missing base64; lldpd, auc and updates are facts (0.3.0)
CI / test (3.10) (push) Successful in 26s
CI / test (3.11) (push) Successful in 23s
CI / test (3.12) (push) Successful in 26s
CI / test (3.10) (pull_request) Successful in 24s
CI / test (3.11) (pull_request) Successful in 22s
CI / test (3.12) (pull_request) Successful in 25s
get_device_warnings no longer names lldpd_not_installed,
updates_available or update_notifications_disabled. The packages and
get_available_updates are the facts; netOrk derives the warnings with the
same reach (netOrk #1111). The old update read swallowed failures,
get_available_updates raises them.

no_base64 stays: BusyBox may provide base64 as an applet, so no package
tells the caller whether it is there.
2026-10-17 09:37:43 +02:00
christianmanivong 9f43b8c797 Merge pull request 'feat!: fix templates with the caller's values replace run_device_action (0.2.0)' (#14) from feat/fix-templates into master
CI / test (3.10) (push) Successful in 29s
CI / test (3.11) (push) Successful in 26s
CI / test (3.12) (push) Successful in 25s
2026-10-17 06:48:19 +00:00
Christian Manivong 968d6583ba feat!: fix templates with the caller's values replace run_device_action (0.2.0)
CI / test (3.10) (push) Successful in 26s
CI / test (3.11) (push) Successful in 24s
CI / test (3.12) (push) Successful in 26s
CI / test (3.10) (pull_request) Successful in 25s
CI / test (3.11) (pull_request) Successful in 23s
CI / test (3.12) (pull_request) Successful in 25s
fix_snmp set no community at all and opened the management zone's
udp/161 to every source, with a rule named after an application; a
second fix_snmp in the system mixin was shadowed and never ran (#5).
install_lldpd, install_auc and install_coreutils_base64 were actions of
their own.

The driver implements napalm-device-types 4.13's templates instead:
- configure_snmp_agent(settings): snmpd installed when missing;
  community, contact and location in UCI with one com2sec (com2sec6)
  per allowed source; the zone-resolving firewall step of the old fix,
  now limited to the sources (src_ip) and named Allow-SNMP; snmpd
  enabled, restarted and listening;
- get_management_peer() from SSH_CONNECTION;
- ensure_package(name) from the base package, over install_package.
A community, contact or location that would break UCI is refused.

BREAKING CHANGE: run_device_action is removed. Requires
napalm-device-types 4.13.

Closes #5. Part of #13.
2026-10-17 08:33:25 +02:00
christianmanivong d569a289ba Merge pull request 'ci: run the tests and build the package on every push and pull request' (#7) from ci/workflow into master
CI / test (3.10) (push) Successful in 26s
CI / test (3.11) (push) Successful in 24s
CI / test (3.12) (push) Successful in 27s
2026-10-07 06:30:50 +00:00
Christian Manivong 56bb999830 ci: run the tests and build the package on every push and pull request
CI / test (3.10) (push) Successful in 26s
CI / test (3.11) (push) Successful in 24s
CI / test (3.12) (push) Successful in 26s
CI / test (3.10) (pull_request) Successful in 26s
CI / test (3.11) (pull_request) Successful in 28s
CI / test (3.12) (pull_request) Successful in 29s
The same job as napalm-fritzbox and napalm-opnsense: Python 3.10, 3.11 and
3.12, pytest, then wheel and sdist. napalm-device-types comes from
git.netork.io first, because PyPI has an unrelated package of that name.
2026-10-07 07:52:44 +02:00
christianmanivong 4885f028be Merge pull request 'feat: report what listens, and which procd service it is' (#6) from feat/listening-sockets into master 2026-10-07 05:21:32 +00:00
Christian Manivong 96f94770cd feat: report what listens, and which procd service it is
Mixes in napalm-device-types' ListeningSocketsMixin (2.5.0): without ss
the shared command reads busybox netstat, and each process's cgroup names
its procd service. The driver only carries the command across.

Over an SSH exec channel of its own, not the interactive shell: busybox
ash cuts a typed line at 512 characters, the command is longer, and the
cut line left the shell waiting for a closing quote. OpenWrt logs in as
root; a login other than root cannot become root, so its reading says it
is not attributed.

Checked against a real OpenWrt 25.12.2 access point. For netOrk#673.
2026-10-07 07:20:27 +02:00
christianmanivong 75f46913b4 Merge pull request 'fix: never report "nothing pending" when the package index is gone, and load it on request' (#4) from feat/update-reader-raises into master 2026-10-05 22:20:10 +00:00
Christian Manivong 388118cd1b fix: never report "nothing pending" when the package index is gone, and load it on request
OpenWrt keeps its package index in RAM. After a reboot `apk version` only
warns that it cannot open its cached index and exits 0, and `opkg
list-upgradable` prints nothing: both read as "no updates". netOrk keeps
"pending since" per package (MVP 5), so the reader now raises instead:

- apk: on apk's own warning ("opening from cache ... No such file"), or a
  failed exit status.
- opkg: when /var/opkg-lists is empty.
- refresh_available_updates(): apk update / opkg update, success from the
  exit status.
2026-10-06 00:20:09 +02:00
Christian Manivong d45c082355 feat(system): report remote syslog, LuCI state and bridge STP
get_system_config() already parsed the whole system section but returned
only a slice of it, so netOrk had no IST side for three AP-profile fields
and could not compare them at all — the fields were editable, stored and
silently ineffective.

Adds:
  * syslog_remote / syslog_ip / syslog_port / syslog_proto — read from the
    system section that was already being parsed. log_remote gates the
    others: OpenWrt ships nothing without it, so a leftover log_ip must
    not read as an active target.
  * luci_enabled — from the uhttpd init script rather than its listener
    config, so the answer stays "is the web UI served" and re-enabling
    restores whatever was configured before.
  * bridge_stp — None when there is no br-ap at all, which is a different
    statement from "bridge without STP" and has to stay distinguishable.

netOrk #164
2026-08-29 22:41:36 +07:00
Christian Manivong fd972a427e refactor: drop the seven forwarding methods AccessPointDriver forced
AccessPointDriver used to declare get_services, manage_service,
get_available_updates, apply_updates, get_packages, install_package and
remove_package as NotImplementedError stubs. Those stubs preceded
OpenWrtSystemMixin and OpenWrtPackageMixin in the MRO and shadowed their working
implementations, so this driver carried a forwarder for each one purely to
delegate past the base.

napalm-device-types v1.0 makes role bases declaration-only, so nothing shadows
anything and all seven forwarders are dead weight. Every method now resolves
straight to the mixin that implements it.

remove_package went with them: the base now calls the method by the name the
package mixin already used, uninstall_package, so the name adapter is gone too.
2026-08-21 12:50:10 +07:00
Christian Manivong 597a59fa39 fix(snmp): resolve the real firewall zone instead of guessing "lan"
fix_snmp reported success on APs where the rule never reached nftables.
Five defects stacked up:

1. Zone detection required ".src=" and "ssh" in the same `uci show` line.
   UCI prints one option per line, so anonymous rules never matched and
   every device fell through to the hardcoded "lan" fallback.
2. That fallback was never checked against the zones that actually exist.
   On an AP whose zone section has no `option name`, fw4 skips the section,
   so `src='lan'` referenced a zone that was not there and the rule was
   dropped with it.
3. The "already present" guard was a substring test, so a rule written by
   an earlier broken run was skipped forever instead of repaired.
4. Stale-rule deletion never committed — the only `uci commit firewall`
   sat in the add branch that the guard had just skipped.
5. `fw4 reload` errors were swallowed by `|| true`, and with no local
   snmpget the action hardcoded success = True.

Now: the management address comes from $SSH_CONNECTION and is mapped to
its network section (via ipaddr, or via `ip -o -4 addr` -> device when the
interface is DHCP-addressed) and from there to the owning zone. A zone
section without a name aborts the action with the repair command rather
than writing a dead rule — naming it is left to the operator, since an
inert zone becoming active changes what the AP filters. Rules are written
in full every run, stale ones are deleted highest anonymous index first
(uci renumbers @rule[n] on delete) and committed, reload output is no
longer truncated or ignored, and success is verified on the device via
`ss -lun` and a udp/161 lookup in the live ruleset.
2026-08-18 17:54:22 +07:00
Christian Manivong c686fac55e fix(vlans): read bridge-vlan membership from UCI, repair stale tests
get_vlans() relied on `bridge vlan show` for port membership. On devices
whose BusyBox ships without the bridge/ip-full packages the command does
not exist, _send_command returns the shell error, and the parser silently
finds nothing in it. All that survived was the sub-interface fallback,
which restates the bridge topology (br-ap tagged, br-ap.10 untagged) and
never names the uplink port — the only port whose tagging matters.

Measured on two Sophos AP100 (BusyBox 1.37.0): eth0 was absent from the
output entirely, while UCI held ports='eth0:u*' for the management VLAN
and 'eth0:t' for the rest.

UCI bridge-vlan sections are now parsed as a second source. They are
readable without the bridge binary and describe the configured state.
Section collection goes through the type declaration, so named sections
(network.apbr_vlan10) are recognised alongside anonymous ones — the old
regex matched only @bridge-vlan[N], so a hand-built bridge was invisible
even for name lookup. Runtime data keeps precedence where it exists,
since that is what the kernel actually enforces.

Option values are kept raw through collection; stripping quotes there
would collapse ports='lan1:t' 'lan2:t' into a single mangled item.

Also repairs TestGetVlans, red on master since get_vlans() moved to
separate tagged/untagged lists while the tests still asserted the old
'interfaces' key, and TestGetFacts, which never learned about the
number_of_interfaces key get_facts() sets deliberately. Both had left
the interesting behaviour uncovered.
2026-08-17 22:50:08 +07:00
Christian Manivong a8637461bb refactor(warnings): report raw signal only, no severity/presentation
get_device_warnings() now returns only {code, meta} — severity, title,
message, and action are resolved centrally by netork's
WARNING_CATALOG (netork/core/device_warnings.py), not by the driver.
Keeps this driver independent of netork and avoids per-vendor drift in
how the same warning code is presented.
2026-07-20 09:48:20 +02:00
Christian Manivong 6b78ebcacb fix: push_mac_acl() must never set macfilter='disable'
OpenWrt's wifi-scripts validator rejects any macfilter value other than
"allow"/"deny" outright — confirmed on real hardware, setting
macfilter='disable' puts netifd in a permanent restart crash loop with the
radio stuck down. The only way to disable filtering is to delete the option
entirely. Also guards against pushing an empty whitelist (macfilter='allow'
with zero MACs blocks every client outright) by treating it as equivalent
to "off".
2026-07-16 12:05:07 +02:00
Christian Manivong af032a3c4d feat: get_ssids() macfilter/maclist parsing + push_mac_acl()
Adds MAC ACL (whitelist/blacklist) read+write support for wireless SSIDs,
mirroring push_radio_channel's UCI write style. Backs the new Global MAC
ACL feature in netOrk.
2026-07-15 23:19:15 +02:00
Christian Manivong bfc19c2241 fix(deps): pin paramiko>=5.0.0 (CVE-2026-44405) 2026-07-02 12:22:55 +02:00
Christian ManivongandClaude Sonnet 4.6 ee69ec8da9 fix: mixin classes must precede AccessPointDriver in OpenWrtDriver MRO
NetworkDriver (parent of AccessPointDriver) raises NotImplementedError for all
standard NAPALM methods. With AccessPointDriver listed first, get_interfaces()
and get_vlans() from the mixins were shadowed and always raised NotImplementedError
(empty message) — causing all AP polls to report 0 interfaces and 0 VLANs.

Fix: reorder inheritance so mixins come before AccessPointDriver. The standard
NAPALM method stubs in NetworkDriver are now shadowed by the mixin implementations.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-25 13:48:25 +02:00
Christian ManivongandClaude Sonnet 4.6 4c41345489 fix: push_radio_channel uses 'wifi' (full restart) instead of 'wifi reload'
'wifi reload' only reapplies the running config without physically
changing the channel on many ath9k/ath10k/mt76 hardware+driver
combinations. A full 'wifi' (down + up) cycle is required for channel
changes to take effect.

Also updated the test assertion accordingly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-25 00:01:03 +02:00
Christian ManivongandClaude Sonnet 4.6 512871b1bb feat: get_channel_scan() + push_radio_channel() in OpenWrtWirelessMixin
get_channel_scan(mode='active'|'passive'):
- Discovers AP-mode interfaces via 'iw dev'
- Runs 'iw dev <iface> scan [passive]' on each AP interface
- Parses BSS blocks: BSSID, SSID, frequency, channel, signal, channel
  width (HT/VHT/HE), band (2.4/5/6 GHz)
- Returns dict[iface → list[ChannelScanEntryDict]]

push_radio_channel(radio, channel):
- Sets channel via 'uci set wireless.<radio>.channel=<ch|auto>'
- Commits and reloads: 'uci commit wireless && wifi reload'
- channel=0 writes 'auto'

Tests: 19 new unit tests covering parse logic, active/passive flag,
AP-only interface filtering, 6 GHz band detection, push command order.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-24 23:26:25 +02:00