Search in sources :

Example 1 with PduHandle

use of org.snmp4j.mp.PduHandle in project opennms by OpenNMS.

the class Snmp4JStrategy method sendTest.

public void sendTest(String agentAddress, int port, String community, PDU pdu) {
    for (RegistrationInfo info : s_registrations.values()) {
        if (port == info.getPort()) {
            final Snmp snmp = info.getSession();
            Snmp4JStrategy.trackSession(snmp);
            MessageDispatcher dispatcher = snmp.getMessageDispatcher();
            TransportMapping<UdpAddress> transport = info.getTransportMapping();
            int securityModel = (pdu instanceof PDUv1 ? SecurityModel.SECURITY_MODEL_SNMPv1 : SecurityModel.SECURITY_MODEL_SNMPv2c);
            int messageModel = (pdu instanceof PDUv1 ? MessageProcessingModel.MPv1 : MessageProcessingModel.MPv2c);
            CommandResponderEvent e = new CommandResponderEvent(dispatcher, transport, new IpAddress(agentAddress), messageModel, securityModel, community.getBytes(), SecurityLevel.NOAUTH_NOPRIV, new PduHandle(), pdu, 1000, null);
            info.getHandler().processPdu(e);
        }
    }
}
Also used : PduHandle(org.snmp4j.mp.PduHandle) MessageDispatcher(org.snmp4j.MessageDispatcher) UdpAddress(org.snmp4j.smi.UdpAddress) CommandResponderEvent(org.snmp4j.CommandResponderEvent) Snmp(org.snmp4j.Snmp) IpAddress(org.snmp4j.smi.IpAddress) PDUv1(org.snmp4j.PDUv1)

Aggregations

CommandResponderEvent (org.snmp4j.CommandResponderEvent)1 MessageDispatcher (org.snmp4j.MessageDispatcher)1 PDUv1 (org.snmp4j.PDUv1)1 Snmp (org.snmp4j.Snmp)1 PduHandle (org.snmp4j.mp.PduHandle)1 IpAddress (org.snmp4j.smi.IpAddress)1 UdpAddress (org.snmp4j.smi.UdpAddress)1