From a9abfd535c062dbb4e15355eeda955d52aaeb927 Mon Sep 17 00:00:00 2001 From: Christian Manivong Date: Thu, 26 Nov 2026 18:56:33 +0100 Subject: [PATCH] docs: no services restart reading on OpenWrt, and a test that keeps it so (NetOrk/netork#2750) An upgrade leaves the old files in the read-only image, and the kernel can name them by their /rom or /overlay/upper path rather than as deleted, so napalm-device-types' /proc scan could read clean right after an upgrade. Without the method the caller shows the reading as not made. A reading of OpenWrt's own is #51. --- README.md | 1 + tests/unit/test_services_restart.py | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 tests/unit/test_services_restart.py diff --git a/README.md b/README.md index d27ae5a..07fccc7 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,7 @@ device.close() | `get_ntp_servers` / `get_ntp_peers` | ✅ | `system.ntp.server` in UCI, every server of the list; none while `system.ntp.enabled` is off -- the same list as `get_time_sync()` | | `get_time_sync()` | ✅ | napalm-device-types `TimeSyncMixin`: the servers as above, the zone from `zonename` where the rule in `timezone` is that zone's (else the one zone with that rule, or none); `synchronized` is not readable (None) | | `get_firmware_offer()` | ✅ | napalm-device-types `FirmwareOfferMixin`: the newest release of the device's own line on the attended sysupgrade server (see *Firmware upgrade*) | +| `get_services_need_restart()` | ❌ | deliberately not offered (NetOrk/netork#2750): an upgrade writes the new files to the overlay while the old ones stay in the read-only image, and `/proc//maps` can name those by their `/rom` or `/overlay/upper` path rather than as deleted (Linux before 6.8 shows an overlay file's real path). napalm-device-types' `/proc` scan could then read clean exactly after an upgrade; without the method the caller shows the reading as not made. A reading of OpenWrt's own is #51 | ## Configuration management diff --git a/tests/unit/test_services_restart.py b/tests/unit/test_services_restart.py new file mode 100644 index 0000000..a25a2bd --- /dev/null +++ b/tests/unit/test_services_restart.py @@ -0,0 +1,16 @@ +"""No ``get_services_need_restart`` on OpenWrt (NetOrk/netork#2750). + +napalm-device-types' ``ServicesRestartMixin`` finds replaced code as deleted files in +``/proc//maps``. On OpenWrt an upgrade leaves the old files in the read-only image, +and the kernel can name them by their ``/rom`` or ``/overlay/upper`` path (Linux +before 6.8 shows an overlay file's real path), so that scan could read clean right +after an upgrade. The driver does not offer it, +and the caller shows the reading as not made. +""" + +from napalm_openwrt.openwrt import OpenWrtDriver + + +def test_it_is_not_offered(): + assert not hasattr(OpenWrtDriver, "get_services_need_restart") + assert not hasattr(OpenWrtDriver, "_run_services_restart_command")