Exemplo n.º 1
0
        public IModule Resolve(string moduleName)
        {
            if (Directory.Exists(_path))
            {
                string[] matchedFiles = Directory.GetFiles(
                    _path,
                    "*",
                    (_recursive) ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly);

                if ((matchedFiles != null) && (matchedFiles.Length >= 1))
                {
                    foreach (string matchedFile in matchedFiles)
                    {
                        if (Path.GetFileNameWithoutExtension(matchedFile.ToLowerInvariant()) == moduleName.ToLowerInvariant())
                        {
                            try
                            {
                                MibDocument md = new MibDocument(matchedFile);
                                if (md.Modules.Count > 0)
                                {
                                    return(md.Modules [0]);
                                }
                            } catch
                            {
                            }
                        }
                    }
                }
            }

            return(null);
        }
Exemplo n.º 2
0
        public IModule Resolve(string moduleName)
        {
            if (Directory.Exists(_path))
            {
                string[] matchedFiles = Directory.GetFiles(
                    _path,
                    "*",
                    (_recursive) ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly);

                if ((matchedFiles != null) && (matchedFiles.Length >= 1))
                {
                    foreach (string matchedFile in matchedFiles)
                    {
						if (Path.GetFileNameWithoutExtension(matchedFile.ToLowerInvariant()) == moduleName.ToLowerInvariant())
						{
							try
							{
								MibDocument md = new MibDocument (matchedFile);
								if (md.Modules.Count > 0)
								{
									return md.Modules [0];
								}
							} catch
							{
							}
						}
                    }                  
                }
            }

            return null;
        }
Exemplo n.º 3
0
        private static IList <IModule> CompileToModules(string file, TextReader stream)
        {
            var watch = new System.Diagnostics.Stopwatch();

            watch.Start();
            Lexer lexer = new Lexer();

            lexer.Parse(file, stream);
            MibDocument doc = new MibDocument(lexer);

            Logger.Info(watch.ElapsedMilliseconds.ToString(CultureInfo.InvariantCulture) + "-ms used to parse " + file);
            watch.Stop();
            return(doc.Modules);
        }
 public void TestEmpty()
 {
     // issue 4978
     Lexer lexer = new Lexer();
     MemoryStream m = new MemoryStream(Resources.empty);
     using (StreamReader reader = new StreamReader(m))
     {
         lexer.Parse(reader);
         reader.Close();
     }
     MibDocument file = new MibDocument(lexer);
     Assert.AreEqual("SNMPV2-CONF", file.Modules[0].Name);
     Assert.AreEqual(0, file.Modules[0].Dependents.Count);
     Assert.AreEqual(0, file.Modules[0].Entities.Count);
 }
        public void TestHttpMib()
        {
            // issue 4978
            Lexer lexer = new Lexer();
            MemoryStream m = new MemoryStream(Resources.httpmib);
            using (StreamReader reader = new StreamReader(m))
            {
                lexer.Parse(reader);
                reader.Close();
            }

            MibDocument file = new MibDocument(lexer);
            Assert.AreEqual("HTTPSERVER-MIB", file.Modules[0].Name);
            Assert.AreEqual(0, file.Modules[0].Dependents.Count);
            Assert.AreEqual(0, file.Modules[0].Entities.Count);
        }        
 // TODO: [Test]
 public void TestSNMPv2_PDU()
 {
     Lexer lexer = new Lexer();
     MemoryStream m = new MemoryStream(Resources.SNMPV2_PDU);
     using (StreamReader reader = new StreamReader(m))
     {
         lexer.Parse(reader);
         reader.Close();
     }
     MibDocument file = new MibDocument(lexer);
     Assert.AreEqual("SNMPv2-PDU", file.Modules[0].Name);
     Assert.AreEqual(5, file.Modules[0].Dependents.Count);
     Assert.AreEqual(55, file.Modules[0].Entities.Count);
     IEntity node = file.Modules[0].Entities[54];
     Assert.AreEqual("casConfigGroup", node.Name);
     Assert.AreEqual(2, node.Value);
     Assert.AreEqual("casMIBGroups", node.Parent);
 }
 public void TestNet_Snmp_Agent_MIB()
 {
     Lexer lexer = new Lexer();
     MemoryStream m = new MemoryStream(Resources.NET_SNMP_AGENT_MIB);
     using (StreamReader reader = new StreamReader(m))
     {
         lexer.Parse(reader);
         reader.Close();
     }
     MibDocument file = new MibDocument(lexer);
     Assert.AreEqual(1, file.Modules.Count);
     Assert.AreEqual("NET-SNMP-AGENT-MIB", file.Modules[0].Name);
     Assert.AreEqual(54, file.Modules[0].Entities.Count);
     IEntity node = file.Modules[0].Entities[53];
     Assert.AreEqual("nsAgentNotifyGroup", node.Name);
     Assert.AreEqual(9, node.Value);
     Assert.AreEqual("netSnmpGroups", node.Parent);
 }
 public void TestMTA_MIB()
 {
     Lexer lexer = new Lexer();
     MemoryStream m = new MemoryStream(Resources.MTA_MIB);
     using (StreamReader reader = new StreamReader(m))
     {
         lexer.Parse(reader);
         reader.Close();
     }
     MibDocument file = new MibDocument(lexer);
     Assert.AreEqual(1, file.Modules.Count);
     Assert.AreEqual("MTA-MIB", file.Modules[0].Name);
     Assert.AreEqual(81, file.Modules[0].Entities.Count);
     IEntity node = file.Modules[0].Entities[80];
     Assert.AreEqual("mtaRFC2789ErrorGroup", node.Name);
     Assert.AreEqual(9, node.Value);
     Assert.AreEqual("mtaGroups", node.Parent);
 }
 public void TestTCP_MIB()
 {
     Lexer lexer = new Lexer();
     MemoryStream m = new MemoryStream(Resources.TCP_MIB);
     using (StreamReader reader = new StreamReader(m))
     {
         lexer.Parse(reader);
         reader.Close();
     }
     MibDocument file = new MibDocument(lexer);
     Assert.AreEqual(1, file.Modules.Count);
     Assert.AreEqual("TCP-MIB", file.Modules[0].Name);
     Assert.AreEqual(51, file.Modules[0].Entities.Count);
     IEntity node = file.Modules[0].Entities[50];
     Assert.AreEqual("tcpHCGroup", node.Name);
     Assert.AreEqual(5, node.Value);
     Assert.AreEqual("tcpMIBGroups", node.Parent);
 }
