com.h3c.of.lib.msg

## Class OfmMutableFlowMod

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

- All Implemented Interfaces:
    Message, MutableMessage, MutableObject, Structure

      public class OfmMutableFlowMod
      extends OfmFlowMod
      implements MutableMessage

  Mutable subclass of `OfmFlowMod`.

- - ### 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
    --- | ---
    `OfmMutableFlowMod` | `addAction(Action act)` Adds an action to the action list; Since 1.0; Removed at 1.1.
    `OfmMutableFlowMod` | `addInstruction(Instruction ins)` Adds an instruction to the instruction list; Since 1.1.
    `OfmMutableFlowMod` | `bufferId(BufferId bufferId)` Sets the buffer id; Since 1.0.
    `void` | `clearXid()` Clears the transaction ID field of this message (sets it to 0).
    `OfmMutableFlowMod` | `command(FlowModCommand command)` Sets the flow mod command; Since 1.0.
    `OfmMutableFlowMod` | `cookie(long cookie)` Sets the cookie value; Since 1.0.
    `OfmMutableFlowMod` | `cookieMask(long mask)` Sets the cookie mask value; Since 1.1.
    `OfmMutableFlowMod` | `flowModFlags(Set<FlowModFlag> flags)` Sets the flow mod flags; Since 1.0.
    `OfmMutableFlowMod` | `hardTimeout(int hardTimeout)` Sets the hard timeout, in seconds; Since 1.0.
    `OfmMutableFlowMod` | `idleTimeout(int idleTimeout)` Sets the idle timeout, in seconds; Since 1.0.
    `OfmMutableFlowMod` | `match(Match match)` Sets the match for this flow mod; Since 1.0.
    `OfmMutableFlowMod` | `outGroup(GroupId outGroup)` Sets the out group; Since 1.1.
    `OfmMutableFlowMod` | `outPort(BigPortNumber outPort)` Sets the out port; Since 1.0.
    `OfmMutableFlowMod` | `priority(int priority)` Sets the priority level of the flow entry; since 1.0.
    `OfmMutableFlowMod` | `tableId(TableId tableId)` Sets the table id; Since 1.1.
    `OpenflowMessage` | `toImmutable()` Returns an immutable instance of this message.
    `String` | `toString()`
    `boolean` | `writable()` Returns true if this mutable object is still writable.

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

      `getActions, getBufferId, getCommand, getCookie, getCookieMask, getFlags, getHardTimeout, getIdleTimeout, getInstructions, getMatch, getOutGroup, getOutPort, getPriority, getTableId, toDebugString, validate`

    - ### 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`

    - ### Methods inherited from interface com.h3c.of.lib.msg.Message

      `getType, getXid`

    - ### Methods inherited from interface com.h3c.of.lib.Structure

      `getVersion, toDebugString`

