]> git.proxmox.com Git - mirror_ovs.git/blame - utilities/ovs-vsctl.8.in
ovs-appctl: On failure, print the error message output by the server.
[mirror_ovs.git] / utilities / ovs-vsctl.8.in
CommitLineData
3b135da3
BP
1.\" -*- nroff -*-
2.de IQ
3. br
4. ns
5. IP "\\$1"
6..
5aa00635
JP
7.de ST
8. PP
9. RS -0.15in
10. I "\\$1"
11. RE
5aa00635 12..
3fbe1d30 13.TH ovs\-vsctl 8 "November 2009" "Open vSwitch" "Open vSwitch Manual"
812560d7 14.\" This program's name:
3b135da3 15.ds PN ovs\-vsctl
812560d7
BP
16.\" SSL peer program's name:
17.ds SN ovsdb\-server
3b135da3
BP
18.
19.SH NAME
20ovs\-vsctl \- utility for querying and configuring \fBovs\-vswitchd\fR
21.
22.SH SYNOPSIS
204bad29
BP
23\fBovs\-vsctl\fR [\fIoptions\fR] \fB\-\-\fR [\fIoptions\fR] \fIcommand
24\fR[\fIargs\fR] [\fB\-\-\fR [\fIoptions\fR] \fIcommand \fR[\fIargs\fR]]...
3b135da3
BP
25.
26.SH DESCRIPTION
dfbe07ba 27The \fBovs\-vsctl\fR program configures \fBovs\-vswitchd\fR(8) by
204bad29 28providing a high\-level interface to its configuration
dfbe07ba
BP
29database. This program is mainly intended for use when
30\fBovs\-vswitchd\fR is running. If it is used when
31\fBovs\-vswitchd\fR is not running, then \fB\-\-no\-wait\fR should be
32specified and configuration changes will only take effect when
33\fBovs\-vswitchd\fR is started.
3b135da3 34.PP
dfbe07ba
BP
35By default, each time \fBovs\-vsctl\fR runs, it connects to an
36\fBovsdb\-server\fR process that maintains an Open vSwitch
37configuration database. Using this connection, it queries and
38possibly applies changes to the database, depending on the supplied
39commands. Then, if it applied any changes, it waits until
40\fBovs\-vswitchd\fR has finished reconfiguring itself before it exits.
460aad80
BP
41.PP
42\fBovs\-vsctl\fR can perform any number of commands in a single run,
43implemented as a single atomic transaction against the database.
204bad29
BP
44.PP
45The \fBovs\-vsctl\fR command line begins with global options (see
46\fBOPTIONS\fR below for details). The global options are followed by
47one or more commands. Each command should begin with \fB\-\-\fR by
48itself as a command-line argument, to separate it from the global
49options and following commands. (If the first command does not have
50any options, then the first \fB\-\-\fR may be omitted.) The command
51itself starts with command-specific options, if any, followed by the
52command name and any arguments. See \fBEXAMPLES\fR below for syntax
53examples.
3b135da3
BP
54.
55.SS "Linux VLAN Bridging Compatibility"
56The \fBovs\-vsctl\fR program supports the model of a bridge
57implemented by Open vSwitch, in which a single bridge supports ports
58on multiple VLANs. In this model, each port on a bridge is either a
59trunk port that potentially passes packets tagged with 802.1Q headers
60that designate VLANs or it is assigned a single implicit VLAN that is
61never tagged with an 802.1Q header.
62.PP
63For compatibility with software designed for the Linux bridge,
64\fBovs\-vsctl\fR also supports a model in which traffic associated
65with a given 802.1Q VLAN is segregated into a separate bridge. A
66special form of the \fBadd\-br\fR command (see below) creates a ``fake
67bridge'' within an Open vSwitch bridge to simulate this behavior.
68When such a ``fake bridge'' is active, \fBovs\-vsctl\fR will treat it
69much like a bridge separate from its ``parent bridge,'' but the actual
70implementation in Open vSwitch uses only a single bridge, with ports on
71the fake bridge assigned the implicit VLAN of the fake bridge of which
72they are members.
73.
74.SH OPTIONS
75.
460aad80
BP
76The following options affect the behavior \fBovs\-vsctl\fR as a whole.
77Some individual commands also accept their own options, which are
78given just before the command name. If the first command on the
79command line has options, then those options must be separated from
80the global options by \fB\-\-\fR.
3b135da3 81.
dfbe07ba
BP
82.IP "\fB\-\-db=\fIserver\fR"
83Sets \fIserver\fR as the database server that \fBovs\-vsctl\fR
84contacts to query or modify configuration. The default is
bc391960 85\fBunix:@RUNDIR@/db.sock\fR. \fIserver\fR must take one of the
dfbe07ba
BP
86following forms:
87.RS
9467fe62 88.so ovsdb/remote-active.man
c9f3f37a 89.so ovsdb/remote-passive.man
dfbe07ba 90.RE
9467fe62 91.
dfbe07ba
BP
92.IP "\fB\-\-no\-wait\fR"
93Prevents \fBovs\-vsctl\fR from waiting for \fBovs\-vswitchd\fR to
94reconfigure itself according to the the modified database. This
95option should be used if \fBovs\-vswitchd\fR is not running;
4e312e69 96otherwise, \fBovs\-vsctl\fR will not exit until \fBovs\-vswitchd\fR
dfbe07ba 97starts.
3b135da3 98.IP
dfbe07ba
BP
99This option has no effect if the commands specified do not change the
100database.
3b135da3 101.
37c84020
BP
102.IP "\fB\-\-no\-syslog\fR"
103By default, \fBovs\-vsctl\fR logs its arguments and the details of any
104changes that it makes to the system log. This option disables this
105logging.
dfbe07ba
BP
106.IP
107This option is equivalent to \fB\-\-verbose=vvsctl:syslog:warn\fR.
108.
2792c2ad 109.IP "\fB\-\-oneline\fR"
4d14e30f 110Modifies the output format so that the output for each command is printed
2792c2ad 111on a single line. New-line characters that would otherwise separate
4d14e30f 112lines are printed as \fB\\n\fR, and any instances of \fB\\\fR that
2792c2ad 113would otherwise appear in the output are doubled.
4d14e30f 114Prints a blank line for each command that has no output.
37c84020 115.
577aebdf
BP
116.IP "\fB\-\-dry\-run\fR"
117Prevents \fBovs\-vsctl\fR from actually modifying the database.
118.
4e312e69
BP
119.IP "\fB\-t \fIsecs\fR"
120.IQ "\fB\-\-timeout=\fIsecs\fR"
6b7b9d34
BP
121By default, or with a \fIsecs\fR of \fB0\fR, \fBovs\-vsctl\fR waits
122forever for a response from the database. This option limits runtime
123to approximately \fIsecs\fR seconds. If the timeout expires,
124\fBovs\-vsctl\fR will exit with a \fBSIGALRM\fR signal. (A timeout
125would normally happen only if the database cannot be contacted, or if
126the system is overloaded.)
342045e1 127.
ac300505 128.SS "Public Key Infrastructure Options"
84ee7bcf 129.so lib/ssl.man
812560d7
BP
130.so lib/ssl-bootstrap.man
131.so lib/ssl-peer-ca-cert.man
dfbe07ba
BP
132.so lib/vlog.man
133.
3b135da3
BP
134.SH COMMANDS
135The commands implemented by \fBovs\-vsctl\fR are described in the
136sections below.
524555d1
BP
137.SS "Open vSwitch Commands"
138These commands work with an Open vSwitch as a whole.
139.
140.IP "\fBinit\fR"
141Initializes the Open vSwitch database, if it is empty. If the
142database has already been initialized, this command has no effect.
143.IP
144Any successful \fBovs\-vsctl\fR command automatically initializes the
145Open vSwitch database if it is empty. This command is provided to
146initialize the database without executing any other command.
3b135da3 147.
18ee958b 148.IP "\fBemer\-reset\fR"
26b31540
BP
149Reset the configuration into a clean state. It deconfigures OpenFlow
150controllers, OVSDB servers, and SSL, and deletes port mirroring,
151NetFlow, and sFlow configuration. This command also removes all
152\fBother\-config\fR keys from all database records, except that
4e312e69 153\fBother\-config:hwaddr\fR is preserved if it is present in a Bridge
26b31540 154record. Other networking configuration is left as-is.
18ee958b 155.
3b135da3
BP
156.SS "Bridge Commands"
157These commands examine and manipulate Open vSwitch bridges.
158.
aeee85aa 159.IP "[\fB\-\-may\-exist\fR] \fBadd\-br \fIbridge\fR"
3b135da3
BP
160Creates a new bridge named \fIbridge\fR. Initially the bridge will
161have no ports (other than \fIbridge\fR itself).
aeee85aa
BP
162.IP
163Without \fB\-\-may\-exist\fR, attempting to create a bridge that
164exists is an error. With \fB\-\-may\-exist\fR, \fIbridge\fR may
165already exist (but it must be a real bridge, not a VLAN bridge).
3b135da3 166.
aeee85aa 167.IP "[\fB\-\-may\-exist\fR] \fBadd\-br \fIbridge parent vlan\fR"
3b135da3
BP
168Creates a ``fake bridge'' named \fIbridge\fR within the existing Open
169vSwitch bridge \fIparent\fR, which must already exist and must not
170itself be a fake bridge. The new fake bridge will be on 802.1Q VLAN
171\fIvlan\fR, which must be an integer between 1 and 4095. Initially
172\fIbridge\fR will have no ports (other than \fIbridge\fR itself).
aeee85aa
BP
173.IP
174Without \fB\-\-may\-exist\fR, attempting to create a bridge that
175exists is an error. With \fB\-\-may\-exist\fR, \fIbridge\fR may
176already exist (but it must have the specified \fIvlan\fR and
177\fIparent\fR).
3b135da3 178.
460aad80 179.IP "[\fB\-\-if\-exists\fR] \fBdel\-br \fIbridge\fR"
3b135da3
BP
180Deletes \fIbridge\fR and all of its ports. If \fIbridge\fR is a real
181bridge, this command also deletes any fake bridges that were created
182with \fIbridge\fR as parent, including all of their ports.
460aad80
BP
183.IP
184Without \fB\-\-if\-exists\fR, attempting to delete a bridge that does
185not exist is an error. With \fB\-\-if\-exists\fR, attempting to
186delete a bridge that does not exist has no effect.
3b135da3
BP
187.
188.IP "\fBlist\-br\fR"
189Lists all existing real and fake bridges on standard output, one per
190line.
191.
192.IP "\fBbr\-exists \fIbridge\fR"
193Tests whether \fIbridge\fR exists as a real or fake bridge. If so,
194\fBovs\-vsctl\fR exits successfully with exit code 0. If not,
195\fBovs\-vsctl\fR exits unsuccessfully with exit code 2.
196.
8e58fa9a
BP
197.IP "\fBbr\-to\-vlan \fIbridge\fR"
198If \fIbridge\fR is a fake bridge, prints the bridge's 802.1Q VLAN as a
199decimal integer. If \fIbridge\fR is a real bridge, prints 0.
200.
201.IP "\fBbr\-to\-parent \fIbridge\fR"
202If \fIbridge\fR is a fake bridge, prints the name of its parent
203bridge. If \fIbridge\fR is a real bridge, print \fIbridge\fR.
204.
457e1eb0
BP
205.IP "\fBbr\-set\-external\-id \fIbridge key\fR [\fIvalue\fR]"
206Sets or clears an ``external ID'' value on \fIbridge\fR. These values
207are intended to identify entities external to Open vSwitch with which
208\fIbridge\fR is associated, e.g. the bridge's identifier in a
209virtualization management platform. The Open vSwitch database schema
210specifies well-known \fIkey\fR values, but \fIkey\fR and \fIvalue\fR
211are otherwise arbitrary strings.
212.IP
213If \fIvalue\fR is specified, then \fIkey\fR is set to \fIvalue\fR for
214\fIbridge\fR, overwriting any previous value. If \fIvalue\fR is
215omitted, then \fIkey\fR is removed from \fIbridge\fR's set of external
216IDs (if it was present).
e328faad
BP
217.IP
218For real bridges, the effect of this command is similar to that of a
219\fBset\fR or \fBremove\fR command in the \fBexternal\-ids\fR column of
220the \fBBridge\fR table. For fake bridges, it actually modifies keys
221with names prefixed by \fBfake\-bridge\-\fR in the \fBPort\fR table.
457e1eb0
BP
222.
223.IP "\fBbr\-get\-external\-id \fIbridge\fR [\fIkey\fR]"
224Queries the external IDs on \fIbridge\fR. If \fIkey\fR is specified,
225the output is the value for that \fIkey\fR or the empty string if
226\fIkey\fR is unset. If \fIkey\fR is omitted, the output is
227\fIkey\fB=\fIvalue\fR, one per line, for each key-value pair.
e328faad
BP
228.IP
229For real bridges, the effect of this command is similar to that of a
230\fBget\fR command in the \fBexternal\-ids\fR column of the
231\fBBridge\fR table. For fake bridges, it queries keys with names
232prefixed by \fBfake\-bridge\-\fR in the \fBPort\fR table.
457e1eb0 233.
3b135da3
BP
234.SS "Port Commands"
235.
236These commands examine and manipulate Open vSwitch ports. These
237commands treat a bonded port as a single entity.
238.
239.IP "\fBlist\-ports \fIbridge\fR"
240Lists all of the ports within \fIbridge\fR on standard output, one per
241line. The local port \fIbridge\fR is not included in the list.
242.
18b239f5 243.IP "[\fB\-\-may\-exist\fR] \fBadd\-port \fIbridge port \fR[\fIcolumn\fR[\fB:\fIkey\fR]\fR=\fIvalue\fR]\&...\fR"
3b135da3
BP
244Creates on \fIbridge\fR a new port named \fIport\fR from the network
245device of the same name.
bb1c67c8 246.IP
18b239f5
BP
247Optional arguments set values of column in the Port record created by
248the command. For example, \fBtag=9\fR would make the port an access
249port for VLAN 9. The syntax is the same as that for the \fBset\fR
250command (see \fBDatabase Commands\fR below).
251.IP
bb1c67c8
BP
252Without \fB\-\-may\-exist\fR, attempting to create a port that exists
253is an error. With \fB\-\-may\-exist\fR, \fIport\fR may already exist
254(but it must be on \fIbridge\fR and not be a bonded port).
3b135da3 255.
18b239f5 256.IP "[\fB\-\-fake\-iface\fR] \fBadd\-bond \fIbridge port iface\fR\&... [\fIcolumn\fR[\fB:\fIkey\fR]\fR=\fIvalue\fR]\&...\fR"
3b135da3
BP
257Creates on \fIbridge\fR a new port named \fIport\fR that bonds
258together the network devices given as each \fIiface\fR. At least two
259interfaces must be named.
b4182c7f 260.IP
18b239f5
BP
261Optional arguments set values of column in the Port record created by
262the command. The syntax is the same as that for the \fBset\fR command
263(see \fBDatabase Commands\fR below).
264.IP
b4182c7f
JP
265With \fB\-\-fake\-iface\fR, a fake interface with the name \fIport\fR is
266created. This should only be used for compatibility with legacy
267software that requires it.
bb1c67c8
BP
268.IP
269Without \fB\-\-may\-exist\fR, attempting to create a port that exists
270is an error. With \fB\-\-may\-exist\fR, \fIport\fR may already exist
271(but it must be on \fIbridge\fR and bond together exactly the
272specified interface).
3b135da3 273.
460aad80 274.IP "[\fB\-\-if\-exists\fR] \fBdel\-port \fR[\fIbridge\fR] \fIport\fR"
3d1b9636
BP
275Deletes \fIport\fR. If \fIbridge\fR is omitted, \fIport\fR is removed
276from whatever bridge contains it; if \fIbridge\fR is specified, it
277must be the real or fake bridge that contains \fIport\fR.
460aad80
BP
278.IP
279Without \fB\-\-if\-exists\fR, attempting to delete a port that does
280not exist is an error. With \fB\-\-if\-exists\fR, attempting to
281delete a port that does not exist has no effect.
3b135da3 282.
7c79588e
BP
283.IP "[\fB\-\-if\-exists\fR] \fB\-\-with\-iface del\-port \fR[\fIbridge\fR] \fIiface\fR"
284Deletes the port named \fIiface\fR or that has an interface named
285\fIiface\fR. If \fIbridge\fR is omitted, the port is removed from
286whatever bridge contains it; if \fIbridge\fR is specified, it must be
287the real or fake bridge that contains the port.
288.IP
289Without \fB\-\-if\-exists\fR, attempting to delete the port for an
290interface that does not exist is an error. With \fB\-\-if\-exists\fR,
291attempting to delete the port for an interface that does not exist has
292no effect.
293.
3b135da3
BP
294.IP "\fBport\-to\-br \fIport\fR"
295Prints the name of the bridge that contains \fIport\fR on standard
296output.
297.
298.SS "Interface Commands"
299.
300These commands examine the interfaces attached to an Open vSwitch
301bridge. These commands treat a bonded port as a collection of two or
302more interfaces, rather than as a single port.
303.
304.IP "\fBlist\-ifaces \fIbridge\fR"
305Lists all of the interfaces within \fIbridge\fR on standard output,
306one per line. The local port \fIbridge\fR is not included in the
307list.
308.
309.IP "\fBiface\-to\-br \fIiface\fR"
310Prints the name of the bridge that contains \fIiface\fR on standard
311output.
457e1eb0 312.
5aa00635
JP
313.SS "OpenFlow Controller Connectivity"
314.
315\fBovs\-vswitchd\fR can perform all configured bridging and switching
76ce9432
BP
316locally, or it can be configured to connect a given bridge to one or
317more external OpenFlow controllers, such as NOX.
5aa00635 318.
1a048029 319.IP "\fBget\-controller\fR \fIbridge\fR"
5aa00635
JP
320Prints the configured controller target.
321.
1a048029 322.IP "\fBdel\-controller\fR \fIbridge\fR"
5aa00635
JP
323Deletes the configured controller target.
324.
1a048029
JP
325.IP "\fBset\-controller\fR \fIbridge\fR \fItarget\fR\&..."
326Sets the configured controller target or targets. Each \fItarget\fR may
327use any of the following forms:
5aa00635
JP
328.
329.RS
84ee7bcf 330.so lib/vconn-active.man
5aa00635 331.RE
84ee7bcf 332.
5aa00635 333.ST "Controller Failure Settings"
89365653 334.PP
5aa00635
JP
335When a controller is configured, it is, ordinarily, responsible for
336setting up all flows on the switch. Thus, if the connection to
337the controller fails, no new network connections can be set up. If
338the connection to the controller stays down long enough, no packets
339can pass through the switch at all.
63f08492 340.PP
5aa00635
JP
341If the value is \fBstandalone\fR, or if neither of these settings
342is set, \fBovs\-vswitchd\fR will take over
343responsibility for setting up
344flows when no message has been received from the controller for three
345times the inactivity probe interval (xxx needs to be exposed). In this mode,
346\fBovs\-vswitchd\fR causes the datapath to act like an ordinary
347MAC-learning switch. \fBovs\-vswitchd\fR will continue to retry connecting
348to the controller in the background and, when the connection succeeds,
349it discontinues its standalone behavior.
63f08492 350.PP
5aa00635
JP
351If this option is set to \fBsecure\fR, \fBovs\-vswitchd\fR will not
352set up flows on its own when the controller connection fails.
353.
1a048029 354.IP "\fBget\-fail\-mode\fR \fIbridge\fR"
5aa00635
JP
355Prints the configured failure mode.
356.
1a048029 357.IP "\fBdel\-fail\-mode\fR \fIbridge\fR"
5aa00635
JP
358Deletes the configured failure mode.
359.
1a048029 360.IP "\fBset\-fail\-mode\fR \fIbridge\fR \fBstandalone\fR|\fBsecure\fR"
5aa00635
JP
361Sets the configured failure mode.
362.
dd8ac6fe
JP
363.SS "SSL Configuration"
364When \fBovs\-vswitchd\fR is configured to connect over SSL for management or
365controller connectivity, the following parameters are required:
366.TP
4e312e69 367\fBprivate\-key\fR
dd8ac6fe
JP
368Specifies a PEM file containing the private key used as the virtual
369switch's identity for SSL connections to the controller.
370.TP
371\fBcertificate\fR
372Specifies a PEM file containing a certificate, signed by the
373certificate authority (CA) used by the controller and manager, that
374certifies the virtual switch's private key, identifying a trustworthy
375switch.
376.TP
4e312e69 377\fBca\-cert\fR
dd8ac6fe
JP
378Specifies a PEM file containing the CA certificate used to verify that
379the virtual switch is connected to a trustworthy controller.
380.PP
381These files are read only once, at \fBovs\-vswitchd\fR startup time. If
382their contents change, \fBovs\-vswitchd\fR must be killed and restarted.
383.PP
384These SSL settings apply to all SSL connections made by the virtual
385switch.
386.
387.IP "\fBget\-ssl\fR"
388Prints the SSL configuration.
389.
390.IP "\fBdel\-ssl\fR"
391Deletes the current SSL configuration.
392.
393.IP "[\fB\-\-bootstrap\fR] \fBset\-ssl\fR \fIprivate-key\fR \fIcertificate\fR \fIca-cert\fR"
394Sets the SSL configuration. The \fB\-\-bootstrap\fR option is described
395below.
396.
397.ST "CA Certificate Bootstrap"
89365653 398.PP
dd8ac6fe
JP
399Ordinarily, all of the files named in the SSL configuration must exist
400when \fBovs\-vswitchd\fR starts. However, if the \fB\-\-bootstrap\fR
401option is given, then \fBovs\-vswitchd\fR will attempt to obtain the
402CA certificate from the controller on its first SSL connection and
403save it to the named PEM file. If it is successful, it will
404immediately drop the connection and reconnect, and from then on all
405SSL connections must be authenticated by a certificate signed by the
406CA certificate thus obtained.
407.PP
408\fBThis option exposes the SSL connection to a man-in-the-middle
409attack obtaining the initial CA certificate\fR, but it may be useful
410for bootstrapping.
411.PP
412This option is only useful if the controller sends its CA certificate
413as part of the SSL certificate chain. The SSL protocol does not
414require the controller to send the CA certificate, but
a946ed39 415\fBovs\-controller\fR(8) can be configured to do so with the
4e312e69 416\fB\-\-peer\-ca\-cert\fR option.
dd8ac6fe 417.
ad83bfa6
BP
418.SS "Database Commands"
419.
420These commands query and modify the contents of \fBovsdb\fR tables.
421They are a slight abstraction of the \fBovsdb\fR interface and as such
422they operate at a lower level than other \fBovs\-vsctl\fR commands.
423.PP
424.ST "Identifying Tables, Records, and Columns"
425.PP
426Each of these commands has a \fItable\fR parameter to identify a table
427within the database. Many of them also take a \fIrecord\fR parameter
428that identifies a particular record within a table. The \fIrecord\fR
429parameter may be the UUID for a record, and many tables offer
430additional ways to identify records. Some commands also take
431\fIcolumn\fR parameters that identify a particular field within the
432records in a table.
433.PP
434The following tables are currently defined:
435.IP "\fBOpen_vSwitch\fR"
436Global configuration for an \fBovs\-vswitchd\fR. This table contains
437exactly one record, identified by specifying \fB.\fR as the record
438name.
439.IP "\fBBridge\fR"
440Configuration for a bridge within an Open vSwitch. Records may be
441identified by bridge name.
442.IP "\fBPort\fR"
443A bridge port. Records may be identified by port name.
444.IP "\fBInterface\fR"
445A network device attached to a port. Records may be identified by
446name.
ef1e753e
BP
447.IP "\fBMirror\fR"
448A port mirroring configuration attached to a bridge. Records may be
449identified by mirror name.
ad83bfa6
BP
450.IP "\fBController\fR"
451Configuration for an OpenFlow controller. A controller attached to a
1a048029 452particular bridge may be identified by the bridge's name.
94db5407
BP
453.IP "\fBManager\fR"
454Configuration for an OVSDB connection. Records may be identified
455by target (e.g. \fBtcp:1.2.3.4\fR).
ad83bfa6
BP
456.IP "\fBNetFlow\fR"
457A NetFlow configuration attached to a bridge. Records may be
ef1e753e
BP
458identified by bridge name.
459.IP "\fBSSL\fR"
460The global SSL configuration for \fBovs\-vswitchd\fR. The record
461attached to the \fBOpen_vSwitch\fR table may be identified by
462specifying \fB.\fR as the record name.
463.IP "\fBsFlow\fR"
464An sFlow configuration attached to a bridge. Records may be
ad83bfa6 465identified by bridge name.
b31bcf60
EJ
466.IP "\fBMonitor\fR"
467Connectivity Monitoring attached to an interface. Records may be
468identified by interface name.
469.IP "\fBMaintenance_Point\fR"
470Maintenance Point managed by a Monitor.
ad83bfa6 471.PP
e111e681
BP
472Record names must be specified in full and with correct
473capitalization. Names of tables and columns are not case-sensitive,
474and \fB\-\-\fR and \fB_\fR are treated interchangeably. Unique
5de48440 475abbreviations are acceptable, e.g. \fBnet\fR or \fBn\fR is sufficient
ad83bfa6
BP
476to identify the \fBNetFlow\fR table.
477.
478.ST "Database Values"
89365653 479.PP
ad83bfa6
BP
480Each column in the database accepts a fixed type of data. The
481currently defined basic types, and their representations, are:
482.IP "integer"
483A decimal integer in the range \-2**63 to 2**63\-1, inclusive.
484.IP "real"
485A floating-point number.
486.IP "Boolean"
487True or false, written \fBtrue\fR or \fBfalse\fR, respectively.
488.IP "string"
489An arbitrary Unicode string, except that null bytes are not allowed.
490Quotes are optional for most strings that begin with an English letter
491or underscore and consist only of letters, underscores, hyphens, and
492periods. However, \fBtrue\fR and \fBfalse\fR and strings that match
493the syntax of UUIDs (see below) must be enclosed in double quotes to
494distinguish them from other basic types. When double quotes are used,
495the syntax is that of strings in JSON, e.g. backslashes may be used to
496escape special characters. The empty string must be represented as a
497pair of double quotes (\fB""\fR).
498.IP "UUID"
ce5a3e38
BP
499Either a universally unique identifier in the style of RFC 4122,
500e.g. \fBf81d4fae\-7dec\-11d0\-a765\-00a0c91e6bf6\fR, or an \fB@\fIname\fR
aed133bf 501defined by a \fBget\fR or \fBcreate\fR command within the same \fBovs\-vsctl\fR
ce5a3e38 502invocation.
ad83bfa6
BP
503.PP
504Multiple values in a single column may be separated by spaces or a
505single comma. When multiple values are present, duplicates are not
506allowed, and order is not important. Conversely, some database
507columns can have an empty set of values, represented as \fB[]\fR, and
508square brackets may optionally enclose other non-empty sets or single
509values as well.
510.PP
511A few database columns are ``maps'' of key-value pairs, where the key
512and the value are each some fixed database type. These are specified
513in the form \fIkey\fB=\fIvalue\fR, where \fIkey\fR and \fIvalue\fR
514follow the syntax for the column's key type and value type,
515respectively. When multiple pairs are present (separated by spaces or
516a comma), duplicate keys are not allowed, and again the order is not
517important. Duplicate values are allowed. An empty map is represented
518as \fB{}\fR, and curly braces may be optionally enclose non-empty maps
519as well.
520.
521.ST "Database Command Syntax"
ad83bfa6
BP
522.IP "\fBlist \fItable \fR[\fIrecord\fR]..."
523List the values of all columns of each specified \fIrecord\fR. If no
524records are specified, lists all the records in \fItable\fR.
3ef917b5
BP
525.IP
526The UUIDs shown for rows created in the same \fBovs\-vsctl\fR
527invocation will be wrong.
ad83bfa6 528.
aed133bf 529.IP "[\fB\-\-id=@\fIname\fR] [\fB\-\-if\-exists\fR] \fBget \fItable record \fR[\fIcolumn\fR[\fB:\fIkey\fR]]..."
ad83bfa6
BP
530Prints the value of each specified \fIcolumn\fR in the given
531\fIrecord\fR in \fItable\fR. For map columns, a \fIkey\fR may
532optionally be specified, in which case the value associated with
533\fIkey\fR in the column is printed, instead of the entire map.
870aeb4a
BP
534.IP
535For a map column, without \fB\-\-if\-exists\fR it is an error if
536\fIkey\fR does not exist; with it, a blank line is printed. If
537\fIcolumn\fR is not a map column or if \fIkey\fR is not specified,
538\fB\-\-if\-exists\fR has no effect.
aed133bf
BP
539.IP
540If \fB@\fIname\fR is specified, then the UUID for \fIrecord\fR may be
541referred to by that name later in the same \fBovs\-vsctl\fR
542invocation in contexts where a UUID is expected.
ad83bfa6 543.
bd76d25d 544.IP "\fBset \fItable record column\fR[\fB:\fIkey\fR]\fB=\fIvalue\fR..."
ad83bfa6
BP
545Sets the value of each specified \fIcolumn\fR in the given
546\fIrecord\fR in \fItable\fR to \fIvalue\fR. For map columns, a
547\fIkey\fR may optionally be specified, in which case the value
548associated with \fIkey\fR in that column is changed (or added, if none
549exists), instead of the entire map.
550.
bd76d25d 551.IP "\fBadd \fItable record column \fR[\fIkey\fB=\fR]\fIvalue\fR..."
ad83bfa6
BP
552Adds the specified value or key-value pair to \fIcolumn\fR in
553\fIrecord\fR in \fItable\fR. If \fIcolumn\fR is a map, then \fIkey\fR
554is required, otherwise it is prohibited. If \fIkey\fR already exists
555in a map column, then the current \fIvalue\fR is not replaced (use the
556\fBset\fR command to replace an existing value).
90c4bd00 557.
bd76d25d
BP
558.IP "\fBremove \fItable record column \fR\fIvalue\fR..."
559.IQ "\fBremove \fItable record column \fR\fIkey\fR..."
560.IQ "\fBremove \fItable record column \fR\fIkey\fB=\fR\fIvalue\fR..."
90c4bd00
BP
561Removes the specified values or key-value pairs from \fIcolumn\fR in
562\fIrecord\fR in \fItable\fR. The first form applies to columns that
563are not maps: each specified \fIvalue\fR is removed from the column.
564The second and third forms apply to map columns: if only a \fIkey\fR
565is specified, then any key-value pair with the given \fIkey\fR is
566removed, regardless of its value; if a \fIvalue\fR is given then a
567pair is removed only if both key and value match.
568.IP
569It is not an error if the column does not contain the specified key or
570value or pair.
571.
bd76d25d 572.IP "\fBclear\fR \fItable record column\fR..."
90c4bd00
BP
573Sets each \fIcolumn\fR in \fIrecord\fR in \fItable\fR to the empty set
574or empty map, as appropriate. This command applies only to columns
575that are allowed to be empty.
576.
4e312e69 577.IP "[\fB\-\-id=@\fIname\fR] \fBcreate\fR \fItable column\fR[\fB:\fIkey\fR]\fB=\fIvalue\fR..."
557e3718
BP
578Creates a new record in \fItable\fR and sets the initial values of
579each \fIcolumn\fR. Columns not explicitly set will receive their
3ef917b5 580default values. Outputs the UUID of the new row.
ce5a3e38
BP
581.IP
582If \fB@\fIname\fR is specified, then the UUID for the new row may be
583referred to by that name elsewhere in the same \fBovs\-vsctl\fR
584invocation in contexts where a UUID is expected. Such references may
585precede or follow the \fBcreate\fR command.
b7f74b6f 586.
0d0f05b9 587.IP "\fR[\fB\-\-if\-exists\fR] \fBdestroy \fItable record\fR..."
b7f74b6f
BP
588Deletes each specified \fIrecord\fR from \fItable\fR. Unless
589\fB\-\-if\-exists\fR is specified, each \fIrecord\fRs must exist.
7db03f7c
BP
590.
591.IP "\fBwait\-until \fItable record \fR[\fIcolumn\fR[\fB:\fIkey\fR]\fB=\fIvalue\fR]..."
592Waits until \fItable\fR contains a record named \fIrecord\fR whose
593\fIcolumn\fR equals \fIvalue\fR or, if \fIkey\fR is specified, whose
594\fIcolumn\fR contains a \fIkey\fR with the specified \fIvalue\fR. Any
595of the operators \fB!=\fR, \fB<\fR, \fB>\fR, \fB<=\fR, or \fB>=\fR may
596be substituted for \fB=\fR to test for inequality, less than, greater
597than, less than or equal to, or greater than or equal to,
598respectively. (Don't forget to escape \fB<\fR or \fB>\fR from
599interpretation by the shell.)
600.IP
601If no \fIcolumn\fR[\fB:\fIkey\fR]\fB=\fIvalue\fR arguments are given,
602this command waits only until \fIrecord\fR exists. If more than one
603such argument is given, the command waits until all of them are
604satisfied.
605.IP
606Usually \fBwait\-until\fR should be placed at the beginning of a set
607of \fBovs\-vsctl\fR commands. For example, \fBwait\-until bridge br0
608\-\- get bridge br0 datapath_id\fR waits until a bridge named
609\fBbr0\fR is created, then prints its \fBdatapath_id\fR column,
610whereas \fBget bridge br0 datapath_id \-\- wait\-until bridge br0\fR
611will abort if no bridge named \fBbr0\fR exists when \fBovs\-vsctl\fR
612initially connects to the database.
613.IP
7db03f7c
BP
614Consider specifying \fB\-\-timeout=0\fR along with
615\fB\-\-wait\-until\fR, to prevent \fBovs\-vsctl\fR from terminating
616after waiting only at most 5 seconds.
4d14e30f
BP
617.SH "EXAMPLES"
618Create a new bridge named br0 and add port eth0 to it:
619.IP
4e312e69 620.B "ovs\-vsctl add\-br br0"
4d14e30f 621.br
4e312e69 622.B "ovs\-vsctl add\-port br0 eth0"
4d14e30f
BP
623.PP
624Alternatively, perform both operations in a single atomic transaction:
625.IP
4e312e69 626.B "ovs\-vsctl add\-br br0 \-\- add\-port br0 eth0"
460aad80
BP
627.PP
628Delete bridge \fBbr0\fR, reporting an error if it does not exist:
629.IP
630.B "ovs\-vsctl del\-br br0"
631.PP
632Delete bridge \fBbr0\fR if it exists (the \fB\-\-\fR is required to
633separate \fBdel\-br\fR's options from the global options):
634.IP
635.B "ovs\-vsctl \-\- \-\-if\-exists del\-br br0"
ce5a3e38
BP
636.PP
637Set the \fBqos\fR column of the \fBPort\fR record for \fBeth0\fR to
638point to a new \fBQoS\fR record, which in turn points with its queue 0
639to a new \fBQueue\fR record:
640.IP
4e312e69 641.B "ovs\-vsctl \-\- set port eth0 qos=@newqos \-\- \-\-id=@newqos create qos type=linux\-htb other\-config:max\-rate=1000000 queues:0=@newqueue \-\- \-\-id=@newqueue create queue other\-config:min\-rate=1000000 other\-config:max\-rate=1000000"
bad973d7
BP
642.SH "CONFIGURATION COOKBOOK"
643.SS "Port Configuration"
644.PP
645Add an ``internal port'' \fBvlan10\fR to bridge \fBbr0\fR as a VLAN
646access port for VLAN 10, and configure it with an IP address:
647.IP
648.B "ovs\-vsctl add\-port br0 vlan10 tag=10 \-\- set Interface vlan10 type=internal"
649.IP
650.B "ifconfig vlan10 192.168.0.123"
3b135da3 651.
bad973d7
BP
652.SS "Port Mirroring"
653.PP
654Mirror all packets received or sent on \fBeth0\fR or \fBeth1\fR onto
655\fBeth2\fR, assuming that all of those ports exist on bridge \fBbr0\fR
656(as a side-effect this causes any packets received on \fBeth2\fR to be
657ignored):
658.IP
659.B "ovs\-vsctl \-\- set Bridge br0 mirrors=@m \(rs"
660.IP
661.B "\-\- \-\-id=@eth0 get Port eth0 \(rs"
662.IP
663.B "\-\- \-\-id=@eth1 get Port eth1 \(rs"
664.IP
665.B "\-\- \-\-id=@eth2 get Port eth2 \(rs"
666.IP
667.B "\-\- \-\-id=@m create Mirror name=mymirror select-dst-port=@eth0,@eth1 select-src-port=@eth0,@eth1 output-port=@eth2"
668.PP
669Remove the mirror created above from \fBbr0\fR and destroy the Mirror
670record (to avoid having an unreferenced record in the database):
671.IP
672.B "ovs\-vsctl destroy Mirror mymirror \-\- clear Bridge br0 mirrors"
673.SS "Quality of Service (QoS)"
674.PP
675Create a \fBlinux\-htb\fR QoS record that points to a few queues and
676use it on \fBeth0\fR and \fBeth1\fR:
677.IP
678.B "ovs\-vsctl \-\- set Port eth0 qos=@newqos \(rs"
679.IP
680.B "\-\- set Port eth1 qos=@newqos \(rs"
681.IP
682.B "\-\- \-\-id=@newqos create QoS type=linux\-htb other\-config:max\-rate=1000000000 queues=0=@q0,1=@q1 \(rs"
683.IP
684.B "\-\- \-\-id=@q0 create Queue other\-config:min\-rate=100000000 other\-config:max\-rate=100000000 \(rs"
685.IP
686.B "\-\- \-\-id=@q1 create Queue other\-config:min\-rate=500000000"
687.PP
688Deconfigure the QoS record above from \fBeth1\fR only:
689.IP
690.B "ovs\-vsctl clear Port eth1 qos"
691.PP
692To deconfigure the QoS record from both \fBeth0\fR and \fBeth1\fR and
693then delete the QoS record:
694.IP
695.B "ovs\-vsctl \-\- destroy QoS eth0 \-\- clear Port eth0 qos \-\- clear Port eth1 qos"
696.PP
697(This command will leave two unreferenced Queue records in the
698database. To delete them, use "\fBovs\-vsctl list Queue\fR" to find
699their UUIDs, then "\fBovs\-vsctl destroy Queue \fIuuid1\fR
700\fIuuid2\fR" to destroy each of them.)
b31bcf60
EJ
701.SS "Connectivity Monitoring"
702.PP
703Create a Monitor which manages a couple of remote Maintenance Points on eth0.
704.IP
705.B "ovs\-vsctl \-\- set Interface eth0 Monitor=@newmon \(rs"
706.IP
707.B "\-\- \-\-id=@newmon create Monitor mpid=1 remote_mps=@mp2,@mp3 \(rs"
708.IP
709.B "\-\- \-\-id=@mp2 create Maintenance_Point mpid=2 \(rs"
710.IP
711.B "\-\- \-\-id=@mp3 create Maintenance_Point mpid=3"
712.PP
713Deconfigure the Monitor record from above:
714.IP
715.B "ovs\-vsctl clear Interface eth0 Monitor"
bad973d7
BP
716.SS "NetFlow"
717.PP
718Configure bridge \fBbr0\fR to send NetFlow records to UDP port 5566 on
719host 192.168.0.34, with an active timeout of 30 seconds:
720.IP
721.B "ovs\-vsctl \-\- set Bridge br0 netflow=@nf \(rs"
722.IP
723.B "\-\- \-\-id=@nf create NetFlow targets=\(rs\(dq192.168.0.34:5566\(rs\(dq active\-timeout=30"
724.PP
725Update the NetFlow configuration created by the previous command to
726instead use an active timeout of 60 seconds:
727.IP
728.B "ovs\-vsctl set NetFlow br0 active_timeout=60"
729.PP
730Deconfigure the NetFlow settings from \fBbr0\fR and delete the NetFlow
731record (to avoid having an unreferenced record in the database):
732.IP
733.B "ovs\-vsctl destroy NetFlow br0 \-\- clear Bridge br0 netflow"
734.SS "sFlow"
735.PP
736Configure bridge \fBbr0\fR to send sFlow records to a collector on
73710.0.0.1 at port 6343, using \fBeth1\fR\'s IP address as the source,
738with specific sampling parameters:
739.IP
740.B "ovs\-vsctl \-\- \-\-id=@s create sFlow agent=eth1 target=\(rs\(dq10.0.0.1:6343\(rs\(dq header=128 sampling=64 polling=10 \(rs"
741.IP
742.B "\-\- set Bridge br0 sflow=@s"
743.PP
744Deconfigure sFlow from br0 and destroy the sFlow record (to avoid
745having an unreferenced record in the database):
746.IP
747.B "ovs\-vsctl \-\- destroy sFlow br0 \-\- clear Bridge br0 sflow"
3b135da3
BP
748.SH "EXIT STATUS"
749.IP "0"
750Successful program execution.
751.IP "1"
752Usage, syntax, or configuration file error.
753.IP "2"
754The \fIbridge\fR argument to \fBbr\-exists\fR specified the name of a
755bridge that does not exist.
756.SH "SEE ALSO"
757.
dfbe07ba 758.BR ovsdb\-server (1),
3b135da3 759.BR ovs\-vswitchd (8).
ce5a3e38 760\