driver / lint (pull_request) Successful in 14s
driver / standard (pull_request) Successful in 16s
driver / types (pull_request) Failing after 26s
driver / test (3.13) (pull_request) Failing after 15s
driver / test (3.12) (pull_request) Failing after 17s
driver / lowest (pull_request) Failing after 16s
driver / build (pull_request) Successful in 28s
driver / security (pull_request) Failing after 35s
CI / driver (pull_request) Failing after 1m6s
driver / publish (pull_request) Skipped
get_scheduled_jobs reads every crontab in /etc/crontabs in one round trip as root, with the time zone from UCI and each crontab's package from opkg; manage_scheduled_job enables, disables or runs one now; put_ and delete_scheduled_job write and remove an application's own job as marked lines in the user's crontab. BusyBox crond has no /etc/crontab, cron.d, run-parts, anacron or systemd, so none is read. OpenWrt's BusyBox differs from what the POSIX mixin assumes, so a few steps are the driver's own: - crontab -l says only "can't open" for a missing crontab, as for an unreadable one: the file is read directly, a missing one is empty, and one that cannot be read is never written. - crontab FILE exits 0 when it could not write: every write is read back. - cron is enabled and restarted after each write; OpenWrt does not start crond while /etc/crontabs is empty. - crond has no special times: aliases are written as five fields and @reboot is refused. - crond hands the whole command to sh and takes only SHELL and PATH from the crontab, so a run now does the same (% is no stdin). - there is no su and no timeout before 25.x: another user's job runs through start-stop-daemon -c, and the run is bounded by timeout only where the router has it. Every write changes only the job's own line, so the reboot failback line in /etc/crontabs/root stays as it is. Requires napalm-device-types 4.26.0. Closes #32
6.0 KiB
6.0 KiB
Changelog
All notable changes to napalm-openwrt. The format follows Keep a Changelog, versions follow Semantic Versioning. Versions up to 0.6.0 were not recorded here; their history is the git log.
[Unreleased]
Added
- Scheduled jobs (NetOrk/netork#1933, #32), through napalm-device-types'
PosixScheduledJobsMixin:get_scheduled_jobs()reads every crontab in/etc/crontabs-- BusyBox crond has no/etc/crontab,cron.d, run-parts, anacron or systemd -- with the time zone from UCI and each crontab's package fromopkg;manage_scheduled_job()enables, disables or runs one now;put_scheduled_job()anddelete_scheduled_job()write and remove an application's own job as marked lines in the user's crontab. Every write changes only the job's own line, is read back (BusyBoxcrontabexits 0 when it could not write) and leaves cron enabled and restarted. A run is the command as BusyBox crond runs it (%is no stdin), bounded bytimeoutwhere the router has it (OpenWrt 25.x); another user's job runs throughstart-stop-daemon -c, as OpenWrt's BusyBox has nosu.@dailyand the other aliases are written as five fields;@rebootis refused, as OpenWrt's crond has no special times. configure_lldp_agent(interfaces)(napalm-device-typesLldpAgentMixin): installs lldpd where it is missing, writes the interfaces given as lldpd's interface list in UCI, enables lldpd at boot and restarts it. A VLAN device (br-ap.10) is written as the device under it (br-ap). It is the action for the setup the LLDP getters used to do on every poll (#8). Needs napalm-device-types withLldpAgentMixin.
Changed
- The floor on napalm-device-types is 4.26.0, the first release with
PosixScheduledJobsMixin(it was 4.24.0, for the sharedlldpctlparser). - Python 3.12 is the floor (
requires-python = ">=3.12"): netOrk runs every driver on 3.12, so 3.10 and 3.11 are no longer tested (NAPALM/driver-standard#6). - The floor on napalm is 5.1: older releases import
pkg_resources, which a Python 3.12 venv no longer has. get_lldp_neighbors()andget_lldp_neighbors_detail()only read. They no longer enable and start a stopped lldpd, and no longer rewrite lldpd's interface list and restart it, which could happen on every poll. A device whose lldpd is stopped now reports no neighbours until lldpd is started, for example withmanage_service("lldpd", "enable")andmanage_service("lldpd", "start")(#8).
Fixed
get_lldp_neighbors()andget_lldp_neighbors_detail()keep an interface name with a dot whole: the neighbours of a VLAN interface such aseth0.1used to come back undereth0with every field empty (#26). A neighbour that names its port by MAC address or a local id is reported with that port instead of an empty one, and a chassis named by a local id or an address with that id. The detail now also carries the neighbour's system description and capabilities, which were always empty. lldpd's output is parsed by napalm-device-types' shared parser.get_lldp_neighbors()reports a neighbour's chassis MAC asmac(lower case) when the neighbour names its chassis by one, as napalm-linux does, so netOrk can match the neighbour by MAC rather than by name only (#31).get_lldp_neighbors()andget_lldp_neighbors_detail()raise when lldpctl fails (not installed, lldpd not running or unreachable), with lldpctl's message; they used to return no neighbours, the same answer as a device without any (#27). An empty result now means lldpctl ran and listed none.get_environment()raises when/proc/stator/proc/meminfocannot be read or parsed, instead of reporting 0 % CPU and 0 bytes of memory.get_arp_table()reports an unknown age as-1.0(napalm-device-types'ARP_AGE_UNKNOWN) instead of0.0, which means "confirmed just now": neitherip neighnor/proc/net/arphas an age (NetOrk/netork#1327).- The driver no longer removes
portfrom theoptional_argsdict it is given: the caller's dict stays as it was (#19). manage_service()reports a failed action or a missing init script as failed: only the init script's exit status decides, where any action used to come back as a success (#3).apply_updates()reports a failed upgrade as failed, with the package manager's exit status inerror; it used to report every upgrade as done (#11).get_environment()reports the CPU usage of the last second, from two reads of/proc/statone second apart; it used to report the average since boot, so a box busy for the last minute could show a low figure (#10).get_lldp_neighbors()andget_lldp_neighbors_detail()report every neighbour on a port (a phone with a PC behind it, a switch without LLDP of its own); only the last one came back, mixed with fields of the others (#9).install_package()anduninstall_package()report a failed install or removal as failed: only the package manager's exit status decides. They used to search the output for words like "error:", so an opkg dependency failure ("Collected errors:", "Cannot install package …") came back as a success, and a successful install of a package whose name contains "failed" as a failure (#28).
[0.7.0] - 2026-10-23
The first release on PyPI.
Changed
- The driver follows the NAPALM driver standard
(https://git.netork.io/NAPALM/driver-standard): CI on Gitea runs ruff, mypy, the
tests on Python 3.10–3.13 and at the lowest declared versions, bandit, pip-audit and
a build check, and a release tag publishes to PyPI. The package now ships
py.typedand a LICENSE file. Python 3.8 and 3.9 are no longer supported; napalm-device-types never ran on them. - napalm-device-types 4.21.1 or newer is required.
- Exceptions the driver deliberately ignores (the snmpd community in
get_snmp_config(), the network VLANs inget_ssids()) are now logged at debug level. - The project links point at git.netork.io instead of GitHub.