fix(driver): leave get_interfaces_ip and cli to NAPALM's stubs
driver / standard (pull_request) Successful in 22s
driver / lint (pull_request) Successful in 16s
driver / types (pull_request) Successful in 1m3s
driver / test (3.12) (pull_request) Successful in 4m13s
driver / test (3.13) (pull_request) Successful in 4m5s
driver / lowest (pull_request) Successful in 3m38s
driver / build (pull_request) Successful in 30s
driver / security (pull_request) Successful in 1m19s
CI / driver (pull_request) Successful in 6m10s
driver / publish (pull_request) Skipped

get_interfaces_ip reported the speaker's address with a prefix length
of 24 it never read: the speaker info has no netmask, and SoCo offers
no reading for one, so a speaker in a /23 or /25 network was reported
wrongly. cli answered [] -- not even NAPALM's dict shape -- for a
speaker that has no CLI. Both overrides are gone; NAPALM's stubs raise
NotImplementedError.

Closes #15
This commit is contained in:
Christian Manivong committed 2026-11-12 19:23:25 +01:00
1 parent bb55884216
commit 397917a174
4 files changed
+23 -27

No files matched your search

+14 -6
View File
@@ -117,14 +117,8 @@ class TestSonosDriver:
interfaces = self.driver.get_interfaces()
assert "eth0" not in self.driver.get_facts()["interface_list"]
assert "eth0" not in interfaces
assert "eth0" not in self.driver.get_interfaces_ip()
assert list(interfaces) == ["wlan0"]
def test_get_interfaces_ip(self):
ifaces_ip = self.driver.get_interfaces_ip()
assert "wlan0" in ifaces_ip
assert "192.168.1.100" in ifaces_ip["wlan0"]["ipv4"]
def test_get_playback_state_has_the_contracts_shape(self):
"""``{"state", "source"}`` as napalm-device-types' MediaDriver declares it (#11)."""
self.mock_device.music_source = "RADIO"
@@ -346,6 +340,8 @@ _NOT_SUPPORTED_GETTERS = [
"get_config",
"get_environment",
"get_firewall_policies",
# The speaker reports no prefix length; it was always given as 24 (#15).
"get_interfaces_ip",
"get_lldp_neighbors",
"get_lldp_neighbors_detail",
"get_mac_address_table",
@@ -367,6 +363,18 @@ def test_an_unsupported_getter_is_napalms_stub(getter):
assert getattr(SonosDriver, getter) is getattr(NetworkDriver, getter)
def test_cli_is_napalms_stub():
"""A speaker has no CLI; `[]` was not even NAPALM's dict shape (#15)."""
assert SonosDriver.cli is NetworkDriver.cli
with pytest.raises(NotImplementedError):
SonosDriver("192.0.2.20").cli(["show version"])
def test_get_interfaces_ip_says_not_implemented():
with pytest.raises(NotImplementedError):
SonosDriver("192.0.2.20").get_interfaces_ip()
def test_get_config_with_napalms_arguments_says_not_implemented():
"""`get_config(retrieve="running")` raised TypeError, read as a failed backup (#13)."""
with pytest.raises(NotImplementedError):