summaryrefslogtreecommitdiff
path: root/examples/v3arch/asyncio
diff options
context:
space:
mode:
Diffstat (limited to 'examples/v3arch/asyncio')
-rw-r--r--examples/v3arch/asyncio/agent/cmdrsp/v3-multiple-users.py47
-rw-r--r--examples/v3arch/asyncio/agent/ntforg/inform-v3.py38
-rw-r--r--examples/v3arch/asyncio/agent/ntforg/trap-v1.py46
-rw-r--r--examples/v3arch/asyncio/manager/cmdgen/get-v2c-custom-timeout.py37
-rw-r--r--examples/v3arch/asyncio/manager/cmdgen/get-v2c-over-ipv6.py35
-rw-r--r--examples/v3arch/asyncio/manager/cmdgen/getbulk-v2c.py39
-rw-r--r--examples/v3arch/asyncio/manager/cmdgen/getnext-v2c-from-specific-address.py39
-rw-r--r--examples/v3arch/asyncio/manager/cmdgen/set-v2c.py36
-rw-r--r--examples/v3arch/asyncio/manager/ntfrcv/v2c-multiple-interfaces.py42
9 files changed, 195 insertions, 164 deletions
diff --git a/examples/v3arch/asyncio/agent/cmdrsp/v3-multiple-users.py b/examples/v3arch/asyncio/agent/cmdrsp/v3-multiple-users.py
index cdc264b..b0b7e5b 100644
--- a/examples/v3arch/asyncio/agent/cmdrsp/v3-multiple-users.py
+++ b/examples/v3arch/asyncio/agent/cmdrsp/v3-multiple-users.py
@@ -1,25 +1,28 @@
-#
-# Command Responder
-#
-# Listen and respond to SNMP GET/SET/GETNEXT/GETBULK queries with
-# the following options:
-#
-# * SNMPv3
-# * with USM user 'usr-md5-des', auth: MD5, priv DES or
-# with USM user 'usr-sha-none', auth: SHA, no privacy
-# with USM user 'usr-sha-aes128', auth: SHA, priv AES
-# * allow access to SNMPv2-MIB objects (1.3.6.1.2.1)
-# * over IPv4/UDP, listening at 127.0.0.1:161
-# * using asyncio network transport (available since Python 3.4)
-#
-# Either of the following Net-SNMP's commands will walk this Agent:
-#
-# $ snmpwalk -v3 -u usr-md5-des -l authPriv -A authkey1 -X privkey1 localhost .1.3.6
-# $ snmpwalk -v3 -u usr-sha-none -l authNoPriv -a SHA -A authkey1 localhost .1.3.6
-# $ snmpwalk -v3 -u usr-sha-aes128 -l authPriv -a SHA -A authkey1 -x AES -X privkey1 localhost .1.3.6
-#
-# Requires Python 3.4 and later!
-#
+"""
+Multiple SNMP USM users
++++++++++++++++++++++++
+
+Listen and respond to SNMP GET/SET/GETNEXT/GETBULK queries with
+the following options:
+
+* SNMPv3
+* with USM user:
+ - 'usr-md5-des', auth: MD5, priv DES or
+ - 'usr-sha-none', auth: SHA, no privacy
+ - 'usr-sha-aes128', auth: SHA, priv AES
+* allow access to SNMPv2-MIB objects (1.3.6.1.2.1)
+* over IPv4/UDP, listening at 127.0.0.1:161
+* using asyncio network transport (available since Python 3.4)
+
+Either of the following Net-SNMP commands will walk this Agent:
+
+| $ snmpwalk -v3 -u usr-md5-des -l authPriv -A authkey1 -X privkey1 localhost .1.3.6
+| $ snmpwalk -v3 -u usr-sha-none -l authNoPriv -a SHA -A authkey1 localhost .1.3.6
+| $ snmpwalk -v3 -u usr-sha-aes128 -l authPriv -a SHA -A authkey1 -x AES -X privkey1 localhost .1.3.6
+
+Requires Python 3.4 and later!
+
+"""#
from pysnmp.entity import engine, config
from pysnmp.entity.rfc3413 import cmdrsp, context
from pysnmp.carrier.asyncio.dgram import udp
diff --git a/examples/v3arch/asyncio/agent/ntforg/inform-v3.py b/examples/v3arch/asyncio/agent/ntforg/inform-v3.py
index 133ff05..3474495 100644
--- a/examples/v3arch/asyncio/agent/ntforg/inform-v3.py
+++ b/examples/v3arch/asyncio/agent/ntforg/inform-v3.py
@@ -1,19 +1,25 @@
-#
-# Notification Originator
-#
-# Send SNMP INFORM notification using the following options:
-#
-# * SNMPv3
-# * with user 'usr-md5-none', auth: MD5, priv NONE
-# * over IPv4/UDP
-# * using asyncio network transport (available from Python 3.4)
-# * to a Manager at 127.0.0.1:162
-# * send INFORM notification
-# * with TRAP ID 'warmStart' specified as an OID
-# * include managed object information 1.3.6.1.2.1.1.5.0 = 'system name'
-#
-# Requires Python 3.4 and later!
-#
+"""
+SNMP IMFORM notification
+++++++++++++++++++++++++
+
+Send SNMP INFORM notification using the following options:
+
+* SNMPv3
+* with user 'usr-md5-none', auth: MD5, priv NONE
+* over IPv4/UDP
+* using asyncio network transport (available from Python 3.4)
+* to a Manager at 127.0.0.1:162
+* send INFORM notification
+* with TRAP ID 'warmStart' specified as an OID
+* include managed object information 1.3.6.1.2.1.1.5.0 = 'system name'
+
+Functionally similar to:
+
+| $ snmpinform -v3 -l authPriv -u usr-md5-none -A authkey1 127.0.0.1 0 1.3.6.1.6.3.1.1.5.1 1.3.6.1.2.1.1.5.0 s 'system name'
+
+Requires Python 3.4 and later!
+
+"""#
from pysnmp.entity import engine, config
from pysnmp.entity.rfc3413 import context
from pysnmp.entity.rfc3413.asyncio import ntforg
diff --git a/examples/v3arch/asyncio/agent/ntforg/trap-v1.py b/examples/v3arch/asyncio/agent/ntforg/trap-v1.py
index 5104f90..28f8ba5 100644
--- a/examples/v3arch/asyncio/agent/ntforg/trap-v1.py
+++ b/examples/v3arch/asyncio/agent/ntforg/trap-v1.py
@@ -1,23 +1,29 @@
-#
-# Notification Originator
-#
-# Send SNMP notification using the following options:
-#
-# * SNMPv1
-# * with community name 'public'
-# * over IPv4/UDP
-# * using asyncio network transport (available from Python 3.4)
-# * to a Manager at 127.0.0.1:162
-# * send TRAP notification
-# * with TRAP ID 'coldStart' specified as an OID
-# * include managed objects information:
-# * overriding Uptime value with 12345
-# * overriding Agent Address with '127.0.0.1'
-# * overriding Enterprise OID with 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'
-#
-# Requires Python 3.4 and later!
-#
+"""
+SNMP TRAP notification
+++++++++++++++++++++++
+
+Send SNMP notification using the following options:
+
+* SNMPv1
+* with community name 'public'
+* over IPv4/UDP
+* using asyncio network transport (available from Python 3.4)
+* to a Manager at 127.0.0.1:162
+* send TRAP notification
+* with TRAP ID 'coldStart' specified as an OID
+* include managed objects information:
+* overriding Uptime value with 12345
+* overriding Agent Address with '127.0.0.1'
+* overriding Enterprise OID with 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 127.0.0.1 6 432 12345 1.3.6.1.2.1.1.1.0 s 'my system'
+
+Requires Python 3.4 and later!
+
+"""#
from pysnmp.entity import engine, config
from pysnmp.entity.rfc3413 import context
from pysnmp.entity.rfc3413.asyncio import ntforg
diff --git a/examples/v3arch/asyncio/manager/cmdgen/get-v2c-custom-timeout.py b/examples/v3arch/asyncio/manager/cmdgen/get-v2c-custom-timeout.py
index c2ef8b5..93efaba 100644
--- a/examples/v3arch/asyncio/manager/cmdgen/get-v2c-custom-timeout.py
+++ b/examples/v3arch/asyncio/manager/cmdgen/get-v2c-custom-timeout.py
@@ -1,20 +1,23 @@
-#
-# GET Command Generator
-#
-# Send a SNMP GET request
-# with SNMPv2c, community 'public'
-# using Asyncio framework for network transport
-# over IPv4/UDP
-# to an Agent at 195.218.195.228:161
-# wait 3 seconds for response, retry 5 times (plus one initial attempt)
-# for an OID in string form
-#
-# This script performs similar to the following Net-SNMP command:
-#
-# $ snmpget -v2c -c public -ObentU -r 5 -t 1 195.218.195.228 1.3.6.1.2.1.1.1.0
-#
-# Requires Python 3.4 and later!
-#
+"""
+Fetch scalar value
+++++++++++++++++++
+
+Send SNMP GET request with the following options:
+
+* with SNMPv2c, community 'public'
+* using Asyncio framework for network transport
+* over IPv4/UDP
+* to an Agent at 195.218.195.228:161
+* wait 3 seconds for response, retry 5 times (plus one initial attempt)
+* for an OID in string form
+
+This script performs similar to the following Net-SNMP command:
+
+| $ snmpget -v2c -c public -ObentU -r 5 -t 1 195.218.195.228 1.3.6.1.2.1.1.1.0
+
+Requires Python 3.4 and later!
+
+"""#
from pysnmp.carrier.asyncio.dgram import udp
from pysnmp.entity.rfc3413.asyncio import cmdgen
from pysnmp.entity import engine, config
diff --git a/examples/v3arch/asyncio/manager/cmdgen/get-v2c-over-ipv6.py b/examples/v3arch/asyncio/manager/cmdgen/get-v2c-over-ipv6.py
index e1b3171..da3a0d0 100644
--- a/examples/v3arch/asyncio/manager/cmdgen/get-v2c-over-ipv6.py
+++ b/examples/v3arch/asyncio/manager/cmdgen/get-v2c-over-ipv6.py
@@ -1,19 +1,22 @@
-#
-# GET Command Generator
-#
-# Send a SNMP GET request
-# with SNMPv2c, community 'public'
-# using Asyncio framework for network transport
-# over IPv6/UDP
-# to an Agent at [::]:161
-# for an OID in string form
-#
-# This script performs similar to the following Net-SNMP command:
-#
-# $ snmpget -v2c -c public -ObentU udp6:[::1]:161 1.3.6.1.2.1.1.1.0
-#
-# Requires Python 3.4 and later!
-#
+"""
+Fetch scalar value over IPv6
+++++++++++++++++++++++++++++
+
+Send SNMP GET request with the following options:
+
+* with SNMPv2c, community 'public'
+* using Asyncio framework for network transport
+* over IPv6/UDP
+* to an Agent at [::]:161
+* for an OID in string form
+
+This script performs similar to the following Net-SNMP command:
+
+| $ snmpget -v2c -c public -ObentU udp6:[::1]:161 1.3.6.1.2.1.1.1.0
+
+Requires Python 3.4 and later!
+
+"""#
from pysnmp.carrier.asyncio.dgram import udp6
from pysnmp.entity.rfc3413.asyncio import cmdgen
from pysnmp.entity import engine, config
diff --git a/examples/v3arch/asyncio/manager/cmdgen/getbulk-v2c.py b/examples/v3arch/asyncio/manager/cmdgen/getbulk-v2c.py
index 5cbe619..939c846 100644
--- a/examples/v3arch/asyncio/manager/cmdgen/getbulk-v2c.py
+++ b/examples/v3arch/asyncio/manager/cmdgen/getbulk-v2c.py
@@ -1,21 +1,24 @@
-#
-# GETBULK Command Generator
-#
-# Send a series of SNMP GETBULK requests
-# with SNMPv2c, community 'public'
-# using Asyncio framework for network transport
-# over IPv4/UDP
-# to an Agent at 195.218.195.228:161
-# with values non-repeaters = 0, max-repetitions = 25
-# for two OIDs in string form
-# stop on end-of-mib condition for both OIDs
-#
-# This script performs similar to the following Net-SNMP command:
-#
-# $ snmpbulkwalk -v2c -c public -C n0 -C r25 -ObentU 195.218.195.228 1.3.6.1.2.1.1 1.3.6.1.4.1.1
-#
-# Requires Python 3.4 and later!
-#
+"""
+Bulk walk MIB
++++++++++++++
+
+Send a series of SNMP GETBULK requests with the following options:
+
+* with SNMPv2c, community 'public'
+* using Asyncio framework for network transport
+* over IPv4/UDP
+* to an Agent at 195.218.195.228:161
+* with values non-repeaters = 0, max-repetitions = 25
+* for two OIDs in string form
+* stop on end-of-mib condition for both OIDs
+
+This script performs similar to the following Net-SNMP command:
+
+| $ snmpbulkwalk -v2c -c public -C n0 -C r25 -ObentU 195.218.195.228 1.3.6.1.2.1.1 1.3.6.1.4.1.1
+
+Requires Python 3.4 and later!
+
+"""#
from pysnmp.entity import engine, config
from pysnmp.proto import rfc1905
from pysnmp.entity.rfc3413.asyncio import cmdgen
diff --git a/examples/v3arch/asyncio/manager/cmdgen/getnext-v2c-from-specific-address.py b/examples/v3arch/asyncio/manager/cmdgen/getnext-v2c-from-specific-address.py
index e50eac8..10a97eb 100644
--- a/examples/v3arch/asyncio/manager/cmdgen/getnext-v2c-from-specific-address.py
+++ b/examples/v3arch/asyncio/manager/cmdgen/getnext-v2c-from-specific-address.py
@@ -1,21 +1,24 @@
-#
-# GETNEXT Command Generator
-#
-# Send a series of SNMP GETNEXT requests
-# with SNMPv2c, community 'public'
-# using Asyncio framework for network transport
-# over IPv4/UDP
-# to an Agent at 195.218.195.228:161
-# sending packets from any local interface (0.0.0.0), local port 61024
-# for two OIDs in string form
-# stop on end-of-mib condition for both OIDs
-#
-# This script performs similar to the following Net-SNMP command:
-#
-# $ snmpwalk -v2c -c public -ObentU 195.218.195.228 1.3.6.1.2.1.1 1.3.6.1.4.1.1
-#
-# Requires Python 3.4 and later!
-#
+"""
+Send packets from specific local interface
+++++++++++++++++++++++++++++++++++++++++++
+
+Send a series of SNMP GETNEXT requests with the following options:
+
+* with SNMPv2c, community 'public'
+* using Asyncio framework for network transport
+* over IPv4/UDP
+* to an Agent at 195.218.195.228:161
+* sending packets from any local interface (0.0.0.0), local port 61024
+* for two OIDs in string form
+* stop on end-of-mib condition for both OIDs
+
+This script performs similar to the following Net-SNMP command:
+
+| $ snmpwalk -v2c -c public -ObentU 195.218.195.228 1.3.6.1.2.1.1 1.3.6.1.4.1.1
+
+Requires Python 3.4 and later!
+
+"""#
from pysnmp.entity import engine, config
from pysnmp.proto import rfc1905
from pysnmp.entity.rfc3413.asyncio import cmdgen
diff --git a/examples/v3arch/asyncio/manager/cmdgen/set-v2c.py b/examples/v3arch/asyncio/manager/cmdgen/set-v2c.py
index 1e512f2..381f11a 100644
--- a/examples/v3arch/asyncio/manager/cmdgen/set-v2c.py
+++ b/examples/v3arch/asyncio/manager/cmdgen/set-v2c.py
@@ -1,20 +1,22 @@
-#
-# Command Generator
-#
-# Send SNMP SET request using the following options:
-#
-# * with SNMPv1, community 'public'
-# * using Asyncio framework for network transport
-# * over IPv4/UDP
-# * to an Agent at 195.218.195.228:161
-# * for OIDs in tuple form and an integer and string-typed values
-#
-# This script performs similar to the following Net-SNMP command:
-#
-# $ snmpset -v1 -c private -ObentU 195.218.195.228:161 1.3.6.1.2.1.1.9.1.3.1 s 'my value' 1.3.6.1.2.1.1.9.1.4.1 t 123
-#
-# Requires Python 3.4 and later!
-#
+"""
+SET string and integer scalars
+++++++++++++++++++++++++++++++
+
+Send SNMP SET request using the following options:
+
+* with SNMPv1, community 'public'
+* using Asyncio framework for network transport
+* over IPv4/UDP
+* to an Agent at 195.218.195.228:161
+* for OIDs in tuple form and an integer and string-typed values
+
+This script performs similar to the following Net-SNMP command:
+
+| $ snmpset -v1 -c private -ObentU 195.218.195.228:161 1.3.6.1.2.1.1.9.1.3.1 s 'my value' 1.3.6.1.2.1.1.9.1.4.1 t 123
+
+Requires Python 3.4 and later!
+
+"""#
from pysnmp.carrier.asyncio.dgram import udp
from pysnmp.entity.rfc3413.asyncio import cmdgen
from pysnmp.entity import engine, config
diff --git a/examples/v3arch/asyncio/manager/ntfrcv/v2c-multiple-interfaces.py b/examples/v3arch/asyncio/manager/ntfrcv/v2c-multiple-interfaces.py
index a5fa241..30dc511 100644
--- a/examples/v3arch/asyncio/manager/ntfrcv/v2c-multiple-interfaces.py
+++ b/examples/v3arch/asyncio/manager/ntfrcv/v2c-multiple-interfaces.py
@@ -1,23 +1,25 @@
-#
-# Notification Receiver
-#
-# Receive SNMP TRAP/INFORM messages with the following options:
-#
-# * SNMPv1/SNMPv2c
-# * with SNMP community "public"
-# * over IPv4/UDP, listening at 127.0.0.1:162
-# over IPv4/UDP, listening at 127.0.0.1:2162
-# * using Asyncio framework for network transport
-# * print received data on stdout
-#
-# Either of the following Net-SNMP's commands will send notifications to this
-# receiver:
-#
-# $ snmptrap -v2c -c public 127.0.0.1:162 123 1.3.6.1.6.3.1.1.5.1 1.3.6.1.2.1.1.5.0 s test
-# $ snmpinform -v2c -c public 127.0.0.1:2162 123 1.3.6.1.6.3.1.1.5.1
-#
-# Requires Python 3.4 and later!
-#
+"""
+Serving multiple network interfaces
++++++++++++++++++++++++++++++++++++
+
+Receive SNMP TRAP/INFORM messages with the following options:
+
+* SNMPv1/SNMPv2c
+* with SNMP community "public"
+* over IPv4/UDP, listening at 127.0.0.1:162
+ over IPv4/UDP, listening at 127.0.0.1:2162
+* using Asyncio framework for network transport
+* print received data on stdout
+
+Either of the following Net-SNMP commands will send notifications to this
+receiver:
+
+| $ snmptrap -v2c -c public 127.0.0.1:162 123 1.3.6.1.6.3.1.1.5.1 1.3.6.1.2.1.1.5.0 s test
+| $ snmpinform -v2c -c public 127.0.0.1:2162 123 1.3.6.1.6.3.1.1.5.1
+
+Requires Python 3.4 and later!
+
+"""#
from pysnmp.entity import engine, config
from pysnmp.carrier.asyncio.dgram import udp
from pysnmp.entity.rfc3413 import ntfrcv