Hi Frank,
thanks for the reply, the status is -1 , which means time out I
guess.I increased the time out as well, but still I get the same out
puthere is the new code I am using
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package snmp;
import java.io.IOException;
import java.util.List;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.snmp4j.CommunityTarget;
import org.snmp4j.PDU;
import org.snmp4j.Snmp;
import org.snmp4j.mp.SnmpConstants;
import org.snmp4j.smi.Address;
import org.snmp4j.smi.GenericAddress;
import org.snmp4j.smi.OID;
import org.snmp4j.smi.OctetString;
import org.snmp4j.smi.UdpAddress;
import org.snmp4j.smi.VariableBinding;
import org.snmp4j.transport.DefaultUdpTransportMapping;
import org.snmp4j.util.DefaultPDUFactory;
import org.snmp4j.util.TableEvent;
import org.snmp4j.util.TableUtils;
/**
*
* @author crysm
*/
public class TableMain {
public static void main(String args[])
{
try {
TableReader tr = new TableReader();
Snmp session = new Snmp(new DefaultUdpTransportMapping());
CommunityTarget target = new CommunityTarget();
Address targetAddress = GenericAddress.parse(udp:
192.41.135.203/161);
target.setCommunity(new OctetString(public));
target.setAddress(targetAddress);
target.setRetries(2);
target.setTimeout(15000);
target.setVersion(SnmpConstants.version1);
TableUtils tu = new TableUtils(session,new
DefaultPDUFactory(PDU.GETBULK));
OID[] oidArray = new OID[13];
oidArray[0] = new OID(1.3.6.1.2.1.15.6.1.1);
oidArray[1] = new OID(1.3.6.1.2.1.15.6.1.2);
oidArray[2] = new OID(1.3.6.1.2.1.15.6.1.3);
oidArray[3] = new OID(1.3.6.1.2.1.15.6.1.4);
oidArray[4] = new OID(1.3.6.1.2.1.15.6.1.5);
oidArray[5] = new OID(1.3.6.1.2.1.15.6.1.6);
oidArray[6] = new OID(1.3.6.1.2.1.15.6.1.7);
oidArray[7] = new OID(1.3.6.1.2.1.15.6.1.8);
oidArray[8] = new OID(1.3.6.1.2.1.15.6.1.9);
oidArray[9] = new OID(1.3.6.1.2.1.15.6.1.10);
oidArray[10] = new OID(1.3.6.1.2.1.15.6.1.11);
oidArray[11] = new OID(1.3.6.1.2.1.15.6.1.12);
oidArray[12] = new OID(1.3.6.1.2.1.15.6.1.13);
// oidArray[13] = new OID(1.3.6.1.2.1.15.6.1.14);
List list = tu.getTable(target, oidArray,null,null);
System.out.println(The size of the list is : + list.size());
System.out.println(list.get(0).getClass());
for(int i=0;ilist.size();i++)
{
TableEvent tableevent = (TableEvent)list.get(i);
System.out.println(this is the status +
tableevent.getStatus());
VariableBinding[] vb = tableevent.getColumns();
if(vb==null)
System.out.println(this is null);
// System.out.println(size of the vb is : +vb.length);
/* for(int j=0;jvb.length;j++)
{
System.out.println(vb[j]);
}*/
}
} catch (IOException ex) {
Logger.getLogger(TableMain.class.getName()).log(Level.SEVERE,
null, ex);
}
}
}
On Mon, Jun 30, 2008 at 5:47 PM, Frank Fock [EMAIL PROTECTED] wrote:
Hi,
What is the status of the TableEvent object you get?
I guess it is an error state...
Best regards,
Frank
AMRUTH KUMAR JUTURU wrote:
Hi all,
I am trying to use TableUtils class to read the bgp routing
table entries. But I have a problemThis is the code
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package snmp;
import java.io.IOException;
import java.util.List;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.snmp4j.CommunityTarget;
import org.snmp4j.Snmp;
import org.snmp4j.smi.OID;
import org.snmp4j.smi.OctetString;
import org.snmp4j.smi.VariableBinding;
import org.snmp4j.transport.DefaultUdpTransportMapping;
import org.snmp4j.util.TableEvent;
import org.snmp4j.util.TableUtils;
/**
*
* @author crysm
*/
public class TableMain {
public static void main(String args[])
{
try {
TableReader tr = new TableReader();
Snmp session = new Snmp(new DefaultUdpTransportMapping());
CommunityTarget target = new CommunityTarget();
target.setCommunity(new OctetString(public));
TableUtils tu = new TableUtils(session,tr);
OID[] oidArray = new OID[14];
oidArray[0] = new OID(1.3.6.1.2.1.15.6.1.1);
oidArray[1] = new OID(1.3.6.1.2.1.15.6.1.2);
oidArray[2] = new OID(1.3.6.1.2.1.15.6.1.3);
oidArray[3] = new OID(1.3.6.1.2.1.15.6.1.4);