summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelie <elie>2015-09-21 18:35:05 +0000
committerelie <elie>2015-09-21 18:35:05 +0000
commit1dc2e64a4a0a52a7e9ed3b07a01dd35a0aa29c95 (patch)
tree7ba4a69a759c1b42194a6f58dd9bc210442a4ed4
parent66b54b016bec3312059f0add5dcc8535d2a1a6c6 (diff)
downloadpysnmp-1dc2e64a4a0a52a7e9ed3b07a01dd35a0aa29c95.tar.gz
post-move documentation and code fixes
-rw-r--r--examples/hlapi/asyncore/agent/ntforg/async-multiple-informs-at-once.py2
-rw-r--r--examples/hlapi/asyncore/agent/ntforg/async-running-multiple-snmp-engines-at-once.py4
-rw-r--r--pysnmp/hlapi/__init__.py2
-rw-r--r--pysnmp/hlapi/asyncore/__init__.py2
-rw-r--r--pysnmp/hlapi/asyncore/_sync/cmdgen.py40
-rw-r--r--pysnmp/hlapi/asyncore/_sync/ntforg.py10
-rw-r--r--pysnmp/hlapi/asyncore/cmdgen.py50
-rw-r--r--pysnmp/hlapi/asyncore/ntforg.py14
-rw-r--r--pysnmp/hlapi/asyncore/transport.py16
-rw-r--r--pysnmp/hlapi/auth.py42
-rw-r--r--pysnmp/hlapi/context.py6
-rw-r--r--pysnmp/hlapi/lcd.py24
-rw-r--r--pysnmp/smi/rfc1902.py2
13 files changed, 109 insertions, 105 deletions
diff --git a/examples/hlapi/asyncore/agent/ntforg/async-multiple-informs-at-once.py b/examples/hlapi/asyncore/agent/ntforg/async-multiple-informs-at-once.py
index d14380b..e2cacbe 100644
--- a/examples/hlapi/asyncore/agent/ntforg/async-multiple-informs-at-once.py
+++ b/examples/hlapi/asyncore/agent/ntforg/async-multiple-informs-at-once.py
@@ -40,7 +40,7 @@ def cbFun(snmpEngine, sendRequestHandle, errorIndication,
for name, val in varBinds:
print('%s = %s' % (name.prettyPrint(), val.prettyPrint()))
-snmpEngine = engine.SnmpEngine()
+snmpEngine = SnmpEngine()
ntfOrg = AsyncNotificationOriginator()
diff --git a/examples/hlapi/asyncore/agent/ntforg/async-running-multiple-snmp-engines-at-once.py b/examples/hlapi/asyncore/agent/ntforg/async-running-multiple-snmp-engines-at-once.py
index 7028d84..9df9daf 100644
--- a/examples/hlapi/asyncore/agent/ntforg/async-running-multiple-snmp-engines-at-once.py
+++ b/examples/hlapi/asyncore/agent/ntforg/async-running-multiple-snmp-engines-at-once.py
@@ -62,10 +62,10 @@ transportDispatcher.registerRoutingCbFun(
lambda td,ta,d: ta[1] % 3 and 'A' or 'B'
)
-snmpEngineA = engine.SnmpEngine()
+snmpEngineA = SnmpEngine()
snmpEngineA.registerTransportDispatcher(transportDispatcher, 'A')
-snmpEngineB = engine.SnmpEngine()
+snmpEngineB = SnmpEngine()
snmpEngineB.registerTransportDispatcher(transportDispatcher, 'B')
ntfOrg = AsyncNotificationOriginator()
diff --git a/pysnmp/hlapi/__init__.py b/pysnmp/hlapi/__init__.py
index 07adb5a..7289fb6 100644
--- a/pysnmp/hlapi/__init__.py
+++ b/pysnmp/hlapi/__init__.py
@@ -2,4 +2,4 @@ from pysnmp.proto.rfc1902 import *
from pysnmp.smi.rfc1902 import *
from pysnmp.hlapi.auth import *
from pysnmp.hlapi.context import *
-from pysnmp.entity.engine import SnmpEngine
+from pysnmp.entity.engine import *
diff --git a/pysnmp/hlapi/asyncore/__init__.py b/pysnmp/hlapi/asyncore/__init__.py
index 9753462..9831a39 100644
--- a/pysnmp/hlapi/asyncore/__init__.py
+++ b/pysnmp/hlapi/asyncore/__init__.py
@@ -5,7 +5,7 @@ from pysnmp.hlapi.context import *
from pysnmp.hlapi.asyncore.transport import *
from pysnmp.hlapi.asyncore.cmdgen import *
from pysnmp.hlapi.asyncore.ntforg import *
-from pysnmp.entity.engine import SnmpEngine
+from pysnmp.entity.engine import *
try:
from pysnmp.hlapi.asyncore._sync.cmdgen import *
diff --git a/pysnmp/hlapi/asyncore/_sync/cmdgen.py b/pysnmp/hlapi/asyncore/_sync/cmdgen.py
index 5cdb290..36da95c 100644
--- a/pysnmp/hlapi/asyncore/_sync/cmdgen.py
+++ b/pysnmp/hlapi/asyncore/_sync/cmdgen.py
@@ -15,16 +15,16 @@ def getCmd(snmpEngine, authData, transportTarget, contextData,
Parameters
----------
- snmpEngine : :py:class:`~pysnmp.entity.engine.SnmpEngine`
+ snmpEngine : :py:class:`~pysnmp.hlapi.SnmpEngine`
Class instance representing SNMP engine.
- authData : :py:class:`~pysnmp.entity.rfc3413.oneliner.auth.CommunityData` or :py:class:`~pysnmp.entity.rfc3413.oneliner.auth.UsmUserData`
+ authData : :py:class:`~pysnmp.hlapi.CommunityData` or :py:class:`~pysnmp.hlapi.UsmUserData`
Class instance representing SNMP credentials.
- transportTarget : :py:class:`~pysnmp.entity.rfc3413.oneliner.target.UdpTransportTarget` or :py:class:`~pysnmp.entity.rfc3413.oneliner.target.Udp6TransportTarget`
+ transportTarget : :py:class:`~pysnmp.hlapi.asyncore.UdpTransportTarget` or :py:class:`~pysnmp.hlapi.asyncore.Udp6TransportTarget`
Class instance representing transport type along with SNMP peer address.
- contextData : :py:class:`~pysnmp.entity.rfc3413.oneliner.ctx.ContextData`
+ contextData : :py:class:`~pysnmp.hlapi.ContextData`
Class instance representing SNMP ContextEngineId and ContextName values.
\*varBinds : :py:class:`~pysnmp.smi.rfc1902.ObjectType`
@@ -65,7 +65,7 @@ def getCmd(snmpEngine, authData, transportTarget, contextData,
Examples
--------
- >>> from pysnmp.entity.rfc3413.oneliner.cmdgen import *
+ >>> from pysnmp.hlapi.asyncore import *
>>> g = getCmd(SnmpEngine(),
... CommunityData('public'),
... UdpTransportTarget(('demo.snmplabs.com', 161)),
@@ -124,16 +124,16 @@ def setCmd(snmpEngine, authData, transportTarget, contextData,
Parameters
----------
- snmpEngine : :py:class:`~pysnmp.entity.engine.SnmpEngine`
+ snmpEngine : :py:class:`~pysnmp.hlapi.SnmpEngine`
Class instance representing SNMP engine.
- authData : :py:class:`~pysnmp.entity.rfc3413.oneliner.auth.CommunityData` or :py:class:`~pysnmp.entity.rfc3413.oneliner.auth.UsmUserData`
+ authData : :py:class:`~pysnmp.hlapi.CommunityData` or :py:class:`~pysnmp.hlapi.UsmUserData`
Class instance representing SNMP credentials.
- transportTarget : :py:class:`~pysnmp.entity.rfc3413.oneliner.target.UdpTransportTarget` or :py:class:`~pysnmp.entity.rfc3413.oneliner.target.Udp6TransportTarget`
+ transportTarget : :py:class:`~pysnmp.hlapi.asyncore.UdpTransportTarget` or :py:class:`~pysnmp.hlapi.asyncore.Udp6TransportTarget`
Class instance representing transport type along with SNMP peer address.
- contextData : :py:class:`~pysnmp.entity.rfc3413.oneliner.ctx.ContextData`
+ contextData : :py:class:`~pysnmp.hlapi.ContextData`
Class instance representing SNMP ContextEngineId and ContextName values.
\*varBinds : :py:class:`~pysnmp.smi.rfc1902.ObjectType`
@@ -175,7 +175,7 @@ def setCmd(snmpEngine, authData, transportTarget, contextData,
Examples
--------
- >>> from pysnmp.entity.rfc3413.oneliner.cmdgen import *
+ >>> from pysnmp.hlapi.asyncore import *
>>> g = setCmd(SnmpEngine(),
... CommunityData('public'),
... UdpTransportTarget(('demo.snmplabs.com', 161)),
@@ -235,16 +235,16 @@ def nextCmd(snmpEngine, authData, transportTarget, contextData,
Parameters
----------
- snmpEngine : :py:class:`~pysnmp.entity.engine.SnmpEngine`
+ snmpEngine : :py:class:`~pysnmp.hlapi.SnmpEngine`
Class instance representing SNMP engine.
- authData : :py:class:`~pysnmp.entity.rfc3413.oneliner.auth.CommunityData` or :py:class:`~pysnmp.entity.rfc3413.oneliner.auth.UsmUserData`
+ authData : :py:class:`~pysnmp.hlapi.CommunityData` or :py:class:`~pysnmp.hlapi.UsmUserData`
Class instance representing SNMP credentials.
- transportTarget : :py:class:`~pysnmp.entity.rfc3413.oneliner.target.UdpTransportTarget` or :py:class:`~pysnmp.entity.rfc3413.oneliner.target.Udp6TransportTarget`
+ transportTarget : :py:class:`~pysnmp.hlapi.asyncore.UdpTransportTarget` or :py:class:`~pysnmp.hlapi.asyncore.Udp6TransportTarget`
Class instance representing transport type along with SNMP peer address.
- contextData : :py:class:`~pysnmp.entity.rfc3413.oneliner.ctx.ContextData`
+ contextData : :py:class:`~pysnmp.hlapi.ContextData`
Class instance representing SNMP ContextEngineId and ContextName values.
\*varBinds : :py:class:`~pysnmp.smi.rfc1902.ObjectType`
@@ -306,7 +306,7 @@ def nextCmd(snmpEngine, authData, transportTarget, contextData,
Examples
--------
- >>> from pysnmp.entity.rfc3413.oneliner.cmdgen import *
+ >>> from pysnmp.hlapi.asyncore import *
>>> g = nextCmd(SnmpEngine(),
... CommunityData('public'),
... UdpTransportTarget(('demo.snmplabs.com', 161)),
@@ -410,16 +410,16 @@ def bulkCmd(snmpEngine, authData, transportTarget, contextData,
Parameters
----------
- snmpEngine : :py:class:`~pysnmp.entity.engine.SnmpEngine`
+ snmpEngine : :py:class:`~pysnmp.hlapi.SnmpEngine`
Class instance representing SNMP engine.
- authData : :py:class:`~pysnmp.entity.rfc3413.oneliner.auth.CommunityData` or :py:class:`~pysnmp.entity.rfc3413.oneliner.auth.UsmUserData`
+ authData : :py:class:`~pysnmp.hlapi.CommunityData` or :py:class:`~pysnmp.hlapi.UsmUserData`
Class instance representing SNMP credentials.
- transportTarget : :py:class:`~pysnmp.entity.rfc3413.oneliner.target.UdpTransportTarget` or :py:class:`~pysnmp.entity.rfc3413.oneliner.target.Udp6TransportTarget`
+ transportTarget : :py:class:`~pysnmp.hlapi.asyncore.UdpTransportTarget` or :py:class:`~pysnmp.hlapi.asyncore.Udp6TransportTarget`
Class instance representing transport type along with SNMP peer address.
- contextData : :py:class:`~pysnmp.entity.rfc3413.oneliner.ctx.ContextData`
+ contextData : :py:class:`~pysnmp.hlapi.ContextData`
Class instance representing SNMP ContextEngineId and ContextName values.
nonRepeaters : int
@@ -495,7 +495,7 @@ def bulkCmd(snmpEngine, authData, transportTarget, contextData,
Examples
--------
- >>> from pysnmp.entity.rfc3413.oneliner.cmdgen import *
+ >>> from pysnmp.hlapi.asyncore import *
>>> g = bulkCmd(SnmpEngine(),
... CommunityData('public'),
... UdpTransportTarget(('demo.snmplabs.com', 161)),
diff --git a/pysnmp/hlapi/asyncore/_sync/ntforg.py b/pysnmp/hlapi/asyncore/_sync/ntforg.py
index bec88cf..ac778c1 100644
--- a/pysnmp/hlapi/asyncore/_sync/ntforg.py
+++ b/pysnmp/hlapi/asyncore/_sync/ntforg.py
@@ -12,16 +12,16 @@ def sendNotification(snmpEngine, authData, transportTarget, contextData,
Parameters
----------
- snmpEngine : :py:class:`~pysnmp.entity.engine.SnmpEngine`
+ snmpEngine : :py:class:`~pysnmp.hlapi.SnmpEngine`
Class instance representing SNMP engine.
- authData : :py:class:`~pysnmp.entity.rfc3413.oneliner.auth.CommunityData` or :py:class:`~pysnmp.entity.rfc3413.oneliner.auth.UsmUserData`
+ authData : :py:class:`~pysnmp.hlapi.CommunityData` or :py:class:`~pysnmp.hlapi.UsmUserData`
Class instance representing SNMP credentials.
- transportTarget : :py:class:`~pysnmp.entity.rfc3413.oneliner.target.UdpTransportTarget` or :py:class:`~pysnmp.entity.rfc3413.oneliner.target.Udp6TransportTarget`
+ transportTarget : :py:class:`~pysnmp.hlapi.asyncore.UdpTransportTarget` or :py:class:`~pysnmp.hlapi.asyncore.Udp6TransportTarget`
Class instance representing transport type along with SNMP peer address.
- contextData : :py:class:`~pysnmp.entity.rfc3413.oneliner.ctx.ContextData`
+ contextData : :py:class:`~pysnmp.hlapi.ContextData`
Class instance representing SNMP ContextEngineId and ContextName values.
notifyType : str
@@ -71,7 +71,7 @@ def sendNotification(snmpEngine, authData, transportTarget, contextData,
Examples
--------
- >>> from pysnmp.entity.rfc3413.oneliner.ntforg import *
+ >>> from pysnmp.hlapi.asyncore import *
>>> g = sendNotification(SnmpEngine(),
... CommunityData('public'),
... UdpTransportTarget(('demo.snmplabs.com', 162)),
diff --git a/pysnmp/hlapi/asyncore/cmdgen.py b/pysnmp/hlapi/asyncore/cmdgen.py
index 850dade..28c5954 100644
--- a/pysnmp/hlapi/asyncore/cmdgen.py
+++ b/pysnmp/hlapi/asyncore/cmdgen.py
@@ -17,7 +17,7 @@ class AsyncCommandGenerator:
This is a high-level wrapper around pure Command Generator
impementation that aims at simplyfing
- :py:class:`pysnmp.entity.engine.SnmpEngine`'s Local Configuration
+ :py:class:`pysnmp.hlapi.SnmpEngine`'s Local Configuration
Datastore (:RFC:`2271#section-3.4.2`) management. Typically,
users instantiate `AsyncCommandGenerator` and call its
commmand-specific methods passing them canned Security,
@@ -44,17 +44,17 @@ class AsyncCommandGenerator:
Parameters
----------
- snmpEngine : :py:class:`~pysnmp.entity.engine.SnmpEngine`
+ snmpEngine : :py:class:`~pysnmp.hlapi.SnmpEngine`
Class instance representing SNMP engine.
- authData : :py:class:`~pysnmp.entity.rfc3413.oneliner.auth.CommunityData` or :py:class:`~pysnmp.entity.rfc3413.oneliner.auth.UsmUserData`
+ authData : :py:class:`~pysnmp.hlapi.CommunityData` or :py:class:`~pysnmp.hlapi.UsmUserData`
Class instance representing SNMP credentials.
- transportTarget : :py:class:`~pysnmp.entity.rfc3413.oneliner.target.UdpTransportTarget` or :py:class:`~pysnmp.entity.rfc3413.oneliner.target.Udp6TransportTarget`
+ transportTarget : :py:class:`~pysnmp.hlapi.asyncore.UdpTransportTarget` or :py:class:`~pysnmp.hlapi.asyncore.Udp6TransportTarget`
Class instance representing transport type along with SNMP peer
address.
- contextData : :py:class:`~pysnmp.entity.rfc3413.oneliner.ctx.ContextData`
+ contextData : :py:class:`~pysnmp.hlapi.ContextData`
Class instance representing SNMP ContextEngineId and ContextName
values.
@@ -80,7 +80,7 @@ class AsyncCommandGenerator:
User-supplied `cbFun` callable must have the following call
signature:
- * snmpEngine (:py:class:`~pysnmp.entity.engine.SnmpEngine`):
+ * snmpEngine (:py:class:`~pysnmp.hlapi.SnmpEngine`):
Class instance representing SNMP engine.
* sendRequestHandle (int): Unique request identifier. Can be used
for matching multiple ongoing requests with received responses.
@@ -107,7 +107,7 @@ class AsyncCommandGenerator:
Examples
--------
- >>> from pysnmp.entity.rfc3413.oneliner.cmdgen import *
+ >>> from pysnmp.hlapi.asyncore import *
>>> def cbFun(snmpEngine, sendRequestHandle, errorIndication, errorStatus, errorIndex, varBinds, cbCtx):
... print(errorIndication, errorStatus, errorIndex, varBinds)
>>>
@@ -165,17 +165,17 @@ class AsyncCommandGenerator:
Parameters
----------
- snmpEngine : :py:class:`~pysnmp.entity.engine.SnmpEngine`
+ snmpEngine : :py:class:`~pysnmp.hlapi.SnmpEngine`
Class instance representing SNMP engine.
- authData : :py:class:`~pysnmp.entity.rfc3413.oneliner.auth.CommunityData` or :py:class:`~pysnmp.entity.rfc3413.oneliner.auth.UsmUserData`
+ authData : :py:class:`~pysnmp.hlapi.CommunityData` or :py:class:`~pysnmp.hlapi.UsmUserData`
Class instance representing SNMP credentials.
- transportTarget : :py:class:`~pysnmp.entity.rfc3413.oneliner.target.UdpTransportTarget` or :py:class:`~pysnmp.entity.rfc3413.oneliner.target.Udp6TransportTarget`
+ transportTarget : :py:class:`~pysnmp.hlapi.asyncore.UdpTransportTarget` or :py:class:`~pysnmp.hlapi.asyncore.Udp6TransportTarget`
Class instance representing transport type along with SNMP peer
address.
- contextData : :py:class:`~pysnmp.entity.rfc3413.oneliner.ctx.ContextData`
+ contextData : :py:class:`~pysnmp.hlapi.ContextData`
Class instance representing SNMP ContextEngineId and ContextName
values.
@@ -201,7 +201,7 @@ class AsyncCommandGenerator:
User-supplied `cbFun` callable must have the following call
signature:
- * snmpEngine (:py:class:`~pysnmp.entity.engine.SnmpEngine`):
+ * snmpEngine (:py:class:`~pysnmp.hlapi.SnmpEngine`):
Class instance representing SNMP engine.
* sendRequestHandle (int): Unique request identifier. Can be used
for matching multiple ongoing requests with received responses.
@@ -228,7 +228,7 @@ class AsyncCommandGenerator:
Examples
--------
- >>> from pysnmp.entity.rfc3413.oneliner.cmdgen import *
+ >>> from pysnmp.hlapi.asyncore import *
>>> def cbFun(snmpEngine, sendRequestHandle, errorIndication, errorStatus, errorIndex, varBinds, cbCtx):
... print(errorIndication, errorStatus, errorIndex, varBinds)
>>>
@@ -286,17 +286,17 @@ class AsyncCommandGenerator:
Parameters
----------
- snmpEngine : :py:class:`~pysnmp.entity.engine.SnmpEngine`
+ snmpEngine : :py:class:`~pysnmp.hlapi.SnmpEngine`
Class instance representing SNMP engine.
- authData : :py:class:`~pysnmp.entity.rfc3413.oneliner.auth.CommunityData` or :py:class:`~pysnmp.entity.rfc3413.oneliner.auth.UsmUserData`
+ authData : :py:class:`~pysnmp.hlapi.CommunityData` or :py:class:`~pysnmp.hlapi.UsmUserData`
Class instance representing SNMP credentials.
- transportTarget : :py:class:`~pysnmp.entity.rfc3413.oneliner.target.UdpTransportTarget` or :py:class:`~pysnmp.entity.rfc3413.oneliner.target.Udp6TransportTarget`
+ transportTarget : :py:class:`~pysnmp.hlapi.asyncore.UdpTransportTarget` or :py:class:`~pysnmp.hlapi.asyncore.Udp6TransportTarget`
Class instance representing transport type along with SNMP peer
address.
- contextData : :py:class:`~pysnmp.entity.rfc3413.oneliner.ctx.ContextData`
+ contextData : :py:class:`~pysnmp.hlapi.ContextData`
Class instance representing SNMP ContextEngineId and ContextName
values.
@@ -322,7 +322,7 @@ class AsyncCommandGenerator:
User-supplied `cbFun` callable must have the following call
signature:
- * snmpEngine (:py:class:`~pysnmp.entity.engine.SnmpEngine`):
+ * snmpEngine (:py:class:`~pysnmp.hlapi.SnmpEngine`):
Class instance representing SNMP engine.
* sendRequestHandle (int): Unique request identifier. Can be used
for matching multiple ongoing requests with received responses.
@@ -351,7 +351,7 @@ class AsyncCommandGenerator:
Examples
--------
- >>> from pysnmp.entity.rfc3413.oneliner.cmdgen import *
+ >>> from pysnmp.hlapi.asyncore import *
>>> def cbFun(snmpEngine, sendRequestHandle, errorIndication, errorStatus, errorIndex, varBinds, cbCtx):
... print(errorIndication, errorStatus, errorIndex, varBinds)
>>>
@@ -406,17 +406,17 @@ class AsyncCommandGenerator:
Parameters
----------
- snmpEngine : :py:class:`~pysnmp.entity.engine.SnmpEngine`
+ snmpEngine : :py:class:`~pysnmp.hlapi.SnmpEngine`
Class instance representing SNMP engine.
- authData : :py:class:`~pysnmp.entity.rfc3413.oneliner.auth.CommunityData` or :py:class:`~pysnmp.entity.rfc3413.oneliner.auth.UsmUserData`
+ authData : :py:class:`~pysnmp.hlapi.CommunityData` or :py:class:`~pysnmp.hlapi.UsmUserData`
Class instance representing SNMP credentials.
- transportTarget : :py:class:`~pysnmp.entity.rfc3413.oneliner.target.UdpTransportTarget` or :py:class:`~pysnmp.entity.rfc3413.oneliner.target.Udp6TransportTarget`
+ transportTarget : :py:class:`~pysnmp.hlapi.asyncore.UdpTransportTarget` or :py:class:`~pysnmp.hlapi.asyncore.Udp6TransportTarget`
Class instance representing transport type along with SNMP peer
address.
- contextData : :py:class:`~pysnmp.entity.rfc3413.oneliner.ctx.ContextData`
+ contextData : :py:class:`~pysnmp.hlapi.ContextData`
Class instance representing SNMP ContextEngineId and ContextName
values.
@@ -452,7 +452,7 @@ class AsyncCommandGenerator:
User-supplied `cbFun` callable must have the following call
signature:
- * snmpEngine (:py:class:`~pysnmp.entity.engine.SnmpEngine`):
+ * snmpEngine (:py:class:`~pysnmp.hlapi.SnmpEngine`):
Class instance representing SNMP engine.
* sendRequestHandle (int): Unique request identifier. Can be used
for matching multiple ongoing requests with received responses.
@@ -481,7 +481,7 @@ class AsyncCommandGenerator:
Examples
--------
- >>> from pysnmp.entity.rfc3413.oneliner.cmdgen import *
+ >>> from pysnmp.hlapi.asyncore import *
>>> def cbFun(snmpEngine, sendRequestHandle, errorIndication, errorStatus, errorIndex, varBinds, cbCtx):
... print(errorIndication, errorStatus, errorIndex, varBinds)
>>>
diff --git a/pysnmp/hlapi/asyncore/ntforg.py b/pysnmp/hlapi/asyncore/ntforg.py
index 6536b9c..3565a2f 100644
--- a/pysnmp/hlapi/asyncore/ntforg.py
+++ b/pysnmp/hlapi/asyncore/ntforg.py
@@ -16,7 +16,7 @@ class AsyncNotificationOriginator:
This is a high-level wrapper around pure Notification Originator
impementation that aims at simplyfing
- :py:class:`pysnmp.entity.engine.SnmpEngine`'s Local Configuration
+ :py:class:`pysnmp.hlapi.SnmpEngine`'s Local Configuration
Datastore (:RFC:`2271#section-3.4.2`) management. Typically,
users instantiate `AsyncNotificationOriginator` and call its
commmand-specific methods passing them canned Security,
@@ -47,17 +47,17 @@ class AsyncNotificationOriginator:
Parameters
----------
- snmpEngine : :py:class:`~pysnmp.entity.engine.SnmpEngine`
+ snmpEngine : :py:class:`~pysnmp.hlapi.SnmpEngine`
Class instance representing SNMP engine.
- authData : :py:class:`~pysnmp.entity.rfc3413.oneliner.auth.CommunityData` or :py:class:`~pysnmp.entity.rfc3413.oneliner.auth.UsmUserData`
+ authData : :py:class:`~pysnmp.hlapi.CommunityData` or :py:class:`~pysnmp.hlapi.UsmUserData`
Class instance representing SNMP credentials.
- transportTarget : :py:class:`~pysnmp.entity.rfc3413.oneliner.target.UdpTransportTarget` or :py:class:`~pysnmp.entity.rfc3413.oneliner.target.Udp6TransportTarget`
+ transportTarget : :py:class:`~pysnmp.hlapi.asyncore.UdpTransportTarget` or :py:class:`~pysnmp.hlapi.asyncore.Udp6TransportTarget`
Class instance representing transport type along with SNMP peer
address.
- contextData : :py:class:`~pysnmp.entity.rfc3413.oneliner.ctx.ContextData`
+ contextData : :py:class:`~pysnmp.hlapi.ContextData`
Class instance representing SNMP ContextEngineId and ContextName
values.
@@ -93,7 +93,7 @@ class AsyncNotificationOriginator:
User-supplied `cbFun` callable must have the following call
signature:
- * snmpEngine (:py:class:`~pysnmp.entity.engine.SnmpEngine`):
+ * snmpEngine (:py:class:`~pysnmp.hlapi.SnmpEngine`):
Class instance representing SNMP engine.
* sendRequestHandle (int): Unique request identifier. Can be used
for matching multiple ongoing *INFORM* notifications with received
@@ -122,7 +122,7 @@ class AsyncNotificationOriginator:
Examples
--------
- >>> from pysnmp.entity.rfc3413.oneliner.ntforg import *
+ >>> from pysnmp.hlapi.asyncore import *
>>>
>>> snmpEngine = SnmpEngine()
>>> n = AsyncNotificationOriginator()
diff --git a/pysnmp/hlapi/asyncore/transport.py b/pysnmp/hlapi/asyncore/transport.py
index f77f575..c585e0c 100644
--- a/pysnmp/hlapi/asyncore/transport.py
+++ b/pysnmp/hlapi/asyncore/transport.py
@@ -42,10 +42,10 @@ class UdpTransportTarget(_AbstractTransportTarget):
"""Creates UDP/IPv4 configuration entry and initialize socket API if needed.
This object can be used by
- :py:class:`~pysnmp.entity.rfc3413.oneliner.cmdgen.AsyncCommandGenerator` or
- :py:class:`~pysnmp.entity.rfc3413.oneliner.ntforg.AsyncNotificationOriginator`
+ :py:class:`~pysnmp.hlapi.asyncore.AsyncCommandGenerator` or
+ :py:class:`~pysnmp.hlapi.asyncore.AsyncNotificationOriginator`
and their derevatives for adding new entries to Local Configuration
- Datastore (LCD) managed by :py:class:`~pysnmp.entity.engine.SnmpEngine`
+ Datastore (LCD) managed by :py:class:`~pysnmp.hlapi.SnmpEngine`
class instance.
See :RFC:`1906#section-3` for more information on the UDP transport mapping.
@@ -69,7 +69,7 @@ class UdpTransportTarget(_AbstractTransportTarget):
Examples
--------
- >>> from pysnmp.entity.rfc3413.oneliner.target import UdpTransportTarget
+ >>> from pysnmp.hlapi.asyncore import UdpTransportTarget
>>> UdpTransportTarget(('demo.snmplabs.com', 161))
UdpTransportTarget(('195.218.195.228', 161), timeout=1, retries=5, tagList='')
>>>
@@ -91,10 +91,10 @@ class Udp6TransportTarget(_AbstractTransportTarget):
"""Creates UDP/IPv6 configuration entry and initialize socket API if needed.
This object can be used by
- :py:class:`~pysnmp.entity.rfc3413.oneliner.cmdgen.AsyncCommandGenerator` or
- :py:class:`~pysnmp.entity.rfc3413.oneliner.ntforg.AsyncNotificationOriginator`
+ :py:class:`~pysnmp.hlapi.asyncore.AsyncCommandGenerator` or
+ :py:class:`~pysnmp.hlapi.asyncore.AsyncNotificationOriginator`
and their derevatives for adding new entries to Local Configuration
- Datastore (LCD) managed by :py:class:`~pysnmp.entity.engine.SnmpEngine`
+ Datastore (LCD) managed by :py:class:`~pysnmp.hlapi.SnmpEngine`
class instance.
See :RFC:`1906#section-3`, :RFC:`2851#section-4` for more information
@@ -119,7 +119,7 @@ class Udp6TransportTarget(_AbstractTransportTarget):
Examples
--------
- >>> from pysnmp.entity.rfc3413.oneliner.target import Udp6TransportTarget
+ >>> from pysnmp.hlapi.asyncore import Udp6TransportTarget
>>> Udp6TransportTarget(('google.com', 161))
Udp6TransportTarget(('2a00:1450:4014:80a::100e', 161), timeout=1, retries=5, tagList='')
>>> Udp6TransportTarget(('FEDC:BA98:7654:3210:FEDC:BA98:7654:3210', 161))
diff --git a/pysnmp/hlapi/auth.py b/pysnmp/hlapi/auth.py
index 5108a21..74dc9a2 100644
--- a/pysnmp/hlapi/auth.py
+++ b/pysnmp/hlapi/auth.py
@@ -13,10 +13,10 @@ class CommunityData:
"""Creates SNMP v1/v2c configuration entry.
This object can be used by
- :py:class:`~pysnmp.entity.rfc3413.oneliner.cmdgen.AsyncCommandGenerator` or
- :py:class:`~pysnmp.entity.rfc3413.oneliner.ntforg.AsyncNotificationOriginator`
+ :py:class:`~pysnmp.hlapi.asyncore.AsyncCommandGenerator` or
+ :py:class:`~pysnmp.hlapi.asyncore.AsyncNotificationOriginator`
and their derivatives for adding new entries to Local Configuration
- Datastore (LCD) managed by :py:class:`~pysnmp.entity.engine.SnmpEngine`
+ Datastore (LCD) managed by :py:class:`~pysnmp.hlapi.SnmpEngine`
class instance.
See :RFC:`2576#section-5.3` for more information on the
@@ -45,7 +45,7 @@ class CommunityData:
Examples
--------
- >>> from pysnmp.entity.rfc3413.oneliner.auth import CommunityData
+ >>> from pysnmp.hlapi import CommunityData
>>> CommunityData('public')
CommunityData(communityIndex='s1410706889', communityName=<COMMUNITY>, mpModel=1, contextEngineId=None, contextName='', tag='')
>>> CommunityData('public', 'public')
@@ -140,10 +140,10 @@ class UsmUserData:
"""Creates SNMP v3 User Security Model (USM) configuration entry.
This object can be used by
- :py:class:`~pysnmp.entity.rfc3413.oneliner.cmdgen.AsyncCommandGenerator` or
- :py:class:`~pysnmp.entity.rfc3413.oneliner.ntforg.AsyncNotificationOriginator`
+ :py:class:`~pysnmp.hlapi.asyncore.AsyncCommandGenerator` or
+ :py:class:`~pysnmp.hlapi.asyncore.AsyncNotificationOriginator`
and their derivatives for adding new entries to Local Configuration
- Datastore (LCD) managed by :py:class:`~pysnmp.entity.engine.SnmpEngine`
+ Datastore (LCD) managed by :py:class:`~pysnmp.hlapi.SnmpEngine`
class instance.
See :RFC:`3414#section-5` for more information on the
@@ -155,15 +155,15 @@ class UsmUserData:
A human readable string representing the name of the SNMP USM user.
authKey : str
Initial value of the secret authentication key. If not set,
- :py:class:`~pysnmp.entity.rfc3413.oneliner.auth.usmNoAuthProtocol`
+ :py:class:`~pysnmp.hlapi.usmNoAuthProtocol`
is implied. If set and no *authProtocol* is specified,
- :py:class:`~pysnmp.entity.rfc3413.oneliner.auth.usmHMACMD5AuthProtocol`
+ :py:class:`~pysnmp.hlapi.usmHMACMD5AuthProtocol`
takes effect.
privKey : str
Initial value of the secret encryption key. If not set,
- :py:class:`~pysnmp.entity.rfc3413.oneliner.auth.usmNoPrivProtocol`
+ :py:class:`~pysnmp.hlapi.usmNoPrivProtocol`
is implied. If set and no *privProtocol* is specified,
- :py:class:`~pysnmp.entity.rfc3413.oneliner.auth.usmDESPrivProtocol`
+ :py:class:`~pysnmp.hlapi.usmDESPrivProtocol`
takes effect.
authProtocol : tuple
An indication of whether messages sent on behalf of this USM user
@@ -172,25 +172,25 @@ class UsmUserData:
Supported authentication protocol identifiers are:
- * :py:class:`~pysnmp.entity.rfc3413.oneliner.auth.usmNoAuthProtocol` (default is *authKey* not given)
- * :py:class:`~pysnmp.entity.rfc3413.oneliner.auth.usmHMACMD5AuthProtocol` (default if *authKey* is given)
- * :py:class:`~pysnmp.entity.rfc3413.oneliner.auth.usmHMACSHAAuthProtocol`
+ * :py:class:`~pysnmp.hlapi.usmNoAuthProtocol` (default is *authKey* not given)
+ * :py:class:`~pysnmp.hlapi.usmHMACMD5AuthProtocol` (default if *authKey* is given)
+ * :py:class:`~pysnmp.hlapi.usmHMACSHAAuthProtocol`
privProtocol : tuple
An indication of whether messages sent on behalf of this USM user
be encrypted, and if so, the type of encryption protocol which is used.
Supported encryption protocol identifiers are:
- * :py:class:`~pysnmp.entity.rfc3413.oneliner.auth.usmNoPrivProtocol` (default is *authKey* not given)
- * :py:class:`~pysnmp.entity.rfc3413.oneliner.auth.usmDESPrivProtocol` (default if *authKey* is given)
- * :py:class:`~pysnmp.entity.rfc3413.oneliner.auth.usm3DESEDEPrivProtocol`
- * :py:class:`~pysnmp.entity.rfc3413.oneliner.auth.usmAesCfb128Protocol`
- * :py:class:`~pysnmp.entity.rfc3413.oneliner.auth.usmAesCfb192Protocol`
- * :py:class:`~pysnmp.entity.rfc3413.oneliner.auth.usmAesCfb256Protocol`
+ * :py:class:`~pysnmp.hlapi.usmNoPrivProtocol` (default is *authKey* not given)
+ * :py:class:`~pysnmp.hlapi.usmDESPrivProtocol` (default if *authKey* is given)
+ * :py:class:`~pysnmp.hlapi.usm3DESEDEPrivProtocol`
+ * :py:class:`~pysnmp.hlapi.usmAesCfb128Protocol`
+ * :py:class:`~pysnmp.hlapi.usmAesCfb192Protocol`
+ * :py:class:`~pysnmp.hlapi.usmAesCfb256Protocol`
Examples
--------
- >>> from pysnmp.entity.rfc3413.oneliner.auth import UsmUserData
+ >>> from pysnmp.hlapi import UsmUserData
>>> UsmUserData('testuser', authKey='authenticationkey')
UsmUserData(userName='testuser', authKey=<AUTHKEY>, privKey=<PRIVKEY>, authProtocol=(1,3,6,1,6,3,10,1,1,2), privProtocol=(1,3,6,1,6,3,10,1,2,1))
>>> UsmUserData('testuser', authKey='authenticationkey', privKey='encryptionkey')
diff --git a/pysnmp/hlapi/context.py b/pysnmp/hlapi/context.py
index 0d86480..e63b367 100644
--- a/pysnmp/hlapi/context.py
+++ b/pysnmp/hlapi/context.py
@@ -6,8 +6,8 @@ class ContextData:
"""Creates UDP/IPv6 configuration entry and initialize socket API if needed.
This object can be used by
- :py:class:`~pysnmp.entity.rfc3413.oneliner.cmdgen.AsyncCommandGenerator` or
- :py:class:`~pysnmp.entity.rfc3413.oneliner.ntforg.AsyncNotificationOriginator`
+ :py:class:`~pysnmp.hlapi.asyncore.AsyncCommandGenerator` or
+ :py:class:`~pysnmp.hlapi.asyncore.AsyncNotificationOriginator`
and their derevatives for forming SNMP PDU and also adding new entries to
Local Configuration Datastore (LCD) in order to support SNMPv1/v2c with
SNMPv3 interoperability.
@@ -29,7 +29,7 @@ class ContextData:
Examples
--------
- >>> from pysnmp.entity.rfc3413.oneliner.ctx import ContextData
+ >>> from pysnmp.hlapi import ContextData
>>> ContextData()
ContextData(contextEngineId=None, contextName='')
>>> ContextData(OctetString(hexValue='01020ABBA0'))
diff --git a/pysnmp/hlapi/lcd.py b/pysnmp/hlapi/lcd.py
index e62eaf1..2709ed3 100644
--- a/pysnmp/hlapi/lcd.py
+++ b/pysnmp/hlapi/lcd.py
@@ -7,20 +7,20 @@ __all__ = ['CommandGeneratorLcdConfigurator',
class AbstractLcdConfigurator:
nextID = nextid.Integer(0xffffffff)
-
+ cacheKeys = []
def _getCache(self, snmpEngine):
- cache = snmpEngine.getUserContext(self.__class__.__name__)
+ cacheId = self.__class__.__name__
+ cache = snmpEngine.getUserContext(cacheId)
if cache is None:
- cache = {
- 'auth': {}, 'parm': {}, 'tran': {}, 'addr': {}
- }
- snmpEngine.setUserContext(cmdgen_cache=cache)
+ cache = dict([(x,{}) for x in self.cacheKeys])
+ snmpEngine.setUserContext(**{cacheId: cache})
return cache
def configure(self, snmpEngine, authData, transportTarget): pass
def unconfigure(self, snmpEngine, authData=None): pass
class CommandGeneratorLcdConfigurator(AbstractLcdConfigurator):
+ cacheKeys = ['auth', 'parm', 'tran', 'addr']
def configure(self, snmpEngine, authData, transportTarget):
cache = self._getCache(snmpEngine)
if isinstance(authData, CommunityData):
@@ -103,7 +103,7 @@ class CommandGeneratorLcdConfigurator(AbstractLcdConfigurator):
return addrName, paramsName
def unconfigure(self, snmpEngine, authData=None):
- cache = _getCache(snmpEngine)
+ cache = self._getCache(snmpEngine)
if authData:
if isinstance(authData, CommunityData):
authDataKey = authData.communityIndex
@@ -178,10 +178,12 @@ class CommandGeneratorLcdConfigurator(AbstractLcdConfigurator):
return addrNames, paramsNames
-class NotificationOriginatorLcdConfigurator(CommandGeneratorLcdConfigurator):
+class NotificationOriginatorLcdConfigurator(AbstractLcdConfigurator):
+ cacheKeys = ['auth', 'name']
+ _cmdGenLcdCfg = CommandGeneratorLcdConfigurator()
def configure(self, snmpEngine, authData, transportTarget, notifyType):
cache = self._getCache(snmpEngine)
- addrName, paramsName = CommandGeneratorLcdConfigurator.configure(self, snmpEngine, authData, transportTarget)
+ addrName, paramsName = self._cmdGenLcdCfg.configure(snmpEngine, authData, transportTarget)
tagList = transportTarget.tagList.split()
if not tagList:
tagList = ['']
@@ -218,7 +220,7 @@ class NotificationOriginatorLcdConfigurator(CommandGeneratorLcdConfigurator):
return notifyName
def unconfigure(self, snmpEngine, authData=None):
- cache = _getCache(snmpEngine)
+ cache = self._getCache(snmpEngine)
if authData:
authDataKey = authData.securityName, authData.securityModel
if authDataKey in cache['auth']:
@@ -228,7 +230,7 @@ class NotificationOriginatorLcdConfigurator(CommandGeneratorLcdConfigurator):
else:
authDataKeys = tuple(cache['auth'].keys())
- addrNames, paramsNames = CommandGeneratorLcdConfigurator.unconfigure(self, snmpEngine, authData)
+ addrNames, paramsNames = self._cmdGenLcdCfg.unconfigure(snmpEngine, authData)
notifyAndParamsNames = [ (cache['name'][x], x) for x in cache['name'].keys() if x[0] in paramsNames ]
diff --git a/pysnmp/smi/rfc1902.py b/pysnmp/smi/rfc1902.py
index 2ab5a8c..6faa993 100644
--- a/pysnmp/smi/rfc1902.py
+++ b/pysnmp/smi/rfc1902.py
@@ -8,6 +8,8 @@ from pyasn1.type.base import AbstractSimpleAsn1Item
from pyasn1.error import PyAsn1Error
from pysnmp import debug
+__all__ = ['ObjectIdentity', 'ObjectType', 'NotificationType']
+
class ObjectIdentity:
"""Create an object representing MIB variable ID.