diff options
author | Ilya Etingof <etingof@gmail.com> | 2016-04-01 22:58:56 +0200 |
---|---|---|
committer | Ilya Etingof <etingof@gmail.com> | 2016-04-01 22:58:56 +0200 |
commit | 020791a97232849c9504024834906dd4a4ffb36c (patch) | |
tree | 6e5d69aa01877ee004efb77645b8148e586610cc /examples/v3arch/asyncore/proxy/command/v2c-to-v1-conversion.py | |
parent | 9541f201e33cd613995cee2e7a7656aa687deb51 (diff) | |
download | pysnmp-git-020791a97232849c9504024834906dd4a4ffb36c.tar.gz |
pep8 reformatted
Diffstat (limited to 'examples/v3arch/asyncore/proxy/command/v2c-to-v1-conversion.py')
-rw-r--r-- | examples/v3arch/asyncore/proxy/command/v2c-to-v1-conversion.py | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/examples/v3arch/asyncore/proxy/command/v2c-to-v1-conversion.py b/examples/v3arch/asyncore/proxy/command/v2c-to-v1-conversion.py index c8dc63eb..71e2347e 100644 --- a/examples/v3arch/asyncore/proxy/command/v2c-to-v1-conversion.py +++ b/examples/v3arch/asyncore/proxy/command/v2c-to-v1-conversion.py @@ -79,20 +79,21 @@ config.addTargetParams(snmpEngine, 'distant-agent-auth', 'distant-area', 'noAuthNoPriv', 0) config.addTargetAddr( - snmpEngine, 'distant-agent', - udp.domainName + (2,), ('195.218.195.228', 161), - 'distant-agent-auth', retryCount=0, tagList='distant' + snmpEngine, 'distant-agent', + udp.domainName + (2,), ('195.218.195.228', 161), + 'distant-agent-auth', retryCount=0, tagList='distant' ) # Default SNMP context config.addContext(snmpEngine, '') + class CommandResponder(cmdrsp.CommandResponderBase): - cmdGenMap = { + cmdGenMap = { v2c.GetRequestPDU.tagSet: cmdgen.GetCommandGenerator(), v2c.SetRequestPDU.tagSet: cmdgen.SetCommandGenerator(), v2c.GetNextRequestPDU.tagSet: cmdgen.NextCommandGeneratorSingleRun(), - v2c.GetBulkRequestPDU.tagSet: cmdgen.BulkCommandGeneratorSingleRun() + v2c.GetBulkRequestPDU.tagSet: cmdgen.BulkCommandGeneratorSingleRun() } pduTypes = cmdGenMap.keys() # This app will handle these PDUs @@ -103,14 +104,14 @@ class CommandResponder(cmdrsp.CommandResponderBase): contextEngineId = None # address authoritative SNMP Engine try: self.cmdGenMap[PDU.tagSet].sendPdu( - snmpEngine, 'distant-agent', + snmpEngine, 'distant-agent', contextEngineId, contextName, PDU, self.handleResponsePdu, cbCtx ) except error.PySnmpError: self.handleResponsePdu( - stateReference, 'error', None, cbCtx + snmpEngine, stateReference, 'error', None, cbCtx ) # SNMP response relay @@ -129,9 +130,10 @@ class CommandResponder(cmdrsp.CommandResponderBase): self.releaseStateInformation(stateReference) + CommandResponder(snmpEngine, context.SnmpContext(snmpEngine)) -snmpEngine.transportDispatcher.jobStarted(1) # this job would never finish +snmpEngine.transportDispatcher.jobStarted(1) # this job would never finish # Run I/O dispatcher which would receive queries and send responses try: |