diff options
author | Ilya Etingof <etingof@gmail.com> | 2018-12-29 12:48:29 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-29 12:48:29 +0100 |
commit | d7534580837445553d8ffdc86fd5a161b9d57af1 (patch) | |
tree | 9f0223047bd118f00baefdaaea448d1e87890c0c /pysnmp/proto | |
parent | 6dd1d0bceb8a0d9bce603f2095a7971374e81f6f (diff) | |
download | pysnmp-git-d7534580837445553d8ffdc86fd5a161b9d57af1.tar.gz |
Redesigned SMI objects management model (#214)
The primary motivation behind this redesign is to allow asynchronous
operations between SNMP responder and the data source feeding its
MIB.
This is achieved by redesigning all `read*`, `write*`, `create*` and
`destroy*` methods of the `SNMPv2-SMI` MIB objects to return
immediately and deliver their results via a call back.
This modification brings significant and backward incompatible
changes to the low-level MIB operations.
The pysnmp MIB modules compiled for older pysnmp remain compatible.
Diffstat (limited to 'pysnmp/proto')
-rw-r--r-- | pysnmp/proto/rfc3412.py | 4 | ||||
-rw-r--r-- | pysnmp/proto/secmod/rfc3414/service.py | 11 |
2 files changed, 10 insertions, 5 deletions
diff --git a/pysnmp/proto/rfc3412.py b/pysnmp/proto/rfc3412.py index 386d1aaa..629dfcce 100644 --- a/pysnmp/proto/rfc3412.py +++ b/pysnmp/proto/rfc3412.py @@ -426,7 +426,7 @@ class MsgAndPduDispatcher(object): transportDomain, transportAddress ) - # 4.2.2.1.3 + # 4.2.2.1.3 (asynchronous function) processPdu(snmpEngine, messageProcessingModel, securityModel, securityName, securityLevel, contextEngineId, contextName, pduVersion, @@ -440,7 +440,7 @@ class MsgAndPduDispatcher(object): if stateReference is not None: del self.__transportInfo[stateReference] - debug.logger & debug.flagDsp and debug.logger('receiveMessage: processPdu succeeded') + debug.logger & debug.flagDsp and debug.logger('receiveMessage: processPdu initiated') return restOfWholeMsg else: # 4.2.2.2 (response) diff --git a/pysnmp/proto/secmod/rfc3414/service.py b/pysnmp/proto/secmod/rfc3414/service.py index f3324961..ad14dd63 100644 --- a/pysnmp/proto/secmod/rfc3414/service.py +++ b/pysnmp/proto/secmod/rfc3414/service.py @@ -168,9 +168,9 @@ class SnmpUSMSecurityModel(AbstractSecurityModel): tblIdx2 = usmUserEntry.getInstIdFromIndices(securityEngineID, userName) - # New row - mibInstrumController.writeVars( - (usmUserEntry.name + (13,) + tblIdx2, 4), **dict(snmpEngine=snmpEngine) + # New inactive row + mibInstrumController.writeMibObjects( + (usmUserEntry.name + (13,) + tblIdx2, 5), **dict(snmpEngine=snmpEngine) ) # Set user&securityNames @@ -184,6 +184,11 @@ class SnmpUSMSecurityModel(AbstractSecurityModel): usmUserEntry.getNode(usmUserEntry.name + (5,) + tblIdx2).syntax = usmUserAuthProtocol.syntax usmUserEntry.getNode(usmUserEntry.name + (8,) + tblIdx2).syntax = usmUserPrivProtocol.syntax + # Activate row + mibInstrumController.writeMibObjects( + (usmUserEntry.name + (13,) + tblIdx2, 1), **dict(snmpEngine=snmpEngine) + ) + # Localize and set keys pysnmpUsmKeyEntry, = mibInstrumController.mibBuilder.importSymbols( 'PYSNMP-USM-MIB', 'pysnmpUsmKeyEntry' |