summaryrefslogtreecommitdiff
path: root/pysnmp/smi/mibs
diff options
context:
space:
mode:
authorIlya Etingof <etingof@gmail.com>2017-04-17 11:27:53 +0200
committerIlya Etingof <etingof@gmail.com>2017-04-17 11:27:53 +0200
commit6bc707925cb851cff18820eedd3d0ba48c46d926 (patch)
tree62801ab52caeb35f3462cbc2072fde5dc0757927 /pysnmp/smi/mibs
parent928ee3c56a76858854c51dbe0f806e343765ba00 (diff)
downloadpysnmp-git-6bc707925cb851cff18820eedd3d0ba48c46d926.tar.gz
minor refactoring in part of rfc4001/4002
Diffstat (limited to 'pysnmp/smi/mibs')
-rw-r--r--pysnmp/smi/mibs/INET-ADDRESS-MIB.py4
-rw-r--r--pysnmp/smi/mibs/SNMPv2-SMI.py4
2 files changed, 5 insertions, 3 deletions
diff --git a/pysnmp/smi/mibs/INET-ADDRESS-MIB.py b/pysnmp/smi/mibs/INET-ADDRESS-MIB.py
index 2c794626..50b34a39 100644
--- a/pysnmp/smi/mibs/INET-ADDRESS-MIB.py
+++ b/pysnmp/smi/mibs/INET-ADDRESS-MIB.py
@@ -55,6 +55,8 @@ class InetAddressDNS(TextualConvention, OctetString):
displayHint = '255a'
subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(1, 255)
+# https://tools.ietf.org/html/rfc4001#section-4.1
+
class InetAddress(TextualConvention, OctetString):
description = "Denotes a generic Internet address. An InetAddress value is always interpreted within the context of an InetAddressType value. Every usage of the InetAddress textual convention is required to specify the InetAddressType object that provides the context. It is suggested that the InetAddressType object be logically registered before the object(s) that use the InetAddress textual convention, if they appear in the same logical row. The value of an InetAddress object must always be consistent with the value of the associated InetAddressType object. Attempts to set an InetAddress object to a value inconsistent with the associated InetAddressType must fail with an inconsistentValue error. When this textual convention is used as the syntax of an index object, there may be issues with the limit of 128 sub-identifiers specified in SMIv2, STD 58. In this case, the object definition MUST include a 'SIZE' clause to limit the number of potential instance sub-identifiers; otherwise the applicable constraints MUST be stated in the appropriate conceptual row DESCRIPTION clauses, or in the surrounding documentation if there is no single DESCRIPTION clause that is appropriate."
status = 'current'
@@ -69,7 +71,7 @@ class InetAddress(TextualConvention, OctetString):
}
@classmethod
- def cloneAsIndex(cls, value, impliedFlag, parentRow, parentIndices):
+ def cloneFromName(cls, value, impliedFlag, parentRow, parentIndices):
for parentIndex in reversed(parentIndices):
if isinstance(parentIndex, InetAddressType):
try:
diff --git a/pysnmp/smi/mibs/SNMPv2-SMI.py b/pysnmp/smi/mibs/SNMPv2-SMI.py
index 88f98d84..4fe9a768 100644
--- a/pysnmp/smi/mibs/SNMPv2-SMI.py
+++ b/pysnmp/smi/mibs/SNMPv2-SMI.py
@@ -997,8 +997,8 @@ class MibTableRow(MibTree):
if not value:
raise error.SmiError('Short OID for index %r' % (obj,))
value = tuple(value) # possible ObjectIdentifiers
- if hasattr(obj, 'cloneAsIndex'):
- return obj.cloneAsIndex(value, impliedFlag, parentRow=self, parentIndices=parentIndices)
+ if hasattr(obj, 'cloneFromName'):
+ return obj.cloneFromName(value, impliedFlag, parentRow=self, parentIndices=parentIndices)
baseTag = obj.getTagSet().getBaseTag()
if baseTag == self.__intBaseTag:
return obj.clone(value[0]), value[1:]