Every version of OpenFlow includes actions. OpenFlow 1.1
introduced the higher-level, related concept of instructions. In
OpenFlow 1.1 and later, actions within a flow are always
encapsulated within an instruction. Each flow has at most one
instruction of each kind, which are executed in the following
fixed order defined in the OpenFlow specification:
1. Meter
2. Apply-Actions
3. Clear-Actions
4. Write-Actions
5. Write-Metadata
6. Stat-Trigger
(not supported by Open vSwitch)
7. Goto-Table
The most important instruction is Apply-Actions
. This instruction
encapsulates any number of actions, which the instruction
executes. Open vSwitch does not explicitly represent
Apply-Actions
. Instead, any action by itself is implicitly part
of an Apply-Actions
instructions.
Open vSwitch syntax requires other instructions, if present, to
be in the order listed above. Otherwise it will flag an error.
The meter action and instruction
Syntax:
meter:
meter_id
Apply meter meter_id. If a meter band rate is exceeded, the
packet may be dropped, or modified, depending on the meter band
type.
Conformance:
OpenFlow 1.3 introduced the meter
instruction. OpenFlow 1.5
changes meter
from an instruction to an action.
OpenFlow 1.5 allows implementations to restrict meter
to be the
first action in an action list and to exclude meter
from action
sets, for better compatibility with OpenFlow 1.3 and 1.4. Open
vSwitch restricts the meter
action both ways.
Open vSwitch 2.0 introduced OpenFlow protocol support for meters,
but it did not include a datapath implementation. Open vSwitch
2.7 added meter support to the userspace datapath. Open vSwitch
2.10 added meter support to the kernel datapath. Open vSwitch
2.12 added support for meter as an action in OpenFlow 1.5.
The clear_actions instruction
Syntax:
clear_actions
Clears the action set. See ``Action Sets'', above, for more
information.
Conformance:
OpenFlow 1.1 introduced clear_actions
. Open vSwitch 2.1 added
support for clear_actions
.
The write_actions instruction
Syntax:
write_actions(
action...)
Adds each action to the action set. The action set is carried
between flow tables and then executed at the end of the pipeline.
Only certain actions may be written to the action set. See
``Action Sets'', above, for more information.
Conformance:
OpenFlow 1.1 introduced write_actions
. Open vSwitch 2.1 added
support for write_actions
.
The write_metadata instruction
Syntax:
write_metadata:
value[/
mask]
Updates the flow's metadata
field. If mask is omitted, metadata
is set exactly to value; if mask is specified, then a 1-bit in
mask indicates that the corresponding bit in metadata
will be
replaced with the corresponding bit from value. Both value and
mask are 64-bit values that are decimal by default; use a 0x
prefix to specify them in hexadecimal.
The metadata
field can also be matched in the flow table and
updated with actions such as set_field
and move
.
Conformance:
OpenFlow 1.1 introduced write_metadata
. Open vSwitch 2.1 added
support for write_metadata
.
The goto_table instruction
Syntax:
goto_table:
table
Jumps to table as the next table in the process pipeline. The
table may be a number between 0 and 254 or a table name.
It is an error if table is less than or equal to the table of the
flow that contains it; that is, goto_table
must move forward in
the OpenFlow pipeline. Since goto_table
must be the last
instruction in a flow, it never leads to recursion. The resubmit
extension action is more flexible.
Conformance:
OpenFlow 1.1 introduced goto_table
. Open vSwitch 2.1 added
support for goto_table
.