Examples of VariableBinding


Examples of org.snmp4j.smi.VariableBinding

        this.pdu.clear();
        this.pdu.setType(PDU.GET);

        // prepare the request items
        for (OID oid : this.endpoint.getOids()) {
            this.pdu.add(new VariableBinding(oid));
        }

        // send the request
        snmp.send(pdu, target, null, this);
View Full Code Here

Examples of org.snmp4j.smi.VariableBinding

        // prepare the header
        sb.append(SNMP_TAG_OPEN);
               
        // now loop all variables of the response
        for (Object o : pdu.getVariableBindings()) {
            VariableBinding b = (VariableBinding)o;

            sb.append(ENTRY_TAG_OPEN);
            sb.append(OID_TAG_OPEN);
            sb.append(b.getOid().toString());
            sb.append(OID_TAG_CLOSE);
            sb.append(VALUE_TAG_OPEN);
            sb.append(getXmlSafeString(b.getVariable().toString()));
            sb.append(VALUE_TAG_CLOSE);
            sb.append(ENTRY_TAG_CLOSE);
        }
       
        // prepare the footer
View Full Code Here

Examples of org.snmp4j.smi.VariableBinding

        this.pdu.clear();
        this.pdu.setType(PDU.GET);

        // prepare the request items
        for (OID oid : this.endpoint.getOids()) {
            this.pdu.add(new VariableBinding(oid));
        }

        // send the request
        snmp.send(pdu, target, null, this);
View Full Code Here

Examples of org.snmp4j.smi.VariableBinding

    target.setCommunity(new OctetString(community));
    target.setAddress(targetAddress);
   
    PDUv1 pdu = new PDUv1();
    pdu.setType(PDU.V1TRAP);
    VariableBinding vb = new VariableBinding();
    OID oidMessage = new OID (alarmMessageOid);
    vb.setOid(oidMessage);
    if(message.length() < MAX_ALARM_MESSAGE_SIZE) {
      vb.setVariable(new OctetString(message));
    } else {
      String tmpMessage = message.substring(0,MAX_ALARM_MESSAGE_SIZE);
      logger.info(" message too long " + message  +
          ". send " + tmpMessage);
      vb.setVariable(new OctetString(tmpMessage));
    }
    pdu.add(vb);   
    OID oid  = new OID(trapId);
    if(trapType == CRITICAL_TRAP) {
      pdu.setSpecificTrap(CRITICAL_TRAP);
View Full Code Here

Examples of org.snmp4j.smi.VariableBinding

      target.setAddress(targetAddress);
      target.setRetries(0);
      target.setTimeout(200);
      target.setVersion(SnmpConstants.version2c);
      PDU pdu = new PDU();
      pdu.add(new VariableBinding(new OID(oid), new Integer32(value)));
      pdu.setType(PDU.SET);
      ResponseListener listener = new ResponseListener() {
        public void onResponse(ResponseEvent event) {
        // Always cancel async request when response has been received
        // otherwise a memory leak is created! Not canceling a request
View Full Code Here

Examples of org.snmp4j.smi.VariableBinding

      comtarget.setRetries(2);
      comtarget.setTimeout(5000);
      PDU pdu = new PDU();
      ResponseEvent response;
      Snmp snmp;
      pdu.add(new VariableBinding(new OID(oid)));
      pdu.setType(PDU.GET);
      snmp = new Snmp(transport);
      response = snmp.get(pdu,comtarget);
      if(response != null) {
        String errorStatus =
View Full Code Here

Examples of org.snmp4j.smi.VariableBinding

    Preconditions.checkNotNull(oids);

    final VariableBinding[] wrapped = new VariableBinding[oids.length];
    int index = 0;
    for (final OID oid : oids) {
      wrapped[index++] = new VariableBinding(oid);
    }
    return wrapped;
  }
View Full Code Here

Examples of org.snmp4j.smi.VariableBinding

      final String random = Integer.toString(new Random().nextInt(100));
      final OctetString location = new OctetString("SECRET SITE #"
          + random);
      final OctetString descr = new OctetString("SECRET DEVICE " + random);
      final VariableBinding binding1 = new VariableBinding(
          SnmpConstants.sysLocation, location);
      final VariableBinding binding2 = new VariableBinding(
          SnmpConstants.sysDescr, descr);
      ResponseEvent response = client.setSync(this.address, binding1,
          binding2);
      Assert.assertNotNull(response);
      Assert.assertTrue(ResponseEvents.extractBindings(response)
View Full Code Here

Examples of org.snmp4j.smi.VariableBinding

  }

  @Test
  public void testNotify() throws IOException {
    for (final SNMPv2<UdpAddress> v2Client : this.v2Clients) {
      v2Client.notify(this.address, new VariableBinding(
          SnmpConstants.sysDescr));
    }
  }
View Full Code Here

Examples of org.snmp4j.smi.VariableBinding

      final TestResponseListener testListener = new TestResponseListener();

      final OctetString location = new OctetString("SECRET SITE #"
          + Integer.toString(new Random().nextInt(100)));
      final VariableBinding binding = new VariableBinding(
          SnmpConstants.sysLocation, location);
      client.setAsync(this.address, testListener, "handle", binding);
      testListener.waitForCallback();
      Assert.assertNotNull(testListener.getResponse());
      Assert.assertTrue(ResponseEvents.extractBindings(
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.