summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelie <elie>2013-09-30 21:10:52 +0000
committerelie <elie>2013-09-30 21:10:52 +0000
commit312f01e03fdcf555be507725b75d54fb946f4abd (patch)
tree5c5a17c47e11346ab6f75c77018dc3112f75a402
parent6c2c109f9053195099b881838776f61ff1d912d3 (diff)
downloadpysnmp-312f01e03fdcf555be507725b75d54fb946f4abd.tar.gz
examples adjusted to work with fixed-EngineID SNMP simulator
-rw-r--r--examples/v3arch/manager/cmdgen/get-v3-custom-context.py11
-rw-r--r--examples/v3arch/manager/cmdgen/set-v1.py2
-rw-r--r--examples/v3arch/manager/cmdgen/set-v2c.py2
-rw-r--r--examples/v3arch/oneliner/manager/cmdgen/set-v3-with-custom-contextengineid-and-contextname.py8
-rw-r--r--examples/v3arch/oneliner/manager/cmdgen/set-v3-with-custom-contextengineid.py7
5 files changed, 17 insertions, 13 deletions
diff --git a/examples/v3arch/manager/cmdgen/get-v3-custom-context.py b/examples/v3arch/manager/cmdgen/get-v3-custom-context.py
index b0ce65c..7a863d6 100644
--- a/examples/v3arch/manager/cmdgen/get-v3-custom-context.py
+++ b/examples/v3arch/manager/cmdgen/get-v3-custom-context.py
@@ -3,15 +3,16 @@
#
# Send a SNMP GET request
# with SNMPv3 with user 'usr-md5-none', SHA auth and no privacy protocols
-# for MIB instance identified by contextEngineId: 8000000001020304,
-# contextName: my-context
+# for MIB instance identified by
+# contextEngineId: 0x80004fb805636c6f75644dab22cc,
+# contextName: da761cfc8c94d3aceef4f60f049105ba
# over IPv4/UDP
# to an Agent at 195.218.195.228:161
# for an OID in tuple form
#
# This script performs similar to the following Net-SNMP command:
#
-# $ snmpget -v3 -l authNoPriv -u usr-md5-none -A authkey1 -E 8000000001020304 -n my-context -ObentU 195.218.195.228:161 1.3.6.1.2.1.1.1.0
+# $ snmpget -v3 -l authNoPriv -u usr-md5-none -A authkey1 -E 80004fb805636c6f75644dab22cc -n da761cfc8c94d3aceef4f60f049105ba -ObentU 195.218.195.228:161 1.3.6.1.2.1.1.1.0
#
from pysnmp.entity import engine, config
from pysnmp.carrier.asynsock.dgram import udp
@@ -71,8 +72,8 @@ cmdgen.GetCommandGenerator().sendReq(
'my-router',
( ((1,3,6,1,2,1,1,1,0), None), ),
cbFun,
- contextEngineId=rfc1902.OctetString(hexValue='8000000001020304'),
- contextName=rfc1902.OctetString('my-context')
+ contextEngineId=rfc1902.OctetString(hexValue='80004fb805636c6f75644dab22cc'),
+ contextName=rfc1902.OctetString('da761cfc8c94d3aceef4f60f049105ba')
)
# Run I/O dispatcher which would send pending queries and process responses
diff --git a/examples/v3arch/manager/cmdgen/set-v1.py b/examples/v3arch/manager/cmdgen/set-v1.py
index 2036540..c64b0fe 100644
--- a/examples/v3arch/manager/cmdgen/set-v1.py
+++ b/examples/v3arch/manager/cmdgen/set-v1.py
@@ -69,7 +69,7 @@ cmdgen.SetCommandGenerator().sendReq(
snmpEngine,
'my-router',
( ((1,3,6,1,2,1,1,9,1,3,1), rfc1902.OctetString('my value')),
- ((1,3,6,1,2,1,1,9,1,4,1), rfc1902.Integer(123)) ),
+ ((1,3,6,1,2,1,1,9,1,4,1), rfc1902.TimeTicks(123)) ),
cbFun
)
diff --git a/examples/v3arch/manager/cmdgen/set-v2c.py b/examples/v3arch/manager/cmdgen/set-v2c.py
index 5e6cbfc..d004433 100644
--- a/examples/v3arch/manager/cmdgen/set-v2c.py
+++ b/examples/v3arch/manager/cmdgen/set-v2c.py
@@ -66,7 +66,7 @@ def cbFun(sendRequestHandle,
cmdgen.SetCommandGenerator().sendReq(
snmpEngine,
'my-router',
- ( ((1,3,6,1,2,1,1,9,1,4,1), rfc1902.Integer(123)), ),
+ ( ((1,3,6,1,2,1,1,9,1,4,1), rfc1902.TimeTicks(123)), ),
cbFun
)
diff --git a/examples/v3arch/oneliner/manager/cmdgen/set-v3-with-custom-contextengineid-and-contextname.py b/examples/v3arch/oneliner/manager/cmdgen/set-v3-with-custom-contextengineid-and-contextname.py
index 2aa6407..e273bba 100644
--- a/examples/v3arch/oneliner/manager/cmdgen/set-v3-with-custom-contextengineid-and-contextname.py
+++ b/examples/v3arch/oneliner/manager/cmdgen/set-v3-with-custom-contextengineid-and-contextname.py
@@ -7,8 +7,8 @@
# * over IPv4/UDP
# * to an Agent at demo.snmplabs.com:161
# * addressing particular set of Managed Objects at remote SNMP Engine by:
-# * contextEngineId 0x8000000001020304 and
-# * contextName 'my-context'
+# * contextEngineId 0x80004fb805636c6f75644dab22cc and
+# * contextName 'a172334d7d97871b72241397f713fa12'
# * setting SNMPv2-MIB::sysName.0 to new value (type taken from MIB)
#
from pysnmp.entity.rfc3413.oneliner import cmdgen
@@ -20,8 +20,8 @@ errorIndication, errorStatus, errorIndex, varBinds = cmdGen.setCmd(
cmdgen.UsmUserData('usr-md5-none', 'authkey1'),
cmdgen.UdpTransportTarget(('demo.snmplabs.com', 161)),
(cmdgen.MibVariable('SNMPv2-MIB', 'sysORDescr', 1), 'new system name'),
- contextEngineId=rfc1902.OctetString(hexValue='8000000001020304'),
- contextName='my-context'
+ contextEngineId=rfc1902.OctetString(hexValue='80004fb805636c6f75644dab22cc'),
+ contextName='da761cfc8c94d3aceef4f60f049105ba'
)
# Check for errors and print out results
diff --git a/examples/v3arch/oneliner/manager/cmdgen/set-v3-with-custom-contextengineid.py b/examples/v3arch/oneliner/manager/cmdgen/set-v3-with-custom-contextengineid.py
index 8a5242f..04ee0bf 100644
--- a/examples/v3arch/oneliner/manager/cmdgen/set-v3-with-custom-contextengineid.py
+++ b/examples/v3arch/oneliner/manager/cmdgen/set-v3-with-custom-contextengineid.py
@@ -4,7 +4,8 @@
# Send SNMP GET request using the following options:
#
# * with SNMPv3 with user 'usr-md5-des', MD5 auth and DES privacy protocols
-# * use remote SNMP Engine ID 0x8000000004030201 (USM autodiscovery will run)
+# * use remote SNMP Engine ID 0x80004fb805636c6f75644dab22cc (USM
+# autodiscovery will run)
# * over IPv4/UDP
# * to an Agent at demo.snmplabs.com:161
# * setting SNMPv2-MIB::sysName.0 to new value (type taken from MIB)
@@ -17,7 +18,9 @@ cmdGen = cmdgen.CommandGenerator()
errorIndication, errorStatus, errorIndex, varBinds = cmdGen.setCmd(
cmdgen.UsmUserData(
'usr-md5-des', 'authkey1', 'privkey1',
- securityEngineId=rfc1902.OctetString(hexValue='8000000004030201')
+ securityEngineId=rfc1902.OctetString(
+ hexValue='80004fb805636c6f75644dab22cc'
+ )
),
cmdgen.UdpTransportTarget(('demo.snmplabs.com', 161)),
(cmdgen.MibVariable('SNMPv2-MIB', 'sysORDescr', 1), 'new system name'),