Exemplo n.º 10
0
 public void TestNetwork_Service_MIB()
 {
     Lexer lexer = new Lexer();
     MemoryStream m = new MemoryStream(Resources.NETWORK_SERVICES_MIB);
     using (StreamReader reader = new StreamReader(m))
     {
         lexer.Parse(reader);
         reader.Close();
     }
     MibDocument file = new MibDocument(lexer);
     Assert.AreEqual(1, file.Modules.Count);
     Assert.AreEqual("NETWORK-SERVICES-MIB", file.Modules[0].Name);
     Assert.AreEqual(44, file.Modules[0].Entities.Count);
     IEntity node = file.Modules[0].Entities[43];
     Assert.AreEqual("applUDPProtoID", node.Name);
     Assert.AreEqual(5, node.Value);
     Assert.AreEqual("application", node.Parent);
 }
Exemplo n.º 11
0
 public void TestNet_Snmp_TC()
 {
     Lexer lexer = new Lexer();
     MemoryStream m = new MemoryStream(Resources.NET_SNMP_TC);
     using (StreamReader reader = new StreamReader(m))
     {
         lexer.Parse(reader);
         reader.Close();
     }
     MibDocument file = new MibDocument(lexer);
     Assert.AreEqual(1, file.Modules.Count);
     Assert.AreEqual("NET-SNMP-TC", file.Modules[0].Name);
     Assert.AreEqual(24, file.Modules[0].Entities.Count);
     IEntity node = file.Modules[0].Entities[23];
     Assert.AreEqual("netSnmpCallbackDomain", node.Name);
     Assert.AreEqual(6, node.Value);
     Assert.AreEqual("netSnmpDomains", node.Parent);
 }
Exemplo n.º 12
0
 public void TestNet_Snmp_System_MIB()
 {
     Lexer lexer = new Lexer();
     MemoryStream m = new MemoryStream(Resources.NET_SNMP_SYSTEM_MIB);
     using (StreamReader reader = new StreamReader(m))
     {
         lexer.Parse(reader);
         reader.Close();
     }
     MibDocument file = new MibDocument(lexer);
     Assert.AreEqual(1, file.Modules.Count);
     Assert.AreEqual("NET-SNMP-SYSTEM-MIB", file.Modules[0].Name);
     Assert.AreEqual(6, file.Modules[0].Entities.Count);
     IEntity node = file.Modules[0].Entities[5];
     Assert.AreEqual("nsDiskIO", node.Name);
     Assert.AreEqual(35, node.Value);
     Assert.AreEqual("netSnmpObjects", node.Parent);
 }
