Package org.snmp4j.smi

Examples of org.snmp4j.smi.OID


    this.transportMappings = transportMappings;
    createMOs();
  }

  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) {
      public Variable getValue() {
        return new Integer32(getUSM().getEngineBoots());
      }
    };
    snmpEngineTime = new MOScalar(new OID("1.3.6.1.6.3.10.2.1.3.0"),
                                  MOAccessImpl.ACCESS_READ_ONLY,
                                  null) {
      public Variable getValue() {
        return new Integer32(getUSM().getEngineTime());
      }
    };
    Integer32 maxMsgSize = new Integer32(getMaxMessageSize());
    snmpEngineMaxMessageSize = new MOScalar(new OID("1.3.6.1.6.3.10.2.1.4.0"),
                                            MOAccessImpl.ACCESS_READ_ONLY,
                                            maxMsgSize);
  }
View Full Code Here


                   new OctetString("testReadView"),
                   new OctetString("testWriteView"),
                   new OctetString("testNotifyView"),
                   StorageType.nonVolatile);

    vacm.addViewTreeFamily(new OctetString("fullReadView"), new OID("1.3"),
                           new OctetString(), VacmMIB.vacmViewIncluded,
                           StorageType.nonVolatile);
    vacm.addViewTreeFamily(new OctetString("fullWriteView"), new OID("1.3"),
                           new OctetString(), VacmMIB.vacmViewIncluded,
                           StorageType.nonVolatile);
    vacm.addViewTreeFamily(new OctetString("fullNotifyView"), new OID("1.3"),
                           new OctetString(), VacmMIB.vacmViewIncluded,
                           StorageType.nonVolatile);

    vacm.addViewTreeFamily(new OctetString("restrictedReadView"),
                           new OID("1.3.6.1.2"),
                           new OctetString(), VacmMIB.vacmViewIncluded,
                           StorageType.nonVolatile);
    vacm.addViewTreeFamily(new OctetString("restrictedWriteView"),
                           new OID("1.3.6.1.2.1"),
                           new OctetString(),
                           VacmMIB.vacmViewIncluded,
                           StorageType.nonVolatile);
    vacm.addViewTreeFamily(new OctetString("restrictedNotifyView"),
                           new OID("1.3.6.1.2"),
                           new OctetString(), VacmMIB.vacmViewIncluded,
                           StorageType.nonVolatile);
    vacm.addViewTreeFamily(new OctetString("restrictedNotifyView"),
                           new OID("1.3.6.1.6.3.1"),
                           new OctetString(), VacmMIB.vacmViewIncluded,
                           StorageType.nonVolatile);

    vacm.addViewTreeFamily(new OctetString("testReadView"),
                           new OID("1.3.6.1.2"),
                           new OctetString(), VacmMIB.vacmViewIncluded,
                           StorageType.nonVolatile);
    vacm.addViewTreeFamily(new OctetString("testReadView"),
                           new OID("1.3.6.1.2.1.1"),
                           new OctetString(), VacmMIB.vacmViewExcluded,
                           StorageType.nonVolatile);
    vacm.addViewTreeFamily(new OctetString("testWriteView"),
                           new OID("1.3.6.1.2.1"),
                           new OctetString(),
                           VacmMIB.vacmViewIncluded,
                           StorageType.nonVolatile);
    vacm.addViewTreeFamily(new OctetString("testNotifyView"),
                           new OID("1.3.6.1.2"),
                           new OctetString(), VacmMIB.vacmViewIncluded,
                           StorageType.nonVolatile);

  }
