A list for users of pure-Python SNMP framework <pysnmp-users.lists.sourceforge.net>
List-Post: <mailto:pysnmp-users@...>
List-Help: <mailto:pysnmp-users-request@...>
List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/pysnmp-users>,
<mailto:pysnmp-users-request@...>
List-Archive: <http://sourceforge.net/mailarchive/forum.php?forum=pysnmp-users>
In fact, this is done in a weird way in 2.x, Version 3.4.x implements a
more table-oriented interface to table browing.
Anyway, here is what it does:
# this is table's head -- where you start walking the MIB from
oidz = ['.1.3.6']
idx = 0
# loop over table columns
while idx < len(oidz):
# if the OID you receive appears to be out of table...
if not asn1.OBJECTID(oidz[idx]).isaprefix(oids[idx]):
# ...remove it from both resultset and table head
del oidz[idx]; del oids[idx]
# ...and restart
idx = 0
idx = idx + 1
> .. I shamefully admit I didn't understand what this piece of code does :D
> .. so I used something like this:
> if oids[0].find(oidz) != 1: break
This seems to be what asn1.OBJECTID.isaprefix() does, excluding various
bells and whistles.
-ilya
|