1 AT_BANNER([OVSDB -- ovsdb-server transactions (Unix sockets)])
3 m4_define([OVSDB_SERVER_SHUTDOWN],
5 AT_CHECK([ovs-appctl -t "`pwd`"/unixctl -e exit], [0], [ignore], [ignore])
6 OVS_WAIT_WHILE([kill -0 `cat savepid`], [kill `cat savepid`])])
8 # OVSDB_CHECK_EXECUTION(TITLE, SCHEMA, TRANSACTIONS, OUTPUT, [KEYWORDS])
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
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
21 # TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS.
22 m4_define([OVSDB_CHECK_EXECUTION],
24 OVS_RUNDIR=`pwd`; export OVS_RUNDIR
25 AT_KEYWORDS([ovsdb server positive unix $5])
27 AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
28 AT_CHECK([ovsdb-server --detach --no-chdir --pidfile="`pwd`"/pid --remote=punix:socket --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore])
29 m4_foreach([txn], [$3],
30 [AT_CHECK([ovsdb-client transact unix:socket 'txn'], [0], [stdout], [ignore],
31 [test ! -e pid || kill `cat pid`])
34 AT_CHECK([${PERL} $srcdir/uuidfilt.pl output], [0], [$4], [ignore],
35 [test ! -e pid || kill `cat pid`])
41 AT_SETUP([truncating corrupted database log])
42 AT_KEYWORDS([ovsdb server positive unix])
43 OVS_RUNDIR=`pwd`; export OVS_RUNDIR
44 ordinal_schema > schema
45 AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
46 dnl Do one transaction and save the output.
47 AT_DATA([txnfile], [[ovsdb-client transact unix:socket \
51 "row": {"number": 0, "name": "zero"}}]'
53 AT_CHECK([ovsdb-server --remote=punix:socket --unixctl="`pwd`"/unixctl db --run="sh txnfile"], [0], [stdout], [])
55 dnl Add some crap to the database log and run another transaction, which should
56 dnl ignore the crap and truncate it out of the log.
58 AT_DATA([txnfile], [[ovsdb-client transact unix:socket \
62 "row": {"number": 1, "name": "one"}}]'
64 AT_CHECK([ovsdb-server --remote=punix:socket --unixctl="`pwd`"/unixctl db --run="sh txnfile"], [0], [stdout], [stderr])
65 AT_CHECK([grep 'syntax error: db: parse error.* in header line "xxx"' stderr],
68 dnl Run a final transaction to verify that both transactions succeeeded.
69 dnl The crap that we added should have been truncated by the previous run,
70 dnl so ovsdb-server shouldn't log a warning this time.
71 AT_DATA([txnfile], [[ovsdb-client transact unix:socket \
78 AT_CHECK([ovsdb-server --remote=punix:socket --unixctl="`pwd`"/unixctl db --run="sh txnfile"], [0], [stdout], [])
80 AT_CHECK([${PERL} $srcdir/uuidfilt.pl output], [0],
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}]}]
85 [test ! -e pid || kill `cat pid`])
88 AT_SETUP([truncating database log with bad transaction])
89 AT_KEYWORDS([ovsdb server positive unix])
90 OVS_RUNDIR=`pwd`; export OVS_RUNDIR
91 ordinal_schema > schema
92 AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
93 dnl Do one transaction and save the output.
94 AT_DATA([txnfile], [[ovsdb-client transact unix:socket \
98 "row": {"number": 0, "name": "zero"}}]'
100 AT_CHECK([ovsdb-server --remote=punix:socket --unixctl="`pwd`"/unixctl db --run="sh txnfile"], [0], [stdout], [])
102 dnl Add some crap to the database log and run another transaction, which should
103 dnl ignore the crap and truncate it out of the log.
104 echo 'OVSDB JSON 15 ffbcdae4b0386265f9ea3280dd7c8f0b72a20e56
105 {"invalid":{}}' >> db
106 AT_DATA([txnfile], [[ovsdb-client transact unix:socket \
110 "row": {"number": 1, "name": "one"}}]'
112 AT_CHECK([ovsdb-server --remote=punix:socket --unixctl="`pwd`"/unixctl db --run="sh txnfile"], [0], [stdout], [stderr])
113 AT_CHECK([grep 'syntax "{"invalid":{}}": unknown table: No table named invalid.' stderr],
116 dnl Run a final transaction to verify that both transactions succeeeded.
117 dnl The crap that we added should have been truncated by the previous run,
118 dnl so ovsdb-server shouldn't log a warning this time.
119 AT_DATA([txnfile], [[ovsdb-client transact unix:socket \
124 "sort": ["number"]}]'
126 AT_CHECK([ovsdb-server --remote=punix:socket --unixctl="`pwd`"/unixctl db --run="sh txnfile"], [0], [stdout], [])
128 AT_CHECK([${PERL} $srcdir/uuidfilt.pl output], [0],
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}]}]
133 [test ! -e pid || kill `cat pid`])
136 AT_SETUP([ovsdb-client get-schema-version])
137 AT_KEYWORDS([ovsdb server positive])
138 OVS_RUNDIR=`pwd`; export OVS_RUNDIR
139 ordinal_schema > schema
140 AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore])
141 AT_CHECK([ovsdb-server --detach --no-chdir --pidfile="`pwd`"/pid --unixctl="`pwd`"/unixctl --remote=punix:socket db], [0], [ignore], [ignore])
142 AT_CHECK([ovsdb-client get-schema-version unix:socket ordinals], [0], [5.1.3
144 OVSDB_SERVER_SHUTDOWN
147 AT_SETUP([database multiplexing implementation])
148 AT_KEYWORDS([ovsdb server positive])
149 OVS_RUNDIR=`pwd`; export OVS_RUNDIR
150 ordinal_schema > schema1
151 constraint_schema > schema2
152 AT_CHECK([ovsdb-tool create db1 schema1], [0], [ignore], [ignore])
153 AT_CHECK([ovsdb-tool create db2 schema2], [0], [ignore], [ignore])
154 AT_CHECK([ovsdb-server --detach --no-chdir --pidfile="`pwd`"/pid --unixctl="`pwd`"/unixctl --remote=punix:socket db1 db2], [0], [ignore], [ignore])
156 [[ovsdb-client list-dbs unix:socket]],
159 ], [ignore], [test ! -e pid || kill `cat pid`])
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`])
164 OVSDB_SERVER_SHUTDOWN
167 AT_SETUP([--remote=db: implementation])
168 AT_KEYWORDS([ovsdb server positive])
169 OVS_RUNDIR=`pwd`; export OVS_RUNDIR
170 OVS_LOGDIR=`pwd`; export OVS_LOGDIR
180 "max": "unlimited"}},
183 "key": {"type": "uuid", "refTable": "Manager"},
185 "max": "unlimited"}}}},
196 AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore])
198 [[ovsdb-tool transact db \
203 "managers": "punix:socket1",
204 "manager_options": ["set", [["named-uuid", "x"]]]}},
208 "row": {"target": "punix:socket2"}}]']], [0], [ignore], [ignore])
209 ON_EXIT([kill `cat ovsdb-server.pid`])
210 AT_CHECK([ovsdb-server --enable-dummy --detach --no-chdir --pidfile --remote=db:Root,managers --remote=db:Root,manager_options --log-file db], [0], [ignore], [ignore])
211 for i in 1 2 3 4 5 6; do ovs-appctl -t ovsdb-server time/warp 1000; done
213 [[ovsdb-client transact unix:socket1 \
218 "columns": ["managers"]},
222 "columns": ["target", "is_connected"]}]']],
223 [0], [stdout], [ignore])
225 [${PERL} $srcdir/uuidfilt.pl stdout],
227 [[[{"rows":[{"managers":"punix:socket1"}]},{"rows":[{"is_connected":false,"target":"punix:socket2"}]}]
232 AT_SETUP([ovsdb-server/add-remote and remove-remote])
233 AT_KEYWORDS([ovsdb server positive])
234 OVS_RUNDIR=`pwd`; export OVS_RUNDIR
235 OVS_LOGDIR=`pwd`; export OVS_LOGDIR
236 ordinal_schema > schema
237 AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore])
238 ON_EXIT([kill `cat *.pid`])
239 AT_CHECK([ovsdb-server --detach --no-chdir --pidfile db])
241 AT_CHECK([test ! -e socket1])
242 AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/add-remote punix:socket1])
243 OVS_WAIT_UNTIL([test -S socket1])
244 AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/list-remotes],
248 AT_CHECK([test ! -e socket2])
249 AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/add-remote punix:socket2])
250 OVS_WAIT_UNTIL([test -S socket2])
251 AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/list-remotes],
256 AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/add-remote db:x,y,z], [2],
257 [], ["db:x,y,z": no database named x
258 ovs-appctl: ovsdb-server: server returned an error
261 AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/remove-remote punix:socket1])
262 OVS_WAIT_UNTIL([test ! -e socket1])
263 AT_CHECK([test -S socket2])
264 AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/list-remotes],
268 AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/remove-remote punix:socket2])
269 OVS_WAIT_UNTIL([test ! -e socket2])
270 AT_CHECK([test ! -e socket1])
271 AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/list-remotes])
274 AT_SETUP([SSL db: implementation])
275 AT_KEYWORDS([ovsdb server positive ssl $5])
276 AT_SKIP_IF([test "$HAVE_OPENSSL" = no])
277 PKIDIR=$abs_top_builddir/tests
278 AT_SKIP_IF([expr "$PKIDIR" : ".*[ '\"
285 "private_key": {"type": "string"},
286 "certificate": {"type": "string"},
287 "ca_cert": {"type": "string"}}}}}
289 AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
291 [[ovsdb-tool transact db \
295 "row": {"private_key": "'"$PKIDIR/testpki-privkey2.pem"'",
296 "certificate": "'"$PKIDIR/testpki-cert2.pem"'",
297 "ca_cert": "'"$PKIDIR/testpki-cacert.pem"'"}}]']],
298 [0], [ignore], [ignore])
299 OVS_LOGDIR=`pwd`; export OVS_LOGDIR
301 [ovsdb-server --log-file --detach --no-chdir --pidfile="`pwd`"/pid \
302 --private-key=db:SSL,private_key \
303 --certificate=db:SSL,certificate \
304 --ca-cert=db:SSL,ca_cert \
305 --remote=pssl:0:127.0.0.1 --unixctl="`pwd`"/unixctl db],
306 [0], [ignore], [ignore])
307 SSL_PORT=`parse_listening_port < ovsdb-server.log`
310 --private-key=$PKIDIR/testpki-privkey.pem \
311 --certificate=$PKIDIR/testpki-cert.pem \
312 --ca-cert=$PKIDIR/testpki-cacert.pem \
313 transact ssl:127.0.0.1:$SSL_PORT \
318 "columns": ["private_key"]}]']],
319 [0], [stdout], [ignore], [test ! -e pid || kill `cat pid`])
322 [${PERL} $srcdir/uuidfilt.pl output], [0],
323 [[[{"rows":[{"private_key":"$PKIDIR/testpki-privkey2.pem"}]}]
324 ]], [ignore], [test ! -e pid || kill `cat pid`])
325 OVSDB_SERVER_SHUTDOWN
328 AT_SETUP([compacting online])
329 AT_KEYWORDS([ovsdb server compact])
330 OVS_RUNDIR=`pwd`; export OVS_RUNDIR
331 ordinal_schema > schema
332 dnl Make sure that "ovsdb-tool create" works with a dangling symlink for
333 dnl the database and the lockfile, creating the target of each symlink rather
334 dnl than replacing the symlinks with regular files.
337 ln -s dir/.db.~lock~ .db.~lock~
338 AT_SKIP_IF([test ! -h db || test ! -h .db.~lock~])
339 AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore])
340 dnl Start ovsdb-server.
341 AT_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])
342 AT_CAPTURE_FILE([ovsdb-server.log])
343 dnl Do a bunch of random transactions that put crap in the database log.
345 [[for pair in 'zero 0' 'one 1' 'two 2' 'three 3' 'four 4' 'five 5'; do
347 ovsdb-client transact unix:socket '
351 "row": {"name": "'$1'", "number": '$2'}},
353 "comment": "add row for '"$pair"'"}]'
354 ovsdb-client transact unix:socket '
358 "where": [["number", "==", '$2']]},
360 "comment": "delete row for '"$2"'"}]'
361 ovsdb-client transact unix:socket '
365 "row": {"name": "'$1'", "number": '$2'}},
367 "comment": "add back row for '"$pair"'"}]'
369 [0], [stdout], [ignore], [test ! -e pid || kill `cat pid`])
370 dnl Check that all the crap is in fact in the database log.
371 AT_CHECK([[${PERL} $srcdir/uuidfilt.pl db | grep -v ^OVSDB | sed 's/"_date":[0-9]*/"_date":0/' | test-json --multiple -]], [0],
372 [[{"cksum":"12345678 9","name":"ordinals","tables":{"ordinals":{"columns":{"name":{"type":"string"},"number":{"type":"integer"}},"indexes":[["number"]]}},"version":"5.1.3"}
373 {"_comment":"add row for zero 0","_date":0,"ordinals":{"<0>":{"name":"zero"}}}
374 {"_comment":"delete row for 0","_date":0,"ordinals":{"<0>":null}}
375 {"_comment":"add back row for zero 0","_date":0,"ordinals":{"<1>":{"name":"zero"}}}
376 {"_comment":"add row for one 1","_date":0,"ordinals":{"<2>":{"name":"one","number":1}}}
377 {"_comment":"delete row for 1","_date":0,"ordinals":{"<2>":null}}
378 {"_comment":"add back row for one 1","_date":0,"ordinals":{"<3>":{"name":"one","number":1}}}
379 {"_comment":"add row for two 2","_date":0,"ordinals":{"<4>":{"name":"two","number":2}}}
380 {"_comment":"delete row for 2","_date":0,"ordinals":{"<4>":null}}
381 {"_comment":"add back row for two 2","_date":0,"ordinals":{"<5>":{"name":"two","number":2}}}
382 {"_comment":"add row for three 3","_date":0,"ordinals":{"<6>":{"name":"three","number":3}}}
383 {"_comment":"delete row for 3","_date":0,"ordinals":{"<6>":null}}
384 {"_comment":"add back row for three 3","_date":0,"ordinals":{"<7>":{"name":"three","number":3}}}
385 {"_comment":"add row for four 4","_date":0,"ordinals":{"<8>":{"name":"four","number":4}}}
386 {"_comment":"delete row for 4","_date":0,"ordinals":{"<8>":null}}
387 {"_comment":"add back row for four 4","_date":0,"ordinals":{"<9>":{"name":"four","number":4}}}
388 {"_comment":"add row for five 5","_date":0,"ordinals":{"<10>":{"name":"five","number":5}}}
389 {"_comment":"delete row for 5","_date":0,"ordinals":{"<10>":null}}
390 {"_comment":"add back row for five 5","_date":0,"ordinals":{"<11>":{"name":"five","number":5}}}
391 ]], [], [test ! -e pid || kill `cat pid`])
392 dnl Dump out and check the actual database contents.
393 AT_CHECK([[ovsdb-client dump unix:socket ordinals]],
394 [0], [stdout], [ignore])
395 AT_CHECK([${PERL} $srcdir/uuidfilt.pl stdout], [0], [dnl
398 ------------------------------------ ----- ------
405 ], [], [test ! -e pid || kill `cat pid`])
406 dnl Now compact the database in-place.
407 AT_CHECK([[ovs-appctl -t "`pwd`"/unixctl ovsdb-server/compact]],
408 [0], [], [ignore], [test ! -e pid || kill `cat pid`])
409 dnl Make sure that "db" is still a symlink to dir/db instead of getting
410 dnl replaced by a regular file, ditto for .db.~lock~.
411 AT_CHECK([test -h db])
412 AT_CHECK([test -h .db.~lock~])
413 AT_CHECK([test -f dir/db])
414 AT_CHECK([test -f dir/.db.~lock~])
415 dnl We can't fully re-check the contents of the database log, because the
416 dnl order of the records is not predictable, but there should only be 4 lines
418 AT_CAPTURE_FILE([db])
419 AT_CHECK([test `wc -l < db` -eq 4], [0], [], [],
420 [test ! -e pid || kill `cat pid`])
421 dnl And check that the dumped data is the same too:
422 AT_CHECK([ovsdb-client dump unix:socket ordinals], [0], [stdout], [ignore],
423 [test ! -e pid || kill `cat pid`])
424 AT_CHECK([${PERL} $srcdir/uuidfilt.pl stdout], [0], [dnl
427 ------------------------------------ ----- ------
434 ], [], [test ! -e pid || kill `cat pid`])
435 dnl Now do some more transactions.
437 [[ovsdb-client transact unix:socket '
441 "where": [["number", "<", 3]]}]']],
443 ]], [ignore], [test ! -e pid || kill `cat pid`])
444 dnl There should be 6 lines in the log now.
445 AT_CHECK([test `wc -l < db` -eq 6], [0], [], [],
446 [test ! -e pid || kill `cat pid`])
447 dnl Then check that the dumped data is correct.
448 AT_CHECK([ovsdb-client dump unix:socket ordinals], [0], [stdout], [ignore],
449 [test ! -e pid || kill `cat pid`])
450 AT_CHECK([${PERL} $srcdir/uuidfilt.pl stdout], [0], [dnl
453 ------------------------------------ ----- ------
457 ], [], [test ! -e pid || kill `cat pid`])
458 OVSDB_SERVER_SHUTDOWN
461 AT_BANNER([OVSDB -- ovsdb-server transactions (SSL sockets)])
463 # OVSDB_CHECK_EXECUTION(TITLE, SCHEMA, TRANSACTIONS, OUTPUT, [KEYWORDS])
465 # Creates a database with the given SCHEMA, starts an ovsdb-server on
466 # that database, and runs each of the TRANSACTIONS (which should be a
467 # quoted list of quoted strings) against it with ovsdb-client one at a
470 # Checks that the overall output is OUTPUT, but UUIDs in the output
471 # are replaced by markers of the form <N> where N is a number. The
472 # first unique UUID is replaced by <0>, the next by <1>, and so on.
473 # If a given UUID appears more than once it is always replaced by the
476 # TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS.
477 m4_define([OVSDB_CHECK_EXECUTION],
479 AT_KEYWORDS([ovsdb server positive ssl $5])
480 AT_SKIP_IF([test "$HAVE_OPENSSL" = no])
481 OVS_RUNDIR=`pwd`; export OVS_RUNDIR
482 OVS_LOGDIR=`pwd`; export OVS_LOGDIR
484 PKIDIR=$abs_top_builddir/tests
485 AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
486 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])
487 SSL_PORT=`parse_listening_port < ovsdb-server.log`
488 m4_foreach([txn], [$3],
489 [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],
490 [test ! -e pid || kill `cat pid`])
493 AT_CHECK([${PERL} $srcdir/uuidfilt.pl output], [0], [$4], [ignore],
494 [test ! -e pid || kill `cat pid`])
495 OVSDB_SERVER_SHUTDOWN
500 AT_BANNER([OVSDB -- ovsdb-server transactions (TCP sockets)])
502 AT_SETUP([ovsdb-client get-schema-version - tcp socket])
503 AT_KEYWORDS([ovsdb server positive tcp])
504 ordinal_schema > schema
505 AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore])
506 OVS_LOGDIR=`pwd`; export OVS_LOGDIR
507 AT_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])
508 TCP_PORT=`parse_listening_port < ovsdb-server.log`
509 AT_CHECK([ovsdb-client get-schema-version tcp:127.0.0.1:$TCP_PORT ordinals], [0], [5.1.3
511 OVSDB_SERVER_SHUTDOWN
514 # OVSDB_CHECK_EXECUTION(TITLE, SCHEMA, TRANSACTIONS, OUTPUT, [KEYWORDS])
516 # Creates a database with the given SCHEMA, starts an ovsdb-server on
517 # that database, and runs each of the TRANSACTIONS (which should be a
518 # quoted list of quoted strings) against it with ovsdb-client one at a
521 # Checks that the overall output is OUTPUT, but UUIDs in the output
522 # are replaced by markers of the form <N> where N is a number. The
523 # first unique UUID is replaced by <0>, the next by <1>, and so on.
524 # If a given UUID appears more than once it is always replaced by the
527 # TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS.
528 m4_define([OVSDB_CHECK_EXECUTION],
530 AT_KEYWORDS([ovsdb server positive tcp $5])
531 OVS_RUNDIR=`pwd`; export OVS_RUNDIR
532 OVS_LOGDIR=`pwd`; export OVS_LOGDIR
534 PKIDIR=$abs_top_builddir/tests
535 AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
536 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])
537 TCP_PORT=`parse_listening_port < ovsdb-server.log`
538 m4_foreach([txn], [$3],
539 [AT_CHECK([ovsdb-client transact tcp:127.0.0.1:$TCP_PORT 'txn'], [0], [stdout], [ignore],
540 [test ! -e pid || kill `cat pid`])
543 AT_CHECK([${PERL} $srcdir/uuidfilt.pl output], [0], [$4], [ignore],
544 [test ! -e pid || kill `cat pid`])
545 OVSDB_SERVER_SHUTDOWN
550 AT_BANNER([OVSDB -- transactions on transient ovsdb-server])
552 # OVSDB_CHECK_EXECUTION(TITLE, SCHEMA, TRANSACTIONS, OUTPUT, [KEYWORDS])
554 # Creates a database with the given SCHEMA and runs each of the
555 # TRANSACTIONS (which should be a quoted list of quoted strings)
556 # against it with ovsdb-client one at a time. Each ovsdb-client
557 # is run against a separately started ovsdb-server that executes
558 # only that single transaction. (The idea is that this should
559 # help to ferret out any differences between what ovsdb-server has
560 # in memory and what actually gets committed to disk.)
562 # Checks that the overall output is OUTPUT, but UUIDs in the output
563 # are replaced by markers of the form <N> where N is a number. The
564 # first unique UUID is replaced by <0>, the next by <1>, and so on.
565 # If a given UUID appears more than once it is always replaced by the
568 # TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS.
569 m4_define([OVSDB_CHECK_EXECUTION],
571 AT_KEYWORDS([ovsdb server positive transient $5])
572 OVS_RUNDIR=`pwd`; export OVS_RUNDIR
574 AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
575 m4_foreach([txn], [$3],
576 [AT_DATA([txnfile], [ovsdb-client transact unix:socket 'txn'
578 AT_CHECK([ovsdb-server --remote=punix:socket --unixctl="`pwd`"/unixctl db --run="sh txnfile"], [0], [stdout], [ignore])
581 AT_CHECK([${PERL} $srcdir/uuidfilt.pl output], [0], [$4], [ignore])