com.h3c.util.snmp

## Class SnmpClientFixture

- java.lang.Object
- - com.h3c.util.snmp.SnmpClientFixture

- All Implemented Interfaces:
    SnmpClient

      public class SnmpClientFixture
      extends Object
      implements SnmpClient

  A fixture SNMP client that simply creates a response by copying the request.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SnmpClientFixture()` Constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static SnmpResponse` | `copy(SnmpRequest request)` Helper method to copy a request into a response (used for fixtures/testing).
    `void` | `sendRequest(SnmpRequest request)` Main entry point for sending requests to a SNMP server.
    `void` | `sendTrap(SnmpTrapRequest trap)` Main entry point for sending traps to a SNMP receiver.
    `void` | `setErrorType(SnmpRequest.ErrorType errorType)`
    `void` | `setRemoteAddress(IpAddress remoteAddress)`
    `void` | `stop()` Shutdown the client and underlying engine.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SnmpClientFixture

          public SnmpClientFixture()

      Constructor.

  - ### Method Detail

    - #### copy

          public static SnmpResponse copy(SnmpRequest request)

      Helper method to copy a request into a response (used for fixtures/testing).
      Parameters:
        `request` - original SNMP request
      Returns:
        response containing a copy of the original request's variable bindings

    - #### setErrorType

          public void setErrorType(SnmpRequest.ErrorType errorType)

    - #### setRemoteAddress

          public void setRemoteAddress(IpAddress remoteAddress)

    - #### stop

          public void stop()

      Description copied from interface: `SnmpClient`
      Shutdown the client and underlying engine.
      Specified by:
        `stop` in interface `SnmpClient`

    - #### sendTrap

          public void sendTrap(SnmpTrapRequest trap)

      Description copied from interface: `SnmpClient`
      Main entry point for sending traps to a SNMP receiver. The caller creates a trap and hands it off to this this method. Once a trap enters this method the caller should not keep a reference to it.
      Specified by:
        `sendTrap` in interface `SnmpClient`
      Parameters:
        `trap` - SNMP trap

    - #### sendRequest

          public void sendRequest(SnmpRequest request)

      Description copied from interface: `SnmpClient`
      Main entry point for sending requests to a SNMP server. The caller creates a request and hands it off to this method. Once a request enters this method the caller should not keep a reference to it.
      Specified by:
        `sendRequest` in interface `SnmpClient`
      Parameters:
        `request` - SNMP request (all required fields must be setup properly)

Copyright © 2014. All Rights Reserved.