public void TestIEEE802dot11_MIB() { var registry = new SimpleObjectRegistry(); registry.Import(Parser.Compile(new MemoryStream(Properties.Resources.RFC_1212), new List <CompilerError>(), new List <CompilerWarning>())); registry.Import(Parser.Compile(new MemoryStream(Properties.Resources.RFC1155_SMI), new List <CompilerError>(), new List <CompilerWarning>())); registry.Import(Parser.Compile(new MemoryStream(Properties.Resources.RFC1213_MIB1), new List <CompilerError>(), new List <CompilerWarning>())); registry.Import(Parser.Compile(new MemoryStream(Properties.Resources.SNMPv2_SMI), new List <CompilerError>(), new List <CompilerWarning>())); registry.Import(Parser.Compile(new MemoryStream(Properties.Resources.SNMPv2_CONF), new List <CompilerError>(), new List <CompilerWarning>())); registry.Import(Parser.Compile(new MemoryStream(Properties.Resources.SNMPv2_TC), new List <CompilerError>(), new List <CompilerWarning>())); registry.Import(Parser.Compile(new MemoryStream(Properties.Resources.SNMPv2_MIB), new List <CompilerError>(), new List <CompilerWarning>())); registry.Import(Parser.Compile(new MemoryStream(Properties.Resources.SNMPv2_TM), new List <CompilerError>(), new List <CompilerWarning>())); registry.Import(Parser.Compile(new MemoryStream(Properties.Resources.IEEE802DOT11_MIB), new List <CompilerError>(), new List <CompilerWarning>())); registry.Refresh(); Assert.AreEqual("IEEE802dot11-MIB::dot11SMTnotification", registry.Translate(new uint[] { 1, 2, 840, 10036, 1, 6 })); uint[] id = registry.Translate("IEEE802dot11-MIB::dot11SMTnotification"); Assert.AreEqual(new uint[] { 1, 2, 840, 10036, 1, 6 }, id); const string name1 = "IEEE802dot11-MIB::dot11Disassociate"; var id1 = new uint[] { 1, 2, 840, 10036, 1, 6, 0, 1 }; Assert.AreEqual(id1, registry.Translate(name1)); Assert.AreEqual(name1, registry.Translate(id1)); }
/// ///////////////////////////////////////////////////////// public CResultAErreurType <ObjectRegistryBase> GetMibComplete() { CResultAErreurType <ObjectRegistryBase> resultBase = new CResultAErreurType <ObjectRegistryBase>(); try { SimpleObjectRegistry registre = new SimpleObjectRegistry(); if (!LoadInRegistre(registre)) { //Regarde s'il y a des modules manquants string[] strDeps = DependancesManquantes; if (strDeps.Length > 0) { resultBase.EmpileErreur(I.T("Can not compile this module because of missing dependancies|20254")); } else { resultBase.EmpileErreur(I.T("Can not compile this module|20255")); } } else { resultBase.DataType = registre; } } catch (Exception e) { resultBase.EmpileErreur(new CErreurException(e)); } return(resultBase); }
//--------------------------------------------------- public IDefinition GetRootDefinitionFromMibs() { SimpleObjectRegistry reg = new SimpleObjectRegistry(); foreach (CRelationTypeAgentSnmp_MibModule rel in RelationsModulesMib) { rel.MibModule.LoadInRegistre(reg); } return(reg.Tree.Root); }
public static void Main(string[] args) { if (args.Length != 1) { Console.WriteLine(@"This application takes one parameter."); return; } var registry = new SimpleObjectRegistry(); var collector = new ErrorRegistry(); registry.Tree.Collector = collector; registry.Import(Parser.Compile(GetLocation("SNMPv2-SMI.txt"), collector)); registry.Import(Parser.Compile(GetLocation("SNMPv2-CONF.txt"), collector)); registry.Import(Parser.Compile(GetLocation("SNMPv2-TC.txt"), collector)); registry.Import(Parser.Compile(GetLocation("SNMPv2-MIB.txt"), collector)); registry.Import(Parser.Compile(GetLocation("SNMPv2-TM.txt"), collector)); registry.Refresh(); var tree = registry.Tree; if (args[0].Contains("::")) { string name = args[0]; var oid = registry.Translate(name); var id = new ObjectIdentifier(oid); Console.WriteLine(id); } else { string oid = args[0]; var o = tree.Search(ObjectIdentifier.Convert(oid)); string textual = o.AlternativeText; Console.WriteLine(textual); if (o.GetRemaining().Count == 0) { Console.WriteLine(o.Definition.Type.ToString()); } } }
public void TestSYMMIB_MIB_MIB() { const string name = "SYMMIB_MIB-MIB::symbios_3_1"; var registry = new SimpleObjectRegistry(); registry.Import(Parser.Compile(new MemoryStream(Properties.Resources.RFC_1212), new List <CompilerError>(), new List <CompilerWarning>())); registry.Import(Parser.Compile(new MemoryStream(Properties.Resources.RFC1155_SMI), new List <CompilerError>(), new List <CompilerWarning>())); registry.Import(Parser.Compile(new MemoryStream(Properties.Resources.RFC1213_MIB1), new List <CompilerError>(), new List <CompilerWarning>())); registry.Import(Parser.Compile(new MemoryStream(Properties.Resources.HOST_RESOURCES_MIB), new List <CompilerError>(), new List <CompilerWarning>())); registry.Import(Parser.Compile(new MemoryStream(Properties.Resources.IF_MIB), new List <CompilerError>(), new List <CompilerWarning>())); registry.Import(Parser.Compile(new MemoryStream(Properties.Resources.IANAifType_MIB), new List <CompilerError>(), new List <CompilerWarning>())); registry.Import(Parser.Compile(new MemoryStream(Properties.Resources.SNMPv2_SMI), new List <CompilerError>(), new List <CompilerWarning>())); registry.Import(Parser.Compile(new MemoryStream(Properties.Resources.SNMPv2_CONF), new List <CompilerError>(), new List <CompilerWarning>())); registry.Import(Parser.Compile(new MemoryStream(Properties.Resources.SNMPv2_TC), new List <CompilerError>(), new List <CompilerWarning>())); registry.Import(Parser.Compile(new MemoryStream(Properties.Resources.SNMPv2_MIB), new List <CompilerError>(), new List <CompilerWarning>())); registry.Import(Parser.Compile(new MemoryStream(Properties.Resources.SNMPv2_TM), new List <CompilerError>(), new List <CompilerWarning>())); registry.Import(Parser.Compile(new MemoryStream(Properties.Resources.SYMMIB_MIB_MIB), new List <CompilerError>(), new List <CompilerWarning>())); registry.Import(Parser.Compile(new MemoryStream(Properties.Resources.DMTF_DMI_MIB), new List <CompilerError>(), new List <CompilerWarning>())); registry.Refresh(); uint[] id = registry.Translate(name); Assert.AreEqual(new uint[] { 1, 3, 6, 1, 4, 1, 1123, 3, 1 }, id); Assert.AreEqual(name, registry.Translate(id)); }
public void TestIEEE802dot11_MIB() { var registry = new SimpleObjectRegistry(); registry.Import(Parser.Compile(new MemoryStream(Properties.Resources.RFC_1212), new List<CompilerError>(), new List<CompilerWarning>())); registry.Import(Parser.Compile(new MemoryStream(Properties.Resources.RFC1155_SMI), new List<CompilerError>(), new List<CompilerWarning>())); registry.Import(Parser.Compile(new MemoryStream(Properties.Resources.RFC1213_MIB1), new List<CompilerError>(), new List<CompilerWarning>())); registry.Import(Parser.Compile(new MemoryStream(Properties.Resources.SNMPv2_SMI), new List<CompilerError>(), new List<CompilerWarning>())); registry.Import(Parser.Compile(new MemoryStream(Properties.Resources.SNMPv2_CONF), new List<CompilerError>(), new List<CompilerWarning>())); registry.Import(Parser.Compile(new MemoryStream(Properties.Resources.SNMPv2_TC), new List<CompilerError>(), new List<CompilerWarning>())); registry.Import(Parser.Compile(new MemoryStream(Properties.Resources.SNMPv2_MIB), new List<CompilerError>(), new List<CompilerWarning>())); registry.Import(Parser.Compile(new MemoryStream(Properties.Resources.SNMPv2_TM), new List<CompilerError>(), new List<CompilerWarning>())); registry.Import(Parser.Compile(new MemoryStream(Properties.Resources.IEEE802DOT11_MIB), new List<CompilerError>(), new List<CompilerWarning>())); registry.Refresh(); Assert.AreEqual("IEEE802dot11-MIB::dot11SMTnotification", registry.Translate(new uint[] {1, 2, 840, 10036, 1, 6})); uint[] id = registry.Translate("IEEE802dot11-MIB::dot11SMTnotification"); Assert.AreEqual(new uint[] {1, 2, 840, 10036, 1, 6}, id); const string name1 = "IEEE802dot11-MIB::dot11Disassociate"; var id1 = new uint[] {1, 2, 840, 10036, 1, 6, 0, 1}; Assert.AreEqual(id1, registry.Translate(name1)); Assert.AreEqual(name1, registry.Translate(id1)); }
public void TestSYMMIB_MIB_MIB() { const string name = "SYMMIB_MIB-MIB::symbios_3_1"; var registry = new SimpleObjectRegistry(); registry.Import(Parser.Compile(new MemoryStream(Properties.Resources.RFC_1212), new List<CompilerError>(), new List<CompilerWarning>())); registry.Import(Parser.Compile(new MemoryStream(Properties.Resources.RFC1155_SMI), new List<CompilerError>(), new List<CompilerWarning>())); registry.Import(Parser.Compile(new MemoryStream(Properties.Resources.RFC1213_MIB1), new List<CompilerError>(), new List<CompilerWarning>())); registry.Import(Parser.Compile(new MemoryStream(Properties.Resources.HOST_RESOURCES_MIB), new List<CompilerError>(), new List<CompilerWarning>())); registry.Import(Parser.Compile(new MemoryStream(Properties.Resources.IF_MIB), new List<CompilerError>(), new List<CompilerWarning>())); registry.Import(Parser.Compile(new MemoryStream(Properties.Resources.IANAifType_MIB), new List<CompilerError>(), new List<CompilerWarning>())); registry.Import(Parser.Compile(new MemoryStream(Properties.Resources.SNMPv2_SMI), new List<CompilerError>(), new List<CompilerWarning>())); registry.Import(Parser.Compile(new MemoryStream(Properties.Resources.SNMPv2_CONF), new List<CompilerError>(), new List<CompilerWarning>())); registry.Import(Parser.Compile(new MemoryStream(Properties.Resources.SNMPv2_TC), new List<CompilerError>(), new List<CompilerWarning>())); registry.Import(Parser.Compile(new MemoryStream(Properties.Resources.SNMPv2_MIB), new List<CompilerError>(), new List<CompilerWarning>())); registry.Import(Parser.Compile(new MemoryStream(Properties.Resources.SNMPv2_TM), new List<CompilerError>(), new List<CompilerWarning>())); registry.Import(Parser.Compile(new MemoryStream(Properties.Resources.SYMMIB_MIB_MIB), new List<CompilerError>(), new List<CompilerWarning>())); registry.Import(Parser.Compile(new MemoryStream(Properties.Resources.DMTF_DMI_MIB), new List<CompilerError>(), new List<CompilerWarning>())); registry.Refresh(); uint[] id = registry.Translate(name); Assert.AreEqual(new uint[] { 1, 3, 6, 1, 4, 1, 1123, 3, 1 }, id); Assert.AreEqual(name, registry.Translate(id)); }
//------------------------------- public void ReloadMibs() { m_registry = null; }