Question

I am using the Mibble MIB Parser to extract all simple data types from an MIB file. I've been successful until my attempt to extract comment text.

Take the following module as an example:

invBookList OBJECT-TYPE
    SYNTAX  INTEGER {
                    mobydick(1),     -- call me ishmael 
                    paradiselost(2), -- aComment
                    1984(3),         -- aComment
                    solaris(4)       -- aComment
            }
    MAX-ACCESS      read-only
    STATUS          current
    DESCRIPTION
            "A few Books for an example."
    ::= { invMasterList 43 }

According to Mibble's API, the OBJECT-TYPE can be accessed by extracting an SnmpObjectType and then calling the appropriate getter method. Which I have done, and can successfully extract all of the text except the comments in the INTEGER syntax.

I have tried calling getSyntax().getComment() on the SnmpObjectType, but always returns null. getSyntax() will extract the INTEGER syntax, e.g.:

mobydick(1),paradiselist(2),1984(3),solaris(4)

but unfortunately strips out the comments.

Any one out there have experience with Mibble Parser who knows how to extract the comments?

Many Thanks.

Was it helpful?

Solution

First, you need to use version 2.9 of Mibble. Then look into MibWriter.java to understand how to use the API:

https://github.com/cederberg/mibble/blob/master/src/java/net/percederberg/mibble/MibWriter.java

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top