|
IP*Works! S/SNMP V6 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--ipworksssnmp.Mibbrowser
The MIBBrowser bean is used to parse SNMP MIB Module definitions.
The MIBBrowser bean allows easy loading and querying of definitions in the SNMP Management Information Base (MIB) specifications.
The LoadMib method allows loading of MIB modules, which get stored in an internal tree structure for further queries.
If modules reference (import) other modules, recursive loading of modules is performed automatically and/or controlled by the ImportSymbols event.
The MIB tree is navigated through the SelectNode method, which enables pointing to a node in the tree specified by NodeOid and NodeLabel . Other node information is provided through the NodeModuleName , NodeFileName , NodeSyntax , NodeType , and NodeAccess properties.
The node selector parameter in SelectNode can be a label such as "internet", an OID such as "1.3.6.4", a combination of the two: "iso.3.dod.internet", or a label in a particular module such as "RFC1213-MIB!interfaces".
Node children and successors are provided by the ListChildren and ListSuccessors methods. The individual node information is provided via the MibNode event.
Module traps are listed via the ListTraps method. The individual trap information is provided through the TrapNode event.
| Field Summary | |
static int |
accForNotify
|
static int |
accNoAccess
|
static int |
accReadCreate
|
static int |
accReadOnly
|
static int |
accReadWrite
|
static int |
accUnknown
|
static int |
accWriteOnly
|
static int |
mcrCapabilities
|
static int |
mcrCompliance
|
static int |
mcrModuleIdentity
|
static int |
mcrNotificationGroup
|
static int |
mcrNotificationType
|
static int |
mcrObjectGroup
|
static int |
mcrObjectIdentity
|
static int |
mcrObjectType
|
static int |
mcrTrapType
|
static int |
stxBitString
|
static int |
stxBoolean
|
static int |
stxChoice
|
static int |
stxCounter
|
static int |
stxCounter64
|
static int |
stxEnumerated
|
static int |
stxGauge
|
static int |
stxInteger
|
static int |
stxIpAddress
|
static int |
stxNetworkAddress
|
static int |
stxNSAP
|
static int |
stxNull
|
static int |
stxObjectId
|
static int |
stxOctetString
|
static int |
stxOpaque
|
static int |
stxSequence
|
static int |
stxSequenceOf
|
static int |
stxSet
|
static int |
stxTimeTicks
|
static int |
stxUInteger
|
static int |
stxUnknown
|
| Constructor Summary | |
Mibbrowser()
|
|
| Method Summary | |
void |
addMibbrowserEventListener(MibbrowserEventListener l)
|
java.lang.String |
config(java.lang.String configurationString)
Sets or retrieves a beanconfiguration setting. |
int |
getNodeAccess()
The access permissions for the selected node. |
java.lang.String |
getNodeDescription()
Textual description of the selected node. |
java.lang.String |
getNodeFileName()
The absolute path of the file where the selected node is declared. |
java.lang.String |
getNodeIndex()
The index of the node in a table. |
java.lang.String |
getNodeLabel()
The label of the selected node. |
java.lang.String |
getNodeModuleName()
The name of the module where the selected node is declared. |
java.lang.String |
getNodeOid()
The Object ID of the selected node. |
int |
getNodeSubId()
The SubId of the currently selected node. |
int |
getNodeSyntax()
The syntax of the selected node. |
java.lang.String |
getNodeSyntaxString()
The node syntax of the selected node in text format. |
int |
getNodeType()
The type of the selected node. |
java.lang.String |
getNodeTypeString()
The node type of the selected node in text format. |
boolean |
isExactMatch()
Controls the way the OID matching is done (complete or partial). |
void |
listChildren()
Lists the immediate children of the selected node. |
void |
listSuccessors()
Lists all successors of the selected node. |
void |
listTraps()
Lists all the traps defined in the loaded modules. |
void |
loadMib(java.lang.String fileName)
Parses the file FileName and adds the parsed nodes to the collection of existing nodes. |
void |
removeMibbrowserEventListener(MibbrowserEventListener l)
|
void |
selectNode(java.lang.String selector)
Used to select individual nodes in the loaded MIB module(s). |
void |
setExactMatch(boolean exactMatch)
Controls the way the OID matching is done (complete or partial). |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int accUnknown
public static final int accNoAccess
public static final int accReadOnly
public static final int accReadCreate
public static final int accReadWrite
public static final int accWriteOnly
public static final int accForNotify
public static final int stxBoolean
public static final int stxInteger
public static final int stxBitString
public static final int stxOctetString
public static final int stxNull
public static final int stxObjectId
public static final int stxEnumerated
public static final int stxSequenceOf
public static final int stxSequence
public static final int stxSet
public static final int stxChoice
public static final int stxNetworkAddress
public static final int stxIpAddress
public static final int stxCounter
public static final int stxGauge
public static final int stxTimeTicks
public static final int stxOpaque
public static final int stxNSAP
public static final int stxCounter64
public static final int stxUInteger
public static final int stxUnknown
public static final int mcrObjectType
public static final int mcrObjectIdentity
public static final int mcrModuleIdentity
public static final int mcrNotificationType
public static final int mcrTrapType
public static final int mcrObjectGroup
public static final int mcrNotificationGroup
public static final int mcrCompliance
public static final int mcrCapabilities
| Constructor Detail |
public Mibbrowser()
| Method Detail |
public boolean isExactMatch()
If ExactMatch is set to True, the SelectNode method will try to find an exact match for the supplied selector. If not found, an exception will be thrown.
If ExactMatch is set to False, the SelectNode method will start from the root (iso) and will go as far as it can, finding the closest match for the requested node.
For instance, for SNMPv2-MIB, mib name 1.3.6.1.2.1.1.3.0 will return sysUpTime.0 while mib -exact name 1.3.6.1.2.1.1.3.0 will fail.
public void setExactMatch(boolean exactMatch)
throws IPWorksSSNMPException
If ExactMatch is set to True, the SelectNode method will try to find an exact match for the supplied selector. If not found, an exception will be thrown.
If ExactMatch is set to False, the SelectNode method will start from the root (iso) and will go as far as it can, finding the closest match for the requested node.
For instance, for SNMPv2-MIB, mib name 1.3.6.1.2.1.1.3.0 will return sysUpTime.0 while mib -exact name 1.3.6.1.2.1.1.3.0 will fail.
IPWorksSSNMPExceptionpublic int getNodeAccess()
The following is the list of values for NodeAccess :
public java.lang.String getNodeDescription()
Because loading descriptions can consume unwanted resources, the bean can control caching of descriptions in order to keep the memory footprint of the bean as small as possible.
To disable caching, set theCacheDescriptionsconfig setting to True. In this case, the bean will only save the offset of the description in the MIB file in memory, and will fetch the textual description directly from the file only when required. When using caching, make sure that the path of the loaded modules does not change or the property will be unable to fetch the correct text description.
public java.lang.String getNodeFileName()
It is possible for a node to be re-declared in other modules. In this case the property contains a comma spearated list of file names where the selected node is declared.
public java.lang.String getNodeIndex()
If the selected node has stxSequence syntax then the NodeIndex represents the column used to distinguish among different table rows.
Example:
MibParser.LoadMib(""SNMPv2-MIB"")
MibParser.SelectNode("1.3.6.1.2.1.2.2")
Debug.Print MibParser1.NodeLabel // prints "ifTable"
MibParser.SelectNode("1.3.6.1.2.1.2.2.1")
Debug.Print MibParser1.NodeLabel // prints "ifEntry"
Debug.Print MibParser1.NodeIndex // prints "ifIndex"
public java.lang.String getNodeLabel()
This label is unique within the MIB module where it is declared.
public java.lang.String getNodeModuleName()
It is possible for a node to be redeclared in other modules. In this
case the NodeModuleName contains a comma spearated list of module names where
the selected node is declared.
public java.lang.String getNodeOid()
Contains the Object Id (OID) of the currently selected node. The OID uniquely identifies the selected node within the entire object hierarchy.
public int getNodeSubId()
For instance, if you select the node "dod" in "rfc1155.smi", the NodeSubId value will be 6.
public int getNodeSyntax()
The syntax defines what type of data the selected node contains. Common data types include:
Additional type definitions can be found in the SNMP RFC's.
public java.lang.String getNodeSyntaxString()
For instance, for the node "system" in "SNMPv2-MIB", NodeSyntax returns 6 ( stxObjectId ), while NodeSyntaxString returns "OBJECT IDENTIFIER".
public int getNodeType()
The following are the possible values for NodeType :
public java.lang.String getNodeTypeString()
For instance, for the node "system" in "SNMPv2-MIB", NodeType returns 2 ( mcrObjectIdentity ), while NodeTypeString returns "OBJECT-IDENTITY".
public java.lang.String config(java.lang.String configurationString)
throws IPWorksSSNMPException
Config is a generic method available in every bean.
It is used to set and retrieveconfiguration settingsfor the
bean.
Configuration settings are similar in functionality to properties,
but they are rarely used. In order to avoid "polluting" the property
namespace of the bean, access to these internal properties is provided through the Config method.
To set a configuration setting named PROPERTY , you must call Config("PROPERTY=VALUE") , where VALUE is the value of the setting expressed as a string. For boolean values, use the strings "True", "False", "0", "1", "Yes", or "No" (case does not matter).
To read (query) the value of a configuration setting, you must call Config("PROPERTY") . The value will be returned as a string.
IPWorksSSNMPException
public void listChildren()
throws IPWorksSSNMPException
The MibNode event fires once for every SubId of the selected node
and provides all info related to that SubId.
For instance, the following code:
MibParser.LoadMib("RFC1155-SMI")
MibParser.SelectNode("internet")
MibParser.ListChildren() will generate the following output through the MibNode event: directory 1.3.6.1.1
mgmt 1.3.6.1.2
experimental 1.3.6.1.3
private 1.3.6.1.4
IPWorksSSNMPException
public void listSuccessors()
throws IPWorksSSNMPException
The MibNode event fires once for each successor of the selected node and provides all information related to it.
IPWorksSSNMPException
public void listTraps()
throws IPWorksSSNMPException
The TrapNode event fires once for every trap and provides all info related to it.
For instance, the following code:
MibParser.LoadMib("mib_ii.mib")
MibParser.ListTraps() will generate the following output through the MibNode event: coldStart 0 snmp
warmStart 1 snmp
linkDown 2 snmp
linkUp 3 snmp
authenticationFailure 4 snmp
IPWorksSSNMPException
public void loadMib(java.lang.String fileName)
throws IPWorksSSNMPException
This method can be used to load and parse a MIB file into the bean.
Some MIB modules contain references to other modules within their imports sections. When loading a MIB that contains external imports, the ImportSymbols event will fire for each external reference. These modules must be loaded if possible to generate a complete representation for the loaded MIB.
It is possible for the component to attempt to load all external references automatically. To do this, use Config and set " AutoLoadMibs=True ". Setting this configuration property causes the bean to attempt to find and load any external references included in the current MIB. The bean will only find external modules if they reside in the same directory as the current module. Alternatively, the bean can load additional modules by calling LoadMib while inside the ImportSymbols event.
If theAutoLoadMibsconfig setting is set to False, and no explicit action is taken to load necessary modules inside the ImportSymbols event, some symbols may remain unresolved. These symbols will not appear in the MibNode hierarchy until the module containing their definition is loaded. Order is unimportant when loading additional MIB modules. A complete list of unresolved symbols can be found by retrieving theUndefinedSymbolsconfig setting (comma separated list of symbols).
If the FileName parameter is not the name of a file, the bean will attempt to parse it as MIB data.
IPWorksSSNMPException
public void selectNode(java.lang.String selector)
throws IPWorksSSNMPException
SelectNode is used for selecting individual nodes and should be called before querying node information.
The Selector parameter can be a label such as "internet", an OID such as "1.3.6.4", a combination of the two: "iso.3.dod.internet", or a label in a particular module such as "RFC1213-MIB!interfaces".
Either '.' or ':' can be used to separate SubIds. If a SubId starts with "0x" or follows the ":" separator then its hexadecimal value is used. For instance, "0x1.0x3.0x6.0x1A" is the same as "1:3:6:1A".
All properties and methods of the bean will operate on the selected node. For example, calling ListSuccessors will only list the successors of the selected node.
IPWorksSSNMPException
public void addMibbrowserEventListener(MibbrowserEventListener l)
throws java.util.TooManyListenersException
java.util.TooManyListenersExceptionpublic void removeMibbrowserEventListener(MibbrowserEventListener l)
|
IP*Works! S/SNMP V6 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||