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