ovsdb-client: Add JSON output format.
[cascardo/ovs.git] / ovsdb / ovsdb-client.1.in
1 .\" -*- nroff -*-
2 .de IQ
3 .  br
4 .  ns
5 .  IP "\\$1"
6 ..
7 .\" -*- nroff -*-
8 .TH ovsdb\-client 1 "November 2009" "Open vSwitch" "Open vSwitch Manual"
9 .\" This program's name:
10 .ds PN ovsdb\-client
11 .\" SSL peer program's name:
12 .ds SN ovsdb\-server
13 .
14 .SH NAME
15 ovsdb\-client \- command-line interface to \fBovsdb-server\fR(1)
16 .
17 .SH SYNOPSIS
18 \fBovsdb\-client \fR[\fIoptions\fR] \fBlist\-dbs\fI server\fR
19 .br
20 \fBovsdb\-client \fR[\fIoptions\fR] \fBget\-schema\fI server database\fR
21 .br
22 \fBovsdb\-client \fR[\fIoptions\fR] \fBlist\-tables\fI server database\fR
23 .br
24 \fBovsdb\-client \fR[\fIoptions\fR] \fBlist\-columns\fI server database \fR[\fItable\fR]
25 .br
26 \fBovsdb\-client \fR[\fIoptions\fR] \fBtransact\fI server transaction\fR
27 .br
28 \fBovsdb\-client \fR[\fIoptions\fR] \fBdump\fI server database\fR
29 .br
30 \fBovsdb\-client \fR[\fIoptions\fR] \fBmonitor\fI server database table\fR
31 [\fIcolumn\fR[\fB,\fIcolumn\fR]...]...
32 .br
33 \fBovsdb\-client help\fR
34 .IP "Output formatting options:"
35 [\fB\-\-format=\fIformat\fR]
36 [\fB\-\-no\-heading\fR]
37 .so lib/daemon-syn.man
38 .so lib/vlog-syn.man
39 .so lib/ssl-syn.man
40 .so lib/ssl-bootstrap-syn.man
41 .so lib/common-syn.man
42 .
43 .SH DESCRIPTION
44 The \fBovsdb\-client\fR program is a command-line client for
45 interacting with a running \fBovsdb\-server\fR process.  For each
46 command, the \fIserver\fR to connect to must be specified in one of
47 the following forms:
48 .RS
49 .so ovsdb/remote-active.man
50 .so ovsdb/remote-passive.man
51 .RE
52 .
53 .SS "Commands"
54 The following commands are implemented:
55 .IP "\fBlist\-dbs\fI server\fR"
56 Connects to \fIserver\fR, retrieves the list of known databases, and
57 prints them one per line.  These database names are the ones that may
58 be used for \fIdatabase\fR in the following commands.
59 .
60 .IP "\fBget\-schema\fI server database\fR"
61 Connects to \fIserver\fR, retrieves the schema for \fIdatabase\fR, and
62 prints it in JSON format.
63 .
64 .IP "\fBlist\-tables\fI server database\fR"
65 Connects to \fIserver\fR, retrieves the schema for \fIdatabase\fR, and
66 prints a table listing the name of each table
67 within the database.
68 .
69 .IP "\fBlist\-columns\fI server database \fR[\fItable\fR]"
70 Connects to \fIserver\fR, retrieves the schema for \fIdatabase\fR, and
71 prints a table listing the name and type of each
72 column.  If \fItable\fR is specified, only columns in that table are
73 listed; otherwise, the tables include columns in all tables.
74 .
75 .IP "\fBtransact\fI server transaction\fR"
76 Connects to \fIserver\fR, sends it the specified \fItransaction\fR,
77 which must be a JSON array containing one or more valid OVSDB
78 operations, and prints the received reply on stdout.
79 .
80 .IP "\fBdump\fI server database\fR"
81 Connects to \fIserver\fR, retrieves all of the data in \fIdatabase\fR,
82 and prints it on stdout as a series of tables.
83 .
84 .IP "\fBmonitor\fI server database table\fR [\fIcolumn\fR[\fB,\fIcolumn\fR]...]..."
85 Connects to \fIserver\fR and monitors the contents of \fItable\fR in
86 \fIdatabase\fR.  By default, the initial contents of \fItable\fR are
87 printed, followed by each change as it occurs.  If at least one
88 \fIcolumn\fR is specified, only those columns are monitored.  The
89 following \fIcolumn\fR names have special meanings:
90 .RS
91 .IP "\fB!initial\fR"
92 Do not print the initial contents of the specified columns.
93 .IP "\fB!insert\fR"
94 Do not print newly inserted rows.
95 .IP "\fB!delete\fR"
96 Do not print deleted rows.
97 .IP "\fB!modify\fR"
98 Do not print modifications to existing rows.
99 .RE
100 .IP
101 Multiple [\fIcolumn\fR[\fB,\fIcolumn\fR]...] groups may be specified
102 as separate arguments, e.g. to apply different reporting parameters to
103 each group.  Whether multiple groups or only a single group is
104 specified, any given column may only be mentioned once on the command
105 line.
106 .IP
107 If \fB\-\-detach\fR is used with \fBmonitor\fR, then \fBovsdb\-client\fR
108 detaches after it has successfully received and printed the initial
109 contents of \fItable\fR.
110 .SH OPTIONS
111 .SS "Output Formatting Options"
112 Much of the output from \fBovsdb\-client\fR is in the form of tables.
113 The following options controlling output formatting:
114 .
115 .IP "\fB\-f \fIformat\fR"
116 .IQ "\fB\-\-format=\fIformat\fR"
117 Sets the type of table formatting.  The following types of
118 \fIformat\fR are available:
119 .RS
120 .IP "\fBtable\fR (default)"
121 Text-based tables with aligned columns.
122 .IP "\fBhtml\fR"
123 HTML tables.
124 .IP "\fBcvs\fR"
125 Comma-separated values as defined in RFC 4180.
126 .IP "\fBjson\fR"
127 JSON format as defined in RFC 4627.  The output is a sequence of JSON
128 objects, each of which corresponds to one table.  Each JSON object has
129 the following members with the noted values:
130 .RS
131 .IP "\fBcaption\fR"
132 The table's caption.  This member is omitted if the table has no
133 caption.
134 .IP "\fBheadings\fR"
135 An array with one element per table column.  Each array element is a
136 string giving the corresponding column's heading.
137 .IP "\fBdata\fR"
138 An array with one element per table row.  Each element is also an
139 array with one element per table column.  The elements of this
140 second-level array are the cells that constitute the table.  Cells
141 that represent OVSDB data or data types are expressed in the format
142 described in the OVSDB specification; other cells are simply expressed
143 as text strings.
144 .RE
145 .RE
146 .
147 .IP "\fB\-d \fIformat\fR"
148 .IP "\fB\-\-data=\fIformat\fR"
149 Sets the formatting for cells within output tables.  The following
150 types of \fIformat\fR are available:
151 .RS
152 .IP "\fBstring\fR (default)"
153 The simple format described in \fBovs\-vsctl\fR(8).
154 .IP "\fBjson\fR"
155 JSON.
156 .RE
157 .IP
158 The \fBjson\fR output format always outputs cells in JSON format,
159 ignoring this option.
160 .
161 .IP "\fB\-\-no\-heading\fR"
162 This option suppresses the heading row that otherwise appears in the
163 first row of table output.
164 .
165 .IP "\fB\-\-pretty\fR"
166 By default, JSON in output is printed as compactly as possible.  This
167 option causes JSON in output to be printed in a more readable
168 fashion.  Members of objects and elements of arrays are printed one
169 per line, with indentation.
170 .IP
171 This option does not affect JSON in tables, which is always printed
172 compactly.
173 .
174 .SS "Daemon Options"
175 The daemon options apply only to the \fBmonitor\fR command.  With any
176 other command, they have no effect.
177 .so lib/daemon.man
178 .SS "Logging Options"
179 .so lib/vlog.man
180 .SS "Public Key Infrastructure Options"
181 .so lib/ssl.man
182 .so lib/ssl-bootstrap.man
183 .SS "Other Options"
184 .so lib/common.man
185 .SH "SEE ALSO"
186 .
187 \fBovsdb\-server\fR(1),
188 \fBovsdb\-client\fR(1),
189 and the OVSDB specification.