Package org.snmp4j.smi

Examples of org.snmp4j.smi.OctetString


    this.v1Client = new StandardSNMPv1<UdpAddress>(V1V2COMMUNITY,
        new DefaultUdpTransportMapping());
    this.v2Client = new StandardSNMPv2<UdpAddress>(V1V2COMMUNITY,
        new DefaultUdpTransportMapping());
    this.v3Client = new StandardSNMPv3<UdpAddress>(usmUser,
        new OctetString(), new DefaultUdpTransportMapping());

    this.allClients.add(this.v1Client);
    this.allClients.add(this.v2Client);
    // this.allClients.add(this.v3Client);
View Full Code Here


  public void testMultiSetSync() throws IOException {

    for (final SNMP<UdpAddress> client : this.allClients) {

      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,
View Full Code Here

    Assert.assertNotNull(response);
    Assert.assertTrue(ResponseEvents.extractBindings(response).containsKey(
        SnmpConstants.sysDescr));

    /* Test an invalid security name */
    final UsmUser invalidUser = new UsmUser(new OctetString("invalidName"),
        V3AUTHPROTO, V3AUTHPASS, V3PRIVPROTO, V3PRIVPASS);
    final SNMPv3<UdpAddress> invalidV3Client = new StandardSNMPv3<UdpAddress>(
        invalidUser, new OctetString(),
        new DefaultUdpTransportMapping());
    response = invalidV3Client
        .getSync(this.address, SnmpConstants.sysDescr);
    Assert.assertNotNull(response);
    Assert.assertFalse(ResponseEvents.extractBindings(response)
View Full Code Here

    for (final SNMP<UdpAddress> client : this.allClients) {

      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();
View Full Code Here

  public void testSetSync() throws IOException {

    for (final SNMP<UdpAddress> client : this.allClients) {

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

     * @throws IOException
     */
    SNMP4JFacade(String address) throws IOException {
        // These files does not exist and are not used but has to be specified
        // Read snmp4j docs for more info
        super(new File("conf.agent"), new File("bootCounter.agent"), new CommandProcessor(new OctetString(
                MPv3.createLocalEngineID())));
        this.address = address;
        start();

    }
View Full Code Here

     * Configuration Datastore (LCD).
     *
     * We only configure one, "public".
     */
    protected void addCommunities(SnmpCommunityMIB communityMIB) {
        Variable[] com2sec = new Variable[] { new OctetString("public"), // community
                                                                         // name
                new OctetString("cpublic"), // security name
                getAgent().getContextEngineID(), // local engine ID
                new OctetString("public"), // default context name
                new OctetString(), // transport tag
                new Integer32(StorageType.nonVolatile), // storage type
                new Integer32(RowStatus.active) // row status
        };
        MOTableRow row = communityMIB.getSnmpCommunityEntry().createRow(
                new OctetString("public2public").toSubIndex(true), com2sec);
        communityMIB.getSnmpCommunityEntry().addRow(row);
    }
View Full Code Here

     * http://www.faqs.org/rfcs/rfc2575.html
     */
    @Override
    protected void addViews(VacmMIB vacm) {

        vacm.addGroup(SecurityModel.SECURITY_MODEL_SNMPv2c, new OctetString("cpublic"), new OctetString("v1v2group"),
                StorageType.nonVolatile);

        vacm.addAccess(new OctetString("v1v2group"), new OctetString("public"), SecurityModel.SECURITY_MODEL_ANY,
                SecurityLevel.NOAUTH_NOPRIV, MutableVACM.VACM_MATCH_EXACT, new OctetString("fullReadView"),
                new OctetString("fullWriteView"), new OctetString("fullNotifyView"), StorageType.nonVolatile);

        vacm.addViewTreeFamily(new OctetString("fullReadView"), new OID("1.3"), new OctetString(),
                VacmMIB.vacmViewIncluded, StorageType.nonVolatile);
    }
View Full Code Here

    /**
     * Clients can register the MO they need
     */
    public void registerManagedObject(ManagedObject mo, String oid) {
        try {
            server.register(mo, new OctetString("public"));
        } catch (DuplicateRegistrationException ex) {
            throw new RuntimeException(ex);
        }
    }
View Full Code Here

        init();
        // This method reads some old config from a file and causes
        // unexpected behavior.
        // loadConfig(ImportModes.REPLACE_CREATE);
        addShutdownHook();
        getServer().addContext(new OctetString("public"));
        finishInit();
        run();
        sendColdStartNotification();
        unregisterManagedObject(getSnmpv2MIB());
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.