com.h3c.of.lib.msg

## Class OfmError

- java.lang.Object
- - com.h3c.nbio.AbstractMessage
  - - com.h3c.of.lib.msg.OpenflowMessage
    - - com.h3c.of.lib.msg.OfmError

- All Implemented Interfaces:
    Message, Structure
  Direct Known Subclasses:
    OfmErrorExper, OfmMutableError

      public class OfmError
      extends OpenflowMessage

  Represents an OpenFlow ERROR message; Since 1.0.

  The `type` value indicates the high-level type of error. The `code` value is interpreted based on the type. The `data` is variable in length and interpreted based on the `type` and `code`. Unless specified otherwise, the data field contains at least 64 bytes of the failed request that caused the error message to be generated; if the failed request is shorter than 64 bytes it should be the full request without any padding.

  As a convenience, the `getErrorMessage()` method will return the data interpreted as an ASCII string, if the message type is `HELLO_FAILED`.

  If the error message is in response to a specific message from the controller, e.g. `BAD_REQUEST`, `BAD_ACTION`, `BAD_INSTRUCTION`, `BAD_MATCH`, or `FLOW_MOD_FAILED`, then the `xid` field of the header must match that of the offending message.

  `EPERM` error codes correspond to a permissions error generated by, for example, an OpenFlow hypervisor interposing between a controller and switch.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class com.h3c.of.lib.msg.OpenflowMessage

      `OpenflowMessage.Header`

  - ### Field Summary

    - ### Fields inherited from class com.h3c.nbio.AbstractMessage

      `length`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `byte[]` | `getData()` Returns data associated with the error; Since 1.0.
    `ErrorCode` | `getErrorCode()` Returns the error code; Since 1.0.
    `String` | `getErrorMessage()` Returns the associated error message; Since 1.0.
    `ErrorType` | `getErrorType()` Returns the high-level type of error; Since 1.0.
    `String` | `toDebugString()` Returns a string representation useful for debugging.
    `String` | `toString()`
    `void` | `validate()` Validates this message for completeness and throws an exception if the message is considered "not complete".

    - ### Methods inherited from class com.h3c.of.lib.msg.OpenflowMessage

      `decodeHeader, getType, getVersion, getXid, hex, hex, length`

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

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

- - ### Method Detail

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `OpenflowMessage`

    - #### toDebugString

          public String toDebugString()

      Description copied from class: `OpenflowMessage`
      Returns a string representation useful for debugging. This default implementation delegates to `OpenflowMessage.toString()`, but subclasses are free to override this behavior.
      Specified by:
        `toDebugString` in interface `Structure`
      Overrides:
        `toDebugString` in class `OpenflowMessage`
      Returns:
        a (possibly multi-line) string representation of this message

    - #### validate

          public void validate()
                        throws IncompleteMessageException

      Description copied from class: `OpenflowMessage`
      Validates this message for completeness and throws an exception if the message is considered "not complete".

      This default implementation does nothing, i.e. default behavior is that messages are considered complete.

      Subclasses should override this method to check that mandatory fields or other internal state is present, throwing an exception if it is not.

      Overrides:
        `validate` in class `OpenflowMessage`
      Throws:
        `IncompleteMessageException` - if the message is not complete

    - #### getErrorType

          public ErrorType getErrorType()

      Returns the high-level type of error; Since 1.0.
      Returns:
        the error type

    - #### getErrorCode

          public ErrorCode getErrorCode()

      Returns the error code; Since 1.0. The code is interpreted based on the `type`.
      Returns:
        the error code

    - #### getData

          public byte[] getData()

      Returns data associated with the error; Since 1.0.
      Returns:
        the associated data

    - #### getErrorMessage

          public String getErrorMessage()

      Returns the associated error message; Since 1.0.

      For errors of type `HELLO_FAILED`, the data bytes are interpreted as an ASCII string, and this is returned. For all other error types, the data bytes are assumed to be the beginning of the OpenFlow message that caused the error; the header bytes of which are decoded and a string representation returned.

      Returns:
        the error message

Copyright © 2014. All Rights Reserved.