Problem with mib tables

Andreas Bokeloh (Andreas.Bokeloh@Informatik.Uni-Oldenburg.DE)
Thu, 3 Apr 1997 17:13:34 +0200 (MET DST)

Hi,
I'm trying to implement a mib which I wrote and discovered a problem with
tables which have two attributes as their index. When I remove all attributes
with the same first index by unsetting the bound variables, all entries behind
these attributes disappear, although the bound variables still exist.
I have appended an example using the udpTable from the MIB-II which shows the
same behaviour.
EntryList contains the entries for udpTable. CreateTable registers the table
instances by binding them to a variable in the global array MibArray using the
OID as an index.
RemoveAddr removes all entries with a certain address entry from EntryList and
unsets the corresponding variables in MibArray().
After unsetting the last entry with a given address all bindings with bigger
indexes are gone, too.
I use scotty version 2.1.5 on an i486 under Linux 2.0.28.
Can anybody tell me what's wrong?
Thanks in advance.
Bye, Andreas.

############ begin example ############
#!/usr/bin/scotty2.1.5

proc CreateTable {TableName EntryList} {
set TableOID [mib oid $TableName]
global SnmpSession MibArray
foreach TableRow $EntryList {
set index1 [lindex $TableRow 0]
set index2 [lindex $TableRow 1]
set counter 0
foreach RowEntry $TableRow {
incr counter
set TmpOID $TableOID.1.$counter.$index1.$index2
$SnmpSession instance $TmpOID MibArray($TmpOID) $RowEntry
$SnmpSession bind $TmpOID get {
puts "Received SNMP-Get on %o"
}
}
}
}

proc RemoveAddr Set {
global EntryList MibArray
set NewList {}
set TmpOID "[mib oid udpTable].1"
foreach SetEntry $EntryList {
if {[lindex $SetEntry 0] != $Set} then {
lappend NewList $SetEntry
} else {
set Index0 [lindex $SetEntry 0]
set Index1 [lindex $SetEntry 1]
set counter 0
foreach Entry $SetEntry {
incr counter
unset MibArray($TmpOID.$counter.$Index0.$Index1)
}
}
}
set EntryList $NewList
}

set MibArray() ""
set SnmpSession [ snmp session -port 1701 -agent "" ]

set EntryList {\
{127.0.0.1 255}\
{127.0.0.1 256}\
{0.0.0.0 1}\
{0.0.0.0 2}\
{192.168.13.0 0}\
{192.168.13.0 1}\
{192.168.13.0 2}\
{192.168.13.0 3}\
{192.168.13.0 4}\
{192.168.13.0 5}\
{192.168.14.0 6}\
{192.168.14.0 7}\
{192.168.14.0 8}\
{192.168.14.0 9}\
{192.168.14.0 10}\
}
CreateTable udpTable $EntryList

RemoveAddr 192.168.13.0
foreach blafasel [lsort [array names MibArray]] {
puts $blafasel
}

#exit
puts "Agent running..."
############ end example ############

--
Email: Andreas.Bokeloh@informatik.uni-oldenburg.de

--
!! This message is brought to you via the `tkined & scotty' mailing list.
!! Please do not reply to this message to unsubscribe. To subscribe or
!! unsubscribe, send a mail message to <tkined-request@ibr.cs.tu-bs.de>.
!! See http://wwwsnmp.cs.utwente.nl/~schoenw/scotty/ for more information.