Commit Graph
18 Commits
Author SHA1 Message Date
Christian Manivong 397917a174 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
2026-11-12 19:23:25 +01:00
Christian Manivong 56e0560eb2 fix(driver): leave unsupported getters to NAPALM's stubs
driver / lint (pull_request) Successful in 15s
driver / standard (pull_request) Successful in 17s
driver / types (pull_request) Successful in 1m0s
driver / test (3.13) (pull_request) Successful in 4m13s
driver / test (3.12) (pull_request) Successful in 4m15s
driver / lowest (pull_request) Successful in 3m42s
driver / build (pull_request) Successful in 27s
driver / security (pull_request) Successful in 1m8s
CI / driver (pull_request) Successful in 5m38s
driver / publish (pull_request) Skipped
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
2026-11-12 18:54:07 +01:00
Christian Manivong 218e2c7a7b fix(driver): follow the media contract's shapes, raise on failed reads
driver / standard (pull_request) Successful in 19s
driver / lint (pull_request) Successful in 15s
driver / types (pull_request) Successful in 1m9s
driver / test (3.12) (pull_request) Successful in 4m21s
driver / test (3.13) (pull_request) Successful in 4m16s
driver / lowest (pull_request) Successful in 3m46s
driver / build (pull_request) Successful in 32s
driver / security (pull_request) Successful in 1m14s
CI / driver (pull_request) Successful in 6m10s
driver / publish (pull_request) Skipped
get_playback_state returned SoCo's transport string and get_zone_info
the speaker's details, where napalm-device-types' MediaDriver declares
{"state", "source"} and a list of {"name", "coordinator", "members"}.
Both now return those shapes; the speaker's details stay in get_facts.