Exemplo n.º 13
0
 public void TestNet_Snmp_MIB()
 {
     Lexer lexer = new Lexer();
     MemoryStream m = new MemoryStream(Resources.NET_SNMP_MIB);
     using (StreamReader reader = new StreamReader(m))
     {
         lexer.Parse(reader);
         reader.Close();
     }
     MibDocument file = new MibDocument(lexer);
     Assert.AreEqual(1, file.Modules.Count);
     Assert.AreEqual("NET-SNMP-MIB", file.Modules[0].Name);
     Assert.AreEqual(14, file.Modules[0].Entities.Count);
     IEntity node = file.Modules[0].Entities[13];
     Assert.AreEqual("netSnmpGroups", node.Name);
     Assert.AreEqual(2, node.Value);
     Assert.AreEqual("netSnmpConformance", node.Parent);
 }
Exemplo n.º 14
0
 public void TestUCD_IPFILTER_MIB()
 {
     Lexer lexer = new Lexer();
     MemoryStream m = new MemoryStream(Resources.UCD_IPFILTER_MIB1);
     using (StreamReader reader = new StreamReader(m))
     {
         lexer.Parse(reader);
         reader.Close();
     }
     MibDocument file = new MibDocument(lexer);
     Assert.AreEqual(1, file.Modules.Count);
     Assert.AreEqual("UCD-IPFILTER-MIB", file.Modules[0].Name);
     Assert.AreEqual(23, file.Modules[0].Entities.Count);
     IEntity node = file.Modules[0].Entities[22];
     Assert.AreEqual("ipfAccOutBytes", node.Name);
     Assert.AreEqual(4, node.Value);
     Assert.AreEqual("ipfAccOutEntry", node.Parent);
 }
Exemplo n.º 15
0
 public void TestUCD_DLMOD_MIB()
 {
     Lexer lexer = new Lexer();
     MemoryStream m = new MemoryStream(Resources.UCD_DLMOD_MIB1);
     using (StreamReader reader = new StreamReader(m))
     {
         lexer.Parse(reader);
         reader.Close();
     }
     MibDocument file = new MibDocument(lexer);
     Assert.AreEqual(1, file.Modules.Count);
     Assert.AreEqual("UCD-DLMOD-MIB", file.Modules[0].Name);
     Assert.AreEqual(9, file.Modules[0].Entities.Count);
     IEntity node = file.Modules[0].Entities[8];
     Assert.AreEqual("dlmodStatus", node.Name);
     Assert.AreEqual(5, node.Value);
     Assert.AreEqual("dlmodEntry", node.Parent);
 }
Exemplo n.º 16
0
 public void TestUCD_DISKIO_MIB()
 {
     Lexer lexer = new Lexer();
     MemoryStream m = new MemoryStream(Resources.UCD_DISKIO_MIB1);
     using (StreamReader reader = new StreamReader(m))
     {
         lexer.Parse(reader);
         reader.Close();
     }
     MibDocument file = new MibDocument(lexer);
     Assert.AreEqual(1, file.Modules.Count);
     Assert.AreEqual("UCD-DISKIO-MIB", file.Modules[0].Name);
     Assert.AreEqual(14, file.Modules[0].Entities.Count);
     IEntity node = file.Modules[0].Entities[13];
     Assert.AreEqual("diskIONWrittenX", node.Name);
     Assert.AreEqual(13, node.Value);
     Assert.AreEqual("diskIOEntry", node.Parent);
 }
Exemplo n.º 17
0
 public void TestUCD_DEMO_MIB()
 {
     Lexer lexer = new Lexer();
     MemoryStream m = new MemoryStream(Resources.UCD_DEMO_MIB1);
     using (StreamReader reader = new StreamReader(m))
     {
         lexer.Parse(reader);
         reader.Close();
     }
     MibDocument file = new MibDocument(lexer);
     Assert.AreEqual(1, file.Modules.Count);
     Assert.AreEqual("UCD-DEMO-MIB", file.Modules[0].Name);
     Assert.AreEqual(7, file.Modules[0].Entities.Count);
     IEntity node = file.Modules[0].Entities[6];
     Assert.AreEqual("ucdDemoPassphrase", node.Name);
     Assert.AreEqual(4, node.Value);
     Assert.AreEqual("ucdDemoPublic", node.Parent);
 }
