feat: declare the SNMP health OIDs instead of collecting them (0.3.0)
CI / test (3.10) (push) Successful in 31s
CI / test (3.11) (push) Successful in 30s
CI / test (3.12) (push) Successful in 33s
CI / test (3.10) (pull_request) Successful in 33s
CI / test (3.11) (pull_request) Successful in 30s
CI / test (3.12) (pull_request) Successful in 32s

The driver no longer collects over SNMP. SNMP_HEALTH_PROFILE states
where the switch publishes its values; the application polls and
computes (napalm-device-types docs/STRUCTURE.md).

This also fixes the memory figure: NETSWITCH-MIB hpLocalMemEntry column
6 is free memory, not used. On swt-l0-3-40 total 58720256 = free
39105640 + allocated 19614616, so the switch showed 66.6 % used instead
of 33.4 %. The profile names column 6 as free.

Interface counters now come from the 64-bit ifXTable where the switch
has it, as the application reads them for every device.

Closes #9
This commit is contained in:
Christian Manivong committed 2026-10-16 12:02:00 +02:00
1 parent 03c8f0588d
commit 39d5e69270
3 files changed
+48 -64

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
"""The switch's SNMP health OIDs, declared as data (napalm-device-types docs/STRUCTURE.md).
The driver does not collect over SNMP; the application polls with this profile.
"""
from napalm_procurve.procurve import ProcurveDriver
PROFILE = ProcurveDriver.SNMP_HEALTH_PROFILE
MEM = "1.3.6.1.4.1.11.2.14.11.5.1.1.2.1.1.1" # NETSWITCH-MIB hpLocalMemEntry
def test_the_driver_does_not_collect_itself():
assert "get_health_metrics" not in vars(ProcurveDriver)
def test_uptime_from_the_switch_mib():
assert PROFILE["uptime"] == {"oids": ["1.3.6.1.4.1.11.2.14.11.1.2.4.1.5.1"]}
def test_cpu_from_the_current_oid_then_the_older_firmware_s():
assert PROFILE["cpu"] == {
"oids": ["1.3.6.1.4.1.11.2.14.11.5.1.9.6.1.0", "1.3.6.1.4.1.11.2.3.7.8.6.1.0"]
}
def test_memory_column_6_is_free_not_used():
# On swt-l0-3-40 (2026-10-16): total (.5) 58720256 = free (.6) 39105640
# + allocated (.7) 19614616. Read as "used", .6 showed 66.6 % instead of 33.4 % (#9).
assert PROFILE["memory"] == {
"total": {"oids": [f"{MEM}.5.1"]},
"free": {"oids": [f"{MEM}.6.1"]},
"unit": "bytes",
}