Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update runtests.sh #1

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@ jobs:
- name: Test with runtests.sh
run: |
pip install -U pysnmp
pip install -U pysnmp-mibs
pip install --force-reinstall pysnmp-mibs
./runtests.sh
4 changes: 2 additions & 2 deletions examples/hlapi/v1arch/asyncio/agent/ntforg/default-v1-trap.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,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 \
| $ snmptrap -v1 -c public demo-snmp.thola.io 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"

"""#
Expand All @@ -33,7 +33,7 @@ def run():
iterator = sendNotification(
snmpDispatcher,
CommunityData('public', mpModel=0),
UdpTransportTarget(('demo.snmplabs.com', 162)),
UdpTransportTarget(('demo-snmp.thola.io', 162)),
'trap',
NotificationType(
ObjectIdentity('1.3.6.1.6.3.1.1.5.2')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

Functionally similar to:

| $ snmptrap -v2c -c public demo.snmplabs.com 12345 1.3.6.1.6.3.1.1.5.2
| $ snmpinform -v2c -c public demo.snmplabs.com 12345 1.3.6.1.6.3.1.1.5.2
| $ snmptrap -v2c -c public demo-snmp.thola.io 12345 1.3.6.1.6.3.1.1.5.2
| $ snmpinform -v2c -c public demo-snmp.thola.io 12345 1.3.6.1.6.3.1.1.5.2

"""#
import asyncio
Expand Down Expand Up @@ -54,7 +54,7 @@ def sendone(snmpDispatcher, hostname, notifyType):
loop = asyncio.get_event_loop()
loop.run_until_complete(
asyncio.wait(
[sendone(snmpDispatcher, 'demo.snmplabs.com', 'trap'),
sendone(snmpDispatcher, 'demo.snmplabs.com', 'inform')]
[sendone(snmpDispatcher, 'demo-snmp.thola.io', 'trap'),
sendone(snmpDispatcher, 'demo-snmp.thola.io', 'inform')]
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@

* with SNMPv2c, community 'public'
* over IPv4/UDP
* to an Agent at demo.snmplabs.com:161
* to an Agent at demo-snmp.thola.io:161
* for all OIDs past SNMPv2-MIB::system
* run till end-of-mib condition is reported by Agent
* based on asyncio I/O framework

Functionally similar to:

| $ snmpbulkwalk -v2c -c public -Cn0 -Cr50 \
| demo.snmplabs.com SNMPv2-MIB::system
| demo-snmp.thola.io SNMPv2-MIB::system

"""#
import asyncio
Expand All @@ -31,7 +31,7 @@ def run(varBinds):
iterator = bulkCmd(
snmpDispatcher,
CommunityData('public'),
UdpTransportTarget(('demo.snmplabs.com', 161)),
UdpTransportTarget(('demo-snmp.thola.io', 161)),
0, 50,
*varBinds
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@

* with SNMPv2c, community 'public'
* over IPv4/UDP
* to multiple Agents at demo.snmplabs.com
* to multiple Agents at demo-snmp.thola.io
* for instance of SNMPv2-MIB::sysDescr.0 MIB object
* based on asyncio I/O framework

Functionally similar to:

| $ snmpget -v2c -c public demo.snmplabs.com:1161 SNMPv2-MIB::sysDescr.0
| $ snmpget -v2c -c public demo.snmplabs.com:2161 SNMPv2-MIB::sysDescr.0
| $ snmpget -v2c -c public demo.snmplabs.com:3161 SNMPv2-MIB::sysDescr.0
| $ snmpget -v2c -c public demo-snmp.thola.io:1161 SNMPv2-MIB::sysDescr.0
| $ snmpget -v2c -c public demo-snmp.thola.io:2161 SNMPv2-MIB::sysDescr.0
| $ snmpget -v2c -c public demo-snmp.thola.io:3161 SNMPv2-MIB::sysDescr.0

"""#
import asyncio
Expand Down Expand Up @@ -53,8 +53,8 @@ def getone(snmpDispatcher, hostname):
loop = asyncio.get_event_loop()
loop.run_until_complete(
asyncio.wait(
[getone(snmpDispatcher, ('demo.snmplabs.com', 1161)),
getone(snmpDispatcher, ('demo.snmplabs.com', 2161)),
getone(snmpDispatcher, ('demo.snmplabs.com', 3161))]
[getone(snmpDispatcher, ('demo-snmp.thola.io', 1161)),
getone(snmpDispatcher, ('demo-snmp.thola.io', 2161)),
getone(snmpDispatcher, ('demo-snmp.thola.io', 3161))]
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@

* with SNMPv2c, community 'public'
* over IPv4/UDP
* to multiple Agents at demo.snmplabs.com
* to multiple Agents at demo-snmp.thola.io
* for instance of SNMPv2-MIB::sysDescr.0 MIB object
* based on asyncio I/O framework

Functionally similar to:

| $ snmpget -v2c -c public demo.snmplabs.com:1161 SNMPv2-MIB::sysDescr.0
| $ snmpget -v2c -c public demo.snmplabs.com:2161 SNMPv2-MIB::sysDescr.0
| $ snmpget -v2c -c public demo.snmplabs.com:3161 SNMPv2-MIB::sysDescr.0
| $ snmpget -v2c -c public demo-snmp.thola.io:1161 SNMPv2-MIB::sysDescr.0
| $ snmpget -v2c -c public demo-snmp.thola.io:2161 SNMPv2-MIB::sysDescr.0
| $ snmpget -v2c -c public demo-snmp.thola.io:3161 SNMPv2-MIB::sysDescr.0

"""#
import asyncio
Expand Down Expand Up @@ -61,9 +61,9 @@ def getall(snmpDispatcher, hostnames):
loop.run_until_complete(
getall(
snmpDispatcher, [
('demo.snmplabs.com', 1161),
('demo.snmplabs.com', 2161),
('demo.snmplabs.com', 3161)
('demo-snmp.thola.io', 1161),
('demo-snmp.thola.io', 2161),
('demo-snmp.thola.io', 3161)
]
)
)
6 changes: 3 additions & 3 deletions examples/hlapi/v1arch/asyncio/manager/cmdgen/v1-get.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@

* with SNMPv1, community 'public'
* over IPv4/UDP
* to an Agent at demo.snmplabs.com:161
* to an Agent at demo-snmp.thola.io:161
* for the 1.3.6.1.2.1.1.1.0 OID (e.g. SNMPv2-MIB::sysDescr.0 MIB object)
* Based on asyncio I/O framework

Functionally similar to:

| $ snmpget -v1 -c public demo.snmplabs.com SNMPv2-MIB::sysDescr.0
| $ snmpget -v1 -c public demo-snmp.thola.io SNMPv2-MIB::sysDescr.0

"""#
import asyncio
Expand All @@ -27,7 +27,7 @@ def run():
iterator = getCmd(
snmpDispatcher,
CommunityData('public', mpModel=0),
UdpTransportTarget(('demo.snmplabs.com', 161)),
UdpTransportTarget(('demo-snmp.thola.io', 161)),
('1.3.6.1.2.1.1.1.0', None)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,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"
| $ snmptrap -v1 -c public demo-snmp.thola.io 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 *
Expand All @@ -32,7 +32,7 @@ def cbFun(errorIndication, errorStatus, errorIndex, varBinds, **context):
sendNotification(
snmpDispatcher,
CommunityData('public', mpModel=0),
UdpTransportTarget(('demo.snmplabs.com', 162)),
UdpTransportTarget(('demo-snmp.thola.io', 162)),
'trap',
# SNMPv2-MIB::sysUpTime.0 = 12345
('1.3.6.1.2.1.1.3.0', TimeTicks(12345)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

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"
| $ snmptrap -v2c -c public demo-snmp.thola.io 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 *
Expand All @@ -30,7 +30,7 @@ def cbFun(errorIndication, errorStatus, errorIndex, varBinds, **context):
sendNotification(
snmpDispatcher,
CommunityData('public'),
UdpTransportTarget(('demo.snmplabs.com', 162)),
UdpTransportTarget(('demo-snmp.thola.io', 162)),
'trap',
# SNMPv2-MIB::sysUpTime.0 = 12345
('1.3.6.1.2.1.1.3.0', TimeTicks(12345)),
Expand Down
4 changes: 2 additions & 2 deletions examples/hlapi/v1arch/asyncore/agent/ntforg/v2c-inform.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

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"
| $ snmpinform -v2c -c public demo-snmp.thola.io 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 *
Expand All @@ -37,7 +37,7 @@ def cbFun(errorIndication, errorStatus, errorIndex, varBinds, **context):
sendNotification(
snmpDispatcher,
CommunityData('public'),
UdpTransportTarget(('demo.snmplabs.com', 162)),
UdpTransportTarget(('demo-snmp.thola.io', 162)),
'inform',
# SNMPv2-MIB::sysUpTime.0 = 12345
('1.3.6.1.2.1.1.3.0', TimeTicks(12345)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

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"
| $ snmptrap -v2c -c public demo-snmp.thola.io 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 *
Expand All @@ -38,7 +38,7 @@ def cbFun(errorIndication, errorStatus, errorIndex, varBinds, **context):
sendNotification(
snmpDispatcher,
CommunityData('public'),
UdpTransportTarget(('demo.snmplabs.com', 162)),
UdpTransportTarget(('demo-snmp.thola.io', 162)),
'trap',
# SNMPv2-MIB::sysUpTime.0 = 12345
('1.3.6.1.2.1.1.3.0', TimeTicks(12345)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
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-snmp.thola.io:161 and
to an Agent at [::1]:161
* for instances of SNMPv2-MIB::system
SNMPv2-MIB::sysLocation.0 MIB objects
Expand All @@ -22,13 +22,13 @@
TARGETS = (
# 1-st target (SNMPv1 over IPv4/UDP)
(CommunityData('public', mpModel=0),
UdpTransportTarget(('demo.snmplabs.com', 161)),
UdpTransportTarget(('demo-snmp.thola.io', 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)),
UdpTransportTarget(('demo-snmp.thola.io', 161)),
(ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysDescr', 0)),
ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysLocation', 0)))),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
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-snmp.thola.io:161 and
to an Agent at [::1]:161
* pull MIB variables till EOM
* Enable MIB lookup feature
Expand All @@ -22,13 +22,13 @@
TARGETS = (
# 1-st target (SNMPv1 over IPv4/UDP)
(CommunityData('public', mpModel=0),
UdpTransportTarget(('demo.snmplabs.com', 161)),
UdpTransportTarget(('demo-snmp.thola.io', 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)),
UdpTransportTarget(('demo-snmp.thola.io', 161)),
(ObjectType(ObjectIdentity('1.3.6.1.4.1')),)),

# 3-th target (SNMPv3 over IPv6/UDP)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

* with SNMPv2c, community 'public'
* over IPv4/UDP
* to an Agent at demo.snmplabs.com:161
* to an Agent at demo-snmp.thola.io: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
| $ snmpwalk -v2c -c public demo-snmp.thola.io 1.3.6.1.4.1
"""#
from pysnmp.hlapi.v1arch.asyncore import *

Expand All @@ -37,7 +37,7 @@ def cbFun(errorIndication, errorStatus, errorIndex, varBindTable, **context):
# Submit initial GETBULK request
bulkCmd(snmpDispatcher,
CommunityData('public'),
UdpTransportTarget(('demo.snmplabs.com', 161)),
UdpTransportTarget(('demo-snmp.thola.io', 161)),
0, 25,
('1.3.6.1.4.1', None),
cbFun=cbFun)
Expand Down
6 changes: 3 additions & 3 deletions examples/hlapi/v1arch/asyncore/manager/cmdgen/v1-getnext.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

* with SNMPv1, community 'public'
* over IPv4/UDP
* to an Agent at demo.snmplabs.com:161
* to an Agent at demo-snmp.thola.io: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
| $ snmpwalk -v1 -c public demo-snmp.thola.io 1.3.6.1.2.1.1

"""#

Expand Down Expand Up @@ -41,7 +41,7 @@ def cbFun(errorIndication, errorStatus, errorIndex, varBindTable, **context):
stateHandle = nextCmd(
snmpDispatcher,
CommunityData('public', mpModel=0),
UdpTransportTarget(('demo.snmplabs.com', 161)),
UdpTransportTarget(('demo-snmp.thola.io', 161)),
('1.3.6.1.5.1.1', None),
cbFun=cbFun
)
Expand Down
6 changes: 3 additions & 3 deletions examples/hlapi/v1arch/asyncore/manager/cmdgen/v2c-get.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

* with SNMPv2c, community 'public'
* over IPv4/UDP
* to an Agent at demo.snmplabs.com:161
* to an Agent at demo-snmp.thola.io: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
| $ snmpget -v2c -c public demo-snmp.thola.io 1.3.6.1.2.1.1.1.0

"""#

Expand All @@ -36,7 +36,7 @@ def cbFun(errorIndication, errorStatus, errorIndex, varBinds, **context):
stateHandle = getCmd(
snmpDispatcher,
CommunityData('public'),
UdpTransportTarget(('demo.snmplabs.com', 161)),
UdpTransportTarget(('demo-snmp.thola.io', 161)),
('1.3.6.1.2.1.1.1.0', None),
cbFun=cbFun
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@

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"
| $ snmptrap -v1 -c public demo-snmp.thola.io 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 *

iterator = sendNotification(
SnmpDispatcher(),
CommunityData('public', mpModel=0),
UdpTransportTarget(('demo.snmplabs.com', 162)),
UdpTransportTarget(('demo-snmp.thola.io', 162)),
'trap',
# SNMPv2-MIB::sysUpTime.0 = 12345
('1.3.6.1.2.1.1.3.0', TimeTicks(12345)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@

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"
| $ snmptrap -v2c -c public demo-snmp.thola.io 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 *

iterator = sendNotification(
SnmpDispatcher(),
CommunityData('public'),
UdpTransportTarget(('demo.snmplabs.com', 162)),
UdpTransportTarget(('demo-snmp.thola.io', 162)),
'trap',
# SNMPv2-MIB::sysUpTime.0 = 12345
('1.3.6.1.2.1.1.3.0', TimeTicks(12345)),
Expand Down
Loading