Beispiel #1
0
        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));
        }
Beispiel #2
0
        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 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));
 }
Beispiel #5
0
        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));
        }