View Full Code Here

      ois.close();
      logger.info("Snapshot file '"+snapshot+
                  "' contains "+l.size()+" objects.");
      OctetString ctx = new OctetString();
      SortedMap roots = new TreeMap();
      OID last = null;
      for (Iterator it = l.iterator(); it.hasNext(); ) {
        VariableBinding vb = (VariableBinding) it.next();
        if (last != null) {
          int min = Math.min(vb.getOid().size(), last.size());
          while (min > 0) {
            if (vb.getOid().leftMostCompare(min, last) == 0) {
              OID root = new OID(last.getValue(), 0, min);
              roots.put(root, root);
              break;
            }
            min--;
          }
        }
        last = vb.getOid();
      }
      logger.info("Identified the following sub-tree candidates: "+roots);
      SortedMap rootsCopy = new TreeMap();
      for (Iterator it = roots.keySet().iterator(); it.hasNext();) {
        OID k = (OID) it.next();
        if (k.size() > 1) {
          OID sk = new OID(k.getValue(), 0, k.size()-1);
          while ((sk.size() > 0) &&  (roots.get(sk) == null)) {
            sk.trim(1);
          }
          if (sk.size() == 0) {
            rootsCopy.put(k,k);
          }
        }
      }
      logger.info("Identified the following sub-trees "+rootsCopy);
      for (Iterator it = rootsCopy.keySet().iterator(); it.hasNext();) {
        OID root = (OID) it.next();
        ArrayList subtree = new ArrayList();
        for (Iterator vit = l.iterator(); vit.hasNext(); ) {
          VariableBinding vb = (VariableBinding) vit.next();
          if (vb.getOid().size() >= root.size()) {
            if (vb.getOid().leftMostCompare(root.size(), root) == 0) {
              subtree.add(vb);
            }
          }
        }
        StaticMOGroup group =
            new StaticMOGroup(root, (VariableBinding[])
                              subtree.toArray(new VariableBinding[subtree.size()]));
        DefaultMOContextScope scope =
            new DefaultMOContextScope(ctx,
                                      root, true, root.nextPeer(), false);
        ManagedObject mo = server.lookup(new DefaultMOQuery(scope, false));
        if (mo != null) {
          logger.warn("Could not register snapshot subtree '"+root+
                      "' with "+subtree+" because ManagedObject "+mo+
                      " is already registered");
View Full Code Here

  public synchronized Iterator iterator() {
    return rows.values().iterator();
  }

  public synchronized MOTableRow firstRow() {
    OID index = firstIndex();
    if (index != null) {
      return (MOTableRow) rows.get(index);
    }
    return null;
  }
View Full Code Here

    }
    return null;
  }

  public synchronized MOTableRow lastRow() {
    OID index = lastIndex();
    if (index != null) {
      return (MOTableRow) rows.get(index);
    }
    return null;
  }
View Full Code Here

    }
    return -1;
  }

  public static OID getTrapOID(OID enterprise, int genericID, int specificID) {
    OID oid;
    if (genericID != 6) {
      oid = new OID(snmpTraps);
      oid.append(genericID+1);
    }
    else {
      oid = new OID(enterprise);
      oid.append(0);
      oid.append(specificID);
    }
    return oid;
  }
View Full Code Here

   */
  public DefaultCounterListener() {
  }

  public synchronized void incrementCounter(CounterEvent event) {
    OID id = event.getOid();
    VariableBinding counter = (VariableBinding) counters.get(id);
    if (counter == null) {
      counter = new VariableBinding(id, new Counter32(1));
      counters.put(id, counter);
    }
View Full Code Here

      if (sn != null) {
        String authPP =
            (String) ArgumentParser.getValue(settings, oAuthPassphrase, 0);
        String privPP =
            (String) ArgumentParser.getValue(settings, oPrivPassphrase, 0);
        OID authProtocol = null;
        String authP =
            (String) ArgumentParser.getValue(settings, oAuthProtocol, 0);
        String privP =
            (String) ArgumentParser.getValue(settings, oPrivProtocol, 0);
        OID privProtocol = null;
        if ("MD5".equals(authP)) {
          authProtocol = AuthMD5.ID;
        }
        else if ("SHA".equals(authP)) {
          authProtocol = AuthSHA.ID;
View Full Code Here

          pdu.add(new VariableBinding(SnmpConstants.sysUpTime,
                                      new TimeTicks(tu.longValue())));
        }
        String to = (String) ArgumentParser.getValue(settings, oTrapOID, 0);
        if (to != null) {
          pdu.add(new VariableBinding(SnmpConstants.snmpTrapOID, new OID(to)));
        }
      }
      else if (type == PDU.V1TRAP) {
        PDUv1 pduV1 = (PDUv1)pdu;
        String aa =
            (String) ArgumentParser.getValue(settings, oAgentAddr, 0);
        if (aa != null) {
          pduV1.setAgentAddress(new IpAddress(aa));
        }
        Integer gid = (Integer) ArgumentParser.getValue(settings, oGenericID, 0);
        if (gid != null) {
          pduV1.setGenericTrap(gid.intValue());
        }
        Integer sid = (Integer) ArgumentParser.getValue(settings, oSpecificID, 0);
        if (sid != null) {
          pduV1.setSpecificTrap(sid.intValue());
        }
        String e =
            (String) ArgumentParser.getValue(settings, oEnterprise, 0);
        if (e != null) {
          pduV1.setEnterprise(new OID(e));
        }
      }
      if (pdu instanceof ScopedPDU) {
        ScopedPDU scoped = (ScopedPDU)pdu;
        String cEngineID =
View Full Code Here

        buf = new StringBuffer();
        t = t.substring(1);
      }
      if ((buf != null) && (t.endsWith("'"))) {
        buf.append(t.substring(0, t.length()-1));
        OID o = new OctetString(buf.toString()).toSubIndex(true);
        int[] h = value;
        value = new int[st.countTokens()+h.length+o.size()];
        System.arraycopy(h, 0, value, 0, size);
        System.arraycopy(o.getValue(), 0, value, size, o.size());
        size += o.size();
        buf = null;
      }
      else if (buf != null) {
        buf.append(t);
      }
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.