Mibble MIB Parser - 从 mib 中提取注释
我正在使用 Mibble MIB 解析器 从 MIB 文件中提取所有简单数据类型。在我尝试提取评论文本之前,我一直成功。
以下面的模块为例:
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 }
根据Mibble的API,可以通过提取SnmpObjectType然后调用适当的getter方法来访问OBJECT-TYPE。我已经完成了,并且可以成功提取除 INTEGER 语法中的注释之外的所有文本。
我尝试在 SnmpObjectType 上调用 getSyntax().getComment(),但总是返回 null。 getSyntax() 将提取 INTEGER 语法,例如:
mobydick(1),paradiselist(2),1984(3),solaris(4)
但不幸的是删除了注释。
任何人都有使用 Mibble Parser 的经验并且知道如何提取注释吗?
非常感谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,您需要使用 Mibble 2.9 版本。然后查看 MibWriter.java 以了解如何使用 API:
https://github.com/cederberg/mibble/blob/master/src/java/net/percederberg/mibble/MibWriter.java
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