feat(power): shut the firewall down through its firmware API (NetOrk/netork#2841) #52

Merged
christianmanivong merged 2 commits from feature/host-shutdown-2841 into main 2026-11-29 22:07:28 +00:00
Owner

shutdown_host() next to reboot_host(): POST /api/core/firmware/poweroff (OPNsense 16.1.15 and later, together with the reboot action), which answers before the firewall goes down. A refusal raises RuntimeError with the firewall's answer.

No version bump: features collect under [Unreleased]. Tests: TestShutdownHost in tests/unit/test_updates.py; full suite 645 passed.

Part of NetOrk/netork#2841: the device header gets Restart and Shut down for hardware devices. netOrk offers each button where the driver has the method (callable(getattr(driver, "reboot_host" / "shutdown_host", None))), so defining it is what switches the button on. The contracts are HostRebootMixin / HostShutdownMixin in napalm-device-types, already mixed in through DeviceTypeDriver; the minimum napalm-device-types version needs no change.

netOrk's feature/host-shutdown-2841 pins this branch's commit for now; once this is merged, the pin moves to the merge commit.

`shutdown_host()` next to `reboot_host()`: `POST /api/core/firmware/poweroff` (OPNsense 16.1.15 and later, together with the reboot action), which answers before the firewall goes down. A refusal raises `RuntimeError` with the firewall's answer. No version bump: features collect under [Unreleased]. Tests: `TestShutdownHost` in `tests/unit/test_updates.py`; full suite 645 passed. Part of NetOrk/netork#2841: the device header gets Restart and Shut down for hardware devices. netOrk offers each button where the driver has the method (`callable(getattr(driver, "reboot_host" / "shutdown_host", None))`), so defining it is what switches the button on. The contracts are `HostRebootMixin` / `HostShutdownMixin` in napalm-device-types, already mixed in through `DeviceTypeDriver`; the minimum napalm-device-types version needs no change. netOrk's `feature/host-shutdown-2841` pins this branch's commit for now; once this is merged, the pin moves to the merge commit.
christianmanivong added 1 commit 2026-11-29 21:53:25 +00:00
feat(power): shut the firewall down through its firmware API (NetOrk/netork#2841)
driver / standard (pull_request) Failing after 14s
driver / lint (pull_request) Successful in 13s
driver / types (pull_request) Successful in 50s
driver / test (3.12) (pull_request) Successful in 1m2s
driver / lowest (pull_request) Successful in 32s
driver / test (3.13) (pull_request) Successful in 1m2s
driver / build (pull_request) Successful in 30s
driver / security (pull_request) Successful in 55s
CI / driver (pull_request) Failing after 1m59s
driver / publish (pull_request) Skipped
94279de382
shutdown_host() posts /api/core/firmware/poweroff, the clean halt with
power off that OPNsense has had since 16.1.15, next to the
firmware/reboot that reboot_host() uses. A refused request raises
RuntimeError with the firewall's answer.
christianmanivong added 1 commit 2026-11-29 22:00:57 +00:00
refactor(power): the firmware's reboot, power-off and status in a mixin of their own (NetOrk/netork#2841)
driver / standard (pull_request) Successful in 14s
driver / lint (pull_request) Successful in 13s
driver / types (pull_request) Successful in 54s
driver / lowest (pull_request) Successful in 27s
driver / test (3.13) (pull_request) Successful in 59s
driver / test (3.12) (pull_request) Successful in 1m4s
driver / build (pull_request) Successful in 24s
driver / security (pull_request) Successful in 55s
CI / driver (pull_request) Successful in 2m4s
driver / publish (pull_request) Skipped
02336c20ed
opnsense.py must not grow (python_file_lines, 3022): reboot_host,
shutdown_host and get_host_status, all three the firmware controller's,
move to firmware_power.py (OPNsenseFirmwarePowerMixin), and opnsense.py
shrinks to 3019 lines, recorded in the baseline. Behaviour unchanged; the
645 tests pass as they were.
christianmanivong merged commit e0be871207 into main 2026-11-29 22:07:28 +00:00
christianmanivong deleted branch feature/host-shutdown-2841 2026-11-29 22:07:29 +00:00
Sign in to join this conversation.