Skip to content

Commit

Permalink
properly refer to MIB modules defining symbols rather than assuming c…
Browse files Browse the repository at this point in the history
…urrent module
  • Loading branch information
etingof committed May 18, 2017
1 parent d15dc61 commit eb716b9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Revision 0.1.3, XX-05-2017
* INET-ADDRESS-MIB configured as pre-built at pysnmp codegen
* JSON codegen produces "nodetype" element for OBJECT-TYPE
* Fix to mibdump.py --destination-directory option
* Fix to pysnmp and JSON code generators to properly refer to MIB module
defining particular MIB object

Revision 0.1.2, 12-04-2017
--------------------------
Expand Down
8 changes: 4 additions & 4 deletions pysmi/codegen/jsondoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ def genNotificationGroup(self, data):
outDict['class'] = 'notificationgroup'

if objects:
outDict['objects'] = [{'module': self.moduleName[0], 'object': self.transOpers(obj)} for obj in objects]
outDict['objects'] = [{'module': self._importMap.get(obj, self.moduleName[0]), 'object': self.transOpers(obj)} for obj in objects]

if status:
outDict['status'] = status
Expand Down Expand Up @@ -360,7 +360,7 @@ def genNotificationType(self, data):
outDict['class'] = 'notificationtype'

if objects:
outDict['objects'] = [{'module': self.moduleName[0], 'object': self.transOpers(obj)} for obj in objects]
outDict['objects'] = [{'module': self._importMap.get(obj, self.moduleName[0]), 'object': self.transOpers(obj)} for obj in objects]

if status:
outDict['status'] = status
Expand Down Expand Up @@ -388,7 +388,7 @@ def genObjectGroup(self, data):
'class': 'objectgroup'})

if objects:
outDict['objects'] = [{'module': self.moduleName[0], 'object': self.transOpers(obj)} for obj in objects]
outDict['objects'] = [{'module': self._importMap.get(obj, self.moduleName[0]), 'object': self.transOpers(obj)} for obj in objects]

if status:
outDict['status'] = status
Expand Down Expand Up @@ -501,7 +501,7 @@ def genTrapType(self, data):
outDict['class'] = 'notificationtype'

if variables:
outDict['objects'] = [{'module': self.moduleName[0], 'object': self.transOpers(obj)} for obj in variables]
outDict['objects'] = [{'module': self._importMap.get(obj, self.moduleName[0]), 'object': self.transOpers(obj)} for obj in variables]

if self.genRules['text'] and description:
outDict['description'] = description
Expand Down
10 changes: 5 additions & 5 deletions pysmi/codegen/pysnmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ def genNotificationGroup(self, data, classmode=False):
oidStr, parentOid = oid

if objects:
objects = ['("' + self.moduleName[0] + '", "' + self.transOpers(obj) + '")' for obj in objects]
objects = ['("' + self._importMap.get(obj, self.moduleName[0]) + '", "' + self.transOpers(obj) + '")' for obj in objects]

objStr = ', '.join(objects)
outStr = name + ' = NotificationGroup(' + oidStr + ')' + label
Expand Down Expand Up @@ -417,7 +417,7 @@ def genNotificationType(self, data, classmode=False):
oidStr, parentOid = oid

if objects:
objects = ['("' + self.moduleName[0] + '", "' + self.transOpers(obj) + '")' for obj in objects]
objects = ['("' + self._importMap.get(obj, self.moduleName[0]) + '", "' + self.transOpers(obj) + '")' for obj in objects]

objStr = ', '.join(objects)
outStr = name + ' = NotificationType(' + oidStr + ')' + label
Expand Down Expand Up @@ -446,7 +446,7 @@ def genObjectGroup(self, data, classmode=False):
oidStr, parentOid = oid

if objects:
objects = ['("' + self.moduleName[0] + '", "' + self.transOpers(obj) + '")' for obj in objects]
objects = ['("' + self._importMap.get(obj, self.moduleName[0]) + '", "' + self.transOpers(obj) + '")' for obj in objects]

objStr = ', '.join(objects)
outStr = name + ' = ObjectGroup(' + oidStr + ')' + label
Expand Down Expand Up @@ -519,7 +519,7 @@ def genObjectType(self, data, classmode=False):

if augmention:
augmention = self.transOpers(augmention)
outStr += augmention + '.registerAugmentions(("' + self.moduleName[0] + '", "' + name + '"))\n'
outStr += augmention + '.registerAugmentions(("' + self._importMap.get(name, self.moduleName[0]) + '", "' + name + '"))\n'
outStr += name + '.setIndexNames(*' + augmention + '.getIndexNames())\n'

if status:
Expand Down Expand Up @@ -547,7 +547,7 @@ def genTrapType(self, data, classmode=False):
enterpriseStr, parentOid = enterprise

if variables:
variables = ['("' + self.moduleName[0] + '", "' + self.transOpers(var) + '")' for var in variables]
variables = ['("' + self._importMap.get(var, self.moduleName[0]) + '", "' + self.transOpers(var) + '")' for var in variables]

varStr = ', '.join(variables)

Expand Down

0 comments on commit eb716b9

Please sign in to comment.