]>
Commit | Line | Data |
---|---|---|
c3bb4bd7 BP |
1 | AT_BANNER([OVSDB -- interface description language (IDL)]) |
2 | ||
56120500 BP |
3 | m4_divert_text([PREPARE_TESTS], [ |
4 | # ovsdb_start_idltest [REMOTE] [SCHEMA] | |
5 | # | |
6 | # Creates a database using SCHEMA (default: idltest.ovsschema) and | |
7 | # starts a database server listening on punix:socket and REMOTE (if | |
8 | # specified). | |
9 | ovsdb_start_idltest () { | |
10 | ovsdb-tool create db ${2:-$abs_srcdir/idltest.ovsschema} || return $? | |
11 | ovsdb-server -vconsole:warn --log-file --detach --no-chdir --pidfile --remote=punix:socket ${1:+--remote=$1} db || return $? | |
12 | on_exit 'kill `cat ovsdb-server.pid`' | |
13 | } | |
c39751e4 TE |
14 | |
15 | # ovsdb_cluster_start_idltest [REMOTE] [SCHEMA] | |
16 | # | |
17 | # Creates a database using SCHEMA (default: idltest.ovsschema) and | |
18 | # starts a database cluster listening on punix:socket and REMOTE (if | |
19 | # specified). | |
20 | ovsdb_cluster_start_idltest () { | |
21 | local n=$1 | |
22 | ovsdb-tool create-cluster s1.db $abs_srcdir/idltest.ovsschema unix:s1.raft || return $? | |
23 | cid=`ovsdb-tool db-cid s1.db` | |
24 | schema_name=`ovsdb-tool schema-name $abs_srcdir/idltest.ovsschema` | |
25 | for i in `seq 2 $n`; do | |
26 | ovsdb-tool join-cluster s$i.db $schema_name unix:s$i.raft unix:s1.raft || return $? | |
27 | done | |
28 | for i in `seq $n`; do | |
29 | ovsdb-server -vraft -vconsole:warn --detach --no-chdir --log-file=s$i.log --pidfile=s$i.pid --unixctl=s$i --remote=punix:s$i.ovsdb ${2:+--remote=$2} s$i.db || return $? | |
30 | done | |
31 | on_exit 'kill `cat s*.pid`' | |
32 | } | |
33 | ||
34 | # ovsdb_cluster_leader [REMOTES] [DATABASE] | |
35 | # | |
36 | # Returns the leader of the DATABASE cluster. | |
37 | ovsdb_cluster_leader () { | |
38 | remotes=$(echo $1 | tr "," "\n") | |
39 | for remote in $remotes; do | |
40 | ovsdb-client dump $remote _Server Database name leader | grep $2 | grep -q true | |
41 | if [[ $? == 0 ]]; then | |
42 | port=$(echo $remote | cut -d':' -f 3) | |
43 | log=$(grep --include=s\*.log -rlnw -e "listening on port $port" ./) | |
44 | pid=$(echo $log | sed 's/\(.*\.\)log/\1pid/' ) | |
45 | echo "${remote}|${pid}" | |
46 | return | |
47 | fi | |
48 | done | |
49 | }]) | |
56120500 | 50 | |
8cdf0349 BP |
51 | # OVSDB_CHECK_IDL_C(TITLE, [PRE-IDL-TXN], TRANSACTIONS, OUTPUT, [KEYWORDS], |
52 | # [FILTER]) | |
c3bb4bd7 BP |
53 | # |
54 | # Creates a database with a schema derived from idltest.ovsidl, runs | |
55 | # each PRE-IDL-TXN (if any), starts an ovsdb-server on that database, | |
56 | # and runs "test-ovsdb idl" passing each of the TRANSACTIONS along. | |
57 | # | |
58 | # Checks that the overall output is OUTPUT. Before comparison, the | |
59 | # output is sorted (using "sort") and UUIDs in the output are replaced | |
60 | # by markers of the form <N> where N is a number. The first unique | |
61 | # UUID is replaced by <0>, the next by <1>, and so on. If a given | |
62 | # UUID appears more than once it is always replaced by the same | |
254604d8 BP |
63 | # marker. If FILTER is supplied then the output is also filtered |
64 | # through the specified program. | |
c3bb4bd7 BP |
65 | # |
66 | # TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS. | |
8cdf0349 BP |
67 | m4_define([OVSDB_CHECK_IDL_C], |
68 | [AT_SETUP([$1 - C]) | |
c3bb4bd7 | 69 | AT_KEYWORDS([ovsdb server idl positive $5]) |
56120500 | 70 | AT_CHECK([ovsdb_start_idltest]) |
c3bb4bd7 | 71 | m4_if([$2], [], [], |
7427f2a4 | 72 | [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])]) |
8cdf0349 | 73 | AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 idl unix:socket $3], |
7427f2a4 | 74 | [0], [stdout], [ignore]) |
c724bd67 | 75 | AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]), |
7427f2a4 | 76 | [0], [$4]) |
028cbd99 | 77 | OVSDB_SERVER_SHUTDOWN |
c3bb4bd7 BP |
78 | AT_CLEANUP]) |
79 | ||
b481a4cc IM |
80 | # same as OVSDB_CHECK_IDL but uses tcp. |
81 | m4_define([OVSDB_CHECK_IDL_TCP_C], | |
82 | [AT_SETUP([$1 - C - tcp]) | |
83 | AT_KEYWORDS([ovsdb server idl positive tcp socket $5]) | |
84 | AT_CHECK([ovsdb_start_idltest "ptcp:0:127.0.0.1"]) | |
85 | PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT]) | |
86 | ||
87 | m4_if([$2], [], [], | |
88 | [AT_CHECK([ovsdb-client transact tcp:127.0.0.1:$TCP_PORT $2], [0], [ignore], [ignore])]) | |
89 | AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 idl tcp:127.0.0.1:$TCP_PORT $3], | |
90 | [0], [stdout], [ignore]) | |
91 | AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]), | |
92 | [0], [$4]) | |
93 | OVSDB_SERVER_SHUTDOWN | |
94 | AT_CLEANUP]) | |
95 | ||
96 | # same as OVSDB_CHECK_IDL but uses tcp6. | |
97 | m4_define([OVSDB_CHECK_IDL_TCP6_C], | |
98 | [AT_SETUP([$1 - C - tcp6]) | |
99 | AT_SKIP_IF([test "$IS_WIN32" = "yes"]) | |
100 | AT_SKIP_IF([test $HAVE_IPV6 = no]) | |
101 | AT_KEYWORDS([ovsdb server idl positive tcp6 socket $5]) | |
102 | AT_CHECK([ovsdb_start_idltest "ptcp:0:[[::1]]"]) | |
103 | PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT]) | |
104 | ||
105 | m4_if([$2], [], [], | |
106 | [AT_CHECK([ovsdb-client transact tcp:[[::1]]:$TCP_PORT $2], [0], [ignore], [ignore])]) | |
107 | AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 idl tcp:[[::1]]:$TCP_PORT $3], | |
108 | [0], [stdout], [ignore]) | |
109 | AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]), | |
110 | [0], [$4]) | |
111 | OVSDB_SERVER_SHUTDOWN | |
112 | AT_CLEANUP]) | |
113 | ||
8cdf0349 | 114 | # same as OVSDB_CHECK_IDL but uses the Python IDL implementation. |
1ca0323e BP |
115 | m4_define([OVSDB_CHECK_IDL_PY], |
116 | [AT_SETUP([$1 - Python3]) | |
8cdf0349 | 117 | AT_KEYWORDS([ovsdb server idl positive Python $5]) |
56120500 | 118 | AT_CHECK([ovsdb_start_idltest]) |
8cdf0349 | 119 | m4_if([$2], [], [], |
7427f2a4 | 120 | [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])]) |
1ca0323e | 121 | AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket $3], |
7427f2a4 | 122 | [0], [stdout], [ignore]) |
c724bd67 | 123 | AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]), |
7427f2a4 | 124 | [0], [$4]) |
8cdf0349 BP |
125 | OVSDB_SERVER_SHUTDOWN |
126 | AT_CLEANUP]) | |
127 | ||
1ca0323e BP |
128 | m4_define([OVSDB_CHECK_IDL_REGISTER_COLUMNS_PY], |
129 | [AT_SETUP([$1 - Python3 - register_columns]) | |
01dc1516 | 130 | AT_KEYWORDS([ovsdb server idl positive Python register_columns $5]) |
56120500 | 131 | AT_CHECK([ovsdb_start_idltest]) |
01dc1516 | 132 | m4_if([$2], [], [], |
7427f2a4 | 133 | [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])]) |
1ca0323e | 134 | AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket ?simple:b,ba,i,ia,r,ra,s,sa,u,ua?link1:i,k,ka,l2?link2:i,l1?singleton:name $3], |
7427f2a4 | 135 | [0], [stdout], [ignore]) |
c724bd67 | 136 | AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]), |
7427f2a4 | 137 | [0], [$4]) |
01dc1516 SA |
138 | OVSDB_SERVER_SHUTDOWN |
139 | AT_CLEANUP]) | |
140 | ||
e06d06a7 | 141 | # same as OVSDB_CHECK_IDL but uses the Python IDL implementation with tcp |
1ca0323e BP |
142 | m4_define([OVSDB_CHECK_IDL_TCP_PY], |
143 | [AT_SETUP([$1 - Python3 - tcp]) | |
e06d06a7 | 144 | AT_KEYWORDS([ovsdb server idl positive Python with tcp socket $5]) |
56120500 | 145 | AT_CHECK([ovsdb_start_idltest "ptcp:0:127.0.0.1"]) |
fb28ef2d | 146 | PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT]) |
1e04fcc8 | 147 | |
e06d06a7 | 148 | m4_if([$2], [], [], |
7427f2a4 | 149 | [AT_CHECK([ovsdb-client transact tcp:127.0.0.1:$TCP_PORT $2], [0], [ignore], [ignore])]) |
1ca0323e | 150 | AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema tcp:127.0.0.1:$TCP_PORT $3], |
7427f2a4 | 151 | [0], [stdout], [ignore]) |
c724bd67 | 152 | AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]), |
7427f2a4 | 153 | [0], [$4]) |
e06d06a7 IY |
154 | OVSDB_SERVER_SHUTDOWN |
155 | AT_CLEANUP]) | |
156 | ||
31e434fc NS |
157 | # same as OVSDB_CHECK_IDL but uses the Python IDL implementation with tcp |
158 | # with multiple remotes with only one remote reachable | |
1ca0323e BP |
159 | m4_define([OVSDB_CHECK_IDL_TCP_MULTIPLE_REMOTES_PY], |
160 | [AT_SETUP([$1 - Python3 (multiple remotes) - tcp]) | |
31e434fc NS |
161 | AT_KEYWORDS([ovsdb server idl positive Python with tcp socket $5]) |
162 | AT_CHECK([ovsdb_start_idltest "ptcp:0:127.0.0.1"]) | |
163 | PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT]) | |
fe495d0c IM |
164 | WRONG_PORT_1=$((TCP_PORT + 101)) |
165 | WRONG_PORT_2=$((TCP_PORT + 102)) | |
31e434fc NS |
166 | remote=tcp:127.0.0.1:$WRONG_PORT_1,tcp:127.0.0.1:$TCP_PORT,tcp:127.0.0.1:$WRONG_PORT_2 |
167 | m4_if([$2], [], [], | |
168 | [AT_CHECK([ovsdb-client transact tcp:127.0.0.1:$TCP_PORT $2], [0], [ignore], [ignore])]) | |
1ca0323e | 169 | AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py -t20 idl $srcdir/idltest.ovsschema $remote $3], |
31e434fc NS |
170 | [0], [stdout], [ignore]) |
171 | AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]), | |
172 | [0], [$4]) | |
173 | OVSDB_SERVER_SHUTDOWN | |
174 | AT_CLEANUP]) | |
175 | ||
e731d71b | 176 | # same as OVSDB_CHECK_IDL but uses the Python IDL implementation with tcp6 |
1ca0323e BP |
177 | m4_define([OVSDB_CHECK_IDL_TCP6_PY], |
178 | [AT_SETUP([$1 - Python3 - tcp6]) | |
7b9d1b65 | 179 | AT_SKIP_IF([test "$IS_WIN32" = "yes"]) |
4819b3a5 | 180 | AT_SKIP_IF([test $HAVE_IPV6 = no]) |
e731d71b | 181 | AT_KEYWORDS([ovsdb server idl positive Python with tcp6 socket $5]) |
56120500 | 182 | AT_CHECK([ovsdb_start_idltest "ptcp:0:[[::1]]"]) |
fb28ef2d | 183 | PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT]) |
e731d71b AS |
184 | echo "TCP_PORT=$TCP_PORT" |
185 | ||
186 | m4_if([$2], [], [], | |
7427f2a4 | 187 | [AT_CHECK([ovsdb-client transact "tcp:[[::1]]:$TCP_PORT" $2], [0], [ignore], [ignore])]) |
1ca0323e | 188 | AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema tcp:[[::1]]:$TCP_PORT $3], |
7427f2a4 | 189 | [0], [stdout], [ignore]) |
c724bd67 | 190 | AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]), |
7427f2a4 | 191 | [0], [$4]) |
e731d71b AS |
192 | OVSDB_SERVER_SHUTDOWN |
193 | AT_CLEANUP]) | |
194 | ||
1ca0323e BP |
195 | m4_define([OVSDB_CHECK_IDL_TCP6_MULTIPLE_REMOTES_PY], |
196 | [AT_SETUP([$1 - Python3 - tcp6]) | |
31e434fc NS |
197 | AT_SKIP_IF([test "$IS_WIN32" = "yes"]) |
198 | AT_SKIP_IF([test $HAVE_IPV6 = no]) | |
199 | AT_KEYWORDS([ovsdb server idl positive Python with tcp6 socket $5]) | |
200 | AT_CHECK([ovsdb_start_idltest "ptcp:0:[[::1]]"]) | |
201 | PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT]) | |
fe495d0c IM |
202 | WRONG_PORT_1=$((TCP_PORT + 101)) |
203 | WRONG_PORT_2=$((TCP_PORT + 102)) | |
31e434fc NS |
204 | remote="tcp:[[::1]]:$WRONG_PORT_1,tcp:[[::1]]:$TCP_PORT,tcp:[[::1]]:$WRONG_PORT_2" |
205 | m4_if([$2], [], [], | |
206 | [AT_CHECK([ovsdb-client transact "tcp:[[::1]]:$TCP_PORT" $2], [0], [ignore], [ignore])]) | |
1ca0323e | 207 | AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py -t20 idl $srcdir/idltest.ovsschema $remote $3], |
31e434fc NS |
208 | [0], [stdout], [ignore]) |
209 | AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]), | |
210 | [0], [$4]) | |
211 | OVSDB_SERVER_SHUTDOWN | |
212 | AT_CLEANUP]) | |
213 | ||
61845323 | 214 | # same as OVSDB_CHECK_IDL but uses the Python IDL implementation with SSL |
1ca0323e BP |
215 | m4_define([OVSDB_CHECK_IDL_SSL_PY], |
216 | [AT_SETUP([$1 - Python3 - SSL]) | |
61845323 | 217 | AT_SKIP_IF([test "$HAVE_OPENSSL" = no]) |
1ca0323e | 218 | $PYTHON3 -c "import OpenSSL.SSL" |
61845323 JS |
219 | SSL_PRESENT=$? |
220 | AT_SKIP_IF([test $SSL_PRESENT != 0]) | |
221 | AT_KEYWORDS([ovsdb server idl positive Python with ssl socket $5]) | |
222 | AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema], | |
223 | [0], [stdout], [ignore]) | |
224 | PKIDIR=$abs_top_builddir/tests | |
225 | AT_CHECK([ovsdb-server -vconsole:warn --log-file --detach --no-chdir \ | |
226 | --pidfile \ | |
227 | --private-key=$PKIDIR/testpki-privkey2.pem \ | |
228 | --certificate=$PKIDIR/testpki-cert2.pem \ | |
229 | --ca-cert=$PKIDIR/testpki-cacert.pem \ | |
230 | --remote=pssl:0:127.0.0.1 db]) | |
231 | on_exit 'kill `cat ovsdb-server.pid`' | |
232 | PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT]) | |
233 | m4_if([$2], [], [], | |
234 | [AT_CHECK([ovsdb-client \ | |
235 | --private-key=$PKIDIR/testpki-privkey2.pem \ | |
236 | --certificate=$PKIDIR/testpki-cert2.pem \ | |
237 | --ca-cert=$PKIDIR/testpki-cacert.pem \ | |
238 | transact "ssl:127.0.0.1:$TCP_PORT" $2], [0], [ignore], [ignore])]) | |
1ca0323e | 239 | AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema \ |
61845323 JS |
240 | ssl:127.0.0.1:$TCP_PORT $PKIDIR/testpki-privkey.pem \ |
241 | $PKIDIR/testpki-cert.pem $PKIDIR/testpki-cacert.pem $3], | |
242 | [0], [stdout], [ignore]) | |
243 | AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]), | |
244 | [0], [$4]) | |
245 | OVSDB_SERVER_SHUTDOWN | |
246 | AT_CLEANUP]) | |
247 | ||
8cdf0349 BP |
248 | m4_define([OVSDB_CHECK_IDL], |
249 | [OVSDB_CHECK_IDL_C($@) | |
b481a4cc IM |
250 | OVSDB_CHECK_IDL_TCP_C($@) |
251 | OVSDB_CHECK_IDL_TCP6_C($@) | |
e06d06a7 | 252 | OVSDB_CHECK_IDL_PY($@) |
01dc1516 | 253 | OVSDB_CHECK_IDL_REGISTER_COLUMNS_PY($@) |
e731d71b | 254 | OVSDB_CHECK_IDL_TCP_PY($@) |
31e434fc | 255 | OVSDB_CHECK_IDL_TCP_MULTIPLE_REMOTES_PY($@) |
61845323 | 256 | OVSDB_CHECK_IDL_TCP6_PY($@) |
31e434fc | 257 | OVSDB_CHECK_IDL_TCP6_MULTIPLE_REMOTES_PY($@) |
61845323 | 258 | OVSDB_CHECK_IDL_SSL_PY($@)]) |
8cdf0349 | 259 | |
af358237 | 260 | # This test uses the Python IDL implementation with passive tcp |
1ca0323e BP |
261 | m4_define([OVSDB_CHECK_IDL_PASSIVE_TCP_PY], |
262 | [AT_SETUP([$1 - Python3 - ptcp]) | |
af358237 | 263 | AT_KEYWORDS([ovsdb server idl positive Python with tcp socket $5]) |
af358237 | 264 | # find free TCP port |
56120500 | 265 | AT_CHECK([ovsdb_start_idltest "ptcp:0:127.0.0.1"]) |
af358237 | 266 | PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT]) |
7427f2a4 | 267 | OVSDB_SERVER_SHUTDOWN |
56120500 | 268 | rm -f db |
af358237 OBY |
269 | |
270 | # start OVSDB server in passive mode | |
56120500 | 271 | AT_CHECK([ovsdb_start_idltest "tcp:127.0.0.1:$TCP_PORT"]) |
1ca0323e | 272 | AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py -t10 idl_passive $srcdir/idltest.ovsschema ptcp:127.0.0.1:$TCP_PORT $3], |
7427f2a4 | 273 | [0], [stdout], [ignore]) |
c724bd67 | 274 | AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]), |
7427f2a4 DDP |
275 | [0], [$4]) |
276 | OVSDB_SERVER_SHUTDOWN | |
af358237 OBY |
277 | AT_CLEANUP |
278 | ]) | |
279 | ||
280 | OVSDB_CHECK_IDL_PASSIVE_TCP_PY([simple passive idl, initially empty, select empty], | |
281 | [], | |
282 | [['["idltest",{"op":"select","table":"link1","where":[]}]']], | |
283 | [[000: empty | |
284 | 001: {"error":null,"result":[{"rows":[]}]} | |
285 | 002: done | |
286 | ]]) | |
287 | ||
c3bb4bd7 BP |
288 | OVSDB_CHECK_IDL([simple idl, initially empty, no ops], |
289 | [], | |
290 | [], | |
291 | [000: empty | |
292 | 001: done | |
293 | ]) | |
294 | ||
295 | OVSDB_CHECK_IDL([simple idl, initially empty, various ops], | |
296 | [], | |
9cb53f26 BP |
297 | [['["idltest", |
298 | {"op": "insert", | |
c3bb4bd7 BP |
299 | "table": "simple", |
300 | "row": {"i": 1, | |
301 | "r": 2.0, | |
302 | "b": true, | |
303 | "s": "mystring", | |
304 | "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"], | |
305 | "ia": ["set", [1, 2, 3]], | |
306 | "ra": ["set", [-0.5]], | |
7fae24e6 | 307 | "ba": ["set", [true]], |
8cdf0349 | 308 | "sa": ["set", ["abc", "def"]], |
c3bb4bd7 BP |
309 | "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"], |
310 | ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}}, | |
311 | {"op": "insert", | |
312 | "table": "simple", | |
313 | "row": {}}]' \ | |
9cb53f26 BP |
314 | '["idltest", |
315 | {"op": "update", | |
c3bb4bd7 BP |
316 | "table": "simple", |
317 | "where": [], | |
318 | "row": {"b": true}}]' \ | |
9cb53f26 BP |
319 | '["idltest", |
320 | {"op": "update", | |
c3bb4bd7 BP |
321 | "table": "simple", |
322 | "where": [], | |
323 | "row": {"r": 123.5}}]' \ | |
9cb53f26 BP |
324 | '["idltest", |
325 | {"op": "insert", | |
c3bb4bd7 BP |
326 | "table": "simple", |
327 | "row": {"i": -1, | |
328 | "r": 125, | |
329 | "b": false, | |
330 | "s": "", | |
331 | "ia": ["set", [1]], | |
332 | "ra": ["set", [1.5]], | |
333 | "ba": ["set", [false]], | |
8cdf0349 | 334 | "sa": ["set", []], |
c3bb4bd7 | 335 | "ua": ["set", []]}}]' \ |
9cb53f26 BP |
336 | '["idltest", |
337 | {"op": "update", | |
c3bb4bd7 BP |
338 | "table": "simple", |
339 | "where": [["i", "<", 1]], | |
340 | "row": {"s": "newstring"}}]' \ | |
9cb53f26 BP |
341 | '["idltest", |
342 | {"op": "delete", | |
c3bb4bd7 BP |
343 | "table": "simple", |
344 | "where": [["i", "==", 0]]}]' \ | |
345 | 'reconnect']], | |
346 | [[000: empty | |
347 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]} | |
348 | 002: i=0 r=0 b=false s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 349 | 002: i=1 r=2 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> |
c3bb4bd7 BP |
350 | 003: {"error":null,"result":[{"count":2}]} |
351 | 004: i=0 r=0 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 352 | 004: i=1 r=2 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> |
c3bb4bd7 BP |
353 | 005: {"error":null,"result":[{"count":2}]} |
354 | 006: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 355 | 006: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> |
c3bb4bd7 BP |
356 | 007: {"error":null,"result":[{"uuid":["uuid","<6>"]}]} |
357 | 008: i=-1 r=125 b=false s= u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
358 | 008: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 359 | 008: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> |
c3bb4bd7 BP |
360 | 009: {"error":null,"result":[{"count":2}]} |
361 | 010: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
362 | 010: i=0 r=123.5 b=true s=newstring u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 363 | 010: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> |
c3bb4bd7 BP |
364 | 011: {"error":null,"result":[{"count":1}]} |
365 | 012: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
7fae24e6 | 366 | 012: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> |
c3bb4bd7 BP |
367 | 013: reconnect |
368 | 014: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
7fae24e6 | 369 | 014: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> |
c3bb4bd7 BP |
370 | 015: done |
371 | ]]) | |
372 | ||
373 | OVSDB_CHECK_IDL([simple idl, initially populated], | |
9cb53f26 BP |
374 | [['["idltest", |
375 | {"op": "insert", | |
c3bb4bd7 BP |
376 | "table": "simple", |
377 | "row": {"i": 1, | |
378 | "r": 2.0, | |
379 | "b": true, | |
380 | "s": "mystring", | |
381 | "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"], | |
382 | "ia": ["set", [1, 2, 3]], | |
383 | "ra": ["set", [-0.5]], | |
7fae24e6 | 384 | "ba": ["set", [true]], |
8cdf0349 | 385 | "sa": ["set", ["abc", "def"]], |
c3bb4bd7 BP |
386 | "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"], |
387 | ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}}, | |
388 | {"op": "insert", | |
389 | "table": "simple", | |
390 | "row": {}}]']], | |
9cb53f26 BP |
391 | [['["idltest", |
392 | {"op": "update", | |
c3bb4bd7 BP |
393 | "table": "simple", |
394 | "where": [], | |
395 | "row": {"b": true}}]']], | |
396 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 397 | 000: i=1 r=2 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<3> <4>] uuid=<5> |
c3bb4bd7 BP |
398 | 001: {"error":null,"result":[{"count":2}]} |
399 | 002: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 400 | 002: i=1 r=2 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<3> <4>] uuid=<5> |
c3bb4bd7 BP |
401 | 003: done |
402 | ]]) | |
403 | ||
475281c0 | 404 | OVSDB_CHECK_IDL([simple idl, writing via IDL], |
9cb53f26 BP |
405 | [['["idltest", |
406 | {"op": "insert", | |
475281c0 BP |
407 | "table": "simple", |
408 | "row": {"i": 1, | |
409 | "r": 2.0, | |
410 | "b": true, | |
411 | "s": "mystring", | |
412 | "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"], | |
413 | "ia": ["set", [1, 2, 3]], | |
414 | "ra": ["set", [-0.5]], | |
7fae24e6 | 415 | "ba": ["set", [true]], |
8cdf0349 | 416 | "sa": ["set", ["abc", "def"]], |
475281c0 BP |
417 | "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"], |
418 | ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}}, | |
419 | {"op": "insert", | |
420 | "table": "simple", | |
421 | "row": {}}]']], | |
a91c6104 BP |
422 | [['verify 0 b, verify 1 r, set 0 b 1, set 1 r 3.5' \ |
423 | 'insert 2, verify 2 i, verify 1 b, delete 1']], | |
475281c0 | 424 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> |
7fae24e6 | 425 | 000: i=1 r=2 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<3> <4>] uuid=<5> |
475281c0 BP |
426 | 001: commit, status=success |
427 | 002: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 428 | 002: i=1 r=3.5 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<3> <4>] uuid=<5> |
475281c0 BP |
429 | 003: commit, status=success |
430 | 004: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
431 | 004: i=2 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<6> | |
432 | 005: done | |
433 | ]]) | |
434 | ||
e7164d96 LR |
435 | OVSDB_CHECK_IDL([simple idl, writing via IDL with unicode], |
436 | [['["idltest", | |
437 | {"op": "insert", | |
438 | "table": "simple", | |
439 | "row": {"s": "(╯°□°)╯︵ ┻━┻"}}]']], | |
440 | [['set 0 b 1, insert 1, set 1 s "¯\_(ツ)_/¯"']], | |
441 | [[000: i=0 r=0 b=false s=(╯°□°)╯︵ ┻━┻ u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
442 | 001: commit, status=success | |
443 | 002: i=0 r=0 b=true s=(╯°□°)╯︵ ┻━┻ u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
444 | 002: i=1 r=0 b=false s="¯\_(ツ)_/¯" u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> | |
445 | 003: done | |
446 | ]]) | |
447 | ||
1ca0323e BP |
448 | m4_define([OVSDB_CHECK_IDL_PY_WITH_EXPOUT], |
449 | [AT_SETUP([$1 - Python3]) | |
980211b7 GL |
450 | AT_KEYWORDS([ovsdb server idl positive Python $5]) |
451 | AT_CHECK([ovsdb_start_idltest]) | |
452 | m4_if([$2], [], [], | |
453 | [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])]) | |
1ca0323e | 454 | AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket $3], |
980211b7 GL |
455 | [0], [stdout], [ignore]) |
456 | echo "$4" > expout | |
457 | AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]), | |
458 | [0], [expout]) | |
459 | OVSDB_SERVER_SHUTDOWN | |
460 | AT_CLEANUP]) | |
461 | ||
980211b7 GL |
462 | OVSDB_CHECK_IDL_PY_WITH_EXPOUT([simple idl, writing large data via IDL with unicode], |
463 | [['["idltest", | |
464 | {"op": "insert", | |
465 | "table": "simple", | |
466 | "row": {"s": "'$(printf "测试超过四千零九十六个字节的中文字符串以使解码出现问题。%.0s" {1..50})'"}}]']], | |
467 | [['set 0 b 1, insert 1, set 1 s '$(printf "测试超过四千零九十六个字节的中文字符串以使解码出现问题。%.0s" {1..100})'']], | |
468 | [[000: i=0 r=0 b=false s=$(printf "测试超过四千零九十六个字节的中文字符串以使解码出现问题。%.0s" {1..50}) u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
469 | 001: commit, status=success | |
470 | 002: i=0 r=0 b=true s=$(printf "测试超过四千零九十六个字节的中文字符串以使解码出现问题。%.0s" {1..50}) u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
471 | 002: i=1 r=0 b=false s=$(printf "测试超过四千零九十六个字节的中文字符串以使解码出现问题。%.0s" {1..100}) u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> | |
472 | 003: done]]) | |
473 | ||
a91c6104 BP |
474 | OVSDB_CHECK_IDL([simple idl, handling verification failure], |
475 | [['["idltest", | |
476 | {"op": "insert", | |
477 | "table": "simple", | |
478 | "row": {"i": 1, | |
479 | "r": 2.0}}, | |
480 | {"op": "insert", | |
481 | "table": "simple", | |
482 | "row": {}}]']], | |
483 | [['set 0 b 1' \ | |
484 | '+["idltest", | |
485 | {"op": "update", | |
486 | "table": "simple", | |
487 | "where": [["i", "==", 1]], | |
488 | "row": {"r": 5.0}}]' \ | |
489 | '+verify 1 r, set 1 r 3' \ | |
490 | 'verify 1 r, set 1 r 3' \ | |
491 | ]], | |
492 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
493 | 000: i=1 r=2 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> | |
494 | 001: commit, status=success | |
495 | 002: {"error":null,"result":[{"count":1}]} | |
94fbe1aa | 496 | 003: commit, status=try again |
a91c6104 BP |
497 | 004: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> |
498 | 004: i=1 r=5 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> | |
499 | 005: commit, status=success | |
500 | 006: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
501 | 006: i=1 r=3 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> | |
502 | 007: done | |
503 | ]]) | |
504 | ||
b54e22e9 | 505 | OVSDB_CHECK_IDL([simple idl, increment operation], |
9cb53f26 BP |
506 | [['["idltest", |
507 | {"op": "insert", | |
b54e22e9 BP |
508 | "table": "simple", |
509 | "row": {}}]']], | |
94fbe1aa | 510 | [['set 0 r 2.0, increment 0']], |
b54e22e9 BP |
511 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> |
512 | 001: commit, status=success, increment=1 | |
513 | 002: i=1 r=2 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
514 | 003: done | |
515 | ]]) | |
516 | ||
2096903b BP |
517 | OVSDB_CHECK_IDL([simple idl, aborting], |
518 | [['["idltest", | |
519 | {"op": "insert", | |
520 | "table": "simple", | |
521 | "row": {}}]']], | |
522 | [['set 0 r 2.0, abort' \ | |
523 | '+set 0 b 1']], | |
524 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
525 | 001: commit, status=aborted | |
526 | 002: commit, status=success | |
527 | 003: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
528 | 004: done | |
529 | ]]) | |
530 | ||
531 | OVSDB_CHECK_IDL([simple idl, destroy without commit or abort], | |
532 | [['["idltest", | |
533 | {"op": "insert", | |
534 | "table": "simple", | |
535 | "row": {}}]']], | |
536 | [['set 0 r 2.0, destroy' \ | |
537 | '+set 0 b 1']], | |
538 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
539 | 001: destroy | |
540 | 002: commit, status=success | |
541 | 003: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
542 | 004: done | |
543 | ]]) | |
544 | ||
16ebb90e LS |
545 | OVSDB_CHECK_IDL([simple idl, conditional, false condition], |
546 | [['["idltest", | |
547 | {"op": "insert", | |
548 | "table": "simple", | |
549 | "row": {"i": 1, | |
550 | "r": 2.0, | |
551 | "b": true}}]']], | |
0164e367 BP |
552 | [['condition simple []' \ |
553 | 'condition simple [true]']], | |
16ebb90e LS |
554 | [[000: change conditions |
555 | 001: empty | |
556 | 002: change conditions | |
557 | 003: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
558 | 004: done | |
559 | ]]) | |
560 | ||
561 | OVSDB_CHECK_IDL([simple idl, conditional, true condition], | |
562 | [['["idltest", | |
563 | {"op": "insert", | |
564 | "table": "simple", | |
565 | "row": {"i": 1, | |
566 | "r": 2.0, | |
567 | "b": true}}]']], | |
0164e367 BP |
568 | [['condition simple []' \ |
569 | 'condition simple [true]']], | |
16ebb90e LS |
570 | [[000: change conditions |
571 | 001: empty | |
572 | 002: change conditions | |
573 | 003: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
574 | 004: done | |
575 | ]]) | |
576 | ||
577 | OVSDB_CHECK_IDL([simple idl, conditional, multiple clauses in condition], | |
578 | [['["idltest", | |
579 | {"op": "insert", | |
580 | "table": "simple", | |
581 | "row": {"i": 1, | |
582 | "r": 2.0, | |
583 | "b": true}}, | |
584 | {"op": "insert", | |
585 | "table": "simple", | |
586 | "row": {"i": 2, | |
587 | "r": 3.0, | |
588 | "b": true}}]']], | |
0164e367 BP |
589 | [['condition simple []' \ |
590 | 'condition simple [["i","==",1],["i","==",2]]']], | |
16ebb90e LS |
591 | [[000: change conditions |
592 | 001: empty | |
593 | 002: change conditions | |
594 | 003: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
595 | 003: i=2 r=3 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> | |
596 | 004: done | |
597 | ]]) | |
598 | ||
599 | OVSDB_CHECK_IDL([simple idl, conditional, modify as insert due to condition], | |
600 | [['["idltest", | |
601 | {"op": "insert", | |
602 | "table": "simple", | |
603 | "row": {"i": 1, | |
604 | "r": 2.0, | |
605 | "b": true}}]']], | |
0164e367 BP |
606 | [['condition simple []' \ |
607 | 'condition simple [["i","==",1]]']], | |
16ebb90e LS |
608 | [[000: change conditions |
609 | 001: empty | |
610 | 002: change conditions | |
611 | 003: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
612 | 004: done | |
613 | ]]) | |
614 | ||
615 | OVSDB_CHECK_IDL([simple idl, conditional, modify as delete due to condition], | |
616 | [['["idltest", | |
617 | {"op": "insert", | |
618 | "table": "simple", | |
619 | "row": {"i": 1, | |
620 | "r": 2.0, | |
621 | "b": true}}]']], | |
0164e367 BP |
622 | [['condition simple []' \ |
623 | 'condition simple [["i","==",1],["i","==",2]]' \ | |
624 | 'condition simple [["i","==",2]]' \ | |
16ebb90e LS |
625 | '["idltest", |
626 | {"op": "insert", | |
627 | "table": "simple", | |
628 | "row": {"i": 2, | |
629 | "r": 3.0, | |
630 | "b": true}}]']], | |
631 | [[000: change conditions | |
632 | 001: empty | |
633 | 002: change conditions | |
634 | 003: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
635 | 004: change conditions | |
636 | 005: empty | |
637 | 006: {"error":null,"result":[{"uuid":["uuid","<2>"]}]} | |
638 | 007: i=2 r=3 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> | |
639 | 008: done | |
640 | ]]) | |
641 | ||
642 | OVSDB_CHECK_IDL([simple idl, conditional, multiple tables], | |
643 | [['["idltest", | |
644 | {"op": "insert", | |
645 | "table": "simple", | |
646 | "row": {"i": 1, | |
647 | "r": 2.0, | |
648 | "b": true}}, | |
649 | {"op": "insert", | |
650 | "table": "link1", | |
651 | "row": {"i": 0, "k": ["named-uuid", "self"]}, | |
652 | "uuid-name": "self"}, | |
653 | {"op": "insert", | |
654 | "table": "link2", | |
655 | "row": {"i": 2}, | |
656 | "uuid-name": "row0"}]']], | |
0164e367 BP |
657 | [['condition simple [];link1 [];link2 []' \ |
658 | 'condition simple [["i","==",1]]' \ | |
659 | 'condition link1 [["i","==",0]]' \ | |
660 | 'condition link2 [["i","==",3]]' \ | |
16ebb90e LS |
661 | '+["idltest", |
662 | {"op": "insert", | |
663 | "table": "link2", | |
664 | "row": {"i": 3}, | |
665 | "uuid-name": "row0"}]']], | |
666 | [[000: change conditions | |
667 | 001: empty | |
668 | 002: change conditions | |
669 | 003: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
670 | 004: change conditions | |
671 | 005: i=0 k=0 ka=[] l2= uuid=<2> | |
672 | 005: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
673 | 006: change conditions | |
674 | 007: {"error":null,"result":[{"uuid":["uuid","<3>"]}]} | |
675 | 008: i=0 k=0 ka=[] l2= uuid=<2> | |
676 | 008: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
677 | 008: i=3 l1= uuid=<3> | |
678 | 009: done | |
679 | ]]) | |
680 | ||
c3bb4bd7 BP |
681 | OVSDB_CHECK_IDL([self-linking idl, consistent ops], |
682 | [], | |
9cb53f26 BP |
683 | [['["idltest", |
684 | {"op": "insert", | |
e9011ac8 | 685 | "table": "link1", |
c3bb4bd7 BP |
686 | "row": {"i": 0, "k": ["named-uuid", "self"]}, |
687 | "uuid-name": "self"}]' \ | |
9cb53f26 BP |
688 | '["idltest", |
689 | {"op": "insert", | |
e9011ac8 | 690 | "table": "link1", |
2d2d6d4a | 691 | "row": {"i": 1, "k": ["named-uuid", "row2"]}, |
c3bb4bd7 BP |
692 | "uuid-name": "row1"}, |
693 | {"op": "insert", | |
e9011ac8 | 694 | "table": "link1", |
c3bb4bd7 | 695 | "row": {"i": 2, "k": ["named-uuid", "row1"]}, |
2d2d6d4a | 696 | "uuid-name": "row2"}]' \ |
9cb53f26 BP |
697 | '["idltest", |
698 | {"op": "update", | |
e9011ac8 | 699 | "table": "link1", |
c3bb4bd7 BP |
700 | "where": [["i", "==", 1]], |
701 | "row": {"k": ["uuid", "#1#"]}}]' \ | |
9cb53f26 BP |
702 | '["idltest", |
703 | {"op": "update", | |
e9011ac8 | 704 | "table": "link1", |
c3bb4bd7 BP |
705 | "where": [], |
706 | "row": {"k": ["uuid", "#0#"]}}]']], | |
707 | [[000: empty | |
708 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]}]} | |
e9011ac8 | 709 | 002: i=0 k=0 ka=[] l2= uuid=<0> |
fbf925e4 | 710 | 003: {"error":null,"result":[{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]}]} |
e9011ac8 BP |
711 | 004: i=0 k=0 ka=[] l2= uuid=<0> |
712 | 004: i=1 k=2 ka=[] l2= uuid=<1> | |
713 | 004: i=2 k=1 ka=[] l2= uuid=<2> | |
c3bb4bd7 | 714 | 005: {"error":null,"result":[{"count":1}]} |
e9011ac8 BP |
715 | 006: i=0 k=0 ka=[] l2= uuid=<0> |
716 | 006: i=1 k=1 ka=[] l2= uuid=<1> | |
717 | 006: i=2 k=1 ka=[] l2= uuid=<2> | |
c3bb4bd7 | 718 | 007: {"error":null,"result":[{"count":3}]} |
e9011ac8 BP |
719 | 008: i=0 k=0 ka=[] l2= uuid=<0> |
720 | 008: i=1 k=0 ka=[] l2= uuid=<1> | |
721 | 008: i=2 k=0 ka=[] l2= uuid=<2> | |
c3bb4bd7 BP |
722 | 009: done |
723 | ]]) | |
724 | ||
725 | OVSDB_CHECK_IDL([self-linking idl, inconsistent ops], | |
726 | [], | |
9cb53f26 BP |
727 | [['["idltest", |
728 | {"op": "insert", | |
e9011ac8 | 729 | "table": "link1", |
c3bb4bd7 | 730 | "row": {"i": 0, "k": ["uuid", "cf197cc5-c8c9-42f5-82d5-c71a9f2cb96b"]}}]' \ |
9cb53f26 BP |
731 | '+["idltest", |
732 | {"op": "insert", | |
e9011ac8 | 733 | "table": "link1", |
0d0f05b9 BP |
734 | "uuid-name": "one", |
735 | "row": {"i": 1, "k": ["named-uuid", "one"]}}, | |
736 | {"op": "insert", | |
737 | "table": "link1", | |
738 | "row": {"i": 2, "k": ["named-uuid", "one"]}}]' \ | |
9cb53f26 BP |
739 | '["idltest", |
740 | {"op": "update", | |
e9011ac8 | 741 | "table": "link1", |
c3bb4bd7 BP |
742 | "where": [], |
743 | "row": {"k": ["uuid", "c2fca39a-e69a-42a4-9c56-5eca85839ce9"]}}]' \ | |
9cb53f26 BP |
744 | '+["idltest", |
745 | {"op": "delete", | |
e9011ac8 | 746 | "table": "link1", |
0d0f05b9 | 747 | "where": [["_uuid", "==", ["uuid", "#1#"]]]}]' \ |
9cb53f26 BP |
748 | '+["idltest", |
749 | {"op": "delete", | |
e9011ac8 | 750 | "table": "link1", |
0d0f05b9 | 751 | "where": [["_uuid", "==", ["uuid", "#2#"]]]}]' \ |
9cb53f26 BP |
752 | '["idltest", |
753 | {"op": "delete", | |
0d0f05b9 BP |
754 | "table": "link1", |
755 | "where": []}]' \ | |
c3bb4bd7 BP |
756 | ]], |
757 | [[000: empty | |
97f7803b | 758 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"details":"Table link1 column k row <0> references nonexistent row <1> in table link1.","error":"referential integrity violation"}]} |
0d0f05b9 BP |
759 | 002: {"error":null,"result":[{"uuid":["uuid","<2>"]},{"uuid":["uuid","<3>"]}]} |
760 | 003: i=1 k=1 ka=[] l2= uuid=<2> | |
761 | 003: i=2 k=1 ka=[] l2= uuid=<3> | |
254604d8 | 762 | 004: {"error":null,"result":[{"count":2},{"details":"Table link1 column k row <x> references nonexistent row <4> in table link1.","error":"referential integrity violation"}]} |
0d0f05b9 BP |
763 | 005: {"error":null,"result":[{"count":1},{"details":"cannot delete link1 row <2> because of 1 remaining reference(s)","error":"referential integrity violation"}]} |
764 | 006: {"error":null,"result":[{"count":1}]} | |
765 | 007: i=1 k=1 ka=[] l2= uuid=<2> | |
766 | 008: {"error":null,"result":[{"count":1}]} | |
767 | 009: empty | |
768 | 010: done | |
254604d8 BP |
769 | ]], |
770 | [], | |
771 | [[sed -e '/004:/s/row <[23]> references/row <x> references/']]) | |
c3bb4bd7 BP |
772 | |
773 | OVSDB_CHECK_IDL([self-linking idl, sets], | |
774 | [], | |
9cb53f26 BP |
775 | [['["idltest", |
776 | {"op": "insert", | |
e9011ac8 | 777 | "table": "link1", |
0d0f05b9 | 778 | "row": {"i": 0, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i0"]]]}, |
c3bb4bd7 BP |
779 | "uuid-name": "i0"}, |
780 | {"op": "insert", | |
e9011ac8 | 781 | "table": "link1", |
0d0f05b9 | 782 | "row": {"i": 1, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i1"]]]}, |
c3bb4bd7 BP |
783 | "uuid-name": "i1"}, |
784 | {"op": "insert", | |
e9011ac8 | 785 | "table": "link1", |
0d0f05b9 | 786 | "row": {"i": 2, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i2"]]]}, |
c3bb4bd7 BP |
787 | "uuid-name": "i2"}, |
788 | {"op": "insert", | |
e9011ac8 | 789 | "table": "link1", |
0d0f05b9 | 790 | "row": {"i": 3, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i3"]]]}, |
c3bb4bd7 | 791 | "uuid-name": "i3"}]' \ |
9cb53f26 BP |
792 | '["idltest", |
793 | {"op": "update", | |
e9011ac8 | 794 | "table": "link1", |
c3bb4bd7 BP |
795 | "where": [], |
796 | "row": {"ka": ["set", [["uuid", "#0#"], ["uuid", "#1#"], ["uuid", "#2#"], ["uuid", "#3#"]]]}}]' \ | |
9cb53f26 BP |
797 | '["idltest", |
798 | {"op": "update", | |
e9011ac8 | 799 | "table": "link1", |
97f7803b BP |
800 | "where": [["i", "==", 2]], |
801 | "row": {"ka": ["set", [["uuid", "#0#"], ["uuid", "88702e78-845b-4a6e-ad08-cf68922ae84a"], ["uuid", "#2#"]]]}}]' \ | |
9cb53f26 BP |
802 | '+["idltest", |
803 | {"op": "delete", | |
0d0f05b9 BP |
804 | "table": "link1", |
805 | "where": []}]']], | |
c3bb4bd7 BP |
806 | [[000: empty |
807 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]},{"uuid":["uuid","<3>"]}]} | |
0d0f05b9 BP |
808 | 002: i=0 k=0 ka=[0] l2= uuid=<0> |
809 | 002: i=1 k=0 ka=[1] l2= uuid=<1> | |
810 | 002: i=2 k=0 ka=[2] l2= uuid=<2> | |
811 | 002: i=3 k=0 ka=[3] l2= uuid=<3> | |
c3bb4bd7 | 812 | 003: {"error":null,"result":[{"count":4}]} |
0d0f05b9 BP |
813 | 004: i=0 k=0 ka=[0 1 2 3] l2= uuid=<0> |
814 | 004: i=1 k=0 ka=[0 1 2 3] l2= uuid=<1> | |
815 | 004: i=2 k=0 ka=[0 1 2 3] l2= uuid=<2> | |
816 | 004: i=3 k=0 ka=[0 1 2 3] l2= uuid=<3> | |
97f7803b | 817 | 005: {"error":null,"result":[{"count":1},{"details":"Table link1 column ka row <2> references nonexistent row <4> in table link1.","error":"referential integrity violation"}]} |
0d0f05b9 BP |
818 | 006: {"error":null,"result":[{"count":4}]} |
819 | 007: empty | |
820 | 008: done | |
c3bb4bd7 BP |
821 | ]]) |
822 | ||
e9011ac8 BP |
823 | OVSDB_CHECK_IDL([external-linking idl, consistent ops], |
824 | [], | |
9cb53f26 BP |
825 | [['["idltest", |
826 | {"op": "insert", | |
e9011ac8 BP |
827 | "table": "link2", |
828 | "row": {"i": 0}, | |
829 | "uuid-name": "row0"}, | |
830 | {"op": "insert", | |
831 | "table": "link1", | |
0d0f05b9 | 832 | "row": {"i": 1, "k": ["named-uuid", "row1"], "l2": ["set", [["named-uuid", "row0"]]]}, |
e9011ac8 BP |
833 | "uuid-name": "row1"}]']], |
834 | [[000: empty | |
835 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]} | |
836 | 002: i=0 l1= uuid=<0> | |
0d0f05b9 | 837 | 002: i=1 k=1 ka=[] l2=0 uuid=<1> |
e9011ac8 BP |
838 | 003: done |
839 | ]]) | |
225b582a | 840 | |
079ace1f MM |
841 | OVSDB_CHECK_IDL([singleton idl, constraints], |
842 | [], | |
843 | [['["idltest", | |
844 | {"op": "insert", | |
845 | "table": "singleton", | |
846 | "row": {"name": "foo"}}]' \ | |
847 | '["idltest", | |
848 | {"op": "insert", | |
849 | "table": "singleton", | |
850 | "row": {"name": "bar"}}]' \ | |
851 | '+["idltest", | |
852 | {"op": "delete", | |
853 | "table": "singleton", | |
854 | "where": [["_uuid", "==", ["uuid", "#0#"]]]}, | |
855 | {"op": "insert", | |
856 | "table": "singleton", | |
857 | "row": {"name": "bar"}}]']], | |
858 | [[000: empty | |
859 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]}]} | |
860 | 002: name=foo uuid=<0> | |
861 | 003: {"error":null,"result":[{"uuid":["uuid","<1>"]},{"details":"transaction causes \"singleton\" table to contain 2 rows, greater than the schema-defined limit of 1 row(s)","error":"constraint violation"}]} | |
862 | 004: {"error":null,"result":[{"count":1},{"uuid":["uuid","<2>"]}]} | |
863 | 005: name=bar uuid=<2> | |
864 | 006: done | |
865 | ]]) | |
866 | ||
225b582a IY |
867 | OVSDB_CHECK_IDL_PY([external-linking idl, insert ops], |
868 | [], | |
869 | [['linktest']], | |
870 | [[000: empty | |
871 | 001: commit, status=success | |
872 | 002: i=1 k=1 ka=[1] l2= uuid=<0> | |
873 | 002: i=2 k=1 ka=[1 2] l2= uuid=<1> | |
874 | 003: done | |
875 | ]]) | |
3b4c362f IY |
876 | |
877 | OVSDB_CHECK_IDL_PY([getattr idl, insert ops], | |
878 | [], | |
879 | [['getattrtest']], | |
880 | [[000: empty | |
881 | 001: commit, status=success | |
882 | 002: i=2 k=2 ka=[] l2= uuid=<0> | |
883 | 003: done | |
884 | ]]) | |
d18e52e3 | 885 | |
d7d417fc TW |
886 | OVSDB_CHECK_IDL_PY([row-from-json idl, whats this], |
887 | [['["idltest", | |
888 | {"op": "insert", | |
889 | "table": "simple", | |
890 | "row": {"i": 1}}, | |
891 | {"op": "insert", | |
892 | "table": "simple", | |
893 | "row": {}}]']], | |
894 | [['notifytest insert 2, notifytest set 1 b 1, notifytest delete 0']], | |
895 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
896 | 000: i=1 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> | |
897 | 001: commit, status=success, events=create|2|None, delete|0|None, update|1|b | |
898 | 002: i=1 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> | |
899 | 002: i=2 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3> | |
900 | 003: done | |
901 | ]]) | |
902 | ||
d18e52e3 BP |
903 | AT_SETUP([idl handling of missing tables and columns - C]) |
904 | AT_KEYWORDS([ovsdb server idl positive]) | |
d18e52e3 BP |
905 | |
906 | # idltest2.ovsschema is the same as idltest.ovsschema, except that | |
907 | # table link2 and column l2 have been deleted. But the IDL still | |
908 | # expects them to be there, so this test checks that it properly | |
909 | # tolerates them being missing. | |
56120500 | 910 | AT_CHECK([ovsdb_start_idltest "" "$abs_srcdir/idltest2.ovsschema"]) |
d18e52e3 BP |
911 | AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 idl unix:socket ['["idltest", |
912 | {"op": "insert", | |
913 | "table": "link1", | |
914 | "row": {"i": 0, "k": ["named-uuid", "self"]}, | |
915 | "uuid-name": "self"}]' \ | |
916 | '["idltest", | |
917 | {"op": "insert", | |
918 | "table": "link1", | |
919 | "row": {"i": 1, "k": ["named-uuid", "row2"]}, | |
920 | "uuid-name": "row1"}, | |
921 | {"op": "insert", | |
922 | "table": "link1", | |
923 | "row": {"i": 2, "k": ["named-uuid", "row1"]}, | |
924 | "uuid-name": "row2"}]' \ | |
925 | '["idltest", | |
926 | {"op": "update", | |
927 | "table": "link1", | |
928 | "where": [["i", "==", 1]], | |
929 | "row": {"k": ["uuid", "#1#"]}}]' \ | |
930 | '["idltest", | |
931 | {"op": "update", | |
932 | "table": "link1", | |
933 | "where": [], | |
934 | "row": {"k": ["uuid", "#0#"]}}]']], | |
5a0e4aec | 935 | [0], [stdout], [stderr]) |
c724bd67 | 936 | AT_CHECK([sort stdout | uuidfilt], [0], |
d18e52e3 BP |
937 | [[000: empty |
938 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]}]} | |
939 | 002: i=0 k=0 ka=[] l2= uuid=<0> | |
940 | 003: {"error":null,"result":[{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]}]} | |
941 | 004: i=0 k=0 ka=[] l2= uuid=<0> | |
942 | 004: i=1 k=2 ka=[] l2= uuid=<1> | |
943 | 004: i=2 k=1 ka=[] l2= uuid=<2> | |
944 | 005: {"error":null,"result":[{"count":1}]} | |
945 | 006: i=0 k=0 ka=[] l2= uuid=<0> | |
946 | 006: i=1 k=1 ka=[] l2= uuid=<1> | |
947 | 006: i=2 k=1 ka=[] l2= uuid=<2> | |
948 | 007: {"error":null,"result":[{"count":3}]} | |
949 | 008: i=0 k=0 ka=[] l2= uuid=<0> | |
950 | 008: i=1 k=0 ka=[] l2= uuid=<1> | |
951 | 008: i=2 k=0 ka=[] l2= uuid=<2> | |
952 | 009: done | |
7427f2a4 | 953 | ]]) |
d18e52e3 BP |
954 | |
955 | # Check that ovsdb-idl figured out that table link2 and column l2 are missing. | |
956 | AT_CHECK([grep ovsdb_idl stderr | sort], [0], [dnl | |
957 | test-ovsdb|ovsdb_idl|idltest database lacks link2 table (database needs upgrade?) | |
079ace1f | 958 | test-ovsdb|ovsdb_idl|idltest database lacks singleton table (database needs upgrade?) |
d18e52e3 BP |
959 | test-ovsdb|ovsdb_idl|link1 table in idltest database lacks l2 column (database needs upgrade?) |
960 | ]) | |
961 | ||
962 | # Check that ovsdb-idl sent on "monitor" request and that it didn't | |
963 | # mention that table or column, and (for paranoia) that it did mention another | |
964 | # table and column. | |
1b1d2e6d | 965 | AT_CHECK([grep -c '"monitor\|monitor_cond"' stderr], [0], [2 |
d18e52e3 | 966 | ]) |
c383f3bf LS |
967 | AT_CHECK([grep '"monitor\|monitor_cond"' stderr | grep link2], [1]) |
968 | AT_CHECK([grep '"monitor\|monitor_cond"' stderr | grep l2], [1]) | |
969 | AT_CHECK([grep '"monitor\|monitor_cond"' stderr | grep -c '"link1"'], [0], [1 | |
d18e52e3 | 970 | ]) |
c383f3bf | 971 | AT_CHECK([grep '"monitor\|monitor_cond"' stderr | grep -c '"ua"'], [0], [1 |
d18e52e3 BP |
972 | ]) |
973 | OVSDB_SERVER_SHUTDOWN | |
974 | AT_CLEANUP | |
80c12152 | 975 | |
1ca0323e BP |
976 | m4_define([OVSDB_CHECK_IDL_FETCH_COLUMNS_PY], |
977 | [AT_SETUP([$1 - Python3 - fetch]) | |
80c12152 | 978 | AT_KEYWORDS([ovsdb server idl positive Python increment fetch $6]) |
56120500 | 979 | AT_CHECK([ovsdb_start_idltest]) |
80c12152 | 980 | m4_if([$2], [], [], |
7427f2a4 | 981 | [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])]) |
1ca0323e | 982 | AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket [$3] $4], |
7427f2a4 | 983 | [0], [stdout], [ignore]) |
c724bd67 | 984 | AT_CHECK([sort stdout | uuidfilt]m4_if([$7],,, [[| $7]]), |
7427f2a4 | 985 | [0], [$5]) |
80c12152 SA |
986 | OVSDB_SERVER_SHUTDOWN |
987 | AT_CLEANUP]) | |
988 | ||
989 | m4_define([OVSDB_CHECK_IDL_FETCH_COLUMNS], | |
990 | [OVSDB_CHECK_IDL_FETCH_COLUMNS_PY($@)]) | |
991 | ||
992 | OVSDB_CHECK_IDL_FETCH_COLUMNS([simple idl, initially populated], | |
993 | [['["idltest", | |
994 | {"op": "insert", | |
995 | "table": "simple", | |
996 | "row": {"i": 1, | |
997 | "r": 2.0, | |
998 | "b": true, | |
999 | "s": "mystring", | |
1000 | "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"], | |
1001 | "ia": ["set", [1, 2, 3]], | |
1002 | "ra": ["set", [-0.5]], | |
1003 | "ba": ["set", [true]], | |
1004 | "sa": ["set", ["abc", "def"]], | |
1005 | "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"], | |
1006 | ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}}, | |
1007 | {"op": "insert", | |
1008 | "table": "simple", | |
1009 | "row": {}}]']], | |
1010 | [?simple:i,r!], | |
1011 | ['fetch 0 r'], | |
1012 | [[000: i=0 uuid=<0> | |
1013 | 000: i=1 uuid=<1> | |
1014 | 001: commit, status=success | |
1015 | 002: i=0 r=0 uuid=<0> | |
1016 | 002: i=1 uuid=<1> | |
1017 | 003: done | |
1018 | ]]) | |
932104f4 | 1019 | |
1ca0323e BP |
1020 | m4_define([OVSDB_CHECK_IDL_WO_MONITOR_COND_PY], |
1021 | [AT_SETUP([$1 - Python3]) | |
897c8064 | 1022 | AT_KEYWORDS([ovsdb server idl Python monitor $4]) |
56120500 BP |
1023 | AT_CHECK([ovsdb_start_idltest]) |
1024 | AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/disable-monitor-cond]) | |
1ca0323e | 1025 | AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket $2], |
7ef00082 | 1026 | [0], [stdout], [ignore]) |
c724bd67 | 1027 | AT_CHECK([sort stdout | uuidfilt]m4_if([$5],,, [[| $5]]), |
7ef00082 | 1028 | [0], [$3]) |
897c8064 LS |
1029 | OVSDB_SERVER_SHUTDOWN |
1030 | AT_CLEANUP]) | |
1031 | ||
897c8064 LS |
1032 | m4_define([OVSDB_CHECK_IDL_WO_MONITOR_COND], |
1033 | [OVSDB_CHECK_IDL_WO_MONITOR_COND_PY($@)]) | |
1034 | ||
1035 | ||
1036 | OVSDB_CHECK_IDL_WO_MONITOR_COND([simple idl disable monitor-cond], | |
1037 | [['["idltest", | |
1038 | {"op": "insert", | |
1039 | "table": "simple", | |
1040 | "row": {"i": 1, | |
1041 | "r": 2.0, | |
1042 | "b": true, | |
1043 | "s": "mystring", | |
1044 | "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"], | |
1045 | "ia": ["set", [1, 2, 3]], | |
1046 | "ra": ["set", [-0.5]], | |
1047 | "ba": ["set", [true]], | |
1048 | "sa": ["set", ["abc", "def"]], | |
1049 | "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"], | |
1050 | ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}}, | |
1051 | {"op": "insert", | |
1052 | "table": "simple", | |
1053 | "row": {}}]' \ | |
1054 | '["idltest", | |
1055 | {"op": "update", | |
1056 | "table": "simple", | |
1057 | "where": [], | |
1058 | "row": {"b": true}}]' \ | |
1059 | '["idltest", | |
1060 | {"op": "update", | |
1061 | "table": "simple", | |
1062 | "where": [], | |
1063 | "row": {"r": 123.5}}]' \ | |
1064 | '["idltest", | |
1065 | {"op": "insert", | |
1066 | "table": "simple", | |
1067 | "row": {"i": -1, | |
1068 | "r": 125, | |
1069 | "b": false, | |
1070 | "s": "", | |
1071 | "ia": ["set", [1]], | |
1072 | "ra": ["set", [1.5]], | |
1073 | "ba": ["set", [false]], | |
1074 | "sa": ["set", []], | |
1075 | "ua": ["set", []]}}]' \ | |
1076 | '["idltest", | |
1077 | {"op": "update", | |
1078 | "table": "simple", | |
1079 | "where": [["i", "<", 1]], | |
1080 | "row": {"s": "newstring"}}]' \ | |
1081 | '["idltest", | |
1082 | {"op": "delete", | |
1083 | "table": "simple", | |
1084 | "where": [["i", "==", 0]]}]' \ | |
1085 | 'reconnect']], | |
1086 | [[000: empty | |
1087 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]} | |
1088 | 002: i=0 r=0 b=false s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
1089 | 002: i=1 r=2 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> | |
1090 | 003: {"error":null,"result":[{"count":2}]} | |
1091 | 004: i=0 r=0 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
1092 | 004: i=1 r=2 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> | |
1093 | 005: {"error":null,"result":[{"count":2}]} | |
1094 | 006: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
1095 | 006: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> | |
1096 | 007: {"error":null,"result":[{"uuid":["uuid","<6>"]}]} | |
1097 | 008: i=-1 r=125 b=false s= u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
1098 | 008: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
1099 | 008: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> | |
1100 | 009: {"error":null,"result":[{"count":2}]} | |
1101 | 010: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
1102 | 010: i=0 r=123.5 b=true s=newstring u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
1103 | 010: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> | |
1104 | 011: {"error":null,"result":[{"count":1}]} | |
1105 | 012: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
1106 | 012: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> | |
1107 | 013: reconnect | |
1108 | 014: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
1109 | 014: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> | |
1110 | 015: done | |
1111 | ]]) | |
1112 | ||
932104f4 SA |
1113 | m4_define([OVSDB_CHECK_IDL_TRACK_C], |
1114 | [AT_SETUP([$1 - C]) | |
1115 | AT_KEYWORDS([ovsdb server idl tracking positive $5]) | |
56120500 | 1116 | AT_CHECK([ovsdb_start_idltest]) |
932104f4 | 1117 | m4_if([$2], [], [], |
7427f2a4 | 1118 | [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])]) |
932104f4 | 1119 | AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl unix:socket $3], |
7427f2a4 | 1120 | [0], [stdout], [ignore]) |
c724bd67 | 1121 | AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]), |
7427f2a4 | 1122 | [0], [$4]) |
932104f4 SA |
1123 | OVSDB_SERVER_SHUTDOWN |
1124 | AT_CLEANUP]) | |
1125 | ||
1126 | m4_define([OVSDB_CHECK_IDL_TRACK], | |
1127 | [OVSDB_CHECK_IDL_TRACK_C($@)]) | |
1128 | ||
1129 | OVSDB_CHECK_IDL_TRACK([track, simple idl, initially populated], | |
1130 | [['["idltest", | |
1131 | {"op": "insert", | |
1132 | "table": "simple", | |
1133 | "row": {"i": 1, | |
1134 | "r": 2.0, | |
1135 | "b": true, | |
1136 | "s": "mystring", | |
1137 | "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"], | |
1138 | "ia": ["set", [1, 2, 3]], | |
1139 | "ra": ["set", [-0.5]], | |
1140 | "ba": ["set", [true]], | |
1141 | "sa": ["set", ["abc", "def"]], | |
1142 | "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"], | |
1143 | ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}}, | |
1144 | {"op": "insert", | |
1145 | "table": "simple", | |
1146 | "row": {}}]']], | |
1147 | [['["idltest", | |
1148 | {"op": "update", | |
1149 | "table": "simple", | |
1150 | "where": [], | |
1151 | "row": {"b": true}}]']], | |
1152 | [[000: i=1 r=2 b=true s=mystring u=<0> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<1> <2>] uuid=<3> | |
32d37ce8 | 1153 | 000: updated columns: b ba i ia r ra s sa u ua |
932104f4 SA |
1154 | 001: {"error":null,"result":[{"count":2}]} |
1155 | 002: i=0 r=0 b=true s= u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<5> | |
1156 | 002: i=1 r=2 b=true s=mystring u=<0> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<1> <2>] uuid=<3> | |
32d37ce8 | 1157 | 002: updated columns: b |
932104f4 SA |
1158 | 003: done |
1159 | ]]) | |
1160 | ||
1161 | OVSDB_CHECK_IDL_TRACK([track, simple idl, initially empty, various ops], | |
1162 | [], | |
1163 | [['["idltest", | |
1164 | {"op": "insert", | |
1165 | "table": "simple", | |
1166 | "row": {"i": 1, | |
1167 | "r": 2.0, | |
1168 | "b": true, | |
1169 | "s": "mystring", | |
1170 | "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"], | |
1171 | "ia": ["set", [1, 2, 3]], | |
1172 | "ra": ["set", [-0.5]], | |
1173 | "ba": ["set", [true]], | |
1174 | "sa": ["set", ["abc", "def"]], | |
1175 | "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"], | |
1176 | ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}}, | |
1177 | {"op": "insert", | |
1178 | "table": "simple", | |
1179 | "row": {}}]' \ | |
1180 | '["idltest", | |
1181 | {"op": "update", | |
1182 | "table": "simple", | |
1183 | "where": [], | |
1184 | "row": {"b": true}}]' \ | |
1185 | '["idltest", | |
1186 | {"op": "update", | |
1187 | "table": "simple", | |
1188 | "where": [], | |
1189 | "row": {"r": 123.5}}]' \ | |
1190 | '["idltest", | |
1191 | {"op": "insert", | |
1192 | "table": "simple", | |
1193 | "row": {"i": -1, | |
1194 | "r": 125, | |
1195 | "b": false, | |
1196 | "s": "", | |
1197 | "ia": ["set", [1]], | |
1198 | "ra": ["set", [1.5]], | |
1199 | "ba": ["set", [false]], | |
1200 | "sa": ["set", []], | |
1201 | "ua": ["set", []]}}]' \ | |
1202 | '["idltest", | |
1203 | {"op": "update", | |
1204 | "table": "simple", | |
1205 | "where": [["i", "<", 1]], | |
1206 | "row": {"s": "newstring"}}]' \ | |
1207 | '["idltest", | |
1208 | {"op": "delete", | |
1209 | "table": "simple", | |
1210 | "where": [["i", "==", 0]]}]' \ | |
1211 | 'reconnect']], | |
1212 | [[000: empty | |
1213 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]} | |
1214 | 002: i=1 r=2 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<3> <4>] uuid=<0> | |
32d37ce8 | 1215 | 002: updated columns: b ba i ia r ra s sa u ua |
932104f4 SA |
1216 | 003: {"error":null,"result":[{"count":2}]} |
1217 | 004: i=0 r=0 b=true s= u=<5> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
32d37ce8 | 1218 | 004: updated columns: b |
932104f4 SA |
1219 | 005: {"error":null,"result":[{"count":2}]} |
1220 | 006: i=0 r=123.5 b=true s= u=<5> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
1221 | 006: i=1 r=123.5 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<3> <4>] uuid=<0> | |
32d37ce8 SA |
1222 | 006: updated columns: r |
1223 | 006: updated columns: r | |
932104f4 SA |
1224 | 007: {"error":null,"result":[{"uuid":["uuid","<6>"]}]} |
1225 | 008: i=-1 r=125 b=false s= u=<5> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
32d37ce8 | 1226 | 008: updated columns: ba i ia r ra |
932104f4 SA |
1227 | 009: {"error":null,"result":[{"count":2}]} |
1228 | 010: i=-1 r=125 b=false s=newstring u=<5> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
1229 | 010: i=0 r=123.5 b=true s=newstring u=<5> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
32d37ce8 SA |
1230 | 010: updated columns: s |
1231 | 010: updated columns: s | |
932104f4 SA |
1232 | 011: {"error":null,"result":[{"count":1}]} |
1233 | 012: ##deleted## uuid=<1> | |
1234 | 013: reconnect | |
1235 | 014: i=-1 r=125 b=false s=newstring u=<5> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
1236 | 014: i=1 r=123.5 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<3> <4>] uuid=<0> | |
32d37ce8 SA |
1237 | 014: updated columns: b ba i ia r ra s sa u ua |
1238 | 014: updated columns: ba i ia r ra s | |
932104f4 SA |
1239 | 015: done |
1240 | ]]) | |
7251075c EA |
1241 | |
1242 | m4_define([OVSDB_CHECK_IDL_PARTIAL_UPDATE_MAP_COLUMN], | |
1243 | [AT_SETUP([$1 - C]) | |
1244 | AT_KEYWORDS([ovsdb server idl partial update map column positive $5]) | |
56120500 | 1245 | AT_CHECK([ovsdb_start_idltest]) |
7251075c | 1246 | m4_if([$2], [], [], |
7427f2a4 | 1247 | [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])]) |
7251075c | 1248 | AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl-partial-update-map-column unix:socket $3], |
7427f2a4 | 1249 | [0], [stdout], [ignore]) |
c724bd67 | 1250 | AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]), |
7427f2a4 | 1251 | [0], [$4]) |
7251075c EA |
1252 | OVSDB_SERVER_SHUTDOWN |
1253 | AT_CLEANUP]) | |
1254 | ||
1255 | OVSDB_CHECK_IDL_PARTIAL_UPDATE_MAP_COLUMN([map, simple2 idl-partial-update-map-column, initially populated], | |
1256 | [['["idltest", {"op":"insert", "table":"simple2", | |
1257 | "row":{"name":"myString1","smap":["map",[["key1","value1"],["key2","value2"]]]} }]'] | |
1258 | ], | |
1259 | [], | |
1260 | [[000: Getting records | |
1261 | 001: name=myString1 smap=[[key1 : value1],[key2 : value2]] imap=[] | |
1262 | 002: After insert element | |
1263 | 003: name=String2 smap=[[key1 : myList1],[key2 : value2]] imap=[[3 : myids2]] | |
1264 | 004: After insert duplicated element | |
1265 | 005: name=String2 smap=[[key1 : myList1],[key2 : value2]] imap=[[3 : myids2]] | |
1266 | 006: After delete element | |
1267 | 007: name=String2 smap=[[key2 : value2]] imap=[[3 : myids2]] | |
1268 | 008: After trying to delete a deleted element | |
1269 | 009: name=String2 smap=[[key2 : value2]] imap=[[3 : myids2]] | |
1270 | 010: End test | |
1271 | ]]) | |
a7261bf7 | 1272 | |
a59912a0 RM |
1273 | OVSDB_CHECK_IDL_PY([partial-map idl], |
1274 | [['["idltest", {"op":"insert", "table":"simple2", | |
330b9c9c | 1275 | "row":{"name":"myString1","smap":["map",[["key1","value1"],["key2","value2"]]]} }]'] |
a59912a0 | 1276 | ], |
2d54d801 | 1277 | [?simple2:name,smap,imap 'partialmapinsertelement' 'partialmapinsertmultipleelements' 'partialmapdelelements' 'partialmapmutatenew'], |
330b9c9c | 1278 | [[000: name=myString1 smap=[(key1 value1) (key2 value2)] imap=[] |
a59912a0 | 1279 | 001: commit, status=success |
330b9c9c | 1280 | 002: name=String2 smap=[(key1 myList1) (key2 value2)] imap=[(3 myids2)] |
a59912a0 | 1281 | 003: commit, status=success |
2d54d801 | 1282 | 004: name=String2 smap=[(key1 myList1) (key2 myList2) (key3 myList3) (key4 myList4)] imap=[(3 myids2)] |
330b9c9c AB |
1283 | 005: commit, status=success |
1284 | 006: name=String2 smap=[(key2 myList2)] imap=[(3 myids2)] | |
2d54d801 AB |
1285 | 007: commit, status=success |
1286 | 008: name=String2 smap=[(key2 myList2)] imap=[(3 myids2)] | |
1287 | 008: name=String2New smap=[(key1 newList1) (key2 newList2)] imap=[] | |
1288 | 009: done | |
a59912a0 RM |
1289 | ]]) |
1290 | ||
f1ab6e06 RM |
1291 | m4_define([OVSDB_CHECK_IDL_PARTIAL_UPDATE_SET_COLUMN], |
1292 | [AT_SETUP([$1 - C]) | |
1293 | AT_KEYWORDS([ovsdb server idl partial update set column positive $5]) | |
56120500 | 1294 | AT_CHECK([ovsdb_start_idltest]) |
f1ab6e06 RM |
1295 | m4_if([$2], [], [], |
1296 | [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])]) | |
1297 | AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl-partial-update-set-column unix:socket $3], | |
1298 | [0], [stdout], [ignore]) | |
c724bd67 | 1299 | AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]), |
f1ab6e06 RM |
1300 | [0], [$4]) |
1301 | OVSDB_SERVER_SHUTDOWN | |
1302 | AT_CLEANUP]) | |
1303 | ||
1304 | OVSDB_CHECK_IDL_PARTIAL_UPDATE_SET_COLUMN([set, simple3 idl-partial-update-set-column, initially populated], | |
1305 | [['["idltest", {"op":"insert", "table":"simple3", | |
1306 | "row":{"name":"mySet1","uset":["set", [[ "uuid", "0005b872-f9e5-43be-ae02-3184b9680e75" ], [ "uuid", "000d2f6a-76af-412f-b59d-e7bcd3e84eff" ]]]} }]'] | |
1307 | ], | |
1308 | [], | |
1309 | [[000: Getting records | |
1310 | 001: name=mySet1 uset=[[<0>],[<1>]] uref=[] | |
1311 | 002: After rename+add new value | |
1312 | 003: name=String2 uset=[[<0>],[<1>],[<2>]] uref=[] | |
1313 | 004: After add new value | |
1314 | 005: name=String2 uset=[[<0>],[<1>],[<2>],[<3>]] uref=[] | |
1315 | 006: After delete value | |
1316 | 007: name=String2 uset=[[<0>],[<1>],[<3>]] uref=[] | |
1317 | 008: After trying to delete a deleted value | |
1318 | 009: name=String2 uset=[[<0>],[<1>],[<3>]] uref=[] | |
1319 | 010: After add to other table + set of strong ref | |
1320 | 011: name=String2 uset=[[<0>],[<1>],[<3>]] uref=[[<4>]] | |
1321 | 012: End test | |
1322 | ]]) | |
1323 | ||
a59912a0 | 1324 | OVSDB_CHECK_IDL_PY([partial-set idl], |
b3220c67 AB |
1325 | [['["idltest", {"op":"insert", "table":"simple3", "uuid-name":"newrow", |
1326 | "row":{"name":"mySet1","uset":["set", [[ "uuid", "0005b872-f9e5-43be-ae02-3184b9680e75" ]]]} }, | |
1327 | {"op":"insert", "table":"simple4", "row":{"name":"seed"}}, | |
1328 | {"op":"mutate", "table":"simple3", "where":[["_uuid", "==", ["named-uuid", "newrow"]]], | |
1329 | "mutations": [["uset", "insert", ["set", [["uuid", "000d2f6a-76af-412f-b59d-e7bcd3e84eff"]]]]]}]'] | |
a59912a0 | 1330 | ], |
2d54d801 | 1331 | ['partialrenamesetadd' 'partialduplicateadd' 'partialsetdel' 'partialsetref' 'partialsetoverrideops' 'partialsetadddelete' 'partialsetmutatenew'], |
a59912a0 RM |
1332 | [[000: name=mySet1 uset=[<0> <1>] |
1333 | 001: commit, status=success | |
1334 | 002: name=String2 uset=[<0> <1> <2>] | |
1335 | 003: commit, status=success | |
1336 | 004: name=String2 uset=[<0> <1> <2> <3>] | |
1337 | 005: commit, status=success | |
1338 | 006: name=String2 uset=[<0> <1> <3>] | |
1339 | 007: commit, status=success | |
1340 | 008: name=String2 uset=[<0> <1> <3>] | |
330b9c9c AB |
1341 | 009: commit, status=success |
1342 | 010: name=String2 uset=[<3>] | |
b3220c67 | 1343 | 011: commit, status=success |
2d54d801 AB |
1344 | 012: name=String2 uset=[<4> <5>] |
1345 | 013: commit, status=success | |
1346 | 014: name=String2 uset=[<4> <5>] | |
1347 | 014: name=String3 uset=[<6>] | |
1348 | 015: done | |
a59912a0 RM |
1349 | ]]) |
1350 | ||
a7261bf7 | 1351 | m4_define([OVSDB_CHECK_IDL_NOTIFY], |
1ca0323e BP |
1352 | [OVSDB_CHECK_IDL_PY([$1], [], [$2], [$3], [notify $4], [$5]) |
1353 | OVSDB_CHECK_IDL_SSL_PY([$1], [], [$2], [$3], [notify $4], [$5])]) | |
a7261bf7 NS |
1354 | |
1355 | OVSDB_CHECK_IDL_NOTIFY([simple idl verify notify], | |
1356 | [['track-notify' \ | |
1357 | '["idltest", | |
1358 | {"op": "insert", | |
1359 | "table": "simple", | |
1360 | "row": {"i": 1, | |
1361 | "r": 2.0, | |
1362 | "b": true, | |
1363 | "s": "mystring", | |
1364 | "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"], | |
1365 | "ia": ["set", [1, 2, 3]], | |
1366 | "ra": ["set", [-0.5]], | |
1367 | "ba": ["set", [true]], | |
1368 | "sa": ["set", ["abc", "def"]], | |
1369 | "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"], | |
1370 | ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}}, | |
1371 | {"op": "insert", | |
1372 | "table": "simple", | |
1373 | "row": {}}]' \ | |
1374 | '["idltest", | |
1375 | {"op": "update", | |
1376 | "table": "simple", | |
1377 | "where": [], | |
1378 | "row": {"b": false}}]' \ | |
1379 | '["idltest", | |
1380 | {"op": "update", | |
1381 | "table": "simple", | |
1382 | "where": [], | |
1383 | "row": {"r": 123.5}}]' \ | |
1384 | '["idltest", | |
1385 | {"op": "insert", | |
1386 | "table": "simple", | |
1387 | "row": {"i": -1, | |
1388 | "r": 125, | |
1389 | "b": false, | |
1390 | "s": "", | |
1391 | "ia": ["set", [1]], | |
1392 | "ra": ["set", [1.5]], | |
1393 | "ba": ["set", [false]], | |
1394 | "sa": ["set", []], | |
1395 | "ua": ["set", []]}}]' \ | |
1396 | '["idltest", | |
1397 | {"op": "update", | |
1398 | "table": "simple", | |
1399 | "where": [["i", "<", 1]], | |
1400 | "row": {"s": "newstring"}}]' \ | |
1401 | '["idltest", | |
1402 | {"op": "delete", | |
1403 | "table": "simple", | |
1404 | "where": [["i", "==", 0]]}]' \ | |
1405 | 'reconnect']], | |
1406 | [[000: empty | |
c39751e4 TE |
1407 | 000: event:create, row={uuid=<0>}, updates=None |
1408 | 000: event:create, row={uuid=<1>}, updates=None | |
1409 | 001: {"error":null,"result":[{"uuid":["uuid","<2>"]},{"uuid":["uuid","<3>"]}]} | |
1410 | 002: event:create, row={i=0 r=0 b=false s= u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3>}, updates=None | |
1411 | 002: event:create, row={i=1 r=2 b=true s=mystring u=<5> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<6> <7>] uuid=<2>}, updates=None | |
1412 | 002: i=0 r=0 b=false s= u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3> | |
1413 | 002: i=1 r=2 b=true s=mystring u=<5> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<6> <7>] uuid=<2> | |
a7261bf7 | 1414 | 003: {"error":null,"result":[{"count":2}]} |
c39751e4 TE |
1415 | 004: event:update, row={i=1 r=2 b=false s=mystring u=<5> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<6> <7>] uuid=<2>}, updates={b=true uuid=<2>} |
1416 | 004: i=0 r=0 b=false s= u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3> | |
1417 | 004: i=1 r=2 b=false s=mystring u=<5> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<6> <7>] uuid=<2> | |
a7261bf7 | 1418 | 005: {"error":null,"result":[{"count":2}]} |
c39751e4 TE |
1419 | 006: event:update, row={i=0 r=123.5 b=false s= u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3>}, updates={r=0 uuid=<3>} |
1420 | 006: event:update, row={i=1 r=123.5 b=false s=mystring u=<5> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<6> <7>] uuid=<2>}, updates={r=2 uuid=<2>} | |
1421 | 006: i=0 r=123.5 b=false s= u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3> | |
1422 | 006: i=1 r=123.5 b=false s=mystring u=<5> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<6> <7>] uuid=<2> | |
1423 | 007: {"error":null,"result":[{"uuid":["uuid","<8>"]}]} | |
1424 | 008: event:create, row={i=-1 r=125 b=false s= u=<4> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<8>}, updates=None | |
1425 | 008: i=-1 r=125 b=false s= u=<4> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<8> | |
1426 | 008: i=0 r=123.5 b=false s= u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3> | |
1427 | 008: i=1 r=123.5 b=false s=mystring u=<5> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<6> <7>] uuid=<2> | |
a7261bf7 | 1428 | 009: {"error":null,"result":[{"count":2}]} |
c39751e4 TE |
1429 | 010: event:update, row={i=-1 r=125 b=false s=newstring u=<4> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<8>}, updates={s= uuid=<8>} |
1430 | 010: event:update, row={i=0 r=123.5 b=false s=newstring u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3>}, updates={s= uuid=<3>} | |
1431 | 010: i=-1 r=125 b=false s=newstring u=<4> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<8> | |
1432 | 010: i=0 r=123.5 b=false s=newstring u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3> | |
1433 | 010: i=1 r=123.5 b=false s=mystring u=<5> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<6> <7>] uuid=<2> | |
a7261bf7 | 1434 | 011: {"error":null,"result":[{"count":1}]} |
c39751e4 TE |
1435 | 012: event:delete, row={i=0 r=123.5 b=false s=newstring u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3>}, updates=None |
1436 | 012: i=-1 r=125 b=false s=newstring u=<4> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<8> | |
1437 | 012: i=1 r=123.5 b=false s=mystring u=<5> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<6> <7>] uuid=<2> | |
a7261bf7 | 1438 | 013: reconnect |
c39751e4 TE |
1439 | 014: event:create, row={i=-1 r=125 b=false s=newstring u=<4> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<8>}, updates=None |
1440 | 014: event:create, row={i=1 r=123.5 b=false s=mystring u=<5> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<6> <7>] uuid=<2>}, updates=None | |
1441 | 014: event:create, row={uuid=<0>}, updates=None | |
1442 | 014: event:create, row={uuid=<1>}, updates=None | |
1443 | 014: i=-1 r=125 b=false s=newstring u=<4> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<8> | |
1444 | 014: i=1 r=123.5 b=false s=mystring u=<5> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<6> <7>] uuid=<2> | |
a7261bf7 NS |
1445 | 015: done |
1446 | ]]) | |
0a8606ee LR |
1447 | |
1448 | # Tests to verify the functionality of the one column compound index. | |
1449 | # It tests index for one column string and integer indexes. | |
1450 | # The run of test-ovsdb generates the output of the display of data using the different indexes defined in | |
1451 | # the program. | |
1452 | # Then, some at_checks are used to verify the correctness of the corresponding index as well as the existence | |
1453 | # of all the rows involved in the test. | |
1454 | m4_define([OVSDB_CHECK_IDL_COMPOUND_INDEX_SINGLE_COLUMN_C], | |
1455 | [AT_SETUP([$1 - C]) | |
1456 | AT_KEYWORDS([ovsdb server idl compound_index_single_column compound_index positive $5]) | |
1457 | AT_CHECK([ovsdb_start_idltest]) | |
1458 | m4_if([$2], [], [], | |
7ef00082 | 1459 | [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])]) |
0a8606ee LR |
1460 | # Generate the data to be tested. |
1461 | AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl-compound-index unix:socket $3], | |
7ef00082 | 1462 | [0], [stdout], [ignore]) |
0a8606ee LR |
1463 | # Filter the rows of data that corresponds to the string index eliminating the extra columns of data. |
1464 | # This is done to verifiy that the output data is in the correct and expected order. | |
1465 | AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: s=.*' | sed -e 's/ i=.*//g']], | |
7ef00082 | 1466 | [0], [$4]) |
0a8606ee LR |
1467 | # Here, the data is filtered and sorted in order to have all the rows in the index and be |
1468 | # able to determined that all the involved rows are present. | |
1469 | AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: s=.*' | sort -k 1,1n -k 2,2 -k 3,3]], | |
7ef00082 | 1470 | [0], [$5]) |
0a8606ee LR |
1471 | # Filter the rows of data that corresponds to the integer index eliminating the extra columns of data. |
1472 | # This is done to verifiy that the output data is in the correct and expected order. | |
1473 | AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: i=.*' | sed -e 's/ s=.*//g']], | |
7ef00082 | 1474 | [0], [$6]) |
0a8606ee LR |
1475 | # Here again, the data is filtered and sorted in order to have all the rows in the index and be |
1476 | # able to determined that all the involved rows are present. | |
1477 | AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: i=.*' | sort -k 1,1n -k 2,2 -k 3,3]], | |
7ef00082 | 1478 | [0], [$7]) |
0a8606ee LR |
1479 | OVSDB_SERVER_SHUTDOWN |
1480 | AT_CLEANUP]) | |
1481 | ||
1482 | OVSDB_CHECK_IDL_COMPOUND_INDEX_SINGLE_COLUMN_C([Compound_index, single column test ], | |
1483 | [['["idltest", | |
1484 | {"op": "insert", "table": "simple", "row": {"s":"List000", "i": 1, "b":true, "r":101.0}}, | |
1485 | {"op": "insert", "table": "simple", "row": {"s":"List000", "i": 2, "b":false, "r":102.0}}, | |
1486 | {"op": "insert", "table": "simple", "row": {"s":"List000", "i": 10, "b":true, "r":110.0}}, | |
1487 | {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 1, "b":false, "r":110.0}}, | |
1488 | {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 2, "b":true, "r":120.0}}, | |
1489 | {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 2, "b":true, "r":122.0}}, | |
1490 | {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 4, "b":true, "r":130.0}}, | |
1491 | {"op": "insert", "table": "simple", "row": {"s":"List005", "i": 5, "b":true, "r":130.0}}, | |
1492 | {"op": "insert", "table": "simple", "row": {"s":"List020", "i": 20, "b":true, "r":220.0}}, | |
1493 | {"op": "insert", "table": "simple", "row": {"s":"List020", "i": 19, "b":true, "r":219.0}} | |
1494 | ]']], | |
1495 | [idl_compound_index_single_column], | |
1496 | [001: s=List000 | |
1497 | 001: s=List000 | |
1498 | 001: s=List000 | |
1499 | 001: s=List001 | |
1500 | 001: s=List001 | |
1501 | 001: s=List001 | |
1502 | 001: s=List001 | |
1503 | 001: s=List005 | |
1504 | 001: s=List020 | |
1505 | 001: s=List020 | |
1506 | 003: s=List001 | |
1507 | 003: s=List001 | |
1508 | 003: s=List001 | |
1509 | 003: s=List001 | |
1510 | ], | |
1511 | [001: s=List000 i=1 b=True r=101.000000 | |
1512 | 001: s=List000 i=10 b=True r=110.000000 | |
1513 | 001: s=List000 i=2 b=False r=102.000000 | |
1514 | 001: s=List001 i=1 b=False r=110.000000 | |
1515 | 001: s=List001 i=2 b=True r=120.000000 | |
1516 | 001: s=List001 i=2 b=True r=122.000000 | |
1517 | 001: s=List001 i=4 b=True r=130.000000 | |
1518 | 001: s=List005 i=5 b=True r=130.000000 | |
1519 | 001: s=List020 i=19 b=True r=219.000000 | |
1520 | 001: s=List020 i=20 b=True r=220.000000 | |
1521 | 003: s=List001 i=1 b=False r=110.000000 | |
1522 | 003: s=List001 i=2 b=True r=120.000000 | |
1523 | 003: s=List001 i=2 b=True r=122.000000 | |
1524 | 003: s=List001 i=4 b=True r=130.000000 | |
1525 | ], | |
1526 | [002: i=1 | |
1527 | 002: i=1 | |
1528 | 002: i=2 | |
1529 | 002: i=2 | |
1530 | 002: i=2 | |
1531 | 002: i=4 | |
1532 | 002: i=5 | |
1533 | 002: i=10 | |
1534 | 002: i=19 | |
1535 | 002: i=20 | |
1536 | 004: i=5 | |
1537 | 005: i=4 | |
1538 | 005: i=5 | |
1539 | 006: i=5 | |
1540 | 006: i=10 | |
1541 | 006: i=19 | |
1542 | 006: i=20 | |
1543 | 006: i=54 | |
0a8606ee | 1544 | 007: i=5 |
0a8606ee LR |
1545 | 007: i=19 |
1546 | 007: i=20 | |
d0bde286 | 1547 | 007: i=30 |
0a8606ee | 1548 | 007: i=54 |
d0bde286 HZ |
1549 | 008: i=1 |
1550 | 008: i=1 | |
1551 | 008: i=2 | |
1552 | 008: i=2 | |
1553 | 008: i=2 | |
1554 | 008: i=5 | |
1555 | 008: i=19 | |
1556 | 008: i=20 | |
1557 | 008: i=30 | |
1558 | 008: i=54 | |
0a8606ee LR |
1559 | ], |
1560 | [002: i=1 s=List000 b=True r=101.000000 | |
1561 | 002: i=1 s=List001 b=False r=110.000000 | |
1562 | 002: i=10 s=List000 b=True r=110.000000 | |
1563 | 002: i=19 s=List020 b=True r=219.000000 | |
1564 | 002: i=2 s=List000 b=False r=102.000000 | |
1565 | 002: i=2 s=List001 b=True r=120.000000 | |
1566 | 002: i=2 s=List001 b=True r=122.000000 | |
1567 | 002: i=20 s=List020 b=True r=220.000000 | |
1568 | 002: i=4 s=List001 b=True r=130.000000 | |
1569 | 002: i=5 s=List005 b=True r=130.000000 | |
1570 | 004: i=5 s=List005 b=True r=130.000000 | |
1571 | 005: i=4 s=List001 b=True r=130.000000 | |
1572 | 005: i=5 s=List005 b=True r=130.000000 | |
1573 | 006: i=10 s=List000 b=True r=110.000000 | |
1574 | 006: i=19 s=List020 b=True r=219.000000 | |
1575 | 006: i=20 s=List020 b=True r=220.000000 | |
1576 | 006: i=5 s=List005 b=True r=130.000000 | |
1577 | 006: i=54 s=Lista054 b=False r=0.000000 | |
0a8606ee | 1578 | 007: i=19 s=List020 b=True r=219.000000 |
0a8606ee | 1579 | 007: i=20 s=List020 b=True r=220.000000 |
d0bde286 | 1580 | 007: i=30 s=List000 b=True r=110.000000 |
0a8606ee LR |
1581 | 007: i=5 s=List005 b=True r=130.000000 |
1582 | 007: i=54 s=Lista054 b=False r=0.000000 | |
d0bde286 HZ |
1583 | 008: i=1 s=List000 b=True r=101.000000 |
1584 | 008: i=1 s=List001 b=False r=110.000000 | |
1585 | 008: i=19 s=List020 b=True r=219.000000 | |
1586 | 008: i=2 s=List000 b=False r=102.000000 | |
1587 | 008: i=2 s=List001 b=True r=120.000000 | |
1588 | 008: i=2 s=List001 b=True r=122.000000 | |
1589 | 008: i=20 s=List020 b=True r=220.000000 | |
1590 | 008: i=30 s=List000 b=True r=110.000000 | |
1591 | 008: i=5 s=List005 b=True r=130.000000 | |
1592 | 008: i=54 s=Lista054 b=False r=0.000000 | |
0a8606ee LR |
1593 | ]) |
1594 | ||
1595 | # Tests to verify the functionality of two column compound index. | |
1596 | # It tests index for two columns using string and integer fields. | |
1597 | # The run of test-ovsdb generates the output of the display of data using the different indexes defined in | |
1598 | # the program. | |
1599 | # Then, some at_checks are used to verify the correctness of the corresponding index as well as the existence | |
1600 | # of all the rows involved in the test. | |
1601 | m4_define([OVSDB_CHECK_IDL_COMPOUND_INDEX_DOUBLE_COLUMN_C], | |
1602 | [AT_SETUP([$1 - C]) | |
1603 | AT_KEYWORDS([ovsdb server idl compound_index_double_column compound_index positive $5]) | |
1604 | AT_CHECK([ovsdb_start_idltest]) | |
1605 | m4_if([$2], [], [], | |
7ef00082 | 1606 | [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])]) |
0a8606ee LR |
1607 | # Generate the data to be tested. |
1608 | AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl-compound-index unix:socket $3], | |
7ef00082 | 1609 | [0], [stdout], [ignore]) |
0a8606ee LR |
1610 | # Filter the rows of data that corresponds to the string-integer index eliminating the extra columns of data. |
1611 | # This is done to verifiy that the output data is in the correct and expected order. | |
1612 | AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: s=.*' | sed -e 's/ b=.*//g']], | |
7ef00082 | 1613 | [0], [$4]) |
0a8606ee LR |
1614 | # Here, the data is filtered and sorted in order to have all the rows in the index and be |
1615 | # able to determined that all the involved rows are present. | |
1616 | AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: s=.*' | sort -k 1,1n -k 2,2 -k 3,3]], | |
7ef00082 | 1617 | [0], [$5]) |
0a8606ee LR |
1618 | # Filter the rows of data that corresponds to the integer index eliminating the extra columns of data. |
1619 | # This is done to verifiy that the output data is in the correct and expected order. | |
1620 | AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: i=.*' | sed -e 's/ b=.*//g']], | |
7ef00082 | 1621 | [0], [$6]) |
0a8606ee LR |
1622 | # Here again, the data is filtered and sorted in order to have all the rows in the index and be |
1623 | # able to determined that all the involved rows are present. | |
1624 | AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: i=.*' | sort -k 1,1n -k 2,2 -k 3,3]], | |
7ef00082 | 1625 | [0], [$7]) |
0a8606ee LR |
1626 | OVSDB_SERVER_SHUTDOWN |
1627 | AT_CLEANUP]) | |
1628 | ||
1629 | OVSDB_CHECK_IDL_COMPOUND_INDEX_DOUBLE_COLUMN_C([Compound_index, double column test ], | |
1630 | [['["idltest", | |
1631 | {"op": "insert", "table": "simple", "row": {"s":"List000", "i": 1, "b":true, "r":101.0}}, | |
1632 | {"op": "insert", "table": "simple", "row": {"s":"List000", "i": 2, "b":false, "r":102.0}}, | |
1633 | {"op": "insert", "table": "simple", "row": {"s":"List000", "i": 10, "b":true, "r":110.0}}, | |
1634 | {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 1, "b":false, "r":110.0}}, | |
1635 | {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 2, "b":true, "r":120.0}}, | |
1636 | {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 2, "b":true, "r":122.0}}, | |
1637 | {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 4, "b":true, "r":130.0}}, | |
1638 | {"op": "insert", "table": "simple", "row": {"s":"List005", "i": 5, "b":true, "r":130.0}}, | |
1639 | {"op": "insert", "table": "simple", "row": {"s":"List020", "i": 20, "b":true, "r":220.0}}, | |
1640 | {"op": "insert", "table": "simple", "row": {"s":"List020", "i": 19, "b":true, "r":219.0}} | |
1641 | ]']], | |
1642 | [idl_compound_index_double_column], | |
1643 | [001: s=List000 i=1 | |
1644 | 001: s=List000 i=2 | |
1645 | 001: s=List000 i=10 | |
1646 | 001: s=List001 i=1 | |
1647 | 001: s=List001 i=2 | |
1648 | 001: s=List001 i=2 | |
1649 | 001: s=List001 i=4 | |
1650 | 001: s=List005 i=5 | |
1651 | 001: s=List020 i=19 | |
1652 | 001: s=List020 i=20 | |
1653 | 002: s=List000 i=10 | |
1654 | 002: s=List000 i=2 | |
1655 | 002: s=List000 i=1 | |
1656 | 002: s=List001 i=4 | |
1657 | 002: s=List001 i=2 | |
1658 | 002: s=List001 i=2 | |
1659 | 002: s=List001 i=1 | |
1660 | 002: s=List005 i=5 | |
1661 | 002: s=List020 i=20 | |
1662 | 002: s=List020 i=19 | |
1663 | 003: s=List000 i=10 | |
1664 | 004: s=List001 i=1 | |
1665 | 004: s=List001 i=2 | |
1666 | 004: s=List001 i=2 | |
1667 | 004: s=List001 i=4 | |
1668 | 004: s=List005 i=5 | |
1669 | ], | |
1670 | [001: s=List000 i=1 b=True r=101.000000 | |
1671 | 001: s=List000 i=10 b=True r=110.000000 | |
1672 | 001: s=List000 i=2 b=False r=102.000000 | |
1673 | 001: s=List001 i=1 b=False r=110.000000 | |
1674 | 001: s=List001 i=2 b=True r=120.000000 | |
1675 | 001: s=List001 i=2 b=True r=122.000000 | |
1676 | 001: s=List001 i=4 b=True r=130.000000 | |
1677 | 001: s=List005 i=5 b=True r=130.000000 | |
1678 | 001: s=List020 i=19 b=True r=219.000000 | |
1679 | 001: s=List020 i=20 b=True r=220.000000 | |
1680 | 002: s=List000 i=1 b=True r=101.000000 | |
1681 | 002: s=List000 i=10 b=True r=110.000000 | |
1682 | 002: s=List000 i=2 b=False r=102.000000 | |
1683 | 002: s=List001 i=1 b=False r=110.000000 | |
1684 | 002: s=List001 i=2 b=True r=120.000000 | |
1685 | 002: s=List001 i=2 b=True r=122.000000 | |
1686 | 002: s=List001 i=4 b=True r=130.000000 | |
1687 | 002: s=List005 i=5 b=True r=130.000000 | |
1688 | 002: s=List020 i=19 b=True r=219.000000 | |
1689 | 002: s=List020 i=20 b=True r=220.000000 | |
1690 | 003: s=List000 i=10 b=True r=110.000000 | |
1691 | 004: s=List001 i=1 b=False r=110.000000 | |
1692 | 004: s=List001 i=2 b=True r=120.000000 | |
1693 | 004: s=List001 i=2 b=True r=122.000000 | |
1694 | 004: s=List001 i=4 b=True r=130.000000 | |
1695 | 004: s=List005 i=5 b=True r=130.000000 | |
1696 | ], | |
1697 | [005: i=1 s=List000 | |
1698 | 005: i=1 s=List001 | |
1699 | 005: i=2 s=List000 | |
1700 | 005: i=2 s=List001 | |
1701 | 005: i=2 s=List001 | |
1702 | 005: i=4 s=List001 | |
1703 | 005: i=5 s=List005 | |
1704 | 005: i=10 s=List000 | |
1705 | 005: i=19 s=List020 | |
1706 | 005: i=20 s=List020 | |
1707 | 006: i=20 s=List020 | |
1708 | 006: i=19 s=List020 | |
1709 | 006: i=10 s=List000 | |
1710 | 006: i=5 s=List005 | |
1711 | 006: i=4 s=List001 | |
1712 | 006: i=2 s=List000 | |
1713 | 006: i=2 s=List001 | |
1714 | 006: i=2 s=List001 | |
1715 | 006: i=1 s=List000 | |
1716 | 006: i=1 s=List001 | |
1717 | ], | |
1718 | [005: i=1 s=List000 b=True r=101.000000 | |
1719 | 005: i=1 s=List001 b=False r=110.000000 | |
1720 | 005: i=10 s=List000 b=True r=110.000000 | |
1721 | 005: i=19 s=List020 b=True r=219.000000 | |
1722 | 005: i=2 s=List000 b=False r=102.000000 | |
1723 | 005: i=2 s=List001 b=True r=120.000000 | |
1724 | 005: i=2 s=List001 b=True r=122.000000 | |
1725 | 005: i=20 s=List020 b=True r=220.000000 | |
1726 | 005: i=4 s=List001 b=True r=130.000000 | |
1727 | 005: i=5 s=List005 b=True r=130.000000 | |
1728 | 006: i=1 s=List000 b=True r=101.000000 | |
1729 | 006: i=1 s=List001 b=False r=110.000000 | |
1730 | 006: i=10 s=List000 b=True r=110.000000 | |
1731 | 006: i=19 s=List020 b=True r=219.000000 | |
1732 | 006: i=2 s=List000 b=False r=102.000000 | |
1733 | 006: i=2 s=List001 b=True r=120.000000 | |
1734 | 006: i=2 s=List001 b=True r=122.000000 | |
1735 | 006: i=20 s=List020 b=True r=220.000000 | |
1736 | 006: i=4 s=List001 b=True r=130.000000 | |
1737 | 006: i=5 s=List005 b=True r=130.000000 | |
1738 | ]) | |
3cc1634f HZ |
1739 | |
1740 | m4_define([OVSDB_CHECK_IDL_COMPOUND_INDEX_WITH_REF], | |
1741 | [AT_SETUP([$1 - C]) | |
1742 | AT_KEYWORDS([ovsdb server idl compound_index compound_index_with_ref positive $5]) | |
1743 | AT_CHECK([ovsdb_start_idltest]) | |
1744 | m4_if([$2], [], [], | |
1745 | [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])]) | |
1746 | AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl-compound-index-with-ref unix:socket $3], | |
1747 | [0], [stdout], [ignore]) | |
c724bd67 | 1748 | AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]), |
3cc1634f HZ |
1749 | [0], [$4]) |
1750 | OVSDB_SERVER_SHUTDOWN | |
1751 | AT_CLEANUP]) | |
1752 | ||
1753 | OVSDB_CHECK_IDL_COMPOUND_INDEX_WITH_REF([set, simple3 idl-compound-index-with-ref, initially populated], | |
1754 | [], | |
1755 | [], | |
1756 | [[000: After add to other table + set of strong ref | |
1757 | 001: name= uset=[] uref=[[<0>]] | |
1758 | 002: check simple4: not empty | |
1759 | 003: Query using index with reference | |
1760 | 004: name= uset=[] uref=[[<0>]] | |
1761 | 005: After delete | |
1762 | 007: check simple4: empty | |
1763 | 008: End test | |
1764 | ]]) | |
c1aa16d1 | 1765 | |
cfef5ae8 IM |
1766 | m4_define([CHECK_STREAM_OPEN_BLOCK], |
1767 | [AT_SETUP([Check Stream open block - C - $1]) | |
1768 | AT_SKIP_IF([test "$1" = "tcp6" && test "$IS_WIN32" = "yes"]) | |
1769 | AT_SKIP_IF([test "$1" = "tcp6" && test "$HAVE_IPV6" = "no"]) | |
1770 | AT_KEYWORDS([Check Stream open block $1]) | |
1771 | AT_CHECK([ovsdb_start_idltest "ptcp:0:$2"]) | |
1772 | PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT]) | |
fe495d0c | 1773 | WRONG_PORT=$(($TCP_PORT + 101)) |
cfef5ae8 IM |
1774 | AT_CHECK([test-stream tcp:$2:$TCP_PORT], [0], [ignore]) |
1775 | AT_CHECK([test-stream tcp:$2:$WRONG_PORT], [1], [ignore], [ignore]) | |
1776 | OVSDB_SERVER_SHUTDOWN | |
1777 | AT_CHECK([test-stream tcp:$2:$TCP_PORT], [1], [ignore], [ignore]) | |
1778 | AT_CLEANUP]) | |
1779 | ||
1780 | CHECK_STREAM_OPEN_BLOCK([tcp], [127.0.0.1]) | |
1781 | CHECK_STREAM_OPEN_BLOCK([tcp6], [[[::1]]]) | |
1782 | ||
c1aa16d1 | 1783 | m4_define([CHECK_STREAM_OPEN_BLOCK_PY], |
1ca0323e | 1784 | [AT_SETUP([$1 - Python3]) |
c1aa16d1 NS |
1785 | AT_KEYWORDS([Check PY Stream open block - $3]) |
1786 | AT_CHECK([ovsdb_start_idltest "ptcp:0:127.0.0.1"]) | |
1787 | PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT]) | |
fe495d0c | 1788 | WRONG_PORT=$(($TCP_PORT + 101)) |
c1aa16d1 NS |
1789 | AT_CHECK([$3 $srcdir/test-stream.py tcp:127.0.0.1:$TCP_PORT], [0], [ignore]) |
1790 | AT_CHECK([$3 $srcdir/test-stream.py tcp:127.0.0.1:$WRONG_PORT], [1], [ignore]) | |
1791 | OVSDB_SERVER_SHUTDOWN | |
1792 | AT_CHECK([$3 $srcdir/test-stream.py tcp:127.0.0.1:$TCP_PORT], [1], [ignore]) | |
1793 | AT_CLEANUP]) | |
1794 | ||
c39751e4 TE |
1795 | # same as OVSDB_CHECK_IDL but uses Python IDL implementation with tcp |
1796 | # with multiple remotes to assert the idl connects to the leader of the Raft cluster | |
1ca0323e BP |
1797 | m4_define([OVSDB_CHECK_IDL_LEADER_ONLY_PY], |
1798 | [AT_SETUP([$1 - Python3 (leader only)]) | |
c39751e4 TE |
1799 | AT_KEYWORDS([ovsdb server idl Python leader_only with tcp socket]) |
1800 | m4_define([LPBK],[127.0.0.1]) | |
1801 | AT_CHECK([ovsdb_cluster_start_idltest $2 "ptcp:0:"LPBK]) | |
1802 | PARSE_LISTENING_PORT([s2.log], [TCP_PORT_1]) | |
1803 | PARSE_LISTENING_PORT([s3.log], [TCP_PORT_2]) | |
1804 | PARSE_LISTENING_PORT([s1.log], [TCP_PORT_3]) | |
1805 | remotes=tcp:LPBK:$TCP_PORT_1,tcp:LPBK:$TCP_PORT_2,tcp:LPBK:$TCP_PORT_3 | |
1806 | pids=$(cat s2.pid s3.pid s1.pid | tr '\n' ',') | |
1807 | echo $pids | |
1ca0323e | 1808 | AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py -t30 idl-cluster $srcdir/idltest.ovsschema $remotes $pids $3], |
c39751e4 TE |
1809 | [0], [stdout], [ignore]) |
1810 | remote=$(ovsdb_cluster_leader $remotes "idltest") | |
1811 | leader=$(echo $remote | cut -d'|' -f 1) | |
1812 | AT_CHECK([grep -F -- "${leader}" stdout], [0], [ignore]) | |
1813 | AT_CLEANUP]) | |
1814 | ||
c39751e4 TE |
1815 | OVSDB_CHECK_IDL_LEADER_ONLY_PY([Check Python IDL connects to leader], 3, ['remote']) |
1816 | OVSDB_CHECK_IDL_LEADER_ONLY_PY([Check Python IDL reconnects to leader], 3, ['remote' '+remotestop' 'remote']) |