summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorelie <elie>2007-05-28 17:45:42 +0000
committerelie <elie>2007-05-28 17:45:42 +0000
commit3517969eaf8fce91f9f43b19fa280e8d376f7dfb (patch)
tree5586235ee1c2eb17cda3b542eee0554d20499f50 /examples
parent27158cdded69a0171d43c0aea4b686e54a44f1d5 (diff)
downloadpysnmp-3517969eaf8fce91f9f43b19fa280e8d376f7dfb.tar.gz
explain MIB symbols in OID specification
Diffstat (limited to 'examples')
-rw-r--r--examples/v3arch/oneliner/manager/getgen.py5
-rw-r--r--examples/v3arch/oneliner/manager/withmib/nextgen.py9
2 files changed, 9 insertions, 5 deletions
diff --git a/examples/v3arch/oneliner/manager/getgen.py b/examples/v3arch/oneliner/manager/getgen.py
index 58fb13a..3b7fce8 100644
--- a/examples/v3arch/oneliner/manager/getgen.py
+++ b/examples/v3arch/oneliner/manager/getgen.py
@@ -10,7 +10,10 @@ errorIndication, errorStatus, \
# SNMP v3
# cmdgen.UsmUserData('test-user', 'authkey1', 'privkey1'),
cmdgen.UdpTransportTarget(('localhost', 161)),
- (1,3,6,1,2,1,1,1,0)
+ # Plain OID
+ (1,3,6,1,2,1,1,1,0),
+ # ((mib-name, mib-symbol), instance-id)
+ (('SNMPv2-MIB', 'sysObjectID'), 0)
)
if errorIndication:
diff --git a/examples/v3arch/oneliner/manager/withmib/nextgen.py b/examples/v3arch/oneliner/manager/withmib/nextgen.py
index c7569a2..1276ce7 100644
--- a/examples/v3arch/oneliner/manager/withmib/nextgen.py
+++ b/examples/v3arch/oneliner/manager/withmib/nextgen.py
@@ -1,6 +1,7 @@
# GETNEXT Commnd Generator with MIB resolution
import string
from pysnmp.entity.rfc3413.oneliner import cmdgen
+from pysnmp.entity.rfc3413 import mibvar
cmdGen = cmdgen.CommandGenerator()
@@ -34,12 +35,12 @@ else:
else:
for varBindTableRow in varBindTable:
for oid, val in varBindTableRow:
- (symName, modName), indices = cmdgen.mibvar.oidToMibName(
+ (symName, modName), indices = mibvar.oidToMibName(
cmdGen.mibViewController, oid
)
- val = cmdgen.mibvar.cloneFromMibValue(
- cmdGen.mibViewController, modName, symName, val
- )
+ val = mibvar.cloneFromMibValue(
+ cmdGen.mibViewController, modName, symName, val
+ )
print '%s::%s.%s = %s' % (
modName, symName,
string.join(map(lambda v: v.prettyPrint(), indices), '.'),