Package org.snmp4j.smi

Examples of org.snmp4j.smi.OID


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

      final TestResponseListener testListener = new TestResponseListener();

      client.getNextAsync(this.address, testListener, "handle", new OID(
          "1.3.6.1.2.1.1.1"));
      testListener.waitForCallback();
      Assert.assertNotNull(testListener.getResponse());
      Assert.assertTrue(ResponseEvents.extractBindings(
          testListener.getResponse()).containsKey(
View Full Code Here


  public void testGetNextSync() throws IOException {

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

      final ResponseEvent response = client.getNextSync(this.address,
          new OID("1.3.6.1.2.1.1.1"));
      Assert.assertNotNull(response);
      Assert.assertTrue(ResponseEvents.extractBindings(response)
          .containsKey(SnmpConstants.sysDescr));
    }
  }
View Full Code Here

  @Test
  public void testMultiGetNextSync() throws IOException {

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

      final OID beforeSysDescr = new OID("1.3.6.1.2.1.1.1");
      final OID beforeSysLocation = new OID("1.3.6.1.2.1.1.6");
      final ResponseEvent response = client.getNextSync(this.address,
          beforeSysDescr, beforeSysLocation);
      Assert.assertNotNull(response);
      Assert.assertTrue(ResponseEvents.extractBindings(response)
          .containsKey(SnmpConstants.sysDescr));
View Full Code Here

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

      /* And a getNext()... */
      response = client.getNextSync(this.address, new OID(
          "1.3.6.1.2.1.1.1"));
      Assert.assertNotNull(response);
      Assert.assertTrue(ResponseEvents.extractBindings(response)
          .containsKey(SnmpConstants.sysDescr));

View Full Code Here

    this.v1Client.setSync(this.address, NON_V1_BINDING);
  }

  @Test
  public void testTrap() throws IOException {
    this.v1Client.trap(this.address, new OID(new int[] { 1, 3, 6, 1, 6, 3,
        1, 1, 5 }), PDUv1.WARMSTART, 0, new VariableBinding(new OID(
        new int[] { 1, 3, 6, 1, 6, 3, 1, 1, 5, 3 }), new Integer32(7)));
  }
View Full Code Here

        new int[] { 1, 3, 6, 1, 6, 3, 1, 1, 5, 3 }), new Integer32(7)));
  }

  @Test(expected = IllegalArgumentException.class)
  public void testTrapNonV1() throws IOException {
    this.v1Client.trap(this.address, new OID(new int[] { 1, 3, 6, 1, 6, 3,
        1, 1, 5 }), PDUv1.WARMSTART, 0, NON_V1_BINDING);
  }
View Full Code Here

    }

    public void registerOID(String key, String suffix) {
        String oidID = baseOID + suffix;
        log.info("Registering OID " + oidID);
        OID oid = new OID(oidID);
        oidMap.put(key, oid);
    }
View Full Code Here

        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

     */
    public void setValue(String key, Integer value) throws Exception {
        if (!scalars.containsKey(key)) {
            if (!oidMap.containsKey(key))
                throw new Exception("OID for " + key + " not registered. ");
            OID oid = oidMap.get(key);
            MOScalar mo = MOScalarFactory.createReadOnly(oid, key);
            scalars.put(key, mo);
            registerManagedObject(mo, oid.toString());
        }
        MOScalar mo = scalars.get(key);
        if (mo != null) {
            mo.setValue(new Integer32(value));
        }
View Full Code Here

        DefaultMOTable ifTable = new DefaultMOTable(tableRootOid, indexDef, columns.toArray(new MOColumn[0]));
        MOMutableTableModel model = (MOMutableTableModel) ifTable.getModel();
        int i = 1;

        for (Variable[] variables : tableRows) {
            model.addRow(new DefaultMOMutableRow2PC(new OID(String.valueOf(i)), variables));
            i++;
        }
        ifTable.setVolatile(true);
        return ifTable;
    }
View Full Code Here

TOP

Related Classes of org.snmp4j.smi.OID

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.