Every REST getter builds its answer from it — get_facts (system.get("name", ""), line 217), interfaces (ports_data = self.get("ports"), line 256), counters, VLANs, LLDP — so an expired session cookie, a timeout or an HTTP 500 produces a switch with an empty hostname, no ports, no VLANs and no neighbours instead of an error. netOrk stores those answers as the switch's state.
(get_snmp_communities / configure_snmp_community use the same get(); they are dead code per #12, and #10 proposes using get_snmp_communities on the REST transport — its endpoint snmp-server/community and the snmp_community_element key should be checked against a real switch's REST API before that, since an error there would also read as "no communities".)
Expected
get() raises ConnectionException (connection error, 401/403 after re-login) or a RuntimeError with the status for other non-2xx answers; a 404 for an optional resource is handled by the caller that expects it. Test-first: get("ports") answering 500 makes get_interfaces() raise.
Priority: P3 — wrong (empty) switch state in netOrk after any transient REST error.
Found during the bug sweep of 2026-11-01.
## What happens
`ProcurveApiClient.get()` (`napalm_procurve/api_client.py` 171-186) returns parsed JSON or, on any non-2xx status or exception, logs and returns `{}`:
```python
"""GET ``{base_url}{endpoint}`` and return parsed JSON (or empty dict)."""
...
logger.warning("GET %s error: %s", url, exc)
```
Every REST getter builds its answer from it — `get_facts` (`system.get("name", "")`, line 217), interfaces (`ports_data = self.get("ports")`, line 256), counters, VLANs, LLDP — so an expired session cookie, a timeout or an HTTP 500 produces a switch with an empty hostname, no ports, no VLANs and no neighbours instead of an error. netOrk stores those answers as the switch's state.
(`get_snmp_communities` / `configure_snmp_community` use the same `get()`; they are dead code per #12, and #10 proposes using `get_snmp_communities` on the REST transport — its endpoint `snmp-server/community` and the `snmp_community_element` key should be checked against a real switch's REST API before that, since an error there would also read as "no communities".)
## Expected
`get()` raises `ConnectionException` (connection error, 401/403 after re-login) or a `RuntimeError` with the status for other non-2xx answers; a 404 for an optional resource is handled by the caller that expects it. Test-first: `get("ports")` answering 500 makes `get_interfaces()` raise.
Priority: P3 — wrong (empty) switch state in netOrk after any transient REST error.
Found during the bug sweep of 2026-11-01.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
What happens
ProcurveApiClient.get()(napalm_procurve/api_client.py171-186) returns parsed JSON or, on any non-2xx status or exception, logs and returns{}:Every REST getter builds its answer from it —
get_facts(system.get("name", ""), line 217), interfaces (ports_data = self.get("ports"), line 256), counters, VLANs, LLDP — so an expired session cookie, a timeout or an HTTP 500 produces a switch with an empty hostname, no ports, no VLANs and no neighbours instead of an error. netOrk stores those answers as the switch's state.(
get_snmp_communities/configure_snmp_communityuse the sameget(); they are dead code per #12, and #10 proposes usingget_snmp_communitieson the REST transport — its endpointsnmp-server/communityand thesnmp_community_elementkey should be checked against a real switch's REST API before that, since an error there would also read as "no communities".)Expected
get()raisesConnectionException(connection error, 401/403 after re-login) or aRuntimeErrorwith the status for other non-2xx answers; a 404 for an optional resource is handled by the caller that expects it. Test-first:get("ports")answering 500 makesget_interfaces()raise.Priority: P3 — wrong (empty) switch state in netOrk after any transient REST error.
Found during the bug sweep of 2026-11-01.