[SNMP4J] Receive INFORMS

Tayyab Akram mail.tayyab at gmail.com
Mon Sep 15 13:09:51 CEST 2008


Hi,

I have implemented Network Manager and Trap Receiver using Snmp4j.
Traps are working fine because they are not acknowledged... But I am having
problem in Receiving INFORMS. In fact i can receive INFORM and *processPdu()
* is called but it doesn't generates response packet automatically.

I am using *snmptrap* and *snmpinform* that comes with *net-snmp *package to
test traps, Also I am running Wireshark (Ethreal) to see the packets.
When I send Traps it works OK and I receive traps and my processPdu()
function is called.

But when I send inform.... every thing goes fine except that no response is
generated back.
I have verified from Network Sniffer that informReuest is generated by no
response packet is generated by Network Manager on receiving INFORM.

When I send INFORM using net-snmp tool *snmpinform*, it do 5 retires as it
doesn't receive any response packet... But on Manager side I receive all the
5 INFORMS,
and my *processPdu* function is called everytime.

Do i need to configure something else so that response is generated from
INFORM.... Or I have to generate the INFORM response myself??
Below some piece of test the code that I am using,


        TransportMapping transport;
        transport = new DefaultUdpTransportMapping(new UdpAddress(162));

        objSnmp = new Snmp(objDispatcher, transport);

        objSnmp.getMessageDispatcher().addMessageProcessingModel(new
MPv1());
        objSnmp.getMessageDispatcher().addMessageProcessingModel(new
MPv2c());
        OctetString engineID = createOctetString(localEngineID);
        objSnmp.getMessageDispatcher().addMessageProcessingModel(new
MPv3(engineID.getValue()));

        // add all security protocols
        SecurityProtocols.getInstance().addDefaultProtocols();
        SecurityProtocols.getInstance().addPrivacyProtocol(new Priv3DES());

        USM usm = new USM(SecurityProtocols.getInstance(), engineID, 0);
        SecurityModels.getInstance().addSecurityModel(usm);

        addUser("wes", "MD5", "passphrase", null, null);     // My function
that addes USM user.

        objSnmp.listen();
        objSnmp.addCommandResponder(this);            // This class
implements CommandResponder


        public void processPdu(CommandResponderEvent crEvent) {
               crEvent.setProcessed(true);
               System.out.println("PDU:-" + crEvent.toString());
        }


Thanks in advance,

Regards,
--Tayyab



More information about the SNMP4J mailing list