Every driver writes run_device_action as an if-chain over _action_<name>:
Several actions:napalm_openwrt/openwrt.py:343, napalm_proxmox/system_mixin.py:472, napalm_linux/linux.py:2196.
fix_snmp only, byte-identical: netgear, tplink, procurve and opnsense.
Contract drift
Unknown action.os.py:299–301 documents ValueError, but every driver raises NotImplementedError (e.g. openwrt.py:353). NetOrk maps NotImplementedError to "not supported".
Result shape.sonos_driver.py:445 and zyxel_driver.py:813 return {"success", "action", "message"} instead of DeviceActionResultDict{"success", "output"} (models.py:824). NetOrk reads output (netork/api/v1/routers/devices/actions/_snmp.py:97).
Proposal
A DeviceActionsMixin with DEVICE_ACTIONS: ClassVar[frozenset[str]] as an allowlist (so private methods are not reachable by name), and a concrete dispatcher.
Decide which exception means "unknown action" and make the docstring say it.
Bring sonos and zyxel to the documented result shape.
Prio P4.
From the NetOrk function index (NetOrk/netork#670); every location was checked against the current code. Paths are relative to each driver repo.
Every driver writes `run_device_action` as an if-chain over `_action_<name>`:
- **Several actions:** `napalm_openwrt/openwrt.py`:343, `napalm_proxmox/system_mixin.py`:472, `napalm_linux/linux.py`:2196.
- **fix_snmp only, byte-identical:** netgear, tplink, procurve and opnsense.
**Contract drift**
- **Unknown action.** `os.py`:299–301 documents `ValueError`, but every driver raises `NotImplementedError` (e.g. `openwrt.py`:353). NetOrk maps `NotImplementedError` to "not supported".
- **Result shape.** `sonos_driver.py`:445 and `zyxel_driver.py`:813 return `{"success", "action", "message"}` instead of `DeviceActionResultDict` `{"success", "output"}` (`models.py`:824). NetOrk reads `output` (`netork/api/v1/routers/devices/actions/_snmp.py`:97).
**Proposal**
- A `DeviceActionsMixin` with `DEVICE_ACTIONS: ClassVar[frozenset[str]]` as an allowlist (so private methods are not reachable by name), and a concrete dispatcher.
- Decide which exception means "unknown action" and make the docstring say it.
- Bring sonos and zyxel to the documented result shape.
Prio P4.
From the NetOrk function index (NetOrk/netork#670); every location was checked against the current code. Paths are relative to each driver repo.
Re-homed by docs/STRUCTURE.md (NAPALM/napalm-device-types#37, NetOrk/netork#1105): replaced by the fix templates in #33, which deprecate run_device_action.
Re-homed by `docs/STRUCTURE.md` (NAPALM/napalm-device-types#37, NetOrk/netork#1105): replaced by the fix templates in #33, which deprecate `run_device_action`.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Every driver writes
run_device_actionas an if-chain over_action_<name>:napalm_openwrt/openwrt.py:343,napalm_proxmox/system_mixin.py:472,napalm_linux/linux.py:2196.Contract drift
os.py:299–301 documentsValueError, but every driver raisesNotImplementedError(e.g.openwrt.py:353). NetOrk mapsNotImplementedErrorto "not supported".sonos_driver.py:445 andzyxel_driver.py:813 return{"success", "action", "message"}instead ofDeviceActionResultDict{"success", "output"}(models.py:824). NetOrk readsoutput(netork/api/v1/routers/devices/actions/_snmp.py:97).Proposal
DeviceActionsMixinwithDEVICE_ACTIONS: ClassVar[frozenset[str]]as an allowlist (so private methods are not reachable by name), and a concrete dispatcher.Prio P4.
From the NetOrk function index (NetOrk/netork#670); every location was checked against the current code. Paths are relative to each driver repo.
Re-homed by
docs/STRUCTURE.md(NAPALM/napalm-device-types#37, NetOrk/netork#1105): replaced by the fix templates in #33, which deprecaterun_device_action.