ofproto: Querying port stats for individual ports (OpenFlow 1.0)
[sliver-openvswitch.git] / utilities / ovs-ofctl.8.in
1 .TH ovs\-ofctl 8 "January 2010" "Open vSwitch" "Open vSwitch Manual"
2 .ds PN ovs\-ofctl
3
4 .SH NAME
5 ovs\-ofctl \- administer OpenFlow switches
6
7 .SH SYNOPSIS
8 .B ovs\-ofctl
9 [\fIoptions\fR] \fIcommand \fR[\fIswitch\fR] [\fIargs\fR\&...]
10
11 .SH DESCRIPTION
12 The
13 .B ovs\-ofctl
14 program is a command line tool for monitoring and administering
15 OpenFlow switches.  It can also show the current state of an OpenFlow
16 switch, including features, configuration, and table entries.
17
18 .SS "OpenFlow Switch Management Commands"
19
20 These commands allow \fBovs\-ofctl\fR to monitor and administer an OpenFlow
21 switch.  It is able to show the current state of a switch, including
22 features, configuration, and table entries.
23
24 Most of these commands take an argument that specifies the method for
25 connecting to an OpenFlow switch.  The following connection methods
26 are supported:
27
28 .RS
29 .so lib/vconn-active.man
30 .
31 .IP "\fIfile\fR"
32 This is short for \fBunix:\fIfile\fR, as long as \fIfile\fR does not
33 contain a colon.
34 .
35 .IP \fIbridge\fR
36 This is short for \fBunix:@RUNDIR@/\fIbridge\fB.mgmt\fR, as long as
37 \fIbridge\fR does not contain a colon.
38 .
39 .IP [\fItype\fB@\fR]\fIdp\fR
40 Attempts to look up the bridge associated with \fIdp\fR and open as
41 above.  If \fItype\fR is given, it specifies the datapath provider of
42 \fIdp\fR, otherwise the default provider \fBsystem\fR is assumed.
43 .RE
44
45 .TP
46 \fBshow \fIswitch\fR
47 Prints to the console information on \fIswitch\fR, including
48 information on its flow tables and ports.
49
50 .TP
51 \fBstatus \fIswitch\fR [\fIkey\fR]
52 Prints to the console a series of key-value pairs that report the
53 status of \fIswitch\fR.  If \fIkey\fR is specified, only the key-value
54 pairs whose key names begin with \fIkey\fR are printed.  If \fIkey\fR is
55 omitted, all key-value pairs are printed.
56
57 .TP
58 \fBdump-tables \fIswitch\fR
59 Prints to the console statistics for each of the flow tables used by
60 \fIswitch\fR.
61
62 .TP
63 \fBdump-ports \fIswitch\fR [\fInetdev\fR]
64 Prints to the console statistics for network devices associated with 
65 \fIswitch\fR.  If \fInetdev\fR is specified, only the statistics
66 associated with that device will be printed.  \fInetdev\fR can be an
67 OpenFlow assigned port number or device name, e.g. \fBeth0\fR.
68
69 .TP
70 \fBmod-port \fIswitch\fR \fInetdev\fR \fIaction\fR
71 Modify characteristics of an interface monitored by \fIswitch\fR.  
72 \fInetdev\fR can be referred to by its OpenFlow assigned port number or 
73 the device name, e.g. \fBeth0\fR.  The \fIaction\fR may be any one of the
74 following:
75
76 .RS
77 .IP \fBup\fR
78 Enables the interface.  This is equivalent to ``ifconfig up'' on a Unix
79 system.
80
81 .IP \fBdown\fR
82 Disables the interface.  This is equivalent to ``ifconfig down'' on a Unix
83 system.
84
85 .IP \fBflood\fR
86 When a \fIflood\fR action is specified, traffic will be sent out this
87 interface.  This is the default posture for monitored ports.
88
89 .IP \fBnoflood\fR
90 When a \fIflood\fR action is specified, traffic will not be sent out 
91 this interface.  This is primarily useful to prevent loops when a
92 spanning tree protocol is not in use.
93
94 .RE
95
96 .TP
97 \fBdump-flows \fIswitch \fR[\fIflows\fR]
98 Prints to the console all flow entries in \fIswitch\fR's
99 tables that match \fIflows\fR.  If \fIflows\fR is omitted, all flows
100 in the switch are retrieved.  See \fBFlow Syntax\fR, below, for the
101 syntax of \fIflows\fR.  The output format is described in 
102 \fBTable Entry Output\fR.
103
104 .TP
105 \fBdump-aggregate \fIswitch \fR[\fIflows\fR]
106 Prints to the console aggregate statistics for flows in 
107 \fIswitch\fR's tables that match \fIflows\fR.  If \fIflows\fR is omitted, 
108 the statistics are aggregated across all flows in the switch's flow
109 tables.  See \fBFlow Syntax\fR, below, for the syntax of \fIflows\fR.
110 The output format is descrbed in \fBTable Entry Output\fR.
111
112 .TP
113 \fBadd-flow \fIswitch flow\fR
114 Add the flow entry as described by \fIflow\fR to the \fIswitch\fR's 
115 tables.  The flow entry is in the format described in \fBFlow Syntax\fR, 
116 below.
117
118 .TP
119 \fBadd-flows \fIswitch file\fR
120 Add flow entries as described in \fIfile\fR to \fIswitch\fR's 
121 tables.  Each line in \fIfile\fR is a flow entry in the format
122 described in \fBFlow Syntax\fR, below.
123
124 .TP
125 \fBmod-flows \fIswitch flow\fR
126 Modify the actions in entries from the \fIswitch\fR's tables 
127 that match \fIflow\fR.  When invoked with the \fB--strict\fR option,
128 wildcards are not treated as active for matching purposes.  See 
129 \fBFlow Syntax\fR, below, for the syntax of \fIflows\fR.
130
131 .TP
132 \fBdel-flows \fIswitch \fR[\fIflow\fR]
133 Deletes entries from the \fIswitch\fR's tables that match
134 \fIflow\fR.  When invoked with the \fB--strict\fR option, wildcards are 
135 not treated as active for matching purposes.  If \fIflow\fR is 
136 omitted and the \fB--strict\fR option is not used, all flows in the 
137 switch's tables are removed.  See \fBFlow Syntax\fR, below, for the 
138 syntax of \fIflows\fR.
139
140 .TP
141 \fBmonitor \fIswitch\fR [\fImiss-len\fR]
142 Connects to \fIswitch\fR and prints to the console all OpenFlow
143 messages received.  Usually, \fIswitch\fR should specify a connection
144 named on \fBovs\-openflowd\fR(8)'s \fB-l\fR or \fB--listen\fR command line
145 option.
146
147 If \fImiss-len\fR is provided, \fBovs\-ofctl\fR sends an OpenFlow ``set
148 configuration'' message at connection setup time that requests
149 \fImiss-len\fR bytes of each packet that misses the flow table.  The
150 OpenFlow reference implementation does not send these messages to the
151 \fBovs\-ofctl monitor\fR client connection unless a nonzero value is
152 specified on this argument.
153
154 This command may be useful for debugging switch or controller
155 implementations.
156
157 .SS "OpenFlow Switch and Controller Commands"
158
159 The following commands, like those in the previous section, may be
160 applied to OpenFlow switches, using any of the connection methods
161 described in that section.  Unlike those commands, these may also be
162 applied to OpenFlow controllers.
163
164 .TP
165 \fBprobe \fItarget\fR
166 Sends a single OpenFlow echo-request message to \fItarget\fR and waits
167 for the response.  With the \fB-t\fR or \fB--timeout\fR option, this
168 command can test whether an OpenFlow switch or controller is up and
169 running.
170
171 .TP
172 \fBping \fItarget \fR[\fIn\fR]
173 Sends a series of 10 echo request packets to \fItarget\fR and times
174 each reply.  The echo request packets consist of an OpenFlow header
175 plus \fIn\fR bytes (default: 64) of randomly generated payload.  This
176 measures the latency of individual requests.
177
178 .TP
179 \fBbenchmark \fItarget n count\fR
180 Sends \fIcount\fR echo request packets that each consist of an
181 OpenFlow header plus \fIn\fR bytes of payload and waits for each
182 response.  Reports the total time required.  This is a measure of the
183 maximum bandwidth to \fItarget\fR for round-trips of \fIn\fR-byte
184 messages.
185
186 .SS "Flow Syntax"
187
188 Some \fBovs\-ofctl\fR commands accept an argument that describes a flow or
189 flows.  Such flow descriptions comprise a series
190 \fIfield\fB=\fIvalue\fR assignments, separated by commas or white
191 space.  (Embedding spaces into a flow description normally requires
192 quoting to prevent the shell from breaking the description into
193 multiple arguments.)
194
195 The following field assignments describe how a flow matches a packet.
196 If any of these assignments is omitted from the flow syntax, the field
197 is treated as a wildcard; thus, if all of them are omitted, the
198 resulting flow matches all packets.  The string \fB*\fR or \fBANY\fR
199 may be specified to explicitly mark any of these fields as a wildcard.  
200 (\fB*\fR should be quoted to protect it from shell expansion.)
201
202 .IP \fBin_port=\fIport_no\fR
203 Matches physical port \fIport_no\fR.  Switch ports are numbered as
204 displayed by \fBovs\-ofctl show\fR.
205
206 .IP \fBdl_vlan=\fIvlan\fR
207 Matches IEEE 802.1q Virtual LAN tag \fIvlan\fR.  Specify \fB0xffff\fR
208 as \fIvlan\fR to match packets that are not tagged with a Virtual LAN;
209 otherwise, specify a number between 0 and 4095, inclusive, as the
210 12-bit VLAN ID to match.
211
212 .IP \fBdl_vlan_pcp=\fIpriority\fR
213 Matches IEEE 802.1q Priority Code Point (PCP) \fIpriority\fR, which is
214 specified as a value between 0 and 7, inclusive.  A higher value
215 indicates a higher frame priority level.
216
217 .IP \fBdl_src=\fImac\fR
218 Matches Ethernet source address \fImac\fR, which is specified as 6 pairs 
219 of hexadecimal digits delimited by colons (e.g. \fB00:0A:E4:25:6B:B0\fR).
220
221 .IP \fBdl_dst=\fImac\fR
222 Matches Ethernet destination address \fImac\fR.
223
224 .IP \fBdl_type=\fIethertype\fR
225 Matches Ethernet protocol type \fIethertype\fR, which is specified as an
226 integer between 0 and 65535, inclusive, either in decimal or as a 
227 hexadecimal number prefixed by \fB0x\fR (e.g. \fB0x0806\fR to match ARP 
228 packets).
229
230 .IP \fBnw_src=\fIip\fR[\fB/\fInetmask\fR]
231 Matches IPv4 source address \fIip\fR, which may be specified as an
232 IP address or host name (e.g. \fB192.168.1.1\fR or
233 \fBwww.example.com\fR).  The optional \fInetmask\fR allows restricting a
234 match to an IPv4 address prefix.  The netmask may be specified as a dotted 
235 quad (e.g. \fB192.168.1.0/255.255.255.0\fR) or as a CIDR block 
236 (e.g. \fB192.168.1.0/24\fR).
237
238 .IP \fBnw_dst=\fIip\fR[\fB/\fInetmask\fR]
239 Matches IPv4 destination address \fIip\fR.
240
241 .IP \fBnw_proto=\fIproto\fR
242 Matches IP protocol type \fIproto\fR, which is specified as a decimal 
243 number between 0 and 255, inclusive (e.g. 6 to match TCP packets).
244
245 .IP \fBnw_tos=\fItos\fR
246 Matches IP ToS/DSCP field \fItos\fR, which is specified as a decimal 
247 number between 0 and 255, inclusive.  Note that the two lower reserved
248 bits are ignored for matching purposes.
249
250 .IP \fBtp_src=\fIport\fR
251 Matches UDP or TCP source port \fIport\fR, which is specified as a decimal 
252 number between 0 and 65535, inclusive (e.g. 80 to match packets originating 
253 from a HTTP server).
254
255 .IP \fBtp_dst=\fIport\fR
256 Matches UDP or TCP destination port \fIport\fR.
257
258 .IP \fBicmp_type=\fItype\fR
259 Matches ICMP message with \fItype\fR, which is specified as a decimal 
260 number between 0 and 255, inclusive.
261
262 .IP \fBicmp_code=\fIcode\fR
263 Matches ICMP messages with \fIcode\fR.
264
265 .PP
266 The following shorthand notations are also available:
267
268 .IP \fBip\fR
269 Same as \fBdl_type=0x0800\fR.
270
271 .IP \fBicmp\fR
272 Same as \fBdl_type=0x0800,nw_proto=1\fR.
273
274 .IP \fBtcp\fR
275 Same as \fBdl_type=0x0800,nw_proto=6\fR.
276
277 .IP \fBudp\fR
278 Same as \fBdl_type=0x0800,nw_proto=17\fR.
279
280 .IP \fBarp\fR
281 Same as \fBdl_type=0x0806\fR.
282
283 .PP
284 The \fBadd-flow\fR and \fBadd-flows\fR commands require an additional field:
285
286 .IP \fBactions=\fR[\fItarget\fR][\fB,\fItarget\fR...]\fR
287 Specifies a comma-separated list of actions to take on a packet when the 
288 flow entry matches.  If no \fItarget\fR is specified, then packets
289 matching the flow are dropped.  The \fItarget\fR may be a decimal port 
290 number designating the physical port on which to output the packet, or one 
291 of the following keywords:
292
293 .RS
294 .IP \fBoutput\fR:\fIport\fR
295 Outputs the packet on the port specified by \fIport\fR.
296
297 .IP \fBnormal\fR
298 Subjects the packet to the device's normal L2/L3 processing.  (This
299 action is not implemented by all OpenFlow switches.)
300
301 .IP \fBflood\fR
302 Outputs the packet on all switch physical ports other than the port on
303 which it was received and any ports on which flooding is disabled
304 (typically, these would be ports disabled by the IEEE 802.1D spanning
305 tree protocol).
306
307 .IP \fBall\fR
308 Outputs the packet on all switch physical ports other than the port on
309 which it was received.
310
311 .IP \fBcontroller\fR:\fImax_len\fR
312 Sends the packet to the OpenFlow controller as a ``packet in''
313 message.  If \fImax_len\fR is a number, then it specifies the maximum
314 number of bytes that should be sent.  If \fImax_len\fR is \fBALL\fR or
315 omitted, then the entire packet is sent.
316
317 .IP \fBlocal\fR
318 Outputs the packet on the ``local port,'' which corresponds to the
319 \fBof\fIn\fR network device (see \fBCONTACTING THE CONTROLLER\fR in
320 \fBovs\-openflowd\fR(8) for information on the \fBof\fIn\fR network device).
321
322 .IP \fBdrop\fR
323 Discards the packet, so no further processing or forwarding takes place.
324 If a drop action is used, no other actions may be specified.
325
326 .IP \fBmod_vlan_vid\fR:\fIvlan_vid\fR
327 Modifies the VLAN id on a packet.  The VLAN tag is added or modified 
328 as necessary to match the value specified.  If the VLAN tag is added,
329 a priority of zero is used (see the \fBmod_vlan_pcp\fR action to set
330 this).
331
332 .IP \fBmod_vlan_pcp\fR:\fIvlan_pcp\fR
333 Modifies the VLAN priority on a packet.  The VLAN tag is added or modified 
334 as necessary to match the value specified.  Valid values are between 0
335 (lowest) and 7 (highest).  If the VLAN tag is added, a vid of zero is used 
336 (see the \fBmod_vlan_vid\fR action to set this).
337
338 .IP \fBstrip_vlan\fR
339 Strips the VLAN tag from a packet if it is present.
340
341 .IP \fBmod_dl_src\fB:\fImac\fR
342 Sets the source Ethernet address to \fImac\fR.
343
344 .IP \fBmod_dl_dst\fB:\fImac\fR
345 Sets the destination Ethernet address to \fImac\fR.
346
347 .IP \fBmod_nw_src\fB:\fIip\fR
348 Sets the IPv4 source address to \fIip\fR.
349
350 .IP \fBmod_nw_dst\fB:\fIip\fR
351 Sets the IPv4 destination address to \fIip\fR.
352
353 .IP \fBmod_tp_src\fB:\fIport\fR
354 Sets the TCP or UDP source port to \fIport\fR.
355
356 .IP \fBmod_tp_dst\fB:\fIport\fR
357 Sets the TCP or UDP destination port to \fIport\fR.
358
359 .IP \fBmod_nw_tos\fB:\fItos\fR
360 Sets the IP ToS/DSCP field to \fItos\fR.  Valid values are between 0 and
361 255, inclusive.  Note that the two lower reserved bits are never
362 modified.
363
364 .RE
365
366 .IP
367 (The OpenFlow protocol supports other actions that \fBovs\-ofctl\fR does
368 not yet expose to the user.)
369
370 .PP
371 The \fBadd-flow\fR, \fBadd-flows\fR, and \fBdel-flows\fR commands
372 support an additional optional field:
373
374 .IP \fBpriority=\fIvalue\fR
375 The priority at which a wildcarded entry will match in comparison to
376 others.  \fIvalue\fR is a number between 0 and 65535, inclusive.  A higher 
377 \fIvalue\fR will match before a lower one.  An exact-match entry will always 
378 have priority over an entry containing wildcards, so it has an implicit 
379 priority value of 65535.  When adding a flow, if the field is not specified, 
380 the flow's priority will default to 32768.
381
382 .PP
383 The \fBadd-flow\fR and \fBadd-flows\fR commands support additional
384 optional fields:
385
386 .TP
387 \fBidle_timeout=\fIseconds\fR
388 Causes the flow to expire after the given number of seconds of
389 inactivity.  A value of 0 prevents a flow from expiring due to
390 inactivity.  The default is 60 seconds.
391
392 .IP \fBhard_timeout=\fIseconds\fR
393 Causes the flow to expire after the given number of seconds,
394 regardless of activity.  A value of 0 (the default) gives the flow no
395 hard expiration deadline.
396
397 .PP
398 The \fBdump-flows\fR, \fBdump-aggregate\fR, \fBdel-flow\fR 
399 and \fBdel-flows\fR commands support one additional optional field:
400
401 .TP
402 \fBout_port=\fIport\fR
403 If set, a matching flow must include an output action to \fIport\fR.
404
405 .PP
406 The \fBdump-flows\fR and \fBdump-aggregate\fR commands support an
407 additional optional field:
408
409 .IP \fBtable=\fInumber\fR
410 If specified, limits the flows about which statistics are gathered to
411 those in the table with the given \fInumber\fR.  Tables are numbered
412 as shown by the \fBdump-tables\fR command.
413
414 If this field is not specified, or if \fInumber\fR is given as
415 \fB255\fR, statistics are gathered about flows from all tables.
416
417 .SS "Table Entry Output"
418
419 The \fBdump-tables\fR and \fBdump-aggregate\fR commands print information 
420 about the entries in a datapath's tables.  Each line of output is a 
421 unique flow entry, which begins with some common information:
422
423 .IP \fBduration\fR
424 The number of seconds the entry has been in the table.
425
426 .IP \fBtable_id\fR
427 The table that contains the flow.  When a packet arrives, the switch 
428 begins searching for an entry at the lowest numbered table.  Tables are 
429 numbered as shown by the \fBdump-tables\fR command.
430
431 .IP \fBpriority\fR
432 The priority of the entry in relation to other entries within the same
433 table.  A higher value will match before a lower one.
434
435 .IP \fBn_packets\fR
436 The number of packets that have matched the entry.
437
438 .IP \fBn_bytes\fR
439 The total number of bytes from packets that have matched the entry.
440
441 .PP
442 The rest of the line consists of a description of the flow entry as 
443 described in \fBFlow Syntax\fR, above.
444
445
446 .SH OPTIONS
447 .TP
448 \fB--strict\fR
449 Uses strict matching when running flow modification commands.
450
451 .so lib/ssl.man
452 .so lib/vlog.man
453 .so lib/common.man
454
455 .SH EXAMPLES
456
457 The following examples assume that an OpenFlow switch on the local
458 host has been configured to listen for management connections on a
459 Unix domain socket named \fB@RUNDIR@/openflow.sock\fR, e.g. by
460 specifying \fB--listen=punix:@RUNDIR@/openflow.sock\fR on the
461 \fBovs\-openflowd\fR(8) command line.
462
463 .TP
464 \fBovs\-ofctl dump-tables unix:@RUNDIR@/openflow.sock\fR
465 Prints out the switch's table stats.  (This is more interesting after
466 some traffic has passed through.)
467
468 .TP
469 \fBovs\-ofctl dump-flows unix:@RUNDIR@/openflow.sock\fR
470 Prints the flow entries in the switch.
471
472 .SH "SEE ALSO"
473
474 .BR ovs\-appctl (8),
475 .BR ovs\-controller (8),
476 .BR ovs\-vswitchd (8)