"""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. """ import re from napalm_netgear.netgear_smart import NetgearSmartDriver PROFILE = NetgearSmartDriver.SNMP_HEALTH_PROFILE def test_the_driver_does_not_collect_itself(): assert "get_health_metrics" not in vars(NetgearSmartDriver) def test_uptime_from_the_standard_sysuptime(): assert PROFILE["uptime"] == {"oids": ["1.3.6.1.2.1.1.3.0"]} def test_memory_from_total_and_free_in_kib(): assert PROFILE["memory"] == { "total": {"oids": ["1.3.6.1.4.1.4526.100.1.1.4.2.0"]}, "free": {"oids": ["1.3.6.1.4.1.4526.100.1.1.4.1.0"]}, "unit": "KiB", } def test_cpu_is_the_five_second_figure_in_a_text_value(): cpu = PROFILE["cpu"] assert cpu["oids"] == ["1.3.6.1.4.1.4526.100.1.1.4.9.0"] text = " 5 Secs ( 3.2%) 60 Secs ( 4.1%) 300 Secs ( 2.0%)" assert re.search(cpu["pattern"], text).group(1) == "3.2"