diff options
author | elie <elie> | 2013-09-30 21:10:52 +0000 |
---|---|---|
committer | elie <elie> | 2013-09-30 21:10:52 +0000 |
commit | 0f190c6a3817c5d0c4e38430a4e4714aa30063f1 (patch) | |
tree | e19fbd27f8726ad2cdd77f317592993f0e789b53 | |
parent | 088bd1af9ba351f1f229fa56c7f7bcc93be68c23 (diff) | |
download | pysnmp-git-0f190c6a3817c5d0c4e38430a4e4714aa30063f1.tar.gz |
examples adjusted to work with fixed-EngineID SNMP simulator
5 files changed, 17 insertions, 13 deletions
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/custom-contextengineid-and-contextname.py b/examples/hlapi/asyncore/sync/manager/cmdgen/custom-contextengineid-and-contextname.py index 2aa6407f..e273bba6 100644 --- a/examples/hlapi/asyncore/sync/manager/cmdgen/custom-contextengineid-and-contextname.py +++ b/examples/hlapi/asyncore/sync/manager/cmdgen/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/hlapi/asyncore/sync/manager/cmdgen/custom-contextengineid.py b/examples/hlapi/asyncore/sync/manager/cmdgen/custom-contextengineid.py index 8a5242fd..04ee0bf5 100644 --- a/examples/hlapi/asyncore/sync/manager/cmdgen/custom-contextengineid.py +++ b/examples/hlapi/asyncore/sync/manager/cmdgen/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'), diff --git a/examples/v3arch/asyncore/manager/cmdgen/custom-contextengineid-and-contextname.py b/examples/v3arch/asyncore/manager/cmdgen/custom-contextengineid-and-contextname.py index b0ce65cd..7a863d6c 100644 --- a/examples/v3arch/asyncore/manager/cmdgen/custom-contextengineid-and-contextname.py +++ b/examples/v3arch/asyncore/manager/cmdgen/custom-contextengineid-and-contextname.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/asyncore/manager/cmdgen/set-multiple-scalar-values.py b/examples/v3arch/asyncore/manager/cmdgen/set-multiple-scalar-values.py index 20365405..c64b0fe1 100644 --- a/examples/v3arch/asyncore/manager/cmdgen/set-multiple-scalar-values.py +++ b/examples/v3arch/asyncore/manager/cmdgen/set-multiple-scalar-values.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/asyncore/manager/cmdgen/v2c-set.py b/examples/v3arch/asyncore/manager/cmdgen/v2c-set.py index 5e6cbfc7..d004433f 100644 --- a/examples/v3arch/asyncore/manager/cmdgen/v2c-set.py +++ b/examples/v3arch/asyncore/manager/cmdgen/v2c-set.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 ) |