get_group_info and get_zone_info caught every exception and answered
{}, so a failed read looked like a speaker in no group. They now raise
like the other getters (#9); {} and [] mean no group.

Closes #11
2026-11-02 09:28:39 +01:00
Christian Manivong 53ea5f051f fix(driver): stop guessing whether a speaker is wired
The wired check read device_properties, which SoCo does not have
(deviceProperties is the UPnP service, and none of its actions says
wired or wireless), and swallowed the AttributeError, so eth0 was never
reported and the guess served nothing. It is gone: a speaker reports
its one connection as wlan0, described as of unknown medium, and the
README and the getter docstrings say that wired vs. wireless is not
known.

Closes #2
2026-11-02 09:26:58 +01:00
Christian Manivong 15ba670a02 fix(driver): raise from getters instead of answering defaults
driver / standard (pull_request) Successful in 17s
driver / lint (pull_request) Successful in 14s
driver / types (pull_request) Successful in 1m21s
driver / test (3.12) (pull_request) Successful in 3m44s
driver / test (3.13) (pull_request) Successful in 3m19s
driver / lowest (pull_request) Successful in 2m49s
driver / build (pull_request) Successful in 37s
driver / security (pull_request) Successful in 1m16s
CI / driver (pull_request) Successful in 5m32s
driver / publish (pull_request) Skipped
get_volume, get_mute, get_playback_state and get_current_track
answered 0, False, "STOPPED" and {} when the driver was not connected
or the read failed, so an unreachable speaker looked like a silent,
stopped one. They now raise ConnectionClosedException, or
ConnectionException / CommandErrorException with the SoCo error as
the cause.

get_playback_state called get_playback_state() on the SoCo object,
which SoCo does not have; the AttributeError was swallowed and every
speaker read as STOPPED. It now reads current_transport_state from
get_current_transport_info(). The tests mock the speaker with
MagicMock(spec=soco.SoCo), so a call to a method SoCo lacks fails.

Closes #9
2026-11-02 08:38:28 +01:00
Christian Manivong 322b7cd688 fix(driver): refuse media controls when not connected
driver / standard (pull_request) Successful in 16s
driver / lint (pull_request) Successful in 15s
driver / types (pull_request) Successful in 1m18s
driver / test (3.12) (pull_request) Successful in 3m14s
driver / test (3.13) (pull_request) Successful in 2m54s
driver / lowest (pull_request) Successful in 2m23s
driver / build (pull_request) Successful in 35s
driver / security (pull_request) Successful in 1m11s
CI / driver (pull_request) Successful in 4m53s
driver / publish (pull_request) Skipped
play() and the other controls returned silently without a device, so
a control that did nothing looked like it had worked. They now raise
ConnectionClosedException. get_arp_table() takes NAPALM's vrf
argument, and the module docstring moves above the imports so
__doc__ is set again.

The wired-speaker part of the issue stays open: SoCo's
deviceProperties is a UPnP service, not a dict with WifiMode, so
renaming the attribute alone would still never report eth0.

Refs #2
2026-11-01 21:53:55 +01:00
Christian Manivong d92dc21cdd fix: the floor on napalm is 5.1 (NAPALM/driver-standard#6)
driver / standard (pull_request) Successful in 16s
driver / lint (pull_request) Successful in 12s
driver / types (pull_request) Successful in 59s
driver / test (3.12) (pull_request) Successful in 2m48s
driver / lowest (pull_request) Successful in 2m21s
driver / test (3.13) (pull_request) Successful in 2m41s
driver / security (pull_request) Successful in 53s
driver / build (pull_request) Successful in 32s
CI / driver (pull_request) Successful in 4m8s
driver / publish (pull_request) Skipped
napalm 5.0 and older import pkg_resources, which a Python 3.12 venv no
longer has, so the lowest job failed on them.
2026-10-27 10:49:31 +01:00
Christian Manivong e3ef8b87c1 chore: Python 3.12 is the floor (NAPALM/driver-standard#6)
driver / standard (pull_request) Successful in 14s
driver / lint (pull_request) Successful in 12s
driver / types (pull_request) Successful in 1m1s
driver / lowest (pull_request) Failing after 19s
driver / security (pull_request) Successful in 52s
driver / build (pull_request) Successful in 24s
driver / test (3.12) (pull_request) Successful in 2m49s
driver / test (3.13) (pull_request) Successful in 2m42s
CI / driver (pull_request) Failing after 3m32s
driver / publish (pull_request) Skipped
netOrk runs every driver in its own containers on Python 3.12, so 3.10
and 3.11 are no longer supported or tested. requires-python, mypy and
ruff move to 3.12, along with what ruff's pyupgrade rules then rewrite.
2026-10-27 10:19:00 +01:00
Christian Manivong 89698c5bd6 chore(release): 0.3.0
driver / standard (pull_request) Successful in 14s
driver / lint (pull_request) Successful in 12s
driver / types (pull_request) Successful in 47s
driver / test (3.10) (pull_request) Successful in 2m44s
driver / test (3.11) (pull_request) Successful in 2m46s
driver / test (3.12) (pull_request) Successful in 2m41s
driver / security (pull_request) Successful in 47s
driver / build (pull_request) Successful in 22s
driver / test (3.13) (pull_request) Successful in 2m35s
driver / lowest (pull_request) Successful in 2m18s
CI / driver (pull_request) Successful in 5m55s
driver / publish (pull_request) Skipped
2026-10-23 16:01:56 +02:00
Christian Manivong 168841ebb8 chore: adopt the NAPALM driver standard
driver / standard (pull_request) Successful in 13s
driver / lint (pull_request) Successful in 12s
driver / types (pull_request) Successful in 45s
driver / test (3.10) (pull_request) Successful in 2m40s
driver / test (3.11) (pull_request) Successful in 2m40s
driver / test (3.12) (pull_request) Successful in 2m37s
driver / test (3.13) (pull_request) Successful in 2m34s
driver / lowest (pull_request) Successful in 2m16s
driver / security (pull_request) Successful in 47s
driver / build (pull_request) Successful in 22s
CI / driver (pull_request) Successful in 15m6s
driver / publish (pull_request) Skipped
- CI moves to .gitea/workflows/ci.yml and calls the shared driver workflow
  of NAPALM/driver-standard; .github/ is gone.
- napalm-device-types >=4.21.1 is now declared: the driver imports
  MediaDriver, PortSpec and FingerprintRule from it, and CI used to
  install it by hand.
- requires-python >=3.10 (napalm-device-types needs it), LICENSE, README,
  CHANGELOG, py.typed, SPDX license string, setuptools>=77, version floors
  on the dev extra, links to git.netork.io; .gitignore as in the template.
- mypy strict for the package; napalm_sonos.sonos_driver is exempt for now
  (5 errors, two of them return types that differ from MediaDriver's),
  recorded in the quality baseline.
- Coverage floor 71 % (measured 71.30 %).
2026-10-23 09:00:07 +02:00
Christian Manivong a6d1d1e597 fix: what bandit and the remaining lint rules found
- open() raises ConnectionException from the SoCo error (B904), so the
  cause stays attached.
- _check_wired_connection: the except Exception: pass (B110) now logs at
  debug level, so a swallowed failure leaves a trace. A module logger is
  new.
- nosec for the empty password default (B107): a Sonos speaker takes no
  login, the argument exists for NAPALM's constructor signature.
- tests: raise AssertionError instead of assert False (B011).
2026-10-23 08:57:52 +02:00
Christian Manivong ad69c0e643 style: ruff format and the lint rules of the driver standard
Mechanical: ruff format, and ruff check --fix with the rule set every NAPALM
driver uses (E, F, I, UP, B at line length 100, Python 3.10). What ruff
cannot fix comes in the next commit.
2026-10-23 08:55:35 +02:00
Christian Manivong 06dbcf4b83 refactor!: drop run_device_action; the media controls are methods (0.2.0)
CI / test (3.10) (push) Successful in 2m20s
CI / test (3.11) (push) Successful in 27s
CI / test (3.12) (push) Successful in 30s
CI / test (3.10) (pull_request) Successful in 2m19s
CI / test (3.11) (pull_request) Successful in 27s
CI / test (3.12) (pull_request) Successful in 29s
run_device_action dispatched play, pause, stop, next/previous track,
set_volume:N and toggle_mute by string and returned
{success, action, message} instead of the DeviceActionResultDict its
contract names. The typed methods it called (play(), set_volume(), ...)
are the interface; napalm-device-types deprecates run_device_action.

BREAKING CHANGE: run_device_action is removed.

Closes #3
2026-10-17 08:39:31 +02:00
Christian Manivong 8672447d16 ci: run the tests and build the package on every push and pull request
CI / test (3.10) (push) Successful in 2m50s
CI / test (3.11) (push) Successful in 29s
CI / test (3.12) (push) Successful in 31s
CI / test (3.10) (pull_request) Successful in 2m50s
CI / test (3.11) (pull_request) Successful in 28s
CI / test (3.12) (pull_request) Successful in 30s
The same job as napalm-fritzbox and napalm-opnsense: Python 3.10, 3.11 and
3.12, pytest, then wheel and sdist. napalm-device-types comes from
git.netork.io first, because PyPI has an unrelated package of that name.
2026-10-07 07:52:44 +02:00
Christian Manivong 8dc3b42fd3 fix: inherit MediaDriver instead of AccessPointDriver
A Sonos speaker implements none of the access-point surface — no SSIDs, no radio
configuration, no MAC ACL. It has get_playback_state, get_volume, play and
get_zone_info. It inherited AccessPointDriver because nothing better existed,
and netOrk reads that role to decide what belongs in its wireless page and its
AP profile pickers, so a speaker showed up in both.

napalm-device-types now has MediaDriver, which is what this is. TYPE_LABEL
becomes "Media" rather than "Access Point".

Same root cause as netork#117.
2026-08-21 13:07:37 +07:00
Christian ManivongandClaude Sonnet 4.6 f33ea2a774 feat: OUI_PREFIXES für MAC/ARP-Fingerprinting
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-24 15:41:45 +02:00
Christian ManivongandClaude Sonnet 4.6 f6bd38a9fe feat: Fingerprint-Attribute für Discovery-Scoring
Ergänzt DRIVER_NAME, HTTP_FINGERPRINT, SNMP_FINGERPRINT, SSH_FINGERPRINT,
PORT_SPECS und SNMP_OBJECT_ID_PREFIX gemäß docs/DISCOVERY_FINGERPRINTING.md.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-24 14:47:08 +02:00
Christian Manivong 6d8f01fe27 init 2026-06-13 03:18:28 +02:00