]> git.proxmox.com Git - mirror_ovs.git/blame - tests/ovsdb-server.at
jsonrpc-server: Track monitor updates separately from sending them.
[mirror_ovs.git] / tests / ovsdb-server.at
CommitLineData
80d326ad 1AT_BANNER([OVSDB -- ovsdb-server transactions (Unix sockets)])
21ff1aee 2
028cbd99
BP
3m4_define([OVSDB_SERVER_SHUTDOWN],
4 [cp pid savepid
37d03458 5 AT_CHECK([ovs-appctl -t "`pwd`"/unixctl -e exit], [0], [ignore], [ignore])
028cbd99
BP
6 OVS_WAIT_WHILE([kill -0 `cat savepid`], [kill `cat savepid`])])
7
21ff1aee
BP
8# OVSDB_CHECK_EXECUTION(TITLE, SCHEMA, TRANSACTIONS, OUTPUT, [KEYWORDS])
9#
10# Creates a database with the given SCHEMA, starts an ovsdb-server on
11# that database, and runs each of the TRANSACTIONS (which should be a
12# quoted list of quoted strings) against it with ovsdb-client one at a
13# time.
14#
15# Checks that the overall output is OUTPUT, but UUIDs in the output
16# are replaced by markers of the form <N> where N is a number. The
17# first unique UUID is replaced by <0>, the next by <1>, and so on.
18# If a given UUID appears more than once it is always replaced by the
19# same marker.
20#
21# TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS.
22m4_define([OVSDB_CHECK_EXECUTION],
23 [AT_SETUP([$1])
2c487bc8 24 OVS_RUNDIR=`pwd`; export OVS_RUNDIR
9ff373db 25 AT_KEYWORDS([ovsdb server positive unix $5])
39ab07af 26 $2 > schema
7c126fbb 27 AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
77a922c7 28 AT_CHECK([ovsdb-server --detach --no-chdir --pidfile="`pwd`"/pid --remote=punix:socket --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore])
21ff1aee 29 m4_foreach([txn], [$3],
7c126fbb 30 [AT_CHECK([ovsdb-client transact unix:socket 'txn'], [0], [stdout], [ignore],
21ff1aee
BP
31 [test ! -e pid || kill `cat pid`])
32cat stdout >> output
33])
5c6d0628 34 AT_CHECK([${PERL} $srcdir/uuidfilt.pl output], [0], [$4], [ignore],
21ff1aee 35 [test ! -e pid || kill `cat pid`])
028cbd99 36 OVSDB_SERVER_SHUTDOWN
21ff1aee
BP
37 AT_CLEANUP])
38
39EXECUTION_EXAMPLES
80d326ad 40\f
db90b374
BP
41AT_SETUP([truncating corrupted database log])
42AT_KEYWORDS([ovsdb server positive unix])
2c487bc8 43OVS_RUNDIR=`pwd`; export OVS_RUNDIR
39ab07af 44ordinal_schema > schema
db90b374
BP
45AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
46dnl Do one transaction and save the output.
47AT_DATA([txnfile], [[ovsdb-client transact unix:socket \
48'["ordinals",
49 {"op": "insert",
50 "table": "ordinals",
51 "row": {"number": 0, "name": "zero"}}]'
52]])
37d03458 53AT_CHECK([ovsdb-server --remote=punix:socket --unixctl="`pwd`"/unixctl db --run="sh txnfile"], [0], [stdout], [])
db90b374
BP
54cat stdout >> output
55dnl Add some crap to the database log and run another transaction, which should
56dnl ignore the crap and truncate it out of the log.
57echo 'xxx' >> db
58AT_DATA([txnfile], [[ovsdb-client transact unix:socket \
59'["ordinals",
60 {"op": "insert",
61 "table": "ordinals",
62 "row": {"number": 1, "name": "one"}}]'
63]])
37d03458 64AT_CHECK([ovsdb-server --remote=punix:socket --unixctl="`pwd`"/unixctl db --run="sh txnfile"], [0], [stdout], [stderr])
db90b374
BP
65AT_CHECK([grep 'syntax error: db: parse error.* in header line "xxx"' stderr],
66 [0], [ignore])
67cat stdout >> output
68dnl Run a final transaction to verify that both transactions succeeeded.
69dnl The crap that we added should have been truncated by the previous run,
70dnl so ovsdb-server shouldn't log a warning this time.
71AT_DATA([txnfile], [[ovsdb-client transact unix:socket \
72'["ordinals",
73 {"op": "select",
74 "table": "ordinals",
75 "where": [],
76 "sort": ["number"]}]'
77]])
37d03458 78AT_CHECK([ovsdb-server --remote=punix:socket --unixctl="`pwd`"/unixctl db --run="sh txnfile"], [0], [stdout], [])
43675e26 79cat stdout >> output
5c6d0628 80AT_CHECK([${PERL} $srcdir/uuidfilt.pl output], [0],
43675e26
BP
81 [[[{"uuid":["uuid","<0>"]}]
82[{"uuid":["uuid","<1>"]}]
83[{"rows":[{"_uuid":["uuid","<0>"],"_version":["uuid","<2>"],"name":"zero","number":0},{"_uuid":["uuid","<1>"],"_version":["uuid","<3>"],"name":"one","number":1}]}]
84]], [],
85 [test ! -e pid || kill `cat pid`])
86AT_CLEANUP
87
88AT_SETUP([truncating database log with bad transaction])
89AT_KEYWORDS([ovsdb server positive unix])
2c487bc8 90OVS_RUNDIR=`pwd`; export OVS_RUNDIR
39ab07af 91ordinal_schema > schema
43675e26
BP
92AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
93dnl Do one transaction and save the output.
94AT_DATA([txnfile], [[ovsdb-client transact unix:socket \
95'["ordinals",
96 {"op": "insert",
97 "table": "ordinals",
98 "row": {"number": 0, "name": "zero"}}]'
99]])
37d03458 100AT_CHECK([ovsdb-server --remote=punix:socket --unixctl="`pwd`"/unixctl db --run="sh txnfile"], [0], [stdout], [])
43675e26
BP
101cat stdout >> output
102dnl Add some crap to the database log and run another transaction, which should
103dnl ignore the crap and truncate it out of the log.
104echo 'OVSDB JSON 15 ffbcdae4b0386265f9ea3280dd7c8f0b72a20e56
105{"invalid":{}}' >> db
106AT_DATA([txnfile], [[ovsdb-client transact unix:socket \
107'["ordinals",
108 {"op": "insert",
109 "table": "ordinals",
110 "row": {"number": 1, "name": "one"}}]'
111]])
37d03458 112AT_CHECK([ovsdb-server --remote=punix:socket --unixctl="`pwd`"/unixctl db --run="sh txnfile"], [0], [stdout], [stderr])
43675e26
BP
113AT_CHECK([grep 'syntax "{"invalid":{}}": unknown table: No table named invalid.' stderr],
114 [0], [ignore])
115cat stdout >> output
116dnl Run a final transaction to verify that both transactions succeeeded.
117dnl The crap that we added should have been truncated by the previous run,
118dnl so ovsdb-server shouldn't log a warning this time.
119AT_DATA([txnfile], [[ovsdb-client transact unix:socket \
120'["ordinals",
121 {"op": "select",
122 "table": "ordinals",
123 "where": [],
124 "sort": ["number"]}]'
125]])
37d03458 126AT_CHECK([ovsdb-server --remote=punix:socket --unixctl="`pwd`"/unixctl db --run="sh txnfile"], [0], [stdout], [])
db90b374 127cat stdout >> output
5c6d0628 128AT_CHECK([${PERL} $srcdir/uuidfilt.pl output], [0],
db90b374
BP
129 [[[{"uuid":["uuid","<0>"]}]
130[{"uuid":["uuid","<1>"]}]
131[{"rows":[{"_uuid":["uuid","<0>"],"_version":["uuid","<2>"],"name":"zero","number":0},{"_uuid":["uuid","<1>"],"_version":["uuid","<3>"],"name":"one","number":1}]}]
132]], [],
133 [test ! -e pid || kill `cat pid`])
134AT_CLEANUP
135
8159b984
BP
136AT_SETUP([ovsdb-client get-schema-version])
137AT_KEYWORDS([ovsdb server positive])
2c487bc8 138OVS_RUNDIR=`pwd`; export OVS_RUNDIR
39ab07af 139ordinal_schema > schema
8159b984 140AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore])
77a922c7 141AT_CHECK([ovsdb-server --detach --no-chdir --pidfile="`pwd`"/pid --unixctl="`pwd`"/unixctl --remote=punix:socket db], [0], [ignore], [ignore])
8159b984
BP
142AT_CHECK([ovsdb-client get-schema-version unix:socket ordinals], [0], [5.1.3
143])
144OVSDB_SERVER_SHUTDOWN
145AT_CLEANUP
146
9cb53f26
BP
147AT_SETUP([database multiplexing implementation])
148AT_KEYWORDS([ovsdb server positive])
2c487bc8 149OVS_RUNDIR=`pwd`; export OVS_RUNDIR
b4e8d170
BP
150ordinal_schema > schema1
151constraint_schema > schema2
152AT_CHECK([ovsdb-tool create db1 schema1], [0], [ignore], [ignore])
153AT_CHECK([ovsdb-tool create db2 schema2], [0], [ignore], [ignore])
154AT_CHECK([ovsdb-server --detach --no-chdir --pidfile="`pwd`"/pid --unixctl="`pwd`"/unixctl --remote=punix:socket db1 db2], [0], [ignore], [ignore])
9cb53f26
BP
155AT_CHECK(
156 [[ovsdb-client list-dbs unix:socket]],
b4e8d170
BP
157 [0], [constraints
158ordinals
9cb53f26
BP
159], [ignore], [test ! -e pid || kill `cat pid`])
160AT_CHECK(
53ffefe9
BP
161 [[test-jsonrpc request unix:socket get_schema [\"nonexistent\"]]], [0],
162 [[{"error":null,"id":0,"result":{"details":"get_schema request specifies unknown database nonexistent","error":"unknown database","syntax":"[\"nonexistent\"]"}}
163]], [], [test ! -e pid || kill `cat pid`])
9cb53f26
BP
164OVSDB_SERVER_SHUTDOWN
165AT_CLEANUP
166
0a3b723b
BP
167AT_SETUP([ovsdb-server/add-db and remove-db])
168AT_KEYWORDS([ovsdb server positive])
169ON_EXIT([kill `cat ovsdb-server.pid`])
170OVS_RUNDIR=`pwd`; export OVS_RUNDIR
171OVS_LOGDIR=`pwd`; export OVS_LOGDIR
172ordinal_schema > schema1
173constraint_schema > schema2
174AT_CHECK([ovsdb-tool create db1 schema1], [0], [ignore], [ignore])
175AT_CHECK([ovsdb-tool create db2 schema2], [0], [ignore], [ignore])
176
177# Start ovsdb-server with just a single database - db1.
178AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket db1], [0])
179AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/list-dbs],
180 [0], [ordinals
181])
182
183# Add the second database.
184AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/add-db db2], [0])
185AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/list-dbs],
186 [0], [constraints
187ordinals
188])
189
190# The databases are responsive.
191AT_CHECK([ovsdb-client list-tables unix:socket constraints], [0], [ignore], [ignore])
192AT_CHECK([ovsdb-client list-tables unix:socket ordinals], [0], [ignore], [ignore])
193
194# Add an already added database.
195AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/add-db db2], 2, [], [stderr])
196AT_CHECK([sed 's/(.*)/(...)/' stderr], [0],
197 [I/O error: db2: failed to lock lockfile (...)
198ovs-appctl: ovsdb-server: server returned an error
199])
200
201# Add a non-existing database.
202AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/add-db db3], 2, [], [stderr])
203AT_CHECK([sed 's/(.*)/(...)/' stderr], [0],
204 [I/O error: open: db3 failed (...)
205ovs-appctl: ovsdb-server: server returned an error
206])
207
208# Add a remote through a db path in db1.
209AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/add-remote db:ordinals,ordinals,name], [0])
210AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/list-remotes],
211 [0], [db:ordinals,ordinals,name
212punix:socket
213])
214
215# Removing db1 has no effect on its remote.
216AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/remove-db ordinals], [0])
217AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/list-dbs],
218 [0], [constraints
219])
220AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/list-remotes],
221 [0], [db:ordinals,ordinals,name
222punix:socket
223])
224AT_CHECK([ovsdb-client list-tables unix:socket ordinals], [1], [ignore], [ignore])
225
226# Remove db2.
227AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/remove-db constraints], [0])
228AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/list-dbs],
229 [0], [])
230AT_CHECK([ovsdb-client list-tables unix:socket constraints], [1], [ignore], [ignore])
231
232# Remove a non-existent database.
233AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/remove-db ordinals], [2],
234 [], [Failed to find the database.
235ovs-appctl: ovsdb-server: server returned an error
236])
3fc53787
GS
237
238# Add a removed database.
239AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/add-db db2], [0])
240AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/list-dbs],
241 [0], [constraints
242])
243AT_CHECK([ovsdb-client list-tables unix:socket constraints], [0], [ignore], [ignore])
0a3b723b
BP
244AT_CLEANUP
245
d7ae8d6b 246AT_SETUP([ovsdb-server/add-db with --monitor])
0a3b723b
BP
247AT_KEYWORDS([ovsdb server positive])
248# Start ovsdb-server, initially with one db.
249OVS_RUNDIR=`pwd`; export OVS_RUNDIR
250OVS_LOGDIR=`pwd`; export OVS_LOGDIR
251ordinal_schema > schema
252AT_CHECK([ovsdb-tool create db1 schema], [0], [ignore], [ignore])
253ON_EXIT([kill `cat *.pid`])
254AT_CHECK([ovsdb-server -v -vvlog:off --monitor --detach --no-chdir --pidfile --log-file db1])
255
256# Add the second database.
257constraint_schema > schema2
258AT_CHECK([ovsdb-tool create db2 schema2], [0], [ignore], [ignore])
259AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/add-db db2], [0])
260AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/list-dbs],
261 [0], [constraints
262ordinals
263])
264
265# Kill the daemon process, making it look like a segfault,
266# and wait for a new daemon process to get spawned.
267cp ovsdb-server.pid old.pid
268AT_CHECK([kill -SEGV `cat ovsdb-server.pid`])
269OVS_WAIT_WHILE([kill -0 `cat old.pid`])
270OVS_WAIT_UNTIL(
271 [test -s ovsdb-server.pid && test `cat ovsdb-server.pid` != `cat old.pid`])
272AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/list-dbs],
273 [0], [constraints
274ordinals
275])
d7ae8d6b
BP
276AT_CLEANUP
277
278AT_SETUP([ovsdb-server/add-db and remove-db with --monitor])
279AT_KEYWORDS([ovsdb server positive])
280# Start ovsdb-server, initially with one db.
281OVS_RUNDIR=`pwd`; export OVS_RUNDIR
282OVS_LOGDIR=`pwd`; export OVS_LOGDIR
283ordinal_schema > schema
284AT_CHECK([ovsdb-tool create db1 schema], [0], [ignore], [ignore])
285constraint_schema > schema2
286AT_CHECK([ovsdb-tool create db2 schema2], [0], [ignore], [ignore])
287ON_EXIT([kill `cat *.pid`])
288AT_CHECK([ovsdb-server -v -vvlog:off --monitor --detach --no-chdir --pidfile --log-file db1 db2])
0a3b723b 289
d7ae8d6b 290# Remove the second database.
0a3b723b
BP
291AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/remove-db constraints])
292AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/list-dbs],
293 [0], [ordinals
294])
295
296# Kill the daemon process, making it look like a segfault,
297# and wait for a new daemon process to get spawned.
298cp ovsdb-server.pid old.pid
299AT_CHECK([kill -SEGV `cat ovsdb-server.pid`])
300OVS_WAIT_WHILE([kill -0 `cat old.pid`])
301OVS_WAIT_UNTIL(
302 [test -s ovsdb-server.pid && test `cat ovsdb-server.pid` != `cat old.pid`])
303AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/list-dbs],
304 [0], [ordinals
305])
306AT_CLEANUP
307
0b1fae1b
BP
308AT_SETUP([--remote=db: implementation])
309AT_KEYWORDS([ovsdb server positive])
b4e8d170
BP
310OVS_RUNDIR=`pwd`; export OVS_RUNDIR
311OVS_LOGDIR=`pwd`; export OVS_LOGDIR
0b1fae1b
BP
312AT_DATA([schema],
313 [[{"name": "mydb",
314 "tables": {
b4e8d170
BP
315 "Root": {
316 "columns": {
317 "managers": {
318 "type": {
319 "key": "string",
320 "min": 0,
321 "max": "unlimited"}},
322 "manager_options": {
323 "type": {
324 "key": {"type": "uuid", "refTable": "Manager"},
325 "min": 0,
326 "max": "unlimited"}}}},
0b1fae1b
BP
327 "Manager": {
328 "columns": {
b4e8d170
BP
329 "target": {
330 "type": "string"},
331 "is_connected": {
332 "type": {
333 "key": "boolean",
334 "min": 0,
335 "max": 1}}}}}}
0b1fae1b 336]])
7c126fbb
BP
337AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore])
338AT_CHECK(
0b1fae1b 339 [[ovsdb-tool transact db \
9cb53f26 340 '["mydb",
b4e8d170
BP
341 {"op": "insert",
342 "table": "Root",
343 "row": {
344 "managers": "punix:socket1",
345 "manager_options": ["set", [["named-uuid", "x"]]]}},
9cb53f26 346 {"op": "insert",
0b1fae1b 347 "table": "Manager",
b4e8d170
BP
348 "uuid-name": "x",
349 "row": {"target": "punix:socket2"}}]']], [0], [ignore], [ignore])
350ON_EXIT([kill `cat ovsdb-server.pid`])
fb6de52c 351AT_CHECK([ovsdb-server --enable-dummy --detach --no-chdir --pidfile --remote=db:mydb,Root,managers --remote=db:mydb,Root,manager_options --log-file db], [0], [ignore], [ignore])
b4e8d170 352for i in 1 2 3 4 5 6; do ovs-appctl -t ovsdb-server time/warp 1000; done
7c126fbb 353AT_CHECK(
b4e8d170 354 [[ovsdb-client transact unix:socket1 \
9cb53f26 355 '["mydb",
b4e8d170
BP
356 {"op": "select",
357 "table": "Root",
358 "where": [],
359 "columns": ["managers"]},
9cb53f26 360 {"op": "select",
0b1fae1b
BP
361 "table": "Manager",
362 "where": [],
b4e8d170
BP
363 "columns": ["target", "is_connected"]}]']],
364 [0], [stdout], [ignore])
0b1fae1b 365AT_CHECK(
5c6d0628 366 [${PERL} $srcdir/uuidfilt.pl stdout],
0b1fae1b 367 [0],
b4e8d170 368 [[[{"rows":[{"managers":"punix:socket1"}]},{"rows":[{"is_connected":false,"target":"punix:socket2"}]}]
0b1fae1b 369]],
b4e8d170 370 [ignore])
0b1fae1b 371AT_CLEANUP
ada496b5 372
b421d2af
BP
373AT_SETUP([ovsdb-server/add-remote and remove-remote])
374AT_KEYWORDS([ovsdb server positive])
375OVS_RUNDIR=`pwd`; export OVS_RUNDIR
376OVS_LOGDIR=`pwd`; export OVS_LOGDIR
377ordinal_schema > schema
378AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore])
379ON_EXIT([kill `cat *.pid`])
380AT_CHECK([ovsdb-server --detach --no-chdir --pidfile db])
381
382AT_CHECK([test ! -e socket1])
383AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/add-remote punix:socket1])
384OVS_WAIT_UNTIL([test -S socket1])
385AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/list-remotes],
386 [0], [punix:socket1
387])
388
389AT_CHECK([test ! -e socket2])
390AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/add-remote punix:socket2])
391OVS_WAIT_UNTIL([test -S socket2])
392AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/list-remotes],
393 [0], [punix:socket1
394punix:socket2
395])
396
397AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/add-remote db:x,y,z], [2],
398 [], ["db:x,y,z": no database named x
399ovs-appctl: ovsdb-server: server returned an error
400])
401
402AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/remove-remote punix:socket1])
403OVS_WAIT_UNTIL([test ! -e socket1])
404AT_CHECK([test -S socket2])
405AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/list-remotes],
406 [0], [punix:socket2
407])
408
409AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/remove-remote punix:socket2])
410OVS_WAIT_UNTIL([test ! -e socket2])
411AT_CHECK([test ! -e socket1])
412AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/list-remotes])
413AT_CLEANUP
414
09993217 415AT_SETUP([ovsdb-server/add-remote with --monitor])
5f36127e
BP
416AT_KEYWORDS([ovsdb server positive])
417# Start ovsdb-server, initially with no remotes.
418OVS_RUNDIR=`pwd`; export OVS_RUNDIR
419OVS_LOGDIR=`pwd`; export OVS_LOGDIR
420ordinal_schema > schema
421AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore])
422ON_EXIT([kill `cat *.pid`])
423AT_CHECK([ovsdb-server -v -vvlog:off --monitor --detach --no-chdir --pidfile --log-file db])
424
425# Add a remote.
426AT_CHECK([test ! -e socket1])
427AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/add-remote punix:socket1])
428OVS_WAIT_UNTIL([test -S socket1])
429AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/list-remotes],
430 [0], [punix:socket1
431])
432
433# Kill the daemon process, making it look like a segfault,
434# and wait for a new daemon process to get spawned and for it to
435# start listening on 'socket1'.
436cp ovsdb-server.pid old.pid
437rm socket1
438AT_CHECK([kill -SEGV `cat ovsdb-server.pid`])
439OVS_WAIT_WHILE([kill -0 `cat old.pid`])
440OVS_WAIT_UNTIL(
441 [test -s ovsdb-server.pid && test `cat ovsdb-server.pid` != `cat old.pid`])
442OVS_WAIT_UNTIL([test -S socket1])
09993217
AW
443AT_CLEANUP
444
445AT_SETUP([ovsdb-server/add-remote and remove-remote with --monitor])
446AT_KEYWORDS([ovsdb server positive])
447# Start ovsdb-server, initially with no remotes.
448OVS_RUNDIR=`pwd`; export OVS_RUNDIR
449OVS_LOGDIR=`pwd`; export OVS_LOGDIR
450ordinal_schema > schema
451AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore])
452ON_EXIT([kill `cat *.pid`])
453AT_CHECK([ovsdb-server -v -vvlog:off --monitor --detach --no-chdir --pidfile --log-file db])
454
455# Add a remote.
456AT_CHECK([test ! -e socket1])
457AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/add-remote punix:socket1])
458OVS_WAIT_UNTIL([test -S socket1])
459AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/list-remotes],
460 [0], [punix:socket1
461])
5f36127e
BP
462
463# Remove the remote.
464AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/remove-remote punix:socket1])
465OVS_WAIT_UNTIL([test ! -e socket1])
466AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/list-remotes])
467
468# Kill the daemon process, making it look like a segfault,
469# and wait for a new daemon process to get spawned and make sure that it
470# does not listen on 'socket1'.
471cp ovsdb-server.pid old.pid
472AT_CHECK([kill -SEGV `cat ovsdb-server.pid`])
473OVS_WAIT_WHILE([kill -0 `cat old.pid`])
474OVS_WAIT_UNTIL(
475 [test -s ovsdb-server.pid && test `cat ovsdb-server.pid` != `cat old.pid`])
476AT_CHECK([test ! -e socket1])
477AT_CLEANUP
478
78876719
BP
479AT_SETUP([SSL db: implementation])
480AT_KEYWORDS([ovsdb server positive ssl $5])
481AT_SKIP_IF([test "$HAVE_OPENSSL" = no])
15b619e2 482PKIDIR=$abs_top_builddir/tests
78876719 483AT_SKIP_IF([expr "$PKIDIR" : ".*[ '\"
0bcff889 484\\]"])
78876719
BP
485AT_DATA([schema],
486 [[{"name": "mydb",
487 "tables": {
488 "SSL": {
489 "columns": {
490 "private_key": {"type": "string"},
491 "certificate": {"type": "string"},
492 "ca_cert": {"type": "string"}}}}}
493]])
494AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
495AT_CHECK(
496 [[ovsdb-tool transact db \
497 '["mydb",
498 {"op": "insert",
499 "table": "SSL",
500 "row": {"private_key": "'"$PKIDIR/testpki-privkey2.pem"'",
501 "certificate": "'"$PKIDIR/testpki-cert2.pem"'",
502 "ca_cert": "'"$PKIDIR/testpki-cacert.pem"'"}}]']],
503 [0], [ignore], [ignore])
1e04fcc8 504OVS_LOGDIR=`pwd`; export OVS_LOGDIR
78876719 505AT_CHECK(
1e04fcc8 506 [ovsdb-server --log-file --detach --no-chdir --pidfile="`pwd`"/pid \
fb6de52c
GS
507 --private-key=db:mydb,SSL,private_key \
508 --certificate=db:mydb,SSL,certificate \
509 --ca-cert=db:mydb,SSL,ca_cert \
1e04fcc8 510 --remote=pssl:0:127.0.0.1 --unixctl="`pwd`"/unixctl db],
78876719 511 [0], [ignore], [ignore])
1e04fcc8 512SSL_PORT=`parse_listening_port < ovsdb-server.log`
78876719
BP
513AT_CHECK(
514 [[ovsdb-client \
515 --private-key=$PKIDIR/testpki-privkey.pem \
516 --certificate=$PKIDIR/testpki-cert.pem \
517 --ca-cert=$PKIDIR/testpki-cacert.pem \
518 transact ssl:127.0.0.1:$SSL_PORT \
519 '["mydb",
520 {"op": "select",
521 "table": "SSL",
522 "where": [],
523 "columns": ["private_key"]}]']],
524 [0], [stdout], [ignore], [test ! -e pid || kill `cat pid`])
525cat stdout >> output
526AT_CHECK_UNQUOTED(
b33bff0f 527 [cat output], [0],
78876719
BP
528 [[[{"rows":[{"private_key":"$PKIDIR/testpki-privkey2.pem"}]}]
529]], [ignore], [test ! -e pid || kill `cat pid`])
530OVSDB_SERVER_SHUTDOWN
531AT_CLEANUP
532
ada496b5
BP
533AT_SETUP([compacting online])
534AT_KEYWORDS([ovsdb server compact])
2c487bc8 535OVS_RUNDIR=`pwd`; export OVS_RUNDIR
39ab07af 536ordinal_schema > schema
a35ae81c
BP
537dnl Make sure that "ovsdb-tool create" works with a dangling symlink for
538dnl the database and the lockfile, creating the target of each symlink rather
539dnl than replacing the symlinks with regular files.
540mkdir dir
541ln -s dir/db db
542ln -s dir/.db.~lock~ .db.~lock~
543AT_SKIP_IF([test ! -h db || test ! -h .db.~lock~])
ada496b5 544AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore])
a35ae81c 545dnl Start ovsdb-server.
77a922c7 546AT_CHECK([ovsdb-server --detach --no-chdir --pidfile="`pwd`"/pid --unixctl="`pwd`"/unixctl --remote=punix:socket --log-file="`pwd`"/ovsdb-server.log db], [0], [ignore], [ignore])
ada496b5
BP
547AT_CAPTURE_FILE([ovsdb-server.log])
548dnl Do a bunch of random transactions that put crap in the database log.
549AT_CHECK(
550 [[for pair in 'zero 0' 'one 1' 'two 2' 'three 3' 'four 4' 'five 5'; do
551 set -- $pair
552 ovsdb-client transact unix:socket '
553 ["ordinals",
554 {"op": "insert",
555 "table": "ordinals",
556 "row": {"name": "'$1'", "number": '$2'}},
557 {"op": "comment",
558 "comment": "add row for '"$pair"'"}]'
559 ovsdb-client transact unix:socket '
560 ["ordinals",
561 {"op": "delete",
562 "table": "ordinals",
563 "where": [["number", "==", '$2']]},
564 {"op": "comment",
565 "comment": "delete row for '"$2"'"}]'
566 ovsdb-client transact unix:socket '
567 ["ordinals",
568 {"op": "insert",
569 "table": "ordinals",
570 "row": {"name": "'$1'", "number": '$2'}},
571 {"op": "comment",
572 "comment": "add back row for '"$pair"'"}]'
573 done]],
574 [0], [stdout], [ignore], [test ! -e pid || kill `cat pid`])
575dnl Check that all the crap is in fact in the database log.
5c6d0628 576AT_CHECK([[${PERL} $srcdir/uuidfilt.pl db | grep -v ^OVSDB | sed 's/"_date":[0-9]*/"_date":0/' | test-json --multiple -]], [0],
6910a6e6 577 [[{"cksum":"12345678 9","name":"ordinals","tables":{"ordinals":{"columns":{"name":{"type":"string"},"number":{"type":"integer"}},"indexes":[["number"]]}},"version":"5.1.3"}
62c87d4a
BP
578{"_comment":"add row for zero 0","_date":0,"ordinals":{"<0>":{"name":"zero"}}}
579{"_comment":"delete row for 0","_date":0,"ordinals":{"<0>":null}}
580{"_comment":"add back row for zero 0","_date":0,"ordinals":{"<1>":{"name":"zero"}}}
581{"_comment":"add row for one 1","_date":0,"ordinals":{"<2>":{"name":"one","number":1}}}
582{"_comment":"delete row for 1","_date":0,"ordinals":{"<2>":null}}
583{"_comment":"add back row for one 1","_date":0,"ordinals":{"<3>":{"name":"one","number":1}}}
584{"_comment":"add row for two 2","_date":0,"ordinals":{"<4>":{"name":"two","number":2}}}
585{"_comment":"delete row for 2","_date":0,"ordinals":{"<4>":null}}
586{"_comment":"add back row for two 2","_date":0,"ordinals":{"<5>":{"name":"two","number":2}}}
587{"_comment":"add row for three 3","_date":0,"ordinals":{"<6>":{"name":"three","number":3}}}
588{"_comment":"delete row for 3","_date":0,"ordinals":{"<6>":null}}
589{"_comment":"add back row for three 3","_date":0,"ordinals":{"<7>":{"name":"three","number":3}}}
590{"_comment":"add row for four 4","_date":0,"ordinals":{"<8>":{"name":"four","number":4}}}
591{"_comment":"delete row for 4","_date":0,"ordinals":{"<8>":null}}
592{"_comment":"add back row for four 4","_date":0,"ordinals":{"<9>":{"name":"four","number":4}}}
593{"_comment":"add row for five 5","_date":0,"ordinals":{"<10>":{"name":"five","number":5}}}
594{"_comment":"delete row for 5","_date":0,"ordinals":{"<10>":null}}
595{"_comment":"add back row for five 5","_date":0,"ordinals":{"<11>":{"name":"five","number":5}}}
ada496b5
BP
596]], [], [test ! -e pid || kill `cat pid`])
597dnl Dump out and check the actual database contents.
598AT_CHECK([[ovsdb-client dump unix:socket ordinals]],
599 [0], [stdout], [ignore])
5c6d0628 600AT_CHECK([${PERL} $srcdir/uuidfilt.pl stdout], [0], [dnl
370a11b9
BP
601ordinals table
602_uuid name number
ada496b5
BP
603------------------------------------ ----- ------
604<0> five 5 @&t@
605<1> four 4 @&t@
606<2> one 1 @&t@
607<3> three 3 @&t@
608<4> two 2 @&t@
609<5> zero 0 @&t@
610], [], [test ! -e pid || kill `cat pid`])
611dnl Now compact the database in-place.
37d03458 612AT_CHECK([[ovs-appctl -t "`pwd`"/unixctl ovsdb-server/compact]],
ada496b5 613 [0], [], [ignore], [test ! -e pid || kill `cat pid`])
a35ae81c
BP
614dnl Make sure that "db" is still a symlink to dir/db instead of getting
615dnl replaced by a regular file, ditto for .db.~lock~.
616AT_CHECK([test -h db])
617AT_CHECK([test -h .db.~lock~])
618AT_CHECK([test -f dir/db])
619AT_CHECK([test -f dir/.db.~lock~])
ada496b5
BP
620dnl We can't fully re-check the contents of the database log, because the
621dnl order of the records is not predictable, but there should only be 4 lines
622dnl in it now.
623AT_CAPTURE_FILE([db])
e0c7697c
EM
624AT_CHECK([test `wc -l < db` -eq 4], [0], [], [],
625 [test ! -e pid || kill `cat pid`])
ada496b5
BP
626dnl And check that the dumped data is the same too:
627AT_CHECK([ovsdb-client dump unix:socket ordinals], [0], [stdout], [ignore],
628 [test ! -e pid || kill `cat pid`])
5c6d0628 629AT_CHECK([${PERL} $srcdir/uuidfilt.pl stdout], [0], [dnl
370a11b9
BP
630ordinals table
631_uuid name number
ada496b5
BP
632------------------------------------ ----- ------
633<0> five 5 @&t@
634<1> four 4 @&t@
635<2> one 1 @&t@
636<3> three 3 @&t@
637<4> two 2 @&t@
638<5> zero 0 @&t@
639], [], [test ! -e pid || kill `cat pid`])
640dnl Now do some more transactions.
641AT_CHECK(
642 [[ovsdb-client transact unix:socket '
643 ["ordinals",
644 {"op": "delete",
645 "table": "ordinals",
646 "where": [["number", "<", 3]]}]']],
647 [0], [[[{"count":3}]
648]], [ignore], [test ! -e pid || kill `cat pid`])
649dnl There should be 6 lines in the log now.
e0c7697c
EM
650AT_CHECK([test `wc -l < db` -eq 6], [0], [], [],
651 [test ! -e pid || kill `cat pid`])
ada496b5
BP
652dnl Then check that the dumped data is correct.
653AT_CHECK([ovsdb-client dump unix:socket ordinals], [0], [stdout], [ignore],
654 [test ! -e pid || kill `cat pid`])
5c6d0628 655AT_CHECK([${PERL} $srcdir/uuidfilt.pl stdout], [0], [dnl
370a11b9
BP
656ordinals table
657_uuid name number
ada496b5
BP
658------------------------------------ ----- ------
659<0> five 5 @&t@
660<1> four 4 @&t@
661<2> three 3 @&t@
662], [], [test ! -e pid || kill `cat pid`])
663OVSDB_SERVER_SHUTDOWN
664AT_CLEANUP
80d326ad 665\f
e731d71b 666AT_BANNER([OVSDB -- ovsdb-server transactions (SSL IPv4 sockets)])
80d326ad
BP
667
668# OVSDB_CHECK_EXECUTION(TITLE, SCHEMA, TRANSACTIONS, OUTPUT, [KEYWORDS])
669#
670# Creates a database with the given SCHEMA, starts an ovsdb-server on
671# that database, and runs each of the TRANSACTIONS (which should be a
672# quoted list of quoted strings) against it with ovsdb-client one at a
673# time.
674#
675# Checks that the overall output is OUTPUT, but UUIDs in the output
676# are replaced by markers of the form <N> where N is a number. The
677# first unique UUID is replaced by <0>, the next by <1>, and so on.
678# If a given UUID appears more than once it is always replaced by the
679# same marker.
680#
681# TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS.
682m4_define([OVSDB_CHECK_EXECUTION],
683 [AT_SETUP([$1])
684 AT_KEYWORDS([ovsdb server positive ssl $5])
685 AT_SKIP_IF([test "$HAVE_OPENSSL" = no])
2c487bc8 686 OVS_RUNDIR=`pwd`; export OVS_RUNDIR
1e04fcc8 687 OVS_LOGDIR=`pwd`; export OVS_LOGDIR
39ab07af 688 $2 > schema
15b619e2 689 PKIDIR=$abs_top_builddir/tests
7c126fbb 690 AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
1e04fcc8
BP
691 AT_CHECK([ovsdb-server --log-file --detach --no-chdir --pidfile="`pwd`"/pid --private-key=$PKIDIR/testpki-privkey2.pem --certificate=$PKIDIR/testpki-cert2.pem --ca-cert=$PKIDIR/testpki-cacert.pem --remote=pssl:0:127.0.0.1 --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore])
692 SSL_PORT=`parse_listening_port < ovsdb-server.log`
80d326ad 693 m4_foreach([txn], [$3],
7c126fbb 694 [AT_CHECK([ovsdb-client --private-key=$PKIDIR/testpki-privkey.pem --certificate=$PKIDIR/testpki-cert.pem --ca-cert=$PKIDIR/testpki-cacert.pem transact ssl:127.0.0.1:$SSL_PORT 'txn'], [0], [stdout], [ignore],
80d326ad
BP
695 [test ! -e pid || kill `cat pid`])
696cat stdout >> output
697])
5c6d0628 698 AT_CHECK([${PERL} $srcdir/uuidfilt.pl output], [0], [$4], [ignore],
80d326ad 699 [test ! -e pid || kill `cat pid`])
028cbd99 700 OVSDB_SERVER_SHUTDOWN
80d326ad
BP
701 AT_CLEANUP])
702
e879d33e
MM
703EXECUTION_EXAMPLES
704
e731d71b
AS
705AT_BANNER([OVSDB -- ovsdb-server transactions (SSL IPv6 sockets)])
706
707# OVSDB_CHECK_EXECUTION(TITLE, SCHEMA, TRANSACTIONS, OUTPUT, [KEYWORDS])
708#
709# Creates a database with the given SCHEMA, starts an ovsdb-server on
710# that database, and runs each of the TRANSACTIONS (which should be a
711# quoted list of quoted strings) against it with ovsdb-client one at a
712# time.
713#
714# Checks that the overall output is OUTPUT, but UUIDs in the output
715# are replaced by markers of the form <N> where N is a number. The
716# first unique UUID is replaced by <0>, the next by <1>, and so on.
717# If a given UUID appears more than once it is always replaced by the
718# same marker.
719#
720# TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS.
721m4_define([OVSDB_CHECK_EXECUTION],
722 [AT_SETUP([$1])
723 AT_KEYWORDS([ovsdb server positive ssl6 $5])
724 AT_SKIP_IF([test "$HAVE_OPENSSL" = no])
725 OVS_RUNDIR=`pwd`; export OVS_RUNDIR
726 OVS_LOGDIR=`pwd`; export OVS_LOGDIR
727 $2 > schema
728 PKIDIR=$abs_top_builddir/tests
729 AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
730 AT_CHECK([ovsdb-server --log-file --detach --no-chdir --pidfile="`pwd`"/pid --private-key=$PKIDIR/testpki-privkey2.pem --certificate=$PKIDIR/testpki-cert2.pem --ca-cert=$PKIDIR/testpki-cacert.pem --remote=pssl:0:[[::1]] --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore])
731 SSL_PORT=`parse_listening_port < ovsdb-server.log`
732 m4_foreach([txn], [$3],
733 [AT_CHECK([ovsdb-client --private-key=$PKIDIR/testpki-privkey.pem --certificate=$PKIDIR/testpki-cert.pem --ca-cert=$PKIDIR/testpki-cacert.pem transact ssl:[[::1]]:$SSL_PORT 'txn'], [0], [stdout], [ignore],
734 [test ! -e pid || kill `cat pid`])
735cat stdout >> output
736])
737 AT_CHECK([${PERL} $srcdir/uuidfilt.pl output], [0], [$4], [ignore],
738 [test ! -e pid || kill `cat pid`])
739 OVSDB_SERVER_SHUTDOWN
740 AT_CLEANUP])
741
742ONE_EXECUTION_EXAMPLE
743
744AT_BANNER([OVSDB -- ovsdb-server transactions (TCP IPv4 sockets)])
e879d33e
MM
745
746AT_SETUP([ovsdb-client get-schema-version - tcp socket])
747AT_KEYWORDS([ovsdb server positive tcp])
748ordinal_schema > schema
e879d33e 749AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore])
1e04fcc8
BP
750OVS_LOGDIR=`pwd`; export OVS_LOGDIR
751AT_CHECK([ovsdb-server --log-file --detach --no-chdir --pidfile="`pwd`"/pid --unixctl="`pwd`"/unixctl --remote=ptcp:0:127.0.0.1 db], [0], [ignore], [ignore])
752TCP_PORT=`parse_listening_port < ovsdb-server.log`
e879d33e
MM
753AT_CHECK([ovsdb-client get-schema-version tcp:127.0.0.1:$TCP_PORT ordinals], [0], [5.1.3
754])
755OVSDB_SERVER_SHUTDOWN
756AT_CLEANUP])
757
758# OVSDB_CHECK_EXECUTION(TITLE, SCHEMA, TRANSACTIONS, OUTPUT, [KEYWORDS])
759#
760# Creates a database with the given SCHEMA, starts an ovsdb-server on
761# that database, and runs each of the TRANSACTIONS (which should be a
762# quoted list of quoted strings) against it with ovsdb-client one at a
763# time.
764#
765# Checks that the overall output is OUTPUT, but UUIDs in the output
766# are replaced by markers of the form <N> where N is a number. The
767# first unique UUID is replaced by <0>, the next by <1>, and so on.
768# If a given UUID appears more than once it is always replaced by the
769# same marker.
770#
771# TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS.
772m4_define([OVSDB_CHECK_EXECUTION],
773 [AT_SETUP([$1])
774 AT_KEYWORDS([ovsdb server positive tcp $5])
2c487bc8 775 OVS_RUNDIR=`pwd`; export OVS_RUNDIR
1e04fcc8 776 OVS_LOGDIR=`pwd`; export OVS_LOGDIR
e879d33e 777 $2 > schema
e879d33e
MM
778 PKIDIR=$abs_top_builddir/tests
779 AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
1e04fcc8
BP
780 AT_CHECK([ovsdb-server --log-file --detach --no-chdir --pidfile="`pwd`"/pid --remote=ptcp:0:127.0.0.1 --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore])
781 TCP_PORT=`parse_listening_port < ovsdb-server.log`
e879d33e
MM
782 m4_foreach([txn], [$3],
783 [AT_CHECK([ovsdb-client transact tcp:127.0.0.1:$TCP_PORT 'txn'], [0], [stdout], [ignore],
784 [test ! -e pid || kill `cat pid`])
785cat stdout >> output
786])
5c6d0628 787 AT_CHECK([${PERL} $srcdir/uuidfilt.pl output], [0], [$4], [ignore],
e879d33e
MM
788 [test ! -e pid || kill `cat pid`])
789 OVSDB_SERVER_SHUTDOWN
790 AT_CLEANUP])
791
80d326ad 792EXECUTION_EXAMPLES
e731d71b 793
7daaec4e
BP
794AT_BANNER([OVSDB -- ovsdb-server transactions (TCP IPv6 sockets)])
795
e731d71b
AS
796# OVSDB_CHECK_EXECUTION(TITLE, SCHEMA, TRANSACTIONS, OUTPUT, [KEYWORDS])
797#
798# Creates a database with the given SCHEMA, starts an ovsdb-server on
799# that database, and runs each of the TRANSACTIONS (which should be a
800# quoted list of quoted strings) against it with ovsdb-client one at a
801# time.
802#
803# Checks that the overall output is OUTPUT, but UUIDs in the output
804# are replaced by markers of the form <N> where N is a number. The
805# first unique UUID is replaced by <0>, the next by <1>, and so on.
806# If a given UUID appears more than once it is always replaced by the
807# same marker.
808#
809# TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS.
810m4_define([OVSDB_CHECK_EXECUTION],
811 [AT_SETUP([$1])
812 AT_KEYWORDS([ovsdb server positive tcp6 $5])
813 OVS_RUNDIR=`pwd`; export OVS_RUNDIR
814 OVS_LOGDIR=`pwd`; export OVS_LOGDIR
815 $2 > schema
816 PKIDIR=$abs_top_builddir/tests
817 AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
818 AT_CHECK([ovsdb-server --log-file --detach --no-chdir --pidfile="`pwd`"/pid --remote=ptcp:0:[[::1]] --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore])
819 TCP_PORT=`parse_listening_port < ovsdb-server.log`
820 m4_foreach([txn], [$3],
821 [AT_CHECK([ovsdb-client transact tcp:[[::1]]:$TCP_PORT 'txn'], [0], [stdout], [ignore],
822 [test ! -e pid || kill `cat pid`])
823cat stdout >> output
824])
825 AT_CHECK([${PERL} $srcdir/uuidfilt.pl output], [0], [$4], [ignore],
826 [test ! -e pid || kill `cat pid`])
827 OVSDB_SERVER_SHUTDOWN
828 AT_CLEANUP])
829
830ONE_EXECUTION_EXAMPLE
9ff373db
BP
831\f
832AT_BANNER([OVSDB -- transactions on transient ovsdb-server])
833
834# OVSDB_CHECK_EXECUTION(TITLE, SCHEMA, TRANSACTIONS, OUTPUT, [KEYWORDS])
835#
836# Creates a database with the given SCHEMA and runs each of the
837# TRANSACTIONS (which should be a quoted list of quoted strings)
838# against it with ovsdb-client one at a time. Each ovsdb-client
839# is run against a separately started ovsdb-server that executes
840# only that single transaction. (The idea is that this should
841# help to ferret out any differences between what ovsdb-server has
842# in memory and what actually gets committed to disk.)
843#
844# Checks that the overall output is OUTPUT, but UUIDs in the output
845# are replaced by markers of the form <N> where N is a number. The
846# first unique UUID is replaced by <0>, the next by <1>, and so on.
847# If a given UUID appears more than once it is always replaced by the
848# same marker.
849#
850# TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS.
851m4_define([OVSDB_CHECK_EXECUTION],
852 [AT_SETUP([$1])
853 AT_KEYWORDS([ovsdb server positive transient $5])
2c487bc8 854 OVS_RUNDIR=`pwd`; export OVS_RUNDIR
39ab07af 855 $2 > schema
9ff373db
BP
856 AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
857 m4_foreach([txn], [$3],
858 [AT_DATA([txnfile], [ovsdb-client transact unix:socket 'txn'
859])
37d03458 860 AT_CHECK([ovsdb-server --remote=punix:socket --unixctl="`pwd`"/unixctl db --run="sh txnfile"], [0], [stdout], [ignore])
9ff373db
BP
861 cat stdout >> output
862])
5c6d0628 863 AT_CHECK([${PERL} $srcdir/uuidfilt.pl output], [0], [$4], [ignore])
9ff373db
BP
864 AT_CLEANUP])
865
866EXECUTION_EXAMPLES