Merge pull request 'fix(driver): load_replace_candidate is None, not a stub that raises (NetOrk/netork#2503)' (#33) from fix/no-config-replace into main
driver / standard (push) Successful in 14s
driver / lint (push) Successful in 13s
driver / types (push) Successful in 50s
driver / test (3.12) (push) Successful in 52s
driver / test (3.13) (push) Successful in 47s
driver / lowest (push) Successful in 23s
driver / build (push) Successful in 26s
driver / security (push) Successful in 1m6s
CI / driver (push) Successful in 2m25s
driver / publish (push) Skipped
driver / standard (push) Successful in 14s
driver / lint (push) Successful in 13s
driver / types (push) Successful in 50s
driver / test (3.12) (push) Successful in 52s
driver / test (3.13) (push) Successful in 47s
driver / lowest (push) Successful in 23s
driver / build (push) Successful in 26s
driver / security (push) Successful in 1m6s
CI / driver (push) Successful in 2m25s
driver / publish (push) Skipped
This commit was merged in pull request #33.
This commit is contained in:
commit
06ece68de6
5 files changed
+26
-12
No files matched your search
@@ -7,6 +7,10 @@ All notable changes to this driver. The format follows
|
|||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
- `load_replace_candidate` is `None` instead of a method that raises
|
||||||
|
`NotImplementedError`, so a caller that asks whether the driver can replace a
|
||||||
|
configuration gets no. netOrk offered a config restore for these devices that
|
||||||
|
could only fail (NetOrk/netork#2503).
|
||||||
- Python 3.12 is the floor (`requires-python = ">=3.12"`): netOrk runs every driver
|
- 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).
|
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
|
- The floor on napalm is 5.1: older releases import `pkg_resources`, which a Python
|
||||||
|
|||||||
@@ -54,8 +54,8 @@ has no Wi-Fi.
|
|||||||
|
|
||||||
## Not supported
|
## Not supported
|
||||||
|
|
||||||
Configuration changes (`load_merge_candidate` and `load_replace_candidate` raise
|
Configuration changes (`load_replace_candidate` is `None`, `load_merge_candidate`
|
||||||
`NotImplementedError`), `get_config`, LLDP, BGP, NTP, SNMP, users, routes, MAC address
|
raises `NotImplementedError`), `get_config`, LLDP, BGP, NTP, SNMP, users, routes, MAC address
|
||||||
table, optics, environment, traceroute, VPN tunnels and the CLI.
|
table, optics, environment, traceroute, VPN tunnels and the CLI.
|
||||||
|
|
||||||
`ping` returns an error and `SUPPORTS_PING` is `False`: the DAL accepts a `PINGTEST`
|
`ping` returns an error and `SUPPORTS_PING` is `False`: the DAL accepts a `PINGTEST`
|
||||||
|
|||||||
@@ -614,11 +614,9 @@ class ZyxelVMGDriver(ResidentialGatewayDriver):
|
|||||||
"""Not supported on Zyxel VMG."""
|
"""Not supported on Zyxel VMG."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def load_replace_candidate(
|
#: No config replace: switched off rather than a stub that raises, so asking
|
||||||
self, filename: str | None = None, config: str | None = None
|
#: whether the driver has one says no (NetOrk/netork#2503).
|
||||||
) -> None:
|
load_replace_candidate = None # type: ignore[assignment]
|
||||||
"""Not supported on Zyxel VMG."""
|
|
||||||
raise NotImplementedError("Zyxel VMG does not support config replacement via NAPALM")
|
|
||||||
|
|
||||||
def load_merge_candidate(self, filename: str | None = None, config: str | None = None) -> None:
|
def load_merge_candidate(self, filename: str | None = None, config: str | None = None) -> None:
|
||||||
"""Not supported on Zyxel VMG."""
|
"""Not supported on Zyxel VMG."""
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
"""The driver cannot replace a device's configuration, and says so by not having the method.
|
||||||
|
|
||||||
|
A ``load_replace_candidate`` that only raises looks like a replace to anyone who asks
|
||||||
|
whether the driver has one: netOrk offered a config restore for these devices that
|
||||||
|
could only fail (NetOrk/netork#2503). ``None`` is how a driver switches off a method
|
||||||
|
it would otherwise inherit, the convention of napalm-device-types and netOrk's
|
||||||
|
capability checks.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from napalm_zyxel import ZyxelVMGDriver
|
||||||
|
|
||||||
|
|
||||||
|
def test_the_driver_has_no_config_replace():
|
||||||
|
assert ZyxelVMGDriver.load_replace_candidate is None
|
||||||
|
assert not callable(getattr(ZyxelVMGDriver, "load_replace_candidate", None))
|
||||||
@@ -292,11 +292,6 @@ class TestZyxelVMGDriver:
|
|||||||
assert not hasattr(type(self.driver), "run_device_action")
|
assert not hasattr(type(self.driver), "run_device_action")
|
||||||
assert not hasattr(type(self.driver), "reboot")
|
assert not hasattr(type(self.driver), "reboot")
|
||||||
|
|
||||||
def test_load_replace_candidate_raises(self):
|
|
||||||
self._setup_mocked_http()
|
|
||||||
with pytest.raises(NotImplementedError):
|
|
||||||
self.driver.load_replace_candidate()
|
|
||||||
|
|
||||||
def test_load_merge_candidate_raises(self):
|
def test_load_merge_candidate_raises(self):
|
||||||
self._setup_mocked_http()
|
self._setup_mocked_http()
|
||||||
with pytest.raises(NotImplementedError):
|
with pytest.raises(NotImplementedError):
|
||||||
|
|||||||
Reference in new issue
Block a user