Search code examples
snmp

SNMP Mib. Are the "qualified" descriptors used in practice


According standard RFC 2578 3.2. IMPORTing Symbols:

Note that when symbols from "enterprise-specific" information modules
are referenced  (e.g., a descriptor), there is the possibility of
collision.  As such, if different objects with the same descriptor
are IMPORTed, then this ambiguity is resolved by prefixing the
descriptor with the name of the information module and a dot ("."),
i.e.,

    "module.descriptor"

(All descriptors must be unique within any information module.)

Of course, this notation can be used to refer to objects even when
there is no collision when IMPORTing symbols.

Everything seems to be clear, but... i cannot find in standard where it can be used and i cannot find any mib that using "qualified" descriptors.

It seems that no one uses it. Is in real mib "qualified" descriptors used and how it used?


Solution

  • I made up some test cases for my compiler product, so post them here for your reference.

    TEST1-MIB module who defines mytest as 9998.

    TEST1-MIB DEFINITIONS ::= BEGIN
    IMPORTS
        enterprises
            FROM SNMPv2-SMI;
    
    mytest OBJECT IDENTIFIER ::= { enterprises 9998 }
    
    END
    

    TEST2-MIB module who defines mytest as 9999.

    TEST2-MIB DEFINITIONS ::= BEGIN
    IMPORTS
        enterprises
            FROM SNMPv2-SMI;
    
    mytest OBJECT IDENTIFIER ::= { enterprises 9999 }
    
    END
    

    Then when TEST3-MIB module tries to import both, we need the prefix to determine which mytest would be used,

    TEST3-MIB DEFINITIONS ::= BEGIN
    IMPORTS
        mytest
            FROM TEST1-MIB
        mytest
            FROM TEST2-MIB;
    
    mytest1 OBJECT IDENTIFIER ::= { TEST2-MIB.mytest 9999 }
    
    END