Python Netgear Switch Interface Library
Query and control all your Netgear switches — SNMP (managed), NSDP and HTTP
web-UI (Plus) — behind one model-driven Python API and the ngsw CLI.
[!WARNING] This library and its documentation were written by an AI. Every line of code, every test and every documentation page was generated by a language model, with a human directing and reviewing the work.
The device behaviour in it is measured — protocol details and firmware quirks come from captured traffic and live runs against the real switches, recorded with the host and firmware they were seen on — and the support tables are generated from the code rather than written by hand. But an AI is perfectly capable of confident, fluent error, and nothing here has had independent human review at scale. Verify anything that matters to you against the source or your own hardware, and please report what you find.
Documentation: https://python-netgear-switch-library.readthedocs.io/ — API
reference, the complete ngsw CLI reference, the virtual-switch guide (how to
test your own tools against a mock), and generated
model × protocol and model × functionality support tables.
Status: early development. See docs/superpowers/specs/ for the design and
docs/superpowers/plans/ for the implementation plans.
Installation
pip / uv (PyPI)
pip install python-netgear-switch-library
# or: uv add python-netgear-switch-library
Optional extras: [async] (pysnmp), [http] (httpx). The synchronous SNMP
transport shells out to the net-snmp command-line tools, a system package
(not a Python dependency):
sudo apt install snmp # provides snmpget/snmpbulkwalk/snmpset
Debian / Ubuntu (apt)
Signed .deb packages for Debian trixie and sid are published to a
GitHub Pages apt repository. Pick the line matching your suite:
sudo install -d -m0755 /etc/apt/keyrings
curl -fsSL https://mithro.github.io/python-netgear-switch-library/netgear-switch.gpg \
| sudo tee /etc/apt/keyrings/netgear-switch.gpg > /dev/null
# trixie:
echo "deb [signed-by=/etc/apt/keyrings/netgear-switch.gpg] https://mithro.github.io/python-netgear-switch-library/trixie/ ./" \
| sudo tee /etc/apt/sources.list.d/netgear-switch.list
# sid:
echo "deb [signed-by=/etc/apt/keyrings/netgear-switch.gpg] https://mithro.github.io/python-netgear-switch-library/sid/ ./" \
| sudo tee /etc/apt/sources.list.d/netgear-switch.list
sudo apt update
sudo apt install python3-netgear-switch-library
This installs the netgear_switch library and the ngsw CLI, and pulls in the
snmp net-snmp CLI tools automatically.
Either way, once installed run ngsw --help to see available commands.
Versioning
This project is a rolling release: the version is derived from git
(0.0.postN / X.Y.postN), and every merge to main publishes a new version
to PyPI and the apt repo. There are no tags or manual version bumps.
Mock switch daemons (ngsw serve)
The library ships in-repo virtual/mock switches. ngsw serve runs them as
standalone, long-lived daemons on real sockets, so an external tool or library
can point at a mock when real hardware is unavailable (CI, local development,
demos).
# Serve one model (ephemeral ports), or several, or every registered model:
ngsw serve --model gsm7228ps
ngsw serve --model gsm7228ps --model gs305ep
ngsw serve --all
For each switch that comes up it prints the model, bind host, the actual bound
port(s) (SNMP/NSDP over UDP, HTTP over TCP), and the SNMP community and HTTP
password it accepts, then blocks until interrupted (Ctrl-C / SIGTERM), at
which point every switch is stopped cleanly:
[gsm7228ps] host=127.0.0.1
SNMP udp/36540
HTTP tcp/42629
community='public' http_password='password'
serving 1 mock switch(es); press Ctrl-C to stop
Point any tool at the printed port. For example, with the mock above serving
SNMP on UDP 36540:
snmpwalk -v2c -c public 127.0.0.1:36540 1.3.6.1.2.1.1
# ...or the library's own CLI against the same mock:
ngsw --host 127.0.0.1 --model gsm7228ps --community public ports # + your transport wiring
Options:
--model KEY— model to serve; repeatable.--allserves every registered model (seengsw models).--host IP— bind address (default127.0.0.1). Pass0.0.0.0to expose the mock to other hosts on the network.--community STR/--http-password STR— credentials the mock accepts (defaultspublic/password).--port N/--http-port N— pin the SNMP/NSDP UDP port and the HTTP TCP port instead of using ephemeral ones. Because a pinned port is a single listener, these are only allowed when serving exactly one model; otherwise leave them unset and read the printed ephemeral ports.
Full details, including worked examples of testing an external tool against a mock, are in the virtual switch guide.
Development
uv sync --all-extras
uv run pytest
uv run ruff check
uv run mypy
Build the documentation (warnings are errors, as on Read the Docs):
uv sync --extra docs
make -C docs html
License
Apache-2.0.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python_netgear_switch_library-0.0.post356.tar.gz.
File metadata
- Download URL: python_netgear_switch_library-0.0.post356.tar.gz
- Upload date:
- Size: 1.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66b9e90bdd7f59f5bc39381feaa0e88709edb6d3aca754535d5dc79b12e4e61b
|
|
| MD5 |
56414dee698de5719d328a821c8d4eeb
|
|
| BLAKE2b-256 |
ffaae7dfd9e4e857515f6617bf70a63d52eaf0a14a6a15bb391b349c66d96c8e
|
Provenance
The following attestation bundles were made for python_netgear_switch_library-0.0.post356.tar.gz:
Publisher:
publish-pypi.yml on mithro/python-netgear-switch-library
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
python_netgear_switch_library-0.0.post356.tar.gz -
Subject digest:
66b9e90bdd7f59f5bc39381feaa0e88709edb6d3aca754535d5dc79b12e4e61b - Sigstore transparency entry: 2321523882
- Sigstore integration time:
-
Permalink:
mithro/python-netgear-switch-library@da9cf6a862680732fd37b2897cbb22a162bfb34f -
Branch / Tag:
refs/heads/main - Owner: https://github.com/mithro
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@da9cf6a862680732fd37b2897cbb22a162bfb34f -
Trigger Event:
push
-
Statement type:
File details
Details for the file python_netgear_switch_library-0.0.post356-py3-none-any.whl.
File metadata
- Download URL: python_netgear_switch_library-0.0.post356-py3-none-any.whl
- Upload date:
- Size: 428.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ae79a6cd6ef73609eeff6513fb70e41b8a98a558f3cc73b929007158fb34c0f
|
|
| MD5 |
07d7239224c244a6ab73a5cedc23d0ce
|
|
| BLAKE2b-256 |
da86ddd35730579a837f2bb547257e906731cc33fe18f717df0b93c76564e190
|
Provenance
The following attestation bundles were made for python_netgear_switch_library-0.0.post356-py3-none-any.whl:
Publisher:
publish-pypi.yml on mithro/python-netgear-switch-library
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
python_netgear_switch_library-0.0.post356-py3-none-any.whl -
Subject digest:
4ae79a6cd6ef73609eeff6513fb70e41b8a98a558f3cc73b929007158fb34c0f - Sigstore transparency entry: 2321524214
- Sigstore integration time:
-
Permalink:
mithro/python-netgear-switch-library@da9cf6a862680732fd37b2897cbb22a162bfb34f -
Branch / Tag:
refs/heads/main - Owner: https://github.com/mithro
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@da9cf6a862680732fd37b2897cbb22a162bfb34f -
Trigger Event:
push
-
Statement type: