feat(host-status): get_host_status through HostStatusMixin #34

Merged
christianmanivong merged 1 commits from feat/interrupted-pm-851 into main 2026-11-07 18:58:31 +00:00
Owner

What

OpenWrtDriver mixes in napalm-device-types' HostStatusMixin, and _run_host_status_command runs the command over an SSH exec channel (run_command). The command is longer than the 512 characters BusyBox ash takes on a typed line.

The router now reports:

  • whether it needs a reboot (one kernel under /lib/modules, so normally no);
  • how full its filesystems are (/ is the overlay);
  • with napalm-device-types 4.32 (NAPALM/napalm-device-types#98), whether apk (OpenWrt 25.12) or opkg (before 25.12) was left halfway, and which of the two it read.

No floor bump. HostStatusMixin exists in the current floor (4.27). The apk/opkg reading comes with the newer device-types.

Why

NetOrk/netork#851: netOrk warns about an interrupted apk and finishes an interrupted opkg (opkg configure) before an update. On OpenWrt it could not see either, because the driver had no host status.

Note for the application: the filesystem reading is new for OpenWrt too, so a router whose overlay is 90 % full or more will get netOrk's "volume almost full" warning.

Tests

Fixtures only. The report is shaped after what the command prints on OpenWrt 25.12, and still has to be checked against a real router. The tests cover two things: the reading is device-types' parse of what the router printed, and the command goes over an exec channel, not the interactive shell. They pass against both napalm-device-types 4.31.1 and the PR above. ruff and mypy are clean.

Refs NetOrk/netork#851

## What `OpenWrtDriver` mixes in napalm-device-types' `HostStatusMixin`, and `_run_host_status_command` runs the command over an SSH exec channel (`run_command`). The command is longer than the 512 characters BusyBox ash takes on a typed line. The router now reports: - whether it needs a reboot (one kernel under `/lib/modules`, so normally no); - how full its filesystems are (`/` is the overlay); - with napalm-device-types 4.32 (NAPALM/napalm-device-types#98), whether apk (OpenWrt 25.12) or opkg (before 25.12) was left halfway, and which of the two it read. No floor bump. `HostStatusMixin` exists in the current floor (4.27). The apk/opkg reading comes with the newer device-types. ## Why NetOrk/netork#851: netOrk warns about an interrupted apk and finishes an interrupted opkg (`opkg configure`) before an update. On OpenWrt it could not see either, because the driver had no host status. Note for the application: the filesystem reading is new for OpenWrt too, so a router whose overlay is 90 % full or more will get netOrk's "volume almost full" warning. ## Tests Fixtures only. The report is shaped after what the command prints on OpenWrt 25.12, and still has to be checked against a real router. The tests cover two things: the reading is device-types' parse of what the router printed, and the command goes over an exec channel, not the interactive shell. They pass against both napalm-device-types 4.31.1 and the PR above. ruff and mypy are clean. Refs NetOrk/netork#851
christianmanivong added 1 commit 2026-11-07 14:01:25 +00:00
feat(host-status): get_host_status through HostStatusMixin
driver / standard (pull_request) Successful in 19s
driver / lint (pull_request) Successful in 16s
driver / types (pull_request) Successful in 1m16s
driver / test (3.13) (pull_request) Successful in 1m11s
driver / test (3.12) (pull_request) Successful in 1m16s
driver / lowest (pull_request) Successful in 30s
driver / build (pull_request) Successful in 34s
driver / security (pull_request) Successful in 1m5s
CI / driver (pull_request) Successful in 2m38s
driver / publish (pull_request) Skipped
29872243ba
The router's host status, read by napalm-device-types' command over an
SSH exec channel: whether it needs a reboot, how full its filesystems
are, and, with napalm-device-types 4.32, whether apk or opkg was left
halfway.

Refs NetOrk/netork#851
christianmanivong merged commit e7bd0c17f5 into main 2026-11-07 18:58:31 +00:00
christianmanivong deleted branch feat/interrupted-pm-851 2026-11-07 18:58:31 +00:00
Sign in to join this conversation.