Skip to content

Commit bb48699

Browse files
committed
missing get/setReference() added to SNMPv2-SMI::NotificationType
1 parent 0645fc6 commit bb48699

File tree

2 files changed

+31
-8
lines changed

2 files changed

+31
-8
lines changed

CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Revision 4.4.2, released 2017-11-XX
1010
- Added support for some more missing fields of SMIv2 MACRO types
1111
- Example scripts rearranged in a way that IPv6 requirement is
1212
clearly encoded in the script's name
13+
- Fixed SNMPv2-SMI.NotificationType to expose .set/getReference()
14+
instead of .set/getRevision() which
1315
- Fixed non-implied-OID encoding in SNMP table indices
1416
- Fixed inconsistent SNMPv3 discovery and retrying algorithm
1517

pysnmp/smi/mibs/SNMPv2-SMI.py

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ class ModuleIdentity(MibNode):
8080
contactInfo = ''
8181
description = ''
8282
revisions = ()
83+
revisionsDescriptions = ()
8384

8485
def getStatus(self):
8586
return self.status
@@ -123,6 +124,13 @@ def setRevisions(self, args):
123124
self.revisions = args
124125
return self
125126

127+
def getRevisionsDescriptions(self):
128+
return self.revisionsDescriptions
129+
130+
def setRevisionsDescriptions(self, args):
131+
self.revisionsDescriptions = args
132+
return self
133+
126134
def asn1Print(self):
127135
return """\
128136
MODULE-IDENTITY
@@ -134,7 +142,7 @@ def asn1Print(self):
134142
self.getOrganization(),
135143
self.getContactInfo(),
136144
self.getDescription(),
137-
''.join(["REVISION \"%s\"\n" % x for x in self.getRevisions()]))
145+
''.join(['REVISION "%s"\n' % x for x in self.getRevisions()]))
138146

139147

140148
class ObjectIdentity(MibNode):
@@ -168,9 +176,10 @@ def asn1Print(self):
168176
OBJECT-IDENTITY
169177
STATUS %s
170178
DESCRIPTION "%s"
171-
REFERENCE "%s" """ % (self.getStatus(),
172-
self.getDescription(),
173-
self.getReference())
179+
REFERENCE "%s"
180+
""" % (self.getStatus(),
181+
self.getDescription(),
182+
self.getReference())
174183

175184

176185
# definition for objects
@@ -179,6 +188,8 @@ class NotificationType(MibNode):
179188
objects = ()
180189
status = 'current'
181190
description = ''
191+
reference = ''
192+
# retained for compatibility
182193
revisions = ()
183194

184195
def getObjects(self):
@@ -205,11 +216,20 @@ def setDescription(self, v):
205216
self.description = v
206217
return self
207218

219+
def getReference(self):
220+
return self.reference
221+
222+
def setReference(self, v):
223+
self.reference = v
224+
return self
225+
226+
# This should not be here. Retained for compatibility.
227+
208228
def getRevisions(self):
209229
return self.revisions
210230

211-
def setRevisions(self, args):
212-
self.revisions = args
231+
def setRevisions(self, v):
232+
self.revisions = v
213233
return self
214234

215235
def asn1Print(self):
@@ -218,10 +238,11 @@ def asn1Print(self):
218238
OBJECTS { %s }
219239
STATUS %s
220240
DESCRIPTION "%s"
221-
%s""" % (', '.join([x for x in self.getObjects()]),
241+
REFERENCE "%s"
242+
""" % (', '.join([x for x in self.getObjects()]),
222243
self.getStatus(),
223244
self.getDescription(),
224-
''.join(["REVISION \"%s\"\n" % x for x in self.getRevisions()]))
245+
self.getReference())
225246

226247

227248
class MibIdentifier(MibNode):

0 commit comments

Comments
 (0)