Exemplo n.º 18
0
 public void TestTunnel_MIB()
 {
     Lexer lexer = new Lexer();
     MemoryStream m = new MemoryStream(Resources.TUNNEL_MIB);
     using (StreamReader reader = new StreamReader(m))
     {
         lexer.Parse(reader);
         reader.Close();
     }
     MibDocument file = new MibDocument(lexer);
     Assert.AreEqual(1, file.Modules.Count);
     Assert.AreEqual("TUNNEL-MIB", file.Modules[0].Name);
     Assert.AreEqual(42, file.Modules[0].Entities.Count);
     IEntity node = file.Modules[0].Entities[41];
     Assert.AreEqual("tunnelMIBInetGroup", node.Name);
     Assert.AreEqual(2, node.Value);
     Assert.AreEqual("tunnelMIBGroups", node.Parent);
 }
Exemplo n.º 19
0
 public void TestTransport_Address_MIB()
 {
     Lexer lexer = new Lexer();
     MemoryStream m = new MemoryStream(Resources.TRANSPORT_ADDRESS_MIB);
     using (StreamReader reader = new StreamReader(m))
     {
         lexer.Parse(reader);
         reader.Close();
     }
     MibDocument file = new MibDocument(lexer);
     Assert.AreEqual(1, file.Modules.Count);
     Assert.AreEqual("TRANSPORT-ADDRESS-MIB", file.Modules[0].Name);
     Assert.AreEqual(18, file.Modules[0].Entities.Count);
     IEntity node = file.Modules[0].Entities[17];
     Assert.AreEqual("transportDomainSctpDns", node.Name);
     Assert.AreEqual(16, node.Value);
     Assert.AreEqual("transportDomains", node.Parent);
 }
Exemplo n.º 20
0
 public void TestNet_Snmp_Examples_MIB()
 {
     Lexer lexer = new Lexer();
     MemoryStream m = new MemoryStream(Resources.NET_SNMP_EXAMPLES_MIB);
     using (StreamReader reader = new StreamReader(m))
     {
         lexer.Parse(reader);
         reader.Close();
     }
     MibDocument file = new MibDocument(lexer);
     Assert.AreEqual(1, file.Modules.Count);
     Assert.AreEqual("NET-SNMP-EXAMPLES-MIB", file.Modules[0].Name);
     Assert.AreEqual(25, file.Modules[0].Entities.Count);
     IEntity node = file.Modules[0].Entities[24];
     Assert.AreEqual("netSnmpExampleNotification", node.Name);
     Assert.AreEqual(1, node.Value);
     Assert.AreEqual("netSnmpExampleNotifications", node.Parent);
 }
Exemplo n.º 21
0
 public void TestNet_Snmp_Extend_MIB()
 {
     Lexer lexer = new Lexer();
     MemoryStream m = new MemoryStream(Resources.NET_SNMP_EXTEND_MIB);
     using (StreamReader reader = new StreamReader(m))
     {
         lexer.Parse(reader);
         reader.Close();
     }
     MibDocument file = new MibDocument(lexer);
     Assert.AreEqual(1, file.Modules.Count);
     Assert.AreEqual("NET-SNMP-EXTEND-MIB", file.Modules[0].Name);
     Assert.AreEqual(27, file.Modules[0].Entities.Count);
     IEntity node = file.Modules[0].Entities[26];
     Assert.AreEqual("nsExtendOutputGroup", node.Name);
     Assert.AreEqual(2, node.Value);
     Assert.AreEqual("nsExtendGroups", node.Parent);
 }
Exemplo n.º 22
0
 public void TestUCD_IPFWACC_MIB()
 {
     Lexer lexer = new Lexer();
     MemoryStream m = new MemoryStream(Resources.UCD_IPFWACC_MIB1);
     using (StreamReader reader = new StreamReader(m))
     {
         lexer.Parse(reader);
         reader.Close();
     }
     MibDocument file = new MibDocument(lexer);
     Assert.AreEqual(1, file.Modules.Count);
     Assert.AreEqual("UCD-IPFWACC-MIB", file.Modules[0].Name);
     Assert.AreEqual(29, file.Modules[0].Entities.Count);
     IEntity node = file.Modules[0].Entities[28];
     Assert.AreEqual("ipFwAccPort10", node.Name);
     Assert.AreEqual(26, node.Value);
     Assert.AreEqual("ipFwAccEntry", node.Parent);
 }
