SNMP Mib。 "qualified" 描述符是否在实践中使用
SNMP Mib. Are the "qualified" descriptors used in practice
根据标准 RFC 2578 3.2。导入符号[=19=]:
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.
一切似乎都清楚了,但是……
我在标准中找不到可以使用它的地方,也找不到任何使用 "qualified" 描述符的 mib。
好像没人用。在真实的 mib 中是否使用了 "qualified" 个描述符以及它是如何使用的?
我为我的编译器产品编了一些测试用例,所以post放在这里供大家参考。
TEST1-MIB
定义 mytest
为 9998
.
的模块
TEST1-MIB DEFINITIONS ::= BEGIN
IMPORTS
enterprises
FROM SNMPv2-SMI;
mytest OBJECT IDENTIFIER ::= { enterprises 9998 }
END
TEST2-MIB
定义 mytest
为 9999
.
的模块
TEST2-MIB DEFINITIONS ::= BEGIN
IMPORTS
enterprises
FROM SNMPv2-SMI;
mytest OBJECT IDENTIFIER ::= { enterprises 9999 }
END
然后当 TEST3-MIB
模块尝试导入两者时,我们需要前缀来确定将使用哪个 mytest
,
TEST3-MIB DEFINITIONS ::= BEGIN
IMPORTS
mytest
FROM TEST1-MIB
mytest
FROM TEST2-MIB;
mytest1 OBJECT IDENTIFIER ::= { TEST2-MIB.mytest 9999 }
END
根据标准 RFC 2578 3.2。导入符号[=19=]:
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.
一切似乎都清楚了,但是…… 我在标准中找不到可以使用它的地方,也找不到任何使用 "qualified" 描述符的 mib。
好像没人用。在真实的 mib 中是否使用了 "qualified" 个描述符以及它是如何使用的?
我为我的编译器产品编了一些测试用例,所以post放在这里供大家参考。
TEST1-MIB
定义 mytest
为 9998
.
TEST1-MIB DEFINITIONS ::= BEGIN
IMPORTS
enterprises
FROM SNMPv2-SMI;
mytest OBJECT IDENTIFIER ::= { enterprises 9998 }
END
TEST2-MIB
定义 mytest
为 9999
.
TEST2-MIB DEFINITIONS ::= BEGIN
IMPORTS
enterprises
FROM SNMPv2-SMI;
mytest OBJECT IDENTIFIER ::= { enterprises 9999 }
END
然后当 TEST3-MIB
模块尝试导入两者时,我们需要前缀来确定将使用哪个 mytest
,
TEST3-MIB DEFINITIONS ::= BEGIN
IMPORTS
mytest
FROM TEST1-MIB
mytest
FROM TEST2-MIB;
mytest1 OBJECT IDENTIFIER ::= { TEST2-MIB.mytest 9999 }
END