SonosDriver.get_config(self) overrode NAPALM's stub with return {} and took no arguments. A caller that asks whether the driver has its own get_config (comparing it against NAPALM's stub) sees one, calls get_config(retrieve="running"), and gets a TypeError. netOrk records that as a failed configuration backup on every poll of every Sonos speaker.
Cause
The driver overrode every NAPALM getter a speaker has nothing for with an empty answer. Besides get_config, the same shape applied to 19 more getters: get_environment, get_optics, get_arp_table, get_route_to, get_mac_address_table, get_lldp_neighbors(_detail), get_ntp_peers/servers/stats, get_snmp_information, get_users, get_network_instances, get_bgp_config, get_bgp_neighbors(_detail), get_probes_config/results, get_firewall_policies.
All of them would be mistaken for implemented getters:
get_route_to(self, destination) required an argument NAPALM defaults, so get_route_to() raised TypeError too (a warning in the poll log on every poll).
get_ntp_servers() answering {} reads as "NTP read, no servers configured", which is a statement about the speaker the driver cannot make.
get_arp_table() answering [] reads as "read, empty" rather than "not read".
The rest answered {}/[] for data the speaker does not have, which STANDARDS §3 rules out ("Returning an empty result for 'could not read' makes a broken device look like an empty one").
Fix
Same as NAPALM/napalm-zyxel#22: the overrides are removed, so NAPALM's stubs stay and raise NotImplementedError. A caller can tell "not supported" from "read, empty" again.
Kept as they are (not getters, out of scope): ping()/traceroute() (return NAPALM's error key), cli() (returns []), and the no-op commit_config(), discard_config(), compare_config(), rollback().
README ("Not supported") and CHANGELOG ([Unreleased], marked breaking: the methods now raise instead of answering empty) are updated.
Tests
Fixtures only (no device).
test_an_unsupported_getter_is_napalms_stub[...]: for each of the 20 getters, the driver's attribute is NAPALM's NetworkDriver stub. Failed before the change (20 red).
test_get_config_with_napalms_arguments_says_not_implemented: get_config(retrieve="running") raises NotImplementedError; failed with TypeError before.
test_get_route_to_with_napalms_defaults_says_not_implemented: get_route_to() raises NotImplementedError; failed with TypeError before.
test_get_arp_table_takes_napalms_vrf_argument (from #2) is replaced by the parametrised test: NAPALM's stub takes vrf.
## What was wrong
`SonosDriver.get_config(self)` overrode NAPALM's stub with `return {}` and took no arguments. A caller that asks whether the driver has its own `get_config` (comparing it against NAPALM's stub) sees one, calls `get_config(retrieve="running")`, and gets a `TypeError`. netOrk records that as a failed configuration backup on every poll of every Sonos speaker.
## Cause
The driver overrode every NAPALM getter a speaker has nothing for with an empty answer. Besides `get_config`, the same shape applied to 19 more getters: `get_environment`, `get_optics`, `get_arp_table`, `get_route_to`, `get_mac_address_table`, `get_lldp_neighbors(_detail)`, `get_ntp_peers/servers/stats`, `get_snmp_information`, `get_users`, `get_network_instances`, `get_bgp_config`, `get_bgp_neighbors(_detail)`, `get_probes_config/results`, `get_firewall_policies`.
All of them would be mistaken for implemented getters:
- `get_route_to(self, destination)` required an argument NAPALM defaults, so `get_route_to()` raised `TypeError` too (a warning in the poll log on every poll).
- `get_ntp_servers()` answering `{}` reads as "NTP read, no servers configured", which is a statement about the speaker the driver cannot make.
- `get_arp_table()` answering `[]` reads as "read, empty" rather than "not read".
- The rest answered `{}`/`[]` for data the speaker does not have, which STANDARDS §3 rules out ("Returning an empty result for 'could not read' makes a broken device look like an empty one").
## Fix
Same as NAPALM/napalm-zyxel#22: the overrides are removed, so NAPALM's stubs stay and raise `NotImplementedError`. A caller can tell "not supported" from "read, empty" again.
Kept as they are (not getters, out of scope): `ping()`/`traceroute()` (return NAPALM's `error` key), `cli()` (returns `[]`), and the no-op `commit_config()`, `discard_config()`, `compare_config()`, `rollback()`.
README ("Not supported") and CHANGELOG (`[Unreleased]`, marked breaking: the methods now raise instead of answering empty) are updated.
## Tests
Fixtures only (no device).
- `test_an_unsupported_getter_is_napalms_stub[...]`: for each of the 20 getters, the driver's attribute is NAPALM's `NetworkDriver` stub. Failed before the change (20 red).
- `test_get_config_with_napalms_arguments_says_not_implemented`: `get_config(retrieve="running")` raises `NotImplementedError`; failed with `TypeError` before.
- `test_get_route_to_with_napalms_defaults_says_not_implemented`: `get_route_to()` raises `NotImplementedError`; failed with `TypeError` before.
- `test_get_arp_table_takes_napalms_vrf_argument` (from #2) is replaced by the parametrised test: NAPALM's stub takes `vrf`.
pytest 76 passed (coverage 92 %), ruff format/check clean, mypy clean, `napalm-standard check` and `ratchet` green.
Closes #13
get_config() overrode NAPALM's stub with `return {}` and took no
arguments, so get_config(retrieve="running") raised TypeError, which a
caller reports as a failed configuration backup on every poll. The
other getters a speaker has nothing for (environment, optics, routing,
ARP, MAC table, LLDP, NTP, SNMP, BGP, probes, users, network instances,
firewall policies) had the same shape: an empty answer reads as
"implemented, nothing there", and get_route_to() required an argument
NAPALM defaults.
All of them are gone; NAPALM's stubs raise NotImplementedError.
Closes#13
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.
What was wrong
SonosDriver.get_config(self)overrode NAPALM's stub withreturn {}and took no arguments. A caller that asks whether the driver has its ownget_config(comparing it against NAPALM's stub) sees one, callsget_config(retrieve="running"), and gets aTypeError. netOrk records that as a failed configuration backup on every poll of every Sonos speaker.Cause
The driver overrode every NAPALM getter a speaker has nothing for with an empty answer. Besides
get_config, the same shape applied to 19 more getters:get_environment,get_optics,get_arp_table,get_route_to,get_mac_address_table,get_lldp_neighbors(_detail),get_ntp_peers/servers/stats,get_snmp_information,get_users,get_network_instances,get_bgp_config,get_bgp_neighbors(_detail),get_probes_config/results,get_firewall_policies.All of them would be mistaken for implemented getters:
get_route_to(self, destination)required an argument NAPALM defaults, soget_route_to()raisedTypeErrortoo (a warning in the poll log on every poll).get_ntp_servers()answering{}reads as "NTP read, no servers configured", which is a statement about the speaker the driver cannot make.get_arp_table()answering[]reads as "read, empty" rather than "not read".{}/[]for data the speaker does not have, which STANDARDS §3 rules out ("Returning an empty result for 'could not read' makes a broken device look like an empty one").Fix
Same as NAPALM/napalm-zyxel#22: the overrides are removed, so NAPALM's stubs stay and raise
NotImplementedError. A caller can tell "not supported" from "read, empty" again.Kept as they are (not getters, out of scope):
ping()/traceroute()(return NAPALM'serrorkey),cli()(returns[]), and the no-opcommit_config(),discard_config(),compare_config(),rollback().README ("Not supported") and CHANGELOG (
[Unreleased], marked breaking: the methods now raise instead of answering empty) are updated.Tests
Fixtures only (no device).
test_an_unsupported_getter_is_napalms_stub[...]: for each of the 20 getters, the driver's attribute is NAPALM'sNetworkDriverstub. Failed before the change (20 red).test_get_config_with_napalms_arguments_says_not_implemented:get_config(retrieve="running")raisesNotImplementedError; failed withTypeErrorbefore.test_get_route_to_with_napalms_defaults_says_not_implemented:get_route_to()raisesNotImplementedError; failed withTypeErrorbefore.test_get_arp_table_takes_napalms_vrf_argument(from #2) is replaced by the parametrised test: NAPALM's stub takesvrf.pytest 76 passed (coverage 92 %), ruff format/check clean, mypy clean,
napalm-standard checkandratchetgreen.Closes #13
get_config() overrode NAPALM's stub with `return {}` and took no arguments, so get_config(retrieve="running") raised TypeError, which a caller reports as a failed configuration backup on every poll. The other getters a speaker has nothing for (environment, optics, routing, ARP, MAC table, LLDP, NTP, SNMP, BGP, probes, users, network instances, firewall policies) had the same shape: an empty answer reads as "implemented, nothing there", and get_route_to() required an argument NAPALM defaults. All of them are gone; NAPALM's stubs raise NotImplementedError. Closes #13