public class OfmMutableFlowMod extends OfmFlowMod implements MutableMessage
OfmFlowMod
. Instances of this class are created
via the MessageFactory
; for example:
OfmMutableFlowMod fm = (OfmMutableFlowMod) MessageFactory.create( ProtocolVersion.V_1_3, MessageType.FLOW_MOD, FlowModCommand.ADD);Note that a newly constructed instance will have the following default values:
length
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.
|
OfmMutableFlowMod |
clearActions()
Removes all actions currently stored in this flow mod.
|
OfmMutableFlowMod |
clearInstructions()
Removes all instructions currently stored in this flow mod.
|
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.
|
getActions, getBufferId, getCommand, getCookie, getCookieMask, getFlags, getHardTimeout, getIdleTimeout, getInstructions, getMatch, getOutGroup, getOutPort, getPriority, getTableId, toDebugString, validate
decodeHeader, getType, getVersion, getXid, hex, hex, length
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getVersion, toDebugString
public void clearXid()
MutableMessage
clearXid
in interface MutableMessage
public OpenflowMessage toImmutable()
MutableMessage
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.
toImmutable
in interface MutableMessage
public boolean writable()
MutableObject
#toImmutable()
method (defined on a sub-interface)
has not yet been invoked.writable
in interface MutableObject
public String toString()
toString
in class OfmFlowMod
public OfmMutableFlowMod cookie(long cookie)
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.
cookie
- the cookie valueInvalidMutableException
- if this instance is no longer writableIllegalArgumentException
- if the reserved value (-1) is specifiedpublic OfmMutableFlowMod cookieMask(long mask)
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.
mask
- the cookie mask valueInvalidMutableException
- if this instance is no longer writableVersionMismatchException
- if version is < 1.1public OfmMutableFlowMod tableId(TableId tableId)
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.
tableId
- the table idInvalidMutableException
- if this instance is no longer writableVersionMismatchException
- if version is < 1.1NullPointerException
- if tableId is nullpublic OfmMutableFlowMod command(FlowModCommand command)
command
- the flow mod commandInvalidMutableException
- if this instance is no longer writableNullPointerException
- if command is nullpublic OfmMutableFlowMod idleTimeout(int idleTimeout)
If the flow is idle (no matches) for this amount of time, discard the flow.
idleTimeout
- the idle timeout, in seconds (u16)InvalidMutableException
- if this instance is no longer writableIllegalArgumentException
- if idleTimeout is not u16public OfmMutableFlowMod hardTimeout(int hardTimeout)
Unconditionally discard the flow after this amount of time.
hardTimeout
- the hard timeout, in seconds (u16)InvalidMutableException
- if this instance is no longer writableIllegalArgumentException
- if hardTimeout is not u16public OfmMutableFlowMod priority(int priority)
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.
priority
- the priority levelInvalidMutableException
- if this instance is no longer writableIllegalArgumentException
- if hardTimeout is not u16public OfmMutableFlowMod bufferId(BufferId bufferId)
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.
bufferId
- the buffer idInvalidMutableException
- if this instance is no longer writableNullPointerException
- if bufferId is nullpublic OfmMutableFlowMod outPort(BigPortNumber outPort)
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.
outPort
- the output portInvalidMutableException
- if this instance is no longer writableNullPointerException
- if outPort is nullIllegalArgumentException
- if the port number is invalidpublic OfmMutableFlowMod outGroup(GroupId outGroup)
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.
outGroup
- the output groupInvalidMutableException
- if this instance is no longer writableVersionMismatchException
- if version is < 1.1NullPointerException
- if outGroup is nullpublic OfmMutableFlowMod flowModFlags(Set<FlowModFlag> flags)
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.
flags
- the flagsInvalidMutableException
- if this instance is no longer writableNullPointerException
- if flags is nullpublic OfmMutableFlowMod addAction(Action act)
act
- the action to addInvalidMutableException
- if this instance is no longer writableVersionMismatchException
- if version is not 1.0NullPointerException
- if act is nullIllegalArgumentException
- if the action is not appropriate for
version 1.0public OfmMutableFlowMod clearActions()
InvalidMutableException
- if this instance is no longer writableVersionMismatchException
- if version is not 1.0public OfmMutableFlowMod match(Match match)
If a match has already been set on this flowmod instance, the specified parameter will replace it.
match
- the matchInvalidMutableException
- if this instance is no longer writableNullPointerException
- if match is nullIllegalArgumentException
- if match is mutableVersionMismatchException
- if match not the right versionpublic OfmMutableFlowMod addInstruction(Instruction ins)
ins
- the instruction to addInvalidMutableException
- if this instance is no longer writableVersionMismatchException
- if version is < 1.1 or if the
instruction is not the same version as this instanceNullPointerException
- if ins is nullIllegalArgumentException
- if the instruction is invalidpublic OfmMutableFlowMod clearInstructions()
InvalidMutableException
- if this instance is no longer writableVersionMismatchException
- if version is < 1.1Copyright © 2015. All Rights Reserved.