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([ovsdb-server/add-remote and remove-remote with --monitor])
275 AT_KEYWORDS([ovsdb server positive])
276 # Start ovsdb-server, initially with no remotes.
277 OVS_RUNDIR=`pwd`; export OVS_RUNDIR
278 OVS_LOGDIR=`pwd`; export OVS_LOGDIR
279 ordinal_schema > schema
280 AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore])
281 ON_EXIT([kill `cat *.pid`])
282 AT_CHECK([ovsdb-server -v -vvlog:off --monitor --detach --no-chdir --pidfile --log-file db])
285 AT_CHECK([test ! -e socket1])
286 AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/add-remote punix:socket1])
287 OVS_WAIT_UNTIL([test -S socket1])
288 AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/list-remotes],
292 # Kill the daemon process, making it look like a segfault,
293 # and wait for a new daemon process to get spawned and for it to
294 # start listening on 'socket1'.
295 cp ovsdb-server.pid old.pid
297 AT_CHECK([kill -SEGV `cat ovsdb-server.pid`])
298 OVS_WAIT_WHILE([kill -0 `cat old.pid`])
300 [test -s ovsdb-server.pid && test `cat ovsdb-server.pid` != `cat old.pid`])
301 OVS_WAIT_UNTIL([test -S socket1])
304 AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/remove-remote punix:socket1])
305 OVS_WAIT_UNTIL([test ! -e socket1])
306 AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/list-remotes])
308 # Kill the daemon process, making it look like a segfault,
309 # and wait for a new daemon process to get spawned and make sure that it
310 # does not listen on 'socket1'.
311 cp ovsdb-server.pid old.pid
312 AT_CHECK([kill -SEGV `cat ovsdb-server.pid`])
313 OVS_WAIT_WHILE([kill -0 `cat old.pid`])
315 [test -s ovsdb-server.pid && test `cat ovsdb-server.pid` != `cat old.pid`])
316 AT_CHECK([test ! -e socket1])
319 AT_SETUP([SSL db: implementation])
320 AT_KEYWORDS([ovsdb server positive ssl $5])
321 AT_SKIP_IF([test "$HAVE_OPENSSL" = no])
322 PKIDIR=$abs_top_builddir/tests
323 AT_SKIP_IF([expr "$PKIDIR" : ".*[ '\"
330 "private_key": {"type": "string"},
331 "certificate": {"type": "string"},
332 "ca_cert": {"type": "string"}}}}}
334 AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
336 [[ovsdb-tool transact db \
340 "row": {"private_key": "'"$PKIDIR/testpki-privkey2.pem"'",
341 "certificate": "'"$PKIDIR/testpki-cert2.pem"'",
342 "ca_cert": "'"$PKIDIR/testpki-cacert.pem"'"}}]']],
343 [0], [ignore], [ignore])
344 OVS_LOGDIR=`pwd`; export OVS_LOGDIR
346 [ovsdb-server --log-file --detach --no-chdir --pidfile="`pwd`"/pid \
347 --private-key=db:SSL,private_key \
348 --certificate=db:SSL,certificate \
349 --ca-cert=db:SSL,ca_cert \
350 --remote=pssl:0:127.0.0.1 --unixctl="`pwd`"/unixctl db],
351 [0], [ignore], [ignore])
352 SSL_PORT=`parse_listening_port < ovsdb-server.log`
355 --private-key=$PKIDIR/testpki-privkey.pem \
356 --certificate=$PKIDIR/testpki-cert.pem \
357 --ca-cert=$PKIDIR/testpki-cacert.pem \
358 transact ssl:127.0.0.1:$SSL_PORT \
363 "columns": ["private_key"]}]']],
364 [0], [stdout], [ignore], [test ! -e pid || kill `cat pid`])
367 [${PERL} $srcdir/uuidfilt.pl output], [0],
368 [[[{"rows":[{"private_key":"$PKIDIR/testpki-privkey2.pem"}]}]
369 ]], [ignore], [test ! -e pid || kill `cat pid`])
370 OVSDB_SERVER_SHUTDOWN
373 AT_SETUP([compacting online])
374 AT_KEYWORDS([ovsdb server compact])
375 OVS_RUNDIR=`pwd`; export OVS_RUNDIR
376 ordinal_schema > schema
377 dnl Make sure that "ovsdb-tool create" works with a dangling symlink for
378 dnl the database and the lockfile, creating the target of each symlink rather
379 dnl than replacing the symlinks with regular files.
382 ln -s dir/.db.~lock~ .db.~lock~
383 AT_SKIP_IF([test ! -h db || test ! -h .db.~lock~])
384 AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore])
385 dnl Start ovsdb-server.
386 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])
387 AT_CAPTURE_FILE([ovsdb-server.log])
388 dnl Do a bunch of random transactions that put crap in the database log.
390 [[for pair in 'zero 0' 'one 1' 'two 2' 'three 3' 'four 4' 'five 5'; do
392 ovsdb-client transact unix:socket '
396 "row": {"name": "'$1'", "number": '$2'}},
398 "comment": "add row for '"$pair"'"}]'
399 ovsdb-client transact unix:socket '
403 "where": [["number", "==", '$2']]},
405 "comment": "delete row for '"$2"'"}]'
406 ovsdb-client transact unix:socket '
410 "row": {"name": "'$1'", "number": '$2'}},
412 "comment": "add back row for '"$pair"'"}]'
414 [0], [stdout], [ignore], [test ! -e pid || kill `cat pid`])
415 dnl Check that all the crap is in fact in the database log.
416 AT_CHECK([[${PERL} $srcdir/uuidfilt.pl db | grep -v ^OVSDB | sed 's/"_date":[0-9]*/"_date":0/' | test-json --multiple -]], [0],
417 [[{"cksum":"12345678 9","name":"ordinals","tables":{"ordinals":{"columns":{"name":{"type":"string"},"number":{"type":"integer"}},"indexes":[["number"]]}},"version":"5.1.3"}
418 {"_comment":"add row for zero 0","_date":0,"ordinals":{"<0>":{"name":"zero"}}}
419 {"_comment":"delete row for 0","_date":0,"ordinals":{"<0>":null}}
420 {"_comment":"add back row for zero 0","_date":0,"ordinals":{"<1>":{"name":"zero"}}}
421 {"_comment":"add row for one 1","_date":0,"ordinals":{"<2>":{"name":"one","number":1}}}
422 {"_comment":"delete row for 1","_date":0,"ordinals":{"<2>":null}}
423 {"_comment":"add back row for one 1","_date":0,"ordinals":{"<3>":{"name":"one","number":1}}}
424 {"_comment":"add row for two 2","_date":0,"ordinals":{"<4>":{"name":"two","number":2}}}
425 {"_comment":"delete row for 2","_date":0,"ordinals":{"<4>":null}}
426 {"_comment":"add back row for two 2","_date":0,"ordinals":{"<5>":{"name":"two","number":2}}}
427 {"_comment":"add row for three 3","_date":0,"ordinals":{"<6>":{"name":"three","number":3}}}
428 {"_comment":"delete row for 3","_date":0,"ordinals":{"<6>":null}}
429 {"_comment":"add back row for three 3","_date":0,"ordinals":{"<7>":{"name":"three","number":3}}}
430 {"_comment":"add row for four 4","_date":0,"ordinals":{"<8>":{"name":"four","number":4}}}
431 {"_comment":"delete row for 4","_date":0,"ordinals":{"<8>":null}}
432 {"_comment":"add back row for four 4","_date":0,"ordinals":{"<9>":{"name":"four","number":4}}}
433 {"_comment":"add row for five 5","_date":0,"ordinals":{"<10>":{"name":"five","number":5}}}
434 {"_comment":"delete row for 5","_date":0,"ordinals":{"<10>":null}}
435 {"_comment":"add back row for five 5","_date":0,"ordinals":{"<11>":{"name":"five","number":5}}}
436 ]], [], [test ! -e pid || kill `cat pid`])
437 dnl Dump out and check the actual database contents.
438 AT_CHECK([[ovsdb-client dump unix:socket ordinals]],
439 [0], [stdout], [ignore])
440 AT_CHECK([${PERL} $srcdir/uuidfilt.pl stdout], [0], [dnl
443 ------------------------------------ ----- ------
450 ], [], [test ! -e pid || kill `cat pid`])
451 dnl Now compact the database in-place.
452 AT_CHECK([[ovs-appctl -t "`pwd`"/unixctl ovsdb-server/compact]],
453 [0], [], [ignore], [test ! -e pid || kill `cat pid`])
454 dnl Make sure that "db" is still a symlink to dir/db instead of getting
455 dnl replaced by a regular file, ditto for .db.~lock~.
456 AT_CHECK([test -h db])
457 AT_CHECK([test -h .db.~lock~])
458 AT_CHECK([test -f dir/db])
459 AT_CHECK([test -f dir/.db.~lock~])
460 dnl We can't fully re-check the contents of the database log, because the
461 dnl order of the records is not predictable, but there should only be 4 lines
463 AT_CAPTURE_FILE([db])
464 AT_CHECK([test `wc -l < db` -eq 4], [0], [], [],
465 [test ! -e pid || kill `cat pid`])
466 dnl And check that the dumped data is the same too:
467 AT_CHECK([ovsdb-client dump unix:socket ordinals], [0], [stdout], [ignore],
468 [test ! -e pid || kill `cat pid`])
469 AT_CHECK([${PERL} $srcdir/uuidfilt.pl stdout], [0], [dnl
472 ------------------------------------ ----- ------
479 ], [], [test ! -e pid || kill `cat pid`])
480 dnl Now do some more transactions.
482 [[ovsdb-client transact unix:socket '
486 "where": [["number", "<", 3]]}]']],
488 ]], [ignore], [test ! -e pid || kill `cat pid`])
489 dnl There should be 6 lines in the log now.
490 AT_CHECK([test `wc -l < db` -eq 6], [0], [], [],
491 [test ! -e pid || kill `cat pid`])
492 dnl Then check that the dumped data is correct.
493 AT_CHECK([ovsdb-client dump unix:socket ordinals], [0], [stdout], [ignore],
494 [test ! -e pid || kill `cat pid`])
495 AT_CHECK([${PERL} $srcdir/uuidfilt.pl stdout], [0], [dnl
498 ------------------------------------ ----- ------
502 ], [], [test ! -e pid || kill `cat pid`])
503 OVSDB_SERVER_SHUTDOWN
506 AT_BANNER([OVSDB -- ovsdb-server transactions (SSL sockets)])
508 # OVSDB_CHECK_EXECUTION(TITLE, SCHEMA, TRANSACTIONS, OUTPUT, [KEYWORDS])
510 # Creates a database with the given SCHEMA, starts an ovsdb-server on
511 # that database, and runs each of the TRANSACTIONS (which should be a
512 # quoted list of quoted strings) against it with ovsdb-client one at a
515 # Checks that the overall output is OUTPUT, but UUIDs in the output
516 # are replaced by markers of the form <N> where N is a number. The
517 # first unique UUID is replaced by <0>, the next by <1>, and so on.
518 # If a given UUID appears more than once it is always replaced by the
521 # TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS.
522 m4_define([OVSDB_CHECK_EXECUTION],
524 AT_KEYWORDS([ovsdb server positive ssl $5])
525 AT_SKIP_IF([test "$HAVE_OPENSSL" = no])
526 OVS_RUNDIR=`pwd`; export OVS_RUNDIR
527 OVS_LOGDIR=`pwd`; export OVS_LOGDIR
529 PKIDIR=$abs_top_builddir/tests
530 AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
531 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])
532 SSL_PORT=`parse_listening_port < ovsdb-server.log`
533 m4_foreach([txn], [$3],
534 [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],
535 [test ! -e pid || kill `cat pid`])
538 AT_CHECK([${PERL} $srcdir/uuidfilt.pl output], [0], [$4], [ignore],
539 [test ! -e pid || kill `cat pid`])
540 OVSDB_SERVER_SHUTDOWN
545 AT_BANNER([OVSDB -- ovsdb-server transactions (TCP sockets)])
547 AT_SETUP([ovsdb-client get-schema-version - tcp socket])
548 AT_KEYWORDS([ovsdb server positive tcp])
549 ordinal_schema > schema
550 AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore])
551 OVS_LOGDIR=`pwd`; export OVS_LOGDIR
552 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])
553 TCP_PORT=`parse_listening_port < ovsdb-server.log`
554 AT_CHECK([ovsdb-client get-schema-version tcp:127.0.0.1:$TCP_PORT ordinals], [0], [5.1.3
556 OVSDB_SERVER_SHUTDOWN
559 # OVSDB_CHECK_EXECUTION(TITLE, SCHEMA, TRANSACTIONS, OUTPUT, [KEYWORDS])
561 # Creates a database with the given SCHEMA, starts an ovsdb-server on
562 # that database, and runs each of the TRANSACTIONS (which should be a
563 # quoted list of quoted strings) against it with ovsdb-client one at a
566 # Checks that the overall output is OUTPUT, but UUIDs in the output
567 # are replaced by markers of the form <N> where N is a number. The
568 # first unique UUID is replaced by <0>, the next by <1>, and so on.
569 # If a given UUID appears more than once it is always replaced by the
572 # TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS.
573 m4_define([OVSDB_CHECK_EXECUTION],
575 AT_KEYWORDS([ovsdb server positive tcp $5])
576 OVS_RUNDIR=`pwd`; export OVS_RUNDIR
577 OVS_LOGDIR=`pwd`; export OVS_LOGDIR
579 PKIDIR=$abs_top_builddir/tests
580 AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
581 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])
582 TCP_PORT=`parse_listening_port < ovsdb-server.log`
583 m4_foreach([txn], [$3],
584 [AT_CHECK([ovsdb-client transact tcp:127.0.0.1:$TCP_PORT 'txn'], [0], [stdout], [ignore],
585 [test ! -e pid || kill `cat pid`])
588 AT_CHECK([${PERL} $srcdir/uuidfilt.pl output], [0], [$4], [ignore],
589 [test ! -e pid || kill `cat pid`])
590 OVSDB_SERVER_SHUTDOWN
595 AT_BANNER([OVSDB -- transactions on transient ovsdb-server])
597 # OVSDB_CHECK_EXECUTION(TITLE, SCHEMA, TRANSACTIONS, OUTPUT, [KEYWORDS])
599 # Creates a database with the given SCHEMA and runs each of the
600 # TRANSACTIONS (which should be a quoted list of quoted strings)
601 # against it with ovsdb-client one at a time. Each ovsdb-client
602 # is run against a separately started ovsdb-server that executes
603 # only that single transaction. (The idea is that this should
604 # help to ferret out any differences between what ovsdb-server has
605 # in memory and what actually gets committed to disk.)
607 # Checks that the overall output is OUTPUT, but UUIDs in the output
608 # are replaced by markers of the form <N> where N is a number. The
609 # first unique UUID is replaced by <0>, the next by <1>, and so on.
610 # If a given UUID appears more than once it is always replaced by the
613 # TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS.
614 m4_define([OVSDB_CHECK_EXECUTION],
616 AT_KEYWORDS([ovsdb server positive transient $5])
617 OVS_RUNDIR=`pwd`; export OVS_RUNDIR
619 AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
620 m4_foreach([txn], [$3],
621 [AT_DATA([txnfile], [ovsdb-client transact unix:socket 'txn'
623 AT_CHECK([ovsdb-server --remote=punix:socket --unixctl="`pwd`"/unixctl db --run="sh txnfile"], [0], [stdout], [ignore])
626 AT_CHECK([${PERL} $srcdir/uuidfilt.pl output], [0], [$4], [ignore])