[SNMP4J] Snmp4J Trap Listener stop receiving V3Traps after 150 sec of processing

Vijay Reddy (dvsreddy) dvsreddy at cisco.com
Tue Sep 7 08:07:31 CEST 2010


All,
 
On understanding more with SNMPv3 implementation and SNMP4J stack code,
its resolved now. Am able to send and receive traps.
 
Thanks and regards,
Vijay

________________________________

From: Vijay Reddy (dvsreddy) 
Sent: Friday, September 03, 2010 11:37 AM
To: snmp4j at agentpp.org
Subject: Snmp4J Trap Listener stop receiving V3Traps after 150 sec of
processing


All,
 
I have Trap Sender developed using SNMP 4J sending V3Traps at 10 per
second.
 
Have Trap Receiver developer using SNMP4J receiving V3 Traps, after
about 150 sec, its stop processing V3 Traps.
 
DId someone ran into same issue , any pointers will help me.  Am
guessing sender sending traps are outside the time window of the
receiver. 
 
In the past with older version of SNMP4J, did remembered haven't ran
into this issue earlier.  
 
 
Here is the sender code snippet,
 
Target target = null;

IpAddress address = new UdpAddress(destIP + "/" + destPort);

if ( (version == 1) || (version == 2) ) {

target = new CommunityTarget();

OctetString comm = new OctetString(community);

((CommunityTarget) target).setCommunity(comm);

target.setAddress(address);

if (version == 1) {

target.setVersion(SnmpConstants.version1);

} else {

target.setVersion(SnmpConstants.version2c);

}

} else {

target = new UserTarget();

((UserTarget) target).setSecurityLevel(securityLevel);

((UserTarget) target).setSecurityName(securityName);

target.setAddress(address);

target.setRetries(1);

target.setTimeout(11500);

target.setVersion(SnmpConstants.version3);

//target.setSecurityLevel(SecurityLevel.AUTH_NOPRIV);

((UserTarget)
target).setSecurityModel(SecurityModel.SECURITY_MODEL_USM);

int maxSizeResponsePDU = 65535;

target.setMaxSizeRequestPDU(maxSizeResponsePDU);

int engineBootCount = 0;

if (getLocalEngineIDType().equalsIgnoreCase("HEX")) {

String HexNumbers = toHex(srcIpList.get(deviceIndex).toString());

localEngineID = new
OctetString(toHex(srcIpList.get(deviceIndex).toString()));

((MPv3)snmpSrc.getMessageProcessingModel(MPv3.ID)).setLocalEngineID(loca
lEngineID.getValue());

} if (getLocalEngineIDType().equalsIgnoreCase("IP")) {

localEngineID = new OctetString(srcIpList.get(deviceIndex).toString());

((MPv3)snmpSrc.getMessageProcessingModel(MPv3.ID)).setLocalEngineID(loca
lEngineID.getValue());

} if (getLocalEngineIDType().equalsIgnoreCase("ID")) {

localEngineID = new
OctetString(Long.toString(ipToLong(srcIpList.get(deviceIndex).toString()
)));

((MPv3)snmpSrc.getMessageProcessingModel(MPv3.ID)).setLocalEngineID(loca
lEngineID.getValue());

}

pdu = (ScopedPDU)pdu;

System.out.println("Context Engine ID is "+localEngineID.toHexString());

((ScopedPDU) pdu).setContextEngineID(localEngineID);

USM usm = new USM(SecurityProtocols.getInstance(),

localEngineID, engineBootCount);

SecurityModels.getInstance().addSecurityModel(usm);

addUsmUser(snmpSrc);



 
 
Thanks and regards,
Vijay
 
 



More information about the SNMP4J mailing list