]> git.proxmox.com Git - mirror_ovs.git/blame - utilities/ovs-ofctl.8.in
utilities: Add gdb debug commands to dump lists and pmd info
[mirror_ovs.git] / utilities / ovs-ofctl.8.in
CommitLineData
a9b4a41a
BP
1.\" -*- nroff -*-
2.de IQ
3. br
4. ns
5. IP "\\$1"
6..
d2cb6c95 7.TH ovs\-ofctl 8 "@VERSION@" "Open vSwitch" "Open vSwitch Manual"
064af421 8.ds PN ovs\-ofctl
a9b4a41a 9.
064af421
BP
10.SH NAME
11ovs\-ofctl \- administer OpenFlow switches
a9b4a41a 12.
064af421
BP
13.SH SYNOPSIS
14.B ovs\-ofctl
15[\fIoptions\fR] \fIcommand \fR[\fIswitch\fR] [\fIargs\fR\&...]
a9b4a41a 16.
064af421
BP
17.SH DESCRIPTION
18The
19.B ovs\-ofctl
20program is a command line tool for monitoring and administering
21OpenFlow switches. It can also show the current state of an OpenFlow
22switch, including features, configuration, and table entries.
0d8e9638 23It should work with any OpenFlow switch, not just Open vSwitch.
a9b4a41a 24.
064af421 25.SS "OpenFlow Switch Management Commands"
a9b4a41a 26.PP
064af421
BP
27These commands allow \fBovs\-ofctl\fR to monitor and administer an OpenFlow
28switch. It is able to show the current state of a switch, including
29features, configuration, and table entries.
a9b4a41a 30.PP
064af421
BP
31Most of these commands take an argument that specifies the method for
32connecting to an OpenFlow switch. The following connection methods
33are supported:
a9b4a41a 34.
064af421 35.RS
84ee7bcf
BP
36.so lib/vconn-active.man
37.
064af421
BP
38.IP "\fIfile\fR"
39This is short for \fBunix:\fIfile\fR, as long as \fIfile\fR does not
40contain a colon.
84ee7bcf 41.
1a6f1e2a
JG
42.IP \fIbridge\fR
43This is short for \fBunix:@RUNDIR@/\fIbridge\fB.mgmt\fR, as long as
44\fIbridge\fR does not contain a colon.
45.
46.IP [\fItype\fB@\fR]\fIdp\fR
47Attempts to look up the bridge associated with \fIdp\fR and open as
48above. If \fItype\fR is given, it specifies the datapath provider of
49\fIdp\fR, otherwise the default provider \fBsystem\fR is assumed.
064af421 50.RE
a9b4a41a 51.
064af421
BP
52.TP
53\fBshow \fIswitch\fR
54Prints to the console information on \fIswitch\fR, including
55information on its flow tables and ports.
a9b4a41a 56.
064af421 57.TP
4e312e69 58\fBdump\-tables \fIswitch\fR
064af421
BP
59Prints to the console statistics for each of the flow tables used by
60\fIswitch\fR.
5deff5aa
AW
61.TP
62\fBdump\-table\-features \fIswitch\fR
63Prints to the console features for each of the flow tables used by
64\fIswitch\fR.
03c72922
BP
65.TP
66\fBdump\-table\-desc \fIswitch\fR
67Prints to the console configuration for each of the flow tables used
68by \fIswitch\fR for OpenFlow 1.4+.
4bc938cc
BP
69.IP "\fBmod\-table \fIswitch\fR \fItable\fR \fIsetting\fR"
70This command configures flow table settings in \fIswitch\fR for
71OpenFlow table \fItable\fR, which may be expressed as a number or
72(unless \fB\-\-no\-names\fR is specified) a name.
73.IP
74The available settings depend on
82c22d34
BP
75the OpenFlow version in use. In OpenFlow 1.1 and 1.2 (which must be
76enabled with the \fB\-O\fR option) only, \fBmod\-table\fR configures
77behavior when no flow is found when a packet is looked up in a flow
78table. The following \fIsetting\fR values are available:
c354fcc5
TG
79.RS
80.IP \fBdrop\fR
81Drop the packet.
82.IP \fBcontinue\fR
83Continue to the next table in the pipeline. (This is how an OpenFlow
841.0 switch always handles packets that do not match any flow, in
85tables other than the last one.)
86.IP \fBcontroller\fR
87Send to controller. (This is how an OpenFlow 1.0 switch always
88handles packets that do not match any flow in the last table.)
89.RE
82c22d34
BP
90.IP
91In OpenFlow 1.4 and later (which must be enabled with the \fB\-O\fR
92option) only, \fBmod\-table\fR configures the behavior when a
93controller attempts to add a flow to a flow table that is full. The
94following \fIsetting\fR values are available:
95.RS
96.IP \fBevict\fR
97Delete some existing flow from the flow table, according to the
98algorithm described for the \fBFlow_Table\fR table in
99\fBovs-vswitchd.conf.db\fR(5).
100.IP \fBnoevict\fR
101Refuse to add the new flow. (Eviction might still be enabled through
de7d3c07 102the \fBoverflow_policy\fR column in the \fBFlow_Table\fR table
82c22d34 103documented in \fBovs-vswitchd.conf.db\fR(5).)
de7d3c07
SJ
104.IP \fBvacancy:\fIlow\fB,\fIhigh\fR
105Enables sending vacancy events to controllers using \fBTABLE_STATUS\fR
106messages, based on percentage thresholds \fIlow\fR and \fIhigh\fR.
107.IP \fBnovacancy\fR
108Disables vacancy events.
82c22d34 109.RE
c354fcc5 110.
064af421 111.TP
4e312e69 112\fBdump\-ports \fIswitch\fR [\fInetdev\fR]
abaad8cf
JP
113Prints to the console statistics for network devices associated with
114\fIswitch\fR. If \fInetdev\fR is specified, only the statistics
115associated with that device will be printed. \fInetdev\fR can be an
116OpenFlow assigned port number or device name, e.g. \fBeth0\fR.
a9b4a41a 117.
70ae4f93 118.IP "\fBdump\-ports\-desc \fIswitch\fR [\fIport\fR]"
2be393ed 119Prints to the console detailed information about network devices
70ae4f93
BP
120associated with \fIswitch\fR. To dump only a specific port, specify
121its number as \fIport\fR. Otherwise, if \fIport\fR is omitted, or if
122it is specified as \fBANY\fR, then all ports are printed. This is a
123subset of the information provided by the \fBshow\fR command.
124.IP
125If the connection to \fIswitch\fR negotiates OpenFlow 1.0, 1.2, or
1261.2, this command uses an OpenFlow extension only implemented in Open
127vSwitch (version 1.7 and later).
128.IP
129Only OpenFlow 1.5 and later support dumping a specific port. Earlier
130versions of OpenFlow always dump all ports.
2be393ed 131.
c6100d92
BP
132.IP "\fBmod\-port \fIswitch\fR \fIport\fR \fIaction\fR"
133Modify characteristics of port \fBport\fR in \fIswitch\fR. \fIport\fR
50f96b10
BP
134may be an OpenFlow port number or name (unless \fB\-\-no\-names\fR is
135specified) or the keyword \fBLOCAL\fR (the
c6100d92
BP
136preferred way to refer to the OpenFlow local port). The \fIaction\fR
137may be any one of the following:
a9b4a41a 138.
064af421 139.RS
28124950
BP
140.IQ \fBup\fR
141.IQ \fBdown\fR
0b2c7e69
BP
142Enable or disable the interface. This is equivalent to \fBip
143link set up\fR or \fBip link set down\fR on a Unix system.
28124950
BP
144.
145.IP \fBstp\fR
146.IQ \fBno\-stp\fR
147Enable or disable 802.1D spanning tree protocol (STP) on the
148interface. OpenFlow implementations that don't support STP will
149refuse to enable it.
150.
151.IP \fBreceive\fR
152.IQ \fBno\-receive\fR
153.IQ \fBreceive\-stp\fR
154.IQ \fBno\-receive\-stp\fR
155Enable or disable OpenFlow processing of packets received on this
156interface. When packet processing is disabled, packets will be
157dropped instead of being processed through the OpenFlow table. The
158\fBreceive\fR or \fBno\-receive\fR setting applies to all packets
159except 802.1D spanning tree packets, which are separately controlled
160by \fBreceive\-stp\fR or \fBno\-receive\-stp\fR.
a9b4a41a 161.
451256f6 162.IP \fBforward\fR
28124950
BP
163.IQ \fBno\-forward\fR
164Allow or disallow forwarding of traffic to this interface. By
165default, forwarding is enabled.
451256f6 166.
064af421 167.IP \fBflood\fR
28124950
BP
168.IQ \fBno\-flood\fR
169Controls whether an OpenFlow \fBflood\fR action will send traffic out
170this interface. By default, flooding is enabled. Disabling flooding
171is primarily useful to prevent loops when a spanning tree protocol is
172not in use.
173.
174.IP \fBpacket\-in\fR
175.IQ \fBno\-packet\-in\fR
176Controls whether packets received on this interface that do not match
177a flow table entry generate a ``packet in'' message to the OpenFlow
178controller. By default, ``packet in'' messages are enabled.
064af421 179.RE
28124950
BP
180.IP
181The \fBshow\fR command displays (among other information) the
182configuration that \fBmod\-port\fR changes.
a9b4a41a 183.
7257b535
BP
184.IP "\fBget\-frags \fIswitch\fR"
185Prints \fIswitch\fR's fragment handling mode. See \fBset\-frags\fR,
186below, for a description of each fragment handling mode.
187.IP
188The \fBshow\fR command also prints the fragment handling mode among
189its other output.
190.
191.IP "\fBset\-frags \fIswitch frag_mode\fR"
192Configures \fIswitch\fR's treatment of IPv4 and IPv6 fragments. The
193choices for \fIfrag_mode\fR are:
194.RS
195.IP "\fBnormal\fR"
196Fragments pass through the flow table like non-fragmented packets.
197The TCP ports, UDP ports, and ICMP type and code fields are always set
198to 0, even for fragments where that information would otherwise be
199available (fragments with offset 0). This is the default fragment
200handling mode for an OpenFlow switch.
201.IP "\fBdrop\fR"
202Fragments are dropped without passing through the flow table.
203.IP "\fBreassemble\fR"
204The switch reassembles fragments into full IP packets before passing
205them through the flow table. Open vSwitch does not implement this
206fragment handling mode.
207.IP "\fBnx\-match\fR"
208Fragments pass through the flow table like non-fragmented packets.
209The TCP ports, UDP ports, and ICMP type and code fields are available
210for matching for fragments with offset 0, and set to 0 in fragments
211with nonzero offset. This mode is a Nicira extension.
212.RE
213.IP
214See the description of \fBip_frag\fR, below, for a way to match on
215whether a packet is a fragment and on its fragment offset.
216.
064af421 217.TP
4e312e69 218\fBdump\-flows \fIswitch \fR[\fIflows\fR]
064af421
BP
219Prints to the console all flow entries in \fIswitch\fR's
220tables that match \fIflows\fR. If \fIflows\fR is omitted, all flows
221in the switch are retrieved. See \fBFlow Syntax\fR, below, for the
bdcc5925 222syntax of \fIflows\fR. The output format is described in
064af421 223\fBTable Entry Output\fR.
a9b4a41a 224.
bdcc5925
BP
225.IP
226By default, \fBovs\-ofctl\fR prints flow entries in the same order
227that the switch sends them, which is unlikely to be intuitive or
1b3758c3
BP
228consistent. Use \fB\-\-sort\fR and \fB\-\-rsort\fR to control display
229order. The \fB\-\-names\fR/\fB\-\-no\-names\fR and
230\fB\-\-stats\fR/\fB\-\-no\-stats\fR options also affect output
231formatting. See the descriptions of these options, under
232\fBOPTIONS\fR below, for more information
bdcc5925 233.
064af421 234.TP
4e312e69 235\fBdump\-aggregate \fIswitch \fR[\fIflows\fR]
bdcc5925 236Prints to the console aggregate statistics for flows in
064af421
BP
237\fIswitch\fR's tables that match \fIflows\fR. If \fIflows\fR is omitted,
238the statistics are aggregated across all flows in the switch's flow
239tables. See \fBFlow Syntax\fR, below, for the syntax of \fIflows\fR.
3845a3fd 240The output format is described in \fBTable Entry Output\fR.
a9b4a41a 241.
d2805da2
BP
242.IP "\fBqueue\-stats \fIswitch \fR[\fIport \fR[\fIqueue\fR]]"
243Prints to the console statistics for the specified \fIqueue\fR on
c6100d92
BP
244\fIport\fR within \fIswitch\fR. \fIport\fR can be an OpenFlow port
245number or name, the keyword \fBLOCAL\fR (the preferred way to refer to
246the OpenFlow local port), or the keyword \fBALL\fR. Either of
247\fIport\fR or \fIqueue\fR or both may be omitted (or equivalently the
248keyword \fBALL\fR). If both are omitted, statistics are printed for
249all queues on all ports. If only \fIqueue\fR is omitted, then
250statistics are printed for all queues on \fIport\fR; if only
251\fIport\fR is omitted, then statistics are printed for \fIqueue\fR on
252every port where it exists.
d2805da2 253.
e016fb63
BP
254.IP "\fBqueue\-get\-config \fIswitch [\fIport \fR[\fIqueue\fR]]"
255Prints to the console the configuration of \fIqueue\fR on \fIport\fR
256in \fIswitch\fR. If \fIport\fR is omitted or \fBANY\fR, reports
257queues for all port. If \fIqueue\fR is omitted or \fBANY\fR, reports
258all queues. For OpenFlow 1.3 and earlier, the output always includes
259all queues, ignoring \fIqueue\fR if specified.
56085be5
BP
260.IP
261This command has limited usefulness, because ports often have no
262configured queues and because the OpenFlow protocol provides only very
263limited information about the configuration of a queue.
264.
56fb20c4 265.IP "\fBdump\-ipfix\-bridge \fIswitch\fR"
fb8f22c1
BY
266Prints to the console the statistics of bridge IPFIX for \fIswitch\fR.
267If bridge IPFIX is configured on the \fIswitch\fR, IPFIX statistics
268can be retrieved. Otherwise, error message will be printed.
269.IP
270This command uses an Open vSwitch extension that is only in Open
271vSwitch 2.6 and later.
272.
56fb20c4 273.IP "\fBdump\-ipfix\-flow \fIswitch\fR"
fb8f22c1
BY
274Prints to the console the statistics of flow-based IPFIX for
275\fIswitch\fR. If flow-based IPFIX is configured on the \fIswitch\fR,
276statistics of all the collector set ids on the \fIswitch\fR will be
277printed. Otherwise, print error message.
278.IP
56fb20c4 279Refer to \fBovs\-vswitchd.conf.db\fR(5) for more details on configuring
fb8f22c1
BY
280flow based IPFIX and collector set ids.
281.IP
282This command uses an Open vSwitch extension that is only in Open
283vSwitch 2.6 and later.
284.
2a7c4805
JP
285.IP "\fBct\-flush\-zone \fIswitch zone\fR
286Flushes the connection tracking entries in \fIzone\fR on \fIswitch\fR.
287.IP
288This command uses an Open vSwitch extension that is only in Open
289vSwitch 2.6 and later.
290.
3200ed58 291.SS "OpenFlow 1.1+ Group Table Commands"
7395c052
NZ
292.
293The following commands work only with switches that support OpenFlow
2941.1 or later. Because support for OpenFlow 1.1 and later is still
295experimental in Open vSwitch, it is necessary to explicitly enable
296these protocol versions in \fBovs\-ofctl\fR (using \fB\-O\fR) and in
297the switch itself (with the \fBprotocols\fR column in the \fBBridge\fR
298table). For more information, see ``Q: What versions of OpenFlow does
299Open vSwitch support?'' in the Open vSwitch FAQ.
300.
19187a71
BP
301.IP "\fBdump\-groups \fIswitch\fR [\fIgroup\fR]"
302Prints group entries in \fIswitch\fR's tables to console. To dump
303only a specific group, specify its number as \fIgroup\fR. Otherwise,
304if \fIgroup\fR is omitted, or if it is specified as \fBALL\fR, then
305all groups are printed. Each line of output is a group entry as
306described in \fBGroup Syntax\fR below.
307.IP
308Only OpenFlow 1.5 and later support dumping a specific group. Earlier
309versions of OpenFlow always dump all groups.
7395c052
NZ
310.
311.IP "\fBdump\-group\-features \fIswitch"
312Prints to the console the group features of the \fIswitch\fR.
313.
314.IP "\fBdump\-group-stats \fIswitch \fR[\fIgroups\fR]"
315Prints to the console statistics for the specified \fIgroups in the
316\fIswitch\fR's tables. If \fIgroups\fR is omitted then statistics for all
317groups are printed. See \fBGroup Syntax\fR, below, for the syntax of
318\fIgroups\fR.
319.
3200ed58
JR
320.SS "OpenFlow 1.3+ Switch Meter Table Commands"
321.
322These commands manage the meter table in an OpenFlow switch. In each
323case, \fImeter\fR specifies a meter entry in the format described in
324\fBMeter Syntax\fR, below.
325.
326.PP
327OpenFlow 1.3 introduced support for meters, so these commands only
328work with switches that support OpenFlow 1.3 or later. The caveats
329described for groups in the previous section also apply to meters.
330.
331.IP "\fBadd\-meter \fIswitch meter\fR"
332Add a meter entry to \fIswitch\fR's tables. The \fImeter\fR syntax is
333described in section \fBMeter Syntax\fR, below.
334.
335.IP "\fBmod\-meter \fIswitch meter\fR"
336Modify an existing meter.
337.
338.IP "\fBdel\-meters \fIswitch\fR"
339.IQ "\fBdel\-meter \fIswitch\fR [\fImeter\fR]"
340Delete entries from \fIswitch\fR's meter table. \fImeter\fR can specify
341a single meter with syntax \fBmeter=\fIid\fR, or all meters with syntax
342\fBmeter=all\fR.
343.
344.IP "\fBdump\-meters \fIswitch\fR"
345.IQ "\fBdump\-meter \fIswitch\fR [\fImeter\fR]"
346Print meter configuration. \fImeter\fR can specify a single meter with
347syntax \fBmeter=\fIid\fR, or all meters with syntax \fBmeter=all\fR.
348.
349.IP "\fBmeter\-stats \fIswitch\fR [\fImeter\fR]"
350Print meter statistics. \fImeter\fR can specify a single meter with
351syntax \fBmeter=\fIid\fR, or all meters with syntax \fBmeter=all\fR.
352.
353.IP "\fBmeter\-features \fIswitch\fR"
354Print meter features.
355.
4989c59f
BP
356.SS "OpenFlow Switch Flow Table Commands"
357.
358These commands manage the flow table in an OpenFlow switch. In each
359case, \fIflow\fR specifies a flow entry in the format described in
db5076ee
JR
360\fBFlow Syntax\fR, below, \fIfile\fR is a text file that contains zero
361or more flows in the same syntax, one per line, and the optional
39c94593
JR
362\fB\-\-bundle\fR option operates the command as a single atomic
363transation, see option \fB\-\-bundle\fR, below.
db5076ee
JR
364.
365.IP "[\fB\-\-bundle\fR] \fBadd\-flow \fIswitch flow\fR"
366.IQ "[\fB\-\-bundle\fR] \fBadd\-flow \fIswitch \fB\- < \fIfile\fR"
367.IQ "[\fB\-\-bundle\fR] \fBadd\-flows \fIswitch file\fR"
4989c59f
BP
368Add each flow entry to \fIswitch\fR's tables.
369.
db5076ee
JR
370Each flow specification (e.g., each line in \fIfile\fR) may start with
371\fBadd\fR, \fBmodify\fR, \fBdelete\fR, \fBmodify_strict\fR, or
372\fBdelete_strict\fR keyword to specify whether a flow is to be added,
373modified, or deleted, and whether the modify or delete is strict or
374not. For backwards compatibility a flow specification without one of
375these keywords is treated as a flow add. All flow mods are executed
376in the order specified.
377.
378.IP "[\fB\-\-bundle\fR] [\fB\-\-strict\fR] \fBmod\-flows \fIswitch flow\fR"
379.IQ "[\fB\-\-bundle\fR] [\fB\-\-strict\fR] \fBmod\-flows \fIswitch \fB\- < \fIfile\fR"
4989c59f
BP
380Modify the actions in entries from \fIswitch\fR's tables that match
381the specified flows. With \fB\-\-strict\fR, wildcards are not treated
382as active for matching purposes.
383.
db5076ee
JR
384.IP "[\fB\-\-bundle\fR] \fBdel\-flows \fIswitch\fR"
385.IQ "[\fB\-\-bundle\fR] [\fB\-\-strict\fR] \fBdel\-flows \fIswitch \fR[\fIflow\fR]"
386.IQ "[\fB\-\-bundle\fR] [\fB\-\-strict\fR] \fBdel\-flows \fIswitch \fB\- < \fIfile\fR"
4989c59f
BP
387Deletes entries from \fIswitch\fR's flow table. With only a
388\fIswitch\fR argument, deletes all flows. Otherwise, deletes flow
389entries that match the specified flows. With \fB\-\-strict\fR,
390wildcards are not treated as active for matching purposes.
a9b4a41a 391.
db5076ee 392.IP "[\fB\-\-bundle\fR] [\fB\-\-readd\fR] \fBreplace\-flows \fIswitch file\fR"
0199c526
BP
393Reads flow entries from \fIfile\fR (or \fBstdin\fR if \fIfile\fR is
394\fB\-\fR) and queries the flow table from \fIswitch\fR. Then it fixes
395up any differences, adding flows from \fIflow\fR that are missing on
396\fIswitch\fR, deleting flows from \fIswitch\fR that are not in
397\fIfile\fR, and updating flows in \fIswitch\fR whose actions, cookie,
398or timeouts differ in \fIfile\fR.
399.
c4ea79bf
BP
400.IP
401With \fB\-\-readd\fR, \fBovs\-ofctl\fR adds all the flows from
402\fIfile\fR, even those that exist with the same actions, cookie, and
b6dc6b93
BP
403timeout in \fIswitch\fR. In OpenFlow 1.0 and 1.1, re-adding a flow
404always resets the flow's packet and byte counters to 0, and in
405OpenFlow 1.2 and later, it does so only if the \fBreset_counts\fR flag
406is set.
c4ea79bf 407.
0199c526
BP
408.IP "\fBdiff\-flows \fIsource1 source2\fR"
409Reads flow entries from \fIsource1\fR and \fIsource2\fR and prints the
410differences. A flow that is in \fIsource1\fR but not in \fIsource2\fR
411is printed preceded by a \fB\-\fR, and a flow that is in \fIsource2\fR
412but not in \fIsource1\fR is printed preceded by a \fB+\fR. If a flow
413exists in both \fIsource1\fR and \fIsource2\fR with different actions,
414cookie, or timeouts, then both versions are printed preceded by
415\fB\-\fR and \fB+\fR, respectively.
416.IP
417\fIsource1\fR and \fIsource2\fR may each name a file or a switch. If
418a name begins with \fB/\fR or \fB.\fR, then it is considered to be a
419file name. A name that contains \fB:\fR is considered to be a switch.
420Otherwise, it is a file if a file by that name exists, a switch if
421not.
422.IP
423For this command, an exit status of 0 means that no differences were
424found, 1 means that an error occurred, and 2 means that some
425differences were found.
426.
6dd3c787
JR
427.IP "\fBpacket\-out \fIswitch\fR \fIpacket-out\fR"
428Connects to \fIswitch\fR and instructs it to execute the
429\fIpacket-out\fR OpenFlow message, specified as defined in
430\fBPacket\-Out Syntax\fR section.
0c3d5fc8 431.
7395c052
NZ
432.SS "OpenFlow Switch Group Table Commands"
433.
434These commands manage the group table in an OpenFlow switch. In each
435case, \fIgroup\fR specifies a group entry in the format described in
436\fBGroup Syntax\fR, below, and \fIfile\fR is a text file that contains
25070e04
JR
437zero or more groups in the same syntax, one per line, and the optional
438\fB\-\-bundle\fR option operates the command as a single atomic
439transation, see option \fB\-\-bundle\fR, below.
7395c052 440
25070e04
JR
441.IP "[\fB\-\-bundle\fR] \fBadd\-group \fIswitch group\fR"
442.IQ "[\fB\-\-bundle\fR] \fBadd\-group \fIswitch \fB\- < \fIfile\fR"
443.IQ "[\fB\-\-bundle\fR] \fBadd\-groups \fIswitch file\fR"
7395c052
NZ
444Add each group entry to \fIswitch\fR's tables.
445.
25070e04
JR
446Each group specification (e.g., each line in \fIfile\fR) may start
447with \fBadd\fR, \fBmodify\fR, \fBadd_or_mod\fR, \fBdelete\fR,
448\fBinsert_bucket\fR, or \fBremove_bucket\fR keyword to specify whether
449a flow is to be added, modified, or deleted, or whether a group bucket
450is to be added or removed. For backwards compatibility a group
451specification without one of these keywords is treated as a group add.
452All group mods are executed in the order specified.
453.
454.IP "[\fB\-\-bundle\fR] [\fB\-\-may\-create\fR] \fBmod\-group \fIswitch group\fR"
455.IQ "[\fB\-\-bundle\fR] [\fB\-\-may\-create\fR] \fBmod\-group \fIswitch \fB\- < \fIfile\fR"
7395c052 456Modify the action buckets in entries from \fIswitch\fR's tables for
88b87a36
JS
457each group entry. If a specified group does not already exist, then
458without \fB\-\-may\-create\fR, this command has no effect; with
459\fB\-\-may\-create\fR, it creates a new group. The
460\fB\-\-may\-create\fR option uses an Open vSwitch extension to
461OpenFlow only implemented in Open vSwitch 2.6 and later.
7395c052 462.
25070e04
JR
463.IP "[\fB\-\-bundle\fR] \fBdel\-groups \fIswitch\fR"
464.IQ "[\fB\-\-bundle\fR] \fBdel\-groups \fIswitch \fR[\fIgroup\fR]"
465.IQ "[\fB\-\-bundle\fR] \fBdel\-groups \fIswitch \fB\- < \fIfile\fR"
7395c052
NZ
466Deletes entries from \fIswitch\fR's group table. With only a
467\fIswitch\fR argument, deletes all groups. Otherwise, deletes the group
468for each group entry.
469.
25070e04
JR
470.IP "[\fB\-\-bundle\fR] \fBinsert\-buckets \fIswitch group\fR"
471.IQ "[\fB\-\-bundle\fR] \fBinsert\-buckets \fIswitch \fB\- < \fIfile\fR"
bdbb8426
SH
472Add buckets to an existing group present in the \fIswitch\fR's group table.
473If no \fIcommand_bucket_id\fR is present in the group specification then all
474buckets of the group are removed.
475.
25070e04
JR
476.IP "[\fB\-\-bundle\fR] \fBremove\-buckets \fIswitch group\fR"
477.IQ "[\fB\-\-bundle\fR] \fBremove\-buckets \fIswitch \fB\- < \fIfile\fR"
bdbb8426
SH
478Remove buckets to an existing group present in the \fIswitch\fR's group table.
479If no \fIcommand_bucket_id\fR is present in the group specification then all
480buckets of the group are removed.
481.
25070e04
JR
482.SS OpenFlow Switch Bundle Command
483.
484Transactional updates to both flow and group tables can be made with
485the \fBbundle\fR command. \fIfile\fR is a text file that contains
6dd3c787
JR
486zero or more flow mods, group mods, or packet-outs in \fBFlow
487Syntax\fR, \fBGroup Syntax\fR, or \fBPacket\-Out Syntax\fR, each line
488preceded by \fBflow\fR, \fBgroup\fR, or \fBpacket\-out\fR keyword,
489correspondingly. The \fBflow\fR keyword may be optionally followed by
490one of the keywords \fBadd\fR, \fBmodify\fR, \fBmodify_strict\fR,
25070e04
JR
491\fBdelete\fR, or \fBdelete_strict\fR, of which the \fBadd\fR is
492assumed if a bare \fBflow\fR is given. Similarly, the \fBgroup\fR
493keyword may be optionally followed by one of the keywords \fBadd\fR,
494\fBmodify\fR, \fBadd_or_mod\fR, \fBdelete\fR, \fBinsert_bucket\fR, or
495\fBremove_bucket\fR, of which the \fBadd\fR is assumed if a bare
496\fBgroup\fR is given.
497.
498.IP "\fBbundle \fIswitch file\fR"
499Execute all flow and group mods in \fIfile\fR as a single atomic
500transaction against \fIswitch\fR's tables. All bundled mods are
501executed in the order specified.
502.
4e548ad9 503.SS "OpenFlow Switch Tunnel TLV Table Commands"
6159c531 504.
4e548ad9
ML
505Open vSwitch maintains a mapping table between tunnel option TLVs (defined
506by <class, type, length>) and NXM fields \fBtun_metadata\fIn\fR,
1e71b944 507where \fIn\fR ranges from 0 to 63, that can be operated on for the
4e548ad9
ML
508purposes of matches, actions, etc. This TLV table can be used for
509Geneve option TLVs or other protocols with options in same TLV format
510as Geneve options. This mapping must be explicitly specified by the user
511through the following commands.
6159c531 512
4e548ad9 513A TLV mapping is specified with the syntax
1e71b944
BP
514\fB{class=\fIclass\fB,type=\fItype\fB,len=\fIlength\fB}->tun_metadata\fIn\fR.
515When an option mapping exists for a given \fBtun_metadata\fIn\fR,
516matching on the defined field becomes possible, e.g.:
517
518.RS
4e548ad9 519ovs-ofctl add-tlv-map br0 "{class=0xffff,type=0,len=4}->tun_metadata0"
1e71b944
BP
520.PP
521ovs-ofctl add-flow br0 tun_metadata0=1234,actions=controller
522.RE
523
524A mapping should not be changed while it is in active
525use by a flow. The result of doing so is undefined.
6159c531
JG
526
527These commands are Nicira extensions to OpenFlow and require Open vSwitch
5282.5 or later.
529
b8e2f655 530.IP "\fBadd\-tlv\-map \fIswitch option\fR[\fB,\fIoption\fR]..."
1e71b944 531Add each \fIoption\fR to \fIswitch\fR's tables. Duplicate fields are
6159c531
JG
532rejected.
533.
b8e2f655 534.IP "\fBdel\-tlv\-map \fIswitch \fR[\fIoption\fR[\fB,\fIoption\fR]]..."
4e548ad9 535Delete each \fIoption\fR from \fIswitch\fR's table, or all option TLV
1e71b944
BP
536mapping if no \fIoption\fR is specified.
537Fields that aren't mapped are ignored.
6159c531 538.
b8e2f655 539.IP "\fBdump\-tlv\-map \fIswitch\fR"
6159c531
JG
540Show the currently mapped fields in the switch's option table as well
541as switch capabilities.
542.
4989c59f
BP
543.SS "OpenFlow Switch Monitoring Commands"
544.
0caf6bde
BP
545.IP "\fBsnoop \fIswitch\fR"
546Connects to \fIswitch\fR and prints to the console all OpenFlow
547messages received. Unlike other \fBovs\-ofctl\fR commands, if
548\fIswitch\fR is the name of a bridge, then the \fBsnoop\fR command
549connects to a Unix domain socket named
421e818c 550\fB@RUNDIR@/\fIswitch\fB.snoop\fR. \fBovs\-vswitchd\fR listens on
0caf6bde
BP
551such a socket for each bridge and sends to it all of the OpenFlow
552messages sent to or received from its configured OpenFlow controller.
553Thus, this command can be used to view OpenFlow protocol activity
554between a switch and its controller.
555.IP
556When a switch has more than one controller configured, only the
e2bfacb6
BP
557traffic to and from a single controller is output. If none of the
558controllers is configured as a master or a slave (using a Nicira
70d0aed3
BP
559extension to OpenFlow 1.0 or 1.1, or a standard request in OpenFlow
5601.2 or later), then a controller is chosen arbitrarily among
e2bfacb6
BP
561them. If there is a master controller, it is chosen; otherwise, if
562there are any controllers that are not masters or slaves, one is
563chosen arbitrarily; otherwise, a slave controller is chosen
564arbitrarily. This choice is made once at connection time and does not
565change as controllers reconfigure their roles.
566.IP
567If a switch has no controller configured, or if
0caf6bde
BP
568the configured controller is disconnected, no traffic is sent, so
569monitoring will not show any traffic.
570.
2b07c8b1 571.IP "\fBmonitor \fIswitch\fR [\fImiss-len\fR] [\fBinvalid_ttl\fR] [\fBwatch:\fR[\fIspec\fR...]]"
064af421 572Connects to \fIswitch\fR and prints to the console all OpenFlow
045b2e5c
BP
573messages received. Usually, \fIswitch\fR should specify the name of a
574bridge in the \fBovs\-vswitchd\fR database.
a9b4a41a 575.IP
064af421
BP
576If \fImiss-len\fR is provided, \fBovs\-ofctl\fR sends an OpenFlow ``set
577configuration'' message at connection setup time that requests
0caf6bde
BP
578\fImiss-len\fR bytes of each packet that misses the flow table. Open vSwitch
579does not send these and other asynchronous messages to an
064af421 580\fBovs\-ofctl monitor\fR client connection unless a nonzero value is
0caf6bde
BP
581specified on this argument. (Thus, if \fImiss\-len\fR is not
582specified, very little traffic will ordinarily be printed.)
a9b4a41a 583.IP
f0fd1a17
PS
584If \fBinvalid_ttl\fR is passed, \fBovs\-ofctl\fR sends an OpenFlow ``set
585configuration'' message at connection setup time that requests
5484c47a
BP
586\fBINVALID_TTL_TO_CONTROLLER\fR, so that \fBovs\-ofctl monitor\fR can
587receive ``packet-in'' messages when TTL reaches zero on \fBdec_ttl\fR action.
ad99e2ed
BP
588Only OpenFlow 1.1 and 1.2 support \fBinvalid_ttl\fR; Open vSwitch also
589implements it for OpenFlow 1.0 as an extension.
f0fd1a17 590.IP
2b07c8b1
BP
591\fBwatch:\fR[\fB\fIspec\fR...] causes \fBovs\-ofctl\fR to send a
592``monitor request'' Nicira extension message to the switch at
593connection setup time. This message causes the switch to send
594information about flow table changes as they occur. The following
595comma-separated \fIspec\fR syntax is available:
596.RS
597.IP "\fB!initial\fR"
598Do not report the switch's initial flow table contents.
599.IP "\fB!add\fR"
600Do not report newly added flows.
601.IP "\fB!delete\fR"
602Do not report deleted flows.
603.IP "\fB!modify\fR"
604Do not report modifications to existing flows.
605.IP "\fB!own\fR"
606Abbreviate changes made to the flow table by \fBovs\-ofctl\fR's own
607connection to the switch. (These could only occur using the
608\fBofctl/send\fR command described below under \fBRUNTIME MANAGEMENT
609COMMANDS\fR.)
610.IP "\fB!actions\fR"
611Do not report actions as part of flow updates.
4bc938cc
BP
612.IP "\fBtable=\fItable\fR"
613Limits the monitoring to the table with the given \fItable\fR, which
614may be expressed as a number between 0 and 254 or (unless
615\fB\-\-no\-names\fR is specified) a name. By default, all tables are
616monitored.
2b07c8b1 617.IP "\fBout_port=\fIport\fR"
c6100d92
BP
618If set, only flows that output to \fIport\fR are monitored. The
619\fIport\fR may be an OpenFlow port number or keyword
620(e.g. \fBLOCAL\fR).
2b07c8b1
BP
621.IP "\fIfield\fB=\fIvalue\fR"
622Monitors only flows that have \fIfield\fR specified as the given
623\fIvalue\fR. Any syntax valid for matching on \fBdump\-flows\fR may
624be used.
625.RE
626.IP
064af421 627This command may be useful for debugging switch or controller
2b07c8b1
BP
628implementations. With \fBwatch:\fR, it is particularly useful for
629observing how a controller updates flow tables.
a9b4a41a 630.
064af421 631.SS "OpenFlow Switch and Controller Commands"
a9b4a41a 632.
064af421
BP
633The following commands, like those in the previous section, may be
634applied to OpenFlow switches, using any of the connection methods
635described in that section. Unlike those commands, these may also be
636applied to OpenFlow controllers.
a9b4a41a 637.
064af421
BP
638.TP
639\fBprobe \fItarget\fR
640Sends a single OpenFlow echo-request message to \fItarget\fR and waits
4e312e69 641for the response. With the \fB\-t\fR or \fB\-\-timeout\fR option, this
064af421
BP
642command can test whether an OpenFlow switch or controller is up and
643running.
a9b4a41a 644.
064af421
BP
645.TP
646\fBping \fItarget \fR[\fIn\fR]
647Sends a series of 10 echo request packets to \fItarget\fR and times
648each reply. The echo request packets consist of an OpenFlow header
649plus \fIn\fR bytes (default: 64) of randomly generated payload. This
650measures the latency of individual requests.
a9b4a41a 651.
064af421
BP
652.TP
653\fBbenchmark \fItarget n count\fR
654Sends \fIcount\fR echo request packets that each consist of an
655OpenFlow header plus \fIn\fR bytes of payload and waits for each
656response. Reports the total time required. This is a measure of the
657maximum bandwidth to \fItarget\fR for round-trips of \fIn\fR-byte
658messages.
a9b4a41a 659.
1ac0e975
BP
660.SS "Other Commands"
661.
662.IP "\fBofp\-parse\fR \fIfile\fR"
663Reads \fIfile\fR (or \fBstdin\fR if \fIfile\fR is \fB\-\fR) as a
664series of OpenFlow messages in the binary format used on an OpenFlow
665connection, and prints them to the console. This can be useful for
666printing OpenFlow messages captured from a TCP stream.
667.
f3dd1419
BP
668.IP "\fBofp\-parse\-pcap\fR \fIfile\fR [\fIport\fR...]"
669Reads \fIfile\fR, which must be in the PCAP format used by network
670capture tools such as \fBtcpdump\fR or \fBwireshark\fR, extracts all
671the TCP streams for OpenFlow connections, and prints the OpenFlow
672messages in those connections in human-readable format on
673\fBstdout\fR.
674.IP
675OpenFlow connections are distinguished by TCP port number.
676Non-OpenFlow packets are ignored. By default, data on TCP ports 6633
677and 6653 are considered to be OpenFlow. Specify one or more
678\fIport\fR arguments to override the default.
679.IP
680This command cannot usefully print SSL encrypted traffic. It does not
681understand IPv6.
682.
064af421 683.SS "Flow Syntax"
a9b4a41a 684.PP
064af421 685Some \fBovs\-ofctl\fR commands accept an argument that describes a flow or
96fee5e0 686flows. Such flow descriptions comprise a series of
064af421
BP
687\fIfield\fB=\fIvalue\fR assignments, separated by commas or white
688space. (Embedding spaces into a flow description normally requires
689quoting to prevent the shell from breaking the description into
690multiple arguments.)
a9b4a41a 691.PP
0b3f2725
BP
692Flow descriptions should be in \fBnormal form\fR. This means that a
693flow may only specify a value for an L3 field if it also specifies a
694particular L2 protocol, and that a flow may only specify an L4 field
695if it also specifies particular L2 and L3 protocol types. For
696example, if the L2 protocol type \fBdl_type\fR is wildcarded, then L3
697fields \fBnw_src\fR, \fBnw_dst\fR, and \fBnw_proto\fR must also be
698wildcarded. Similarly, if \fBdl_type\fR or \fBnw_proto\fR (the L3
1c58a78b
BP
699protocol type) is wildcarded, so must be the L4 fields \fBtcp_dst\fR and
700\fBtcp_src\fR. \fBovs\-ofctl\fR will warn about
0b3f2725
BP
701flows not in normal form.
702.PP
96fee5e0
BP
703\fBovs\-fields\fR(7) describes the supported fields and how to match
704them. In addition to match fields, commands that operate on flows
705accept a few additional key-value pairs:
71e17a7a 706.
4bc938cc
BP
707.IP \fBtable=\fItable\fR
708For flow dump commands, limits the flows dumped to those in
709\fItable\fR, which may be expressed as a number between 0 and 255 or
710(unless \fB\-\-no\-names\fR is specified) a name. If not specified
711(or if 255 is specified as \fItable\fR), then flows in all tables are
0e197060
BP
712dumped.
713.
714.IP
715For flow table modification commands, behavior varies based on the
716OpenFlow version used to connect to the switch:
717.
718.RS
719.IP "OpenFlow 1.0"
720OpenFlow 1.0 does not support \fBtable\fR for modifying flows.
721\fBovs\-ofctl\fR will exit with an error if \fBtable\fR (other than
722\fBtable=255\fR) is specified for a switch that only supports OpenFlow
7231.0.
724.IP
725In OpenFlow 1.0, the switch chooses the table into which to insert a
726new flow. The Open vSwitch software switch always chooses table 0.
727Other Open vSwitch datapaths and other OpenFlow implementations may
728choose different tables.
729.IP
730The OpenFlow 1.0 behavior in Open vSwitch for modifying or removing
731flows depends on whether \fB\-\-strict\fR is used. Without
732\fB\-\-strict\fR, the command applies to matching flows in all tables.
733With \fB\-\-strict\fR, the command will operate on any single matching
734flow in any table; it will do nothing if there are matches in more
735than one table. (The distinction between these behaviors only matters
736if non-OpenFlow 1.0 commands were also used, because OpenFlow 1.0
737alone cannot add flows with the same matching criteria to multiple
738tables.)
739.
740.IP "OpenFlow 1.0 with table_id extension"
741Open vSwitch implements an OpenFlow extension that allows the
742controller to specify the table on which to operate. \fBovs\-ofctl\fR
743automatically enables the extension when \fBtable\fR is specified and
744OpenFlow 1.0 is used. \fBovs\-ofctl\fR automatically detects whether
745the switch supports the extension. As of this writing, this extension
746is only known to be implemented by Open vSwitch.
747.
748.IP
749With this extension, \fBovs\-ofctl\fR operates on the requested table
750when \fBtable\fR is specified, and acts as described for OpenFlow 1.0
751above when no \fBtable\fR is specified (or for \fBtable=255\fR).
752.
753.IP "OpenFlow 1.1"
754OpenFlow 1.1 requires flow table modification commands to specify a
755table. When \fBtable\fR is not specified (or \fBtable=255\fR is
756specified), \fBovs\-ofctl\fR defaults to table 0.
757.
758.IP "OpenFlow 1.2 and later"
759OpenFlow 1.2 and later allow flow deletion commands, but not other
760flow table modification commands, to operate on all flow tables, with
761the behavior described above for OpenFlow 1.0.
762.RE
96fee5e0
BP
763.IP "\fBduration=\fR..."
764.IQ "\fBn_packet=\fR..."
765.IQ "\fBn_bytes=\fR..."
766\fBovs\-ofctl\fR ignores assignments to these ``fields'' to allow
767output from the \fBdump\-flows\fR command to be used as input for
768other commands that parse flows.
2c6d8411
BP
769.
770.PP
c821124b
BP
771The \fBadd\-flow\fR, \fBadd\-flows\fR, and \fBmod\-flows\fR commands
772require an additional field, which must be the final field specified:
a9b4a41a 773.
d1ba66e9 774.IP \fBactions=\fR[\fIaction\fR][\fB,\fIaction\fR...]\fR
064af421 775Specifies a comma-separated list of actions to take on a packet when the
d1ba66e9
BP
776flow entry matches. If no \fIaction\fR is specified, then packets
777matching the flow are dropped. The following forms of \fIaction\fR
778are supported:
a9b4a41a 779.
064af421 780.RS
d1ba66e9
BP
781.IP \fIport\fR
782.IQ \fBoutput:\fIport\fR
783Outputs the packet to OpenFlow port number \fIport\fR. If \fIport\fR
784is the packet's input port, the packet is not output.
c6100d92
BP
785.
786.IP \fBoutput:\fIsrc\fB[\fIstart\fB..\fIend\fB]
787Outputs the packet to the OpenFlow port number read from \fIsrc\fR,
21b2fa61
JR
788which may be an NXM field name, as described above, or a match field name.
789\fBoutput:reg0[16..31]\fR outputs to the OpenFlow port number
d1ba66e9
BP
790written in the upper half of register 0. If the port number is the
791packet's input port, the packet is not output.
792.IP
793This form of \fBoutput\fR was added in Open vSwitch 1.3.0. This form
794of \fBoutput\fR uses an OpenFlow extension that is not supported by
795standard OpenFlow switches.
5682f723 796.
aaca4fe0
WT
797.IP \fBoutput(port=\fIport\fR\fB,max_len=\fInbytes\fR)
798Outputs the packet to the OpenFlow port number read from \fIport\fR,
799with maximum packet size set to \fInbytes\fR. \fIport\fR may be OpenFlow
800port number, \fBlocal\fR, or \fBin_port\fR. Patch port is not supported.
801Packets larger than \fInbytes\fR will be trimmed to \fInbytes\fR while
802packets smaller than \fInbytes\fR remains the original size.
803.
b47e67c4 804.IP \fBgroup:\fIgroup_id\fR
88c8ca26
BP
805Outputs the packet to the OpenFlow group \fIgroup_id\fR. OpenFlow 1.1
806introduced support for groups; Open vSwitch 2.6 and later also
807supports output to groups as an extension to OpenFlow 1.0. See
808\fBGroup Syntax\fR for more details.
b47e67c4 809.
064af421
BP
810.IP \fBnormal\fR
811Subjects the packet to the device's normal L2/L3 processing. (This
812action is not implemented by all OpenFlow switches.)
a9b4a41a 813.
064af421
BP
814.IP \fBflood\fR
815Outputs the packet on all switch physical ports other than the port on
816which it was received and any ports on which flooding is disabled
817(typically, these would be ports disabled by the IEEE 802.1D spanning
818tree protocol).
a9b4a41a 819.
064af421
BP
820.IP \fBall\fR
821Outputs the packet on all switch physical ports other than the port on
822which it was received.
a9b4a41a 823.
d1ba66e9
BP
824.IP \fBlocal\fR
825Outputs the packet on the ``local port,'' which corresponds to the
826network device that has the same name as the bridge.
827.
828.IP \fBin_port\fR
829Outputs the packet on the port from which it was received.
830.
a7349929 831.IP \fBcontroller(\fIkey\fB=\fIvalue\fR...\fB)
77ab5fd2 832Sends the packet and its metadata to the OpenFlow controller as a ``packet in''
a7349929
BP
833message. The supported key-value pairs are:
834.RS
835.IP "\fBmax_len=\fInbytes\fR"
836Limit to \fInbytes\fR the number of bytes of the packet to send to
837the controller. By default the entire packet is sent.
838.IP "\fBreason=\fIreason\fR"
839Specify \fIreason\fR as the reason for sending the message in the
840``packet in'' message. The supported reasons are \fBaction\fR (the
841default), \fBno_match\fR, and \fBinvalid_ttl\fR.
842.IP "\fBid=\fIcontroller-id\fR"
843Specify \fIcontroller-id\fR, a 16-bit integer, as the connection ID of
844the OpenFlow controller or controllers to which the ``packet in''
845message should be sent. The default is zero. Zero is also the
846default connection ID for each controller connection, and a given
847controller connection will only have a nonzero connection ID if its
848controller uses the \fBNXT_SET_CONTROLLER_ID\fR Nicira extension to
849OpenFlow.
bdcad671
BP
850.IP "\fBuserdata=\fIhh\fR...\fR"
851Supplies the bytes represented as hex digits \fIhh\fR as additional
852data to the controller in the packet-in message. Pairs of hex digits
853may be separated by periods for readability.
77ab5fd2
BP
854.IP "\fBpause\fR"
855Causes the switch to freeze the packet's trip through Open vSwitch
856flow tables and serializes that state into the packet-in message as a
857``continuation,'' an additional property in the \fBNXT_PACKET_IN2\fR
858message. The controller can later send the continuation back to the
859switch in an \fBNXT_RESUME\fR message, which will restart the packet's
860traversal from the point where it was interrupted. This permits an
861OpenFlow controller to interpose on a packet midway through processing
862in Open vSwitch.
bdcad671 863.
a7349929 864.RE
d1ba66e9 865.IP
bdcad671
BP
866If any \fIreason\fR other than \fBaction\fR or any nonzero
867\fIcontroller-id\fR is supplied, Open vSwitch extension
868\fBNXAST_CONTROLLER\fR, supported by Open vSwitch 1.6 and later, is
869used. If \fBuserdata\fR is supplied, then \fBNXAST_CONTROLLER2\fR,
870supported by Open vSwitch 2.6 and later, is used.
a7349929
BP
871.
872.IP \fBcontroller\fR
873.IQ \fBcontroller\fR[\fB:\fInbytes\fR]
874Shorthand for \fBcontroller()\fR or
875\fBcontroller(max_len=\fInbytes\fB)\fR, respectively.
a9b4a41a 876.
d1ba66e9
BP
877.IP \fBenqueue(\fIport\fB,\fIqueue\fB)\fR
878Enqueues the packet on the specified \fIqueue\fR within port
879\fIport\fR, which must be an OpenFlow port number or keyword
880(e.g. \fBLOCAL\fR). The number of supported queues depends on the
881switch; some OpenFlow implementations do not support queuing at all.
64c1e8af 882.
064af421
BP
883.IP \fBdrop\fR
884Discards the packet, so no further processing or forwarding takes place.
885If a drop action is used, no other actions may be specified.
a9b4a41a 886.
064af421
BP
887.IP \fBmod_vlan_vid\fR:\fIvlan_vid\fR
888Modifies the VLAN id on a packet. The VLAN tag is added or modified
889as necessary to match the value specified. If the VLAN tag is added,
890a priority of zero is used (see the \fBmod_vlan_pcp\fR action to set
891this).
a9b4a41a 892.
064af421
BP
893.IP \fBmod_vlan_pcp\fR:\fIvlan_pcp\fR
894Modifies the VLAN priority on a packet. The VLAN tag is added or modified
895as necessary to match the value specified. Valid values are between 0
896(lowest) and 7 (highest). If the VLAN tag is added, a vid of zero is used
897(see the \fBmod_vlan_vid\fR action to set this).
a9b4a41a 898.
064af421
BP
899.IP \fBstrip_vlan\fR
900Strips the VLAN tag from a packet if it is present.
a9b4a41a 901.
3e34fbdd 902.IP \fBpush_vlan\fR:\fIethertype\fR
898dcef1 903Push a new VLAN tag onto the packet. Ethertype is used as the Ethertype
3e34fbdd
IY
904for the tag. Only ethertype 0x8100 should be used. (0x88a8 which the spec
905allows isn't supported at the moment.)
906A priority of zero and the tag of zero are used for the new tag.
907.
b02475c5 908.IP \fBpush_mpls\fR:\fIethertype\fR
912c1938
SH
909Changes the packet's Ethertype to \fIethertype\fR, which must be either
910\fB0x8847\fR or \fB0x8848\fR, and pushes an MPLS LSE.
911.IP
912If the packet does not already contain any MPLS labels then an initial
913label stack entry is pushed. The label stack entry's label is 2 if the
914packet contains IPv6 and 0 otherwise, its default traffic control value is
915the low 3 bits of the packet's DSCP value (0 if the packet is not IP), and
916its TTL is copied from the IP TTL (64 if the packet is not IP).
b02475c5
SH
917.IP
918If the packet does already contain an MPLS label, pushes a new
919outermost label as a copy of the existing outermost label.
920.IP
b0a17866
SH
921A limitation of the implementation is that processing of actions will stop
922if \fBpush_mpls\fR follows another \fBpush_mpls\fR unless there is a
923\fBpop_mpls\fR in between.
b02475c5
SH
924.
925.IP \fBpop_mpls\fR:\fIethertype\fR
799a91bb
SH
926Strips the outermost MPLS label stack entry.
927Currently the implementation restricts \fIethertype\fR to a non-MPLS Ethertype
928and thus \fBpop_mpls\fR should only be applied to packets with
b0a17866
SH
929an MPLS label stack depth of one. A further limitation is that processing of
930actions will stop if \fBpop_mpls\fR follows another \fBpop_mpls\fR unless
931there is a \fBpush_mpls\fR in between.
b02475c5 932.
064af421
BP
933.IP \fBmod_dl_src\fB:\fImac\fR
934Sets the source Ethernet address to \fImac\fR.
a9b4a41a 935.
064af421
BP
936.IP \fBmod_dl_dst\fB:\fImac\fR
937Sets the destination Ethernet address to \fImac\fR.
a9b4a41a 938.
e423eca6
JP
939.IP \fBmod_nw_src\fB:\fIip\fR
940Sets the IPv4 source address to \fIip\fR.
a9b4a41a 941.
e423eca6
JP
942.IP \fBmod_nw_dst\fB:\fIip\fR
943Sets the IPv4 destination address to \fIip\fR.
a9b4a41a 944.
e423eca6 945.IP \fBmod_tp_src\fB:\fIport\fR
0d56eaf2 946Sets the TCP or UDP or SCTP source port to \fIport\fR.
a9b4a41a 947.
e423eca6 948.IP \fBmod_tp_dst\fB:\fIport\fR
0d56eaf2 949Sets the TCP or UDP or SCTP destination port to \fIport\fR.
a9b4a41a 950.
959a2ecd 951.IP \fBmod_nw_tos\fB:\fItos\fR
04f01c24
BP
952Sets the DSCP bits in the IPv4 ToS/DSCP or IPv6 traffic class field to
953\fItos\fR, which must be a multiple of 4 between 0 and 255. This action
954does not modify the two least significant bits of the ToS field (the ECN bits).
ff14eb7a
JR
955.
956.IP \fBmod_nw_ecn\fB:\fIecn\fR
957Sets the ECN bits in the IPv4 ToS or IPv6 traffic class field to \fIecn\fR,
958which must be a value between 0 and 3, inclusive. This action does not modify
959the six most significant bits of the field (the DSCP bits).
960.IP
961Requires OpenFlow 1.1 or later.
0c20dbe4
JR
962.
963.IP \fBmod_nw_ttl\fB:\fIttl\fR
964Sets the IPv4 TTL or IPv6 hop limit field to \fIttl\fR, which is specified as
965a decimal number between 0 and 255, inclusive. Switch behavior when setting
966\fIttl\fR to zero is not well specified, though.
967.IP
968Requires OpenFlow 1.1 or later.
659586ef
JG
969.RE
970.IP
971The following actions are Nicira vendor extensions that, as of this writing, are
972only known to be implemented by Open vSwitch:
973.
974.RS
975.
3a2fe1f3 976.IP \fBresubmit\fB:\fIport\fR
29901626 977.IQ \fBresubmit\fB(\fR[\fIport\fR]\fB,\fR[\fItable\fR]\fB)
2cd20955 978.IQ \fBresubmit\fB(\fR[\fIport\fR]\fB,\fR[\fItable\fR]\fB,ct)
4bc938cc
BP
979Re-searches this OpenFlow flow table (or table \fItable\fR, if
980specified) with the \fBin_port\fR field replaced by
2cd20955
JR
981\fIport\fR (if \fIport\fR is specified) and the packet 5-tuple fields
982swapped with the corresponding conntrack original direction tuple
983fields (if \fBct\fR is specified, see \fBct_nw_src\fR above), and
984executes the actions found, if any, in addition to any other actions
985in this flow entry. The \fBin_port\fR and swapped 5-tuple fields are
986restored immediately after the search, before any actions are
987executed.
988.IP
4bc938cc
BP
989The \fItable\fR may be expressed as a number between 0 and 254 or
990(unless \fB\-\-no\-names\fR is specified) a name.
991.IP
2cd20955
JR
992The \fBct\fR option requires a valid connection tracking state as a
993match prerequisite in the flow where this action is placed. Examples
994of valid connection tracking state matches include
995\fBct_state=+new\fR, \fBct_state=+est\fR, \fBct_state=+rel\fR, and
996\fBct_state=+trk-inv\fR.
29901626 997.IP
790c5d26
BP
998Recursive \fBresubmit\fR actions are obeyed up to
999implementation-defined limits:
1000.RS
1001.IP \(bu
1002Open vSwitch 1.0.1 and earlier did not support recursion.
1003.IP \(bu
1004Open vSwitch 1.0.2 and 1.0.3 limited recursion to 8 levels.
1005.IP \(bu
1006Open vSwitch 1.1 and 1.2 limited recursion to 16 levels.
1007.IP \(bu
1008Open vSwitch 1.2 through 1.8 limited recursion to 32 levels.
1009.IP \(bu
1010Open vSwitch 1.9 through 2.0 limited recursion to 64 levels.
1011.IP \(bu
1012Open vSwitch 2.1 through 2.5 limited recursion to 64 levels and impose
1013a total limit of 4,096 resubmits per flow translation (earlier versions
1014did not impose any total limit).
1015.IP \(bu
1016Open vSwitch 2.6 and later imposes the same limits as 2.5, with one
1017exception: \fBresubmit\fR from table \fIx\fR to any table \fIy\fR >
1018\fIx\fR does not count against the recursion limit.
1019.RE
1020.IP
2cd20955
JR
1021Open vSwitch before 1.2.90 did not support \fItable\fR. Open vSwitch
1022before 2.7 did not support \fBct\fR.
659586ef
JG
1023.
1024.IP \fBset_tunnel\fB:\fIid\fR
b9298d3f
BP
1025.IQ \fBset_tunnel64\fB:\fIid\fR
1026If outputting to a port that encapsulates the packet in a tunnel and
5a6861aa 1027supports an identifier (such as GRE), sets the identifier to \fIid\fR.
b9298d3f
BP
1028If the \fBset_tunnel\fR form is used and \fIid\fR fits in 32 bits,
1029then this uses an action extension that is supported by Open vSwitch
10301.0 and later. Otherwise, if \fIid\fR is a 64-bit value, it requires
1031Open vSwitch 1.1 or later.
3a2fe1f3 1032.
eedc0097
JP
1033.IP \fBset_queue\fB:\fIqueue\fR
1034Sets the queue that should be used to \fIqueue\fR when packets are
1035output. The number of supported queues depends on the switch; some
1036OpenFlow implementations do not support queuing at all.
1037.
1038.IP \fBpop_queue\fR
1039Restores the queue to the value it was before any \fBset_queue\fR
1040actions were applied.
1041.
07659514 1042.IP \fBct\fR
f6fabcc6 1043.IQ \fBct(\fR[\fIargument\fR][\fB,\fIargument\fR...]\fB)
07659514 1044Send the packet through the connection tracker. Refer to the \fBct_state\fR
f6fabcc6
JP
1045documentation above for possible packet and connection states. A \fBct\fR
1046action always sets the packet to an untracked state and clears out the
1047\fBct_state\fR fields for the current processing path. Those fields are
1048only available for the processing path pointed to by the \fBtable\fR
1049argument. The following arguments are supported:
07659514
JS
1050.RS
1051.IP \fBcommit\fR
1052.RS
1053Commit the connection to the connection tracking module. Information about the
1054connection will be stored beyond the lifetime of the packet in the pipeline.
1055Some \fBct_state\fR flags are only available for committed connections.
1056.RE
a76a37ef
JR
1057.IP \fBforce\fR
1058.RS
1059A committed connection always has the directionality of the packet
1060that caused the connection to be committed in the first place. This
1061is the ``original direction'' of the connection, and the opposite
1062direction is the ``reply direction''. If a connection is already
1063committed, but it is in the wrong direction, \fBforce\fR flag may be
1064used in addition to \fBcommit\fR flag to effectively terminate the
1065existing connection and start a new one in the current direction.
1066This flag has no effect if the original direction of the connection is
1067already the same as that of the current packet.
1068.RE
4bc938cc 1069.IP \fBtable=\fItable\fR
07659514
JS
1070Fork pipeline processing in two. The original instance of the packet will
1071continue processing the current actions list as an untracked packet. An
1072additional instance of the packet will be sent to the connection tracker, which
1073will be re-injected into the OpenFlow pipeline to resume processing in table
4bc938cc
BP
1074\fInumber\fR (which may be specified as a number between 0 and 254 or,
1075unless \fB\-\-no\-names\fR is specified, a name), with the
1076\fBct_state\fR and other ct match fields set. If
54da48f4
JS
1077\fBtable\fR is not specified, then the packet which is submitted to the
1078connection tracker is not re-injected into the OpenFlow pipeline. It is
1079strongly recommended to specify a table later than the current table to prevent
1080loops.
07659514
JS
1081.IP \fBzone=\fIvalue\fR
1082.IQ \fBzone=\fIsrc\fB[\fIstart\fB..\fIend\fB]\fR
1083A 16-bit context id that can be used to isolate connections into separate
1084domains, allowing overlapping network addresses in different zones. If a zone
1085is not provided, then the default is to use zone zero. The \fBzone\fR may be
1086specified either as an immediate 16-bit \fIvalue\fR, or may be provided from an
8e53fe8c 1087NXM field \fIsrc\fR. The \fIstart\fR and \fIend\fR pair are inclusive, and must
54da48f4
JS
1088specify a 16-bit range within the field. This value is copied to the
1089\fBct_zone\fR match field for packets which are re-injected into the pipeline
1090using the \fBtable\fR option.
8e53fe8c 1091.IP \fBexec\fB(\fR[\fIaction\fR][\fB,\fIaction\fR...]\fB)\fR
54da48f4
JS
1092Perform actions within the context of connection tracking. This is a restricted
1093set of actions which are in the same format as their specifications as part
1094of a flow. Only actions which modify the \fBct_mark\fR or \fBct_label\fR
1095fields are accepted within the \fBexec\fR action, and these fields may only be
1096modified with this option. For example:
8e53fe8c
JS
1097.
1098.RS
96f46bfc 1099.IP \fBset_field:\fIvalue\fR[\fB/\fImask\fR]->ct_mark\fR
91440329
JR
1100Store a 32-bit metadata value with the connection. Subsequent lookups
1101for packets in this connection will populate the \fBct_mark\fR flow
1102field when the packet is sent to the connection tracker with the
1103\fBtable\fR specified.
96f46bfc 1104.IP \fBset_field:\fIvalue\fR[\fB/\fImask\fR]->ct_label\fR
91440329
JR
1105Store a 128-bit metadata value with the connection. Subsequent
1106lookups for packets in this connection will populate the
1107\fBct_label\fR flow field when the packet is sent to the connection
1108tracker with the \fBtable\fR specified.
8e53fe8c
JS
1109.RE
1110.IP
3a103e4a 1111The \fBcommit\fR parameter must be specified to use \fBexec(...)\fR.
8e53fe8c 1112.
d787ad39
JS
1113.IP \fBalg=\fIalg\fR
1114Specify application layer gateway \fIalg\fR to track specific connection
40c7b2fc
JS
1115types. If subsequent related connections are sent through the \fBct\fR
1116action, then the \fBrel\fR flag in the \fBct_state\fR field will be set.
1117Supported types include:
d787ad39
JS
1118.RS
1119.IP \fBftp\fR
40c7b2fc
JS
1120Look for negotiation of FTP data connections. Specify this option for FTP
1121control connections to detect related data connections and populate the
1122\fBrel\fR flag for the data connections.
1123.
1124.IP \fBtftp\fR
1125Look for negotiation of TFTP data connections. Specify this option for TFTP
1126control connections to detect related data connections and populate the
1127\fBrel\fR flag for the data connections.
d787ad39
JS
1128.RE
1129.
54da48f4 1130.IP
3a103e4a
RB
1131The \fBcommit\fR parameter must be specified to use \fBalg=\fIalg\fR.
1132.
1133.IP
54da48f4
JS
1134When committing related connections, the \fBct_mark\fR for that connection is
1135inherited from the current \fBct_mark\fR stored with the original connection
1136(ie, the connection created by \fBct(alg=...)\fR).
ae8b9260 1137.
8c019a41
JS
1138.IP
1139Note that with the Linux datapath, global sysctl options affect the usage of
1140the \fBct\fR action. In particular, if \fBnet.netfilter.nf_conntrack_helper\fR
1141is enabled then application layer gateway helpers may be executed even if the
1142\fBalg\fR option is not specified. This is the default setting until Linux 4.7.
1143For security reasons, the netfilter team recommends users to disable this
1144option. See this blog post for further details:
1145.
1146http://www.netfilter.org/news.html#2012-04-03
1147.
ae8b9260
JR
1148.IP \fBnat\fR[\fB(\fR(\fBsrc\fR|\fBdst\fR)\fB=\fIaddr1\fR[\fB-\fIaddr2\fR][\fB:\fIport1\fR[\fB-\fIport2\fR]][\fB,\fIflags\fR]\fB)\fR]
1149.
1150Specify address and port translation for the connection being tracked.
1151For new connections either \fBsrc\fR or \fBdst\fR argument must be
1152provided to set up either source address/port translation (SNAT) or
1153destination address/port translation (DNAT), respectively. Setting up
1154address translation for a new connection takes effect only if the
1155\fBcommit\fR flag is also provided for the enclosing \fBct\fR action.
1156A bare \fBnat\fR action will only translate the packet being processed
1157in the way the connection has been set up with an earlier \fBct\fR
1158action. Also a \fBnat\fR action with \fBsrc\fR or \fBdst\fR, when
1159applied to a packet belonging to an established (rather than new)
1160connection, will behave the same as a bare \fBnat\fR.
1161.IP
1162\fBsrc\fR and \fBdst\fR options take the following arguments:
1163.RS
1164.IP \fIaddr1\fR[\fB-\fIaddr2\fR]
1165The address range from which the translated address should be
1166selected. If only one address is given, then that address will always
1167be selected, otherwise the address selection can be informed by the
1168optional \fBpersistent\fR flag as described below. Either IPv4 or
1169IPv6 addresses can be provided, but both addresses must be of the same
1170type, and the datapath behavior is undefined in case of providing IPv4
1171address range for an IPv6 packet, or IPv6 address range for an IPv4
1172packet. IPv6 addresses must be bracketed with '[' and ']' if a port
1173range is also given.
1174.RE
1175.
1176.RS
1177.IP \fIport1\fR[\fB-\fIport2\fR]
1178The port range from which the translated port should be selected. If
1179only one port number is provided, then that should be selected. In
1180case of a mapping conflict the datapath may choose any other
1181non-conflicting port number instead, even when no port range is
1182specified. The port number selection can be informed by the optional
1183\fBrandom\fR and \fBhash\fR flags as described below.
1184.RE
1185.IP
1186The optional flags are:
1187.RS
1188.IP \fBrandom\fR
1189The selection of the port from the given range should be done using a
1190fresh random number. This flag is mutually exclusive with \fBhash\fR.
1191.RE
1192.
1193.RS
1194.IP \fBhash\fR
1195The selection of the port from the given range should be done using a
1196datapath specific hash of the packet's IP addresses and the other,
1197non-mapped port number. This flag is mutually exclusive with
1198\fBrandom\fR.
1199.RE
1200.
1201.RS
1202.IP \fBpersistent\fR
1203The selection of the IP address from the given range should be done so
1204that the same mapping can be provided after the system restarts.
1205.RE
1206.IP
1207If an \fBalg\fR is specified for the committing \fBct\fR action that
1208also includes \fBnat\fR with a \fBsrc\fR or \fBdst\fR attribute,
1209then the datapath tries to set up the helper to be NAT aware. This
1210functionality is datapath specific and may not be supported by all
1211datapaths.
1212.IP
1213\fBnat\fR was introduced in Open vSwitch 2.6. The first datapath that
1214implements \fBct nat\fR support is the one that ships with Linux 4.6.
07659514
JS
1215.RE
1216.IP
1217The \fBct\fR action may be used as a primitive to construct stateful firewalls
1218by selectively committing some traffic, then matching the \fBct_state\fR to
1219allow established connections while denying new connections. The following
1220flows provide an example of how to implement a simple firewall that allows new
1221connections from port 1 to port 2, and only allows established connections to
1222send traffic from port 2 to port 1:
1223 \fBtable=0,priority=1,action=drop
1224 table=0,priority=10,arp,action=normal
1225 table=0,priority=100,ip,ct_state=-trk,action=ct(table=1)
1226 table=1,in_port=1,ip,ct_state=+trk+new,action=ct(commit),2
1227 table=1,in_port=1,ip,ct_state=+trk+est,action=2
1228 table=1,in_port=2,ip,ct_state=+trk+new,action=drop
1229 table=1,in_port=2,ip,ct_state=+trk+est,action=1\fR
1230.IP
1231If \fBct\fR is executed on IP (or IPv6) fragments, then the message is
1232implicitly reassembled before sending to the connection tracker and
1233refragmented upon \fBoutput\fR, to the original maximum received fragment size.
54da48f4
JS
1234Reassembly occurs within the context of the \fBzone\fR, meaning that IP
1235fragments in different zones are not assembled together. Pipeline processing
1236for the initial fragments is halted; When the final fragment is received, the
1237message is assembled and pipeline processing will continue for that flow.
07659514
JS
1238Because packet ordering is not guaranteed by IP protocols, it is not possible
1239to determine which IP fragment will cause message reassembly (and therefore
1240continue pipeline processing). As such, it is strongly recommended that
1241multiple flows should not execute \fBct\fR to reassemble fragments from the
1242same IP message.
1243.IP
1244Currently, connection tracking is only available on Linux kernels with the
54da48f4
JS
1245nf_conntrack module loaded. The \fBct\fR action was introduced in Open vSwitch
12462.5.
07659514 1247.
72fe7578
BP
1248.IP \fBct_clear\fR
1249Clears connection tracking state from the flow, zeroing
1250\fBct_state\fR, \fBct_zone\fR, \fBct_mark\fR, and \fBct_label\fR.
1251.IP
1252This action was introduced in Open vSwitch 2.6.90.
1253.
f0fd1a17 1254.IP \fBdec_ttl\fR
ef6d1b11 1255.IQ \fBdec_ttl(\fIid1\fR[\fB,\fIid2\fR]...\fB)\fR
f0fd1a17 1256Decrement TTL of IPv4 packet or hop limit of IPv6 packet. If the
972b5f38
JR
1257TTL or hop limit is initially zero or decrementing would make it so, no
1258decrement occurs, as packets reaching TTL zero must be rejected. Instead,
f0fd1a17
PS
1259a ``packet-in'' message with reason code \fBOFPR_INVALID_TTL\fR is
1260sent to each connected controller that has enabled receiving them,
c2d967a5
MM
1261if any. Processing the current set of actions then stops. However,
1262if the current set of actions was reached through ``resubmit'' then
ef6d1b11
JP
1263remaining actions in outer levels resume processing.
1264.IP
1265This action also optionally supports the ability to specify a list of
1266valid controller ids. Each of the controllers in the list will receive
1267the ``packet_in'' message only if they have registered to receive the
c2d967a5
MM
1268invalid ttl packets. If controller ids are not specified, the
1269``packet_in'' message will be sent only to the controllers having
1270controller id zero which have registered for the invalid ttl packets.
f0fd1a17 1271.
afd5ac06
SH
1272.IP \fBset_mpls_label\fR:\fIlabel\fR
1273Set the label of the outer MPLS label stack entry of a packet.
1274\fIlabel\fR should be a 20-bit value that is decimal by default;
1275use a \fB0x\fR prefix to specify them in hexadecimal.
1276.
1277.IP \fBset_mpls_tc\fR:\fItc\fR
1278Set the traffic-class of the outer MPLS label stack entry of a packet.
1279\fItc\fR should be a in the range 0 to 7 inclusive.
1280.
0f3f3c3d
SH
1281.IP \fBset_mpls_ttl\fR:\fIttl\fR
1282Set the TTL of the outer MPLS label stack entry of a packet.
1283\fIttl\fR should be in the range 0 to 255 inclusive.
1284.
b676167a
SH
1285.IP \fBdec_mpls_ttl\fR
1286Decrement TTL of the outer MPLS label stack entry of a packet. If the TTL
972b5f38
JR
1287is initially zero or decrementing would make it so, no decrement occurs.
1288Instead, a ``packet-in'' message with reason code \fBOFPR_INVALID_TTL\fR
1289is sent to the main controller (id zero), if it has enabled receiving them.
b676167a
SH
1290Processing the current set of actions then stops. However, if the current
1291set of actions was reached through ``resubmit'' then remaining actions in
1292outer levels resume processing.
1293.
491e05c2
YY
1294.IP \fBdec_nsh_ttl\fR
1295Decrement TTL of the outer NSH header of a packet. If the TTL
1296is initially zero or decrementing would make it so, no decrement occurs.
1297Instead, a ``packet-in'' message with reason code \fBOFPR_INVALID_TTL\fR
1298is sent to the main controller (id zero), if it has enabled receiving them.
1299Processing the current set of actions then stops. However, if the current
1300set of actions was reached through ``resubmit'' then remaining actions in
1301outer levels resume processing.
1302.
96fc46e8
BP
1303.IP \fBnote:\fR[\fIhh\fR]...
1304Does nothing at all. Any number of bytes represented as hex digits
1305\fIhh\fR may be included. Pairs of hex digits may be separated by
1306periods for readability.
e0631927
BP
1307The \fBnote\fR action's format doesn't include an exact length for its
1308payload, so the provided bytes will be padded on the right by enough
1309bytes with value 0 to make the total number 6 more than a multiple of
13108.
f393f81e 1311.
5a6861aa 1312.IP "\fBmove:\fIsrc\fB[\fIstart\fB..\fIend\fB]\->\fIdst\fB[\fIstart\fB..\fIend\fB]\fR"
f393f81e 1313Copies the named bits from field \fIsrc\fR to field \fIdst\fR.
21b2fa61
JR
1314\fIsrc\fR and \fIdst\fR may be NXM field names as defined in
1315\fBnicira\-ext.h\fR, e.g. \fBNXM_OF_UDP_SRC\fR or \fBNXM_NX_REG0\fR,
1316or a match field name, e.g. \fBreg0\fR. Each
1317\fIstart\fR and \fIend\fR pair, which are inclusive, must specify the
1318same number of bits and must fit within its respective field.
f393f81e
BP
1319Shorthands for \fB[\fIstart\fB..\fIend\fB]\fR exist: use
1320\fB[\fIbit\fB]\fR to specify a single bit or \fB[]\fR to specify an
21b2fa61 1321entire field (in the latter case the brackets can also be left off).
f393f81e
BP
1322.IP
1323Examples: \fBmove:NXM_NX_REG0[0..5]\->NXM_NX_REG1[26..31]\fR copies the
1324six bits numbered 0 through 5, inclusive, in register 0 into bits 26
1325through 31, inclusive;
21b2fa61 1326\fBmove:reg0[0..15]\->vlan_tci\fR copies the least
f393f81e 1327significant 16 bits of register 0 into the VLAN TCI field.
1a12c419 1328.IP
914624f8
BP
1329In OpenFlow 1.0 through 1.4, \fBmove\fR ordinarily uses an Open
1330vSwitch extension to OpenFlow. In OpenFlow 1.5, \fBmove\fR uses the
d3cb080e 1331OpenFlow 1.5 standard \fBcopy_field\fR action. The ONF has
914624f8
BP
1332also made \fBcopy_field\fR available as an extension to OpenFlow 1.3.
1333Open vSwitch 2.4 and later understands this extension and uses it if a
1334controller uses it, but for backward compatibility with older versions
1335of Open vSwitch, \fBovs\-ofctl\fR does not use it.
f393f81e 1336.
7eb4b1f1
BP
1337.IP "\fBset_field:\fIvalue\fR[/\fImask\fR]\fB\->\fIdst"
1338.IQ "\fBload:\fIvalue\fB\->\fIdst\fB[\fIstart\fB..\fIend\fB]"
1339Loads a literal value into a field or part of a field. With
1340\fBset_field\fR, \fBvalue\fR and the optional \fBmask\fR are given in
1341the customary syntax for field \fIdst\fR, which is expressed as a
1342field name. For example, \fBset_field:00:11:22:33:44:55->eth_src\fR
1343sets the Ethernet source address to 00:11:22:33:44:55. With
1344\fBload\fR, \fIvalue\fR must be an integer value (in decimal or
21b2fa61
JR
1345prefixed by \fB0x\fR for hexadecimal) and \fIdst\fR can also be the
1346NXM or OXM name for the field. For example,
1347\fBload:0x001122334455->OXM_OF_ETH_SRC[]\fR has the same effect as the
7eb4b1f1
BP
1348prior \fBset_field\fR example.
1349.IP
1350The two forms exist for historical reasons. Open vSwitch 1.1
1351introduced \fBNXAST_REG_LOAD\fR as a Nicira extension to OpenFlow 1.0
1352and used \fBload\fR to express it. Later, OpenFlow 1.2 introduced a
1353standard \fBOFPAT_SET_FIELD\fR action that was restricted to loading
1354entire fields, so Open vSwitch added the form \fBset_field\fR with
1355this restriction. OpenFlow 1.5 extended \fBOFPAT_SET_FIELD\fR to the
1356point that it became a superset of \fBNXAST_REG_LOAD\fR. Open vSwitch
1357translates either syntax as necessary for the OpenFlow version in use:
1358in OpenFlow 1.0 and 1.1, \fBNXAST_REG_LOAD\fR; in OpenFlow 1.2, 1.3,
1359and 1.4, \fBNXAST_REG_LOAD\fR for \fBload\fR or for loading a
1360subfield, \fBOFPAT_SET_FIELD\fR otherwise; and OpenFlow 1.5 and later,
1361\fBOFPAT_SET_FIELD\fR.
53ddd40a 1362.
bd85dac1 1363.IP "\fBpush:\fIsrc\fB[\fIstart\fB..\fIend\fB]"
81ce8036
BP
1364.IQ "\fBpop:\fIdst\fB[\fIstart\fB..\fIend\fB]"
1365These Open vSwitch extension actions act on bits \fIstart\fR to
1366\fIend\fR, inclusive, in the named field, pushing or popping the bits
1367on a general-purpose stack of fields or subfields. Controllers can
1368use this stack for saving and restoring data or metadata around
1369\fBresubmit\fR actions, for swapping or rearranging data and metadata,
1370or for other purposes. Any data or metadata field, or part of one,
1371may be pushed, and any modifiable field or subfield may be popped.
bd85dac1 1372.IP
81ce8036
BP
1373The number of bits pushed in a stack entry do not have to match the
1374number of bits later popped from that entry. If more bits are popped
1375from an entry than were pushed, then the entry is conceptually
1376left-padded with 0-bits as needed. If fewer bits are popped than
1377pushed, then bits are conceptually trimmed from the left side of the
1378entry.
bd85dac1 1379.IP
81ce8036
BP
1380The stack's size is intended to have a large enough limit that
1381``normal'' use will not pose problems. Stack overflow or underflow is
1382an error that causes action execution to stop.
1383.IP
1384Example: \fBpush:NXM_NX_REG2[0..5]\fR or \fBpush:reg2[0..5]\fR push
1385the value stored in register 2 bits 0 through 5, inclusive, on the
1386internal stack, and \fBpop:NXM_NX_REG2[0..5]\fR or
1387\fBpop:reg2[0..5]\fR pops the value from top of the stack and sets
1388register 2 bits 0 through 5, inclusive, based on bits 0 through 5 from
1389the value just popped.
f5c45121 1390.
53ddd40a
BP
1391.IP "\fBmultipath(\fIfields\fB, \fIbasis\fB, \fIalgorithm\fB, \fIn_links\fB, \fIarg\fB, \fIdst\fB[\fIstart\fB..\fIend\fB])\fR"
1392Hashes \fIfields\fR using \fIbasis\fR as a universal hash parameter,
1393then the applies multipath link selection \fIalgorithm\fR (with
1394parameter \fIarg\fR) to choose one of \fIn_links\fR output links
1395numbered 0 through \fIn_links\fR minus 1, and stores the link into
43edca57 1396\fIdst\fB[\fIstart\fB..\fIend\fB]\fR, which must be an NXM field as
53ddd40a
BP
1397described above.
1398.IP
4249b547
JB
1399\fIfields\fR must be one of the following:
1400.RS
1401.IP \fBeth_src\fR
1402Hashes Ethernet source address only.
1403.IP \fBsymmetric_l4\fR
1404Hashes Ethernet source, destination, and type, VLAN ID, IPv4/IPv6
1405source, destination, and protocol, and TCP or SCTP (but not UDP)
1406ports. The hash is computed so that pairs of corresponding flows in
1407each direction hash to the same value, in environments where L2 paths
1408are the same in each direction. UDP ports are not included in the
1409hash to support protocols such as VXLAN that use asymmetric ports in
1410each direction.
1411.IP \fBsymmetric_l3l4\fR
1412Hashes IPv4/IPv6 source, destination, and protocol, and TCP or SCTP
1413(but not UDP) ports. Like \fBsymmetric_l4\fR, this is a symmetric
1414hash, but by excluding L2 headers it is more effective in environments
1415with asymmetric L2 paths (e.g. paths involving VRRP IP addresses on a
1416router). Not an effective hash function for protocols other than IPv4
1417and IPv6, which hash to a constant zero.
1418.IP \fBsymmetric_l3l4+udp\fR
1419Like \fBsymmetric_l3l4+udp\fR, but UDP ports are included in the hash.
1420This is a more effective hash when asymmetric UDP protocols such as
1421VXLAN are not a consideration.
417cfdb6 1422.IP \fBnw_src\fR
1423Hashes Network source address only.
1424.IP \fBnw_dst\fR
1425Hashes Network destination address only.
4249b547
JB
1426.RE
1427.IP
1428\fIalgorithm\fR must be one of \fBmodulo_n\fR,
53ddd40a
BP
1429\fBhash_threshold\fR, \fBhrw\fR, and \fBiter_hash\fR. Only
1430the \fBiter_hash\fR algorithm uses \fIarg\fR.
1431.IP
1432Refer to \fBnicira\-ext.h\fR for more details.
3b6a2571 1433.
daff3353
EJ
1434.IP "\fBbundle(\fIfields\fB, \fIbasis\fB, \fIalgorithm\fB, \fIslave_type\fB, slaves:[\fIs1\fB, \fIs2\fB, ...])\fR"
1435Hashes \fIfields\fR using \fIbasis\fR as a universal hash parameter, then
1436applies the bundle link selection \fIalgorithm\fR to choose one of the listed
1437slaves represented as \fIslave_type\fR. Currently the only supported
1438\fIslave_type\fR is \fBofport\fR. Thus, each \fIs1\fR through \fIsN\fR should
1439be an OpenFlow port number. Outputs to the selected slave.
1440.IP
417cfdb6 1441Currently, \fIfields\fR must be either \fBeth_src\fR, \fBsymmetric_l4\fR, \fBsymmetric_l3l4\fR, \fBsymmetric_l3l4+udp\fR,
1442\fBnw_src\fR, or \fBnw_dst\fR, and \fIalgorithm\fR must be one of \fBhrw\fR and \fBactive_backup\fR.
daff3353
EJ
1443.IP
1444Example: \fBbundle(eth_src,0,hrw,ofport,slaves:4,8)\fR uses an Ethernet source
1445hash with basis 0, to select between OpenFlow ports 4 and 8 using the Highest
1446Random Weight algorithm.
1447.IP
1448Refer to \fBnicira\-ext.h\fR for more details.
a368bb53
EJ
1449.
1450.IP "\fBbundle_load(\fIfields\fB, \fIbasis\fB, \fIalgorithm\fB, \fIslave_type\fB, \fIdst\fB[\fIstart\fB..\fIend\fB], slaves:[\fIs1\fB, \fIs2\fB, ...])\fR"
1451Has the same behavior as the \fBbundle\fR action, with one exception. Instead
1452of outputting to the selected slave, it writes its selection to
1453\fIdst\fB[\fIstart\fB..\fIend\fB]\fR, which must be an NXM field as described
1454above.
1455.IP
2638c6dc
BP
1456Example: \fBbundle_load(eth_src, 0, hrw, ofport, NXM_NX_REG0[],
1457slaves:4, 8)\fR uses an Ethernet source hash with basis 0, to select
1458between OpenFlow ports 4 and 8 using the Highest Random Weight
21b2fa61
JR
1459algorithm, and writes the selection to \fBNXM_NX_REG0[]\fR. Also the
1460match field name can be used, for example, instead of 'NXM_NX_REG0'
1461the name 'reg0' can be used. When the while field is indicated the
1462empty brackets can also be left off.
a368bb53
EJ
1463.IP
1464Refer to \fBnicira\-ext.h\fR for more details.
75a75043
BP
1465.
1466.IP "\fBlearn(\fIargument\fR[\fB,\fIargument\fR]...\fB)\fR"
1467This action adds or modifies a flow in an OpenFlow table, similar to
1468\fBovs\-ofctl \-\-strict mod\-flows\fR. The arguments specify the
1469flow's match fields, actions, and other properties, as follows. At
1470least one match criterion and one action argument should ordinarily be
1471specified.
1472.RS
1473.IP \fBidle_timeout=\fIseconds\fR
1474.IQ \fBhard_timeout=\fIseconds\fR
1475.IQ \fBpriority=\fIvalue\fR
45d77538 1476.IQ \fBcookie=\fIvalue\fR
3d6832c2
BP
1477.IQ \fBsend_flow_rem\fR
1478These arguments have the same meaning as in the usual \fBovs\-ofctl\fR
1479flow syntax.
75a75043 1480.
0e553d9c
BP
1481.IP \fBfin_idle_timeout=\fIseconds\fR
1482.IQ \fBfin_hard_timeout=\fIseconds\fR
1483Adds a \fBfin_timeout\fR action with the specified arguments to the
1484new flow. This feature was added in Open vSwitch 1.5.90.
1485.
4bc938cc 1486.IP \fBtable=\fItable\fR
75a75043 1487The table in which the new flow should be inserted. Specify a decimal
4bc938cc
BP
1488number between 0 and 254 or (unless \fB\-\-no\-names\fR is specified)
1489a name. The default, if \fBtable\fR is unspecified, is table 1.
75a75043 1490.
35f48b8b
BP
1491.IP \fBdelete_learned\fR
1492This flag enables deletion of the learned flows when the flow with the
1493\fBlearn\fR action is removed. Specifically, when the last
1494\fBlearn\fR action with this flag and particular \fBtable\fR and
1495\fBcookie\fR values is removed, the switch deletes all of the flows in
1496the specified table with the specified cookie.
1497.
1498.IP
1499This flag was added in Open vSwitch 2.4.
1500.
4c71600d
DDP
1501.IP \fBlimit=\fInumber\fR
1502If the number of flows in table \fBtable\fR with cookie id \fBcookie\fR exceeds
1503\fInumber\fR, a new flow will not be learned by this action. By default
1746822c 1504there's no limit. limit=0 is a long-hand for no limit.
4c71600d
DDP
1505.
1506.IP
1507This flag was added in Open vSwitch 2.8.
1508.
1509.IP \fBresult_dst=\fIfield\fB[\fIbit\fB]\fR
1510If learning failed (because the number of flows exceeds \fBlimit\fR),
1511the action sets \fIfield\fB[\fIbit\fB]\fR to 0, otherwise it will be set to 1.
1512\fIfield\fB[\fIbit\fB]\fR must be a single bit.
1513.
1514.IP
1515This flag was added in Open vSwitch 2.8.
1516.
75a75043
BP
1517.IP \fIfield\fB=\fIvalue\fR
1518.IQ \fIfield\fB[\fIstart\fB..\fIend\fB]=\fIsrc\fB[\fIstart\fB..\fIend\fB]\fR
1519.IQ \fIfield\fB[\fIstart\fB..\fIend\fB]\fR
1520Adds a match criterion to the new flow.
1521.IP
1522The first form specifies that \fIfield\fR must match the literal
1523\fIvalue\fR, e.g. \fBdl_type=0x0800\fR. All of the fields and values
1524for \fBovs\-ofctl\fR flow syntax are available with their usual
5b10f305
OS
1525meanings. Shorthand notation matchers (e.g. \fBip\fR in place of
1526\fBdl_type=0x0800\fR) are not currently implemented.
75a75043
BP
1527.IP
1528The second form specifies that \fIfield\fB[\fIstart\fB..\fIend\fB]\fR
1529in the new flow must match \fIsrc\fB[\fIstart\fB..\fIend\fB]\fR taken
1530from the flow currently being processed.
5b10f305
OS
1531For example, \fINXM_OF_UDP_DST\fB[]\fR=\fINXM_OF_UDP_SRC\fB[]\fR on a
1532TCP packet for which the UDP src port is \fB53\fR, creates a flow which
1533matches \fINXM_OF_UDP_DST\fB[]\fR=\fB53\fR.
75a75043
BP
1534.IP
1535The third form is a shorthand for the second form. It specifies that
5b10f305 1536\fIfield\fB[\fIstart\fB..\fIend\fB]\fR in the new flow must match the same
75a75043
BP
1537\fIfield\fB[\fIstart\fB..\fIend\fB]\fR taken from the flow currently
1538being processed.
5b10f305
OS
1539For example, \fINXM_OF_TCP_DST\fB[]\fR on a TCP packet
1540for which the TCP dst port is \fB80\fR, creates a flow which
1541matches \fINXM_OF_TCP_DST\fB[]\fR=\fB80\fR.
75a75043
BP
1542.
1543.IP \fBload:\fIvalue\fB\->\fIdst\fB[\fIstart\fB..\fIend\fB]
1544.IQ \fBload:\fIsrc\fB[\fIstart\fB..\fIend\fB]\->\fIdst\fB[\fIstart\fB..\fIend\fB]
1545.
1546Adds a \fBload\fR action to the new flow.
1547.IP
1548The first form loads the literal \fIvalue\fR into bits \fIstart\fR
1549through \fIend\fR, inclusive, in field \fIdst\fR. Its syntax is the
1550same as the \fBload\fR action described earlier in this section.
1551.IP
1552The second form loads \fIsrc\fB[\fIstart\fB..\fIend\fB]\fR, a value
1553from the flow currently being processed, into bits \fIstart\fR
1554through \fIend\fR, inclusive, in field \fIdst\fR.
1555.
1556.IP \fBoutput:\fIfield\fB[\fIstart\fB..\fIend\fB]\fR
1557Add an \fBoutput\fR action to the new flow's actions, that outputs to
1558the OpenFlow port taken from \fIfield\fB[\fIstart\fB..\fIend\fB]\fR,
1559which must be an NXM field as described above.
1560.RE
c4f5d00b 1561.RE
a9b4a41a 1562.
8dd54666 1563.RS
8dd54666 1564.
b19e8793
IY
1565.IP \fBclear_actions\fR
1566Clears all the actions in the action set immediately.
1567.
7fdb60a7
SH
1568.IP \fBwrite_actions(\fR[\fIaction\fR][\fB,\fIaction\fR...]\fB)
1569Add the specific actions to the action set. The syntax of
1570\fIactions\fR is the same as in the \fBactions=\fR field. The action
1571set is carried between flow tables and then executed at the end of the
1572pipeline.
1573.
1574.IP
1575The actions in the action set are applied in the following order, as
1576required by the OpenFlow specification, regardless of the order in
1577which they were added to the action set. Except as specified
1578otherwise below, the action set only holds at most a single action of
1579each type. When more than one action of a single type is written to
1580the action set, the one written later replaces the earlier action:
1581.
1582.RS
1583.IP 1.
1584\fBstrip_vlan\fR
1585.IQ
1586\fBpop_mpls\fR
1587.
1588.IP 2.
f839892a 1589\fBdecap\fR
7fdb60a7
SH
1590.
1591.IP 3.
f839892a 1592\fBencap\fR
7fdb60a7
SH
1593.
1594.IP 4.
f839892a
JS
1595\fBpush_mpls\fR
1596.
1597.IP 5.
1598\fBpush_vlan\fR
1599.
1600.IP 6.
7fdb60a7
SH
1601\fBdec_ttl\fR
1602.IQ
1603\fBdec_mpls_ttl\fR
491e05c2
YY
1604.IQ
1605\fBdec_nsh_ttl\fR
7fdb60a7 1606.
f839892a 1607.IP 7.
7fdb60a7
SH
1608\fBload\fR
1609.IQ
1b0ee636
TG
1610\fBmove\fR
1611.IQ
7fdb60a7
SH
1612\fBmod_dl_dst\fR
1613.IQ
1614\fBmod_dl_src\fR
1615.IQ
1616\fBmod_nw_dst\fR
1617.IQ
1618\fBmod_nw_src\fR
1619.IQ
1620\fBmod_nw_tos\fR
1621.IQ
ff14eb7a
JR
1622\fBmod_nw_ecn\fR
1623.IQ
0c20dbe4
JR
1624\fBmod_nw_ttl\fR
1625.IQ
7fdb60a7
SH
1626\fBmod_tp_dst\fR
1627.IQ
1628\fBmod_tp_src\fR
1629.IQ
1630\fBmod_vlan_pcp\fR
1631.IQ
1632\fBmod_vlan_vid\fR
1633.IQ
1634\fBset_field\fR
1635.IQ
1636\fBset_tunnel\fR
1637.IQ
1638\fBset_tunnel64\fR
1639.IQ
1640The action set can contain any number of these actions, with
1b0ee636
TG
1641cumulative effect. They will be applied in the order as added.
1642That is, when multiple actions modify the same part of a field,
1643the later modification takes effect, and when they modify
1644different parts of a field (or different fields), then both
7fdb60a7
SH
1645modifications are applied.
1646.
f839892a 1647.IP 8.
7fdb60a7
SH
1648\fBset_queue\fR
1649.
f839892a 1650.IP 9.
7fdb60a7
SH
1651\fBgroup\fR
1652.IQ
1653\fBoutput\fR
1654.IQ
2e34a6a3
SS
1655\fBresubmit\fR
1656.IQ
1657If more than one of these actions is present, then the one listed
1658earliest above is executed and the others are ignored, regardless of
1659the order in which they were added to the action set. (If none of these
1660actions is present, the action set has no real effect, because the
1661modified packet is not sent anywhere and thus the modifications are
1662not visible.)
7fdb60a7
SH
1663.RE
1664.IP
1665Only the actions listed above may be written to the action set.
491e05c2 1666\fBencap\fR, \fBdecap\fR and \fBdec_nsh_ttl\fR actions are nonstandard.
7fdb60a7 1667.
4cceacb9
JS
1668.IP \fBwrite_metadata\fB:\fIvalue\fR[/\fImask\fR]
1669Updates the metadata field for the flow. If \fImask\fR is omitted, the
1670metadata field is set exactly to \fIvalue\fR; if \fImask\fR is specified, then
1671a 1-bit in \fImask\fR indicates that the corresponding bit in the metadata
1672field will be replaced with the corresponding bit from \fIvalue\fR. Both
1673\fIvalue\fR and \fImask\fR are 64-bit values that are decimal by default; use
1674a \fB0x\fR prefix to specify them in hexadecimal.
1675.
3200ed58
JR
1676.IP \fBmeter\fR:\fImeter_id\fR
1677Apply the \fImeter_id\fR before any other actions. If a meter band rate is
1678exceeded, the packet may be dropped, or modified, depending on the meter
1679band type. See the description of the \fBMeter Table Commands\fR, above,
1680for more details.
1681.
8dd54666 1682.IP \fBgoto_table\fR:\fItable\fR
4bc938cc
BP
1683Jumps to \fItable\Fr as the next table in the process pipeline. The
1684\fItable\fR may be a number between 0 and 254 or (unless
1685\fB\-\-no\-names\fR is specified) a name.
8dd54666 1686.
0e553d9c
BP
1687.IP "\fBfin_timeout(\fIargument\fR[\fB,\fIargument\fR]\fB)"
1688This action changes the idle timeout or hard timeout, or both, of this
1689OpenFlow rule when the rule matches a TCP packet with the FIN or RST
1690flag. When such a packet is observed, the action reduces the rule's
1691timeouts to those specified on the action. If the rule's existing
1692timeout is already shorter than the one that the action specifies,
1693then that timeout is unaffected.
1694.IP
1695\fIargument\fR takes the following forms:
1696.RS
1697.IP "\fBidle_timeout=\fIseconds\fR"
1698Causes the flow to expire after the given number of seconds of
1699inactivity.
1700.
1701.IP "\fBhard_timeout=\fIseconds\fR"
1702Causes the flow to expire after the given number of seconds,
1703regardless of activity. (\fIseconds\fR specifies time since the
1704flow's creation, not since the receipt of the FIN or RST.)
1705.RE
1706.IP
1707This action was added in Open vSwitch 1.5.90.
29089a54
RL
1708.
1709.IP "\fBsample(\fIargument\fR[\fB,\fIargument\fR]...\fB)\fR"
1710Samples packets and sends one sample for every sampled packet.
1711.IP
1712\fIargument\fR takes the following forms:
1713.RS
1714.IP "\fBprobability=\fIpackets\fR"
1715The number of sampled packets out of 65535. Must be greater or equal to 1.
1716.IP "\fBcollector_set_id=\fIid\fR"
1717The unsigned 32-bit integer identifier of the set of sample collectors
1718to send sampled packets to. Defaults to 0.
1719.IP "\fBobs_domain_id=\fIid\fR"
1720When sending samples to IPFIX collectors, the unsigned 32-bit integer
1721Observation Domain ID sent in every IPFIX flow record. Defaults to 0.
1722.IP "\fBobs_point_id=\fIid\fR"
1723When sending samples to IPFIX collectors, the unsigned 32-bit integer
1724Observation Point ID sent in every IPFIX flow record. Defaults to 0.
f69f713b 1725.IP "\fBsampling_port=\fIport\fR"
4930ea56
BP
1726Sample packets on \fIport\fR, which should be the ingress or egress
1727port. This option, which was added in Open vSwitch 2.5.90, allows the
1728IPFIX implementation to export egress tunnel information.
1729.IP "\fBingress\fR"
1730.IQ "\fBegress\fR"
1731Specifies explicitly that the packet is being sampled on ingress to or
1732egress from the switch. IPFIX reports sent by Open vSwitch before
1733version 2.5.90 did not include a direction. From 2.5.90 until 2.6.90,
1734IPFIX reports inferred a direction from \fBsampling_port\fR: if it was
1735the packet's output port, then the direction was reported as egress,
1736otherwise as ingress. Open vSwitch 2.6.90 introduced these options,
1737which allow the inferred direction to be overridden. This is
1738particularly useful when the ingress (or egress) port is not a tunnel.
29089a54
RL
1739.RE
1740.IP
fb8f22c1 1741Refer to \fBovs\-vswitchd.conf.db\fR(5) for more details on
29089a54
RL
1742configuring sample collector sets.
1743.IP
1744This action was added in Open vSwitch 1.10.90.
1745.
848e8809 1746.IP "\fBexit\fR"
7fdb60a7
SH
1747This action causes Open vSwitch to immediately halt execution of
1748further actions. Those actions which have already been executed are
1749unaffected. Any further actions, including those which may be in
1750other tables, or different levels of the \fBresubmit\fR call stack,
1751are ignored. Actions in the action set is still executed (specify
1752\fBclear_actions\fR before \fBexit\fR to discard them).
18080541
BP
1753.
1754.IP "\fBconjunction(\fIid\fB, \fIk\fB/\fIn\fR\fB)\fR"
96fee5e0
BP
1755This action allows for sophisticated ``conjunctive match'' flows.
1756Refer to \fBCONJUNCTIVE MATCH FIELDS\fR in \fBovs\-fields\fR(7) for details.
18080541
BP
1757.IP
1758The \fBconjunction\fR action and \fBconj_id\fR field were introduced
1759in Open vSwitch 2.4.
e8035fc0
BP
1760.
1761.IP "\fBclone(\fR[\fIaction\fR][\fB,\fIaction\fR...]\fB)\fR"
1762Executes each nested \fIaction\fR, saving much of the packet and
1763pipeline state beforehand and then restoring it afterward. The state
1764that is saved and restored includes all flow data and metadata
b827b231
BP
1765(including, for example, \fBct_state\fR), the stack accessed by
1766\fBpush\fR and \fBpop\fR actions, and the OpenFlow action set.
e8035fc0
BP
1767.IP
1768This action was added in Open vSwitch 2.6.90.
f839892a
JS
1769.
1770.IP "\fBencap(\fR\fIheader\fR[\fB(\fR\fIprop\fR\fB=\fR\fIvalue\fR,\fItlv\fR\fB(\fR\fIclass\fR,\fItype\fR,\fIvalue\fB)\fR,...\fB)\fR]\fB)\fR"
1771Encapsulates the packet with a new packet header, e.g., ethernet
1772or nsh.
1773.
1774.RS
1775.IP "\fIheader\fR"
1776Used to specify encapsulation header type.
1777.
1778.IP "\fIprop\fR\fB=\fR\fIvalue\fR"
1779Used to specify the initial value for the property in the encapsulation header.
1780.
1781.IP "\fItlv\fR\fB(\fR\fIclass\fR,\fItype\fR,\fIvalue\fB)\fR"
1782Used to specify the initial value for the TLV (Type Length Value)
1783in the encapsulation header.
1784.RE
1785.IP
1786For example, \fBencap(ethernet)\fR will encapsulate the L3 packet with
1787Ethernet header.
1788.IP
1789\fBencap(nsh(md_type=1))\fR will encapsulate the packet with nsh header
1790and nsh metadata type 1.
1791.IP
1792\fBencap(nsh(md_type=2,tlv(0x1000,10,0x12345678)))\fR will encapsulate
1793the packet with nsh header and nsh metadata type 2, and the nsh TLV with
1794class 0x1000 and type 10 is set to 0x12345678.
1795.IP
1796\fIprop\fR\fB=\fR\fIvalue\fR is just used to set some
1797necessary fields for encapsulation header initialization. Other fields
1798in the encapsulation header must be set by \fBset_field\fR action. New
1799encapsulation header implementation must add new match fields and
1800corresponding \fBset\fR action in order that \fBset_field\fR action can
1801change the fields in the encapsulation header on demand.
1802.IP
1803\fBencap(nsh(md_type=1)),\fR
1804\fBset_field:0x1234->nsh_spi,set_field:0x11223344->nsh_c1\fR
1805is an example to encapsulate nsh header and set nsh spi and c1.
1806.IP
1807This action was added in Open vSwitch 2.8.
1808.
1809.IP "\fBdecap(\fR[\fBpacket_type(ns=\fR\fInamespace\fR\fB,type=\fR\fItype\fR\fB)\fR]\fB)\fR"
1810Decapsulates the outer packet header.
1811.
1812.RS
1813.IP "\fBpacket_type(ns=\fR\fInamespace\fR\fB,type=\fR\fItype\fR\fB)\fR"
1814It is optional and used to specify the outer header type of the
1815decapsulated packet. \fInamespace\fR is 0 for Ethernet packet,
18161 for L3 packet, \fItype\fR\ is L3 protocol type, e.g.,
18170x894f for nsh, 0x0 for Ethernet.
1818.RE
1819.IP
1820By default, \fBdecap()\fR will decapsulate the outer packet header
1821according to the packet header type, if
1822\fBpacket_type(ns=\fR\fInamespace\fR\fB,type=\fR\fItype\fR\fB)\fR
1823is given, it will decapsulate the given packet header, it will fail
1824if the actual outer packet header type is not of
1825\fBpacket_type(ns=\fR\fInamespace\fR\fB,type=\fR\fItype\fR\fB)\fR.
1826.IP
1827This action was added in Open vSwitch 2.8.
24362cd6 1828.RE
848e8809 1829.
064af421 1830.PP
e729e793
JP
1831An opaque identifier called a cookie can be used as a handle to identify
1832a set of flows:
1833.
623e1caf
JP
1834.IP \fBcookie=\fIvalue\fR
1835.
1836A cookie can be associated with a flow using the \fBadd\-flow\fR,
1837\fBadd\-flows\fR, and \fBmod\-flows\fR commands. \fIvalue\fR can be any
183864-bit number and need not be unique among flows. If this field is
1839omitted, a default cookie value of 0 is used.
1840.
1841.IP \fBcookie=\fIvalue\fR\fB/\fImask\fR
e729e793 1842.
e729e793 1843When using NXM, the cookie can be used as a handle for querying,
623e1caf
JP
1844modifying, and deleting flows. \fIvalue\fR and \fImask\fR may be
1845supplied for the \fBdel\-flows\fR, \fBmod\-flows\fR, \fBdump\-flows\fR, and
1846\fBdump\-aggregate\fR commands to limit matching cookies. A 1-bit in
1847\fImask\fR indicates that the corresponding bit in \fIcookie\fR must
1848match exactly, and a 0-bit wildcards that bit. A mask of \-1 may be used
1849to exactly match a cookie.
1850.IP
1851The \fBmod\-flows\fR command can update the cookies of flows that
1852match a cookie by specifying the \fIcookie\fR field twice (once with a
1853mask for matching and once without to indicate the new value):
1854.RS
1855.IP "\fBovs\-ofctl mod\-flows br0 cookie=1,actions=normal\fR"
1856Change all flows' cookies to 1 and change their actions to \fBnormal\fR.
1857.IP "\fBovs\-ofctl mod\-flows br0 cookie=1/\-1,cookie=2,actions=normal\fR"
1858Update cookies with a value of 1 to 2 and change their actions to
1859\fBnormal\fR.
1860.RE
1861.IP
1862The ability to match on cookies was added in Open vSwitch 1.5.0.
8cce2125
JP
1863.
1864.PP
4b6b46ce
BP
1865The following additional field sets the priority for flows added by
1866the \fBadd\-flow\fR and \fBadd\-flows\fR commands. For
1867\fBmod\-flows\fR and \fBdel\-flows\fR when \fB\-\-strict\fR is
1868specified, priority must match along with the rest of the flow
623e1caf 1869specification. For \fBmod-flows\fR without \fB\-\-strict\fR,
fdb3539e
BP
1870priority is only significant if the command creates a new flow, that
1871is, non-strict \fBmod\-flows\fR does not match on priority and will
1872not change the priority of existing flows. Other commands do not
1873allow priority to be specified.
a9b4a41a 1874.
064af421
BP
1875.IP \fBpriority=\fIvalue\fR
1876The priority at which a wildcarded entry will match in comparison to
1877others. \fIvalue\fR is a number between 0 and 65535, inclusive. A higher
1878\fIvalue\fR will match before a lower one. An exact-match entry will always
1879have priority over an entry containing wildcards, so it has an implicit
1880priority value of 65535. When adding a flow, if the field is not specified,
1881the flow's priority will default to 32768.
4530afba
BP
1882.IP
1883OpenFlow leaves behavior undefined when two or more flows with the
1884same priority can match a single packet. Some users expect
1885``sensible'' behavior, such as more specific flows taking precedence
1886over less specific flows, but OpenFlow does not specify this and Open
1887vSwitch does not implement it. Users should therefore take care to
1888use priorities to ensure the behavior that they expect.
a9b4a41a 1889.
064af421 1890.PP
fdb3539e
BP
1891The \fBadd\-flow\fR, \fBadd\-flows\fR, and \fBmod\-flows\fR commands
1892support the following additional options. These options affect only
1893new flows. Thus, for \fBadd\-flow\fR and \fBadd\-flows\fR, these
1894options are always significant, but for \fBmod\-flows\fR they are
1895significant only if the command creates a new flow, that is, their
a993007b 1896values do not update or affect existing flows.
a9b4a41a 1897.
fdb3539e 1898.IP "\fBidle_timeout=\fIseconds\fR"
064af421 1899Causes the flow to expire after the given number of seconds of
fdb3539e
BP
1900inactivity. A value of 0 (the default) prevents a flow from expiring
1901due to inactivity.
a9b4a41a 1902.
064af421
BP
1903.IP \fBhard_timeout=\fIseconds\fR
1904Causes the flow to expire after the given number of seconds,
1905regardless of activity. A value of 0 (the default) gives the flow no
1906hard expiration deadline.
a9b4a41a 1907.
ca26eb44
RB
1908.IP "\fBimportance=\fIvalue\fR"
1909Sets the importance of a flow. The flow entry eviction mechanism can
1910use importance as a factor in deciding which flow to evict. A value
1911of 0 (the default) makes the flow non-evictable on the basis of
1912importance. Specify a value between 0 and 65535.
1913.IP
1914Only OpenFlow 1.4 and later support \fBimportance\fR.
1915.
a993007b
BP
1916.IP "\fBsend_flow_rem\fR"
1917Marks the flow with a flag that causes the switch to generate a ``flow
1918removed'' message and send it to interested controllers when the flow
1919later expires or is removed.
1920.
1921.IP "\fBcheck_overlap\fR"
1922Forces the switch to check that the flow match does not overlap that
1923of any different flow with the same priority in the same table. (This
1924check is expensive so it is best to avoid it.)
1925.
b6dc6b93
BP
1926.IP "\fBreset_counts\fR"
1927When this flag is specified on a flow being added to a switch, and the
1928switch already has a flow with an identical match, an OpenFlow 1.2 (or
1929later) switch resets the flow's packet and byte counters to 0.
1930Without the flag, the packet and byte counters are preserved.
1931.IP
1932OpenFlow 1.0 and 1.1 switches always reset counters in this situation,
1933as if \fBreset_counts\fR were always specified.
1934.IP
1935Open vSwitch 1.10 added support for \fBreset_counts\fR.
1936.
1937.IP "\fBno_packet_counts\fR"
1938.IQ "\fBno_byte_counts\fR"
1939Adding these flags to a flow advises an OpenFlow 1.3 (or later) switch
1940that the controller does not need packet or byte counters,
1941respectively, for the flow. Some switch implementations might achieve
1942higher performance or reduce resource consumption when these flags are
1943used. These flags provide no benefit to the Open vSwitch software
1944switch implementation.
1945.IP
1946OpenFlow 1.2 and earlier do not support these flags.
1947.IP
1948Open vSwitch 1.10 added support for \fBno_packet_counts\fR and
1949\fBno_byte_counts\fR.
1950.
064af421 1951.PP
4e312e69 1952The \fBdump\-flows\fR, \fBdump\-aggregate\fR, \fBdel\-flow\fR
6d5d1f3b 1953and \fBdel\-flows\fR commands support these additional optional fields:
a9b4a41a 1954.
064af421
BP
1955.TP
1956\fBout_port=\fIport\fR
c6100d92 1957If set, a matching flow must include an output action to \fIport\fR,
60a0b9e5 1958which must be an OpenFlow port number or name (e.g. \fBlocal\fR).
a9b4a41a 1959.
6d5d1f3b
BP
1960.TP
1961\fBout_group=\fIport\fR
1962If set, a matching flow must include an \fBgroup\fR action naming
1963\fIgroup\fR, which must be an OpenFlow group number. This field
1964is supported in Open vSwitch 2.5 and later and requires OpenFlow 1.1
1965or later.
1966.
064af421 1967.SS "Table Entry Output"
a9b4a41a 1968.
4e312e69 1969The \fBdump\-tables\fR and \fBdump\-aggregate\fR commands print information
064af421 1970about the entries in a datapath's tables. Each line of output is a
f27f2134
BP
1971flow entry as described in \fBFlow Syntax\fR, above, plus some
1972additional fields:
a9b4a41a 1973.
f27f2134
BP
1974.IP \fBduration=\fIsecs\fR
1975The time, in seconds, that the entry has been in the table.
1976\fIsecs\fR includes as much precision as the switch provides, possibly
1977to nanosecond resolution.
a9b4a41a 1978.
064af421
BP
1979.IP \fBn_packets\fR
1980The number of packets that have matched the entry.
a9b4a41a 1981.
064af421
BP
1982.IP \fBn_bytes\fR
1983The total number of bytes from packets that have matched the entry.
a9b4a41a 1984.
064af421 1985.PP
f27f2134
BP
1986The following additional fields are included only if the switch is
1987Open vSwitch 1.6 or later and the NXM flow format is used to dump the
1988flow (see the description of the \fB\-\-flow-format\fR option below).
1989The values of these additional fields are approximations only and in
1990particular \fBidle_age\fR will sometimes become nonzero even for busy
1991flows.
1992.
1993.IP \fBhard_age=\fIsecs\fR
1994The integer number of seconds since the flow was added or modified.
1995\fBhard_age\fR is displayed only if it differs from the integer part
1996of \fBduration\fR. (This is separate from \fBduration\fR because
1997\fBmod\-flows\fR restarts the \fBhard_timeout\fR timer without zeroing
1998\fBduration\fR.)
1999.
2000.IP \fBidle_age=\fIsecs\fR
2001The integer number of seconds that have passed without any packets
2002passing through the flow.
a9b4a41a 2003.
6dd3c787
JR
2004.SS "Packet\-Out Syntax"
2005.PP
2006\fBovs\-ofctl bundle\fR command accepts packet-outs to be specified in
2007the bundle file. Each packet-out comprises of a series of
2008\fIfield\fB=\fIvalue\fR assignments, separated by commas or white
2009space. (Embedding spaces into a packet-out description normally
2010requires quoting to prevent the shell from breaking the description
2011into multiple arguments.). Unless noted otherwise only the last
2012instance of each field is honoured. This same syntax is also
2013supported by the \fBovs\-ofctl packet-out\fR command.
2014.PP
2015.IP \fBin_port=\fIport\fR
2016The port number to be considered the in_port when processing actions.
2017This can be any valid OpenFlow port number, or any of the \fBLOCAL\fR,
2018\fBCONTROLLER\fR, or \fBNONE\fR.
2019.
2020This field is required.
2021
880b1458
YHW
2022.IP \fIpipeline_field\fR=\fIvalue\fR
2023Optionally, user can specify a list of pipeline fields for a packet-out
2024message. The supported pipeline fields includes \fBtunnel fields\fR and
2025\fBregister fields\fR as defined in \fBovs\-fields\fR(7).
2026
6dd3c787
JR
2027.IP \fBpacket=\fIhex-string\fR
2028The actual packet to send, expressed as a string of hexadecimal bytes.
2029.
2030This field is required.
2031
2032.IP \fBactions=\fR[\fIaction\fR][\fB,\fIaction\fR...]\fR
2033The syntax of actions are identical to the \fBactions=\fR field
2034described in \fBFlow Syntax\fR above. Specifying \fBactions=\fR is
2035optional, but omitting actions is interpreted as a drop, so the packet
2036will not be sent anywhere from the switch.
2037.
2038\fBactions\fR must be specified at the end of each line, like for flow mods.
2039.RE
2040.
7395c052
NZ
2041.SS "Group Syntax"
2042.PP
2043Some \fBovs\-ofctl\fR commands accept an argument that describes a group or
2044groups. Such flow descriptions comprise a series
2045\fIfield\fB=\fIvalue\fR assignments, separated by commas or white
2046space. (Embedding spaces into a group description normally requires
2047quoting to prevent the shell from breaking the description into
2048multiple arguments.). Unless noted otherwise only the last instance
2049of each field is honoured.
2050.PP
2051.IP \fBgroup_id=\fIid\fR
2052The integer group id of group.
19187a71 2053When this field is specified in \fBdel\-groups\fR or \fBdump\-groups\fR,
7395c052
NZ
2054the keyword "all" may be used to designate all groups.
2055.
2056This field is required.
2057
2058
2059.IP \fBtype=\fItype\fR
bdbb8426 2060The type of the group. The \fBadd-group\fR, \fBadd-groups\fR and
ed1d5ef3 2061\fBmod-groups\fR commands require this field. It is prohibited for
bdbb8426 2062other commands. The following keywords designated the allowed types:
7395c052
NZ
2063.RS
2064.IP \fBall\fR
2065Execute all buckets in the group.
2066.IP \fBselect\fR
9a84f468
BP
2067Execute one bucket in the group, balancing across the buckets
2068according to their weights. To select a bucket, for each live bucket,
2069Open vSwitch hashes flow data with the bucket ID and multiplies by the
2070bucket weight to obtain a ``score,'' and then selects the bucket with
2071the highest score. Use \fBselection_method\fR to control the flow
2072data used for selection.
7395c052
NZ
2073.IP \fBindirect\fR
2074Executes the one bucket in the group.
2075.IP \fBff\fR
2076.IQ \fBfast_failover\fR
2077Executes the first live bucket in the group which is associated with
2078a live port or group.
2079.RE
2080
bdbb8426
SH
2081.IP \fBcommand_bucket_id=\fIid\fR
2082The bucket to operate on. The \fBinsert-buckets\fR and \fBremove-buckets\fR
2083commands require this field. It is prohibited for other commands.
2084\fIid\fR may be an integer or one of the following keywords:
2085.RS
2086.IP \fBall\fR
2087Operate on all buckets in the group.
2088Only valid when used with the \fBremove-buckets\fR command in which
2089case the effect is to remove all buckets from the group.
2090.IP \fBfirst\fR
2091Operate on the first bucket present in the group.
2092In the case of the \fBinsert-buckets\fR command the effect is to
2093insert new bucets just before the first bucket already present in the group;
2094or to replace the buckets of the group if there are no buckets already present
2095in the group.
2096In the case of the \fBremove-buckets\fR command the effect is to
2097remove the first bucket of the group; or do nothing if there are no
2098buckets present in the group.
2099.IP \fBlast\fR
2100Operate on the last bucket present in the group.
2101In the case of the \fBinsert-buckets\fR command the effect is to
2102insert new bucets just after the last bucket already present in the group;
2103or to replace the buckets of the group if there are no buckets already present
2104in the group.
2105In the case of the \fBremove-buckets\fR command the effect is to
2106remove the last bucket of the group; or do nothing if there are no
2107buckets present in the group.
2108.RE
2109.IP
2110If \fIid\fR is an integer then it should correspond to the \fBbucket_id\fR
2111of a bucket present in the group.
2112In case of the \fBinsert-buckets\fR command the effect is to
2113insert buckets just before the bucket in the group whose \fBbucket_id\fR is
2114\fIid\fR.
2115In case of the \fBiremove-buckets\fR command the effect is to
2116remove the in the group whose \fBbucket_id\fR is \fIid\fR.
2117It is an error if there is no bucket persent group in whose \fBbucket_id\fR is
2118\fIid\fR.
2119
b879391e
SH
2120.IP \fBselection_method\fR=\fImethod\fR
2121The selection method used to select a bucket for a select group.
2122This is a string of 1 to 15 bytes in length known to lower layers.
2123This field is optional for \fBadd\-group\fR, \fBadd\-groups\fR and
2124\fBmod\-group\fR commands on groups of type \fBselect\fR. Prohibited
2125otherwise. The default value is the empty string.
53cc166a
JR
2126.RS
2127.IP \fBhash\fR
2128Use a hash computed over the fields specified with the \fBfields\fR
2129option, see below. \fBhash\fR uses the \fBselection_method_param\fR
2130as the hash basis.
2131.IP
2132Note that the hashed fields become exact matched by the datapath
2133flows. For example, if the TCP source port is hashed, the created
2134datapath flows will match the specific TCP source port value present
2135in the packet received. Since each TCP connection generally has a
2136different source port value, a separate datapath flow will be need to
2137be inserted for each TCP connection thus hashed to a select group
2138bucket.
2139.IP \fBdp_hash\fR
2140Use a datapath computed hash value. The hash algorithm varies accross
2141different datapath implementations. \fBdp_hash\fR uses the upper 32
2142bits of the \fBselection_method_param\fR as the datapath hash
2143algorithm selector, which currently must always be 0, corresponding to
2144hash computation over the IP 5-tuple (selecting specific fields with
2145the \fBfields\fR option is not allowed with \fBdp_hash\fR). The lower
214632 bits are used as the hash basis.
2147.IP
2148Using \fBdp_hash\fR has the advantage that it does not require the
2149generated datapath flows to exact match any additional packet header
2150fields. For example, even if multiple TCP connections thus hashed to
2151different select group buckets have different source port numbers,
2152generally all of them would be handled with a small set of already
2153established datapath flows, resulting in less latency for TCP SYN
2154packets. The downside is that the shared datapath flows must match
2155each packet twice, as the datapath hash value calculation happens only
2156when needed, and a second match is required to match some bits of its
2157value. This double-matching incurs a small additional latency cost
2158for each packet, but this latency is orders of magnitude less than the
2159latency of creating new datapath flows for new TCP connections.
2160.RE
68dfc25b 2161.IP
b879391e
SH
2162This option will use a Netronome OpenFlow extension which is only supported
2163when using Open vSwitch 2.4 and later with OpenFlow 1.5 and later.
2164
2165.IP \fBselection_method_param\fR=\fIparam\fR
216664-bit integer parameter to the selection method selected by the
2167\fBselection_method\fR field. The parameter's use is defined by the
2168lower-layer that implements the \fBselection_method\fR. It is optional if
2169the \fBselection_method\fR field is specified as a non-empty string.
2170Prohibited otherwise. The default value is zero.
2171.IP
2172This option will use a Netronome OpenFlow extension which is only supported
2173when using Open vSwitch 2.4 and later with OpenFlow 1.5 and later.
2174
68dfc25b
BP
2175.IP \fBfields\fR=\fIfield\fR
2176.IQ \fBfields(\fIfield\fR[\fB=\fImask\fR]\fR...\fB)\fR
b879391e 2177The field parameters to selection method selected by the
60dfb5ed
JR
2178\fBselection_method\fR field. The syntax is described in \fBFlow
2179Syntax\fR with the additional restrictions that if a value is provided
2180it is treated as a wildcard mask and wildcard masks following a slash
2181are prohibited. The pre-requisites of fields must be provided by any
2182flows that output to the group. The use of the fields is defined by
2183the lower-layer that implements the \fBselection_method\fR. They are
2184optional if the \fBselection_method\fR field is specified as ``hash',
2185prohibited otherwise. The default is no fields.
b879391e
SH
2186.IP
2187This option will use a Netronome OpenFlow extension which is only supported
2188when using Open vSwitch 2.4 and later with OpenFlow 1.5 and later.
2189
7395c052
NZ
2190.IP \fBbucket\fR=\fIbucket_parameters\fR
2191The \fBadd-group\fR, \fBadd-groups\fR and \fBmod-group\fR commands
2192require at least one bucket field. Bucket fields must appear after
2193all other fields.
2194.
2195Multiple bucket fields to specify multiple buckets.
2196The order in which buckets are specified corresponds to their order in
2197the group. If the type of the group is "indirect" then only one group may
2198be specified.
2199.
2200\fIbucket_parameters\fR consists of a list of \fIfield\fB=\fIvalue\fR
2201assignments, separated by commas or white space followed by a
2202comma-separated list of actions.
7395c052
NZ
2203The fields for \fIbucket_parameters\fR are:
2204.
2205.RS
2d5d050c
SH
2206.IP \fBbucket_id=\fIid\fR
2207The 32-bit integer group id of the bucket. Values greater than
22080xffffff00 are reserved.
2209.
2210This field was added in Open vSwitch 2.4 to conform with the OpenFlow
d3cb080e 22111.5 specification. It is not supported when earlier versions
2d5d050c
SH
2212of OpenFlow are used. Open vSwitch will automatically allocate bucket
2213ids when they are not specified.
f1457c26
TG
2214.IP \fBactions=\fR[\fIaction\fR][\fB,\fIaction\fR...]\fR
2215The syntax of actions are identical to the \fBactions=\fR field described in
6dd3c787 2216\fBFlow Syntax\fR above. Specifying \fBactions=\fR is optional, any unknown
f1457c26 2217bucket parameter will be interpreted as an action.
7395c052
NZ
2218.IP \fBweight=\fIvalue\fR
2219The relative weight of the bucket as an integer. This may be used by the switch
2220during bucket select for groups whose \fBtype\fR is \fBselect\fR.
2221.IP \fBwatch_port=\fIport\fR
2222Port used to determine liveness of group.
2223This or the \fBwatch_group\fR field is required
2224for groups whose \fBtype\fR is \fBff\fR or \fBfast_failover\fR.
2225.IP \fBwatch_group=\fIgroup_id\fR
2226Group identifier of group used to determine liveness of group.
2227This or the \fBwatch_port\fR field is required
2228for groups whose \fBtype\fR is \fBff\fR or \fBfast_failover\fR.
2229.RE
2230.
3200ed58
JR
2231.SS "Meter Syntax"
2232.PP
2233The meter table commands accept an argument that describes a meter.
2234Such meter descriptions comprise a series \fIfield\fB=\fIvalue\fR
2235assignments, separated by commas or white space.
2236(Embedding spaces into a group description normally requires
2237quoting to prevent the shell from breaking the description into
2238multiple arguments.). Unless noted otherwise only the last instance
2239of each field is honoured.
2240.PP
2241.IP \fBmeter=\fIid\fR
2242The integer meter id of the meter.
2243When this field is specified in \fBdel-meter\fR, \fBdump-meter\fR, or
2244\fBmeter-stats\fR, the keyword "all" may be used to designate all meters.
2245.
dfec5030 2246This field is required, except for \fBmeter-stats\fR, which dumps all stats
3200ed58
JR
2247when this field is not specified.
2248
2249.IP \fBkbps\fR
2250.IQ \fBpktps\fR
2251The unit for the meter band rate parameters, either kilobits per second, or
2252packets per second, respectively. One of these must be specified. The burst
2253size unit corresponds to the rate unit by dropping the "per second", i.e.,
2254burst is in units of kilobits or packets, respectively.
2255
2256.IP \fBburst\fR
2257Specify burst size for all bands, or none of them, if this flag is not given.
2258
2259.IP \fBstats\fR
2260Collect meter and band statistics.
2261
2262.IP \fBbands\fR=\fIband_parameters\fR
2263The \fBadd-meter\fR and \fBmod-meter\fR commands require at least one
2264band specification. Bands must appear after all other fields.
2265.RS
2266.IP \fBtype=\fItype\fR
2267The type of the meter band. This keyword starts a new band specification.
2268Each band specifies a rate above which the band is to take some action. The
2269action depends on the band type. If multiple bands' rate is exceeded, then
2270the band with the highest rate among the exceeded bands is selected.
2271The following keywords designate the allowed
2272meter band types:
2273.RS
2274.IP \fBdrop\fR
2275Drop packets exceeding the band's rate limit.
2276.RE
2277.
2278.IP "The other \fIband_parameters\fR are:"
2279.IP \fBrate=\fIvalue\fR
2280The relative rate limit for this band, in kilobits per second or packets per
2281second, depending on the meter flags defined above.
96660ed1
BP
2282.IP \fBburst_size=\fIsize\fR
2283The maximum burst allowed for the band. If \fBpktps\fR is specified,
2284then \fIsize\fR is a packet count, otherwise it is in kilobits. If
2285unspecified, the switch is free to select some reasonable value
2286depending on its configuration.
3200ed58
JR
2287.RE
2288.
064af421
BP
2289.SH OPTIONS
2290.TP
4e312e69 2291\fB\-\-strict\fR
064af421 2292Uses strict matching when running flow modification commands.
a9b4a41a 2293.
50f96b10
BP
2294.IP "\fB\-\-names\fR"
2295.IQ "\fB\-\-no\-names\fR"
4bc938cc
BP
2296Every OpenFlow port has a name and a number, and every OpenFlow flow
2297table has a number and sometimes a name. By default, \fBovs\-ofctl\fR
2298commands accept both port and table names and numbers, and they
2299display port and table names if \fBovs\-ofctl\fR is running on an
2300interactive console, numbers otherwise. With \fB\-\-names\fR,
2301\fBovs\-ofctl\fR commands both accept and display port and table
2302names; with \fB\-\-no\-names\fR, commands neither accept nor display
2303port and table names.
2304.IP
2305If a port or table name contains special characters or might be
2306confused with a keyword within a flow, it may be enclosed in double
2307quotes (escaped from the shell). If necessary, JSON-style escape
2308sequences may be used inside quotes, as specified in RFC 7159. When
2309it displays port and table names, \fBovs\-ofctl\fR quotes any name
2310that does not start with a letter followed by letters or digits.
2311.IP
2312Open vSwitch added support for port names and these options. Open
2313vSwitch 2.10 added support for table names. Earlier versions always
50f96b10
BP
2314behaved as if \fB\-\-no\-names\fR were specified.
2315.IP
2316Open vSwitch does not place its own limit on the length of port names,
2317but OpenFlow 1.0 to 1.5 limit port names to 15 bytes and OpenFlow 1.6
2318limits them to 63 bytes. Because \fRovs\-ofctl\fR uses OpenFlow to
2319retrieve the mapping between port names and numbers, names longer than
2320this limit will be truncated for both display and acceptance.
2321Truncation can also cause long names that are different to appear to
2322be the same; when a switch has two ports with the same (truncated)
2323name, \fBovs\-ofctl\fR refuses to display or accept the name, using
2324the number instead.
4bc938cc
BP
2325.IP
2326OpenFlow and Open vSwitch limit table names to 32 bytes.
50f96b10 2327.
1b3758c3
BP
2328.IP "\fB\-\-stats\fR"
2329.IQ "\fB\-\-no\-stats\fR"
2330The \fBdump\-flows\fR command by default, or with \fB\-\-stats\fR,
2331includes flow duration, packet and byte counts, and idle and hard age
2332in its output. With \fB\-\-no\-stats\fR, it omits all of these, as
2333well as cookie values and table IDs if they are zero.
2334.
1f4a7252
RM
2335.IP "\fB\-\-read-only\fR"
2336Do not execute read/write commands.
2337.
db5076ee 2338.IP "\fB\-\-bundle\fR"
39c94593 2339Execute flow mods as an OpenFlow 1.4 atomic bundle transaction.
db5076ee
JR
2340.RS
2341.IP \(bu
2342Within a bundle, all flow mods are processed in the order they appear
39c94593
JR
2343and as a single atomic transaction, meaning that if one of them fails,
2344the whole transaction fails and none of the changes are made to the
2345\fIswitch\fR's flow table, and that each given datapath packet
2346traversing the OpenFlow tables sees the flow tables either as before
2347the transaction, or after all the flow mods in the bundle have been
2348successfully applied.
db5076ee
JR
2349.IP \(bu
2350The beginning and the end of the flow table modification commands in a
2351bundle are delimited with OpenFlow 1.4 bundle control messages, which
2352makes it possible to stream the included commands without explicit
2353OpenFlow barriers, which are otherwise used after each flow table
2354modification command. This may make large modifications execute
2355faster as a bundle.
2356.IP \(bu
2357Bundles require OpenFlow 1.4 or higher. An explicit \fB-O
2358OpenFlow14\fR option is not needed, but you may need to enable
2359OpenFlow 1.4 support for OVS by setting the OVSDB \fIprotocols\fR
2360column in the \fIbridge\fR table.
db5076ee
JR
2361.RE
2362.
a53a8efa
SH
2363.so lib/ofp-version.man
2364.
27527aa0
BP
2365.IP "\fB\-F \fIformat\fR[\fB,\fIformat\fR...]"
2366.IQ "\fB\-\-flow\-format=\fIformat\fR[\fB,\fIformat\fR...]"
2367\fBovs\-ofctl\fR supports the following individual flow formats, any
2368number of which may be listed as \fIformat\fR:
88ca35ee 2369.RS
27527aa0
BP
2370.IP "\fBOpenFlow10\-table_id\fR"
2371This is the standard OpenFlow 1.0 flow format. All OpenFlow switches
2372and all versions of Open vSwitch support this flow format.
88ca35ee 2373.
27527aa0
BP
2374.IP "\fBOpenFlow10+table_id\fR"
2375This is the standard OpenFlow 1.0 flow format plus a Nicira extension
2376that allows \fBovs\-ofctl\fR to specify the flow table in which a
2377particular flow should be placed. Open vSwitch 1.2 and later supports
2378this flow format.
2379.
2380.IP "\fBNXM\-table_id\fR (Nicira Extended Match)"
88ca35ee
BP
2381This Nicira extension to OpenFlow is flexible and extensible. It
2382supports all of the Nicira flow extensions, such as \fBtun_id\fR and
27527aa0
BP
2383registers. Open vSwitch 1.1 and later supports this flow format.
2384.
2385.IP "\fBNXM+table_id\fR (Nicira Extended Match)"
2386This combines Nicira Extended match with the ability to place a flow
2387in a specific table. Open vSwitch 1.2 and later supports this flow
2388format.
e71bff1b
BP
2389.
2390.IP "\fBOXM-OpenFlow12\fR"
2391.IQ "\fBOXM-OpenFlow13\fR"
aa233d57 2392.IQ "\fBOXM-OpenFlow14\fR"
8d348579
BP
2393.IQ "\fBOXM-OpenFlow15\fR"
2394.IQ "\fBOXM-OpenFlow16\fR"
e71bff1b 2395These are the standard OXM (OpenFlow Extensible Match) flow format in
8d348579 2396OpenFlow 1.2 and later.
88ca35ee 2397.RE
27527aa0 2398.
88ca35ee 2399.IP
27527aa0
BP
2400\fBovs\-ofctl\fR also supports the following abbreviations for
2401collections of flow formats:
2402.RS
2403.IP "\fBany\fR"
aa233d57 2404Any supported flow format.
27527aa0
BP
2405.IP "\fBOpenFlow10\fR"
2406\fBOpenFlow10\-table_id\fR or \fBOpenFlow10+table_id\fR.
2407.IP "\fBNXM\fR"
2408\fBNXM\-table_id\fR or \fBNXM+table_id\fR.
e71bff1b 2409.IP "\fBOXM\fR"
aa233d57 2410\fBOXM-OpenFlow12\fR, \fBOXM-OpenFlow13\fR, or \fBOXM-OpenFlow14\fR.
27527aa0 2411.RE
4f564f8d 2412.
27527aa0
BP
2413.IP
2414For commands that modify the flow table, \fBovs\-ofctl\fR by default
2415negotiates the most widely supported flow format that supports the
2416flows being added. For commands that query the flow table,
2417\fBovs\-ofctl\fR by default uses the most advanced format supported by
2418the switch.
2419.IP
2420This option, where \fIformat\fR is a comma-separated list of one or
2421more of the formats listed above, limits \fBovs\-ofctl\fR's choice of
2422flow format. If a command cannot work as requested using one of the
2423specified flow formats, \fBovs\-ofctl\fR will report a fatal error.
54834960
EJ
2424.
2425.IP "\fB\-P \fIformat\fR"
2426.IQ "\fB\-\-packet\-in\-format=\fIformat\fR"
6409e008 2427\fBovs\-ofctl\fR supports the following ``packet-in'' formats, in order of
54834960
EJ
2428increasing capability:
2429.RS
6409e008
BP
2430.IP "\fBstandard\fR"
2431This uses the \fBOFPT_PACKET_IN\fR message, the standard ``packet-in''
2432message for any given OpenFlow version. Every OpenFlow switch that
2433supports a given OpenFlow version supports this format.
2434.
2435.IP "\fBnxt_packet_in\fR"
2436This uses the \fBNXT_PACKET_IN\fR message, which adds many of the
2437capabilities of the OpenFlow 1.1 and later ``packet-in'' messages
2438before those OpenFlow versions were available in Open vSwitch. Open
2439vSwitch 1.1 and later support this format. Only Open vSwitch 2.6 and
2440later, however, support it for OpenFlow 1.1 and later (but there is
2441little reason to use it with those versions of OpenFlow).
2442.
2443.IP "\fBnxt_packet_in2\fR"
2444This uses the \fBNXT_PACKET_IN2\fR message, which is extensible and
bdcad671
BP
2445should avoid the need to define new formats later. In particular,
2446this format supports passing arbitrary user-provided data to a
2447controller using the \fBuserdata\fB option on the \fBcontroller\fR
2448action. Open vSwitch 2.6 and later support this format.
54834960
EJ
2449.
2450.RE
2451.IP
6409e008
BP
2452Without this option, \fBovs\-ofctl\fR prefers \fBnxt_packet_in2\fR if
2453the switch supports it. Otherwise, if OpenFlow 1.0 is in use,
2454\fBovs\-ofctl\fR prefers \fBnxt_packet_in\fR if the switch supports
2455it. Otherwise, \fBovs\-ofctl\fR falls back to the \fBstandard\fR
2456packet-in format. When this option is specified, \fBovs\-ofctl\fR
2457insists on the selected format. If the switch does not support the
2458requested format, \fBovs\-ofctl\fR will report a fatal error.
2459.IP
2460Before version 2.6, Open vSwitch called \fBstandard\fR format
2461\fBopenflow10\fR and \fBnxt_packet_in\fR format \fBnxm\fR, and
2462\fBovs\-ofctl\fR still accepts these names as synonyms. (The name
2463\fBopenflow10\fR was a misnomer because this format actually varies
2464from one OpenFlow version to another; it is not consistently OpenFlow
24651.0 format. Similarly, when \fBnxt_packet_in2\fR was introduced, the
2466name \fBnxm\fR became confusing because it also uses OXM/NXM.)
2467.
2468.IP
2469This option affects only the \fBmonitor\fR command.
54834960 2470.
0c9560b7
BP
2471.IP "\fB\-\-timestamp\fR"
2472Print a timestamp before each received packet. This option only
f3dd1419
BP
2473affects the \fBmonitor\fR, \fBsnoop\fR, and \fBofp\-parse\-pcap\fR
2474commands.
0c9560b7 2475.
4f564f8d
BP
2476.IP "\fB\-m\fR"
2477.IQ "\fB\-\-more\fR"
2478Increases the verbosity of OpenFlow messages printed and logged by
2479\fBovs\-ofctl\fR commands. Specify this option more than once to
2480increase verbosity further.
1eb85ef5 2481.
bdcc5925
BP
2482.IP \fB\-\-sort\fR[\fB=\fIfield\fR]
2483.IQ \fB\-\-rsort\fR[\fB=\fIfield\fR]
2484Display output sorted by flow \fIfield\fR in ascending
2485(\fB\-\-sort\fR) or descending (\fB\-\-rsort\fR) order, where
2486\fIfield\fR is any of the fields that are allowed for matching or
2487\fBpriority\fR to sort by priority. When \fIfield\fR is omitted, the
2488output is sorted by priority. Specify these options multiple times to
2489sort by multiple fields.
2490.IP
2491Any given flow will not necessarily specify a value for a given
2492field. This requires special treatement:
2493.RS
2494.IP \(bu
2495A flow that does not specify any part of a field that is used for sorting is
2496sorted after all the flows that do specify the field. For example,
2497\fB\-\-sort=tcp_src\fR will sort all the flows that specify a TCP
2498source port in ascending order, followed by the flows that do not
0d56eaf2 2499specify a TCP source port at all.
bdcc5925
BP
2500.IP \(bu
2501A flow that only specifies some bits in a field is sorted as if the
2502wildcarded bits were zero. For example, \fB\-\-sort=nw_src\fR would
2503sort a flow that specifies \fBnw_src=192.168.0.0/24\fR the same as
2504\fBnw_src=192.168.0.0\fR.
2505.RE
2506.IP
2507These options currently affect only \fBdump\-flows\fR output.
2508.
679d3475 2509.SS "Daemon Options"
1eb85ef5
EJ
2510.ds DD \
2511\fBovs\-ofctl\fR detaches only when executing the \fBmonitor\fR or \
2512\fBsnoop\fR commands.
2513.so lib/daemon.man
19945013 2514.so lib/unixctl.man
ac300505 2515.SS "Public Key Infrastructure Options"
84ee7bcf 2516.so lib/ssl.man
064af421 2517.so lib/vlog.man
e7019d99 2518.so lib/colors.man
064af421 2519.so lib/common.man
a9b4a41a 2520.
1eb85ef5 2521.SH "RUNTIME MANAGEMENT COMMANDS"
96761f58
BP
2522\fBovs\-appctl\fR(8) can send commands to a running \fBovs\-ofctl\fR
2523process. The supported commands are listed below.
2524.
1eb85ef5 2525.IP "\fBexit\fR"
96761f58
BP
2526Causes \fBovs\-ofctl\fR to gracefully terminate. This command applies
2527only when executing the \fBmonitor\fR or \fBsnoop\fR commands.
2528.
1e1d00a5
BP
2529.IP "\fBofctl/set\-output\-file \fIfile\fR"
2530Causes all subsequent output to go to \fIfile\fR instead of stderr.
2531This command applies only when executing the \fBmonitor\fR or
2532\fBsnoop\fR commands.
2533.
96761f58
BP
2534.IP "\fBofctl/send \fIofmsg\fR..."
2535Sends each \fIofmsg\fR, specified as a sequence of hex digits that
2536express an OpenFlow message, on the OpenFlow connection. This command
2537is useful only when executing the \fBmonitor\fR command.
2538.
6dd3c787
JR
2539.IP "\fBofctl/packet\-out \fIpacket-out\fR"
2540Sends an OpenFlow PACKET_OUT message specified in \fBPacket\-Out
2541Syntax\fR, on the OpenFlow connection. See \fBPacket\-Out Syntax\fR
2542section for more information. This command is useful only when
2543executing the \fBmonitor\fR command.
2544.
bb638b9a
BP
2545.IP "\fBofctl/barrier\fR"
2546Sends an OpenFlow barrier request on the OpenFlow connection and waits
2547for a reply. This command is useful only for the \fBmonitor\fR
2548command.
2549.
064af421 2550.SH EXAMPLES
a9b4a41a 2551.
045b2e5c
BP
2552The following examples assume that \fBovs\-vswitchd\fR has a bridge
2553named \fBbr0\fR configured.
a9b4a41a 2554.
064af421 2555.TP
045b2e5c 2556\fBovs\-ofctl dump\-tables br0\fR
064af421
BP
2557Prints out the switch's table stats. (This is more interesting after
2558some traffic has passed through.)
a9b4a41a 2559.
064af421 2560.TP
045b2e5c 2561\fBovs\-ofctl dump\-flows br0\fR
064af421 2562Prints the flow entries in the switch.
a9b4a41a 2563.
5b10f305
OS
2564.TP
2565\fBovs\-ofctl add\-flow table=0 actions=learn(table=1,hard_timeout=10, NXM_OF_VLAN_TCI[0..11],output:NXM_OF_IN_PORT[]), resubmit(,1)\fR
2566\fBovs\-ofctl add\-flow table=1 priority=0 actions=flood\fR
2567Implements a level 2 MAC learning switch using the learn.
2568.
2569.TP
2570\fBovs\-ofctl add\-flow br0 'table=0,priority=0 actions=load:3->NXM_NX_REG0[0..15],learn(table=0,priority=1,idle_timeout=10,NXM_OF_ETH_SRC[],NXM_OF_VLAN_TCI[0..11],output:NXM_NX_REG0[0..15]),output:2\fR
2571In this use of a learn action, the first packet from each source MAC
2572will be sent to port 2. Subsequent packets will be output to port 3,
21b2fa61
JR
2573with an idle timeout of 10 seconds. NXM field names and match field
2574names are both accepted, e.g. \fBNXM_NX_REG0\fR or \fBreg0\fR for the
2575first register, and empty brackets may be omitted.
2576.IP
5b10f305
OS
2577Additional examples may be found documented as part of related sections.
2578.
064af421 2579.SH "SEE ALSO"
a9b4a41a 2580.
96fee5e0 2581.BR ovs\-fields (7),
064af421 2582.BR ovs\-appctl (8),
96fee5e0 2583.BR ovs\-vswitchd (8),
29089a54 2584.BR ovs\-vswitchd.conf.db (8)