fix(driver): leave get_interfaces_ip and cli to NAPALM's stubs #16

Merged
christianmanivong merged 1 commits from fix/interfaces-ip-prefix into main 2026-11-12 19:06:14 +00:00
Owner

What was wrong

  • get_interfaces_ip() always reported the speaker's address with prefix_length: 24, a guess presented as a reading. A speaker in a /23 or /25 network was reported wrongly.
  • cli() returned [] (NAPALM's cli returns a dict) for a speaker that has no CLI, so it read as implemented.

Can the real prefix be read?

No. The driver's only reading of the speaker is SoCo's get_speaker_info(), which parses /xml/device_description.xml: room name, serial, versions, model, MAC — no address, no netmask (the driver's info.get("ip_address", self.hostname) always fell back to the hostname). SoCo 0.31 has no netmask or prefix reading anywhere; its only netmask is the scan range of its own discovery, the local host's networks. So per the issue the getter goes back to NAPALM's stub.

Fix

The get_interfaces_ip and cli overrides are removed; NAPALM's stubs raise NotImplementedError. get_interfaces() (the one wlan0 connection) is unchanged.

For netOrk: the poll asks implements_napalm_getter(conn, "get_interfaces_ip") first, so a Sonos speaker's interface simply carries no address there instead of a wrong /24; the device keeps its management address.

README (Supported / Not supported) and CHANGELOG [Unreleased] (marked breaking: both now raise) updated.

Tests

Fixtures only.

  • get_interfaces_ip joins the parametrised "is NAPALM's stub" test; test_get_interfaces_ip_says_not_implemented; test_cli_is_napalms_stub (identity and NotImplementedError). All three failed before.
  • The old test_get_interfaces_ip (asserting the guessed entry) is removed, and the no-eth0 test no longer reads get_interfaces_ip.

pytest 78 passed (coverage 93 %), ruff, mypy, napalm-standard check/ratchet green.

Closes #15

## What was wrong - `get_interfaces_ip()` always reported the speaker's address with `prefix_length: 24`, a guess presented as a reading. A speaker in a /23 or /25 network was reported wrongly. - `cli()` returned `[]` (NAPALM's `cli` returns a dict) for a speaker that has no CLI, so it read as implemented. ## Can the real prefix be read? No. The driver's only reading of the speaker is SoCo's `get_speaker_info()`, which parses `/xml/device_description.xml`: room name, serial, versions, model, MAC — no address, no netmask (the driver's `info.get("ip_address", self.hostname)` always fell back to the hostname). SoCo 0.31 has no netmask or prefix reading anywhere; its only netmask is the scan range of its own discovery, the local host's networks. So per the issue the getter goes back to NAPALM's stub. ## Fix The `get_interfaces_ip` and `cli` overrides are removed; NAPALM's stubs raise `NotImplementedError`. `get_interfaces()` (the one `wlan0` connection) is unchanged. For netOrk: the poll asks `implements_napalm_getter(conn, "get_interfaces_ip")` first, so a Sonos speaker's interface simply carries no address there instead of a wrong /24; the device keeps its management address. README (Supported / Not supported) and CHANGELOG `[Unreleased]` (marked breaking: both now raise) updated. ## Tests Fixtures only. - `get_interfaces_ip` joins the parametrised "is NAPALM's stub" test; `test_get_interfaces_ip_says_not_implemented`; `test_cli_is_napalms_stub` (identity and `NotImplementedError`). All three failed before. - The old `test_get_interfaces_ip` (asserting the guessed entry) is removed, and the no-`eth0` test no longer reads `get_interfaces_ip`. pytest 78 passed (coverage 93 %), ruff, mypy, `napalm-standard check`/`ratchet` green. Closes #15
christianmanivong added 1 commit 2026-11-12 18:23:26 +00:00
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
397917a174
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
christianmanivong merged commit 0cc2e5a685 into main 2026-11-12 19:06:14 +00:00
christianmanivong deleted branch fix/interfaces-ip-prefix 2026-11-12 19:06:15 +00:00
Sign in to join this conversation.