[SNMP4J] How the class TestAndIncr works?

Frank Fock fock at agentpp.com
Thu Feb 21 19:47:20 CET 2008


Hi Mark,

The TestAndIncr textual convention is defined in SNMPv2-TC
as

TestAndIncr ::= TEXTUAL-CONVENTION
   STATUS  current
   DESCRIPTION
      "Represents integer-valued information used for atomic
      operations.  When the management protocol is used to specify
      that an object instance having this syntax is to be
      modified, the new value supplied via the management protocol
      must precisely match the value presently held by the
      instance.  If not, the management protocol set operation
      fails with an error of `inconsistentValue'.  Otherwise, if
      the current value is the maximum value of 2^31-1 (2147483647
      decimal), then the value held by the instance is wrapped to
      zero; otherwise, the value held by the instance is
      incremented by one.  (Note that regardless of whether the
      management protocol set operation succeeds, the variable-
      binding in the request and response PDUs are identical.)
      The value of the ACCESS clause for objects having this
      syntax is either `read-write' or `read-create'.  When an
      instance of a columnar object having this syntax is created,
      any value may be supplied via the management protocol.
      When the network management portion of the system is re-
      initialized, the value of every object instance having this
      syntax must either be incremented from its value prior to
      the re-initialization, or (if the value prior to the re-
      initialization is unknown) be set to a pseudo-randomly
      generated value."
   SYNTAX INTEGER (0..2147483647)


Best regards,
Frank

Mark Gorokhov wrote:
> Attempt to set from the MIB browser the value '0' for already existing
> value '0' actually sets the new value '1'. And so on: set the value 'n'
> for existing value 'n' sets the value to 'n+1'.
> 
> Is this correct behavior? Is this documented somewhere?
> 
> Mark G.
> 
> -----Original Message-----
> From: snmp4j-bounces at agentpp.org [mailto:snmp4j-bounces at agentpp.org] On
> Behalf Of Mark Gorokhov
> Sent: Thursday, February 21, 2008 10:33 AM
> To: snmp4j at agentpp.org
> Subject: [SNMP4J] How the class TestAndIncr works?
> 
> It's not clear how the class org.snmp4j.agent.mo.snmp.TestAndIncr
> works.
> 
> This class is used for example for the scalar snmpTargetSpinLock in
> SnmpTargetMib. The default value of this scalar is '0'. Attempt to set
> any other value from MIB browser, e.g. '1', always returns
> SnmpConstants.SNMP_ERROR_INCONSISTENT_VALUE in the prepare() method.
> 
> Am I missing something or this is a bug?
> 
> Thanks,
> Mark G.
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j

-- 
AGENT++
http://www.agentpp.com
http://www.mibexplorer.com
http://www.mibdesigner.com




More information about the SNMP4J mailing list