diff options
author | Ilya Etingof <etingof@gmail.com> | 2017-10-05 23:21:30 +0200 |
---|---|---|
committer | Ilya Etingof <etingof@gmail.com> | 2017-10-05 23:21:30 +0200 |
commit | 9d35779f1cf8dce05bb8abe12aa7a2bb0732967a (patch) | |
tree | ac6faea496c30dbf14668cfadd42a1196ccbd204 /pysnmp/entity | |
parent | 82e59461016e8c0608aeec05489385ec4c18479a (diff) | |
download | pysnmp-git-9d35779f1cf8dce05bb8abe12aa7a2bb0732967a.tar.gz |
NotificationReceiver reports SNMPv1 TRAP community string
Diffstat (limited to 'pysnmp/entity')
-rw-r--r-- | pysnmp/entity/rfc3413/ntfrcv.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/pysnmp/entity/rfc3413/ntfrcv.py b/pysnmp/entity/rfc3413/ntfrcv.py index c3cc2c1c..14f965ea 100644 --- a/pysnmp/entity/rfc3413/ntfrcv.py +++ b/pysnmp/entity/rfc3413/ntfrcv.py @@ -21,10 +21,17 @@ class NotificationReceiver(object): snmpEngine.msgAndPduDsp.registerContextEngineId( null, self.pduTypes, self.processPdu # '' is a wildcard ) + + self.__snmpTrapCommunity = '' self.__cbFunVer = 0 self.__cbFun = cbFun self.__cbCtx = cbCtx + def storeSnmpTrapCommunity(snmpEngine, execpoint, variables, cbCtx): + self.__snmpTrapCommunity = variables.get('communityName', '') + + snmpEngine.observer.registerObserver(storeSnmpTrapCommunity, 'rfc2576.processIncomingMsg') + def close(self, snmpEngine): snmpEngine.msgAndPduDsp.unregisterContextEngineId( null, self.pduTypes @@ -39,7 +46,7 @@ class NotificationReceiver(object): # Agent-side API complies with SMIv2 if messageProcessingModel == 0: origPdu = PDU - PDU = rfc2576.v1ToV2(PDU) + PDU = rfc2576.v1ToV2(PDU, snmpTrapCommunity=self.__snmpTrapCommunity) else: origPdu = None |