fix(snmp): read get_snmp_information's community from the Name column #15

Merged
christianmanivong merged 1 commits from fix/bugs-2026-11-02 into main 2026-11-02 08:12:22 +00:00
Owner

What

get_snmp_information() reads each community from the community table's Name column and its access from the Type column.

  • New pure parser parse_snmp_community_access() in napalm_tplink_jetstream/parsers.py: community name → "rw" when its Type says write, "ro" otherwise. It shares the header/dashes table reading with parse_snmp_communities() (from #13), which keeps its behaviour.
  • get_snmp_information() uses it instead of its own row splitting. The "SNMP disabled" check is unchanged.

Why

The switch's table starts with an Index column. The getter took the first word of each row as the community, so the switch's public was reported as 1, and read the access from the second word (the name), so every community came out read-only.

Tests

Fixtures only (no device): tests/unit/test_snmp_information.py against the recorded jetstream-show-snmp-server-community.txt, plus that recording with a read-write row and with a read-only community named writers added in the same layout, and parser edge cases (no rows, no Name column, no Type column, unknown output). The getter tests failed before the change ({'1': ...} instead of {'public': ...}).

pytest 64 passed, ruff format/check clean, mypy clean, napalm-standard ratchet within the baseline (tplink_jetstream.py 2013→1999 lines), napalm-standard check passes.

Closes #14

## What `get_snmp_information()` reads each community from the community table's `Name` column and its access from the `Type` column. - New pure parser `parse_snmp_community_access()` in `napalm_tplink_jetstream/parsers.py`: community name → `"rw"` when its `Type` says write, `"ro"` otherwise. It shares the header/dashes table reading with `parse_snmp_communities()` (from #13), which keeps its behaviour. - `get_snmp_information()` uses it instead of its own row splitting. The "SNMP disabled" check is unchanged. ## Why The switch's table starts with an `Index` column. The getter took the first word of each row as the community, so the switch's `public` was reported as `1`, and read the access from the second word (the name), so every community came out read-only. ## Tests Fixtures only (no device): `tests/unit/test_snmp_information.py` against the recorded `jetstream-show-snmp-server-community.txt`, plus that recording with a `read-write` row and with a read-only community named `writers` added in the same layout, and parser edge cases (no rows, no `Name` column, no `Type` column, unknown output). The getter tests failed before the change (`{'1': ...}` instead of `{'public': ...}`). pytest 64 passed, ruff format/check clean, mypy clean, `napalm-standard ratchet` within the baseline (`tplink_jetstream.py` 2013→1999 lines), `napalm-standard check` passes. Closes #14
christianmanivong added 1 commit 2026-11-02 07:41:05 +00:00
fix(snmp): read get_snmp_information's community from the Name column
driver / standard (pull_request) Successful in 18s
driver / lint (pull_request) Successful in 16s
driver / test (3.12) (pull_request) Successful in 1m5s
driver / types (pull_request) Successful in 1m12s
driver / test (3.13) (pull_request) Successful in 1m4s
driver / lowest (pull_request) Successful in 30s
driver / build (pull_request) Successful in 33s
driver / security (pull_request) Successful in 1m13s
CI / driver (pull_request) Successful in 2m55s
driver / publish (pull_request) Skipped
9df131db78
The switch's community table starts with an Index column. The getter
took the first word of each row as the community, so "public" was
reported as "1", and read the access from the second word, the name,
so every community came out read-only. It now uses the header-based
community table parser: the name from Name, the access from Type.

Closes #14
christianmanivong merged commit 7af20c5889 into main 2026-11-02 08:12:22 +00:00
christianmanivong deleted branch fix/bugs-2026-11-02 2026-11-02 08:12:22 +00:00
Sign in to join this conversation.