Building/Parsing OBJECT IDENTIFIERs
MIB Smithy SDK provides APIs for creating OIDs for columnar OBJECT-TYPEs from given index values, as well as for parsing index values out of a given instance OID for a columnar object.
Building OBJECT IDENTIFIERs
To create an OID for a columnar OBJECT-TYPE from index values:
Syntax:
% dbcmd buildoid record value ?value ...?
Where:
dbcmd
- is the name of the database;
record
- is the name or OID of the columnar OBJECT-TYPE; and
value
- are the values for each index object (in order). Enumeration labels may be used in place of integer values where applicable. OCTET STRING values may also be specified, and length prefixes are handled automatically depending on whether the corresponding index is declared IMPLICIT.
Returns:
- A single OBJECT IDENTIFIER composed of the OBJECT-TYPE's OID and all instance subidentifiers, including applicable length subidentifers for variable-length indexes.
Parsing OBJECT IDENTIFIERs
Syntax:
To parse an OID for for its index values, either of these forms are equivalent:
% dbcmd parseoid oid
% dbcmd get -indexparts oid
Where:
dbcmd
- is the name of the database; and
oid
- is the OBJECT IDENTIFIER to be parsed.
Returns:
- A list with length that is a multiple of 3, that includes the index name, the subidentifiers for that index, and the raw value parsed from those index subientifiers.
Examples
% $db buildoid tcpConnState 127.0.0.1 1234 10.1.1.1 5678
1.3.6.1.2.1.6.13.1.1.127.0.0.1.1234.10.1.1.1.5678
% $db parseoid TCP-MIB!tcpConnState.127.0.0.1.1234.10.1.1.1.5678
tcpConnLocalAddress 127.0.0.1 127.0.0.1 tcpConnLocalPort 1234 1234 tcpConnRemAddress 10.1.1.1 10.1.1.1 tcpConnRemPort 5678 5678
% $db buildoid snmpNotifyTag foo
1.3.6.1.6.3.13.1.1.1.2.102.111.111