Mibble MIB Parser - extracting comments from the mib.

Posted by this.matt on Stack Overflow See other posts from Stack Overflow or by this.matt
Published on 2010-01-05T03:01:17Z Indexed on 2010/03/24 17:03 UTC
Read the original article Hit count: 415

Filed under:
|
|
|

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.

© Stack Overflow or respective owner

Related posts about java

Related posts about asn.1