summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorIlya Etingof <etingof@gmail.com>2018-08-12 17:22:58 +0200
committerGitHub <noreply@github.com>2018-08-12 17:22:58 +0200
commitac0b956d006a4b7b32780e852740b56ecd826c7e (patch)
tree4576911add0e18525991109acdb2a91bc4b2fde8 /examples
parent488ec26798a4493ee0fc45e730f88f1365f56df7 (diff)
downloadpysnmp-git-ac0b956d006a4b7b32780e852740b56ecd826c7e.tar.gz
Add `hlapi.v1arch` API (#186)
* Add `hlapi.v1arch` API Introduce new sub-package `pysnmp.hlapi.v1arch` which wraps otherwise very detailed packet-level SNMP messaging into a handful of convenience functions. As a side effect, the `pysnmp.hlapi.*` sub-packages moved under `pysnmp.hlapi.v3arch` though `pysnmp.hlapi` still exposes `pysnmp.hlappi.v3arch.*` symbols to retain some degree of backward compatibility. The signature of the hlapi `.sendNotification()` call has changed to accept `*varBinds` instead of a sequence of `varBinds`. The rationale is to unify this method call with similar methods of CommandGenerator. * Add v1arch docs and reshuffle hlapi docs
Diffstat (limited to 'examples')
-rw-r--r--examples/hlapi/v1arch/asyncore/agent/ntforg/generic-v1-trap.py52
-rw-r--r--examples/hlapi/v1arch/asyncore/agent/ntforg/generic-v2c-trap.py44
-rw-r--r--examples/hlapi/v1arch/asyncore/agent/ntforg/v2c-inform.py51
-rw-r--r--examples/hlapi/v1arch/asyncore/agent/ntforg/v2c-trap-with-notification-objects.py53
-rw-r--r--examples/hlapi/v1arch/asyncore/manager/cmdgen/multiple-concurrent-queries-over-ipv4-and-ipv6.py63
-rw-r--r--examples/hlapi/v1arch/asyncore/manager/cmdgen/pull-mibs-from-multiple-agents-at-once-over-ipv4-and-ipv6.py63
-rw-r--r--examples/hlapi/v1arch/asyncore/manager/cmdgen/pull-whole-mib.py44
-rw-r--r--examples/hlapi/v1arch/asyncore/manager/cmdgen/v1-getnext.py48
-rw-r--r--examples/hlapi/v1arch/asyncore/manager/cmdgen/v2c-get.py44
-rw-r--r--examples/hlapi/v1arch/asyncore/sync/agent/ntforg/generic-v1-trap.py46
-rw-r--r--examples/hlapi/v1arch/asyncore/sync/agent/ntforg/generic-v2c-trap.py38
-rw-r--r--examples/hlapi/v1arch/asyncore/sync/agent/ntforg/v2c-inform.py45
-rw-r--r--examples/hlapi/v1arch/asyncore/sync/agent/ntforg/v2c-trap-with-notification-objects.py39
-rw-r--r--examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/coerce-set-value-to-mib-spec.py38
-rw-r--r--examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/custom-asn1-mib-search-path.py40
-rw-r--r--examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/custom-pysnmp-mibs-search-path.py49
-rw-r--r--examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/custom-timeout-and-retries.py51
-rw-r--r--examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/enable-mib-lookup.py43
-rw-r--r--examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/fetch-variables-over-ipv6.py36
-rw-r--r--examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/get-table-object-by-index.py38
-rw-r--r--examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/get-table-object-by-multiple-indices.py40
-rw-r--r--examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/getbulk-fetch-scalar-and-table-variables-over-ipv6.py45
-rw-r--r--examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/getbulk-limit-number-of-packets.py44
-rw-r--r--examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/multiple-get-calls.py48
-rw-r--r--examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/preload-pysnmp-mibs.py41
-rw-r--r--examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/pull-whole-mib.py39
-rw-r--r--examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/pull-whole-snmp-table.py47
-rw-r--r--examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/query-agents-from-multuple-threads-over-ipv4-and-ipv6.py130
-rw-r--r--examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/set-multiple-scalar-values.py46
-rw-r--r--examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/v1-get.py36
-rw-r--r--examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/v2c-get.py35
-rw-r--r--examples/hlapi/v3arch/asyncio/agent/ntforg/default-v1-trap.py (renamed from examples/hlapi/asyncio/agent/ntforg/default-v1-trap.py)4
-rw-r--r--examples/hlapi/v3arch/asyncio/agent/ntforg/multiple-notifications-at-once.py (renamed from examples/hlapi/asyncio/agent/ntforg/multiple-notifications-at-once.py)4
-rw-r--r--examples/hlapi/v3arch/asyncio/manager/cmdgen/getbulk-to-eom.py (renamed from examples/hlapi/asyncio/manager/cmdgen/getbulk-to-eom.py)2
-rw-r--r--examples/hlapi/v3arch/asyncio/manager/cmdgen/multiple-concurrent-queries-over-ipv4-and-ipv6.py (renamed from examples/hlapi/asyncio/manager/cmdgen/multiple-concurrent-queries-over-ipv4-and-ipv6.py)2
-rw-r--r--examples/hlapi/v3arch/asyncio/manager/cmdgen/multiple-sequential-queries.py (renamed from examples/hlapi/asyncio/manager/cmdgen/multiple-sequential-queries.py)2
-rw-r--r--examples/hlapi/v3arch/asyncio/manager/cmdgen/v1-get.py (renamed from examples/hlapi/asyncio/manager/cmdgen/v1-get.py)2
-rw-r--r--examples/hlapi/v3arch/asyncore/agent/ntforg/default-v1-trap.py (renamed from examples/hlapi/asyncore/agent/ntforg/default-v1-trap.py)4
-rw-r--r--examples/hlapi/v3arch/asyncore/agent/ntforg/multiple-informs-at-once.py (renamed from examples/hlapi/asyncore/agent/ntforg/multiple-informs-at-once.py)2
-rw-r--r--examples/hlapi/v3arch/asyncore/agent/ntforg/multiple-traps-at-once.py (renamed from examples/hlapi/asyncore/agent/ntforg/multiple-traps-at-once.py)2
-rw-r--r--examples/hlapi/v3arch/asyncore/agent/ntforg/running-multiple-snmp-engines-at-once.py (renamed from examples/hlapi/asyncore/agent/ntforg/running-multiple-snmp-engines-at-once.py)2
-rw-r--r--examples/hlapi/v3arch/asyncore/manager/cmdgen/multiple-concurrent-queries-over-ipv4-and-ipv6.py (renamed from examples/hlapi/asyncore/manager/cmdgen/multiple-concurrent-queries-over-ipv4-and-ipv6.py)2
-rw-r--r--examples/hlapi/v3arch/asyncore/manager/cmdgen/pull-mibs-from-multiple-agents-at-once-over-ipv4-and-ipv6.py (renamed from examples/hlapi/asyncore/manager/cmdgen/pull-mibs-from-multiple-agents-at-once-over-ipv4-and-ipv6.py)6
-rw-r--r--examples/hlapi/v3arch/asyncore/manager/cmdgen/pull-whole-mib.py (renamed from examples/hlapi/asyncore/manager/cmdgen/pull-whole-mib.py)2
-rw-r--r--examples/hlapi/v3arch/asyncore/manager/cmdgen/query-multiple-snmp-engines-over-ipv4-and-ipv6.py (renamed from examples/hlapi/asyncore/manager/cmdgen/query-multiple-snmp-engines-over-ipv4-and-ipv6.py)4
-rw-r--r--examples/hlapi/v3arch/asyncore/manager/cmdgen/v2c-get.py (renamed from examples/hlapi/asyncore/manager/cmdgen/v2c-get.py)2
-rw-r--r--examples/hlapi/v3arch/asyncore/sync/agent/ntforg/custom-contextengineid.py (renamed from examples/hlapi/asyncore/sync/agent/ntforg/custom-contextengineid.py)5
-rw-r--r--examples/hlapi/v3arch/asyncore/sync/agent/ntforg/custom-contextname.py (renamed from examples/hlapi/asyncore/sync/agent/ntforg/custom-contextname.py)2
-rw-r--r--examples/hlapi/v3arch/asyncore/sync/agent/ntforg/custom-v1-trap.py (renamed from examples/hlapi/asyncore/sync/agent/ntforg/custom-v1-trap.py)2
-rw-r--r--examples/hlapi/v3arch/asyncore/sync/agent/ntforg/default-v1-trap.py (renamed from examples/hlapi/asyncore/sync/agent/ntforg/default-v1-trap.py)2
-rw-r--r--examples/hlapi/v3arch/asyncore/sync/agent/ntforg/send-notification-with-additional-varbinds.py (renamed from examples/hlapi/asyncore/sync/agent/ntforg/send-notification-with-additional-varbinds.py)0
-rw-r--r--examples/hlapi/v3arch/asyncore/sync/agent/ntforg/v2c-trap-with-notification-objects.py (renamed from examples/hlapi/asyncore/sync/agent/ntforg/v2c-trap-with-notification-objects.py)0
-rw-r--r--examples/hlapi/v3arch/asyncore/sync/agent/ntforg/v3-inform.py (renamed from examples/hlapi/asyncore/sync/agent/ntforg/v3-inform.py)2
-rw-r--r--examples/hlapi/v3arch/asyncore/sync/agent/ntforg/v3-trap.py (renamed from examples/hlapi/asyncore/sync/agent/ntforg/v3-trap.py)0
-rw-r--r--examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/coerce-set-value-to-mib-spec.py (renamed from examples/hlapi/asyncore/sync/manager/cmdgen/coerce-set-value-to-mib-spec.py)0
-rw-r--r--examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/custom-asn1-mib-search-path.py (renamed from examples/hlapi/asyncore/sync/manager/cmdgen/custom-asn1-mib-search-path.py)0
-rw-r--r--examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/custom-contextengineid-and-contextname.py (renamed from examples/hlapi/asyncore/sync/manager/cmdgen/custom-contextengineid-and-contextname.py)0
-rw-r--r--examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/custom-contextengineid.py (renamed from examples/hlapi/asyncore/sync/manager/cmdgen/custom-contextengineid.py)0
-rw-r--r--examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/custom-pysnmp-mibs-search-path.py (renamed from examples/hlapi/asyncore/sync/manager/cmdgen/custom-pysnmp-mibs-search-path.py)0
-rw-r--r--examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/custom-timeout-and-retries.py (renamed from examples/hlapi/asyncore/sync/manager/cmdgen/custom-timeout-and-retries.py)0
-rw-r--r--examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/custom-v3-security-name.py (renamed from examples/hlapi/asyncore/sync/manager/cmdgen/custom-v3-security-name.py)0
-rw-r--r--examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/fetch-variables-over-ipv6.py (renamed from examples/hlapi/asyncore/sync/manager/cmdgen/fetch-variables-over-ipv6.py)0
-rw-r--r--examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/get-table-object-by-index.py (renamed from examples/hlapi/asyncore/sync/manager/cmdgen/get-table-object-by-index.py)0
-rw-r--r--examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/get-table-object-by-multiple-indices.py (renamed from examples/hlapi/asyncore/sync/manager/cmdgen/get-table-object-by-multiple-indices.py)0
-rw-r--r--examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/getbulk-fetch-scalar-and-table-variables-over-ipv6.py (renamed from examples/hlapi/asyncore/sync/manager/cmdgen/getbulk-fetch-scalar-and-table-variables-over-ipv6.py)0
-rw-r--r--examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/getbulk-limit-number-of-packets.py (renamed from examples/hlapi/asyncore/sync/manager/cmdgen/getbulk-limit-number-of-packets.py)0
-rw-r--r--examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/getbulk-limit-number-of-variables.py (renamed from examples/hlapi/asyncore/sync/manager/cmdgen/getbulk-limit-number-of-variables.py)0
-rw-r--r--examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/getnext-limit-number-of-variables.py (renamed from examples/hlapi/asyncore/sync/manager/cmdgen/getnext-limit-number-of-variables.py)0
-rw-r--r--examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/getnext-multiple-oids-to-eom.py (renamed from examples/hlapi/asyncore/sync/manager/cmdgen/getnext-multiple-oids-to-eom.py)0
-rw-r--r--examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/multiple-get-calls.py (renamed from examples/hlapi/asyncore/sync/manager/cmdgen/multiple-get-calls.py)13
-rw-r--r--examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/preload-pysnmp-mibs.py (renamed from examples/hlapi/asyncore/sync/manager/cmdgen/preload-pysnmp-mibs.py)0
-rw-r--r--examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/pull-whole-mib.py (renamed from examples/hlapi/asyncore/sync/manager/cmdgen/pull-whole-mib.py)0
-rw-r--r--examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/pull-whole-snmp-table.py (renamed from examples/hlapi/asyncore/sync/manager/cmdgen/pull-whole-snmp-table.py)0
-rw-r--r--examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/query-agents-from-multuple-threads-over-ipv4-and-ipv6.py (renamed from examples/hlapi/asyncore/sync/manager/cmdgen/query-agents-from-multuple-threads-over-ipv4-and-ipv6.py)0
-rw-r--r--examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/set-multiple-scalar-values.py (renamed from examples/hlapi/asyncore/sync/manager/cmdgen/set-multiple-scalar-values.py)2
-rw-r--r--examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/specific-v3-engine-id.py (renamed from examples/hlapi/asyncore/sync/manager/cmdgen/specific-v3-engine-id.py)0
-rw-r--r--examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/usm-md5-des.py (renamed from examples/hlapi/asyncore/sync/manager/cmdgen/usm-md5-des.py)0
-rw-r--r--examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/usm-md5-none.py (renamed from examples/hlapi/asyncore/sync/manager/cmdgen/usm-md5-none.py)0
-rw-r--r--examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/usm-none-none.py (renamed from examples/hlapi/asyncore/sync/manager/cmdgen/usm-none-none.py)0
-rw-r--r--examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/usm-sha-aes128.py (renamed from examples/hlapi/asyncore/sync/manager/cmdgen/usm-sha-aes128.py)0
-rw-r--r--examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/v1-get.py (renamed from examples/hlapi/asyncore/sync/manager/cmdgen/v1-get.py)0
-rw-r--r--examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/v2c-get.py (renamed from examples/hlapi/asyncore/sync/manager/cmdgen/v2c-get.py)0
-rw-r--r--examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/v2c-getbulk.py (renamed from examples/hlapi/asyncore/sync/manager/cmdgen/v2c-getbulk.py)0
-rw-r--r--examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/waive-mib-lookup.py (renamed from examples/hlapi/asyncore/sync/manager/cmdgen/waive-mib-lookup.py)7
-rw-r--r--examples/hlapi/v3arch/trollius/agent/ntforg/default-v1-trap.py (renamed from examples/hlapi/trollius/agent/ntforg/default-v1-trap.py)4
-rw-r--r--examples/hlapi/v3arch/trollius/manager/cmdgen/getbulk-to-eom.py (renamed from examples/hlapi/trollius/manager/cmdgen/getbulk-to-eom.py)2
-rw-r--r--examples/hlapi/v3arch/trollius/manager/cmdgen/v1-get.py (renamed from examples/hlapi/trollius/manager/cmdgen/v1-get.py)2
-rw-r--r--examples/hlapi/v3arch/twisted/agent/ntforg/default-v1-trap.py (renamed from examples/hlapi/twisted/agent/ntforg/default-v1-trap.py)4
-rw-r--r--examples/hlapi/v3arch/twisted/agent/ntforg/multiple-notifications-at-once.py (renamed from examples/hlapi/twisted/agent/ntforg/multiple-notifications-at-once.py)4
-rw-r--r--examples/hlapi/v3arch/twisted/agent/ntforg/v2c-trap-inline-callbacks.py (renamed from examples/hlapi/twisted/agent/ntforg/v2c-trap-inline-callbacks.py)4
-rw-r--r--examples/hlapi/v3arch/twisted/manager/cmdgen/custom-timeout-and-retries.py (renamed from examples/hlapi/twisted/manager/cmdgen/custom-timeout-and-retries.py)2
-rw-r--r--examples/hlapi/v3arch/twisted/manager/cmdgen/getbulk-to-eom.py (renamed from examples/hlapi/twisted/manager/cmdgen/getbulk-to-eom.py)2
-rw-r--r--examples/hlapi/v3arch/twisted/manager/cmdgen/multiple-concurrent-queries.py (renamed from examples/hlapi/twisted/manager/cmdgen/multiple-concurrent-queries.py)2
-rw-r--r--examples/hlapi/v3arch/twisted/manager/cmdgen/pull-mibs-from-multiple-agents-at-once.py (renamed from examples/hlapi/twisted/manager/cmdgen/pull-mibs-from-multiple-agents-at-once.py)2
-rw-r--r--examples/hlapi/v3arch/twisted/manager/cmdgen/pull-whole-mib.py (renamed from examples/hlapi/twisted/manager/cmdgen/pull-whole-mib.py)2
-rw-r--r--examples/hlapi/v3arch/twisted/manager/cmdgen/v1-get.py (renamed from examples/hlapi/twisted/manager/cmdgen/v1-get.py)2
-rw-r--r--examples/v1arch/asyncore/agent/ntforg/send-inform-over-ipv4-and-ipv6.py1
97 files changed, 1542 insertions, 44 deletions
diff --git a/examples/hlapi/v1arch/asyncore/agent/ntforg/generic-v1-trap.py b/examples/hlapi/v1arch/asyncore/agent/ntforg/generic-v1-trap.py
new file mode 100644
index 00000000..ca969f10
--- /dev/null
+++ b/examples/hlapi/v1arch/asyncore/agent/ntforg/generic-v1-trap.py
@@ -0,0 +1,52 @@
+"""
+Generic SNMPv1 TRAP
++++++++++++++++++++
+
+Send SNMPv1 TRAP using the following options:
+
+* SNMPv1
+* with community name 'public'
+* over IPv4/UDP
+* send TRAP notification
+* with Uptime 12345
+* with Generic Trap #1 (warmStart) and Specific Trap 0
+* with Agent Address 127.0.0.1
+* with Enterprise OID 1.3.6.1.4.1.20408.4.1.1.2
+* include managed object information '1.3.6.1.2.1.1.1.0' = 'my system'
+
+Functionally similar to:
+
+| $ snmptrap -v1 -c public demo.snmplabs.com 1.3.6.1.4.1.20408.4.1.1.2 0.0.0.0 1 0 0 1.3.6.1.2.1.1.1.0 s "my system"
+
+"""#
+from pysnmp.hlapi.v1arch.asyncore import *
+
+
+def cbFun(errorIndication, errorStatus, errorIndex, varBinds, **context):
+ if errorIndication:
+ print(errorIndication)
+
+
+snmpDispatcher = SnmpDispatcher()
+
+sendNotification(
+ snmpDispatcher,
+ CommunityData('public', mpModel=0),
+ UdpTransportTarget(('demo.snmplabs.com', 162)),
+ 'trap',
+ # SNMPv2-MIB::sysUpTime.0 = 12345
+ ('1.3.6.1.2.1.1.3.0', TimeTicks(12345)),
+ # SNMPv2-SMI::snmpTrapOID.0 = SNMPv2-MIB::warmStart
+ ('1.3.6.1.6.3.1.1.4.1.0', ObjectIdentifier('1.3.6.1.6.3.1.1.5.2')),
+ # SNMP-COMMUNITY-MIB::snmpTrapAddress.0 = 127.0.0.1
+ ('1.3.6.1.6.3.18.1.3.0', IpAddress('127.0.0.1')),
+ # SNMP-COMMUNITY-MIB::snmpTrapCommunity.0 = public
+ ('1.3.6.1.6.3.18.1.4.0', OctetString('public')),
+ # SNMP-COMMUNITY-MIB::snmpTrapEnterprise.0 = 1.3.6.1.4.1.20408.4.1.1.2
+ ('1.3.6.1.6.3.1.1.4.3.0', ObjectIdentifier('1.3.6.1.4.1.20408.4.1.1.2')),
+ # SNMPv2-MIB::sysName.0
+ ('1.3.6.1.2.1.1.1.0', OctetString('my system')),
+ cbFun=cbFun
+)
+
+snmpDispatcher.transportDispatcher.runDispatcher()
diff --git a/examples/hlapi/v1arch/asyncore/agent/ntforg/generic-v2c-trap.py b/examples/hlapi/v1arch/asyncore/agent/ntforg/generic-v2c-trap.py
new file mode 100644
index 00000000..36c01e60
--- /dev/null
+++ b/examples/hlapi/v1arch/asyncore/agent/ntforg/generic-v2c-trap.py
@@ -0,0 +1,44 @@
+"""
+Generic SNMPv2c TRAP
+++++++++++++++++++++
+
+Send SNMPv1 TRAP using the following options:
+
+* SNMPv2c
+* with community name 'public'
+* over IPv4/UDP
+* send TRAP notification
+* with Uptime 12345
+* with Generic Trap #1 (warmStart) and Specific Trap 0
+* include managed object information '1.3.6.1.2.1.1.1.0' = 'my system'
+
+Functionally similar to:
+
+| $ snmptrap -v2c -c public demo.snmplabs.com 12345 1.3.6.1.6.3.1.1.5.2 1.3.6.1.2.1.1.1.0 s "my system"
+
+"""#
+from pysnmp.hlapi.v1arch.asyncore import *
+
+
+def cbFun(errorIndication, errorStatus, errorIndex, varBinds, **context):
+ if errorIndication:
+ print(errorIndication)
+
+
+snmpDispatcher = SnmpDispatcher()
+
+sendNotification(
+ snmpDispatcher,
+ CommunityData('public'),
+ UdpTransportTarget(('demo.snmplabs.com', 162)),
+ 'trap',
+ # SNMPv2-MIB::sysUpTime.0 = 12345
+ ('1.3.6.1.2.1.1.3.0', TimeTicks(12345)),
+ # SNMPv2-SMI::snmpTrapOID.0 = SNMPv2-MIB::warmStart
+ ('1.3.6.1.6.3.1.1.4.1.0', ObjectIdentifier('1.3.6.1.6.3.1.1.5.2')),
+ # SNMPv2-MIB::sysName.0
+ ('1.3.6.1.2.1.1.1.0', OctetString('my system')),
+ cbFun=cbFun
+)
+
+snmpDispatcher.transportDispatcher.runDispatcher()
diff --git a/examples/hlapi/v1arch/asyncore/agent/ntforg/v2c-inform.py b/examples/hlapi/v1arch/asyncore/agent/ntforg/v2c-inform.py
new file mode 100644
index 00000000..8271a9f5
--- /dev/null
+++ b/examples/hlapi/v1arch/asyncore/agent/ntforg/v2c-inform.py
@@ -0,0 +1,51 @@
+"""
+SNMPv2c INFORM
+++++++++++++++
+
+Send SNMP INFORM notification using the following options:
+
+* SNMPv2c
+* with community name 'public'
+* over IPv4/UDP
+* send INFORM notification
+* with TRAP ID 'warmStart' specified as a string OID
+* include managed object information 1.3.6.1.2.1.1.5.0 = 'system name'
+
+Functionally similar to:
+
+| $ snmpinform -v2c -c public demo.snmplabs.com 12345 1.3.6.1.4.1.20408.4.1.1.2 1.3.6.1.2.1.1.1.0 s "my system"
+
+"""#
+from pysnmp.hlapi.v1arch.asyncore import *
+
+
+def cbFun(errorIndication, errorStatus, errorIndex, varBinds, **context):
+ if errorIndication:
+ print(errorIndication)
+
+ elif errorStatus:
+ print('%s at %s' % (errorStatus.prettyPrint(),
+ errorIndex and varBinds[int(errorIndex) - 1][0] or '?'))
+
+ else:
+ for varBind in varBinds:
+ print(' = '.join([x.prettyPrint() for x in varBind]))
+
+
+snmpDispatcher = SnmpDispatcher()
+
+sendNotification(
+ snmpDispatcher,
+ CommunityData('public'),
+ UdpTransportTarget(('demo.snmplabs.com', 162)),
+ 'inform',
+ # SNMPv2-MIB::sysUpTime.0 = 12345
+ ('1.3.6.1.2.1.1.3.0', TimeTicks(12345)),
+ # SNMPv2-SMI::snmpTrapOID.0 = SNMPv2-MIB::warmStart
+ ('1.3.6.1.6.3.1.1.4.1.0', ObjectIdentifier('1.3.6.1.6.3.1.1.5.2')),
+ # SNMPv2-MIB::sysName.0
+ ('1.3.6.1.2.1.1.1.0', OctetString('my system')),
+ cbFun=cbFun
+)
+
+snmpDispatcher.transportDispatcher.runDispatcher()
diff --git a/examples/hlapi/v1arch/asyncore/agent/ntforg/v2c-trap-with-notification-objects.py b/examples/hlapi/v1arch/asyncore/agent/ntforg/v2c-trap-with-notification-objects.py
new file mode 100644
index 00000000..a3bc18ae
--- /dev/null
+++ b/examples/hlapi/v1arch/asyncore/agent/ntforg/v2c-trap-with-notification-objects.py
@@ -0,0 +1,53 @@
+"""
+Generic SNMPv2c TRAP
+++++++++++++++++++++
+
+Send SNMPv1 TRAP using the following options:
+
+* SNMPv2c
+* with community name 'public'
+* over IPv4/UDP
+* send TRAP notification
+* with Uptime 12345
+* with Generic Trap #1 (warmStart) and Specific Trap 0
+* include managed object information '1.3.6.1.2.1.1.1.0' = 'my system'
+
+Functionally similar to:
+
+| $ snmptrap -v2c -c public demo.snmplabs.com 12345 1.3.6.1.6.3.1.1.5.2 1.3.6.1.2.1.1.1.0 s "my system"
+
+"""#
+from pysnmp.hlapi.v1arch.asyncore import *
+
+
+def cbFun(errorIndication, errorStatus, errorIndex, varBinds, **context):
+ if errorIndication:
+ print(errorIndication)
+
+ elif errorStatus:
+ print('%s at %s' % (errorStatus.prettyPrint(),
+ errorIndex and varBinds[int(errorIndex) - 1][0] or '?'))
+
+ else:
+ for varBind in varBinds:
+ print(' = '.join([x.prettyPrint() for x in varBind]))
+
+
+snmpDispatcher = SnmpDispatcher()
+
+sendNotification(
+ snmpDispatcher,
+ CommunityData('public'),
+ UdpTransportTarget(('demo.snmplabs.com', 162)),
+ 'trap',
+ # SNMPv2-MIB::sysUpTime.0 = 12345
+ ('1.3.6.1.2.1.1.3.0', TimeTicks(12345)),
+ # SNMPv2-SMI::snmpTrapOID.0 = SNMPv2-MIB::warmStart
+ NotificationType(ObjectIdentity('SNMPv2-MIB', 'warmStart')),
+ # SNMPv2-MIB::sysName.0
+ ('1.3.6.1.2.1.1.1.0', OctetString('my system')),
+ cbFun=cbFun,
+ lookupMib=True
+)
+
+snmpDispatcher.transportDispatcher.runDispatcher()
diff --git a/examples/hlapi/v1arch/asyncore/manager/cmdgen/multiple-concurrent-queries-over-ipv4-and-ipv6.py b/examples/hlapi/v1arch/asyncore/manager/cmdgen/multiple-concurrent-queries-over-ipv4-and-ipv6.py
new file mode 100644
index 00000000..7c282a81
--- /dev/null
+++ b/examples/hlapi/v1arch/asyncore/manager/cmdgen/multiple-concurrent-queries-over-ipv4-and-ipv6.py
@@ -0,0 +1,63 @@
+"""
+Multiple concurrent queries
++++++++++++++++++++++++++++
+
+Send a bunch of different SNMP GET requests to different peers all at once,
+wait for responses asynchronously:
+
+* with SNMPv1, community 'public' and
+ with SNMPv2c, community 'public' and
+* over IPv4/UDP and
+ over IPv6/UDP
+* to an Agent at demo.snmplabs.com:161 and
+ to an Agent at [::1]:161
+* for instances of SNMPv2-MIB::system
+ SNMPv2-MIB::sysLocation.0 MIB objects
+* Enable MIB lookup feature
+"""#
+from pysnmp.hlapi.v1arch.asyncore import *
+
+# List of targets in the following format:
+# ((authData, transportTarget, varNames), ...)
+targets = (
+ # 1-st target (SNMPv1 over IPv4/UDP)
+ (CommunityData('public', mpModel=0),
+ UdpTransportTarget(('demo.snmplabs.com', 161)),
+ (ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysDescr', 0)),
+ ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysLocation', 0)))),
+ # 2-nd target (SNMPv2c over IPv4/UDP)
+ (CommunityData('public'),
+ UdpTransportTarget(('demo.snmplabs.com', 161)),
+ (ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysDescr', 0)),
+ ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysLocation', 0)))),
+ # 3-nd target (SNMPv2c over IPv4/UDP) - same community and
+ # different transport address.
+ (CommunityData('public'),
+ Udp6TransportTarget(('::1', 161)),
+ (ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysContact', 0)),
+ ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysName', 0)))),
+ # N-th target
+ # ...
+)
+
+
+def cbFun(errorIndication, errorStatus, errorIndex, varBinds, **context):
+ if errorIndication:
+ print(errorIndication)
+
+ elif errorStatus:
+ print('%s at %s' % (errorStatus.prettyPrint(),
+ errorIndex and varBinds[int(errorIndex) - 1][0] or '?'))
+
+ else:
+ for varBind in varBinds:
+ print(' = '.join([x.prettyPrint() for x in varBind]))
+
+snmpDispatcher = SnmpDispatcher()
+
+# Submit a bunch of initial GET requests
+for authData, transportTarget, varBinds in targets:
+ getCmd(snmpDispatcher, authData, transportTarget, *varBinds,
+ **dict(cbFun=cbFun, lookupMib=True))
+
+snmpDispatcher.transportDispatcher.runDispatcher()
diff --git a/examples/hlapi/v1arch/asyncore/manager/cmdgen/pull-mibs-from-multiple-agents-at-once-over-ipv4-and-ipv6.py b/examples/hlapi/v1arch/asyncore/manager/cmdgen/pull-mibs-from-multiple-agents-at-once-over-ipv4-and-ipv6.py
new file mode 100644
index 00000000..eaf1755d
--- /dev/null
+++ b/examples/hlapi/v1arch/asyncore/manager/cmdgen/pull-mibs-from-multiple-agents-at-once-over-ipv4-and-ipv6.py
@@ -0,0 +1,63 @@
+"""
+Walk multiple Agents at once
+++++++++++++++++++++++++++++
+
+Iterate over MIBs of multiple SNMP Agents asynchronously using the
+following options:
+
+* with SNMPv1, community 'public' and
+ with SNMPv2c, community 'public' and
+* over IPv4/UDP and
+ over IPv6/UDP
+* to an Agent at demo.snmplabs.com:161 and
+ to an Agent at [::1]:161
+* pull MIB variables till EOM
+* Enable MIB lookup feature
+
+"""#
+from pysnmp.hlapi.v1arch.asyncore import *
+
+# List of targets in the following format:
+# ((authData, transportTarget, varNames), ...)
+targets = (
+ # 1-st target (SNMPv1 over IPv4/UDP)
+ (CommunityData('public', mpModel=0),
+ UdpTransportTarget(('demo.snmplabs.com', 161)),
+ (ObjectType(ObjectIdentity('1.3.6.1.2.1')),
+ ObjectType(ObjectIdentity('1.3.6.1.3.1')))),
+ # 2-nd target (SNMPv2c over IPv4/UDP)
+ (CommunityData('public'),
+ UdpTransportTarget(('demo.snmplabs.com', 161)),
+ (ObjectType(ObjectIdentity('1.3.6.1.4.1')),)),
+ # 3-th target (SNMPv3 over IPv6/UDP)
+ (CommunityData('public'),
+ Udp6TransportTarget(('::1', 161)),
+ (ObjectType(ObjectIdentity('IF-MIB', 'ifTable')),))
+ # N-th target
+ # ...
+)
+
+
+def cbFun(errorIndication, errorStatus, errorIndex, varBindTable, **context):
+ if errorIndication:
+ print(errorIndication)
+
+ elif errorStatus:
+ print('%s at %s' % (errorStatus.prettyPrint(),
+ errorIndex and varBinds[int(errorIndex) - 1][0] or '?'))
+
+ else:
+ for varBindRow in varBindTable:
+ for varBind in varBindRow:
+ print(' = '.join([x.prettyPrint() for x in varBind]))
+
+ return context.get('nextVarBinds')
+
+snmpDispatcher = SnmpDispatcher()
+
+# Submit a bunch of initial GETNEXT requests
+for authData, transportTarget, varBinds in targets:
+ nextCmd(snmpDispatcher, authData, transportTarget, *varBinds,
+ **dict(cbFun=cbFun, lookupMib=True))
+
+snmpDispatcher.transportDispatcher.runDispatcher()
diff --git a/examples/hlapi/v1arch/asyncore/manager/cmdgen/pull-whole-mib.py b/examples/hlapi/v1arch/asyncore/manager/cmdgen/pull-whole-mib.py
new file mode 100644
index 00000000..c5731570
--- /dev/null
+++ b/examples/hlapi/v1arch/asyncore/manager/cmdgen/pull-whole-mib.py
@@ -0,0 +1,44 @@
+"""
+Walk whole MIB
+++++++++++++++
+
+Send a series of SNMP GETBULK requests using the following options:
+
+* with SNMPv2c, community 'public'
+* over IPv4/UDP
+* to an Agent at demo.snmplabs.com:161
+* for all OIDs past 1.3.6.1.4.1
+
+Functionally similar to:
+
+| $ snmpwalk -v2c -c public demo.snmplabs.com 1.3.6.1.4.1
+"""#
+from pysnmp.hlapi.v1arch.asyncore import *
+
+
+def cbFun(errorIndication, errorStatus, errorIndex, varBindTable, **context):
+ if errorIndication:
+ print(errorIndication)
+
+ elif errorStatus:
+ print('%s at %s' % (errorStatus.prettyPrint(),
+ errorIndex and varBinds[int(errorIndex) - 1][0] or '?'))
+
+ else:
+ for varBindRow in varBindTable:
+ for varBind in varBindRow:
+ print(' = '.join([x.prettyPrint() for x in varBind]))
+
+ return context.get('nextVarBinds')
+
+snmpDispatcher = SnmpDispatcher()
+
+# Submit initial GETBULK request
+bulkCmd(snmpDispatcher,
+ CommunityData('public'),
+ UdpTransportTarget(('demo.snmplabs.com', 161)),
+ 0, 25,
+ ('1.3.6.1.4.1', None),
+ **dict(cbFun=cbFun))
+
+snmpDispatcher.transportDispatcher.runDispatcher()
diff --git a/examples/hlapi/v1arch/asyncore/manager/cmdgen/v1-getnext.py b/examples/hlapi/v1arch/asyncore/manager/cmdgen/v1-getnext.py
new file mode 100644
index 00000000..385e869c
--- /dev/null
+++ b/examples/hlapi/v1arch/asyncore/manager/cmdgen/v1-getnext.py
@@ -0,0 +1,48 @@
+"""
+SNMP GETNEXT over SNMPv1
+++++++++++++++++++++++++
+
+Send a series of SNMP GETNEXT requests using the following options:
+
+ * with SNMPv1, community 'public'
+ * over IPv4/UDP
+ * to an Agent at demo.snmplabs.com:161
+ * for the 1.3.6.1.2.1.1 OID (e.g. SNMPv2-MIB::system MIB branch)
+
+Functionally similar to:
+
+| $ snmpwalk -v1 -c public demo.snmplabs.com 1.3.6.1.2.1.1
+
+"""#
+
+from pysnmp.hlapi.v1arch.asyncore import *
+
+
+def cbFun(errorIndication, errorStatus, errorIndex, varBindTable, **context):
+ if errorIndication:
+ print(errorIndication)
+ return
+
+ elif errorStatus:
+ print('%s at %s' % (errorStatus.prettyPrint(),
+ errorIndex and varBindTable[-1][int(errorIndex) - 1][0] or '?'))
+ return
+
+ else:
+ for varBindRow in varBindTable:
+ for varBind in varBindRow:
+ print(' = '.join([x.prettyPrint() for x in varBind]))
+
+ return context.get('nextVarBinds')
+
+snmpDispatcher = SnmpDispatcher()
+
+stateHandle = nextCmd(
+ snmpDispatcher,
+ CommunityData('public', mpModel=0),
+ UdpTransportTarget(('demo.snmplabs.com', 161)),
+ ('1.3.6.1.5.1.1', None),
+ cbFun=cbFun
+)
+
+snmpDispatcher.transportDispatcher.runDispatcher()
diff --git a/examples/hlapi/v1arch/asyncore/manager/cmdgen/v2c-get.py b/examples/hlapi/v1arch/asyncore/manager/cmdgen/v2c-get.py
new file mode 100644
index 00000000..9ce8d7dd
--- /dev/null
+++ b/examples/hlapi/v1arch/asyncore/manager/cmdgen/v2c-get.py
@@ -0,0 +1,44 @@
+"""
+SNMP GET over SNMPv2c
++++++++++++++++++++++
+
+Send SNMP GET request using the following options:
+
+ * with SNMPv2c, community 'public'
+ * over IPv4/UDP
+ * to an Agent at demo.snmplabs.com:161
+ * for the 1.3.6.1.2.1.1.1.0 OID (e.g. SNMPv2-MIB::sysDescr.0 MIB object)
+
+Functionally similar to:
+
+| $ snmpget -v2c -c public demo.snmplabs.com 1.3.6.1.2.1.1.1.0
+
+"""#
+
+from pysnmp.hlapi.v1arch.asyncore import *
+
+
+def cbFun(errorIndication, errorStatus, errorIndex, varBinds, **context):
+ if errorIndication:
+ print(errorIndication)
+ return
+ elif errorStatus:
+ print('%s at %s' % (errorStatus.prettyPrint(),
+ errorIndex and varBindTable[-1][int(errorIndex) - 1][0] or '?'))
+ return
+ else:
+ for varBind in varBinds:
+ print(' = '.join([x.prettyPrint() for x in varBind]))
+
+
+snmpDispatcher = SnmpDispatcher()
+
+stateHandle = getCmd(
+ snmpDispatcher,
+ CommunityData('public'),
+ UdpTransportTarget(('demo.snmplabs.com', 161)),
+ ('1.3.6.1.2.1.1.1.0', None),
+ cbFun=cbFun
+)
+
+snmpDispatcher.transportDispatcher.runDispatcher()
diff --git a/examples/hlapi/v1arch/asyncore/sync/agent/ntforg/generic-v1-trap.py b/examples/hlapi/v1arch/asyncore/sync/agent/ntforg/generic-v1-trap.py
new file mode 100644
index 00000000..2f1fa0fd
--- /dev/null
+++ b/examples/hlapi/v1arch/asyncore/sync/agent/ntforg/generic-v1-trap.py
@@ -0,0 +1,46 @@
+"""
+Generic SNMPv1 TRAP
++++++++++++++++++++
+
+Send SNMPv1 TRAP using the following options:
+
+* SNMPv1
+* with community name 'public'
+* over IPv4/UDP
+* send TRAP notification
+* with Uptime 12345
+* with Generic Trap #1 (warmStart) and Specific Trap 0
+* with Agent Address 127.0.0.1
+* with Enterprise OID 1.3.6.1.4.1.20408.4.1.1.2
+* include managed object information '1.3.6.1.2.1.1.1.0' = 'my system'
+
+Functionally similar to:
+
+| $ snmptrap -v1 -c public demo.snmplabs.com 1.3.6.1.4.1.20408.4.1.1.2 0.0.0.0 1 0 0 1.3.6.1.2.1.1.1.0 s "my system"
+
+"""#
+from pysnmp.hlapi.v1arch import *
+
+errorIndication, errorStatus, errorIndex, varBinds = next(
+ sendNotification(
+ SnmpDispatcher(),
+ CommunityData('public', mpModel=0),
+ UdpTransportTarget(('demo.snmplabs.com', 162)),
+ 'trap',
+ # SNMPv2-MIB::sysUpTime.0 = 12345
+ ('1.3.6.1.2.1.1.3.0', TimeTicks(12345)),
+ # SNMPv2-SMI::snmpTrapOID.0 = SNMPv2-MIB::warmStart
+ ('1.3.6.1.6.3.1.1.4.1.0', ObjectIdentifier('1.3.6.1.6.3.1.1.5.2')),
+ # SNMP-COMMUNITY-MIB::snmpTrapAddress.0 = 127.0.0.1
+ ('1.3.6.1.6.3.18.1.3.0', IpAddress('127.0.0.1')),
+ # SNMP-COMMUNITY-MIB::snmpTrapCommunity.0 = public
+ ('1.3.6.1.6.3.18.1.4.0', OctetString('public')),
+ # SNMP-COMMUNITY-MIB::snmpTrapEnterprise.0 = 1.3.6.1.4.1.20408.4.1.1.2
+ ('1.3.6.1.6.3.1.1.4.3.0', ObjectIdentifier('1.3.6.1.4.1.20408.4.1.1.2')),
+ # SNMPv2-MIB::sysName.0
+ ('1.3.6.1.2.1.1.1.0', OctetString('my system'))
+ )
+)
+
+if errorIndication:
+ print(errorIndication)
diff --git a/examples/hlapi/v1arch/asyncore/sync/agent/ntforg/generic-v2c-trap.py b/examples/hlapi/v1arch/asyncore/sync/agent/ntforg/generic-v2c-trap.py
new file mode 100644
index 00000000..10a04ed4
--- /dev/null
+++ b/examples/hlapi/v1arch/asyncore/sync/agent/ntforg/generic-v2c-trap.py
@@ -0,0 +1,38 @@
+"""
+Generic SNMPv2c TRAP
+++++++++++++++++++++
+
+Send SNMPv1 TRAP using the following options:
+
+* SNMPv2c
+* with community name 'public'
+* over IPv4/UDP
+* send TRAP notification
+* with Uptime 12345
+* with Generic Trap #1 (warmStart) and Specific Trap 0
+* include managed object information '1.3.6.1.2.1.1.1.0' = 'my system'
+
+Functionally similar to:
+
+| $ snmptrap -v2c -c public demo.snmplabs.com 12345 1.3.6.1.6.3.1.1.5.2 1.3.6.1.2.1.1.1.0 s "my system"
+
+"""#
+from pysnmp.hlapi.v1arch import *
+
+errorIndication, errorStatus, errorIndex, varBinds = next(
+ sendNotification(
+ SnmpDispatcher(),
+ CommunityData('public'),
+ UdpTransportTarget(('demo.snmplabs.com', 162)),
+ 'trap',
+ # SNMPv2-MIB::sysUpTime.0 = 12345
+ ('1.3.6.1.2.1.1.3.0', TimeTicks(12345)),
+ # SNMPv2-SMI::snmpTrapOID.0 = SNMPv2-MIB::warmStart
+ ('1.3.6.1.6.3.1.1.4.1.0', ObjectIdentifier('1.3.6.1.6.3.1.1.5.2')),
+ # SNMPv2-MIB::sysName.0
+ ('1.3.6.1.2.1.1.1.0', OctetString('my system'))
+ )
+)
+
+if errorIndication:
+ print(errorIndication)
diff --git a/examples/hlapi/v1arch/asyncore/sync/agent/ntforg/v2c-inform.py b/examples/hlapi/v1arch/asyncore/sync/agent/ntforg/v2c-inform.py
new file mode 100644
index 00000000..c1799993
--- /dev/null
+++ b/examples/hlapi/v1arch/asyncore/sync/agent/ntforg/v2c-inform.py
@@ -0,0 +1,45 @@
+"""
+SNMPv2c INFORM
+++++++++++++++
+
+Send SNMP INFORM notification using the following options:
+
+* SNMPv2c
+* with community name 'public'
+* over IPv4/UDP
+* send INFORM notification
+* with TRAP ID 'warmStart' specified as a string OID
+* include managed object information 1.3.6.1.2.1.1.5.0 = 'system name'
+
+Functionally similar to:
+
+| $ snmpinform -v2c -c public demo.snmplabs.com 12345 1.3.6.1.4.1.20408.4.1.1.2 1.3.6.1.2.1.1.1.0 s "my system"
+
+"""#
+from pysnmp.hlapi.v1arch import *
+
+errorIndication, errorStatus, errorIndex, varBinds = next(
+ sendNotification(
+ SnmpDispatcher(),
+ CommunityData('public'),
+ UdpTransportTarget(('demo.snmplabs.com', 162)),
+ 'inform',
+ # SNMPv2-MIB::sysUpTime.0 = 12345
+ ('1.3.6.1.2.1.1.3.0', TimeTicks(12345)),
+ # SNMPv2-SMI::snmpTrapOID.0 = SNMPv2-MIB::warmStart
+ ('1.3.6.1.6.3.1.1.4.1.0', ObjectIdentifier('1.3.6.1.6.3.1.1.5.2')),
+ # SNMPv2-MIB::sysName.0
+ ('1.3.6.1.2.1.1.1.0', OctetString('my system'))
+ )
+)
+
+if errorIndication:
+ print(errorIndication)
+
+elif errorStatus:
+ print('%s at %s' % (errorStatus.prettyPrint(),
+ errorIndex and varBinds[int(errorIndex) - 1][0] or '?'))
+
+else:
+ for varBind in varBinds:
+ print(' = '.join([x.prettyPrint() for x in varBind]))
diff --git a/examples/hlapi/v1arch/asyncore/sync/agent/ntforg/v2c-trap-with-notification-objects.py b/examples/hlapi/v1arch/asyncore/sync/agent/ntforg/v2c-trap-with-notification-objects.py
new file mode 100644
index 00000000..052946bc
--- /dev/null
+++ b/examples/hlapi/v1arch/asyncore/sync/agent/ntforg/v2c-trap-with-notification-objects.py
@@ -0,0 +1,39 @@
+"""
+Generic SNMPv2c TRAP
+++++++++++++++++++++
+
+Send SNMPv1 TRAP using the following options:
+
+* SNMPv2c
+* with community name 'public'
+* over IPv4/UDP
+* send TRAP notification
+* with Uptime 12345
+* with Generic Trap #1 (warmStart) and Specific Trap 0
+* include managed object information '1.3.6.1.2.1.1.1.0' = 'my system'
+
+Functionally similar to:
+
+| $ snmptrap -v2c -c public demo.snmplabs.com 12345 1.3.6.1.6.3.1.1.5.2 1.3.6.1.2.1.1.1.0 s "my system"
+
+"""#
+from pysnmp.hlapi.v1arch import *
+
+errorIndication, errorStatus, errorIndex, varBinds = next(
+ sendNotification(
+ SnmpDispatcher(),
+ CommunityData('public'),
+ UdpTransportTarget(('demo.snmplabs.com', 162)),
+ 'trap',
+ # SNMPv2-MIB::sysUpTime.0 = 12345
+ ('1.3.6.1.2.1.1.3.0', TimeTicks(12345)),
+ # SNMPv2-SMI::snmpTrapOID.0 = SNMPv2-MIB::warmStart
+ NotificationType(ObjectIdentity('SNMPv2-MIB', 'warmStart')),
+ # SNMPv2-MIB::sysName.0
+ ('1.3.6.1.2.1.1.1.0', OctetString('my system')),
+ lookupMib=True
+ )
+)
+
+if errorIndication:
+ print(errorIndication)
diff --git a/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/coerce-set-value-to-mib-spec.py b/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/coerce-set-value-to-mib-spec.py
new file mode 100644
index 00000000..a6789f7f
--- /dev/null
+++ b/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/coerce-set-value-to-mib-spec.py
@@ -0,0 +1,38 @@
+"""
+Coerce value to SET to MIB spec
++++++++++++++++++++++++++++++++
+
+Send SNMP SET request using the following options:
+
+* with SNMPv2c, community 'public'
+* over IPv4/UDP
+* to an Agent at demo.snmplabs.com:161
+* with MIB lookup enabled
+* setting SNMPv2-MIB::sysName.0 to new value (type taken from MIB)
+
+Functionally similar to:
+
+| $ snmpset -v2c -c public demo.snmplabs.com SNMPv2-MIB::sysDescr.0 = "new system name"
+
+"""#
+from pysnmp.hlapi.v1arch import *
+
+errorIndication, errorStatus, errorIndex, varBinds = next(
+ setCmd(SnmpDispatcher(),
+ CommunityData('public'),
+ UdpTransportTarget(('demo.snmplabs.com', 161)),
+ ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysORDescr', 1),
+ 'new description'),
+ lookupMib=True)
+)
+
+if errorIndication:
+ print(errorIndication)
+
+elif errorStatus:
+ print('%s at %s' % (errorStatus.prettyPrint(),
+ errorIndex and varBinds[int(errorIndex) - 1][0] or '?'))
+
+else:
+ for varBind in varBinds:
+ print(' = '.join([x.prettyPrint() for x in varBind]))
diff --git a/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/custom-asn1-mib-search-path.py b/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/custom-asn1-mib-search-path.py
new file mode 100644
index 00000000..759171c1
--- /dev/null
+++ b/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/custom-asn1-mib-search-path.py
@@ -0,0 +1,40 @@
+"""
+Custom ASN.1 MIB path
++++++++++++++++++++++
+
+Send SNMP GET request using the following options:
+
+* with SNMPv2c, community 'public'
+* over IPv4/UDP
+* to an Agent at demo.snmplabs.com:161
+* for IF-MIB::ifInOctets.1 MIB object
+* pass non-default ASN.1 MIB source to MIB compiler
+* with MIB lookup enabled
+
+Functionally similar to:
+
+| $ snmpget -v2c -c public -M /usr/share/snmp demo.snmplabs.com IF-MIB::ifInOctets.1
+
+"""#
+from pysnmp.hlapi.v1arch import *
+
+errorIndication, errorStatus, errorIndex, varBinds = next(
+ getCmd(SnmpDispatcher(),
+ CommunityData('public'),
+ UdpTransportTarget(('demo.snmplabs.com', 161)),
+ ObjectType(ObjectIdentity('IF-MIB', 'ifInOctets', 1).addAsn1MibSource(
+ 'file:///usr/share/snmp',
+ 'http://mibs.snmplabs.com/asn1/@mib@')),
+ lookupMib=True)
+)
+
+if errorIndication:
+ print(errorIndication)
+
+elif errorStatus:
+ print('%s at %s' % (errorStatus.prettyPrint(),
+ errorIndex and varBinds[int(errorIndex) - 1][0] or '?'))
+
+else:
+ for varBind in varBinds:
+ print(' = '.join([x.prettyPrint() for x in varBind]))
diff --git a/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/custom-pysnmp-mibs-search-path.py b/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/custom-pysnmp-mibs-search-path.py
new file mode 100644
index 00000000..a3686d69
--- /dev/null
+++ b/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/custom-pysnmp-mibs-search-path.py
@@ -0,0 +1,49 @@
+"""
+Custom PySNMP MIBs location
++++++++++++++++++++++++++++
+
+Send a series of SNMP GETBULK requests using the following options:
+
+* with SNMPv2c, community 'public'
+* over IPv4/UDP
+* to an Agent at demo.snmplabs.com:161
+* for all OIDs within TCP-MIB::tcpConnTable column
+* TCP-MIB Python module will be searched by a user-specified filesystem
+ path (/opt/mib/pysnmp) and in Python package (python_packaged_mibs)
+ which should be in sys.path
+* with MIB lookup enabled
+
+Functionally similar to:
+
+| $ snmpbulkwalk -v2c -c public -Cn0 -Cr50 demo.snmplabs.com TCP-MIB::tcpConnTable
+
+"""#
+from pysnmp.hlapi.v1arch import *
+
+for (errorIndication,
+ errorStatus,
+ errorIndex,
+ varBinds) in bulkCmd(SnmpDispatcher(),
+ CommunityData('public'),
+ UdpTransportTarget(('demo.snmplabs.com', 161)),
+ 0, 50,
+ ObjectType(
+ ObjectIdentity('TCP-MIB', 'tcpConnTable').addMibSource(
+ '/opt/mibs/pysnmp').addMibSource(
+ 'python_packaged_mibs')
+ ),
+ lookupMib=True,
+ lexicographicMode=False):
+
+ if errorIndication:
+ print(errorIndication)
+ break
+
+ elif errorStatus:
+ print('%s at %s' % (errorStatus.prettyPrint(),
+ errorIndex and varBinds[int(errorIndex) - 1][0] or '?'))
+ break
+
+ else:
+ for varBind in varBinds:
+ print(' = '.join([x.prettyPrint() for x in varBind]))
diff --git a/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/custom-timeout-and-retries.py b/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/custom-timeout-and-retries.py
new file mode 100644
index 00000000..7a4253cf
--- /dev/null
+++ b/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/custom-timeout-and-retries.py
@@ -0,0 +1,51 @@
+"""
+Custom request timeout
+++++++++++++++++++++++
+
+Send SNMP GET request using the following options:
+
+* with SNMPv2c, community 'public'
+* over IPv4/UDP
+* to an Agent at demo.snmplabs.com:161
+* for an OID in string form
+* use custom timeout and request retries values
+
+Transport timing settings (maximum number of request retries and
+individual request timeout in seconds) can be set on a per-target basis
+as explained by the code that follows.
+
+Keep in mind that while timeout value can be specified in fractions of a
+second, default pysnmp timer resolution is quite low (about 0.5 sec)
+so there's no much point in using timeouts which is not a multiple of 0.5
+Internal timer can be programmatically adjusted to finer resolution if needed.
+
+If retries value is set to 0, pysnmp will issue a single request. Even
+if no response arrives, there will be no retry. Likewise, retries=1
+means one initial request plus one retry.
+
+Functionally similar to:
+
+| $ snmpget -v1 -c public -t 2 -r 0 demo.snmplabs.com 1.3.6.1.2.1.1.1.0
+
+"""#
+from pysnmp.hlapi.v1arch import *
+
+errorIndication, errorStatus, errorIndex, varBinds = next(
+ getCmd(SnmpDispatcher(),
+ CommunityData('public'),
+ UdpTransportTarget(
+ ('demo.snmplabs.com', 161), timeout=2.0, retries=0
+ ),
+ (('1.3.6.1.2.1.1.1.0', None)))
+)
+
+if errorIndication:
+ print(errorIndication)
+
+elif errorStatus:
+ print('%s at %s' % (errorStatus.prettyPrint(),
+ errorIndex and varBinds[int(errorIndex) - 1][0] or '?'))
+
+else:
+ for varBind in varBinds:
+ print(' = '.join([x.prettyPrint() for x in varBind]))
diff --git a/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/enable-mib-lookup.py b/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/enable-mib-lookup.py
new file mode 100644
index 00000000..2f4f8edb
--- /dev/null
+++ b/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/enable-mib-lookup.py
@@ -0,0 +1,43 @@
+"""
+Enable MIB lookup
++++++++++++++++++
+
+Perform SNMP GETNEXT operation with the following options:
+
+* with SNMPv2c, community 'public'
+* over IPv4/UDP
+* to an Agent at demo.snmplabs.com:161
+* for an OID in string form
+* resolve request and response OIDs and values from/to human-friendly form
+
+The `lookupMib=True` keyword argument makes pysnmp resolving
+request and response variable-bindings from/to human-friendly form.
+
+Functionally similar to:
+
+| $ snmpwalk -v2c -c public -ObentU demo.snmplabs.com 1.3.6.1.2.1
+
+"""#
+from pysnmp.hlapi.v1arch import *
+
+for (errorIndication,
+ errorStatus,
+ errorIndex,
+ varBinds) in nextCmd(SnmpDispatcher(),
+ CommunityData('public'),
+ UdpTransportTarget(('demo.snmplabs.com', 161)),
+ ObjectType(ObjectIdentity('1.3.6.1.2.1.1')),
+ lookupMib=True):
+
+ if errorIndication:
+ print(errorIndication)
+ break
+
+ elif errorStatus:
+ print('%s at %s' % (errorStatus.prettyPrint(),
+ errorIndex and varBinds[int(errorIndex) - 1][0] or '?'))
+ break
+
+ else:
+ for varBind in varBinds:
+ print(' = '.join([x.prettyPrint() for x in varBind]))
diff --git a/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/fetch-variables-over-ipv6.py b/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/fetch-variables-over-ipv6.py
new file mode 100644
index 00000000..bd8d9ca2
--- /dev/null
+++ b/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/fetch-variables-over-ipv6.py
@@ -0,0 +1,36 @@
+"""
+GET over IPv6
++++++++++++++
+
+Send SNMP GET request using the following options:
+
+* with SNMPv2c, community 'public'
+* over IPv6/UDP
+* to an Agent at [::1]:161
+* for three OIDs in string form
+
+Functionally similar to:
+
+| $ snmpget -v2c -c public udp6:[::1]:161 1.3.6.1.2.1.1.1.0 1.3.6.1.2.1.1.2.0 1.3.6.1.2.1.1.3.0
+"""#
+from pysnmp.hlapi.v1arch import *
+
+errorIndication, errorStatus, errorIndex, varBinds = next(
+ getCmd(SnmpDispatcher(),
+ CommunityData('public'),
+ Udp6TransportTarget(('::1', 161)),
+ ('1.3.6.1.2.1.1.1.0', None),
+ ('1.3.6.1.2.1.1.2.0', None),
+ ('1.3.6.1.2.1.1.3.0', None))
+)
+
+if errorIndication:
+ print(errorIndication)
+
+elif errorStatus:
+ print('%s at %s' % (errorStatus.prettyPrint(),
+ errorIndex and varBinds[int(errorIndex) - 1][0] or '?'))
+
+else:
+ for varBind in varBinds:
+ print(' = '.join([x.prettyPrint() for x in varBind]))
diff --git a/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/get-table-object-by-index.py b/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/get-table-object-by-index.py
new file mode 100644
index 00000000..b7fccdcb
--- /dev/null
+++ b/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/get-table-object-by-index.py
@@ -0,0 +1,38 @@
+"""
+GET table row
++++++++++++++
+
+Send SNMP GET request using the following options:
+
+* with SNMPv2c, community name "public"
+* over IPv4/UDP
+* to an Agent at demo.snmplabs.com:161
+* with MIB lookup enabled
+* for IF-MIB::ifInOctets.1 and IF-MIB::ifOutOctets.1 MIB object
+
+Functionally similar to:
+
+| $ snmpget -v 2c -c public demo.snmplabs.com IF-MIB::ifInOctets.1 IF-MIB::ifOutOctets.1
+
+"""#
+from pysnmp.hlapi.v1arch import *
+
+errorIndication, errorStatus, errorIndex, varBinds = next(
+ getCmd(SnmpDispatcher(),
+ CommunityData('public'),
+ UdpTransportTarget(('demo.snmplabs.com', 161)),
+ ObjectType(ObjectIdentity('IF-MIB', 'ifInOctets', 1)),
+ ObjectType(ObjectIdentity('IF-MIB', 'ifOutOctets', 1)),
+ lookupMib=True)
+)
+
+if errorIndication:
+ print(errorIndication)
+
+elif errorStatus:
+ print('%s at %s' % (errorStatus.prettyPrint(),
+ errorIndex and varBinds[int(errorIndex) - 1][0] or '?'))
+
+else:
+ for varBind in varBinds:
+ print(' = '.join([x.prettyPrint() for x in varBind]))
diff --git a/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/get-table-object-by-multiple-indices.py b/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/get-table-object-by-multiple-indices.py
new file mode 100644
index 00000000..cec5ad25
--- /dev/null
+++ b/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/get-table-object-by-multiple-indices.py
@@ -0,0 +1,40 @@
+"""
+Fetch table row by composite index
+++++++++++++++++++++++++++++++++++
+
+Send SNMP GET request using the following options:
+
+* with SNMPv2c, community 'public'
+* over IPv4/UDP
+* to an Agent at demo.snmplabs.com:161
+* for TCP-MIB::tcpConnLocalAddress."0.0.0.0".22."0.0.0.0".0 MIB object
+* with MIB lookup enabled
+
+Functionally similar to:
+
+| $ snmpget -v2c -c public demo.snmplabs.com TCP-MIB::tcpConnLocalAddress."0.0.0.0".22."0.0.0.0".0
+
+"""#
+from pysnmp.hlapi.v1arch import *
+
+errorIndication, errorStatus, errorIndex, varBinds = next(
+ getCmd(SnmpDispatcher(),
+ CommunityData('public'),
+ UdpTransportTarget(('demo.snmplabs.com', 161)),
+ ObjectType(ObjectIdentity('TCP-MIB',
+ 'tcpConnLocalAddress',
+ '0.0.0.0', 22,
+ '0.0.0.0', 0)),
+ lookupMib=True)
+)
+
+if errorIndication:
+ print(errorIndication)
+
+elif errorStatus:
+ print('%s at %s' % (errorStatus.prettyPrint(),
+ errorIndex and varBinds[int(errorIndex) - 1][0] or '?'))
+
+else:
+ for varBind in varBinds:
+ print(' = '.join([x.prettyPrint() for x in varBind]))
diff --git a/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/getbulk-fetch-scalar-and-table-variables-over-ipv6.py b/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/getbulk-fetch-scalar-and-table-variables-over-ipv6.py
new file mode 100644
index 00000000..49257a1c
--- /dev/null
+++ b/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/getbulk-fetch-scalar-and-table-variables-over-ipv6.py
@@ -0,0 +1,45 @@
+"""
+Fetch scalar and table variables
+++++++++++++++++++++++++++++++++
+
+Send a series of SNMP GETBULK requests using the following options:
+
+* with SNMPv2c, community name "public"
+* over IPv6/UDP
+* to an Agent at demo.snmplabs.com:161
+* with MIB lookup enabled
+* with values non-repeaters = 1, max-repetitions = 25
+* for IP-MIB::ipAdEntAddr and all columns of the IF-MIB::ifEntry table
+* stop when response OIDs leave the scopes of the table
+
+Functionally similar to:
+
+| $ snmpbulkwalk -v2c -c public -Cn1, -Cr25 demo.snmplabs.com IP-MIB::ipAdEntAddr IP-MIB::ipAddrEntry
+
+"""#
+from pysnmp.hlapi.v1arch import *
+
+for (errorIndication,
+ errorStatus,
+ errorIndex,
+ varBinds) in bulkCmd(SnmpDispatcher(),
+ CommunityData('public'),
+ UdpTransportTarget(('demo.snmplabs.com', 161)),
+ 1, 25,
+ ObjectType(ObjectIdentity('IP-MIB', 'ipAdEntAddr')),
+ ObjectType(ObjectIdentity('IP-MIB', 'ipAddrEntry')),
+ lookupMib=True,
+ lexicographicMode=False):
+
+ if errorIndication:
+ print(errorIndication)
+ break
+
+ elif errorStatus:
+ print('%s at %s' % (errorStatus.prettyPrint(),
+ errorIndex and varBinds[int(errorIndex) - 1][0] or '?'))
+ break
+
+ else:
+ for varBind in varBinds:
+ print(' = '.join([x.prettyPrint() for x in varBind]))
diff --git a/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/getbulk-limit-number-of-packets.py b/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/getbulk-limit-number-of-packets.py
new file mode 100644
index 00000000..22d52589
--- /dev/null
+++ b/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/getbulk-limit-number-of-packets.py
@@ -0,0 +1,44 @@
+"""
+Walk Agent, limit number of packets
++++++++++++++++++++++++++++++++++++
+
+Send a series of SNMP GETBULK requests using the following options:
+
+* with SNMPv2c, community name "public"
+* over IPv4/UDP
+* to an Agent at demo.snmplabs.com:161
+* for all OIDs past SNMPv2-MIB::system
+* with MIB lookup enabled
+* run till end-of-mib condition is reported by Agent OR
+ maxCalls == 10 request-response interactions occur
+
+Functionally similar to:
+
+| $ snmpbulkwalk -v2c -c public -Cn0 -Cr50 demo.snmplabs.com SNMPv2-MIB::system
+
+"""#
+from pysnmp.hlapi.v1arch import *
+
+for (errorIndication,
+ errorStatus,
+ errorIndex,
+ varBinds) in bulkCmd(SnmpDispatcher(),
+ CommunityData('public'),
+ UdpTransportTarget(('demo.snmplabs.com', 161)),
+ 0, 50,
+ ObjectType(ObjectIdentity('SNMPv2-MIB', 'system')),
+ lookupMib=True,
+ maxCalls=10):
+
+ if errorIndication:
+ print(errorIndication)
+ break
+
+ elif errorStatus:
+ print('%s at %s' % (errorStatus.prettyPrint(),
+ errorIndex and varBinds[int(errorIndex) - 1][0] or '?'))
+ break
+
+ else:
+ for varBind in varBinds:
+ print(' = '.join([x.prettyPrint() for x in varBind]))
diff --git a/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/multiple-get-calls.py b/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/multiple-get-calls.py
new file mode 100644
index 00000000..57a1132b
--- /dev/null
+++ b/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/multiple-get-calls.py
@@ -0,0 +1,48 @@
+"""
+Sequence Of GET's
++++++++++++++++++
+
+Send two SNMP GET requests in a row using the following options:
+
+* with SNMPv2c, community name "public"
+* over IPv4/UDP
+* to an Agent at demo.snmplabs.com:161
+* for IF-MIB::ifInOctets.1 and IF-MIB::ifOutOctets.1 MIB objects
+* with MIB lookup enabled
+
+Use a queue of MIB objects to query.
+
+The next() call is used to forward Python iterator to the position where it
+could consume input
+
+Functionally similar to:
+
+| $ snmpget -v2c -c public demo.snmplabs.com IF-MIB::ifInOctets.1
+
+"""#
+from pysnmp.hlapi.v1arch import *
+
+queue = [
+ [ObjectType(ObjectIdentity('IF-MIB', 'ifInOctets', 1))],
+ [ObjectType(ObjectIdentity('IF-MIB', 'ifOutOctets', 1))]
+]
+
+iterator = getCmd(SnmpDispatcher(),
+ CommunityData('public'),
+ UdpTransportTarget(('demo.snmplabs.com', 161)),
+ lookupMib=True)
+
+next(iterator)
+
+while queue:
+ errorIndication, errorStatus, errorIndex, varBinds = iterator.send(queue.pop())
+ if errorIndication:
+ print(errorIndication)
+
+ elif errorStatus:
+ print('%s at %s' % (errorStatus.prettyPrint(),
+ errorIndex and varBinds[int(errorIndex) - 1][0] or '?'))
+
+ else:
+ for varBind in varBinds:
+ print(' = '.join([x.prettyPrint() for x in varBind]))
diff --git a/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/preload-pysnmp-mibs.py b/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/preload-pysnmp-mibs.py
new file mode 100644
index 00000000..39d1e7dd
--- /dev/null
+++ b/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/preload-pysnmp-mibs.py
@@ -0,0 +1,41 @@
+"""
+Preload PySNMP MIBs
++++++++++++++++++++
+
+Send a series of SNMP GETNEXT requests using the following options:
+
+* with SNMPv2c, community name "public"
+* over IPv4/UDP
+* to an Agent at demo.snmplabs.com:161
+* for all OIDs starting from 1.3.6
+* with MIB lookup enabled
+* preload all Python MIB modules found in search path
+
+Functionally similar to:
+
+| $ snmpwalk -v2c -c public -m ALL demo.snmplabs.com:161 1.3.6
+
+"""#
+from pysnmp.hlapi.v1arch import *
+
+for (errorIndication,
+ errorStatus,
+ errorIndex,
+ varBinds) in nextCmd(SnmpDispatcher(),
+ CommunityData('public'),
+ UdpTransportTarget(('demo.snmplabs.com', 161)),
+ ObjectType(ObjectIdentity('1.3.6').loadMibs()),
+ lookupMib=True):
+
+ if errorIndication:
+ print(errorIndication)
+ break
+
+ elif errorStatus:
+ print('%s at %s' % (errorStatus.prettyPrint(),
+ errorIndex and varBinds[int(errorIndex) - 1][0] or '?'))
+ break
+
+ else:
+ for varBind in varBinds:
+ print(' = '.join([x.prettyPrint() for x in varBind]))
diff --git a/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/pull-whole-mib.py b/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/pull-whole-mib.py
new file mode 100644
index 00000000..69e943d9
--- /dev/null
+++ b/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/pull-whole-mib.py
@@ -0,0 +1,39 @@
+"""
+Walk whole MIB
+++++++++++++++
+
+Send a series of SNMP GETNEXT requests using the following options:
+
+* with SNMPv2c, community 'public'
+* over IPv4/UDP
+* to an Agent at demo.snmplabs.com:161
+* for all OIDs in IF-MIB
+* with MIB lookup enabled
+
+Functionally similar to:
+
+| $ snmpwalk -v2c -c public demo.snmplabs.com IF-MIB::
+
+"""#
+from pysnmp.hlapi.v1arch import *
+
+for (errorIndication,
+ errorStatus,
+ errorIndex,
+ varBinds) in nextCmd(SnmpDispatcher(),
+ CommunityData('public'),
+ UdpTransportTarget(('demo.snmplabs.com', 161)),
+ ObjectType(ObjectIdentity('IF-MIB'))):
+
+ if errorIndication:
+ print(errorIndication)
+ break
+
+ elif errorStatus:
+ print('%s at %s' % (errorStatus.prettyPrint(),
+ errorIndex and varBinds[int(errorIndex) - 1][0] or '?'))
+ break
+
+ else:
+ for varBind in varBinds:
+ print(' = '.join([x.prettyPrint() for x in varBind]))
diff --git a/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/pull-whole-snmp-table.py b/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/pull-whole-snmp-table.py
new file mode 100644
index 00000000..8d81b1e5
--- /dev/null
+++ b/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/pull-whole-snmp-table.py
@@ -0,0 +1,47 @@
+"""
+Fetch whole SNMP table
+++++++++++++++++++++++
+
+Send a series of SNMP GETNEXT requests using the following options:
+
+* with SNMPv1, community 'public'
+* over IPv4/UDP
+* to an Agent at demo.snmplabs.com:161
+* for some columns of the IF-MIB::ifEntry table
+* with MIB lookup enabled
+* stop when response OIDs leave the scopes of initial OIDs
+
+Functionally similar to:
+
+| $ snmpwalk -v1 -c public demo.snmplabs.com IF-MIB::ifDescr IF-MIB::ifType IF-MIB::ifMtu IF-MIB::ifSpeed IF-MIB::ifPhysAddress IF-MIB::ifType
+
+"""#
+from pysnmp.hlapi.v1arch import *
+
+for (errorIndication,
+ errorStatus,
+ errorIndex,
+ varBinds) in nextCmd(SnmpDispatcher(),
+ CommunityData('public', mpModel=0),
+ UdpTransportTarget(('demo.snmplabs.com', 161)),
+ ObjectType(ObjectIdentity('IF-MIB', 'ifDescr')),
+ ObjectType(ObjectIdentity('IF-MIB', 'ifType')),
+ ObjectType(ObjectIdentity('IF-MIB', 'ifMtu')),
+ ObjectType(ObjectIdentity('IF-MIB', 'ifSpeed')),
+ ObjectType(ObjectIdentity('IF-MIB', 'ifPhysAddress')),
+ ObjectType(ObjectIdentity('IF-MIB', 'ifType')),
+ lookupMib=True,
+ lexicographicMode=False):
+
+ if errorIndication:
+ print(errorIndication)
+ break
+
+ elif errorStatus:
+ print('%s at %s' % (errorStatus.prettyPrint(),
+ errorIndex and varBinds[int(errorIndex)-1][0] or '?'))
+ break
+
+ else:
+ for varBind in varBinds:
+ print(' = '.join([x.prettyPrint() for x in varBind]))
diff --git a/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/query-agents-from-multuple-threads-over-ipv4-and-ipv6.py b/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/query-agents-from-multuple-threads-over-ipv4-and-ipv6.py
new file mode 100644
index 00000000..29ec78b6
--- /dev/null
+++ b/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/query-agents-from-multuple-threads-over-ipv4-and-ipv6.py
@@ -0,0 +1,130 @@
+"""
+Query Agents from multiple threads
+++++++++++++++++++++++++++++++++++
+
+Send a bunch of SNMP GET requests simultaneously using the following options:
+
+* process 4 GET requests in 3 parallel threads
+* with SNMPv1, community 'public' and
+ with SNMPv2c, community 'public' and
+* over IPv4/UDP and
+ over IPv6/UDP
+* to an Agent at demo.snmplabs.com:161 and
+ to an Agent at demo.snmplabs.com:1161 and
+ to an Agent at [::1]:161
+* for instances of SNMPv2-MIB::sysDescr.0 and
+ SNMPv2-MIB::sysLocation.0 MIB objects
+* with MIB lookup enabled
+
+Functionally similar to:
+
+| $ snmpget -v1 -c public demo.snmplabs.com SNMPv2-MIB::sysDescr.0 SNMPv2-MIB::sysLocation.0
+| $ snmpget -v2c -c public demo.snmplabs.com SNMPv2-MIB::sysDescr.0 SNMPv2-MIB::sysLocation.0
+| $ snmpget -v2c -c public demo.snmplabs.com:1161 SNMPv2-MIB::sysDescr.0 SNMPv2-MIB::sysLocation.0
+| $ snmpget -v2c -c public '[::1]' SNMPv2-MIB::sysDescr.0 SNMPv2-MIB::sysLocation.0
+
+"""#
+from sys import version_info
+from threading import Thread
+from pysnmp.hlapi.v1arch import *
+
+if version_info[0] == 2:
+ from Queue import Queue
+else:
+ from queue import Queue
+
+# List of targets in the following format:
+# ( ( authData, transportTarget, varNames ), ... )
+targets = (
+ # 1-st target (SNMPv1 over IPv4/UDP)
+ (CommunityData('public', mpModel=0),
+ UdpTransportTarget(('demo.snmplabs.com', 161)),
+ (ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysDescr', 0)),
+ ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysLocation', 0)))),
+ # 2-nd target (SNMPv2c over IPv4/UDP)
+ (CommunityData('public'),
+ UdpTransportTarget(('demo.snmplabs.com', 161)),
+ (ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysDescr', 0)),
+ ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysLocation', 0)))),
+ # 3-nd target (SNMPv2c over IPv4/UDP) - same community and
+ # different transport address.
+ (CommunityData('public'),
+ Udp6TransportTarget(('localhost', 161)),
+ (ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysContact', 0)),
+ ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysName', 0)))),
+ # 4-th target (SNMPv2c over IPv4/UDP) - same community and
+ # different transport port.
+ (CommunityData('public'),
+ UdpTransportTarget(('demo.snmplabs.com', 1161)),
+ (ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysDescr', 0)),
+ ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysLocation', 0)))),
+ # N-th target
+ # ...
+)
+
+
+class Worker(Thread):
+ def __init__(self, requests, responses):
+ Thread.__init__(self)
+ self.snmpDispatcher = SnmpDispatcher()
+ self.requests = requests
+ self.responses = responses
+ self.setDaemon(True)
+ self.start()
+
+ def run(self):
+ while True:
+ authData, transportTarget, varBinds = self.requests.get()
+
+ self.responses.append(
+ next(getCmd(self.snmpDispatcher,
+ authData, transportTarget, *varBinds, lookupMib=True))
+ )
+
+ if hasattr(self.requests, 'task_done'): # 2.5+
+ self.requests.task_done()
+
+
+class ThreadPool(object):
+ def __init__(self, num_threads):
+ self.requests = Queue(num_threads)
+ self.responses = []
+ for _ in range(num_threads):
+ Worker(self.requests, self.responses)
+
+ def addRequest(self, authData, transportTarget, varBinds):
+ self.requests.put((authData, transportTarget, varBinds))
+
+ def getResponses(self):
+ return self.responses
+
+ def waitCompletion(self):
+ if hasattr(self.requests, 'join'):
+ self.requests.join() # 2.5+
+ else:
+ from time import sleep
+ # this is a lame substitute for missing .join()
+ # adding an explicit synchronization might be a better solution
+ while not self.requests.empty():
+ sleep(1)
+
+
+pool = ThreadPool(3)
+
+# Submit GET requests
+for authData, transportTarget, varBinds in targets:
+ pool.addRequest(authData, transportTarget, varBinds)
+
+# Wait for responses or errors
+pool.waitCompletion()
+
+# Walk through responses
+for errorIndication, errorStatus, errorIndex, varBinds in pool.getResponses():
+ if errorIndication:
+ print(errorIndication)
+ elif errorStatus:
+ print('%s at %s' % (errorStatus.prettyPrint(),
+ errorIndex and varBinds[int(errorIndex) - 1][0] or '?'))
+ else:
+ for varBind in varBinds:
+ print(' = '.join([x.prettyPrint() for x in varBind]))
diff --git a/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/set-multiple-scalar-values.py b/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/set-multiple-scalar-values.py
new file mode 100644
index 00000000..b5498003
--- /dev/null
+++ b/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/set-multiple-scalar-values.py
@@ -0,0 +1,46 @@
+"""
+SET scalars values
+++++++++++++++++++
+
+Send SNMP SET request using the following options:
+
+* with SNMPv1, community 'public'
+* over IPv4/UDP
+* to an Agent at demo.snmplabs.com:161
+* with MIB lookup enabled
+* setting three var-bindings to new values
+
+Please note, that in this example MIB lookup is only used
+for the second var-bindins. For the rest, value types are
+inferred from passed objects.
+
+Functionally similar to:
+
+| $ snmpset -v1 -c public demo.snmplabs.com 1.3.6.1.2.1.1.9.1.2.1 o 1.3.6.1.4.1.20408.1.1 1.3.6.1.2.1.1.9.1.2.1 = 1.3.6.1.4.1.20408.1.1 1.3.6.1.2.1.1.9.1.3.1 s "new system name"
+
+"""#
+from pysnmp.hlapi.v1arch import *
+
+errorIndication, errorStatus, errorIndex, varBinds = next(
+ setCmd(SnmpDispatcher(),
+ CommunityData('public', mpModel=0),
+ UdpTransportTarget(('demo.snmplabs.com', 161)),
+ ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysORID', 1),
+ ObjectIdentifier('1.3.6.1.4.1.20408.1.1')),
+ ObjectType(ObjectIdentity('1.3.6.1.2.1.1.9.1.2.1'),
+ '1.3.6.1.4.1.20408.1.1'),
+ ObjectType(ObjectIdentity('1.3.6.1.2.1.1.9.1.3.1'),
+ OctetString('new system name')),
+ lookupMib=True)
+)
+
+if errorIndication:
+ print(errorIndication)
+
+elif errorStatus:
+ print('%s at %s' % (errorStatus.prettyPrint(),
+ errorIndex and varBinds[int(errorIndex) - 1][0] or '?'))
+
+else:
+ for varBind in varBinds:
+ print(' = '.join([x.prettyPrint() for x in varBind]))
diff --git a/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/v1-get.py b/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/v1-get.py
new file mode 100644
index 00000000..b54802af
--- /dev/null
+++ b/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/v1-get.py
@@ -0,0 +1,36 @@
+"""
+SNMPv1
+++++++
+
+Send SNMP GET request using the following options:
+
+ * with SNMPv1, community 'public'
+ * over IPv4/UDP
+ * to an Agent at demo.snmplabs.com:161
+ * for an instance of SNMPv2-MIB::sysDescr.0 MIB object
+ * having MIB lookup feature enabled
+
+Functionally similar to:
+
+| $ snmpget -v1 -c public demo.snmplabs.com SNMPv2-MIB::sysDescr.0
+
+"""#
+from pysnmp.hlapi.v1arch import *
+
+for response in getCmd(SnmpDispatcher(),
+ CommunityData('public', mpModel=0),
+ UdpTransportTarget(('demo.snmplabs.com', 161)),
+ ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysDescr', 0)),
+ lookupMib=True):
+
+ errorIndication, errorStatus, errorIndex, varBinds = response
+
+ if errorIndication:
+ print(errorIndication)
+
+ elif errorStatus:
+ print('%s at %s' % (errorStatus.prettyPrint(),
+ errorIndex and varBinds[int(errorIndex) - 1][0] or '?'))
+ else:
+ for varBind in varBinds:
+ print(' = '.join([x.prettyPrint() for x in varBind]))
diff --git a/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/v2c-get.py b/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/v2c-get.py
new file mode 100644
index 00000000..e2ec5815
--- /dev/null
+++ b/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/v2c-get.py
@@ -0,0 +1,35 @@
+"""
+SNMPv2c
++++++++
+
+Send SNMP GET request using the following options:
+
+* with SNMPv2c, community 'public'
+* over IPv4/UDP
+* to an Agent at demo.snmplabs.com:161
+* for two var-bindings with OIDs in string form
+
+Functionally similar to:
+
+| $ snmpget -v2c -c public demo.snmplabs.com 1.3.6.1.2.1.1.1.0 1.3.6.1.2.1.1.6.0
+
+"""#
+from pysnmp.hlapi.v1arch import *
+
+for response in getCmd(SnmpDispatcher(),
+ CommunityData('public'),
+ UdpTransportTarget(('demo.snmplabs.com', 161)),
+ ('1.3.6.1.2.1.1.1.0', None),
+ ('1.3.6.1.2.1.1.6.0', None)):
+
+ errorIndication, errorStatus, errorIndex, varBinds = response
+
+ if errorIndication:
+ print(errorIndication)
+
+ elif errorStatus:
+ print('%s at %s' % (errorStatus.prettyPrint(),
+ errorIndex and varBinds[int(errorIndex) - 1][0] or '?'))
+ else:
+ for varBind in varBinds:
+ print(' = '.join([x.prettyPrint() for x in varBind]))
diff --git a/examples/hlapi/asyncio/agent/ntforg/default-v1-trap.py b/examples/hlapi/v3arch/asyncio/agent/ntforg/default-v1-trap.py
index 92d3e70e..6a0fefda 100644
--- a/examples/hlapi/asyncio/agent/ntforg/default-v1-trap.py
+++ b/examples/hlapi/v3arch/asyncio/agent/ntforg/default-v1-trap.py
@@ -21,7 +21,7 @@ Functionally similar to:
"""#
import asyncio
-from pysnmp.hlapi.asyncio import *
+from pysnmp.hlapi.v3arch.asyncio import *
@asyncio.coroutine
@@ -35,6 +35,8 @@ def run():
'trap',
NotificationType(
ObjectIdentity('1.3.6.1.6.3.1.1.5.2')
+ ).loadMibs(
+ 'SNMPv2-MIB'
).addVarBinds(
('1.3.6.1.6.3.1.1.4.3.0', '1.3.6.1.4.1.20408.4.1.1.2'),
('1.3.6.1.2.1.1.1.0', OctetString('my system'))
diff --git a/examples/hlapi/asyncio/agent/ntforg/multiple-notifications-at-once.py b/examples/hlapi/v3arch/asyncio/agent/ntforg/multiple-notifications-at-once.py
index 74cedeea..f1cae2b8 100644
--- a/examples/hlapi/asyncio/agent/ntforg/multiple-notifications-at-once.py
+++ b/examples/hlapi/v3arch/asyncio/agent/ntforg/multiple-notifications-at-once.py
@@ -24,7 +24,7 @@ Functionally similar to:
"""#
import asyncio
-from pysnmp.hlapi.asyncio import *
+from pysnmp.hlapi.v3arch.asyncio import *
@asyncio.coroutine
@@ -40,6 +40,8 @@ def sendone(snmpEngine, hostname, notifyType):
notifyType,
NotificationType(
ObjectIdentity('1.3.6.1.6.3.1.1.5.2')
+ ).loadMibs(
+ 'SNMPv2-MIB'
).addVarBinds(
('1.3.6.1.6.3.1.1.4.3.0', '1.3.6.1.4.1.20408.4.1.1.2'),
('1.3.6.1.2.1.1.1.0', OctetString('my system'))
diff --git a/examples/hlapi/asyncio/manager/cmdgen/getbulk-to-eom.py b/examples/hlapi/v3arch/asyncio/manager/cmdgen/getbulk-to-eom.py
index e453e6b5..c60d6e12 100644
--- a/examples/hlapi/asyncio/manager/cmdgen/getbulk-to-eom.py
+++ b/examples/hlapi/v3arch/asyncio/manager/cmdgen/getbulk-to-eom.py
@@ -18,7 +18,7 @@ Functionally similar to:
"""#
import asyncio
-from pysnmp.hlapi.asyncio import *
+from pysnmp.hlapi.v3arch.asyncio import *
@asyncio.coroutine
diff --git a/examples/hlapi/asyncio/manager/cmdgen/multiple-concurrent-queries-over-ipv4-and-ipv6.py b/examples/hlapi/v3arch/asyncio/manager/cmdgen/multiple-concurrent-queries-over-ipv4-and-ipv6.py
index ad9c441b..a1b5d9a0 100644
--- a/examples/hlapi/asyncio/manager/cmdgen/multiple-concurrent-queries-over-ipv4-and-ipv6.py
+++ b/examples/hlapi/v3arch/asyncio/manager/cmdgen/multiple-concurrent-queries-over-ipv4-and-ipv6.py
@@ -18,7 +18,7 @@ Functionally similar to:
"""#
import asyncio
-from pysnmp.hlapi.asyncio import *
+from pysnmp.hlapi.v3arch.asyncio import *
@asyncio.coroutine
diff --git a/examples/hlapi/asyncio/manager/cmdgen/multiple-sequential-queries.py b/examples/hlapi/v3arch/asyncio/manager/cmdgen/multiple-sequential-queries.py
index 4a43bc49..d546870d 100644
--- a/examples/hlapi/asyncio/manager/cmdgen/multiple-sequential-queries.py
+++ b/examples/hlapi/v3arch/asyncio/manager/cmdgen/multiple-sequential-queries.py
@@ -18,7 +18,7 @@ Functionally similar to:
"""#
import asyncio
-from pysnmp.hlapi.asyncio import *
+from pysnmp.hlapi.v3arch.asyncio import *
@asyncio.coroutine
diff --git a/examples/hlapi/asyncio/manager/cmdgen/v1-get.py b/examples/hlapi/v3arch/asyncio/manager/cmdgen/v1-get.py
index 6147706d..f14a9f63 100644
--- a/examples/hlapi/asyncio/manager/cmdgen/v1-get.py
+++ b/examples/hlapi/v3arch/asyncio/manager/cmdgen/v1-get.py
@@ -16,7 +16,7 @@ Functionally similar to:
"""#
import asyncio
-from pysnmp.hlapi.asyncio import *
+from pysnmp.hlapi.v3arch.asyncio import *
@asyncio.coroutine
diff --git a/examples/hlapi/asyncore/agent/ntforg/default-v1-trap.py b/examples/hlapi/v3arch/asyncore/agent/ntforg/default-v1-trap.py
index 3b806d6d..21ac77b3 100644
--- a/examples/hlapi/asyncore/agent/ntforg/default-v1-trap.py
+++ b/examples/hlapi/v3arch/asyncore/agent/ntforg/default-v1-trap.py
@@ -20,7 +20,7 @@ Functionally similar to:
| $ snmptrap -v1 -c public demo.snmplabs.com 1.3.6.1.4.1.20408.4.1.1.2 0.0.0.0 1 0 0 1.3.6.1.2.1.1.1.0 s "my system"
"""#
-from pysnmp.hlapi.asyncore import *
+from pysnmp.hlapi.v3arch.asyncore import *
snmpEngine = SnmpEngine()
@@ -35,6 +35,8 @@ sendNotification(
).addVarBinds(
('1.3.6.1.6.3.1.1.4.3.0', '1.3.6.1.4.1.20408.4.1.1.2'),
('1.3.6.1.2.1.1.1.0', OctetString('my system'))
+ ).loadMibs(
+ 'SNMPv2-MIB'
)
)
diff --git a/examples/hlapi/asyncore/agent/ntforg/multiple-informs-at-once.py b/examples/hlapi/v3arch/asyncore/agent/ntforg/multiple-informs-at-once.py
index 58c5bfb8..9690c2e4 100644
--- a/examples/hlapi/asyncore/agent/ntforg/multiple-informs-at-once.py
+++ b/examples/hlapi/v3arch/asyncore/agent/ntforg/multiple-informs-at-once.py
@@ -16,7 +16,7 @@ Send multiple SNMP notifications at once using the following options:
| $ snmpinform -v3 -u usr-md5-des -l authPriv -A authkey1 -X privkey1 demo.snmplabs.com 123 1.3.6.1.6.3.1.1.5.1
"""#
-from pysnmp.hlapi.asyncore import *
+from pysnmp.hlapi.v3arch.asyncore import *
# List of targets in the followin format:
# ( ( authData, transportTarget ), ... )
diff --git a/examples/hlapi/asyncore/agent/ntforg/multiple-traps-at-once.py b/examples/hlapi/v3arch/asyncore/agent/ntforg/multiple-traps-at-once.py
index 7aa63f68..ad873868 100644
--- a/examples/hlapi/asyncore/agent/ntforg/multiple-traps-at-once.py
+++ b/examples/hlapi/v3arch/asyncore/agent/ntforg/multiple-traps-at-once.py
@@ -17,7 +17,7 @@ wait for responses asynchronously:
| $ snmptrap -v2c -c public demo.snmplabs.com 123 1.3.6.1.6.3.1.1.5.1
"""#
-from pysnmp.hlapi.asyncore import *
+from pysnmp.hlapi.v3arch.asyncore import *
# List of targets in the followin format:
# ( ( authData, transportTarget ), ... )
diff --git a/examples/hlapi/asyncore/agent/ntforg/running-multiple-snmp-engines-at-once.py b/examples/hlapi/v3arch/asyncore/agent/ntforg/running-multiple-snmp-engines-at-once.py
index ba65d60a..10a96756 100644
--- a/examples/hlapi/asyncore/agent/ntforg/running-multiple-snmp-engines-at-once.py
+++ b/examples/hlapi/v3arch/asyncore/agent/ntforg/running-multiple-snmp-engines-at-once.py
@@ -29,7 +29,7 @@ criterias are also possible.
| $ snmpinform -v3 -u usr-md5-des -l authPriv -A authkey1 -X privkey1 demo.snmplabs.com 123 1.3.6.1.6.3.1.1.5.1
"""#
-from pysnmp.hlapi.asyncore import *
+from pysnmp.hlapi.v3arch.asyncore import *
from pysnmp.carrier.asyncore.dispatch import AsyncoreDispatcher
# List of targets in the following format:
diff --git a/examples/hlapi/asyncore/manager/cmdgen/multiple-concurrent-queries-over-ipv4-and-ipv6.py b/examples/hlapi/v3arch/asyncore/manager/cmdgen/multiple-concurrent-queries-over-ipv4-and-ipv6.py
index 2b4b0eb3..c6132711 100644
--- a/examples/hlapi/asyncore/manager/cmdgen/multiple-concurrent-queries-over-ipv4-and-ipv6.py
+++ b/examples/hlapi/v3arch/asyncore/manager/cmdgen/multiple-concurrent-queries-over-ipv4-and-ipv6.py
@@ -16,7 +16,7 @@ wait for responses asynchronously:
SNMPv2-MIB::sysLocation.0 MIB objects
"""#
-from pysnmp.hlapi.asyncore import *
+from pysnmp.hlapi.v3arch.asyncore import *
# List of targets in the followin format:
# ( ( authData, transportTarget, varNames ), ... )
diff --git a/examples/hlapi/asyncore/manager/cmdgen/pull-mibs-from-multiple-agents-at-once-over-ipv4-and-ipv6.py b/examples/hlapi/v3arch/asyncore/manager/cmdgen/pull-mibs-from-multiple-agents-at-once-over-ipv4-and-ipv6.py
index d87d55c5..eef035d1 100644
--- a/examples/hlapi/asyncore/manager/cmdgen/pull-mibs-from-multiple-agents-at-once-over-ipv4-and-ipv6.py
+++ b/examples/hlapi/v3arch/asyncore/manager/cmdgen/pull-mibs-from-multiple-agents-at-once-over-ipv4-and-ipv6.py
@@ -15,10 +15,10 @@ following options:
* pull variables till EOM
"""#
-from pysnmp.hlapi.asyncore import *
+from pysnmp.hlapi.v3arch.asyncore import *
-# List of targets in the followin format:
-# ( ( authData, transportTarget, varNames ), ... )
+# List of targets in the following format:
+# ((authData, transportTarget, varNames), ...)
targets = (
# 1-st target (SNMPv1 over IPv4/UDP)
(CommunityData('public', mpModel=0),
diff --git a/examples/hlapi/asyncore/manager/cmdgen/pull-whole-mib.py b/examples/hlapi/v3arch/asyncore/manager/cmdgen/pull-whole-mib.py
index 8d9ff19e..a0aa02b9 100644
--- a/examples/hlapi/asyncore/manager/cmdgen/pull-whole-mib.py
+++ b/examples/hlapi/v3arch/asyncore/manager/cmdgen/pull-whole-mib.py
@@ -15,7 +15,7 @@ Functionally similar to:
| demo.snmplabs.com IF-MIB::
"""#
-from pysnmp.hlapi.asyncore import *
+from pysnmp.hlapi.v3arch.asyncore import *
# noinspection PyUnusedLocal,PyUnusedLocal,PyUnusedLocal
diff --git a/examples/hlapi/asyncore/manager/cmdgen/query-multiple-snmp-engines-over-ipv4-and-ipv6.py b/examples/hlapi/v3arch/asyncore/manager/cmdgen/query-multiple-snmp-engines-over-ipv4-and-ipv6.py
index 4a732041..87591b4e 100644
--- a/examples/hlapi/asyncore/manager/cmdgen/query-multiple-snmp-engines-over-ipv4-and-ipv6.py
+++ b/examples/hlapi/v3arch/asyncore/manager/cmdgen/query-multiple-snmp-engines-over-ipv4-and-ipv6.py
@@ -3,7 +3,7 @@ Multiple SNMP engines
+++++++++++++++++++++
Send multiple SNMP GET requests to multiple peers using multiple
-independend SNMP engines. Deal with peers asynchronously. SNMP options
+independent SNMP engines. Deal with peers asynchronously. SNMP options
are:
* with SNMPv1, community 'public' and
@@ -28,7 +28,7 @@ employ here is based on peer's UDP port number. Other selection
criterias are also possible.
"""#
-from pysnmp.hlapi.asyncore import *
+from pysnmp.hlapi.v3arch.asyncore import *
from pysnmp.carrier.asyncore.dispatch import AsyncoreDispatcher
# List of targets in the following format:
diff --git a/examples/hlapi/asyncore/manager/cmdgen/v2c-get.py b/examples/hlapi/v3arch/asyncore/manager/cmdgen/v2c-get.py
index d752b540..ae8f8262 100644
--- a/examples/hlapi/asyncore/manager/cmdgen/v2c-get.py
+++ b/examples/hlapi/v3arch/asyncore/manager/cmdgen/v2c-get.py
@@ -14,7 +14,7 @@ Functionally similar to:
| $ snmpget -v2c -c public demo.snmplabs.com SNMPv2-MIB::sysDescr.0
"""#
-from pysnmp.hlapi.asyncore import *
+from pysnmp.hlapi.v3arch.asyncore import *
# noinspection PyUnusedLocal,PyUnusedLocal,PyUnusedLocal
diff --git a/examples/hlapi/asyncore/sync/agent/ntforg/custom-contextengineid.py b/examples/hlapi/v3arch/asyncore/sync/agent/ntforg/custom-contextengineid.py
index 6c4e7adc..1b9e12d5 100644
--- a/examples/hlapi/asyncore/sync/agent/ntforg/custom-contextengineid.py
+++ b/examples/hlapi/v3arch/asyncore/sync/agent/ntforg/custom-contextengineid.py
@@ -28,7 +28,10 @@ errorIndication, errorStatus, errorIndex, varBinds = next(
UdpTransportTarget(('demo.snmplabs.com', 162)),
ContextData(OctetString(hexValue='8000000004030201')),
'inform',
- NotificationType(ObjectIdentity('1.3.6.1.6.3.1.1.5.2')))
+ NotificationType(
+ ObjectIdentity('1.3.6.1.6.3.1.1.5.2')
+ ).loadMibs('SNMPv2-MIB')
+ )
)
if errorIndication:
diff --git a/examples/hlapi/asyncore/sync/agent/ntforg/custom-contextname.py b/examples/hlapi/v3arch/asyncore/sync/agent/ntforg/custom-contextname.py
index 729c9b83..96abba48 100644
--- a/examples/hlapi/asyncore/sync/agent/ntforg/custom-contextname.py
+++ b/examples/hlapi/v3arch/asyncore/sync/agent/ntforg/custom-contextname.py
@@ -28,7 +28,7 @@ errorIndication, errorStatus, errorIndex, varBinds = next(
UdpTransportTarget(('demo.snmplabs.com', 162)),
ContextData(contextName='my-context'),
'inform',
- NotificationType(ObjectIdentity('1.3.6.1.6.3.1.1.5.2')))
+ NotificationType(ObjectIdentity('1.3.6.1.6.3.1.1.5.2')).loadMibs('SNMPv2-MIB'))
)
if errorIndication:
diff --git a/examples/hlapi/asyncore/sync/agent/ntforg/custom-v1-trap.py b/examples/hlapi/v3arch/asyncore/sync/agent/ntforg/custom-v1-trap.py
index 8693f13f..c6d84303 100644
--- a/examples/hlapi/asyncore/sync/agent/ntforg/custom-v1-trap.py
+++ b/examples/hlapi/v3arch/asyncore/sync/agent/ntforg/custom-v1-trap.py
@@ -38,6 +38,8 @@ errorIndication, errorStatus, errorIndex, varBinds = next(
('1.3.6.1.6.3.18.1.3.0', '127.0.0.1'),
('1.3.6.1.6.3.1.1.4.3.0', '1.3.6.1.4.1.20408.4.1.1.2'),
('1.3.6.1.2.1.1.1.0', OctetString('my system'))
+ ).loadMibs(
+ 'SNMPv2-MIB', 'SNMP-COMMUNITY-MIB'
)
)
)
diff --git a/examples/hlapi/asyncore/sync/agent/ntforg/default-v1-trap.py b/examples/hlapi/v3arch/asyncore/sync/agent/ntforg/default-v1-trap.py
index 18cc2c77..552ad877 100644
--- a/examples/hlapi/asyncore/sync/agent/ntforg/default-v1-trap.py
+++ b/examples/hlapi/v3arch/asyncore/sync/agent/ntforg/default-v1-trap.py
@@ -34,6 +34,8 @@ errorIndication, errorStatus, errorIndex, varBinds = next(
).addVarBinds(
('1.3.6.1.6.3.1.1.4.3.0', '1.3.6.1.4.1.20408.4.1.1.2'),
('1.3.6.1.2.1.1.1.0', OctetString('my system'))
+ ).loadMibs(
+ 'SNMPv2-MIB'
)
)
)
diff --git a/examples/hlapi/asyncore/sync/agent/ntforg/send-notification-with-additional-varbinds.py b/examples/hlapi/v3arch/asyncore/sync/agent/ntforg/send-notification-with-additional-varbinds.py
index 46f3c5c1..46f3c5c1 100644
--- a/examples/hlapi/asyncore/sync/agent/ntforg/send-notification-with-additional-varbinds.py
+++ b/examples/hlapi/v3arch/asyncore/sync/agent/ntforg/send-notification-with-additional-varbinds.py
diff --git a/examples/hlapi/asyncore/sync/agent/ntforg/v2c-trap-with-notification-objects.py b/examples/hlapi/v3arch/asyncore/sync/agent/ntforg/v2c-trap-with-notification-objects.py
index 5681d28c..5681d28c 100644
--- a/examples/hlapi/asyncore/sync/agent/ntforg/v2c-trap-with-notification-objects.py
+++ b/examples/hlapi/v3arch/asyncore/sync/agent/ntforg/v2c-trap-with-notification-objects.py
diff --git a/examples/hlapi/asyncore/sync/agent/ntforg/v3-inform.py b/examples/hlapi/v3arch/asyncore/sync/agent/ntforg/v3-inform.py
index 46153978..6f02024f 100644
--- a/examples/hlapi/asyncore/sync/agent/ntforg/v3-inform.py
+++ b/examples/hlapi/v3arch/asyncore/sync/agent/ntforg/v3-inform.py
@@ -29,6 +29,8 @@ errorIndication, errorStatus, errorIndex, varBinds = next(
ObjectIdentity('1.3.6.1.6.3.1.1.5.2')
).addVarBinds(
ObjectType(ObjectIdentity('1.3.6.1.2.1.1.5.0'), 'system name')
+ ).loadMibs(
+ 'SNMPv2-MIB'
)
)
)
diff --git a/examples/hlapi/asyncore/sync/agent/ntforg/v3-trap.py b/examples/hlapi/v3arch/asyncore/sync/agent/ntforg/v3-trap.py
index 836e8d50..836e8d50 100644
--- a/examples/hlapi/asyncore/sync/agent/ntforg/v3-trap.py
+++ b/examples/hlapi/v3arch/asyncore/sync/agent/ntforg/v3-trap.py
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/coerce-set-value-to-mib-spec.py b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/coerce-set-value-to-mib-spec.py
index b6fb879e..b6fb879e 100644
--- a/examples/hlapi/asyncore/sync/manager/cmdgen/coerce-set-value-to-mib-spec.py
+++ b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/coerce-set-value-to-mib-spec.py
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/custom-asn1-mib-search-path.py b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/custom-asn1-mib-search-path.py
index f25fafe4..f25fafe4 100644
--- a/examples/hlapi/asyncore/sync/manager/cmdgen/custom-asn1-mib-search-path.py
+++ b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/custom-asn1-mib-search-path.py
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/custom-contextengineid-and-contextname.py b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/custom-contextengineid-and-contextname.py
index 497af602..497af602 100644
--- a/examples/hlapi/asyncore/sync/manager/cmdgen/custom-contextengineid-and-contextname.py
+++ b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/custom-contextengineid-and-contextname.py
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/custom-contextengineid.py b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/custom-contextengineid.py
index 6435a5d5..6435a5d5 100644
--- a/examples/hlapi/asyncore/sync/manager/cmdgen/custom-contextengineid.py
+++ b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/custom-contextengineid.py
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/custom-pysnmp-mibs-search-path.py b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/custom-pysnmp-mibs-search-path.py
index 26b8954a..26b8954a 100644
--- a/examples/hlapi/asyncore/sync/manager/cmdgen/custom-pysnmp-mibs-search-path.py
+++ b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/custom-pysnmp-mibs-search-path.py
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/custom-timeout-and-retries.py b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/custom-timeout-and-retries.py
index d70a322f..d70a322f 100644
--- a/examples/hlapi/asyncore/sync/manager/cmdgen/custom-timeout-and-retries.py
+++ b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/custom-timeout-and-retries.py
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/custom-v3-security-name.py b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/custom-v3-security-name.py
index 8e541f7b..8e541f7b 100644
--- a/examples/hlapi/asyncore/sync/manager/cmdgen/custom-v3-security-name.py
+++ b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/custom-v3-security-name.py
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/fetch-variables-over-ipv6.py b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/fetch-variables-over-ipv6.py
index 9bc76446..9bc76446 100644
--- a/examples/hlapi/asyncore/sync/manager/cmdgen/fetch-variables-over-ipv6.py
+++ b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/fetch-variables-over-ipv6.py
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/get-table-object-by-index.py b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/get-table-object-by-index.py
index ed5d8351..ed5d8351 100644
--- a/examples/hlapi/asyncore/sync/manager/cmdgen/get-table-object-by-index.py
+++ b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/get-table-object-by-index.py
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/get-table-object-by-multiple-indices.py b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/get-table-object-by-multiple-indices.py
index 672aea93..672aea93 100644
--- a/examples/hlapi/asyncore/sync/manager/cmdgen/get-table-object-by-multiple-indices.py
+++ b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/get-table-object-by-multiple-indices.py
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/getbulk-fetch-scalar-and-table-variables-over-ipv6.py b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/getbulk-fetch-scalar-and-table-variables-over-ipv6.py
index 499c9b02..499c9b02 100644
--- a/examples/hlapi/asyncore/sync/manager/cmdgen/getbulk-fetch-scalar-and-table-variables-over-ipv6.py
+++ b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/getbulk-fetch-scalar-and-table-variables-over-ipv6.py
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/getbulk-limit-number-of-packets.py b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/getbulk-limit-number-of-packets.py
index dd94650c..dd94650c 100644
--- a/examples/hlapi/asyncore/sync/manager/cmdgen/getbulk-limit-number-of-packets.py
+++ b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/getbulk-limit-number-of-packets.py
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/getbulk-limit-number-of-variables.py b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/getbulk-limit-number-of-variables.py
index fa39086b..fa39086b 100644
--- a/examples/hlapi/asyncore/sync/manager/cmdgen/getbulk-limit-number-of-variables.py
+++ b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/getbulk-limit-number-of-variables.py
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/getnext-limit-number-of-variables.py b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/getnext-limit-number-of-variables.py
index f9fd70c1..f9fd70c1 100644
--- a/examples/hlapi/asyncore/sync/manager/cmdgen/getnext-limit-number-of-variables.py
+++ b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/getnext-limit-number-of-variables.py
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/getnext-multiple-oids-to-eom.py b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/getnext-multiple-oids-to-eom.py
index 863ceb6f..863ceb6f 100644
--- a/examples/hlapi/asyncore/sync/manager/cmdgen/getnext-multiple-oids-to-eom.py
+++ b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/getnext-multiple-oids-to-eom.py
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/multiple-get-calls.py b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/multiple-get-calls.py
index c08b9f47..d883d16a 100644
--- a/examples/hlapi/asyncore/sync/manager/cmdgen/multiple-get-calls.py
+++ b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/multiple-get-calls.py
@@ -8,6 +8,7 @@ Send two SNMP GET requests in a row using the following options:
* over IPv4/UDP
* to an Agent at demo.snmplabs.com:161
* for IF-MIB::ifInOctets.1 and IF-MIB::ifOutOctets.1 MIB objects
+* with MIB lookup enabled
Use a queue of MIB objects to query.
@@ -24,15 +25,15 @@ from pysnmp.hlapi import *
queue = [[ObjectType(ObjectIdentity('IF-MIB', 'ifInOctets', 1))],
[ObjectType(ObjectIdentity('IF-MIB', 'ifOutOctets', 1))]]
-iter = getCmd(SnmpEngine(),
- UsmUserData('usr-md5-none', 'authkey1'),
- UdpTransportTarget(('demo.snmplabs.com', 161)),
- ContextData())
+iterator = getCmd(SnmpEngine(),
+ UsmUserData('usr-md5-none', 'authkey1'),
+ UdpTransportTarget(('demo.snmplabs.com', 161)),
+ ContextData())
-next(iter)
+next(iterator)
while queue:
- errorIndication, errorStatus, errorIndex, varBinds = iter.send(queue.pop())
+ errorIndication, errorStatus, errorIndex, varBinds = iterator.send(queue.pop())
if errorIndication:
print(errorIndication)
elif errorStatus:
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/preload-pysnmp-mibs.py b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/preload-pysnmp-mibs.py
index a9bb2bb3..a9bb2bb3 100644
--- a/examples/hlapi/asyncore/sync/manager/cmdgen/preload-pysnmp-mibs.py
+++ b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/preload-pysnmp-mibs.py
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/pull-whole-mib.py b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/pull-whole-mib.py
index b9103de3..b9103de3 100644
--- a/examples/hlapi/asyncore/sync/manager/cmdgen/pull-whole-mib.py
+++ b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/pull-whole-mib.py
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/pull-whole-snmp-table.py b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/pull-whole-snmp-table.py
index 91a71a61..91a71a61 100644
--- a/examples/hlapi/asyncore/sync/manager/cmdgen/pull-whole-snmp-table.py
+++ b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/pull-whole-snmp-table.py
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/query-agents-from-multuple-threads-over-ipv4-and-ipv6.py b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/query-agents-from-multuple-threads-over-ipv4-and-ipv6.py
index 16995ed8..16995ed8 100644
--- a/examples/hlapi/asyncore/sync/manager/cmdgen/query-agents-from-multuple-threads-over-ipv4-and-ipv6.py
+++ b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/query-agents-from-multuple-threads-over-ipv4-and-ipv6.py
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/set-multiple-scalar-values.py b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/set-multiple-scalar-values.py
index b5fc1912..be4ffeab 100644
--- a/examples/hlapi/asyncore/sync/manager/cmdgen/set-multiple-scalar-values.py
+++ b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/set-multiple-scalar-values.py
@@ -25,7 +25,7 @@ errorIndication, errorStatus, errorIndex, varBinds = next(
CommunityData('public', mpModel=0),
UdpTransportTarget(('demo.snmplabs.com', 161)),
ContextData(),
- ObjectType(ObjectIdentity('1.3.6.1.2.1.1.9.1.2.1'),
+ ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysORID', 1),
ObjectIdentifier('1.3.6.1.4.1.20408.1.1')),
ObjectType(ObjectIdentity('1.3.6.1.2.1.1.9.1.2.1'),
'1.3.6.1.4.1.20408.1.1'),
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/specific-v3-engine-id.py b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/specific-v3-engine-id.py
index 94f591c4..94f591c4 100644
--- a/examples/hlapi/asyncore/sync/manager/cmdgen/specific-v3-engine-id.py
+++ b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/specific-v3-engine-id.py
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/usm-md5-des.py b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/usm-md5-des.py
index 27c0e7fb..27c0e7fb 100644
--- a/examples/hlapi/asyncore/sync/manager/cmdgen/usm-md5-des.py
+++ b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/usm-md5-des.py
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/usm-md5-none.py b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/usm-md5-none.py
index f06964e2..f06964e2 100644
--- a/examples/hlapi/asyncore/sync/manager/cmdgen/usm-md5-none.py
+++ b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/usm-md5-none.py
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/usm-none-none.py b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/usm-none-none.py
index 940d8817..940d8817 100644
--- a/examples/hlapi/asyncore/sync/manager/cmdgen/usm-none-none.py
+++ b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/usm-none-none.py
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/usm-sha-aes128.py b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/usm-sha-aes128.py
index 53d4f800..53d4f800 100644
--- a/examples/hlapi/asyncore/sync/manager/cmdgen/usm-sha-aes128.py
+++ b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/usm-sha-aes128.py
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/v1-get.py b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/v1-get.py
index 1b272967..1b272967 100644
--- a/examples/hlapi/asyncore/sync/manager/cmdgen/v1-get.py
+++ b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/v1-get.py
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/v2c-get.py b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/v2c-get.py
index 606bab5b..606bab5b 100644
--- a/examples/hlapi/asyncore/sync/manager/cmdgen/v2c-get.py
+++ b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/v2c-get.py
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/v2c-getbulk.py b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/v2c-getbulk.py
index 47715195..47715195 100644
--- a/examples/hlapi/asyncore/sync/manager/cmdgen/v2c-getbulk.py
+++ b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/v2c-getbulk.py
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/waive-mib-lookup.py b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/waive-mib-lookup.py
index 17194552..f44d160b 100644
--- a/examples/hlapi/asyncore/sync/manager/cmdgen/waive-mib-lookup.py
+++ b/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/waive-mib-lookup.py
@@ -8,11 +8,10 @@ Perform SNMP GETNEXT operation with the following options:
* over IPv4/UDP
* to an Agent at demo.snmplabs.com:161
* for an OID in string form
-* do not resolve response OIDs and values into human-freidly form
+* do not resolve request/response OIDs and values from/toto human-friendly form
-False lookupMib keyword arguments could make pysnmp waiving
-OIDs and values resolution in response variable-bindings, into human
-friendly form.
+The `lookupMib=False` keyword argument makes pysnmp NOT resolving
+request and response variable-bindings from/to human-friendly form.
Functionally similar to:
diff --git a/examples/hlapi/trollius/agent/ntforg/default-v1-trap.py b/examples/hlapi/v3arch/trollius/agent/ntforg/default-v1-trap.py
index 514cff2f..64e61b1d 100644
--- a/examples/hlapi/trollius/agent/ntforg/default-v1-trap.py
+++ b/examples/hlapi/v3arch/trollius/agent/ntforg/default-v1-trap.py
@@ -22,7 +22,7 @@ Functionally similar to:
"""#
import trollius
-from pysnmp.hlapi.asyncio import *
+from pysnmp.hlapi.v3arch.asyncio import *
@trollius.coroutine
@@ -40,6 +40,8 @@ def run():
'inform',
NotificationType(
ObjectIdentity('1.3.6.1.6.3.1.1.5.2')
+ ).loadMibs(
+ 'SNMPv2-MIB'
).addVarBinds(
('1.3.6.1.6.3.1.1.4.3.0', '1.3.6.1.4.1.20408.4.1.1.2'),
('1.3.6.1.2.1.1.1.0', OctetString('my system'))
diff --git a/examples/hlapi/trollius/manager/cmdgen/getbulk-to-eom.py b/examples/hlapi/v3arch/trollius/manager/cmdgen/getbulk-to-eom.py
index b380b283..f084e398 100644
--- a/examples/hlapi/trollius/manager/cmdgen/getbulk-to-eom.py
+++ b/examples/hlapi/v3arch/trollius/manager/cmdgen/getbulk-to-eom.py
@@ -17,7 +17,7 @@ Functionally similar to:
"""#
import trollius
-from pysnmp.hlapi.asyncio import *
+from pysnmp.hlapi.v3arch.asyncio import *
@trollius.coroutine
diff --git a/examples/hlapi/trollius/manager/cmdgen/v1-get.py b/examples/hlapi/v3arch/trollius/manager/cmdgen/v1-get.py
index d7406963..771e48c6 100644
--- a/examples/hlapi/trollius/manager/cmdgen/v1-get.py
+++ b/examples/hlapi/v3arch/trollius/manager/cmdgen/v1-get.py
@@ -16,7 +16,7 @@ Functionally similar to:
"""#
import trollius
-from pysnmp.hlapi.asyncio import *
+from pysnmp.hlapi.v3arch.asyncio import *
@trollius.coroutine
diff --git a/examples/hlapi/twisted/agent/ntforg/default-v1-trap.py b/examples/hlapi/v3arch/twisted/agent/ntforg/default-v1-trap.py
index 4d1a2700..756ce58d 100644
--- a/examples/hlapi/twisted/agent/ntforg/default-v1-trap.py
+++ b/examples/hlapi/v3arch/twisted/agent/ntforg/default-v1-trap.py
@@ -21,7 +21,7 @@ Functionally similar to:
"""#
from twisted.internet.task import react
-from pysnmp.hlapi.twisted import *
+from pysnmp.hlapi.v3arch.twisted import *
def success(args, hostname):
@@ -53,6 +53,8 @@ def run(reactor, hostname):
'trap',
NotificationType(
ObjectIdentity('1.3.6.1.6.3.1.1.5.2')
+ ).loadMibs(
+ 'SNMPv2-MIB'
).addVarBinds(
('1.3.6.1.6.3.1.1.4.3.0', '1.3.6.1.4.1.20408.4.1.1.2'),
('1.3.6.1.2.1.1.1.0', OctetString('my system'))
diff --git a/examples/hlapi/twisted/agent/ntforg/multiple-notifications-at-once.py b/examples/hlapi/v3arch/twisted/agent/ntforg/multiple-notifications-at-once.py
index e9d199e9..c234a827 100644
--- a/examples/hlapi/twisted/agent/ntforg/multiple-notifications-at-once.py
+++ b/examples/hlapi/v3arch/twisted/agent/ntforg/multiple-notifications-at-once.py
@@ -24,7 +24,7 @@ Functionally similar to:
"""#
from twisted.internet.defer import DeferredList
from twisted.internet.task import react
-from pysnmp.hlapi.twisted import *
+from pysnmp.hlapi.v3arch.twisted import *
def success(args, hostname):
@@ -53,6 +53,8 @@ def sendone(reactor, snmpEngine, hostname, notifyType):
notifyType,
NotificationType(
ObjectIdentity('1.3.6.1.6.3.1.1.5.2')
+ ).loadMibs(
+ 'SNMPv2-MIB'
).addVarBinds(
('1.3.6.1.6.3.1.1.4.3.0', '1.3.6.1.4.1.20408.4.1.1.2'),
('1.3.6.1.2.1.1.1.0', OctetString('my system'))
diff --git a/examples/hlapi/twisted/agent/ntforg/v2c-trap-inline-callbacks.py b/examples/hlapi/v3arch/twisted/agent/ntforg/v2c-trap-inline-callbacks.py
index e326108c..39b15c57 100644
--- a/examples/hlapi/twisted/agent/ntforg/v2c-trap-inline-callbacks.py
+++ b/examples/hlapi/v3arch/twisted/agent/ntforg/v2c-trap-inline-callbacks.py
@@ -18,7 +18,7 @@ Functionally similar to:
"""#
from twisted.internet.task import react, defer
-from pysnmp.hlapi.twisted import *
+from pysnmp.hlapi.v3arch.twisted import *
@defer.inlineCallbacks
@@ -32,6 +32,8 @@ def sendtrap(reactor, snmpEngine, hostname):
'trap',
NotificationType(
ObjectIdentity('1.3.6.1.6.3.1.1.5.2')
+ ).loadMibs(
+ 'SNMPv2-MIB'
).addVarBinds(
ObjectType(ObjectIdentity('1.3.6.1.2.1.1.1.0'), OctetString('Hello from Twisted'))
)
diff --git a/examples/hlapi/twisted/manager/cmdgen/custom-timeout-and-retries.py b/examples/hlapi/v3arch/twisted/manager/cmdgen/custom-timeout-and-retries.py
index a1ff7850..9c8c6eb9 100644
--- a/examples/hlapi/twisted/manager/cmdgen/custom-timeout-and-retries.py
+++ b/examples/hlapi/v3arch/twisted/manager/cmdgen/custom-timeout-and-retries.py
@@ -16,7 +16,7 @@ Functionally similar to:
"""#
from twisted.internet.task import react
-from pysnmp.hlapi.twisted import *
+from pysnmp.hlapi.v3arch.twisted import *
def success(args, hostname):
diff --git a/examples/hlapi/twisted/manager/cmdgen/getbulk-to-eom.py b/examples/hlapi/v3arch/twisted/manager/cmdgen/getbulk-to-eom.py
index d3675451..89542793 100644
--- a/examples/hlapi/twisted/manager/cmdgen/getbulk-to-eom.py
+++ b/examples/hlapi/v3arch/twisted/manager/cmdgen/getbulk-to-eom.py
@@ -17,7 +17,7 @@ Functionally similar to:
"""#
from twisted.internet.task import react
-from pysnmp.hlapi.twisted import *
+from pysnmp.hlapi.v3arch.twisted import *
def success(args, reactor, snmpEngine):
diff --git a/examples/hlapi/twisted/manager/cmdgen/multiple-concurrent-queries.py b/examples/hlapi/v3arch/twisted/manager/cmdgen/multiple-concurrent-queries.py
index 07fb08ea..90561015 100644
--- a/examples/hlapi/twisted/manager/cmdgen/multiple-concurrent-queries.py
+++ b/examples/hlapi/v3arch/twisted/manager/cmdgen/multiple-concurrent-queries.py
@@ -19,7 +19,7 @@ Functionally similar to:
"""#
from twisted.internet.defer import DeferredList
from twisted.internet.task import react
-from pysnmp.hlapi.twisted import *
+from pysnmp.hlapi.v3arch.twisted import *
def success(args, hostname):
diff --git a/examples/hlapi/twisted/manager/cmdgen/pull-mibs-from-multiple-agents-at-once.py b/examples/hlapi/v3arch/twisted/manager/cmdgen/pull-mibs-from-multiple-agents-at-once.py
index 41d779e6..2e501262 100644
--- a/examples/hlapi/twisted/manager/cmdgen/pull-mibs-from-multiple-agents-at-once.py
+++ b/examples/hlapi/v3arch/twisted/manager/cmdgen/pull-mibs-from-multiple-agents-at-once.py
@@ -17,7 +17,7 @@ Functionally similar to:
"""#
from twisted.internet.defer import DeferredList
from twisted.internet.task import react
-from pysnmp.hlapi.twisted import *
+from pysnmp.hlapi.v3arch.twisted import *
def success(args, reactor, snmpEngine, hostname):
diff --git a/examples/hlapi/twisted/manager/cmdgen/pull-whole-mib.py b/examples/hlapi/v3arch/twisted/manager/cmdgen/pull-whole-mib.py
index b2b245e6..9e3f1791 100644
--- a/examples/hlapi/twisted/manager/cmdgen/pull-whole-mib.py
+++ b/examples/hlapi/v3arch/twisted/manager/cmdgen/pull-whole-mib.py
@@ -16,7 +16,7 @@ Functionally similar to:
"""#
from twisted.internet.task import react
-from pysnmp.hlapi.twisted import *
+from pysnmp.hlapi.v3arch.twisted import *
def success(args, reactor, snmpEngine):
diff --git a/examples/hlapi/twisted/manager/cmdgen/v1-get.py b/examples/hlapi/v3arch/twisted/manager/cmdgen/v1-get.py
index 21719ff7..e483354d 100644
--- a/examples/hlapi/twisted/manager/cmdgen/v1-get.py
+++ b/examples/hlapi/v3arch/twisted/manager/cmdgen/v1-get.py
@@ -16,7 +16,7 @@ Functionally similar to:
"""#
from twisted.internet.task import react
-from pysnmp.hlapi.twisted import *
+from pysnmp.hlapi.v3arch.twisted import *
def success(args, hostname):
diff --git a/examples/v1arch/asyncore/agent/ntforg/send-inform-over-ipv4-and-ipv6.py b/examples/v1arch/asyncore/agent/ntforg/send-inform-over-ipv4-and-ipv6.py
index 69d9b43b..43d37e5f 100644
--- a/examples/v1arch/asyncore/agent/ntforg/send-inform-over-ipv4-and-ipv6.py
+++ b/examples/v1arch/asyncore/agent/ntforg/send-inform-over-ipv4-and-ipv6.py
@@ -41,7 +41,6 @@ def cbTimerFun(timeNow):
raise Exception("Request timed out")
-# noinspection PyUnusedLocal,PyUnusedLocal
def cbRecvFun(transportDispatcher, transportDomain, transportAddress,
wholeMsg, reqPDU=reqPDU):
while wholeMsg: