I was trying too many things and hence I pasted the wrong code. Here is the code I am using
from pysnmp.entity.rfc3413.oneliner import cmdgen
from pysnmp.smi import *
cmdGen = cmdgen.CommandGenerator()
errorIndication, errorStatus, errorIndex, varBind = cmdGen.nextCmd(
cmdgen.CommunityData('public', 1),
cmdgen.UdpTransportTarget(('junipertestrtr', 161)),
(1,3,6,1,4,1,2636,5,1,1,2,1,1,1,13,0,1),
)
print errorIndication, errorStatus
for varBindTableRow in varBind:
for name, val in varBindTableRow:
print name, val
When I run this program, I get the error message "requestTimedOut 0"
However when I run snmpwalk -c public -v 2c junipertestrtr 1.3.6.1.4.1.2636.5.1.1.2.1.1.1.13.0.1 from the same computer's command line I get the right output
iso.3.6.1.4.1.2636.5.1.1.2.1.1.1.13.0.1.172.28.254.83.1.172.16.25.82 = Gauge32: 64902 iso.3.6.1.4.1.2636.5.1.1.2.1.1.1.13.0.1.172.28.254.135.1.172.17.25.134 = Gauge32: 64902 iso.3.6.1.4.1.2636.5.1.1.2.1.1.1.13.0.1.172.28.255.135.1.172.29.255.136 = Gauge32: 64861 iso.3.6.1.4.1.2636.5.1.1.2.1.1.1.13.0.1.172.28.255.135.1.172.28.255.137 = Gauge32: 64861 iso.3.6.1.4.1.2636.5.1.1.2.1.1.1.13.0.1.172.28.255.135.1.172.28.255.138 = Gauge32: 64861 iso.3.6.1.4.1.2636.5.1.1.2.1.1.1.13.0.1.10.1.1.1.1.10.1.1.2 = Gauge32: 64810
what is wrong with my pysnmp and why am I getting a requestimedout error message?