From 0c0d054e8e949cf7645fd3fe26640ee52893f18a Mon Sep 17 00:00:00 2001 From: Ilya Etingof Date: Wed, 24 Oct 2018 10:14:33 +0200 Subject: Refactor MIB state machine into asynchronous operations (#210) Convert to async MIB instrumentation API (#210) MIB instrumentation API changed to allow for asynchronous managed objects access. The MIB instrumentation methods called by the state machine now return immediately and resume once the callback is called. The built-in SNMPv2-SMI objects are still synchronous. This change is a prerequisite for fully asynchronous managed objects implementation. --- .../v3arch/asyncore/agent/cmdrsp/implementing-scalar-mib-objects.py | 2 +- examples/v3arch/asyncore/proxy/command/ipv6-to-ipv4-conversion.py | 2 +- examples/v3arch/asyncore/proxy/command/v2c-to-v1-conversion.py | 2 +- examples/v3arch/asyncore/proxy/command/v2c-to-v3-conversion.py | 2 +- examples/v3arch/asyncore/proxy/command/v3-to-v2c-conversion.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) (limited to 'examples') diff --git a/examples/v3arch/asyncore/agent/cmdrsp/implementing-scalar-mib-objects.py b/examples/v3arch/asyncore/agent/cmdrsp/implementing-scalar-mib-objects.py index 878f97a9..783c1e6c 100644 --- a/examples/v3arch/asyncore/agent/cmdrsp/implementing-scalar-mib-objects.py +++ b/examples/v3arch/asyncore/agent/cmdrsp/implementing-scalar-mib-objects.py @@ -56,7 +56,7 @@ MibScalar, MibScalarInstance = mibBuilder.importSymbols( class MyStaticMibScalarInstance(MibScalarInstance): # noinspection PyUnusedLocal,PyUnusedLocal - def getValue(self, name, idx): + def getValue(self, name, idx, **context): return self.getSyntax().clone( 'Python %s running on a %s platform' % (sys.version, sys.platform) ) diff --git a/examples/v3arch/asyncore/proxy/command/ipv6-to-ipv4-conversion.py b/examples/v3arch/asyncore/proxy/command/ipv6-to-ipv4-conversion.py index 9e34fd0d..df712179 100644 --- a/examples/v3arch/asyncore/proxy/command/ipv6-to-ipv4-conversion.py +++ b/examples/v3arch/asyncore/proxy/command/ipv6-to-ipv4-conversion.py @@ -96,7 +96,7 @@ class CommandResponder(cmdrsp.CommandResponderBase): v2c.GetNextRequestPDU.tagSet: cmdgen.NextCommandGeneratorSingleRun(), v2c.GetBulkRequestPDU.tagSet: cmdgen.BulkCommandGeneratorSingleRun() } - pduTypes = cmdGenMap.keys() # This app will handle these PDUs + SUPPORTED_PDU_TYPES = cmdGenMap.keys() # This app will handle these PDUs # SNMP request relay def handleMgmtOperation(self, snmpEngine, stateReference, contextName, 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 3dd64ddf..c676e9b5 100644 --- a/examples/v3arch/asyncore/proxy/command/v2c-to-v1-conversion.py +++ b/examples/v3arch/asyncore/proxy/command/v2c-to-v1-conversion.py @@ -95,7 +95,7 @@ class CommandResponder(cmdrsp.CommandResponderBase): v2c.GetNextRequestPDU.tagSet: cmdgen.NextCommandGeneratorSingleRun(), v2c.GetBulkRequestPDU.tagSet: cmdgen.BulkCommandGeneratorSingleRun() } - pduTypes = cmdGenMap.keys() # This app will handle these PDUs + SUPPORTED_PDU_TYPES = cmdGenMap.keys() # This app will handle these PDUs # SNMP request relay def handleMgmtOperation(self, snmpEngine, stateReference, contextName, diff --git a/examples/v3arch/asyncore/proxy/command/v2c-to-v3-conversion.py b/examples/v3arch/asyncore/proxy/command/v2c-to-v3-conversion.py index f5d6167e..83d4c453 100644 --- a/examples/v3arch/asyncore/proxy/command/v2c-to-v3-conversion.py +++ b/examples/v3arch/asyncore/proxy/command/v2c-to-v3-conversion.py @@ -95,7 +95,7 @@ class CommandResponder(cmdrsp.CommandResponderBase): v2c.GetNextRequestPDU.tagSet: cmdgen.NextCommandGeneratorSingleRun(), v2c.GetBulkRequestPDU.tagSet: cmdgen.BulkCommandGeneratorSingleRun() } - pduTypes = cmdGenMap.keys() # This app will handle these PDUs + SUPPORTED_PDU_TYPES = cmdGenMap.keys() # This app will handle these PDUs # SNMP request relay def handleMgmtOperation(self, snmpEngine, stateReference, contextName, diff --git a/examples/v3arch/asyncore/proxy/command/v3-to-v2c-conversion.py b/examples/v3arch/asyncore/proxy/command/v3-to-v2c-conversion.py index b5d64790..e0c1c4d6 100644 --- a/examples/v3arch/asyncore/proxy/command/v3-to-v2c-conversion.py +++ b/examples/v3arch/asyncore/proxy/command/v3-to-v2c-conversion.py @@ -98,7 +98,7 @@ class CommandResponder(cmdrsp.CommandResponderBase): v2c.GetNextRequestPDU.tagSet: cmdgen.NextCommandGeneratorSingleRun(), v2c.GetBulkRequestPDU.tagSet: cmdgen.BulkCommandGeneratorSingleRun() } - pduTypes = cmdGenMap.keys() # This app will handle these PDUs + SUPPORTED_PDU_TYPES = cmdGenMap.keys() # This app will handle these PDUs # SNMP request relay def handleMgmtOperation(self, snmpEngine, stateReference, contextName, -- cgit v1.2.1