예제 #1
0
def make_plugin_store() -> SNMPPluginStore:
    inventory_sections = make_inventory_sections()
    return SNMPPluginStore({
        s.name: SNMPPluginStoreItem(
            [BackendSNMPTree.from_frontend(base=t.base, oids=t.oids) for t in s.trees],
            SNMPDetectSpec(s.detect_spec),
            s.name in inventory_sections,
        ) for s in agent_based_register.iter_all_snmp_sections()
    })
예제 #2
0
 def store(self) -> SNMPPluginStore:
     return SNMPPluginStore(
         {
             SectionName("section0"): SNMPPluginStoreItem(
                 [
                     BackendSNMPTree(
                         base=".1.2.3",
                         oids=[
                             BackendOIDSpec("4.5", "string", False),
                             BackendOIDSpec("9.7", "string", False),
                         ],
                     ),
                     BackendSNMPTree(
                         base=".8.9.0",
                         oids=[
                             BackendOIDSpec("1.2", "string", False),
                             BackendOIDSpec("3.4", "string", False),
                         ],
                     ),
                 ],
                 SNMPDetectSpec(
                     [
                         [
                             ("oid0", "regex0", True),
                             ("oid1", "regex1", True),
                             ("oid2", "regex2", False),
                         ]
                     ]
                 ),
                 False,
             ),
             SectionName("section1"): SNMPPluginStoreItem(
                 [
                     BackendSNMPTree(
                         base=".1.2.3",
                         oids=[
                             BackendOIDSpec("4.5", "string", False),
                             BackendOIDSpec("6.7.8", "string", False),
                         ],
                     )
                 ],
                 SNMPDetectSpec(
                     [
                         [
                             ("oid3", "regex3", True),
                             ("oid4", "regex4", False),
                         ]
                     ]
                 ),
                 False,
             ),
         }
     )
예제 #3
0
 def snmp_plugin_fixture(self) -> None:
     SNMPFetcher.plugin_store = SNMPPluginStore({
         SectionName("pim"):
         SNMPPluginStoreItem(
             trees=[
                 BackendSNMPTree(
                     base=".1.1.1",
                     oids=[
                         BackendOIDSpec("1.2", "string", False),
                         BackendOIDSpec("3.4", "string", False),
                     ],
                 )
             ],
             detect_spec=SNMPDetectSpec([[("1.2.3.4", "pim device", True)]
                                         ]),
             inventory=False,
         ),
         SectionName("pam"):
         SNMPPluginStoreItem(
             trees=[
                 BackendSNMPTree(
                     base=".1.2.3",
                     oids=[
                         BackendOIDSpec("4.5", "string", False),
                         BackendOIDSpec("6.7", "string", False),
                         BackendOIDSpec("8.9", "string", False),
                     ],
                 ),
             ],
             detect_spec=SNMPDetectSpec([[("1.2.3.4", "pam device", True)]
                                         ]),
             inventory=False,
         ),
         SectionName("pum"):
         SNMPPluginStoreItem(
             trees=[
                 BackendSNMPTree(
                     base=".2.2.2",
                     oids=[BackendOIDSpec("2.2", "string", False)]),
                 BackendSNMPTree(
                     base=".3.3.3",
                     oids=[BackendOIDSpec("2.2", "string", False)]),
             ],
             detect_spec=SNMPDetectSpec([[]]),
             inventory=False,
         ),
     })
예제 #4
0
 def test_serialization(self, store: SNMPPluginStore) -> None:
     assert SNMPPluginStore.deserialize(store.serialize()) == store
예제 #5
0
 def global_config(self):
     return GlobalConfig(
         cmc_log_level=5,
         cluster_max_cachefile_age=90,
         snmp_plugin_store=SNMPPluginStore(),
     )
예제 #6
0
 def global_config(self):
     return GlobalConfig(cmc_log_level=5,
                         snmp_plugin_store=SNMPPluginStore())