markabrahams / node-net-snmp

JavaScript implementation of the Simple Network Management Protocol (SNMP)
207 stars 97 forks source link

Support TEXTUAL CONVENTION v1 #256

Closed ddolcimascolo closed 6 days ago

ddolcimascolo commented 1 week ago

Hi,

Thanks for maintaining this library. Currently the MIB parser correctly parses TEXTUAL CONVENTION v1 but these are not returned by the store.getSyntaxTypes() method. This is because there's no TEXTUAL-CONVENTION macro, the definition directly follows the object name.

See: https://www.ibm.com/docs/en/netcoolomnibus/8.1?topic=snmp-valid-mib-object-formats#omn_ref_mib_formats__title__2

DellStateCapabilities           ::= INTEGER {
    -- If set to 0 (zero), object has no state capabilities
    unknownCapabilities(1),     -- object's state capabilities are unknown
    -- The object's state capabilities allow it to be set to:
    enableCapable(2),           -- be disabled (offline) or be enabled (online)
    notReadyCapable(4),         -- not ready
    enableAndNotReadyCapable(6)
}

Another (simpler) example

DellBoolean                     ::= INTEGER (0..1)    -- 0 = FALSE, 1 = TRUE

Is this something you'll want to support?

I can share a MIB holding such definitions, just ask.

Thanks, David

markabrahams commented 1 week ago

Hi @ddolcimascolo - yes if you could send an example MIB with this kind of definition, that would be great for my reference. It would be worth supporting this if possible. Given the lack of information in the pre-TEXTUAL CONVENTION type definitions, I'll have to see if I can heuristically determine whether an entry is a v1 data type assignment - probably due to what isn't present, given that not a lot is present!

ddolcimascolo commented 1 week ago

Here you are. The MIB is part of a larger set used to monitor Dell machines through an iDRAC.

10892.mib.zip

markabrahams commented 6 days ago

Thanks for the example MIB @ddolcimascolo - that's great to have. I've implemented support for SMIv1 Defined Types now (RFC1155 Section 3.3), and have also implemented support for the SMIv1 TRAP-TYPE macro, as defined in RFC1215. These changes are published in version 3.14.0 of the npm.

ddolcimascolo commented 6 days ago

That's excellent news. Thanks for the great work :pray:

David