本文整理汇总了Python中pysnmp.proto.rfc1902.ObjectName方法的典型用法代码示例。如果您正苦于以下问题:Python rfc1902.ObjectName方法的具体用法?Python rfc1902.ObjectName怎么用?Python rfc1902.ObjectName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pysnmp.proto.rfc1902
的用法示例。
在下文中一共展示了rfc1902.ObjectName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getMibSymbol
# 需要导入模块: from pysnmp.proto import rfc1902 [as 别名]
# 或者: from pysnmp.proto.rfc1902 import ObjectName [as 别名]
def getMibSymbol(self):
"""Returns MIB variable symbolic identification.
Returns
-------
str
MIB module name
str
MIB variable symbolic name
: :py:class:`~pysnmp.proto.rfc1902.ObjectName`
class instance representing MIB variable instance index.
Raises
------
SmiError
If MIB variable conversion has not been performed.
Examples
--------
>>> objectIdentity = ObjectIdentity('1.3.6.1.2.1.1.1.0')
>>> objectIdentity.resolveWithMib(mibViewController)
>>> objectIdentity.getMibSymbol()
('SNMPv2-MIB', 'sysDescr', (0,))
>>>
"""
if self.__state & self.stClean:
return self.__modName, self.__symName, self.__indices
else:
raise SmiError('%s object not fully initialized' % self.__class__.__name__)
示例2: getOid
# 需要导入模块: from pysnmp.proto import rfc1902 [as 别名]
# 或者: from pysnmp.proto.rfc1902 import ObjectName [as 别名]
def getOid(self):
"""Returns OID identifying MIB variable.
Returns
-------
: :py:class:`~pysnmp.proto.rfc1902.ObjectName`
full OID identifying MIB variable including possible index part.
Raises
------
SmiError
If MIB variable conversion has not been performed.
Examples
--------
>>> objectIdentity = ObjectIdentity('SNMPv2-MIB', 'sysDescr', 0)
>>> objectIdentity.resolveWithMib(mibViewController)
>>> objectIdentity.getOid()
ObjectName('1.3.6.1.2.1.1.1.0')
>>>
"""
if self.__state & self.stClean:
return self.__oid
else:
raise SmiError('%s object not fully initialized' % self.__class__.__name__)