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