diff options
author | elie <elie> | 2015-12-12 15:48:47 +0000 |
---|---|---|
committer | elie <elie> | 2015-12-12 15:48:47 +0000 |
commit | 1244961c3fb0c76289bc94c6b66da7474838c556 (patch) | |
tree | 59c463ef9cb75b7c1a3a4c3681b4c86c2fefd19f /pysnmp | |
parent | 9815736980981682ec7c4d510cf0bd8e4473a3fe (diff) | |
download | pysnmp-git-1244961c3fb0c76289bc94c6b66da7474838c556.tar.gz |
all SNMP counters now incremented via '+= 1' rather than 'x = x + 1'
Diffstat (limited to 'pysnmp')
-rw-r--r-- | pysnmp/cache.py | 4 | ||||
-rw-r--r-- | pysnmp/carrier/asyncio/dispatch.py | 4 | ||||
-rw-r--r-- | pysnmp/entity/engine.py | 2 | ||||
-rw-r--r-- | pysnmp/entity/rfc3413/ntfrcv.py | 2 | ||||
-rw-r--r-- | pysnmp/proto/mpmod/rfc2576.py | 2 | ||||
-rw-r--r-- | pysnmp/proto/rfc3412.py | 8 | ||||
-rw-r--r-- | pysnmp/proto/secmod/rfc2576.py | 2 | ||||
-rw-r--r-- | pysnmp/proto/secmod/rfc3414/service.py | 16 |
8 files changed, 20 insertions, 20 deletions
diff --git a/pysnmp/cache.py b/pysnmp/cache.py index 46ad6020..49be826f 100644 --- a/pysnmp/cache.py +++ b/pysnmp/cache.py @@ -19,7 +19,7 @@ class Cache: return k in self.__cache def __getitem__(self, k): - self.__usage[k] = self.__usage[k] + 1 + self.__usage[k] += 1 return self.__cache[k] def __len__(self): @@ -34,7 +34,7 @@ class Cache: del self.__usage[_k] self.__size = self.__size - self.__chopSize if k not in self.__cache: - self.__size = self.__size + 1 + self.__size += 1 self.__usage[k] = 0 self.__cache[k] = v diff --git a/pysnmp/carrier/asyncio/dispatch.py b/pysnmp/carrier/asyncio/dispatch.py index 4365f792..0955fac5 100644 --- a/pysnmp/carrier/asyncio/dispatch.py +++ b/pysnmp/carrier/asyncio/dispatch.py @@ -71,13 +71,13 @@ class AsyncioDispatcher(AbstractTransportDispatcher): AbstractTransportDispatcher.registerTransport( self, tDomain, transport ) - self.__transportCount = self.__transportCount + 1 + self.__transportCount += 1 def unregisterTransport(self, tDomain): t = AbstractTransportDispatcher.getTransport(self, tDomain) if t is not None: AbstractTransportDispatcher.unregisterTransport(self, tDomain) - self.__transportCount = self.__transportCount - 1 + self.__transportCount -= 1 # The last transport has been removed, stop the timeout if self.__transportCount == 0 and not self.loopingcall.done(): diff --git a/pysnmp/entity/engine.py b/pysnmp/entity/engine.py index a3036fd0..cce2503b 100644 --- a/pysnmp/entity/engine.py +++ b/pysnmp/entity/engine.py @@ -119,7 +119,7 @@ class SnmpEngine: pass try: - snmpEngineBoots.syntax = snmpEngineBoots.syntax + 1 + snmpEngineBoots.syntax += 1 except: snmpEngineBoots.syntax = snmpEngineBoots.syntax.clone(1) diff --git a/pysnmp/entity/rfc3413/ntfrcv.py b/pysnmp/entity/rfc3413/ntfrcv.py index 1a27222c..da3734e5 100644 --- a/pysnmp/entity/rfc3413/ntfrcv.py +++ b/pysnmp/entity/rfc3413/ntfrcv.py @@ -78,7 +78,7 @@ class NotificationReceiver: except error.StatusInformation: debug.logger & debug.flagApp and debug.logger('processPdu: stateReference %s, statusInformation %s' % (stateReference, sys.exc_info()[1])) snmpSilentDrops, = snmpEngine.msgAndPduDsp.mibInstrumController.mibBuilder.importSymbols('__SNMPv2-MIB', 'snmpSilentDrops') - snmpSilentDrops.syntax = snmpSilentDrops.syntax + 1 + snmpSilentDrops.syntax += 1 elif PDU.tagSet in rfc3411.unconfirmedClassPDUs: pass diff --git a/pysnmp/proto/mpmod/rfc2576.py b/pysnmp/proto/mpmod/rfc2576.py index 605d01ca..ebe6e43c 100644 --- a/pysnmp/proto/mpmod/rfc2576.py +++ b/pysnmp/proto/mpmod/rfc2576.py @@ -238,7 +238,7 @@ class SnmpV1MessageProcessingModel(AbstractMessageProcessingModel): except PyAsn1Error: debug.logger & debug.flagMP and debug.logger('prepareDataElements: %s' % (sys.exc_info()[1],)) snmpInASNParseErrs, = snmpEngine.msgAndPduDsp.mibInstrumController.mibBuilder.importSymbols('__SNMPv2-MIB', 'snmpInASNParseErrs') - snmpInASNParseErrs.syntax = snmpInASNParseErrs.syntax + 1 + snmpInASNParseErrs.syntax += 1 raise error.StatusInformation(errorIndication=errind.parseError) debug.logger & debug.flagMP and debug.logger('prepareDataElements: %s' % (msg.prettyPrint(),)) diff --git a/pysnmp/proto/rfc3412.py b/pysnmp/proto/rfc3412.py index 26052c68..99117d3d 100644 --- a/pysnmp/proto/rfc3412.py +++ b/pysnmp/proto/rfc3412.py @@ -280,7 +280,7 @@ class MsgAndPduDispatcher: msgVersion = verdec.decodeMessageVersion(wholeMsg) except error.ProtocolError: snmpInASNParseErrs, = self.mibInstrumController.mibBuilder.importSymbols('__SNMPv2-MIB', 'snmpInASNParseErrs') - snmpInASNParseErrs.syntax = snmpInASNParseErrs.syntax + 1 + snmpInASNParseErrs.syntax += 1 return null # n.b the whole buffer gets dropped debug.logger & debug.flagDsp and debug.logger('receiveMessage: msgVersion %s, msg decoded' % msgVersion) @@ -292,7 +292,7 @@ class MsgAndPduDispatcher: mpHandler = snmpEngine.messageProcessingSubsystems[k] else: snmpInBadVersions, = self.mibInstrumController.mibBuilder.importSymbols('__SNMPv2-MIB', 'snmpInBadVersions') - snmpInBadVersions.syntax = snmpInBadVersions.syntax + 1 + snmpInBadVersions.syntax += 1 return restOfWholeMsg # 4.2.1.3 -- no-op @@ -337,7 +337,7 @@ class MsgAndPduDispatcher: if processPdu is None: # 4.2.2.1.2.a snmpUnknownPDUHandlers, = self.mibInstrumController.mibBuilder.importSymbols('__SNMP-MPD-MIB', 'snmpUnknownPDUHandlers') - snmpUnknownPDUHandlers.syntax = snmpUnknownPDUHandlers.syntax+1 + snmpUnknownPDUHandlers.syntax += 1 # 4.2.2.1.2.b statusInformation = { @@ -425,7 +425,7 @@ class MsgAndPduDispatcher: # 4.2.2.2.2 if cachedParams is None: snmpUnknownPDUHandlers, = self.mibInstrumController.mibBuilder.importSymbols('__SNMP-MPD-MIB', 'snmpUnknownPDUHandlers') - snmpUnknownPDUHandlers.syntax = snmpUnknownPDUHandlers.syntax+1 + snmpUnknownPDUHandlers.syntax += 1 return restOfWholeMsg debug.logger & debug.flagDsp and debug.logger('receiveMessage: cache read by sendPduHandle %s' % sendPduHandle) diff --git a/pysnmp/proto/secmod/rfc2576.py b/pysnmp/proto/secmod/rfc2576.py index 1aa8cded..337153f3 100644 --- a/pysnmp/proto/secmod/rfc2576.py +++ b/pysnmp/proto/secmod/rfc2576.py @@ -332,7 +332,7 @@ class SnmpV1SecurityModel(base.AbstractSecurityModel): except error.StatusInformation: snmpInBadCommunityNames, = snmpEngine.msgAndPduDsp.mibInstrumController.mibBuilder.importSymbols('__SNMPv2-MIB', 'snmpInBadCommunityNames') - snmpInBadCommunityNames.syntax = snmpInBadCommunityNames.syntax+1 + snmpInBadCommunityNames.syntax += 1 raise error.StatusInformation(errorIndication=errind.unknownCommunityName) snmpEngineID, = snmpEngine.msgAndPduDsp.mibInstrumController.mibBuilder.importSymbols('__SNMP-FRAMEWORK-MIB', 'snmpEngineID') diff --git a/pysnmp/proto/secmod/rfc3414/service.py b/pysnmp/proto/secmod/rfc3414/service.py index cc3edf73..7bb0e54d 100644 --- a/pysnmp/proto/secmod/rfc3414/service.py +++ b/pysnmp/proto/secmod/rfc3414/service.py @@ -265,7 +265,7 @@ class SnmpUSMSecurityModel(AbstractSecurityModel): except PyAsn1Error: debug.logger & debug.flagSM and debug.logger('processIncomingMsg: %s' % (sys.exc_info()[1],)) snmpInGenErrs, = snmpEngine.msgAndPduDsp.mibInstrumController.mibBuilder.importSymbols('__SNMPv2-MIB', 'snmpInGenErrs') - snmpInGenErrs.syntax = snmpInGenErrs.syntax + 1 + snmpInGenErrs.syntax += 1 raise error.StatusInformation( errorIndication=errind.invalidMsg ) @@ -532,7 +532,7 @@ class SnmpUSMSecurityModel(AbstractSecurityModel): not 4 < len(msgAuthoritativeEngineID) < 33: # 3.2.3b usmStatsUnknownEngineIDs, = snmpEngine.msgAndPduDsp.mibInstrumController.mibBuilder.importSymbols('__SNMP-USER-BASED-SM-MIB', 'usmStatsUnknownEngineIDs') - usmStatsUnknownEngineIDs.syntax = usmStatsUnknownEngineIDs.syntax+1 + usmStatsUnknownEngineIDs.syntax += 1 debug.logger & debug.flagSM and debug.logger('processIncomingMsg: null or malformed msgAuthoritativeEngineID') pysnmpUsmDiscoverable, = snmpEngine.msgAndPduDsp.mibInstrumController.mibBuilder.importSymbols('__PYSNMP-USM-MIB', 'pysnmpUsmDiscoverable') if pysnmpUsmDiscoverable.syntax: @@ -620,7 +620,7 @@ class SnmpUSMSecurityModel(AbstractSecurityModel): except PyAsn1Error: debug.logger & debug.flagSM and debug.logger('processIncomingMsg: %s' % (sys.exc_info()[1],)) snmpInGenErrs, = snmpEngine.msgAndPduDsp.mibInstrumController.mibBuilder.importSymbols('__SNMPv2-MIB', 'snmpInGenErrs') - snmpInGenErrs.syntax = snmpInGenErrs.syntax + 1 + snmpInGenErrs.syntax += 1 raise error.StatusInformation(errorIndication=errind.invalidMsg) else: # empty username used for engineID discovery @@ -669,7 +669,7 @@ class SnmpUSMSecurityModel(AbstractSecurityModel): __badSecIndication = 'noAuthNoPriv wanted while priv expected' if __badSecIndication: usmStatsUnsupportedSecLevels, = snmpEngine.msgAndPduDsp.mibInstrumController.mibBuilder.importSymbols('__SNMP-USER-BASED-SM-MIB', 'usmStatsUnsupportedSecLevels') - usmStatsUnsupportedSecLevels.syntax = usmStatsUnsupportedSecLevels.syntax + 1 + usmStatsUnsupportedSecLevels.syntax += 1 debug.logger & debug.flagSM and debug.logger('processIncomingMsg: reporting inappropriate security level for user %s: %s' % (msgUserName, __badSecIndication)) raise error.StatusInformation( errorIndication=errind.unsupportedSecurityLevel, @@ -700,7 +700,7 @@ class SnmpUSMSecurityModel(AbstractSecurityModel): except error.StatusInformation: usmStatsWrongDigests, = snmpEngine.msgAndPduDsp.mibInstrumController.mibBuilder.importSymbols('__SNMP-USER-BASED-SM-MIB', 'usmStatsWrongDigests') - usmStatsWrongDigests.syntax = usmStatsWrongDigests.syntax+1 + usmStatsWrongDigests.syntax += 1 raise error.StatusInformation( errorIndication=errind.authenticationFailure, oid=usmStatsWrongDigests.name, @@ -760,7 +760,7 @@ class SnmpUSMSecurityModel(AbstractSecurityModel): abs(idleTime + int(snmpEngineTime) - \ int(msgAuthoritativeEngineTime)) > 150: usmStatsNotInTimeWindows, = snmpEngine.msgAndPduDsp.mibInstrumController.mibBuilder.importSymbols('__SNMP-USER-BASED-SM-MIB', 'usmStatsNotInTimeWindows') - usmStatsNotInTimeWindows.syntax = usmStatsNotInTimeWindows.syntax+1 + usmStatsNotInTimeWindows.syntax += 1 raise error.StatusInformation( errorIndication=errind.notInTimeWindow, oid=usmStatsNotInTimeWindows.name, @@ -826,7 +826,7 @@ class SnmpUSMSecurityModel(AbstractSecurityModel): except error.StatusInformation: usmStatsDecryptionErrors, = snmpEngine.msgAndPduDsp.mibInstrumController.mibBuilder.importSymbols('__SNMP-USER-BASED-SM-MIB', 'usmStatsDecryptionErrors') - usmStatsDecryptionErrors.syntax = usmStatsDecryptionErrors.syntax+1 + usmStatsDecryptionErrors.syntax += 1 raise error.StatusInformation( errorIndication=errind.decryptionError, oid=usmStatsDecryptionErrors.name, @@ -870,7 +870,7 @@ class SnmpUSMSecurityModel(AbstractSecurityModel): # Delayed to include details if not msgUserName and not msgAuthoritativeEngineID: usmStatsUnknownUserNames, = snmpEngine.msgAndPduDsp.mibInstrumController.mibBuilder.importSymbols('__SNMP-USER-BASED-SM-MIB', 'usmStatsUnknownUserNames') - usmStatsUnknownUserNames.syntax = usmStatsUnknownUserNames.syntax+1 + usmStatsUnknownUserNames.syntax += 1 raise error.StatusInformation( errorIndication=errind.unknownSecurityName, oid=usmStatsUnknownUserNames.name, |