summaryrefslogtreecommitdiff
path: root/examples/hlapi
diff options
context:
space:
mode:
authorelie <elie>2015-05-31 19:35:10 +0000
committerelie <elie>2015-05-31 19:35:10 +0000
commit27c1c8ef97a43f5b6446f09400d0a941564ffbcf (patch)
tree779d7ed0f6e11b93d6628d62c94b3858c027fe93 /examples/hlapi
parentcbcda159023cd6101328713ba2b6fe5c2a4ed1c7 (diff)
downloadpysnmp-git-27c1c8ef97a43f5b6446f09400d0a941564ffbcf.tar.gz
Major overhaul related to PySMI integration and Standard SNMP Applications
API redesign: * MibVariable becomes ObjectIdentity and moves to pysnmp.smi.rfc1902 * ObjectType and NotificationType classes resempling corresponding MIB MACROs implemented * SNMP Standard Applications and examples modified to support ObjectType and NotificationType parameters
Diffstat (limited to 'examples/hlapi')
-rw-r--r--examples/hlapi/asyncore/agent/ntforg/multiple-informs-at-once.py21
-rw-r--r--examples/hlapi/asyncore/agent/ntforg/multiple-traps-at-once.py23
-rw-r--r--examples/hlapi/asyncore/agent/ntforg/running-multiple-snmp-engines-at-once.py21
-rw-r--r--examples/hlapi/asyncore/manager/cmdgen/multiple-concurrent-queries.py20
-rw-r--r--examples/hlapi/asyncore/manager/cmdgen/pull-mibs-from-multiple-agents-at-once.py4
-rw-r--r--examples/hlapi/asyncore/manager/cmdgen/query-multiple-snmp-engines.py12
-rw-r--r--examples/hlapi/asyncore/sync/agent/ntforg/custom-contextengineid.py8
-rw-r--r--examples/hlapi/asyncore/sync/agent/ntforg/custom-contextname.py9
-rw-r--r--examples/hlapi/asyncore/sync/agent/ntforg/custom-v1-trap.py16
-rw-r--r--examples/hlapi/asyncore/sync/agent/ntforg/default-v1-trap.py9
-rw-r--r--examples/hlapi/asyncore/sync/agent/ntforg/send-notification-with-additional-varbinds.py7
-rw-r--r--examples/hlapi/asyncore/sync/agent/ntforg/v2c-trap-via-notification-type.py3
-rw-r--r--examples/hlapi/asyncore/sync/agent/ntforg/v3-inform.py7
-rw-r--r--examples/hlapi/asyncore/sync/agent/ntforg/v3-trap.py4
-rw-r--r--examples/hlapi/asyncore/sync/manager/cmdgen/coerce-set-value-to-mib-spec.py5
-rw-r--r--examples/hlapi/asyncore/sync/manager/cmdgen/custom-asn1-mib-search-path.py34
-rw-r--r--examples/hlapi/asyncore/sync/manager/cmdgen/custom-contextengineid-and-contextname.py5
-rw-r--r--examples/hlapi/asyncore/sync/manager/cmdgen/custom-contextengineid.py5
-rw-r--r--examples/hlapi/asyncore/sync/manager/cmdgen/custom-pysnmp-mibs-search-path.py2
-rw-r--r--examples/hlapi/asyncore/sync/manager/cmdgen/fetch-variables-over-ipv6.py4
-rw-r--r--examples/hlapi/asyncore/sync/manager/cmdgen/get-table-object-by-index.py2
-rw-r--r--examples/hlapi/asyncore/sync/manager/cmdgen/get-table-object-by-multiple-indices.py2
-rw-r--r--examples/hlapi/asyncore/sync/manager/cmdgen/getbulk-fetch-scalar-and-table-variables.py4
-rw-r--r--examples/hlapi/asyncore/sync/manager/cmdgen/getnext-limit-number-of-variables.py2
-rw-r--r--examples/hlapi/asyncore/sync/manager/cmdgen/preload-pysnmp-mibs.py2
-rw-r--r--examples/hlapi/asyncore/sync/manager/cmdgen/pull-whole-mib.py2
-rw-r--r--examples/hlapi/asyncore/sync/manager/cmdgen/pull-whole-snmp-table.py10
-rw-r--r--examples/hlapi/asyncore/sync/manager/cmdgen/query-agents-from-multuple-threads.py20
-rw-r--r--examples/hlapi/asyncore/sync/manager/cmdgen/usm-md5-none.py2
-rw-r--r--examples/hlapi/asyncore/sync/manager/cmdgen/v1-get.py4
30 files changed, 161 insertions, 108 deletions
diff --git a/examples/hlapi/asyncore/agent/ntforg/multiple-informs-at-once.py b/examples/hlapi/asyncore/agent/ntforg/multiple-informs-at-once.py
index a19bc117..fc4a3582 100644
--- a/examples/hlapi/asyncore/agent/ntforg/multiple-informs-at-once.py
+++ b/examples/hlapi/asyncore/agent/ntforg/multiple-informs-at-once.py
@@ -12,19 +12,19 @@
# * include managed object information specified as var-bind objects pair
#
from pysnmp.entity.rfc3413.oneliner import ntforg
-from pysnmp.entity.rfc3413 import context
from pysnmp.entity import engine
-from pysnmp.proto import rfc1902
# List of targets in the followin format:
# ( ( authData, transportTarget ), ... )
targets = (
# 1-st target (SNMPv2c over IPv4/UDP)
( ntforg.CommunityData('public'),
- ntforg.UdpTransportTarget(('localhost', 162)) ),
+ ntforg.UdpTransportTarget(('localhost', 162)),
+ ntforg.ContextData() ),
# 2-nd target (SNMPv3 over IPv4/UDP)
( ntforg.UsmUserData('usr-md5-des', 'authkey1', 'privkey1'),
- ntforg.UdpTransportTarget(('localhost', 162)) )
+ ntforg.UdpTransportTarget(('localhost', 162)),
+ ntforg.ContextData() ),
)
def cbFun(snmpEngine, sendRequestHandle, errorIndication,
@@ -43,17 +43,16 @@ snmpEngine = engine.SnmpEngine()
ntfOrg = ntforg.AsyncNotificationOriginator()
-for authData, transportTarget in targets:
+for authData, transportTarget, contextData in targets:
sendPduHandle = ntfOrg.sendNotification(
snmpEngine,
authData,
transportTarget,
- context.SnmpContext(snmpEngine),
- ntforg.null,
- 'inform',
- ntforg.MibVariable('SNMPv2-MIB', 'coldStart'),
- ( ( rfc1902.ObjectName('1.3.6.1.2.1.1.1.0'),
- rfc1902.OctetString('my name') ), ),
+ contextData,
+ 'inform', # NotifyType
+ ntforg.NotificationType(
+ ntforg.ObjectIdentity('SNMPv2-MIB', 'coldStart')
+ ).addVarBinds( ( '1.3.6.1.2.1.1.1.0', 'my name' ) ),
cbInfo=(cbFun, None)
)
diff --git a/examples/hlapi/asyncore/agent/ntforg/multiple-traps-at-once.py b/examples/hlapi/asyncore/agent/ntforg/multiple-traps-at-once.py
index a075fdaa..c9e955e9 100644
--- a/examples/hlapi/asyncore/agent/ntforg/multiple-traps-at-once.py
+++ b/examples/hlapi/asyncore/agent/ntforg/multiple-traps-at-once.py
@@ -12,7 +12,6 @@
# * include managed object information specified as var-bind objects pair
#
from pysnmp.entity.rfc3413.oneliner import ntforg
-from pysnmp.entity.rfc3413 import context
from pysnmp.entity import engine
from pysnmp.proto import rfc1902
@@ -21,27 +20,31 @@ from pysnmp.proto import rfc1902
targets = (
# 1-st target (SNMPv1 over IPv4/UDP)
( ntforg.CommunityData('public', mpModel=0),
- ntforg.UdpTransportTarget(('localhost', 162)) ),
+ ntforg.UdpTransportTarget(('localhost', 162)),
+ ntforg.ContextData() ),
# 2-nd target (SNMPv2c over IPv4/UDP)
( ntforg.CommunityData('public'),
- ntforg.UdpTransportTarget(('localhost', 162)) )
+ ntforg.UdpTransportTarget(('localhost', 162)),
+ ntforg.ContextData() ),
)
snmpEngine = engine.SnmpEngine()
ntfOrg = ntforg.AsyncNotificationOriginator()
-for authData, transportTarget in targets:
+for authData, transportTarget, contextData in targets:
ntfOrg.sendNotification(
snmpEngine,
authData,
transportTarget,
- context.SnmpContext(snmpEngine),
- ntforg.null,
- 'trap',
- ntforg.MibVariable('SNMPv2-MIB', 'coldStart'),
- ( ( rfc1902.ObjectName('1.3.6.1.2.1.1.1.0'),
- rfc1902.OctetString('my name') ), )
+ contextData,
+ 'trap', # NotifyType
+ ntforg.NotificationType(
+ ntforg.ObjectIdentity('SNMPv2-MIB', 'coldStart')
+ ).addVarBinds(
+ ( rfc1902.ObjectName('1.3.6.1.2.1.1.1.0'),
+ rfc1902.OctetString('my name') )
+ )
)
snmpEngine.transportDispatcher.runDispatcher()
diff --git a/examples/hlapi/asyncore/agent/ntforg/running-multiple-snmp-engines-at-once.py b/examples/hlapi/asyncore/agent/ntforg/running-multiple-snmp-engines-at-once.py
index 088b72b9..2dfbc55a 100644
--- a/examples/hlapi/asyncore/agent/ntforg/running-multiple-snmp-engines-at-once.py
+++ b/examples/hlapi/asyncore/agent/ntforg/running-multiple-snmp-engines-at-once.py
@@ -26,19 +26,19 @@
#
from pysnmp.entity.rfc3413.oneliner import ntforg
from pysnmp.entity import engine
-from pysnmp.entity.rfc3413 import context
from pysnmp.carrier.asynsock.dispatch import AsynsockDispatcher
-from pysnmp.proto import rfc1902
# List of targets in the following format:
# ( ( authData, transportTarget ), ... )
targets = (
# 1-st target (SNMPv2c over IPv4/UDP)
( ntforg.CommunityData('public'),
- ntforg.UdpTransportTarget(('localhost', 1162)) ),
+ ntforg.UdpTransportTarget(('localhost', 1162)),
+ ntforg.ContextData() ),
# 2-nd target (SNMPv3 over IPv4/UDP)
( ntforg.UsmUserData('usr-md5-des', 'authkey1', 'privkey1'),
- ntforg.UdpTransportTarget(('localhost', 162)) )
+ ntforg.UdpTransportTarget(('localhost', 162)),
+ ntforg.ContextData() ),
)
def cbFun(snmpEngine, sendRequestHandle, errorIndication,
@@ -69,19 +69,18 @@ snmpEngineB.registerTransportDispatcher(transportDispatcher, 'B')
ntfOrg = ntforg.AsyncNotificationOriginator()
-for authData, transportTarget in targets:
+for authData, transportTarget, contextData in targets:
snmpEngine = transportTarget.getTransportInfo()[1][1] % 3 and \
snmpEngineA or snmpEngineB
sendPduHandle = ntfOrg.sendNotification(
snmpEngine,
authData,
transportTarget,
- context.SnmpContext(snmpEngine),
- ntforg.null,
- 'inform',
- ntforg.MibVariable('SNMPv2-MIB', 'coldStart'),
- ( ( rfc1902.ObjectName('1.3.6.1.2.1.1.1.0'),
- rfc1902.OctetString('my name') ), ),
+ contextData,
+ 'inform', # NotifyType
+ ntforg.NotificationType(
+ ntforg.ObjectIdentity('SNMPv2-MIB', 'coldStart')
+ ).addVarBinds( ( '1.3.6.1.2.1.1.1.0', 'my name' ) ),
cbInfo=(cbFun, snmpEngine)
)
diff --git a/examples/hlapi/asyncore/manager/cmdgen/multiple-concurrent-queries.py b/examples/hlapi/asyncore/manager/cmdgen/multiple-concurrent-queries.py
index d70617d2..d169377e 100644
--- a/examples/hlapi/asyncore/manager/cmdgen/multiple-concurrent-queries.py
+++ b/examples/hlapi/asyncore/manager/cmdgen/multiple-concurrent-queries.py
@@ -22,29 +22,29 @@ targets = (
# 1-st target (SNMPv1 over IPv4/UDP)
( cmdgen.CommunityData('public', mpModel=0),
cmdgen.UdpTransportTarget(('demo.snmplabs.com', 161)),
- ( cmdgen.MibVariable('SNMPv2-MIB', 'sysDescr', 0),
- cmdgen.MibVariable('SNMPv2-MIB', 'sysLocation', 0) ) ),
+ ( cmdgen.ObjectIdentity('SNMPv2-MIB', 'sysDescr', 0),
+ cmdgen.ObjectIdentity('SNMPv2-MIB', 'sysLocation', 0) ) ),
# 2-nd target (SNMPv2c over IPv4/UDP)
( cmdgen.CommunityData('public'),
cmdgen.UdpTransportTarget(('demo.snmplabs.com', 161)),
- ( cmdgen.MibVariable('SNMPv2-MIB', 'sysDescr', 0),
- cmdgen.MibVariable('SNMPv2-MIB', 'sysLocation', 0) ) ),
+ ( cmdgen.ObjectIdentity('SNMPv2-MIB', 'sysDescr', 0),
+ cmdgen.ObjectIdentity('SNMPv2-MIB', 'sysLocation', 0) ) ),
# 3-nd target (SNMPv2c over IPv4/UDP) - same community and
# different transport address.
( cmdgen.CommunityData('public'),
cmdgen.UdpTransportTarget(('localhost', 161)),
- ( cmdgen.MibVariable('SNMPv2-MIB', 'sysContact', 0),
- cmdgen.MibVariable('SNMPv2-MIB', 'sysName', 0) ) ),
+ ( cmdgen.ObjectIdentity('SNMPv2-MIB', 'sysContact', 0),
+ cmdgen.ObjectIdentity('SNMPv2-MIB', 'sysName', 0) ) ),
# 4-nd target (SNMPv3 over IPv4/UDP)
( cmdgen.UsmUserData('usr-md5-des', 'authkey1', 'privkey1'),
cmdgen.UdpTransportTarget(('demo.snmplabs.com', 161)),
- ( cmdgen.MibVariable('SNMPv2-MIB', 'sysDescr', 0),
- cmdgen.MibVariable('SNMPv2-MIB', 'sysLocation', 0) ) ),
+ ( cmdgen.ObjectIdentity('SNMPv2-MIB', 'sysDescr', 0),
+ cmdgen.ObjectIdentity('SNMPv2-MIB', 'sysLocation', 0) ) ),
# 5-th target (SNMPv3 over IPv6/UDP)
( cmdgen.UsmUserData('usr-md5-none', 'authkey1'),
cmdgen.Udp6TransportTarget(('::1', 161)),
- ( cmdgen.MibVariable('SNMPv2-MIB', 'sysDescr', 0),
- cmdgen.MibVariable('SNMPv2-MIB', 'sysLocation', 0) ) ),
+ ( cmdgen.ObjectIdentity('SNMPv2-MIB', 'sysDescr', 0),
+ cmdgen.ObjectIdentity('SNMPv2-MIB', 'sysLocation', 0) ) ),
# N-th target
# ...
)
diff --git a/examples/hlapi/asyncore/manager/cmdgen/pull-mibs-from-multiple-agents-at-once.py b/examples/hlapi/asyncore/manager/cmdgen/pull-mibs-from-multiple-agents-at-once.py
index af3a40f6..80ff0fe1 100644
--- a/examples/hlapi/asyncore/manager/cmdgen/pull-mibs-from-multiple-agents-at-once.py
+++ b/examples/hlapi/asyncore/manager/cmdgen/pull-mibs-from-multiple-agents-at-once.py
@@ -29,11 +29,11 @@ targets = (
# 3-nd target (SNMPv3 over IPv4/UDP)
( cmdgen.UsmUserData('usr-md5-des', 'authkey1', 'privkey1'),
cmdgen.UdpTransportTarget(('demo.snmplabs.com', 161)),
- ( cmdgen.MibVariable('SNMPv2-MIB', 'system'), ) ),
+ ( cmdgen.ObjectIdentity('SNMPv2-MIB', 'system'), ) ),
# 4-th target (SNMPv3 over IPv6/UDP)
( cmdgen.UsmUserData('usr-md5-none', 'authkey1'),
cmdgen.Udp6TransportTarget(('::1', 161)),
- ( cmdgen.MibVariable('IF-MIB', 'ifTable'), ) )
+ ( cmdgen.ObjectIdentity('IF-MIB', 'ifTable'), ) )
# N-th target
# ...
)
diff --git a/examples/hlapi/asyncore/manager/cmdgen/query-multiple-snmp-engines.py b/examples/hlapi/asyncore/manager/cmdgen/query-multiple-snmp-engines.py
index 1b7d1565..94c1f541 100644
--- a/examples/hlapi/asyncore/manager/cmdgen/query-multiple-snmp-engines.py
+++ b/examples/hlapi/asyncore/manager/cmdgen/query-multiple-snmp-engines.py
@@ -35,18 +35,18 @@ targets = (
# 1-st target (SNMPv1 over IPv4/UDP)
( cmdgen.CommunityData('public', mpModel=0),
cmdgen.UdpTransportTarget(('demo.snmplabs.com', 161)),
- ( cmdgen.MibVariable('SNMPv2-MIB', 'sysDescr', 0),
- cmdgen.MibVariable('SNMPv2-MIB', 'sysLocation', 0) ) ),
+ ( cmdgen.ObjectIdentity('SNMPv2-MIB', 'sysDescr', 0),
+ cmdgen.ObjectIdentity('SNMPv2-MIB', 'sysLocation', 0) ) ),
# 2-nd target (SNMPv2c over IPv4/UDP)
( cmdgen.CommunityData('public'),
cmdgen.UdpTransportTarget(('demo.snmplabs.com', 1161)),
- ( cmdgen.MibVariable('SNMPv2-MIB', 'sysDescr', 0),
- cmdgen.MibVariable('SNMPv2-MIB', 'sysLocation', 0) ) ),
+ ( cmdgen.ObjectIdentity('SNMPv2-MIB', 'sysDescr', 0),
+ cmdgen.ObjectIdentity('SNMPv2-MIB', 'sysLocation', 0) ) ),
# 3-nd target (SNMPv3 over IPv4/UDP)
( cmdgen.UsmUserData('usr-md5-des', 'authkey1', 'privkey1'),
cmdgen.UdpTransportTarget(('demo.snmplabs.com', 2161)),
- ( cmdgen.MibVariable('SNMPv2-MIB', 'sysDescr', 0),
- cmdgen.MibVariable('SNMPv2-MIB', 'sysLocation', 0) ) )
+ ( cmdgen.ObjectIdentity('SNMPv2-MIB', 'sysDescr', 0),
+ cmdgen.ObjectIdentity('SNMPv2-MIB', 'sysLocation', 0) ) )
# N-th target
# ...
)
diff --git a/examples/hlapi/asyncore/sync/agent/ntforg/custom-contextengineid.py b/examples/hlapi/asyncore/sync/agent/ntforg/custom-contextengineid.py
index 60ab7b26..5e8c0535 100644
--- a/examples/hlapi/asyncore/sync/agent/ntforg/custom-contextengineid.py
+++ b/examples/hlapi/asyncore/sync/agent/ntforg/custom-contextengineid.py
@@ -20,17 +20,15 @@ from pysnmp.entity.rfc3413.oneliner import ntforg
from pysnmp.proto import rfc1902
snmpEngine = engine.SnmpEngine()
-snmpContext = context.SnmpContext(
- snmpEngine,contextEngineId=rfc1902.OctetString(hexValue='8000000004030201')
-)
-ntfOrg = ntforg.NotificationOriginator(snmpEngine, snmpContext)
+ntfOrg = ntforg.NotificationOriginator(snmpEngine)
errorIndication, errorStatus, errorIndex, varBinds = ntfOrg.sendNotification(
ntforg.UsmUserData('usr-md5-none', 'authkey1'),
ntforg.UdpTransportTarget(('localhost', 162)),
'inform',
- '1.3.6.1.6.3.1.1.5.2'
+ ntforg.NotificationType(ntforg.ObjectIdentity('1.3.6.1.6.3.1.1.5.2')),
+ contextEngineId=rfc1902.OctetString(hexValue='8000000004030201')
)
if errorIndication:
diff --git a/examples/hlapi/asyncore/sync/agent/ntforg/custom-contextname.py b/examples/hlapi/asyncore/sync/agent/ntforg/custom-contextname.py
index 1d1085e5..dfe0ad04 100644
--- a/examples/hlapi/asyncore/sync/agent/ntforg/custom-contextname.py
+++ b/examples/hlapi/asyncore/sync/agent/ntforg/custom-contextname.py
@@ -15,22 +15,17 @@
# the ContextName being used.
#
from pysnmp.entity import engine
-from pysnmp.entity.rfc3413 import context
from pysnmp.entity.rfc3413.oneliner import ntforg
snmpEngine = engine.SnmpEngine()
-snmpContext = context.SnmpContext(snmpEngine)
-# register default collection of Managed Objects under new contextName
-snmpContext.registerContextName('my-context', snmpContext.getMibInstrum())
-
-ntfOrg = ntforg.NotificationOriginator(snmpEngine, snmpContext)
+ntfOrg = ntforg.NotificationOriginator(snmpEngine)
errorIndication, errorStatus, errorIndex, varBinds = ntfOrg.sendNotification(
ntforg.UsmUserData('usr-md5-none', 'authkey1'),
ntforg.UdpTransportTarget(('localhost', 162)),
'inform',
- '1.3.6.1.6.3.1.1.5.2',
+ ntforg.NotificationType(ntforg.ObjectIdentity('1.3.6.1.6.3.1.1.5.2')),
contextName='my-context'
)
diff --git a/examples/hlapi/asyncore/sync/agent/ntforg/custom-v1-trap.py b/examples/hlapi/asyncore/sync/agent/ntforg/custom-v1-trap.py
index e2ba44a4..7db778e3 100644
--- a/examples/hlapi/asyncore/sync/agent/ntforg/custom-v1-trap.py
+++ b/examples/hlapi/asyncore/sync/agent/ntforg/custom-v1-trap.py
@@ -15,6 +15,9 @@
#
from pysnmp.entity.rfc3413.oneliner import ntforg
from pysnmp.proto import rfc1902
+#from pysnmp import debug
+
+#debug.setLogger(debug.Debug('mibview'))
ntfOrg = ntforg.NotificationOriginator()
@@ -22,11 +25,14 @@ errorIndication = ntfOrg.sendNotification(
ntforg.CommunityData('public', mpModel=0),
ntforg.UdpTransportTarget(('localhost', 162)),
'trap',
- '1.3.6.1.4.1.20408.4.1.1.2.0.432',
- ('1.3.6.1.2.1.1.3.0', 12345),
- ('1.3.6.1.6.3.18.1.3.0', '127.0.0.1'),
- ('1.3.6.1.6.3.1.1.4.3.0', '1.3.6.1.4.1.20408.4.1.1.2'),
- ('1.3.6.1.2.1.1.1.0', rfc1902.OctetString('my system'))
+ ntforg.NotificationType(
+ ntforg.ObjectIdentity('1.3.6.1.4.1.20408.4.1.1.2.0.432'),
+ ).addVarBinds(
+ ('1.3.6.1.2.1.1.3.0', 12345),
+ ('1.3.6.1.6.3.18.1.3.0', '127.0.0.1'),
+ ('1.3.6.1.6.3.1.1.4.3.0', '1.3.6.1.4.1.20408.4.1.1.2'),
+ ('1.3.6.1.2.1.1.1.0', rfc1902.OctetString('my system'))
+ )
)
if errorIndication:
diff --git a/examples/hlapi/asyncore/sync/agent/ntforg/default-v1-trap.py b/examples/hlapi/asyncore/sync/agent/ntforg/default-v1-trap.py
index 4a845f40..beab6e7c 100644
--- a/examples/hlapi/asyncore/sync/agent/ntforg/default-v1-trap.py
+++ b/examples/hlapi/asyncore/sync/agent/ntforg/default-v1-trap.py
@@ -22,9 +22,12 @@ errorIndication = ntfOrg.sendNotification(
ntforg.CommunityData('public', mpModel=0),
ntforg.UdpTransportTarget(('localhost', 162)),
'trap',
- '1.3.6.1.6.3.1.1.5.2',
- ('1.3.6.1.6.3.1.1.4.3.0', '1.3.6.1.4.1.20408.4.1.1.2'),
- ('1.3.6.1.2.1.1.1.0', rfc1902.OctetString('my system'))
+ ntforg.NotificationType(
+ ntforg.ObjectIdentity('1.3.6.1.6.3.1.1.5.2')
+ ).addVarBinds(
+ ('1.3.6.1.6.3.1.1.4.3.0', '1.3.6.1.4.1.20408.4.1.1.2'),
+ ('1.3.6.1.2.1.1.1.0', rfc1902.OctetString('my system'))
+ )
)
if errorIndication:
diff --git a/examples/hlapi/asyncore/sync/agent/ntforg/send-notification-with-additional-varbinds.py b/examples/hlapi/asyncore/sync/agent/ntforg/send-notification-with-additional-varbinds.py
index ca51d280..330b6b24 100644
--- a/examples/hlapi/asyncore/sync/agent/ntforg/send-notification-with-additional-varbinds.py
+++ b/examples/hlapi/asyncore/sync/agent/ntforg/send-notification-with-additional-varbinds.py
@@ -19,8 +19,11 @@ errorIndication, errorStatus, errorIndex, varBinds = ntfOrg.sendNotification(
ntforg.CommunityData('public'),
ntforg.UdpTransportTarget(('localhost', 162)),
'inform',
- ntforg.MibVariable('SNMPv2-MIB', 'coldStart'),
- ( ntforg.MibVariable('SNMPv2-MIB', 'sysName', 0), 'my system' ),
+ ntforg.NotificationType(
+ ntforg.ObjectIdentity('SNMPv2-MIB', 'coldStart')
+ ).addVarBinds(
+ ( ntforg.ObjectIdentity('SNMPv2-MIB', 'sysName', 0), 'my system' )
+ ),
lookupNames=True, lookupValues=True
)
diff --git a/examples/hlapi/asyncore/sync/agent/ntforg/v2c-trap-via-notification-type.py b/examples/hlapi/asyncore/sync/agent/ntforg/v2c-trap-via-notification-type.py
index 7d018833..502b3a0e 100644
--- a/examples/hlapi/asyncore/sync/agent/ntforg/v2c-trap-via-notification-type.py
+++ b/examples/hlapi/asyncore/sync/agent/ntforg/v2c-trap-via-notification-type.py
@@ -18,8 +18,7 @@ errorIndication = ntfOrg.sendNotification(
ntforg.CommunityData('public'),
ntforg.UdpTransportTarget(('localhost', 162)),
'trap',
- ntforg.MibVariable('SNMPv2-MIB', 'coldStart'),
- ( ntforg.MibVariable('SNMPv2-MIB', 'sysName', 0), 'new name' )
+ ntforg.NotificationType(ntforg.ObjectIdentity('SNMPv2-MIB', 'coldStart'))
)
if errorIndication:
diff --git a/examples/hlapi/asyncore/sync/agent/ntforg/v3-inform.py b/examples/hlapi/asyncore/sync/agent/ntforg/v3-inform.py
index 41d996ee..f9abe916 100644
--- a/examples/hlapi/asyncore/sync/agent/ntforg/v3-inform.py
+++ b/examples/hlapi/asyncore/sync/agent/ntforg/v3-inform.py
@@ -19,8 +19,11 @@ errorIndication, errorStatus, errorIndex, varBinds = ntfOrg.sendNotification(
ntforg.UsmUserData('usr-md5-des', 'authkey1', 'privkey1'),
ntforg.UdpTransportTarget(('localhost', 162)),
'inform',
- '1.3.6.1.6.3.1.1.5.2',
- ('1.3.6.1.2.1.1.5.0', rfc1902.OctetString('system name'))
+ ntforg.NotificationType(
+ ntforg.ObjectIdentity('1.3.6.1.6.3.1.1.5.2')
+ ).addVarBinds(
+ ('1.3.6.1.2.1.1.5.0', rfc1902.OctetString('system name'))
+ )
)
if errorIndication:
diff --git a/examples/hlapi/asyncore/sync/agent/ntforg/v3-trap.py b/examples/hlapi/asyncore/sync/agent/ntforg/v3-trap.py
index 7aa72f45..60cb0a6c 100644
--- a/examples/hlapi/asyncore/sync/agent/ntforg/v3-trap.py
+++ b/examples/hlapi/asyncore/sync/agent/ntforg/v3-trap.py
@@ -30,7 +30,9 @@ errorIndication = ntfOrg.sendNotification(
privProtocol=ntforg.usmAesCfb128Protocol),
ntforg.UdpTransportTarget(('127.0.0.1', 162)),
'trap',
- ntforg.MibVariable('SNMPv2-MIB', 'authenticationFailure')
+ ntforg.NotificationType(
+ ntforg.ObjectIdentity('SNMPv2-MIB', 'authenticationFailure')
+ )
)
if errorIndication:
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/coerce-set-value-to-mib-spec.py b/examples/hlapi/asyncore/sync/manager/cmdgen/coerce-set-value-to-mib-spec.py
index d58ad9ca..6732ec29 100644
--- a/examples/hlapi/asyncore/sync/manager/cmdgen/coerce-set-value-to-mib-spec.py
+++ b/examples/hlapi/asyncore/sync/manager/cmdgen/coerce-set-value-to-mib-spec.py
@@ -15,7 +15,10 @@ cmdGen = cmdgen.CommandGenerator()
errorIndication, errorStatus, errorIndex, varBinds = cmdGen.setCmd(
cmdgen.CommunityData('public'),
cmdgen.UdpTransportTarget(('demo.snmplabs.com', 161)),
- (cmdgen.MibVariable('SNMPv2-MIB', 'sysORDescr', 1), 'new system name')
+ cmdgen.ObjectType(
+ cmdgen.ObjectIdentity('SNMPv2-MIB', 'sysORDescr', 1),
+ 'new system name'
+ )
)
# Check for errors and print out results
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/custom-asn1-mib-search-path.py b/examples/hlapi/asyncore/sync/manager/cmdgen/custom-asn1-mib-search-path.py
new file mode 100644
index 00000000..2c696993
--- /dev/null
+++ b/examples/hlapi/asyncore/sync/manager/cmdgen/custom-asn1-mib-search-path.py
@@ -0,0 +1,34 @@
+#
+# Command Generator
+#
+# Send SNMP GET request using the following options:
+#
+# * with SNMPv2c, community 'public'
+# * over IPv4/UDP
+# * to an Agent at demo.snmplabs.com:161
+# * for IF-MIB::ifInOctets.1 MIB object
+#
+from pysnmp.entity.rfc3413.oneliner import cmdgen
+
+cmdGen = cmdgen.CommandGenerator()
+
+errorIndication, errorStatus, errorIndex, varBinds = cmdGen.getCmd(
+ cmdgen.CommunityData('public'),
+ cmdgen.UdpTransportTarget(('demo.snmplabs.com', 161)),
+ cmdgen.ObjectIdentity('IF-MIB', 'ifInOctets', 1).addMibCompiler('file:///usr/share/snmp', 'http://mibs.snmplabs.com/asn1/<mib>'),
+ lookupNames=True, lookupValues=True
+)
+
+# Check for errors and print out results
+if errorIndication:
+ print(errorIndication)
+else:
+ if errorStatus:
+ print('%s at %s' % (
+ errorStatus.prettyPrint(),
+ errorIndex and varBinds[int(errorIndex)-1][0] or '?'
+ )
+ )
+ else:
+ for oid, val in varBinds:
+ print('%s = %s' % (oid.prettyPrint(), val.prettyPrint()))
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 e273bba6..f28063b1 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
@@ -19,7 +19,10 @@ cmdGen = cmdgen.CommandGenerator()
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'),
+ cmdgen.ObjectType(
+ cmdgen.ObjectIdentity('SNMPv2-MIB', 'sysORDescr', 1),
+ 'new system name'
+ ),
contextEngineId=rfc1902.OctetString(hexValue='80004fb805636c6f75644dab22cc'),
contextName='da761cfc8c94d3aceef4f60f049105ba'
)
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/custom-contextengineid.py b/examples/hlapi/asyncore/sync/manager/cmdgen/custom-contextengineid.py
index 04ee0bf5..124a26fa 100644
--- a/examples/hlapi/asyncore/sync/manager/cmdgen/custom-contextengineid.py
+++ b/examples/hlapi/asyncore/sync/manager/cmdgen/custom-contextengineid.py
@@ -23,7 +23,10 @@ errorIndication, errorStatus, errorIndex, varBinds = cmdGen.setCmd(
)
),
cmdgen.UdpTransportTarget(('demo.snmplabs.com', 161)),
- (cmdgen.MibVariable('SNMPv2-MIB', 'sysORDescr', 1), 'new system name'),
+ cmdgen.ObjectType(
+ cmdgen.ObjectIdentity('SNMPv2-MIB', 'sysORDescr', 1),
+ 'new system name'
+ )
)
# Check for errors and print out results
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/custom-pysnmp-mibs-search-path.py b/examples/hlapi/asyncore/sync/manager/cmdgen/custom-pysnmp-mibs-search-path.py
index a0f0f298..4ca6b6e9 100644
--- a/examples/hlapi/asyncore/sync/manager/cmdgen/custom-pysnmp-mibs-search-path.py
+++ b/examples/hlapi/asyncore/sync/manager/cmdgen/custom-pysnmp-mibs-search-path.py
@@ -22,7 +22,7 @@ errorIndication, errorStatus, errorIndex, varBindTable = cmdGen.bulkCmd(
cmdgen.UsmUserData('usr-none-none'),
cmdgen.UdpTransportTarget(('demo.snmplabs.com', 161)),
0, 50,
- cmdgen.MibVariable('TCP-MIB', 'tcpConnTable').addMibSource('/tmp/mymibs'),
+ cmdgen.ObjectIdentity('TCP-MIB', 'tcpConnTable').addMibSource('/tmp/mibs'),
lexicographicMode=True, maxRows=100, maxCalls=10,ignoreNonIncreasingOid=True
)
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/fetch-variables-over-ipv6.py b/examples/hlapi/asyncore/sync/manager/cmdgen/fetch-variables-over-ipv6.py
index 452c8113..b766fad9 100644
--- a/examples/hlapi/asyncore/sync/manager/cmdgen/fetch-variables-over-ipv6.py
+++ b/examples/hlapi/asyncore/sync/manager/cmdgen/fetch-variables-over-ipv6.py
@@ -6,7 +6,7 @@
# * with SNMPv3 with user 'usr-md5-des', MD5 auth and DES privacy protocols
# * over IPv6/UDP
# * to an Agent at [::1]:161
-# * for three OIDs: one passed as a MibVariable object while others are
+# * for three OIDs: one passed as a ObjectIdentity object while others are
# * in string form
#
from pysnmp.entity.rfc3413.oneliner import cmdgen
@@ -16,7 +16,7 @@ cmdGen = cmdgen.CommandGenerator()
errorIndication, errorStatus, errorIndex, varBinds = cmdGen.getCmd(
cmdgen.UsmUserData('usr-md5-des', 'authkey1', 'privkey1'),
cmdgen.Udp6TransportTarget(('::1', 161)),
- cmdgen.MibVariable('1.3.6.1.2.1.1.1.0'),
+ cmdgen.ObjectIdentity('1.3.6.1.2.1.1.1.0'),
'1.3.6.1.2.1.1.2.0',
'1.3.6.1.2.1.1.3.0'
)
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/get-table-object-by-index.py b/examples/hlapi/asyncore/sync/manager/cmdgen/get-table-object-by-index.py
index 35fe0df4..c6419934 100644
--- a/examples/hlapi/asyncore/sync/manager/cmdgen/get-table-object-by-index.py
+++ b/examples/hlapi/asyncore/sync/manager/cmdgen/get-table-object-by-index.py
@@ -16,7 +16,7 @@ cmdGen = cmdgen.CommandGenerator()
errorIndication, errorStatus, errorIndex, varBinds = cmdGen.getCmd(
cmdgen.UsmUserData('usr-none-none'),
cmdgen.UdpTransportTarget(('demo.snmplabs.com', 161)),
- cmdgen.MibVariable('IF-MIB', 'ifInOctets', '1'),
+ cmdgen.ObjectIdentity('IF-MIB', 'ifInOctets', 1),
lookupNames=True, lookupValues=True
)
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/get-table-object-by-multiple-indices.py b/examples/hlapi/asyncore/sync/manager/cmdgen/get-table-object-by-multiple-indices.py
index 74f31b0e..8bc4562b 100644
--- a/examples/hlapi/asyncore/sync/manager/cmdgen/get-table-object-by-multiple-indices.py
+++ b/examples/hlapi/asyncore/sync/manager/cmdgen/get-table-object-by-multiple-indices.py
@@ -17,7 +17,7 @@ errorIndication, errorStatus, errorIndex, varBinds = cmdGen.getCmd(
authProtocol=cmdgen.usmHMACSHAAuthProtocol,
privProtocol=cmdgen.usmAesCfb128Protocol ),
cmdgen.UdpTransportTarget(('demo.snmplabs.com', 161)),
- cmdgen.MibVariable('TCP-MIB', 'tcpConnLocalAddress', '0.0.0.0', 22, '0.0.0.0', 0)
+ cmdgen.ObjectIdentity('TCP-MIB', 'tcpConnLocalAddress', '0.0.0.0', 22, '0.0.0.0', 0)
)
# Check for errors and print out results
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/getbulk-fetch-scalar-and-table-variables.py b/examples/hlapi/asyncore/sync/manager/cmdgen/getbulk-fetch-scalar-and-table-variables.py
index 7291ee8f..99df3c11 100644
--- a/examples/hlapi/asyncore/sync/manager/cmdgen/getbulk-fetch-scalar-and-table-variables.py
+++ b/examples/hlapi/asyncore/sync/manager/cmdgen/getbulk-fetch-scalar-and-table-variables.py
@@ -22,8 +22,8 @@ errorIndication, errorStatus, errorIndex, varBindTable = cmdGen.bulkCmd(
cmdgen.UsmUserData('usr-md5-des', 'authkey1', 'privkey1'),
cmdgen.Udp6TransportTarget(('::1', 161)),
1, 25,
- cmdgen.MibVariable('IP-MIB', 'ipAdEntAddr'),
- cmdgen.MibVariable('IF-MIB', 'ifEntry'),
+ cmdgen.ObjectIdentity('IP-MIB', 'ipAdEntAddr'),
+ cmdgen.ObjectIdentity('IF-MIB', 'ifEntry'),
lookupNames=True, lookupValues=True, maxRows=20
)
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/getnext-limit-number-of-variables.py b/examples/hlapi/asyncore/sync/manager/cmdgen/getnext-limit-number-of-variables.py
index 2e9c9f43..bdeda853 100644
--- a/examples/hlapi/asyncore/sync/manager/cmdgen/getnext-limit-number-of-variables.py
+++ b/examples/hlapi/asyncore/sync/manager/cmdgen/getnext-limit-number-of-variables.py
@@ -21,7 +21,7 @@ errorIndication, errorStatus, errorIndex, varBindTable = cmdGen.nextCmd(
authProtocol=cmdgen.usmHMACSHAAuthProtocol,
privProtocol=cmdgen.usmAesCfb128Protocol),
cmdgen.UdpTransportTarget(('demo.snmplabs.com', 161)),
- cmdgen.MibVariable('IF-MIB', '').loadMibs(),
+ cmdgen.ObjectIdentity('IF-MIB', '').loadMibs(),
lexicographicMode=True, maxRows=100,
ignoreNonIncreasingOid=True
)
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/preload-pysnmp-mibs.py b/examples/hlapi/asyncore/sync/manager/cmdgen/preload-pysnmp-mibs.py
index 6354572c..847ba252 100644
--- a/examples/hlapi/asyncore/sync/manager/cmdgen/preload-pysnmp-mibs.py
+++ b/examples/hlapi/asyncore/sync/manager/cmdgen/preload-pysnmp-mibs.py
@@ -19,7 +19,7 @@ cmdGen = cmdgen.CommandGenerator()
errorIndication, errorStatus, errorIndex, varBindTable = cmdGen.nextCmd(
cmdgen.UsmUserData('usr-md5-des', 'authkey1', 'privkey1'),
cmdgen.Udp6TransportTarget(('::1', 161)),
- cmdgen.MibVariable('IF-MIB', 'ifEntry'),
+ cmdgen.ObjectIdentity('IF-MIB', 'ifEntry'),
lookupNames=True, lookupValues=True
)
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/pull-whole-mib.py b/examples/hlapi/asyncore/sync/manager/cmdgen/pull-whole-mib.py
index 25352de8..2d62e85c 100644
--- a/examples/hlapi/asyncore/sync/manager/cmdgen/pull-whole-mib.py
+++ b/examples/hlapi/asyncore/sync/manager/cmdgen/pull-whole-mib.py
@@ -19,7 +19,7 @@ cmdGen = cmdgen.CommandGenerator()
errorIndication, errorStatus, errorIndex, varBindTable = cmdGen.nextCmd(
cmdgen.UsmUserData('usr-md5-none', 'authkey1'),
cmdgen.UdpTransportTarget(('demo.snmplabs.com', 161)),
- cmdgen.MibVariable('IF-MIB', ''),
+ cmdgen.ObjectIdentity('IF-MIB', ''),
lookupValues=True
)
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/pull-whole-snmp-table.py b/examples/hlapi/asyncore/sync/manager/cmdgen/pull-whole-snmp-table.py
index 2a698959..7be99e22 100644
--- a/examples/hlapi/asyncore/sync/manager/cmdgen/pull-whole-snmp-table.py
+++ b/examples/hlapi/asyncore/sync/manager/cmdgen/pull-whole-snmp-table.py
@@ -18,11 +18,11 @@ cmdGen = cmdgen.CommandGenerator()
errorIndication, errorStatus, errorIndex, varBindTable = cmdGen.nextCmd(
cmdgen.CommunityData('public', mpModel=0),
cmdgen.UdpTransportTarget(('demo.snmplabs.com', 161)),
- cmdgen.MibVariable('IF-MIB', 'ifDescr'),
- cmdgen.MibVariable('IF-MIB', 'ifType'),
- cmdgen.MibVariable('IF-MIB', 'ifMtu'),
- cmdgen.MibVariable('IF-MIB', 'ifSpeed'),
- cmdgen.MibVariable('IF-MIB', 'ifPhysAddress')
+ cmdgen.ObjectIdentity('IF-MIB', 'ifDescr'),
+ cmdgen.ObjectIdentity('IF-MIB', 'ifType'),
+ cmdgen.ObjectIdentity('IF-MIB', 'ifMtu'),
+ cmdgen.ObjectIdentity('IF-MIB', 'ifSpeed'),
+ cmdgen.ObjectIdentity('IF-MIB', 'ifPhysAddress')
)
if errorIndication:
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/query-agents-from-multuple-threads.py b/examples/hlapi/asyncore/sync/manager/cmdgen/query-agents-from-multuple-threads.py
index df22afb7..5d589f93 100644
--- a/examples/hlapi/asyncore/sync/manager/cmdgen/query-agents-from-multuple-threads.py
+++ b/examples/hlapi/asyncore/sync/manager/cmdgen/query-agents-from-multuple-threads.py
@@ -28,29 +28,29 @@ targets = (
# 1-st target (SNMPv1 over IPv4/UDP)
( cmdgen.CommunityData('public', mpModel=0),
cmdgen.UdpTransportTarget(('demo.snmplabs.com', 161)),
- ( cmdgen.MibVariable('SNMPv2-MIB', 'sysDescr', 0),
- cmdgen.MibVariable('SNMPv2-MIB', 'sysLocation', 0) ) ),
+ ( cmdgen.ObjectIdentity('SNMPv2-MIB', 'sysDescr', 0),
+ cmdgen.ObjectIdentity('SNMPv2-MIB', 'sysLocation', 0) ) ),
# 2-nd target (SNMPv2c over IPv4/UDP)
( cmdgen.CommunityData('public'),
cmdgen.UdpTransportTarget(('demo.snmplabs.com', 161)),
- ( cmdgen.MibVariable('SNMPv2-MIB', 'sysDescr', 0),
- cmdgen.MibVariable('SNMPv2-MIB', 'sysLocation', 0) ) ),
+ ( cmdgen.ObjectIdentity('SNMPv2-MIB', 'sysDescr', 0),
+ cmdgen.ObjectIdentity('SNMPv2-MIB', 'sysLocation', 0) ) ),
# 3-nd target (SNMPv2c over IPv4/UDP) - same community and
# different transport address.
( cmdgen.CommunityData('public'),
cmdgen.UdpTransportTarget(('localhost', 161)),
- ( cmdgen.MibVariable('SNMPv2-MIB', 'sysContact', 0),
- cmdgen.MibVariable('SNMPv2-MIB', 'sysName', 0) ) ),
+ ( cmdgen.ObjectIdentity('SNMPv2-MIB', 'sysContact', 0),
+ cmdgen.ObjectIdentity('SNMPv2-MIB', 'sysName', 0) ) ),
# 4-nd target (SNMPv3 over IPv4/UDP)
( cmdgen.UsmUserData('usr-md5-des', 'authkey1', 'privkey1'),
cmdgen.UdpTransportTarget(('demo.snmplabs.com', 161)),
- ( cmdgen.MibVariable('SNMPv2-MIB', 'sysDescr', 0),
- cmdgen.MibVariable('SNMPv2-MIB', 'sysLocation', 0) ) ),
+ ( cmdgen.ObjectIdentity('SNMPv2-MIB', 'sysDescr', 0),
+ cmdgen.ObjectIdentity('SNMPv2-MIB', 'sysLocation', 0) ) ),
# 5-th target (SNMPv3 over IPv6/UDP)
( cmdgen.UsmUserData('usr-md5-none', 'authkey1'),
cmdgen.Udp6TransportTarget(('::1', 161)),
- ( cmdgen.MibVariable('SNMPv2-MIB', 'sysDescr', 0),
- cmdgen.MibVariable('SNMPv2-MIB', 'sysLocation', 0) ) ),
+ ( cmdgen.ObjectIdentity('SNMPv2-MIB', 'sysDescr', 0),
+ cmdgen.ObjectIdentity('SNMPv2-MIB', 'sysLocation', 0) ) ),
# N-th target
# ...
)
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/usm-md5-none.py b/examples/hlapi/asyncore/sync/manager/cmdgen/usm-md5-none.py
index 5392c0c9..47f025f1 100644
--- a/examples/hlapi/asyncore/sync/manager/cmdgen/usm-md5-none.py
+++ b/examples/hlapi/asyncore/sync/manager/cmdgen/usm-md5-none.py
@@ -15,7 +15,7 @@ cmdGen = cmdgen.CommandGenerator()
errorIndication, errorStatus, errorIndex, varBinds = cmdGen.getCmd(
cmdgen.UsmUserData('usr-md5-none', 'authkey1'),
cmdgen.UdpTransportTarget(('demo.snmplabs.com', 161)),
- cmdgen.MibVariable('IF-MIB', 'ifInOctets', '1')
+ cmdgen.ObjectIdentity('IF-MIB', 'ifInOctets', 1)
)
# Check for errors and print out results
diff --git a/examples/hlapi/asyncore/sync/manager/cmdgen/v1-get.py b/examples/hlapi/asyncore/sync/manager/cmdgen/v1-get.py
index f05c5f80..664df9dd 100644
--- a/examples/hlapi/asyncore/sync/manager/cmdgen/v1-get.py
+++ b/examples/hlapi/asyncore/sync/manager/cmdgen/v1-get.py
@@ -16,8 +16,8 @@ cmdGen = cmdgen.CommandGenerator()
errorIndication, errorStatus, errorIndex, varBinds = cmdGen.getCmd(
cmdgen.CommunityData('public', mpModel=0),
cmdgen.UdpTransportTarget(('demo.snmplabs.com', 161)),
- cmdgen.MibVariable('iso.org.dod.internet.mgmt.mib-2.system.sysDescr.0'),
- cmdgen.MibVariable('SNMPv2-MIB', 'sysDescr', 0)
+ cmdgen.ObjectIdentity('iso.org.dod.internet.mgmt.mib-2.system.sysDescr.0'),
+ cmdgen.ObjectIdentity('SNMPv2-MIB', 'sysDescr', 0)
)
# Check for errors and print out results