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
2.0 KiB
napalm-sonos
NAPALM driver for Sonos speakers, built on
napalm-device-types (MediaDriver).
It talks to the speaker through SoCo.
Tested against
| Model | Firmware |
|---|---|
| not recorded yet |
Connection
UPnP/SOAP over HTTP on port 1400, through SoCo. A Sonos speaker takes no login:
username and password are accepted for NAPALM's constructor and ignored.
open() reads the speaker info once; is_alive() checks that TCP port 1400 accepts
a connection.
from napalm import get_network_driver
driver = get_network_driver("sonos")
with driver("192.0.2.20") as speaker:
print(speaker.get_facts())
print(speaker.get_playback_state())
Supported
| Getter / action | |
|---|---|
get_facts |
from the speaker info read at open() |
get_interfaces, get_interfaces_ip |
one interface, wlan0, for the speaker's network connection (see below) |
get_playback_state, get_current_track |
yes |
get_volume, set_volume, get_mute, set_mute |
yes |
play, pause, stop, next_track, previous_track |
yes |
get_group_info, get_zone_info |
yes |
Whether a speaker is wired or wireless is not known: SoCo offers no reading for it
(deviceProperties is the UPnP service of that name, and none of its actions says), so
the driver reports no eth0. The one interface keeps the name wlan0; it stands for the
speaker's connection, whatever its medium.
Not supported
Configuration management (load_replace_candidate and load_merge_candidate raise
NotImplementedError), the CLI, and every routing, LLDP, ARP, NTP, SNMP, BGP, user
and environment getter: they return empty results.
Installation
pip install napalm-sonos
Development
The rules are in STANDARDS.md.
python -m venv .venv && .venv/bin/pip install -e ".[dev]"
.venv/bin/pytest --cov
License
Apache-2.0