-
-
Notifications
You must be signed in to change notification settings - Fork 203
Commit
Previously, MIB resolution errors were ignored (whenever possible) for objects we were sending and receiving. This change tightens outgoing objects MIB compliance (send will fail), but tolerate non quite compliant objects we receive. Also, extend the same policy onto `NotificationOriginator`.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1113,14 +1113,20 @@ def loadMibs(self, *modNames): | |
def isFullyResolved(self): | ||
return self.__state & self.stClean | ||
|
||
def resolveWithMib(self, mibViewController): | ||
def resolveWithMib(self, mibViewController, ignoreErrors=True): | ||
"""Perform MIB variable ID conversion and notification objects expansion. | ||
Parameters | ||
---------- | ||
mibViewController : :py:class:`~pysnmp.smi.view.MibViewController` | ||
class instance representing MIB browsing functionality. | ||
Other Parameters | ||
---------------- | ||
ignoreErrors: :py:class:`bool` | ||
If `True` (default), ignore MIB object name or value casting | ||
failures if possible. | ||
Returns | ||
------- | ||
: :py:class:`~pysnmp.smi.rfc1902.NotificationType` | ||
|
@@ -1158,7 +1164,7 @@ class instance representing MIB browsing functionality. | |
|
||
self.__varBinds.append( | ||
ObjectType(ObjectIdentity(v2c.apiTrapPDU.snmpTrapOID), | ||
self.__objectIdentity).resolveWithMib(mibViewController) | ||
self.__objectIdentity).resolveWithMib(mibViewController, ignoreErrors) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
etingof
Author
Owner
|
||
) | ||
|
||
SmiNotificationType, = mibViewController.mibBuilder.importSymbols('SNMPv2-SMI', 'NotificationType') | ||
|
@@ -1170,11 +1176,11 @@ class instance representing MIB browsing functionality. | |
if isinstance(mibNode, SmiNotificationType): | ||
for notificationObject in mibNode.getObjects(): | ||
objectIdentity = ObjectIdentity(*notificationObject + self.__instanceIndex).resolveWithMib( | ||
mibViewController) | ||
mibViewController, ignoreErrors) | ||
This comment has been minimized.
Sorry, something went wrong.
eminjin
|
||
self.__varBinds.append( | ||
ObjectType(objectIdentity, | ||
self.__objects.get(notificationObject, rfc1905.unSpecified)).resolveWithMib( | ||
mibViewController) | ||
mibViewController, ignoreErrors) | ||
) | ||
varBindsLocation[objectIdentity] = len(self.__varBinds) - 1 | ||
else: | ||
|
@@ -1184,7 +1190,7 @@ class instance representing MIB browsing functionality. | |
for varBinds in self.__additionalVarBinds: | ||
if not isinstance(varBinds, ObjectType): | ||
varBinds = ObjectType(ObjectIdentity(varBinds[0]), varBinds[1]) | ||
varBinds.resolveWithMib(mibViewController) | ||
varBinds.resolveWithMib(mibViewController, ignoreErrors) | ||
if varBinds[0] in varBindsLocation: | ||
self.__varBinds[varBindsLocation[varBinds[0]]] = varBinds | ||
else: | ||
|
ObjectIdentity class function resolveWithMib has not added ignoreErrors flag