Package org.snmp4j.smi

Examples of org.snmp4j.smi.OctetString


                variable = new UnsignedInteger32(Long.parseLong(value));
                break;
            }

            case 's': {
                variable = new OctetString(value);
                break;
            }

            case 'x': {
                variable = OctetString.fromString(value, ':', 16);
View Full Code Here


        vbs.add(vb);
    }

    private static OctetString createOctetString(String s) {
        OctetString octetString;
        if (s.startsWith("0x")) {
            octetString = OctetString.fromHexString(s.substring(2), ':');
        } else {
            octetString = new OctetString(s);
        }

        return octetString;
    }
View Full Code Here

            assertVariableBindingIsPrefixed(variableBinding, oidPrefix);
            assertVariableBindingHasStringValue(variableBinding);

            switch (variableBindingsIterator.previousIndex()) {
            case 2:
                assertEquals(variableBinding.getVariable(), new OctetString(expectedValues.getAlertDefinitionName()));
                break;
            case 3:
                assertEquals(variableBinding.getVariable(), new OctetString(expectedValues.getResourceName()));
                break;
            case 4:
                assertEquals(variableBinding.getVariable(), new OctetString(expectedValues.getPlatformName()));
                break;
            case 5:
                assertEquals(variableBinding.getVariable(), new OctetString(expectedValues.getAlertConditions()));
                break;
            case 6:
                assertEquals(variableBinding.getVariable(), new OctetString(expectedValues.getAlertPriority()
                    .toString().toLowerCase()));
                break;
            case 7:
                assertEquals(variableBinding.getVariable(), new OctetString(expectedValues.getAlertUrl()));
                break;
            case 8:
                assertEquals(variableBinding.getVariable(), new OctetString(expectedValues.getPlatformName() + "::"
                    + expectedValues.getResourceName() + "::"));
                break;
            default:
                throw new RuntimeException("Unexpected index: " + variableBindingsIterator.previousIndex());
            }
View Full Code Here

        }
    }

    private void add(PDU pdu, OID oid, Object message) {
        String s = String.valueOf(message);
        pdu.add(new VariableBinding(oid, new OctetString(s)));
    }
View Full Code Here

        }

        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);
        this.target.setTimeout(timeout);
    }
View Full Code Here

  public void prepare(SubRequest subRequest, MOTableRow row,
                      MOTableRow changeSet, int column) {
    Variable[] indexValues =
        ((UsmMIB.UsmTableRow)row).getIndexDef().getIndexValues(row.getIndex());
    OctetString userName = (OctetString) indexValues[1];
    if ((!subRequest.getRequest().getSecurityName().equals(userName)) ||
        subRequest.getRequest().getSecurityModel() !=
        SecurityModel.SECURITY_MODEL_USM) {
      subRequest.getStatus().setErrorStatus(PDU.noAccess);
    }
View Full Code Here

  private int type;

  public UsmKeyChange(int columnID,
                      MOAccess access, int type) {
    super(columnID, access, new OctetString(), true);
    this.type = type;
  }
View Full Code Here

      int digestLength = getDigestLength(usmRow, changeSet);
      if (digestLength <= 0) {
        subRequest.completed();
        return;
      }
      OctetString v =
          (OctetString) subRequest.getVariableBinding().getVariable();
      if (v.length() != digestLength) {
        subRequest.getStatus().setErrorStatus(PDU.wrongValue);
      }
    }
  }
View Full Code Here

  private void createMOs() {
    snmpEngineID = new MOScalar(new OID("1.3.6.1.6.3.10.2.1.1.0"),
                                MOAccessImpl.ACCESS_READ_ONLY,
                                null) {
      public Variable getValue() {
        return new OctetString(getUSM().getLocalEngineID());
      }
    };
    snmpEngineBoots = new MOScalar(new OID("1.3.6.1.6.3.10.2.1.2.0"),
                                   MOAccessImpl.ACCESS_READ_ONLY,
                                   null) {
View Full Code Here

  protected List groups = new ArrayList();

  public SnapshotAgent(File bootCounterFile, File configFile,
                       File snapshot) throws IOException {
    super(bootCounterFile, configFile,
          new CommandProcessor(new OctetString(MPv3.createLocalEngineID())));
// Alternatively:       OctetString.fromHexString("00:00:00:00:00:00:02", ':');
    agent.setWorkerPool(ThreadPool.create("RequestPool", 2));
    this.snapshot = snapshot;
  }
View Full Code Here

TOP

Related Classes of org.snmp4j.smi.OctetString

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.