Examples of UdpAddress


Examples of org.snmp4j.smi.UdpAddress

    {
      TransportIpAddress transportIpAddress;
      if (address.getPort() <= 0)
        address.setPort(162);
      if (address.isUdp())
        transportIpAddress = new UdpAddress(address.getInetAddress(), address.getPort());
      else
        transportIpAddress = new TcpAddress(address.getInetAddress(), address.getPort());
 
      snmpTargetMIB.addTargetAddress(new OctetString("notification" + address.getHost()),
          address.getTransportDomain(),
View Full Code Here

Examples of org.snmp4j.smi.UdpAddress

      {
        if (_connectors[i].getPort() <= 0)
          _connectors[i].setPort(161);
        if (_connectors[i].isUdp())
        {
          UdpAddress address = new UdpAddress(_connectors[i].getInetAddress(), _connectors[i].getPort());
          transportMappings[i] = new DefaultUdpTransportMapping(address);
        }
        else
        {
          TcpAddress address = new TcpAddress(_connectors[i].getInetAddress(), _connectors[i].getPort());
View Full Code Here

Examples of org.snmp4j.smi.UdpAddress

            }
          }
        }
      }

      UdpAddress udpAddr = new UdpAddress(UdpAddress.ANY_IPADDRESS, 0);
      Snmp snmp = new Snmp(new DefaultUdpTransportMapping(udpAddr));
      /* the snmp connection is open... add a seprate try/catch so we can make sure we close it */
      try {
        if ((version.equals("1")) || (version.equals("2c"))) {
          target = getCommunityTarget(targetAddress, Integer.parseInt(timeout), community, version);
View Full Code Here

Examples of org.snmp4j.smi.UdpAddress

    public SnmpHelper(String address, String community) {
        _target = new CommunityTarget();
        _target.setCommunity(new OctetString(community));
        _target.setVersion(SnmpConstants.version2c);
        _target.setAddress(new UdpAddress(address));
        try {
            _snmp = new Snmp(new DefaultUdpTransportMapping());
        } catch (IOException e) {
            _snmp = null;
            throw new CloudRuntimeException(" Error in crearting snmp object, " + e.getMessage());
View Full Code Here

Examples of org.snmp4j.smi.UdpAddress

        String transport = systemConfig.getSimpleValue("transport","UDP");


        String address = host + "/" + port;
        if (transport.equalsIgnoreCase(UDP_TRANSPORT)) {
            return new UdpAddress(address);
        } else if (transport.equalsIgnoreCase(TCP_TRANSPORT)) {
            return new TcpAddress(address);
        }

        throw new IllegalArgumentException("Unknown transport: " + transport);
View Full Code Here

Examples of org.snmp4j.smi.UdpAddress

    @BeforeMethod
    public void setUp() throws Exception {
        receivedTraps = new ConcurrentLinkedQueue<PDU>();

        snmp = new Snmp(new DefaultUdpTransportMapping());
        Address targetAddress = new UdpAddress(getTestPort());
        boolean installedTrapListener = snmp.addNotificationListener(targetAddress, new CommandResponder() {
            @Override
            public void processPdu(CommandResponderEvent event) {
                receivedTraps.offer(event.getPDU());
            }
View Full Code Here

Examples of org.snmp4j.smi.UdpAddress

        add(pdu, alertSeverity, Severity.medium);

        CommunityTarget target = new CommunityTarget();
        target.setCommunity(community);
        target.setVersion(SnmpConstants.version2c);
        target.setAddress(new UdpAddress(address, port));
        target.setTimeout(1000);
        target.setRetries(2);

        try {
            snmp.send(pdu, target);
View Full Code Here

Examples of org.snmp4j.smi.UdpAddress

        eventContext = context.getEventContext();

        // TODO: check if the engine is already alive
        try {
            UdpAddress targetAddress = new UdpAddress(port);
            // TransportMapping transport = new DefaultUdpTransportMapping(targetAddress);
            snmp = new Snmp(new DefaultUdpTransportMapping());
            snmpTrapEventPoller = new SnmpTrapEventPoller(severityOid);
            eventContext.registerEventPoller(snmpTrapEventPoller, pollInterval);
            // TODO set up the community here
View Full Code Here

Examples of org.snmp4j.smi.UdpAddress

    private Snmp initSession() throws SNMPException {
        try {
            InetAddress host = InetAddress.getByName(ANY_LOCAL_ADDRESS);
            int port = ANY_FREE_PORT;
            UdpAddress addr = new UdpAddress(host, port);
            session = new Snmp(new DefaultUdpTransportMapping(addr));
            session.listen();
        } catch (IOException e) {
            throw new SNMPException("Failed to initialize SNMP session.", e);
        }
View Full Code Here

Examples of org.snmp4j.smi.UdpAddress

      if (TransportDomains.transportDomainTcpIpv4.equals(transportDomain) ||
          TransportDomains.transportDomainTcpIpv6.equals(transportDomain)) {
        transportIpAddress = new TcpAddress();
      }
      else {
        transportIpAddress = new UdpAddress();
      }
      try {
        transportIpAddress.setTransportAddress(address);
      }
      catch (Exception ex) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.