Files
napalm-netgear/README.md
T
Christian Manivong 7e3c7d6285
driver / standard (pull_request) Successful in 18s
driver / lint (pull_request) Successful in 15s
driver / types (pull_request) Successful in 1m10s
driver / test (3.12) (pull_request) Successful in 1m17s
driver / test (3.13) (pull_request) Successful in 1m13s
driver / lowest (pull_request) Successful in 29s
driver / build (pull_request) Successful in 32s
driver / security (pull_request) Successful in 1m16s
CI / driver (pull_request) Successful in 3m7s
driver / publish (pull_request) Skipped
fix(plus): stop reporting unread or failed reads as empty
Netgear Plus answered reads its web interface cannot do (MAC table,
LLDP, config, users, SNMP, NTP) with empty values without asking the
switch; those now fall through to NAPALM's NotImplementedError, and the
switch-role getters that only returned {} (spanning tree, port channels,
802.1X, MAC ACL) are gone, as device-types reads capability from the
method being there. get_vlans_detail raises when vlan.cgi cannot be
read, get_vlans keys VLANs by int, and Smart get_snmp_config raises when
show snmp fails instead of reading as "no SNMP".

Closes #21
2026-11-02 09:22:22 +01:00

162 lines
6.2 KiB
Markdown

# napalm-netgear-switches
NAPALM community drivers for two families of Netgear switches:
| Driver | Switches | Transport |
|---|---|---|
| `netgear_smart` | Smart Managed Pro (GS110TP, GS108EPP, GS316EPP, …) | SSH CLI via Netmiko |
| `netgear_plus` | Plus / Smart Managed Plus (GS308EP, …) | the switch's web interface over HTTP, via [py-netgear-plus](https://pypi.org/project/py-netgear-plus/) |
The two drivers share the package, not their abilities: `netgear_plus` reads far less than
`netgear_smart`, and changes nothing but PoE. The tables below say which driver does what.
## Tested devices
| Model | Series | Driver | Tested |
|---|---|---|---|
| GS110TP | Smart Managed Pro | `netgear_smart` | ✅ |
| GS108EPP | Smart Managed Pro | `netgear_smart` | ✅ |
| GS316EPP | Smart Managed Pro | `netgear_smart` | ✅ |
| GS308EP | Plus | `netgear_plus` | ✅ |
> Other models from the Smart Managed Pro series should work with `netgear_smart`, and
> other Plus models that py-netgear-plus recognises with `netgear_plus` —
> contributions welcome.
## Requirements
| Dependency | Minimum version |
|---|---|
| Python | 3.12 |
| NAPALM | 5.1 |
| napalm-device-types | 4.21.1 |
| Netmiko | 4.0.0 |
| paramiko | 5.0.0 |
| netaddr | 0.7.19 |
| py-netgear-plus (`netgear_plus`) | 0.6.4 |
The same floors as `pyproject.toml`; `pip` installs all of them with the package.
## Installation
```bash
pip install napalm-netgear-switches
```
The name `napalm-netgear` on PyPI belongs to another project. The import package is
still `napalm_netgear`, and the drivers are still `netgear_smart` and `netgear_plus`.
Or from source:
```bash
git clone https://git.netork.io/NAPALM/napalm-netgear.git
cd napalm-netgear
pip install -e .
```
## Quick start
```python
from napalm import get_network_driver
driver = get_network_driver("netgear_smart")
with driver("192.168.0.239", "admin", "password") as device:
facts = device.get_facts()
print(facts)
```
## Implemented getters
✅ implemented · ⚪ always returns an empty value, the switch is not asked ·
❌ raises `NotImplementedError` (or, for a driver without the method, it does not exist)
| Getter / method | `netgear_smart` | `netgear_plus` | Notes on `netgear_plus` |
|---|---|---|---|
| `get_facts` | ✅ | ✅ | model, hostname, os_version, serial; `uptime` is always `0.0` |
| `get_interfaces` | ✅ | ✅ | link, speed, port name; `is_enabled` always `True`, `mtu` always 1518, no MAC |
| `get_interfaces_ip` | ✅ | ⚪ | |
| `get_config` | ✅ | ❌ | the web interface has no configuration text |
| `get_arp_table` | ✅ | ⚪ | the switches are L2 only: no ARP table |
| `get_mac_address_table` | ✅ | ❌ | |
| `get_lldp_neighbors` | ✅ | ❌ | |
| `get_lldp_neighbors_detail` | ✅ | ❌ | |
| `get_vlans` | ✅ | ✅ | 802.1Q VLANs from the web page `vlan.cgi`; raises when it cannot be read |
| `get_vlans_detail` | ❌ | ✅ | tagged and untagged ports per VLAN; keys are strings (`"1"`) |
| `get_environment` | ✅ | ✅ | Smart: CPU + memory only. Plus: PoE power status per PoE port only |
| `get_interfaces_counters` | ✅ | ✅ | rx/tx octets from the switch's cumulative totals, CRC errors as rx_errors; the rest `0` |
| `get_users` | ✅ | ❌ | |
| `get_snmp_information` | ✅ | ❌ | |
| `get_snmp_config` | ✅ | ⚪ | always `None`: SNMP is not read |
| `get_ntp_servers` | ✅ | ❌ | |
| `get_ntp_peers` | ✅ | ❌ | Smart: same as servers |
| `get_ntp_stats` | ⚪ | ❌ | not exposed via the Smart CLI |
| `get_route_to` | ✅ | ❌ | Smart: static/connected only |
| `get_poe_status` | ✅ | ✅ | delivering or searching per PoE port, the model's power budgets; `enabled` always `True`, no power draw |
| `set_poe_enabled` | ❌ | ✅ | |
| `power_cycle_port` | ❌ | ✅ | |
| `get_firmware_offer` | ❌ | ✅ | GS305EP, GS305EPP, GS308EP, GS308EPP; see below |
| `ping` | ✅ | ❌ | Plus: `supports_ping()` is `False` |
| `traceroute` | ❌ | ❌ | |
| `cli` | ✅ | ❌ | Plus has no CLI |
| `is_alive` | ✅ | ✅ | Plus: whether `open()` logged in; the switch is not asked |
| `load_merge_candidate` | ✅ | ❌ | |
| `load_replace_candidate` | ✅ | ❌ | Smart: additive — no atomic replace |
| `compare_config` | ✅ | ❌ | |
| `commit_config` | ✅ | ❌ | |
| `discard_config` | ✅ | ❌ | |
| `rollback` | ✅ | ❌ | Smart: session-scoped backup |
| `get_bgp_neighbors` | ❌ | ❌ | not applicable |
| `get_optics` | ⚪ | ❌ | DDM not exposed via the Smart CLI |
| `get_ipv6_neighbors_table` | ⚪ | ❌ | not exposed via the Smart CLI |
Neither driver has `get_spanning_tree`, `get_port_channels`, `get_dot1x_ports` or
`get_mac_acl`.
## Connecting
### `netgear_smart` (SSH)
| Optional argument | Default | Description |
|---|---|---|
| `port` | `22` | SSH port |
| `force_no_enable` | `False` | Skip `enable` after login |
| `canonical_int_fmt` | `False` | Use canonical interface names |
Any additional keyword arguments are forwarded to Netmiko.
CLI notes:
* Netmiko device type: `netgear_prosafe`
* Prompt pattern: `(hostname) >` / `(hostname) #` / `(hostname) (Config)#`
* Interface naming: `0/1`, `0/2`, … (slot/port); LAG channels: `ch1`, `ch2`, …
* Config is persisted with `write memory`
* Key-value output uses `Key: value` **or** `Key..... value` notation
depending on firmware generation — both are handled automatically
### `netgear_plus` (HTTP)
* The switch's web interface over plain HTTP, through py-netgear-plus, which detects
the model at login. The VLAN and port-name pages (`vlan.cgi`, `dashboard.cgi`) are
read directly.
* The login takes the password only: `username` is accepted and ignored. The password
is sent over plain HTTP.
* `optional_args` are ignored, and so is `timeout`; none of the Netmiko options above
applies.
* Interfaces are named `port1`, `port2`, …
* `get_firmware_offer` sends HTTPS `HEAD` requests to Netgear's download server
(`downloads.netgear.com`) to find the newest firmware for the model, at most once per
24 hours per model and process. Other models get `None`.
## Development
The rules are in [STANDARDS.md](https://git.netork.io/NAPALM/driver-standard/src/branch/main/STANDARDS.md).
```bash
python -m venv .venv && .venv/bin/pip install -e ".[dev]"
.venv/bin/pytest --cov
```
## License
Apache 2.0 — see [LICENSE](LICENSE).