Exemplo n.º 23
0
 public void TestNet_Snmp_Monitor_MIB()
 {
     Lexer lexer = new Lexer();
     MemoryStream m = new MemoryStream(Resources.NET_SNMP_MONITOR_MIB);
     using (StreamReader reader = new StreamReader(m))
     {
         lexer.Parse(reader);
         reader.Close();
     }
     MibDocument file = new MibDocument(lexer);
     Assert.AreEqual(1, file.Modules.Count);
     Assert.AreEqual("NET-SNMP-MONITOR-MIB", file.Modules[0].Name);
     Assert.AreEqual(5, file.Modules[0].Entities.Count);
     IEntity node = file.Modules[0].Entities[4];
     Assert.AreEqual("nsLog", node.Name);
     Assert.AreEqual(24, node.Value);
     Assert.AreEqual("netSnmpObjects", node.Parent);
 }
Exemplo n.º 24
0
 public void TestUCD_SNMP_MIB()
 {
     Lexer lexer = new Lexer();
     MemoryStream m = new MemoryStream(Resources.UCD_SNMP_MIB1);
     using (StreamReader reader = new StreamReader(m))
     {
         lexer.Parse(reader);
         reader.Close();
     }
     MibDocument file = new MibDocument(lexer);
     Assert.AreEqual(1, file.Modules.Count);
     Assert.AreEqual("UCD-SNMP-MIB", file.Modules[0].Name);
     Assert.AreEqual(158, file.Modules[0].Entities.Count);
     IEntity node = file.Modules[0].Entities[157];
     Assert.AreEqual("logMatchRegExCompilation", node.Name);
     Assert.AreEqual(101, node.Value);
     Assert.AreEqual("logMatchEntry", node.Parent);
 }
Exemplo n.º 25
0
 public void TestRFC1157_SNMP_MIB()
 {
     Lexer lexer = new Lexer();
     MemoryStream m = new MemoryStream(Resources.RFC1157_SNMP);
     using (StreamReader reader = new StreamReader(m))
     {
         lexer.Parse(reader);
         reader.Close();
     }
     MibDocument file = new MibDocument(lexer);
     Assert.AreEqual("RFC1157-SNMP", file.Modules[0].Name);
     Assert.AreEqual(1, file.Modules[0].Dependents.Count);
     Assert.AreEqual(0, file.Modules[0].Entities.Count);
 }
Exemplo n.º 26
0
 public void TestIPv6_Flow_Label_MIB()
 {
     Lexer lexer = new Lexer();
     MemoryStream m = new MemoryStream(Resources.IPV6_FLOW_LABEL_MIB);
     using (StreamReader reader = new StreamReader(m))
     {
         lexer.Parse(reader);
         reader.Close();
     }
     MibDocument file = new MibDocument(lexer);
     Assert.AreEqual(1, file.Modules.Count);
     Assert.AreEqual("IPV6-FLOW-LABEL-MIB", file.Modules[0].Name);
     Assert.AreEqual(1, file.Modules[0].Entities.Count);
     IEntity node = file.Modules[0].Entities[0];
     Assert.AreEqual("ipv6FlowLabelMIB", node.Name);
     Assert.AreEqual(103, node.Value);
     Assert.AreEqual("mib-2", node.Parent);
 }
Exemplo n.º 27
0
 public void TestNet_Snmp_VACM_MIB()
 {
     Lexer lexer = new Lexer();
     MemoryStream m = new MemoryStream(Resources.NET_SNMP_VACM_MIB);
     using (StreamReader reader = new StreamReader(m))
     {
         lexer.Parse(reader);
         reader.Close();
     }
     MibDocument file = new MibDocument(lexer);
     Assert.AreEqual(1, file.Modules.Count);
     Assert.AreEqual("NET-SNMP-VACM-MIB", file.Modules[0].Name);
     Assert.AreEqual(8, file.Modules[0].Entities.Count);
     IEntity node = file.Modules[0].Entities[7];
     Assert.AreEqual("nsVacmStatus", node.Name);
     Assert.AreEqual(5, node.Value);
     Assert.AreEqual("nsVacmAccessEntry", node.Parent);
 }
