Okay, the python works to degree, but after a while it quits. Here's a
sample of running the same test script (source code after transcipt)
over and over. It worked 4 times, then no longer functions. I can
still run it just fine from the cygwin prompt using normal netsnmp commands.
In [1]: run testscript.py
adGenEasyBridgeIndexNext.0
7
adGenEasyBridgeRowStatus.7
adGenEasyBridgeStatusString.7
('Not Activated',)
In [2]: run testscript.py
adGenEasyBridgeIndexNext.0
8
adGenEasyBridgeRowStatus.8
adGenEasyBridgeStatusString.8
('Not Activated',)
In [3]: run testscript.py
adGenEasyBridgeIndexNext.0
9
adGenEasyBridgeRowStatus.9
adGenEasyBridgeStatusString.9
('Not Activated',)
In [4]: run testscript.py
adGenEasyBridgeIndexNext.0
10
adGenEasyBridgeRowStatus.10
error: set: unknown object ID
(adGenEasyBridgeRowStatus.10)adGenEasyBridgeStatu
String.10
error: get: unknown object ID (adGenEasyBridgeStatusString.10)None
In [5]: run testscript.py
adGenEasyBridgeIndexNext.0
11
adGenEasyBridgeRowStatus.11
error: set: unknown object ID
(adGenEasyBridgeRowStatus.11)adGenEasyBridgeStatu
String.11
error: get: unknown object ID (adGenEasyBridgeStatusString.11)None
Source code:
#!/usr/bin/python
from netsnmp import *
#setup the varbinds for gen easy bridge
#'.iso.org.dod.internet.private.enterprises.adtran.adShared.adGenTa5k.adGenTa5kMgmt.adGenBridge.adGenEasyBridgeMIBObjects'
host = '192.168.15.254'
ver = 2
comm = 'private'
def SnmpGetType(label,index,dataType):
print label + index
var = Varbind(label+index,None,None, dataType)
return snmpget(var,Version=ver,DestHost=host,Community = comm)
def SnmpGet(label,index):
print label + index
var = Varbind(label+index)
return snmpget(var,Version=ver,DestHost=host,Community = comm)
def SnmpSet(label,index,val,dataType):
print label + index
var = Varbind(label+index,None,val,dataType)
return snmpset(var,Version=ver,DestHost=host,Community = comm)
genEasyBridgeIndexNext = 'adGenEasyBridgeIndexNext.'
genEasyBridgeName = 'adGenEasyBridgeName.'
genEasyBridgeRowStatus = 'adGenEasyBridgeRowStatus.'
genEasyBridgeType = 'adGenEasyBridgeType.'
genEasyBridgeUpstreamRate = 'adGenEasyBridgeUpstreamRate.'
genEasyBridgeDownstreamRate = 'adGenEasyBridgeDownstreamRate.'
genEasyBridgeMemberPhyls = 'adGenEasyBridgeMemberPhyls.'
genEasyBridgeMinNumActPhyls = 'adGenEasyBridgeMinNumActPhyls.'
genEasyBridgeStatusString = 'adGenEasyBridgeStatusString.'
genEasyBridgeRateControl = 'adGenEasyBridgeRateControl.'
#get the next index
res = SnmpGet(genEasyBridgeIndexNext,'0')
print res[0]
#Create Row
SnmpSet(genEasyBridgeRowStatus,res[0],5,'INTEGER')
#Retrieve status
result = SnmpGet(genEasyBridgeStatusString,res[0])
print result
Mike Ayers wrote:
From: Jack G Atkinson Jr [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 02, 2008 10:03 PM
Sorry, I forgot to put in the row number in my email. It it's there.
Also, It has no trouble finding the adGenEasyBridgeIndexNext
object ID, but it can't find the adGenEasyBridgeRowStatus
object Id or the adGenEasyBridgeStatusString object ID. So,
it is somehow partially recognizing the ADTRAN-GENERIC-BRIDGE-MIB.
...or the row that you expect to find is not there. When creating
rows, it is imperative to read the documentation for the specific MIB (usually
put into the MIB itself) to find out what the proper order of operations is for
row creation, and any prerequisites.
In the future, please post actual transcripts. Guessing helps noone.
Thanks,
Mike
--
------------------------------------------------------------------
Jack G. Atkinson Jr.
[EMAIL PROTECTED]
Romans 5:6-10 - God loved us while we were unlovable!
Luke 12:36-47 - Be ready!
------------------------------------------------------------------
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users