]> git.proxmox.com Git - ovs.git/blame - tests/ovsdb-tool.at
bump version to 2.15.0+ds1-2+deb11u3.1
[ovs.git] / tests / ovsdb-tool.at
CommitLineData
1e19e50e
BP
1AT_BANNER([OVSDB -- ovsdb-tool])
2
3# OVSDB_CHECK_EXECUTION(TITLE, SCHEMA, TRANSACTIONS, OUTPUT, [KEYWORDS])
4#
5# Creates a database with the given SCHEMA and runs each of the
6# TRANSACTIONS (which should be a quoted list of quoted strings)
7# against it with ovsdb-tool one at a time.
8#
9# Checks that the overall output is OUTPUT, but UUIDs in the output
10# are replaced by markers of the form <N> where N is a number. The
11# first unique UUID is replaced by <0>, the next by <1>, and so on.
12# If a given UUID appears more than once it is always replaced by the
13# same marker.
14#
15# TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS.
16m4_define([OVSDB_CHECK_EXECUTION],
17 [AT_SETUP([$1])
18 AT_KEYWORDS([ovsdb file positive $5])
39ab07af 19 $2 > schema
1e19e50e
BP
20 touch .db.~lock~
21 AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
22 m4_foreach([txn], [$3],
23 [AT_CHECK([ovsdb-tool transact db 'txn'], [0], [stdout], [ignore])
24cat stdout >> output
25])
c724bd67 26 AT_CHECK([uuidfilt output], [0], [$4])
1e19e50e
BP
27 AT_CLEANUP])
28
29EXECUTION_EXAMPLES
30
31AT_SETUP([transaction comments])
32AT_KEYWORDS([ovsdb file positive])
39ab07af 33ordinal_schema > schema
1e19e50e
BP
34touch .db.~lock~
35AT_CHECK([ovsdb-tool create db schema], [0], [], [ignore])
36AT_CHECK([[ovsdb-tool transact db '
37 ["ordinals",
38 {"op": "insert",
39 "table": "ordinals",
40 "row": {"name": "five", "number": 5}},
41 {"op": "comment",
42 "comment": "add row for 5"}]']], [0], [stdout], [ignore])
c724bd67 43AT_CHECK([uuidfilt stdout], [0],
1e19e50e
BP
44 [[[{"uuid":["uuid","<0>"]},{}]
45]])
00961f7c 46AT_CHECK([grep "add row for 5" db], [0], [ignore])
1e19e50e
BP
47AT_CLEANUP
48
49AT_SETUP([ovsdb-tool compact])
50AT_KEYWORDS([ovsdb file positive])
39ab07af 51ordinal_schema > schema
a35ae81c
BP
52dnl Make sure that "ovsdb-tool create" works with a dangling symlink,
53dnl creating the target of the symlink rather than replacing the symlink
54dnl with a regular file, and that the lockfile gets created relative to
55dnl the symlink's target.
56mkdir dir
57: > dir/.db.~lock~
1ae1933f
AS
58if test "$IS_WIN32" = "no"; then
59 ln -s dir/db db
60 AT_SKIP_IF([test ! -h db])
61fi
1e19e50e 62AT_CHECK([ovsdb-tool create db schema], [0], [], [ignore])
1ae1933f
AS
63if test "$IS_WIN32" = "no"; then
64 AT_CHECK([test ! -e .db.~lock])
65 AT_CHECK([test -h db])
66 AT_CHECK([test -f dir/db])
67fi
1e19e50e
BP
68dnl Do a bunch of random transactions that put crap in the database log.
69AT_CHECK(
70 [[for pair in 'zero 0' 'one 1' 'two 2' 'three 3' 'four 4' 'five 5'; do
71 set -- $pair
72 ovsdb-tool transact db '
73 ["ordinals",
74 {"op": "insert",
75 "table": "ordinals",
76 "row": {"name": "'$1'", "number": '$2'}},
77 {"op": "comment",
78 "comment": "add row for '"$pair"'"}]'
79 ovsdb-tool transact db '
80 ["ordinals",
81 {"op": "delete",
82 "table": "ordinals",
83 "where": [["number", "==", '$2']]},
84 {"op": "comment",
85 "comment": "delete row for '"$2"'"}]'
86 ovsdb-tool transact db '
87 ["ordinals",
88 {"op": "insert",
89 "table": "ordinals",
90 "row": {"name": "'$1'", "number": '$2'}},
91 {"op": "comment",
92 "comment": "add back row for '"$pair"'"}]'
93 done]],
94 [0], [stdout], [ignore])
95dnl Check that all the crap is in fact in the database log.
2ccd66f5
IM
96AT_CHECK([[uuidfilt db | grep -v ^OVSDB | sed 's/"_date":[0-9]*/"_date":0/' | \
97 sed 's/"_is_diff":true,//' | ovstest test-json --multiple -]], [0],
6910a6e6 98 [[{"cksum":"12345678 9","name":"ordinals","tables":{"ordinals":{"columns":{"name":{"type":"string"},"number":{"type":"integer"}},"indexes":[["number"]]}},"version":"5.1.3"}
e86dd676
BP
99{"_comment":"add row for zero 0","_date":0,"ordinals":{"<0>":{"name":"zero"}}}
100{"_comment":"delete row for 0","_date":0,"ordinals":{"<0>":null}}
101{"_comment":"add back row for zero 0","_date":0,"ordinals":{"<1>":{"name":"zero"}}}
102{"_comment":"add row for one 1","_date":0,"ordinals":{"<2>":{"name":"one","number":1}}}
103{"_comment":"delete row for 1","_date":0,"ordinals":{"<2>":null}}
104{"_comment":"add back row for one 1","_date":0,"ordinals":{"<3>":{"name":"one","number":1}}}
105{"_comment":"add row for two 2","_date":0,"ordinals":{"<4>":{"name":"two","number":2}}}
106{"_comment":"delete row for 2","_date":0,"ordinals":{"<4>":null}}
107{"_comment":"add back row for two 2","_date":0,"ordinals":{"<5>":{"name":"two","number":2}}}
108{"_comment":"add row for three 3","_date":0,"ordinals":{"<6>":{"name":"three","number":3}}}
109{"_comment":"delete row for 3","_date":0,"ordinals":{"<6>":null}}
110{"_comment":"add back row for three 3","_date":0,"ordinals":{"<7>":{"name":"three","number":3}}}
111{"_comment":"add row for four 4","_date":0,"ordinals":{"<8>":{"name":"four","number":4}}}
112{"_comment":"delete row for 4","_date":0,"ordinals":{"<8>":null}}
113{"_comment":"add back row for four 4","_date":0,"ordinals":{"<9>":{"name":"four","number":4}}}
114{"_comment":"add row for five 5","_date":0,"ordinals":{"<10>":{"name":"five","number":5}}}
115{"_comment":"delete row for 5","_date":0,"ordinals":{"<10>":null}}
116{"_comment":"add back row for five 5","_date":0,"ordinals":{"<11>":{"name":"five","number":5}}}
1e19e50e 117]])
1ae1933f 118
1e19e50e 119dnl Dump out and check the actual database contents.
1ae1933f
AS
120on_exit 'kill `cat ovsdb-server.pid`'
121AT_CHECK([[ovsdb-server --detach --pidfile --no-chdir --remote=punix:socket db]],
5a0e4aec 122 [0], [stdout], [ignore])
1ae1933f 123AT_CHECK([[ovsdb-client dump unix:socket ordinals]],
5a0e4aec 124 [0], [stdout], [ignore])
1ae1933f
AS
125OVS_APP_EXIT_AND_WAIT([ovsdb-server])
126
c724bd67 127AT_CHECK([uuidfilt stdout], [0], [dnl
370a11b9
BP
128ordinals table
129_uuid name number
1e19e50e 130------------------------------------ ----- ------
e51d0a1d
BP
131<0> five 5
132<1> four 4
133<2> one 1
134<3> three 3
135<4> two 2
136<5> zero 0
1e19e50e
BP
137])
138dnl Now compact the database in-place.
139touch .db.tmp.~lock~
140AT_CHECK([[ovsdb-tool compact db]], [0], [], [ignore])
a35ae81c
BP
141dnl Make sure that "db" is still a symlink to dir/db instead of getting
142dnl replaced by a regular file.
1ae1933f
AS
143if test "$IS_WIN32" = "no"; then
144 AT_CHECK([test ! -e .db.~lock])
145 AT_CHECK([test -h db])
146 AT_CHECK([test -f dir/db])
147fi
1e19e50e
BP
148dnl We can't fully re-check the contents of the database log, because the
149dnl order of the records is not predictable, but there should only be 4 lines
150dnl in it now.
151AT_CAPTURE_FILE([db])
e0c7697c 152AT_CHECK([test `wc -l < db` -eq 4])
1e19e50e 153dnl And check that the dumped data is the same too:
1ae1933f 154AT_CHECK([[ovsdb-server --detach --pidfile --no-chdir --remote=punix:socket db]],
5a0e4aec 155 [0], [stdout], [ignore])
1ae1933f 156AT_CHECK([[ovsdb-client dump unix:socket ordinals]],
5a0e4aec 157 [0], [stdout], [ignore])
1ae1933f
AS
158OVS_APP_EXIT_AND_WAIT([ovsdb-server])
159
c724bd67 160AT_CHECK([uuidfilt stdout], [0], [dnl
370a11b9
BP
161ordinals table
162_uuid name number
1e19e50e 163------------------------------------ ----- ------
e51d0a1d
BP
164<0> five 5
165<1> four 4
166<2> one 1
167<3> three 3
168<4> two 2
169<5> zero 0
1e19e50e
BP
170])
171AT_CLEANUP
172
173AT_SETUP([ovsdb-tool convert -- removing a column])
174AT_KEYWORDS([ovsdb file positive])
39ab07af 175ordinal_schema > schema
1e19e50e
BP
176AT_DATA([new-schema],
177 [[{"name": "ordinals",
178 "tables": {
179 "ordinals": {
180 "columns": {
181 "number": {"type": "integer"}}}}}
182]])
183touch .db.~lock~
184AT_CHECK([ovsdb-tool create db schema], [0], [], [ignore])
185dnl Put some data in the database.
186AT_CHECK(
187 [[for pair in 'zero 0' 'one 1' 'two 2' 'three 3' 'four 4' 'five 5'; do
188 set -- $pair
189 ovsdb-tool transact db '
190 ["ordinals",
191 {"op": "insert",
192 "table": "ordinals",
193 "row": {"name": "'$1'", "number": '$2'}},
194 {"op": "comment",
195 "comment": "add row for '"$pair"'"}]'
196 done]],
197 [0], [stdout], [ignore])
198dnl Dump out and check the actual database contents.
10c119c3
GS
199AT_CHECK([[ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket db]],
200 [0])
201AT_CHECK([ovsdb-client dump unix:socket ordinals], [0], [stdout], [ignore])
c724bd67 202AT_CHECK([uuidfilt stdout], [0], [dnl
370a11b9
BP
203ordinals table
204_uuid name number
1e19e50e 205------------------------------------ ----- ------
e51d0a1d
BP
206<0> five 5
207<1> four 4
208<2> one 1
209<3> three 3
210<4> two 2
211<5> zero 0
1e19e50e 212])
10c119c3 213OVS_APP_EXIT_AND_WAIT([ovsdb-server])
1e19e50e
BP
214dnl Now convert the database in-place.
215touch .db.tmp.~lock~
216AT_CHECK([[ovsdb-tool convert db new-schema]], [0], [], [ignore])
217dnl We can't fully re-check the contents of the database log, because the
218dnl order of the records is not predictable, but there should only be 4 lines
219dnl in it now.
220AT_CAPTURE_FILE([db])
e0c7697c 221AT_CHECK([test `wc -l < db` -eq 4])
1e19e50e 222dnl And check that the dumped data is the same except for the removed column:
10c119c3
GS
223AT_CHECK([[ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket db]],
224 [0])
225AT_CHECK([ovsdb-client dump unix:socket ordinals], [0], [stdout], [ignore])
c724bd67 226AT_CHECK([uuidfilt stdout], [0], [dnl
370a11b9
BP
227ordinals table
228_uuid number
1e19e50e 229------------------------------------ ------
e51d0a1d
BP
230<0> 0
231<1> 1
232<2> 2
233<3> 3
234<4> 4
235<5> 5
1e19e50e 236])
10c119c3 237OVS_APP_EXIT_AND_WAIT([ovsdb-server])
1e19e50e
BP
238AT_CLEANUP
239
240AT_SETUP([ovsdb-tool convert -- adding a column])
241AT_KEYWORDS([ovsdb file positive])
242AT_DATA([schema],
243 [[{"name": "ordinals",
244 "tables": {
245 "ordinals": {
246 "columns": {
247 "number": {"type": "integer"}}}}}
248]])
39ab07af 249ordinal_schema > new-schema
1e19e50e
BP
250touch .db.~lock~
251AT_CHECK([ovsdb-tool create db schema], [0], [], [ignore])
252dnl Put some data in the database.
253AT_CHECK(
254 [[for number in 0 1 2 3 4 5; do
255 ovsdb-tool transact db '
256 ["ordinals",
257 {"op": "insert",
258 "table": "ordinals",
259 "row": {"number": '$number'}},
260 {"op": "comment",
261 "comment": "add row for '"$number"'"}]'
262 done]],
263 [0], [stdout], [ignore])
264dnl Dump out and check the actual database contents.
10c119c3
GS
265AT_CHECK([[ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket db]],
266 [0])
267AT_CHECK([ovsdb-client dump unix:socket ordinals], [0], [stdout], [ignore])
c724bd67 268AT_CHECK([uuidfilt stdout], [0], [dnl
370a11b9
BP
269ordinals table
270_uuid number
1e19e50e 271------------------------------------ ------
e51d0a1d
BP
272<0> 0
273<1> 1
274<2> 2
275<3> 3
276<4> 4
277<5> 5
1e19e50e 278])
10c119c3 279OVS_APP_EXIT_AND_WAIT([ovsdb-server])
1e19e50e
BP
280dnl Now convert the database in-place.
281touch .db.tmp.~lock~
282AT_CHECK([[ovsdb-tool convert db new-schema]], [0], [], [ignore])
283dnl We can't fully re-check the contents of the database log, because the
284dnl order of the records is not predictable, but there should only be 4 lines
285dnl in it now.
286AT_CAPTURE_FILE([db])
e0c7697c 287AT_CHECK([test `wc -l < db` -eq 4])
1e19e50e 288dnl And check that the dumped data is the same except for the added column:
10c119c3
GS
289AT_CHECK([[ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket db]],
290 [0])
291AT_CHECK([ovsdb-client dump unix:socket ordinals], [0], [stdout], [ignore])
c724bd67 292AT_CHECK([uuidfilt stdout], [0], [dnl
370a11b9
BP
293ordinals table
294_uuid name number
1e19e50e 295------------------------------------ ---- ------
e51d0a1d
BP
296<0> "" 0
297<1> "" 1
298<2> "" 2
299<3> "" 3
300<4> "" 4
301<5> "" 5
1e19e50e 302])
10c119c3 303OVS_APP_EXIT_AND_WAIT([ovsdb-server])
1e19e50e 304AT_CLEANUP
8159b984 305
1b1d2e6d
BP
306AT_SETUP([ovsdb-tool unsupported cluster operations])
307AT_KEYWORDS([ovsdb file negative compact query transact convert])
308ordinal_schema > schema
309AT_CHECK([ovsdb-tool create-cluster db schema unix:s1.raft])
310AT_CHECK([ovsdb-tool compact db], [1], [], [ovsdb-tool: ovsdb error: db: cannot apply this operation to clustered database file
311])
312AT_CHECK([ovsdb-tool convert db schema], [1], [], [ovsdb-tool: ovsdb error: db: cannot apply this operation to clustered database file
313])
314AT_CHECK([ovsdb-tool needs-conversion db schema], [1], [], [ovsdb-tool: ovsdb error: db: cannot apply this operation to clustered database file
315])
316AT_CHECK([ovsdb-tool query db '[[]]'], [1], [], [ovsdb-tool: ovsdb error: db: cannot apply this operation to clustered database file
317])
318AT_CHECK([ovsdb-tool transact db '[[]]'], [1], [], [ovsdb-tool: ovsdb error: db: cannot apply this operation to clustered database file
319])
320AT_CLEANUP
321
439902cb
BP
322AT_SETUP([ovsdb-tool schema-version, schema-cksum, schema-name])
323AT_KEYWORDS([ovsdb file positive schema-version schema-cksum])
39ab07af 324ordinal_schema > schema
8159b984
BP
325AT_CHECK([ovsdb-tool schema-version schema], [0], [5.1.3
326])
6aa09313
BP
327AT_CHECK([ovsdb-tool schema-cksum schema], [0], [12345678 9
328])
439902cb
BP
329AT_CHECK([ovsdb-tool schema-name schema], [0], [ordinals
330])
6aa09313
BP
331AT_CLEANUP
332
1b1d2e6d
BP
333AT_SETUP([ovsdb-tool database inspection commands - standalone])
334AT_KEYWORDS([ovsdb file positive db-version db-cksum db-name db-cid db-sid db-local-address])
39ab07af 335ordinal_schema > schema
6aa09313
BP
336touch .db.~lock~
337AT_CHECK([ovsdb-tool create db schema], [0], [], [ignore])
439902cb
BP
338AT_CHECK([ovsdb-tool db-version db], [0], [5.1.3
339])
6aa09313
BP
340AT_CHECK([ovsdb-tool db-cksum db], [0], [12345678 9
341])
439902cb
BP
342AT_CHECK([ovsdb-tool db-name db], [0], [ordinals
343])
1b1d2e6d
BP
344AT_CHECK([ovsdb-tool db-cid db], [1], [], [ovsdb-tool: db: not a clustered database
345])
346AT_CHECK([ovsdb-tool db-sid db], [1], [], [ovsdb-tool: db: not a clustered database
347])
348AT_CHECK([ovsdb-tool db-local-address db], [1], [], [ovsdb-tool: db: not a clustered database
349])
350AT_CLEANUP
351
352AT_SETUP([ovsdb-tool database inspection commands - clustered])
353AT_KEYWORDS([ovsdb file negative db-version db-cksum db-name db-cid db-sid db-local-address cluster])
354ordinal_schema > schema
355touch .db.~lock~
356AT_CHECK([ovsdb-tool create-cluster db schema tcp:1.2.3.4:1234])
357AT_CHECK([ovsdb-tool db-version db], [1], [], [ovsdb-tool: ovsdb error: db: cannot apply this operation to clustered database file
358])
359AT_CHECK([ovsdb-tool db-cksum db], [1], [], [ovsdb-tool: ovsdb error: db: cannot apply this operation to clustered database file
360])
361AT_CHECK([ovsdb-tool db-name db], [0], [ordinals
362])
363AT_CHECK([(ovsdb-tool db-cid db; ovsdb-tool db-sid db) | uuidfilt], [0], [<0>
364<1>
365])
366AT_CHECK([ovsdb-tool db-local-address db], [0], [tcp:1.2.3.4:1234
367])
368AT_CLEANUP
369
370AT_SETUP([ovsdb-tool database inspection commands - joining a cluster])
371AT_KEYWORDS([ovsdb file positive db-version db-cksum db-name db-cid db-sid db-local-address cluster join joining])
372ordinal_schema > schema
373touch .db.~lock~
374for cid in '' 520cf525-3772-43cc-8268-23bf5b548cf4; do
375 if test -z "$cid"; then
376 cid_option=
377 else
378 cid_option=--cid=$cid
379 fi
380 AT_CHECK([rm -f db && ovsdb-tool $cid_option join-cluster db ordinals tcp:1.2.3.4:1234 tcp:2.3.4.5:1234], [0], [], [ignore])
381 AT_CHECK([ovsdb-tool db-version db], [1], [], [ovsdb-tool: ovsdb error: db: cannot apply this operation to clustered database file
382])
383 AT_CHECK([ovsdb-tool db-cksum db], [1], [], [ovsdb-tool: ovsdb error: db: cannot apply this operation to clustered database file
384])
385 AT_CHECK([ovsdb-tool db-name db], [0], [ordinals
386])
387 if test -z "$cid"; then
388 AT_CHECK([ovsdb-tool db-cid db], [2], [], [db: cluster ID not yet known
389])
390 else
391 AT_CHECK_UNQUOTED([ovsdb-tool db-cid db], [0], [$cid
392])
393 fi
394 AT_CHECK([ovsdb-tool db-sid db | uuidfilt], [0], [<0>
395])
396 AT_CHECK([ovsdb-tool db-local-address db], [0], [tcp:1.2.3.4:1234
397])
398done
6aa09313 399AT_CLEANUP
403e3a25
BP
400
401AT_SETUP([ovsdb-tool needs-conversion (no conversion needed)])
402AT_KEYWORDS([ovsdb file positive])
39ab07af 403ordinal_schema > schema
403e3a25
BP
404touch .db.~lock~
405AT_CHECK([ovsdb-tool create db schema], [0], [], [ignore])
406AT_CHECK([ovsdb-tool needs-conversion db schema], [0], [no
407])
408AT_CLEANUP
409
410AT_SETUP([ovsdb-tool needs-conversion (conversion needed)])
411AT_KEYWORDS([ovsdb file positive])
39ab07af 412ordinal_schema > schema
403e3a25
BP
413touch .db.~lock~
414AT_CHECK([ovsdb-tool create db schema], [0], [], [ignore])
415sed 's/5\.1\.3/5.1.4/' < schema > schema2
416AT_CHECK([diff schema schema2], [1], [ignore])
417AT_CHECK([ovsdb-tool needs-conversion db schema2], [0], [yes
418])
419AT_CLEANUP
1b1d2e6d
BP
420
421AT_SETUP([ovsdb-tool create-cluster with initial data])
422AT_KEYWORDS([ovsdb file positive])
423
424# Create a standalone database and put some data in it.
425ordinal_schema > schema
426ovsdb-tool create db1 schema
427AT_CHECK(
428 [[for pair in 'zero 0' 'one 1' 'two 2' 'three 3' 'four 4' 'five 5'; do
429 set -- $pair
430 ovsdb-tool transact db1 '
5a0e4aec
BP
431 ["ordinals",
432 {"op": "insert",
433 "table": "ordinals",
434 "row": {"name": "'$1'", "number": '$2'}},
435 {"op": "comment",
436 "comment": "add row for '"$pair"'"}]'
1b1d2e6d
BP
437 done | uuidfilt]], [0],
438[[[{"uuid":["uuid","<0>"]},{}]
439[{"uuid":["uuid","<1>"]},{}]
440[{"uuid":["uuid","<2>"]},{}]
441[{"uuid":["uuid","<3>"]},{}]
442[{"uuid":["uuid","<4>"]},{}]
443[{"uuid":["uuid","<5>"]},{}]
444]], [ignore])
445
446# Dump the data.
3915a9d3 447AT_CHECK([ovsdb-server -vfile -vvlog:off --detach --no-chdir --pidfile --log-file --remote=punix:db.sock db1])
1b1d2e6d
BP
448AT_CHECK([ovsdb-client dump > expout])
449OVS_APP_EXIT_AND_WAIT([ovsdb-server])
450
451# Create a clustered database from the standalone one.
452ovsdb-tool create-cluster db2 db1 unix:s1.raft
453
454# Dump the data.
3915a9d3 455AT_CHECK([ovsdb-server -vconsole:off -vfile -vvlog:off --detach --no-chdir --pidfile --log-file --remote=punix:db.sock db2])
d97af428 456AT_CHECK([ovsdb_client_wait ordinals connected])
1b1d2e6d
BP
457AT_CHECK([ovsdb-client dump > dump2])
458OVS_APP_EXIT_AND_WAIT([ovsdb-server])
459
460# Make sure that the clustered data matched the standalone data.
461AT_CHECK([cat dump2], [0], [expout])
462AT_CLEANUP
00de46f9
AG
463
464AT_SETUP([ovsdb-tool convert-to-standalone])
465AT_KEYWORDS([ovsdb file positive])
466ordinal_schema > schema
467AT_CHECK([ovsdb-tool create-cluster db schema unix:s1.raft], [0], [stdout], [ignore])
468AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket --log-file db >/dev/null 2>&1])
469for txn in m4_foreach([txn], [[[["ordinals",
470 {"op": "insert",
471 "table": "ordinals",
472 "row": {"number": 0, "name": "zero"}},
473 {"op": "insert",
474 "table": "ordinals",
475 "row": {"number": 1, "name": "one"}},
476 {"op": "insert",
477 "table": "ordinals",
478 "row": {"number": 2, "name": "two"}}]]]], ['txn' ]); do
479AT_CHECK([ovsdb-client transact unix:socket "$txn"], [0], [ignore], [ignore])
480done
481AT_CHECK([ovsdb-client transact unix:socket '[["ordinals"]]'], [0],
482 [ignore], [ignore])
483AT_CHECK([ovsdb-client dump unix:socket > clusterdump])
484AT_CHECK([ovs-appctl -t ovsdb-server -e exit], [0], [ignore], [ignore])
485
486# Convert to standalone database from clustered database.
487AT_CHECK(ovsdb-tool cluster-to-standalone db1 db)
488
489# Check its standalone db
490AT_CHECK([ovsdb-tool db-is-standalone db1])
491
492# Dump the standalone db data.
493AT_CHECK([ovsdb-server -vconsole:off -vfile -vvlog:off --detach --no-chdir --pidfile --log-file --remote=punix:db.sock db1])
494AT_CHECK([ovsdb_client_wait ordinals connected])
495AT_CHECK([ovsdb-client dump > standalonedump])
496OVS_APP_EXIT_AND_WAIT([ovsdb-server])
497
498# Make sure both standalone and cluster db data matches.
499AT_CHECK([diff standalonedump clusterdump])
500AT_CLEANUP