feat: fix routines as templates with the caller's values; deprecate run_device_action (4.13.0) #41

Merged
christianmanivong merged 1 commits from feat/fix-templates-33 into main 2026-10-16 22:43:23 +00:00
Owner

Step 4 of NetOrk/netork#1105, base-package side. Stacked on #40 (merge that first; this PR then shows only its own commit).

napalm_device_types.fixes:

  • run_fix_steps(steps): runs steps in order, stops at the first failure; a step that raises has failed.
  • SnmpAgentMixin.configure_snmp_agent(settings): install, configure, firewall, start; SnmpAgentSettingsDict = community, allowed_sources, contact, location, listen. Verification is the caller's, with its own SNMP client.
  • EnsurePackageMixin.ensure_package(name): installs only what is missing (copes with drivers whose install_package still returns {success, output}).
  • PackageProxyMixin.configure_package_proxy(url) and ContainerEngineMixin.grant_container_engine_access(user): declared.
  • FixResultDict lists every step that ran.

None sits on a role base (tested), so callable(getattr(driver, name, None)) stays truthful. run_device_action is marked deprecated; goes in 5.0.

Next: napalm-linux and napalm-bsd implement the steps; netOrk calls the templates with its values (NetOrk/netork#1109).

Closes #33

Step 4 of NetOrk/netork#1105, base-package side. **Stacked on #40** (merge that first; this PR then shows only its own commit). `napalm_device_types.fixes`: - `run_fix_steps(steps)`: runs steps in order, stops at the first failure; a step that raises has failed. - `SnmpAgentMixin.configure_snmp_agent(settings)`: install, configure, firewall, start; `SnmpAgentSettingsDict` = community, allowed_sources, contact, location, listen. Verification is the caller's, with its own SNMP client. - `EnsurePackageMixin.ensure_package(name)`: installs only what is missing (copes with drivers whose `install_package` still returns `{success, output}`). - `PackageProxyMixin.configure_package_proxy(url)` and `ContainerEngineMixin.grant_container_engine_access(user)`: declared. - `FixResultDict` lists every step that ran. None sits on a role base (tested), so `callable(getattr(driver, name, None))` stays truthful. `run_device_action` is marked deprecated; goes in 5.0. Next: napalm-linux and napalm-bsd implement the steps; netOrk calls the templates with its values (NetOrk/netork#1109). Closes #33
christianmanivong added 2 commits 2026-10-16 13:29:45 +00:00
feat: SnmpHealthProfile, the OIDs a driver declares; deprecate HealthMetricsMixin (4.12.0)
CI / test (3.10) (push) Successful in 28s
CI / test (3.11) (push) Successful in 27s
CI / test (3.12) (push) Successful in 29s
CI / test (3.13) (push) Successful in 30s
CI / test (3.10) (pull_request) Successful in 29s
CI / test (3.11) (pull_request) Successful in 26s
CI / test (3.12) (pull_request) Successful in 35s
CI / test (3.13) (pull_request) Successful in 33s
b4c4ec0b0b
Drivers no longer collect over SNMP (docs/STRUCTURE.md). A driver whose
device publishes its health values under OIDs of its own declares them
as SNMP_HEALTH_PROFILE: per value either scalars asked in order or a
table folded by first, average or max, optionally with a pattern for
text answers; memory as total with used or free, or a percentage, in
KiB or bytes; and how to read the interfaces. The application polls
and computes.

HealthMetricsMixin.get_health_metrics now warns that it is deprecated;
it goes in 5.0.

Closes #32
feat: fix routines as templates with the caller's values; deprecate run_device_action (4.13.0)
CI / test (3.10) (push) Successful in 34s
CI / test (3.11) (push) Successful in 31s
CI / test (3.12) (push) Successful in 31s
CI / test (3.13) (push) Successful in 27s
CI / test (3.10) (pull_request) Successful in 27s
CI / test (3.11) (pull_request) Successful in 28s
CI / test (3.12) (pull_request) Successful in 28s
CI / test (3.13) (pull_request) Successful in 27s
9324a5b8f1
run_device_action was a string dispatch drivers filled with an
application's remediations, values hard-coded inside (community
"public", the caller's address, a /24 firewall rule).

napalm_device_types.fixes declares them as templates instead. A
template runs declared steps in order and stops at the first failure
(run_fix_steps); the driver implements the steps, or overrides the
whole method where its device takes the change in one call; every
value comes from the caller.

- SnmpAgentMixin.configure_snmp_agent(settings): install, configure,
  firewall, start. The caller verifies with its own SNMP client.
  get_management_peer() (optional) says the address the device sees the
  management connection come from, for choosing allowed_sources.
- EnsurePackageMixin.ensure_package(name): install only what is missing.
- PackageProxyMixin.configure_package_proxy(url): declared.
- ContainerEngineMixin.grant_container_engine_access(user): declared.

None is mixed into a role base, so a capability check stays truthful.

Closes #33
christianmanivong force-pushed feat/fix-templates-33 from d60b3d3742 to 9324a5b8f1 2026-10-16 13:29:45 +00:00 Compare
christianmanivong changed title from feat: fix routines as templates with the caller's values; deprecate run_device_action (4.12.0) to feat: fix routines as templates with the caller's values; deprecate run_device_action (4.13.0) 2026-10-16 13:29:56 +00:00
christianmanivong merged commit 6551008ad3 into main 2026-10-16 22:43:23 +00:00
christianmanivong deleted branch feat/fix-templates-33 2026-10-16 22:43:23 +00:00
Sign in to join this conversation.