]>
Commit | Line | Data |
---|---|---|
80d326ad | 1 | AT_BANNER([OVSDB -- ovsdb-server transactions (Unix sockets)]) |
21ff1aee | 2 | |
028cbd99 BP |
3 | m4_define([OVSDB_SERVER_SHUTDOWN], |
4 | [cp pid savepid | |
5 | AT_CHECK([ovs-appctl -t $PWD/unixctl -e exit], [0], [ignore], [ignore]) | |
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. | |
22 | m4_define([OVSDB_CHECK_EXECUTION], | |
23 | [AT_SETUP([$1]) | |
9ff373db | 24 | AT_KEYWORDS([ovsdb server positive unix $5]) |
21ff1aee BP |
25 | AT_DATA([schema], [$2 |
26 | ]) | |
7c126fbb | 27 | AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore]) |
0b1fae1b | 28 | AT_CHECK([ovsdb-server --detach --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`]) |
32 | cat stdout >> output | |
33 | ]) | |
b12e3c41 | 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 | ||
39 | EXECUTION_EXAMPLES | |
80d326ad | 40 | \f |
9cb53f26 BP |
41 | AT_SETUP([database multiplexing implementation]) |
42 | AT_KEYWORDS([ovsdb server positive]) | |
43 | AT_DATA([schema], [ORDINAL_SCHEMA | |
44 | ]) | |
45 | AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore]) | |
46 | AT_CHECK([ovsdb-server --detach --pidfile=$PWD/pid --unixctl=$PWD/unixctl --remote=punix:socket db], [0], [ignore], [ignore]) | |
47 | AT_CHECK( | |
48 | [[ovsdb-client list-dbs unix:socket]], | |
49 | [0], [ordinals | |
50 | ], [ignore], [test ! -e pid || kill `cat pid`]) | |
51 | AT_CHECK( | |
52 | [[ovsdb-client get-schema unix:socket nonexistent]], | |
53 | [1], [], [[ovsdb-client: syntax "{"syntax":"[\"nonexistent\"]","details":"get_schema request specifies unknown database nonexistent","error":"unknown database"}": syntax error: Parsing database schema failed: Required 'name' member is missing. | |
54 | ]], [test ! -e pid || kill `cat pid`]) | |
55 | OVSDB_SERVER_SHUTDOWN | |
56 | AT_CLEANUP | |
57 | ||
0b1fae1b BP |
58 | AT_SETUP([--remote=db: implementation]) |
59 | AT_KEYWORDS([ovsdb server positive]) | |
60 | AT_DATA([schema], | |
61 | [[{"name": "mydb", | |
62 | "tables": { | |
63 | "Manager": { | |
64 | "columns": { | |
65 | "manager": {"type": "string"}}}}} | |
66 | ]]) | |
7c126fbb BP |
67 | AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore]) |
68 | AT_CHECK( | |
0b1fae1b | 69 | [[ovsdb-tool transact db \ |
9cb53f26 BP |
70 | '["mydb", |
71 | {"op": "insert", | |
0b1fae1b BP |
72 | "table": "Manager", |
73 | "row": {"manager": "punix:socket"}}]']], [0], [ignore], [ignore]) | |
74 | AT_CHECK([ovsdb-server --detach --pidfile=$PWD/pid --remote=db:Manager,manager --unixctl=$PWD/unixctl db], [0], [ignore], [ignore]) | |
7c126fbb | 75 | AT_CHECK( |
0b1fae1b | 76 | [[ovsdb-client transact unix:socket \ |
9cb53f26 BP |
77 | '["mydb", |
78 | {"op": "select", | |
0b1fae1b BP |
79 | "table": "Manager", |
80 | "where": [], | |
81 | "columns": ["manager"]}]']], | |
82 | [0], [stdout], [ignore], [test ! -e pid || kill `cat pid`]) | |
83 | AT_CHECK( | |
84 | [perl $srcdir/uuidfilt.pl stdout], | |
85 | [0], | |
86 | [[[{"rows":[{"manager":"punix:socket"}]}] | |
87 | ]], | |
88 | [ignore], | |
89 | [test ! -e pid || kill `cat pid`]) | |
028cbd99 | 90 | OVSDB_SERVER_SHUTDOWN |
0b1fae1b | 91 | AT_CLEANUP |
80d326ad BP |
92 | \f |
93 | AT_BANNER([OVSDB -- ovsdb-server transactions (SSL sockets)]) | |
94 | ||
95 | # OVSDB_CHECK_EXECUTION(TITLE, SCHEMA, TRANSACTIONS, OUTPUT, [KEYWORDS]) | |
96 | # | |
97 | # Creates a database with the given SCHEMA, starts an ovsdb-server on | |
98 | # that database, and runs each of the TRANSACTIONS (which should be a | |
99 | # quoted list of quoted strings) against it with ovsdb-client one at a | |
100 | # time. | |
101 | # | |
102 | # Checks that the overall output is OUTPUT, but UUIDs in the output | |
103 | # are replaced by markers of the form <N> where N is a number. The | |
104 | # first unique UUID is replaced by <0>, the next by <1>, and so on. | |
105 | # If a given UUID appears more than once it is always replaced by the | |
106 | # same marker. | |
107 | # | |
108 | # TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS. | |
109 | m4_define([OVSDB_CHECK_EXECUTION], | |
110 | [AT_SETUP([$1]) | |
111 | AT_KEYWORDS([ovsdb server positive ssl $5]) | |
112 | AT_SKIP_IF([test "$HAVE_OPENSSL" = no]) | |
113 | AT_SKIP_IF([test "x$RANDOM" = x]) | |
114 | AT_DATA([schema], [$2 | |
115 | ]) | |
116 | SSL_PORT=`expr 32767 + \( $RANDOM % 32767 \)` | |
117 | PKIDIR=$abs_top_srcdir/tests | |
7c126fbb | 118 | AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore]) |
80d326ad BP |
119 | AT_CHECK([ovsdb-server --detach --pidfile=$PWD/pid --private-key=$PKIDIR/testpki-privkey2.pem --certificate=$PKIDIR/testpki-cert2.pem --ca-cert=$PKIDIR/testpki-cacert.pem --remote=pssl:$SSL_PORT:127.0.0.1 --unixctl=$PWD/unixctl db], [0], [ignore], [ignore]) |
120 | m4_foreach([txn], [$3], | |
7c126fbb | 121 | [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 |
122 | [test ! -e pid || kill `cat pid`]) |
123 | cat stdout >> output | |
124 | ]) | |
125 | AT_CHECK([perl $srcdir/uuidfilt.pl output], [0], [$4], [ignore], | |
126 | [test ! -e pid || kill `cat pid`]) | |
028cbd99 | 127 | OVSDB_SERVER_SHUTDOWN |
80d326ad BP |
128 | AT_CLEANUP]) |
129 | ||
130 | EXECUTION_EXAMPLES | |
9ff373db BP |
131 | \f |
132 | AT_BANNER([OVSDB -- transactions on transient ovsdb-server]) | |
133 | ||
134 | # OVSDB_CHECK_EXECUTION(TITLE, SCHEMA, TRANSACTIONS, OUTPUT, [KEYWORDS]) | |
135 | # | |
136 | # Creates a database with the given SCHEMA and runs each of the | |
137 | # TRANSACTIONS (which should be a quoted list of quoted strings) | |
138 | # against it with ovsdb-client one at a time. Each ovsdb-client | |
139 | # is run against a separately started ovsdb-server that executes | |
140 | # only that single transaction. (The idea is that this should | |
141 | # help to ferret out any differences between what ovsdb-server has | |
142 | # in memory and what actually gets committed to disk.) | |
143 | # | |
144 | # Checks that the overall output is OUTPUT, but UUIDs in the output | |
145 | # are replaced by markers of the form <N> where N is a number. The | |
146 | # first unique UUID is replaced by <0>, the next by <1>, and so on. | |
147 | # If a given UUID appears more than once it is always replaced by the | |
148 | # same marker. | |
149 | # | |
150 | # TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS. | |
151 | m4_define([OVSDB_CHECK_EXECUTION], | |
152 | [AT_SETUP([$1]) | |
153 | AT_KEYWORDS([ovsdb server positive transient $5]) | |
154 | AT_DATA([schema], [$2 | |
155 | ]) | |
156 | AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore]) | |
157 | m4_foreach([txn], [$3], | |
158 | [AT_DATA([txnfile], [ovsdb-client transact unix:socket 'txn' | |
159 | ]) | |
160 | AT_CHECK([ovsdb-server --remote=punix:socket --unixctl=$PWD/unixctl db --run="sh txnfile"], [0], [stdout], [ignore]) | |
161 | cat stdout >> output | |
162 | ]) | |
163 | AT_CHECK([perl $srcdir/uuidfilt.pl output], [0], [$4], [ignore]) | |
164 | AT_CLEANUP]) | |
165 | ||
166 | EXECUTION_EXAMPLES |