diff --git a/CHANGELOG.md b/CHANGELOG.md index fccd5e1..740ac84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ All notable changes to this driver. The format follows ## [Unreleased] ### 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 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 diff --git a/README.md b/README.md index 500d9ea..57c8c9c 100644 --- a/README.md +++ b/README.md @@ -54,8 +54,8 @@ has no Wi-Fi. ## Not supported -Configuration changes (`load_merge_candidate` and `load_replace_candidate` raise -`NotImplementedError`), `get_config`, LLDP, BGP, NTP, SNMP, users, routes, MAC address +Configuration changes (`load_replace_candidate` is `None`, `load_merge_candidate` +raises `NotImplementedError`), `get_config`, LLDP, BGP, NTP, SNMP, users, routes, MAC address table, optics, environment, traceroute, VPN tunnels and the CLI. `ping` returns an error and `SUPPORTS_PING` is `False`: the DAL accepts a `PINGTEST` diff --git a/napalm_zyxel/zyxel_driver.py b/napalm_zyxel/zyxel_driver.py index 90520b2..cba2a56 100644 --- a/napalm_zyxel/zyxel_driver.py +++ b/napalm_zyxel/zyxel_driver.py @@ -614,11 +614,9 @@ class ZyxelVMGDriver(ResidentialGatewayDriver): """Not supported on Zyxel VMG.""" pass - def load_replace_candidate( - self, filename: str | None = None, config: str | None = None - ) -> None: - """Not supported on Zyxel VMG.""" - raise NotImplementedError("Zyxel VMG does not support config replacement via NAPALM") + #: No config replace: switched off rather than a stub that raises, so asking + #: whether the driver has one says no (NetOrk/netork#2503). + load_replace_candidate = None # type: ignore[assignment] def load_merge_candidate(self, filename: str | None = None, config: str | None = None) -> None: """Not supported on Zyxel VMG.""" diff --git a/tests/test_config_replace.py b/tests/test_config_replace.py new file mode 100644 index 0000000..499b078 --- /dev/null +++ b/tests/test_config_replace.py @@ -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)) diff --git a/tests/test_zyxel.py b/tests/test_zyxel.py index ea875a3..387e64b 100644 --- a/tests/test_zyxel.py +++ b/tests/test_zyxel.py @@ -292,11 +292,6 @@ class TestZyxelVMGDriver: assert not hasattr(type(self.driver), "run_device_action") 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): self._setup_mocked_http() with pytest.raises(NotImplementedError):