fix: Plus and Smart reads that read as empty, README requirements (#21, #22) #23

Merged
christianmanivong merged 2 commits from fix/bugs-2026-11-02b into main 2026-11-02 09:40:38 +00:00
Owner

What

#21: unread or failed reads are no longer reported as empty

  • Netgear Plus no longer overrides the NAPALM getters its web interface cannot do: get_mac_address_table, get_lldp_neighbors, get_lldp_neighbors_detail, get_config, get_users, get_snmp_information, get_ntp_servers, get_ntp_peers, get_ntp_stats. They fall through to NAPALM's stub, which raises NotImplementedError and lets an application see that the driver does not override it. They returned empty values without asking the switch. get_arp_table still returns [] (L2 only).
  • Breaking: Netgear Plus no longer has get_spanning_tree, get_port_channels, get_dot1x_ports and get_mac_acl. They returned {} without asking the switch. napalm-device-types only declares them, so an application tells capability by the method being there, as with the VLAN writes in #9.
  • Netgear Plus get_vlans_detail (and get_vlans through it) raises when vlan.cgi cannot be read: ConnectionException when the request fails, RuntimeError for a non-200 answer or an empty page. The fetch moves into _fetch_vlan_page (get_vlans_detail 67→58 lines, complexity under the limit).
  • Breaking: Netgear Plus get_vlans keys are int, as in NAPALM. get_vlans_detail keeps its string keys.
  • Smart get_snmp_config raises when show snmp fails instead of returning None ("no SNMP").
  • README getter table updated to match.

#22: README requirements

The table lists every dependency with the floor pyproject.toml declares: NAPALM 5.1 (was 4.0), plus paramiko and netaddr.

Why

A caller could not tell "not supported" or "could not read" from "read, none".

Tests

Fixtures only (no device). tests/unit/test_reads_not_empty.py:

  • each Plus NAPALM getter is NAPALM's own stub and raises;
  • the four switch-role getters are absent;
  • ARP stays [];
  • vlan.cgi is parsed from a page in the layout the parser documents (no recording exists), and get_vlans gives int keys;
  • a failed fetch, None, HTTP 500 and an empty page raise;
  • Smart get_snmp_config raises with show snmp failing.

19 of them failed before the change.

pytest 131 passed, ruff format/check clean, mypy clean, napalm-standard check passes, napalm-standard ratchet within the baseline (tightened: get_vlans_detail gone from complexity, 58 lines; Smart get_snmp_config complexity 16→15; netgear_smart.py 2067→2063 lines).

Closes #21
Closes #22

## What **#21: unread or failed reads are no longer reported as empty** - Netgear Plus no longer overrides the NAPALM getters its web interface cannot do: `get_mac_address_table`, `get_lldp_neighbors`, `get_lldp_neighbors_detail`, `get_config`, `get_users`, `get_snmp_information`, `get_ntp_servers`, `get_ntp_peers`, `get_ntp_stats`. They fall through to NAPALM's stub, which raises `NotImplementedError` and lets an application see that the driver does not override it. They returned empty values without asking the switch. `get_arp_table` still returns `[]` (L2 only). - **Breaking:** Netgear Plus no longer has `get_spanning_tree`, `get_port_channels`, `get_dot1x_ports` and `get_mac_acl`. They returned `{}` without asking the switch. napalm-device-types only declares them, so an application tells capability by the method being there, as with the VLAN writes in #9. - Netgear Plus `get_vlans_detail` (and `get_vlans` through it) raises when `vlan.cgi` cannot be read: `ConnectionException` when the request fails, `RuntimeError` for a non-200 answer or an empty page. The fetch moves into `_fetch_vlan_page` (`get_vlans_detail` 67→58 lines, complexity under the limit). - **Breaking:** Netgear Plus `get_vlans` keys are `int`, as in NAPALM. `get_vlans_detail` keeps its string keys. - Smart `get_snmp_config` raises when `show snmp` fails instead of returning `None` ("no SNMP"). - README getter table updated to match. **#22: README requirements** The table lists every dependency with the floor `pyproject.toml` declares: NAPALM 5.1 (was 4.0), plus paramiko and netaddr. ## Why A caller could not tell "not supported" or "could not read" from "read, none". ## Tests Fixtures only (no device). `tests/unit/test_reads_not_empty.py`: - each Plus NAPALM getter is NAPALM's own stub and raises; - the four switch-role getters are absent; - ARP stays `[]`; - `vlan.cgi` is parsed from a page in the layout the parser documents (no recording exists), and `get_vlans` gives int keys; - a failed fetch, `None`, HTTP 500 and an empty page raise; - Smart `get_snmp_config` raises with `show snmp` failing. 19 of them failed before the change. pytest 131 passed, ruff format/check clean, mypy clean, `napalm-standard check` passes, `napalm-standard ratchet` within the baseline (tightened: `get_vlans_detail` gone from complexity, 58 lines; Smart `get_snmp_config` complexity 16→15; `netgear_smart.py` 2067→2063 lines). Closes #21 Closes #22
christianmanivong added 2 commits 2026-11-02 08:22:37 +00:00
The requirements table named NAPALM 4.0 where pyproject.toml requires
5.1, and left out paramiko and netaddr. It now lists every dependency
with the floor pyproject.toml declares.

Closes #22
fix(plus): stop reporting unread or failed reads as empty
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
7e3c7d6285
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
christianmanivong merged commit a9b6205f4b into main 2026-11-02 09:40:38 +00:00
christianmanivong deleted branch fix/bugs-2026-11-02b 2026-11-02 09:40:38 +00:00
Sign in to join this conversation.