- - ### Method Detail

    - #### clearXid

          public void clearXid()

      Description copied from interface: `MutableMessage`
      Clears the transaction ID field of this message (sets it to 0).
      Specified by:
        `clearXid` in interface `MutableMessage`

    - #### toImmutable

          public OpenflowMessage toImmutable()

      Description copied from interface: `MutableMessage`
      Returns an immutable instance of this message. In essence, converts this message to be read-only.

      It is expected that the reference to this mutable message will be dropped. Note that all method calls invoked on a `MutableMessage` after `toImmutable()` has been invoked will result in an `InvalidMutableException` being thrown.

      Specified by:
        `toImmutable` in interface `MutableMessage`
      Returns:
        an immutable instance of this message.

    - #### writable

          public boolean writable()

      Description copied from interface: `MutableObject`
      Returns true if this mutable object is still writable. That is, the `#toImmutable()` method (defined on a sub-interface) has not yet been invoked.
      Specified by:
        `writable` in interface `MutableObject`
      Returns:
        true if this mutable object is still writable

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `OfmFlowMod`

    - #### cookie

          public OfmMutableFlowMod cookie(long cookie)

      Sets the cookie value; Since 1.0.

      The cookie field is an opaque data value chosen by the controller. This value appears in flow removed messages and flow statistics, and can also be used to filter flow statistics, flow modification and flow deletion. It is not used by the packet processing pipeline, and thus does not need to reside in hardware.

      The value -1 (0xffffffffffffffff) is reserved and must not be used.

      When a flow entry is inserted in a table through an `ADD` message, its cookie field is set to the provided value. When a flow entry is modified (`MODIFY` or `MODIFY_STRICT` messages), its cookie field is unchanged.

      Parameters:
        `cookie` - the cookie value
      Returns:
        self, for chaining
      Throws:
        `InvalidMutableException` - if this instance is no longer writable
        `IllegalArgumentException` - if the reserved value (-1) is specified

    - #### cookieMask

          public OfmMutableFlowMod cookieMask(long mask)

      Sets the cookie mask value; Since 1.1.

      If the cookie mask field is non-zero, it is used with the cookie field to restrict flow matching while modifying or deleting flow entries. This field is ignored by `ADD` messages.

      Parameters:
        `mask` - the cookie mask value
      Returns:
        self, for chaining
      Throws:
        `InvalidMutableException` - if this instance is no longer writable
        `VersionMismatchException` - if version is < 1.1

    - #### tableId

          public OfmMutableFlowMod tableId(TableId tableId)

      Sets the table id; Since 1.1.

      The table id field specifies the table into which the flow entry should be inserted, modified or deleted. Table 0 signifies the first table in the pipeline. The use of `TableId.ALL` is only valid for delete requests.

      Parameters:
        `tableId` - the table id
      Returns:
        self, for chaining
      Throws:
        `InvalidMutableException` - if this instance is no longer writable
        `VersionMismatchException` - if version is < 1.1
        `NullPointerException` - if tableId is null

    - #### command

          public OfmMutableFlowMod command(FlowModCommand command)

      Sets the flow mod command; Since 1.0.
      Parameters:
        `command` - the flow mod command
      Returns:
        self, for chaining
      Throws:
        `InvalidMutableException` - if this instance is no longer writable
        `NullPointerException` - if command is null

    - #### idleTimeout

          public OfmMutableFlowMod idleTimeout(int idleTimeout)

      Sets the idle timeout, in seconds; Since 1.0.

      If the flow is idle (no matches) for this amount of time, discard the flow.

      Parameters:
        `idleTimeout` - the idle timeout, in seconds (u16)
      Returns:
        self, for chaining
      Throws:
        `InvalidMutableException` - if this instance is no longer writable
        `IllegalArgumentException` - if idleTimeout is not u16

    - #### hardTimeout

          public OfmMutableFlowMod hardTimeout(int hardTimeout)

      Sets the hard timeout, in seconds; Since 1.0.

      Unconditionally discard the flow after this amount of time.

      Parameters:
        `hardTimeout` - the hard timeout, in seconds (u16)
      Returns:
        self, for chaining
      Throws:
        `InvalidMutableException` - if this instance is no longer writable
        `IllegalArgumentException` - if hardTimeout is not u16

    - #### priority

          public OfmMutableFlowMod priority(int priority)

      Sets the priority level of the flow entry; since 1.0.

      The priority indicates priority within the specified flow table. Higher numbers indicate higher priorities. This field is used only for `ADD` messages when matching and adding flow entries, and for `MODIFY_STRICT` or `DELETE_STRICT` messages when matching flow entries.

      Parameters:
        `priority` - the priority level
      Returns:
        self, for chaining
      Throws:
        `InvalidMutableException` - if this instance is no longer writable
        `IllegalArgumentException` - if hardTimeout is not u16

    - #### bufferId

          public OfmMutableFlowMod bufferId(BufferId bufferId)

      Sets the buffer id; Since 1.0.

      The buffer id refers to the packet buffered at the switch and sent to the controller by a packet-in message. A flow mod that includes a valid buffer id is effectively equivalent to sending a two-message sequence of a flow-mod and a packet-out to `Port.TABLE`, with the requirement that the switch must fully process the flow-mod before the packet-out. These semantics apply regardless of the table to which the flow mod refers, or the instructions contained in the flow mod.

      This field is ignored by `DELETE` and `DELETE_STRICT` flow mod messages.

      Parameters:
        `bufferId` - the buffer id
      Returns:
        self, for chaining
      Throws:
        `InvalidMutableException` - if this instance is no longer writable
        `NullPointerException` - if bufferId is null

    - #### outPort

          public OfmMutableFlowMod outPort(BigPortNumber outPort)

      Sets the out port; Since 1.0.

      Used to filter the scope of `DELETE` and `DELETE_STRICT` messages by output port. If this value is any other than `Port.ANY`, it introduces the constraint that the flow entry must contain an output action directed at that port.

      This field is ignored by `ADD`, `MODIFY` or `MODIFY_STRICT` messages.

      Note that in 1.0, port numbers are u16.

      Parameters:
        `outPort` - the output port
      Returns:
        self, for chaining
      Throws:
        `InvalidMutableException` - if this instance is no longer writable
        `NullPointerException` - if outPort is null
        `IllegalArgumentException` - if the port number is invalid

    - #### outGroup

          public OfmMutableFlowMod outGroup(GroupId outGroup)

      Sets the out group; Since 1.1.

      Used to filter the scope of `DELETE` and `DELETE_STRICT` messages by output group. If this value is any other than `GroupId.ANY`, it introduces the constraint that the flow entry must contain an output action directed at that group.

      This field is ignored by `ADD`, `MODIFY` or `MODIFY_STRICT` messages.

      Parameters:
        `outGroup` - the output group
      Returns:
        self, for chaining
      Throws:
        `InvalidMutableException` - if this instance is no longer writable
        `VersionMismatchException` - if version is < 1.1
        `NullPointerException` - if outGroup is null

    - #### flowModFlags

          public OfmMutableFlowMod flowModFlags(Set<FlowModFlag> flags)

      Sets the flow mod flags; Since 1.0.

      When the `SEND_FLOW_REM` flag is set, the switch must send a flow removed message when the flow entry expires or is deleted.

      When the `CHECK_OVERLAP` flag is set, the switch must check that there are no conflicting entries with the same priority prior to inserting in in the flow table. If there is one, the flow mod fails and an error message is returned.

      When the `NO_PACKET_COUNTS` flag is set, the switch does not need to keep track of the flow packet count. When the `NO_BYTE_COUNTS` flag is set, the switch does not need to keep track of the flow byte count. Setting those flags may decrease the processing load on some OpenFlow switches, however, those counters may not be available in flow statistics and flow removed messages for this flow entry. A switch is not required to honor these flags and may keep track of a flow count and return it despite the corresponding flag being set. If a switch does not keep track of a flow count, the corresponding counter is not available and must be set to the maximum field value.

      When a flow entry is inserted in a table, its flags field is set with the values from the message. When flow entry is matched and modified (`MODIFY` or `MODIFY_STRICT` messages), the flags field is ignored.

      Parameters:
        `flags` - the flags
      Returns:
        self, for chaining
      Throws:
        `InvalidMutableException` - if this instance is no longer writable
        `NullPointerException` - if flags is null

    - #### addAction

          public OfmMutableFlowMod addAction(Action act)

      Adds an action to the action list; Since 1.0; Removed at 1.1.
      Parameters:
        `act` - the action to add
      Returns:
        self, for chaining
      Throws:
        `InvalidMutableException` - if this instance is no longer writable
        `VersionMismatchException` - if version is not 1.0
        `NullPointerException` - if act is null
        `IllegalArgumentException` - if the action is not appropriate for version 1.0

    - #### match

          public OfmMutableFlowMod match(Match match)

      Sets the match for this flow mod; Since 1.0.
      Parameters:
        `match` - the match
      Returns:
        self, for chaining
      Throws:
        `InvalidMutableException` - if this instance is no longer writable
        `NullPointerException` - if match is null
        `IllegalArgumentException` - if match is mutable
        `VersionMismatchException` - if match not the right version

    - #### addInstruction

          public OfmMutableFlowMod addInstruction(Instruction ins)

      Adds an instruction to the instruction list; Since 1.1.
      Parameters:
        `ins` - the instruction to add
      Returns:
        self, for chaining
      Throws:
        `InvalidMutableException` - if this instance is no longer writable
        `VersionMismatchException` - if version is < 1.1 or if the instruction is not the same version as this instance
        `NullPointerException` - if ins is null
        `IllegalArgumentException` - if the instruction is invalid

Copyright © 2014. All Rights Reserved.