Package org.snmp4j.smi

Examples of org.snmp4j.smi.Address


      }
      if ((separate_queries != null) && ((separate_queries.equals("on")) || separate_queries.equals("true"))) {
        send_separate_queries = true;
      }

      Address targetAddress = GenericAddress.parse("udp:"+host+"/"+port);

      for (Map.Entry<String, String> entry : config.entrySet())
      {
        String type = entry.getKey();
        if (type.length() > 4) {
View Full Code Here


    @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

        if (log.isDebugEnabled())
            log.debug("recv: " + cre);
        PDU pdu = cre.getPDU();
        String sourceAddr;
        Address addr = cre.getPeerAddress();
        if (addr instanceof IpAddress) {
            sourceAddr = ((IpAddress) addr).getInetAddress().toString();
            if (sourceAddr.startsWith("/"))
                sourceAddr = sourceAddr.substring(1);
        } else {
View Full Code Here

    void init(String host, int port, String community, long timeout, int retries) throws SNMPException {
        if (session == null) {
            session = initSession();
        }

        Address address = GenericAddress.parse("udp:" + host + "/" + port);
        this.target = new CommunityTarget();
        this.target.setAddress(address);
        this.target.setCommunity(new OctetString(community));
        this.target.setVersion(this.version);
        this.target.setRetries(retries);
View Full Code Here

    }
  }

  protected void initTransportMappings() throws IOException {
    transportMappings = new TransportMapping[1];
    Address addr = GenericAddress.parse(address);
    TransportMapping tm =
        TransportMappings.getInstance().createTransportMapping(addr);
    transportMappings[0] = tm;
  }
View Full Code Here

    return null;
  }

  public boolean isValidAddress(OID transportDomain, OctetString address) {
    try {
      Address addr = createAddress(transportDomain, address);
      if (addr != null) {
        return true;
      }
    }
    catch (Exception ex) {
View Full Code Here

    };
  }

  protected void addListenAddresses(MessageDispatcher md, List addresses) {
    for (Iterator it = addresses.iterator(); it.hasNext();) {
      Address address = GenericAddress.parse((String)it.next());
      TransportMapping tm =
          TransportMappings.getInstance().createTransportMapping(address);
      if (tm != null) {
        md.addTransportMapping(tm);
      }
View Full Code Here

  }
 
  public static void sendTrap(String address, String community,
      String message, int trapType, int port) throws SNMPException {
    address= address + "/" + port;
    Address targetAddress = GenericAddress.parse(address);
    logger.info("sendig trap to: " + address + ", message: " + message);
   
    CommunityTarget target = new CommunityTarget();
    target.setCommunity(new OctetString(community));
    target.setAddress(targetAddress);
View Full Code Here

  }
 
  public static void snmpSet(String address, String community,
      String oid, int value, int port) throws SNMPException {
    address = address + "/" + port;
    Address targetAddress = GenericAddress.parse(address);
    Snmp snmp;
   
    try {
      TransportMapping transport = new DefaultUdpTransportMapping();
      snmp = new Snmp(transport);
View Full Code Here

      String oid, int port) throws SNMPException {
    int ret = 0;   
    address= address + "/" + port;
   
    try {
      Address targetaddress = new UdpAddress(address);
      TransportMapping transport = new DefaultUdpTransportMapping();
      transport.listen();
      CommunityTarget comtarget = new CommunityTarget();
      comtarget.setCommunity(new OctetString(community));
      comtarget.setVersion(SnmpConstants.version1);
View Full Code Here

TOP

Related Classes of org.snmp4j.smi.Address

Copyright © 2018 www.massapicom. 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.