Fix routines as templates; deprecate run_device_action #33

Closed
opened 2026-10-14 08:22:57 +00:00 by christianmanivong · 0 comments
Owner

run_device_action(action) is a string dispatch that drivers fill with the application's remediations: fix_snmp (eight drivers), fix_apt_proxy, fix_docker_permissions, install_lldpd, install_auc. Their values are hard-coded in the drivers (rocommunity public, sysContact netork@localhost, a firewall rule for the caller's /24).

Change: one template per purpose. The template runs declared steps in order and stops at the first failure; a driver implements the steps, or overrides the whole method when its device does it in one call (OPNsense). Every value comes from the caller.

Today Template
fix_snmp configure_snmp_agent(settings: SnmpAgentSettingsDict)
fix_apt_proxy configure_package_proxy(url)
fix_docker_permissions grant_container_engine_access(user)
install_lldpd, install_auc ensure_package(name)

Add SnmpAgentSettingsDict (community, allowed sources, contact, location), FixStepDict and FixResultDict. The mixins are mixed in by drivers, not by role bases, so hasattr stays truthful. Deprecate run_device_action and DeviceActionResultDict.

Replaces #14.

Part of NetOrk/netork#1105. Plan: NAPALM/napalm-device-types docs/STRUCTURE.md (branch docs/structure-plan).

Prio P3.

`run_device_action(action)` is a string dispatch that drivers fill with the application's remediations: `fix_snmp` (eight drivers), `fix_apt_proxy`, `fix_docker_permissions`, `install_lldpd`, `install_auc`. Their values are hard-coded in the drivers (`rocommunity public`, `sysContact netork@localhost`, a firewall rule for the caller's /24). **Change:** one template per purpose. The template runs declared steps in order and stops at the first failure; a driver implements the steps, or overrides the whole method when its device does it in one call (OPNsense). Every value comes from the caller. | Today | Template | |---|---| | `fix_snmp` | `configure_snmp_agent(settings: SnmpAgentSettingsDict)` | | `fix_apt_proxy` | `configure_package_proxy(url)` | | `fix_docker_permissions` | `grant_container_engine_access(user)` | | `install_lldpd`, `install_auc` | `ensure_package(name)` | Add `SnmpAgentSettingsDict` (community, allowed sources, contact, location), `FixStepDict` and `FixResultDict`. The mixins are mixed in by drivers, not by role bases, so `hasattr` stays truthful. Deprecate `run_device_action` and `DeviceActionResultDict`. Replaces #14. Part of NetOrk/netork#1105. Plan: NAPALM/napalm-device-types `docs/STRUCTURE.md` (branch `docs/structure-plan`). Prio P3.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: NAPALM/napalm-device-types#33