cederberg / mibble

Mibble is an open-source SNMP MIB parser library for Java.
https://www.mibble.org/
Other
113 stars 68 forks source link

MIB Loading inconsistent between Mibble UI and Mibble.jar #14

Closed mumashankar closed 8 years ago

mumashankar commented 10 years ago

I am using Mibble 2.9.3 to parse my MIB files (all files are in same folder) using mibble-parser-2.9.3.jar.

I have taken the MIBs from http://www.juniper.net/techpubs/software/junos/junos141/juniper-mibs-14.1R1.10.zip. I have downloaded ENTITY-MIB and added to this package.

The loading code is as follows:

MibLoader mibLdr = new MibLoader(); loadMandatoryMibs(mibLdr); // Here, the mandatory MIBs are loaded -- Successfully Mib m = mibLdr.load(mibFile);

Out of my 229 MIB files, 22 files are failing to load with same exception:

mib-802.1ag.txt
mib-802.1ap.txt
mib-jnx-atm-cos-Orig.txt
mib-jnx-atm-cos.txt
mib-jnx-bl.txt
mib-jnx-chas-defines.txt
mib-jnx-if-accounting.txt
mib-jnx-ifotn.txt
mib-jnx-ipsec-monitor-asp.txt
mib-jnx-ldp.txt
mib-jnx-mobile-gateway-aaa.txt
mib-jnx-mobile-gateway-appfw.txt
mib-jnx-mobile-gateway-charging.txt
mib-jnx-mobile-gateway-gtp.txt
mib-jnx-mobile-gateway-rmps.txt
mib-jnx-mobile-gateway-sgw-charging.txt
mib-jnx-mobile-gateway-sgw-gtp.txt
mib-jnx-mobile-gateway-sgw-mfwd.txt
mib-jnx-mobile-gateway-sm-ip-pool.txt
mib-jnx-pwatm.txt
mib-jnx-pwtdm.txt
mib-jnx-vpls-bgp.txt

I am receiving below exception for all these files:

Unable to read: mib-jnx-mobile-gateway-sm-ip-pool.txt With exception.getMessage: found 1 MIB loader errors net.percederberg.mibble.MibLoaderException: found 1 MIB loader errors

at net.percederberg.mibble.MibLoader.load(MibLoader.java:552)
at net.percederberg.mibble.MibLoader.load(MibLoader.java:479)
at com.juniper.mibble.mibTester.testMibs(mibTester.java:38)
at com.juniper.mibble.mibTester.main(mibTester.java:26)

However, if I load the above MIBs to Mibble UI, the loading is successful. I have tried to see if there is anything wrong with MIB files; but the exception message returned by JAR file is not clear. So, could you please let me know what am I missing that is causing these MIBs fail to load?

Thank you.

cederberg commented 10 years ago

To get the detailed error messages from a MibLoaderException, please use code similar to this (adapted from the MibbleValidator app):

try {
    ...
} catch (MibLoaderException e) {
    e.getLog().printTo(System.err);
}

This will print the details of all the errors found, and not just the error summary. I guess the documentation could be clearer on this.

mumashankar commented 10 years ago

Thank you. It helped.

On Wed, Jul 16, 2014 at 3:31 PM, Per Cederberg notifications@github.com wrote:

To get the detailed error messages from a MibLoaderException, please code similar to this (adapted from the MibbleValidator app):

try { ... } catch (MibLoaderException e) { e.getLog().printTo(System.err); }

This will print the details of all the errors found, and not just the error summary. I guess the documentation could be clearer on this.

— Reply to this email directly or view it on GitHub https://github.com/cederberg/mibble/issues/14#issuecomment-49144699.

Best Regards,

Uma Shankar