Example #1
0
 /**
  * Add directly a VariableBinding to the map it will be stored as a key/value and the original
  * snmp datas will be lost only not
  *
  * @param vb
  */
 public boolean addVariable(VariableBinding vb) {
   boolean retValue = false;
   if (vb == null) {
     logger.error("null variable to add ?");
   } else if (!vb.isException()) {
     OID vbOid = vb.getOid();
     put(vbOid, convertVar(vb.getVariable()));
     retValue = true;
   } else {
     errors.put(vb.getOid(), vb.getSyntax());
     int exception = vb.getSyntax();
     String exceptionName = "";
     switch (exception) {
       case SMIConstants.EXCEPTION_END_OF_MIB_VIEW:
         exceptionName = "End of mib view";
         break;
       case SMIConstants.EXCEPTION_NO_SUCH_INSTANCE:
         exceptionName = "No such instance";
         break;
       case SMIConstants.EXCEPTION_NO_SUCH_OBJECT:
         exceptionName = "No such object";
         break;
       default:
         exceptionName = "Unknown exception";
         break;
     }
     logger.trace("Exception " + exceptionName + " for " + vb.getOid());
   }
   return retValue;
 }
Example #2
0
 public void verify(VariableBinding vb) {
   assertNotNull("variable binding should not be null", vb);
   Variable val = vb.getVariable();
   assertNotNull("variable should not be null", val);
   assertEquals("OID (value: " + val + ")", new OID(m_expectedOid), vb.getOid());
   assertEquals("syntax", m_expectedSyntax, vb.getSyntax());
   assertEquals("value", m_expectedValue, val);
 }