Sun Microsystems
Products & Services
 
Support & Training
 
 

Previous Previous     Contents     Index     Next Next

(**) See Table 20-5.

Table 20-3 Error Translation From SNMPv1 Subagents to SNMPv1 Managers

PDU Type

Error From SNMPv1 Subagents

Error Sent to SNMPv1 Managers

get

genErr

genErr

get

noSuchName

noSuchName

get

tooBig

handled by stack => resend or tooBig

get

any other error

genErr

set

any error

genErr (**) - undoFailed is translated into genErr

get-next

genErr

genErr

get-next

noSuchName

noSuchName

get-next

tooBig

handled by stack => resend or tooBig

get-next

any other error

genErr

(**) See Table 20-5.

Table 20-4 Error Translation from SNMPv2/v3 Subagents to SNMPv2/v3 Managers

PDU Type

Error From SNMPv2/v3 Subagents

Error Sent to SNMPv2/v3 Managers

get

noError

noError

get

tooBig

handled by stack => resend or tooBig

get

any other error

same error (if valid) or genErr

set

any error

undoFailed (**)

get-next/get-bulk

noError

noError

get-next/get-bulk

tooBig

handled by stack => resend or tooBig or truncated response (GET-BULK)

get-next/get-bulk

any other error

same error (if valid) or genErr

(**) By default SnmpProxy sends the remote set request during the set() phase of the set operation. When an error occurs during the set() phase, undoFailed is returned to the manager because the atomicity is no longer guaranteed. Note that in the special case where an SnmpProxy is configured to perform the remote set request during the check() phase of the set operation, the following translation is applied for errors returned by the remote set request, even if the atomicity of the set request is broken, as shown in the following table.

Table 20-5 Error Translation When SnmpProxy Performs Remote set

Before Translation

After Translation

v1 errorStatus

v2/v3 errorStatus

noError

noError

noSuchName

noSuchName

genErr

genErr

badValue

wrongValue

readOnly

wrongValue

v2/v3 errorStatus

v1 errorStatus

noError

noError

genErr

genErr

wrongValue, wrongEncoding, wrongLength, wrongType, inconsistentValue

badValue

noAccess, notWritable, noCreation, inconsistentName, authorizationError

noSuchName

resourceUnavailable, commitFailed, undoFailed, any other error

genErr

v1 errorStatus

v1 errorStatus

any error

same error (if valid); genErr otherwise

v2/v3 errorStatus

v2/v3 errorStatus

any error

same error (if valid); genErr otherwise

v1 errorStatus

v2/v3 errorStatus

noError

noError

noSuchName

noSuchName

genErr

genErr

badValue

wrongValue

readOnly

wrongValue

v2/v3 errorStatus

v1 errorStatus

noError

noError

genErr

genErr

wrongValue, wrongEncoding, wrongLength, wrongType, inconsistentValue

badValue

noAccess, notWritable, noCreation, inconsistentName, authorizationError

noSuchName

resourceUnavailable, commitFailed, undoFailed, any other error

genErr

v1 errorStatus

v1 errorStatus

any error

same error (if valid); genErr otherwise

v2/v3 errorStatus

v2/v3 errorStatus

any error

same error (if valid); genErr otherwise

20.7 SNMP Master Agent Examples

These examples show you how to register local and remote MIBs within the master agent SNMP adaptor. They demonstrate how to instantiate and use the SnmpProxy and SnmpUsmProxy classes to register the remote MIBs.

In these examples, we demonstrate two different types of SNMP master agent that delegate handling of SNMP requests to subagents:

  • A master agent, which hides a single subagent and contains a single remote MIB implemented by that subagent

  • An overlap master agent, which locally implements part of a MIB whose OID space overlaps with the MIB implemented by its subagent

These examples also contain a manager which is used to send requests to the master agent. This manager operates in synchronous mode. Manager requests are sent both in SNMPv2 and SNMPv3.

Before going through this example, you must be familiar with the agent and manager examples described in Chapter 16, Creating an SNMP Agent and Chapter 17, Developing an SNMP Manager.

The following applications are used in these examples:

SimpleManager

A manager used to query the master agent. This class is in the examplesDir/current/Snmp/MasterAgent/manager directory. The SimpleManager application makes SNMP requests both in SNMPv3 and in SNMPv2 on a Java DMK master agent, and listens to forwarded traps.

StandAloneAgent

A Java DMK SNMPv1/v2 standalone subagent. This class is in the examplesDir/current/Snmp/MasterAgent/standalone directory. The StandAloneAgent application is a multi-protocol SNMP agent implementing a simple MIB containing four OIDs:

  • sysDescr1 value "error1"

  • sysDescr2 value "error2"

  • sysDescr3 value "sysDescr3"

  • sysDescr4 value "sysDescr4"

This simple MIB contains a single fake system group registered in the OID space of MIB-II.

MasterAgent

A simple SNMPv1/v2 master agent, configured with a single remote MIB implemented by a single subagent. This class is in the examplesDir/current/Snmp/MasterAgent/master directory. The MasterAgent application registers an SnmpProxy to forward requests to the remote MIB implemented by the StandAloneAgent, and forwards SNMPv1 and v2 traps to SNMPv1 and v2 managers.

MasterAgentV3

A simple SNMPv3 master agent, configured with a single remote MIB implemented by a single subagent. This class is in the examplesDir/current/Snmp/MasterAgent/master directory. The MasterAgentV3 application registers an SnmpUsmProxy to forward requests to the remote MIB implemented by the StandAloneAgent and forwards SNMPv1 and SNMPv2 traps to SNMPv3 managers.

MasterAgent

A simple master agent that deals with MIBs whose OID spaces overlap. This class is in the examplesDir/current/Snmp/MasterAgent/overlap directory. The MasterAgent application registers an SnmpProxy to forward requests to the remote MIB implemented by the StandAloneAgent subagent. It also locally implements a MIB whose variables sysDescr1 and sysDescr2 with values "sysDescr1", "sysDescr2" overlap with the variables defined in the subagent's MIB.

The SimpleManager is identical to a standard Java DMK SNMP manager. The StandAloneAgent is also identical to a standard Java DMK SNMP standalone agent. It is unaware of the existence of the master agent, unless it is configured to send traps.

There are, however, differences in the way each of the SNMPv1/v2 master agent and the SNMPv3 master agent creates a proxy, as shown in Example 20-2 and Example 20-3. Example 20-4 shows how the MIB overlapping is programmed.

Previous Previous     Contents     Index     Next Next