Exemplo n.º 28
0
 public void TestSMUX_MIB()
 {
     Lexer lexer = new Lexer();
     MemoryStream m = new MemoryStream(Resources.SMUX_MIB);
     using (StreamReader reader = new StreamReader(m))
     {
         lexer.Parse(reader);
         reader.Close();
     }
     MibDocument file = new MibDocument(lexer);
     Assert.AreEqual(1, file.Modules.Count);
     Assert.AreEqual("SMUX-MIB", file.Modules[0].Name);
     Assert.AreEqual(14, file.Modules[0].Entities.Count);
     IEntity node = file.Modules[0].Entities[13];
     Assert.AreEqual("smuxTstatus", node.Name);
     Assert.AreEqual(4, node.Value);
     Assert.AreEqual("smuxTreeEntry", node.Parent);
 }
Exemplo n.º 29
0
 public void TestNotification_Log_MIB()
 {
     Lexer lexer = new Lexer();
     MemoryStream m = new MemoryStream(Resources.NOTIFICATION_LOG_MIB);
     using (StreamReader reader = new StreamReader(m))
     {
         lexer.Parse(reader);
         reader.Close();
     }
     MibDocument file = new MibDocument(lexer);
     Assert.AreEqual(1, file.Modules.Count);
     Assert.AreEqual("NOTIFICATION-LOG-MIB", file.Modules[0].Name);
     Assert.AreEqual(55, file.Modules[0].Entities.Count);
     IEntity node = file.Modules[0].Entities[54];
     Assert.AreEqual("notificationLogDateGroup", node.Name);
     Assert.AreEqual(4, node.Value);
     Assert.AreEqual("notificationLogMIBGroups", node.Parent);
 }
Exemplo n.º 30
0
 public void TestSNMP_VIEW_BASED_ACM_MIB()
 {
     Lexer lexer = new Lexer();
     MemoryStream m = new MemoryStream(Resources.SNMP_VIEW_BASED_ACM_MIB);
     using (StreamReader reader = new StreamReader(m))
     {
         lexer.Parse(reader);
         reader.Close();
     }
     MibDocument file = new MibDocument(lexer);
     Assert.AreEqual(1, file.Modules.Count);
     Assert.AreEqual("SNMP-VIEW-BASED-ACM-MIB", file.Modules[0].Name);
     Assert.AreEqual(38, file.Modules[0].Entities.Count);
     IEntity node = file.Modules[0].Entities[37];
     Assert.AreEqual("vacmBasicGroup", node.Name);
     Assert.AreEqual(1, node.Value);
     Assert.AreEqual("vacmMIBGroups", node.Parent);
 }
Exemplo n.º 31
0
 public void TestUCD_SNMP_MIB_OLD()
 {
     Lexer lexer = new Lexer();
     MemoryStream m = new MemoryStream(Resources.UCD_SNMP_MIB_OLD);
     using (StreamReader reader = new StreamReader(m))
     {
         lexer.Parse(reader);
         reader.Close();
     }
     MibDocument file = new MibDocument(lexer);
     Assert.AreEqual(1, file.Modules.Count);
     Assert.AreEqual("UCD-SNMP-MIB-OLD", file.Modules[0].Name);
     Assert.AreEqual(35, file.Modules[0].Entities.Count);
     IEntity node = file.Modules[0].Entities[34];
     Assert.AreEqual("loadaveErrMessage", node.Name);
     Assert.AreEqual(101, node.Value);
     Assert.AreEqual("loadaves", node.Parent);
 }
Exemplo n.º 32
0
 public void TestUDP_MIB()
 {
     Lexer lexer = new Lexer();
     MemoryStream m = new MemoryStream(Resources.UDP_MIB);
     using (StreamReader reader = new StreamReader(m))
     {
         lexer.Parse(reader);
         reader.Close();
     }
     MibDocument file = new MibDocument(lexer);
     Assert.AreEqual(1, file.Modules.Count);
     Assert.AreEqual("UDP-MIB", file.Modules[0].Name);
     Assert.AreEqual(31, file.Modules[0].Entities.Count);
     IEntity node = file.Modules[0].Entities[30];
     Assert.AreEqual("udpEndpointGroup", node.Name);
     Assert.AreEqual(4, node.Value);
     Assert.AreEqual("udpMIBGroups", node.Parent);
 }