def _make_snmp_plugin_store() -> SNMPPluginStore: return SNMPPluginStore({ s.name: SNMPPluginStoreItem( [BackendSNMPTree.from_frontend(base=t.base, oids=t.oids) for t in s.trees], SNMPDetectSpec(s.detect_spec)) for s in agent_based_register.iter_all_snmp_sections() })
def test_snmptree_from_frontend(): base = "1.2" tree = BackendSNMPTree.from_frontend( base=base, oids=[ OIDSpecTuple('2', "string", False), OIDSpecTuple('2', "string", True), OIDSpecTuple('2', "binary", False), OIDSpecTuple(SpecialColumn.END, "string", False), ], ) assert tree.base == base assert tree.oids == [ BackendOIDSpec("2", "string", False), BackendOIDSpec("2", "string", True), BackendOIDSpec("2", "binary", False), BackendOIDSpec(SpecialColumn.END, "string", False), ]
def test_snmptree_from_frontend(): base = "1.2" tree = BackendSNMPTree.from_frontend( base=base, oids=[ # this function will vanish, still use it for a moment: _create_oid_entry('2'), _create_oid_entry(OIDCached('2')), _create_oid_entry(OIDBytes('2')), _create_oid_entry(SpecialColumn.END), ], ) assert tree.base == base assert tree.oids == [ BackendOIDSpec("2", "string", False), BackendOIDSpec("2", "string", True), BackendOIDSpec("2", "binary", False), BackendOIDSpec(SpecialColumn.END, "string", False), ]