Hello!

I want to get route tables from Cisco routers in the network. What i
have:
<snip>
   else:
       for varBindTableRow in varBindTable:
           for oid, val in varBindTableRow:
                print varBindTableRow
 <snip>

Result:

Code: Select all
[(ObjectName('1.3.6.1.2.1.4.21.1.1.0.0.0.0'), IpAddress('0.0.0.0'))]
[(ObjectName('1.3.6.1.2.1.4.21.1.1.10.9.0.0'), IpAddress('10.9.0.0'))]
[(ObjectName('1.3.6.1.2.1.4.21.1.1.192.168.1.0'),
IpAddress('192.168.1.0'))]

How can i get IpAddress values from this list and put they in the
dictionary? Or may be there is much better solution?

My guess, from looking at what you have there, str(varBindTableRow[1]) should 
get your IP address in a string format. In any case the varBindTableRow[1] will 
contain the IpAddress object(?) that is displayed in the lists.

HTH,
Wayne


Results are: 

1. print str(varBindTableRow[1])

IndexError: list index out of range

2. print str(varBindTableRow[0][1])

АЁ

3. but for ipRouteIfIndex, i have

print str(varBindTableRow[0][1])

0
0
1

So, it works for IfIndex, RouteType, but not for Dest, Mask and NextHop as they 
return ip.

Thanks indeed.

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
  • [Tutor] How to get ipRo... Костиков Сергей Николаевич
    • Re: [Tutor] How to... Костиков Сергей Николаевич

Reply via email to