]> git.proxmox.com Git - mirror_ovs.git/blob - tests/ovsdb-idl.at
netdev-afxdp: Add interrupt mode netdev class.
[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_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 }])
50
51 # OVSDB_CHECK_IDL_C(TITLE, [PRE-IDL-TXN], TRANSACTIONS, OUTPUT, [KEYWORDS],
52 # [FILTER])
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
63 # marker. If FILTER is supplied then the output is also filtered
64 # through the specified program.
65 #
66 # TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS.
67 m4_define([OVSDB_CHECK_IDL_C],
68 [AT_SETUP([$1 - C])
69 AT_KEYWORDS([ovsdb server idl positive $5])
70 AT_CHECK([ovsdb_start_idltest])
71 m4_if([$2], [], [],
72 [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])])
73 AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 idl unix:socket $3],
74 [0], [stdout], [ignore])
75 AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]),
76 [0], [$4])
77 OVSDB_SERVER_SHUTDOWN
78 AT_CLEANUP])
79
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
114 # same as OVSDB_CHECK_IDL but uses the Python IDL implementation.
115 m4_define([OVSDB_CHECK_IDL_PY],
116 [AT_SETUP([$1 - Python3])
117 AT_KEYWORDS([ovsdb server idl positive Python $5])
118 AT_CHECK([ovsdb_start_idltest])
119 m4_if([$2], [], [],
120 [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])])
121 AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket $3],
122 [0], [stdout], [ignore])
123 AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]),
124 [0], [$4])
125 OVSDB_SERVER_SHUTDOWN
126 AT_CLEANUP])
127
128 m4_define([OVSDB_CHECK_IDL_REGISTER_COLUMNS_PY],
129 [AT_SETUP([$1 - Python3 - register_columns])
130 AT_KEYWORDS([ovsdb server idl positive Python register_columns $5])
131 AT_CHECK([ovsdb_start_idltest])
132 m4_if([$2], [], [],
133 [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])])
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],
135 [0], [stdout], [ignore])
136 AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]),
137 [0], [$4])
138 OVSDB_SERVER_SHUTDOWN
139 AT_CLEANUP])
140
141 # same as OVSDB_CHECK_IDL but uses the Python IDL implementation with tcp
142 m4_define([OVSDB_CHECK_IDL_TCP_PY],
143 [AT_SETUP([$1 - Python3 - tcp])
144 AT_KEYWORDS([ovsdb server idl positive Python with tcp socket $5])
145 AT_CHECK([ovsdb_start_idltest "ptcp:0:127.0.0.1"])
146 PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT])
147
148 m4_if([$2], [], [],
149 [AT_CHECK([ovsdb-client transact tcp:127.0.0.1:$TCP_PORT $2], [0], [ignore], [ignore])])
150 AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema tcp:127.0.0.1:$TCP_PORT $3],
151 [0], [stdout], [ignore])
152 AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]),
153 [0], [$4])
154 OVSDB_SERVER_SHUTDOWN
155 AT_CLEANUP])
156
157 # same as OVSDB_CHECK_IDL but uses the Python IDL implementation with tcp
158 # with multiple remotes with only one remote reachable
159 m4_define([OVSDB_CHECK_IDL_TCP_MULTIPLE_REMOTES_PY],
160 [AT_SETUP([$1 - Python3 (multiple remotes) - tcp])
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])
164 WRONG_PORT_1=$((TCP_PORT + 101))
165 WRONG_PORT_2=$((TCP_PORT + 102))
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])])
169 AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py -t20 idl $srcdir/idltest.ovsschema $remote $3],
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
176 # same as OVSDB_CHECK_IDL but uses the Python IDL implementation with tcp6
177 m4_define([OVSDB_CHECK_IDL_TCP6_PY],
178 [AT_SETUP([$1 - Python3 - tcp6])
179 AT_SKIP_IF([test "$IS_WIN32" = "yes"])
180 AT_SKIP_IF([test $HAVE_IPV6 = no])
181 AT_KEYWORDS([ovsdb server idl positive Python with tcp6 socket $5])
182 AT_CHECK([ovsdb_start_idltest "ptcp:0:[[::1]]"])
183 PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT])
184 echo "TCP_PORT=$TCP_PORT"
185
186 m4_if([$2], [], [],
187 [AT_CHECK([ovsdb-client transact "tcp:[[::1]]:$TCP_PORT" $2], [0], [ignore], [ignore])])
188 AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema tcp:[[::1]]:$TCP_PORT $3],
189 [0], [stdout], [ignore])
190 AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]),
191 [0], [$4])
192 OVSDB_SERVER_SHUTDOWN
193 AT_CLEANUP])
194
195 m4_define([OVSDB_CHECK_IDL_TCP6_MULTIPLE_REMOTES_PY],
196 [AT_SETUP([$1 - Python3 - tcp6])
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])
202 WRONG_PORT_1=$((TCP_PORT + 101))
203 WRONG_PORT_2=$((TCP_PORT + 102))
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])])
207 AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py -t20 idl $srcdir/idltest.ovsschema $remote $3],
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
214 # same as OVSDB_CHECK_IDL but uses the Python IDL implementation with SSL
215 m4_define([OVSDB_CHECK_IDL_SSL_PY],
216 [AT_SETUP([$1 - Python3 - SSL])
217 AT_SKIP_IF([test "$HAVE_OPENSSL" = no])
218 $PYTHON3 -c "import OpenSSL.SSL"
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])])
239 AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema \
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
248 m4_define([OVSDB_CHECK_IDL],
249 [OVSDB_CHECK_IDL_C($@)
250 OVSDB_CHECK_IDL_TCP_C($@)
251 OVSDB_CHECK_IDL_TCP6_C($@)
252 OVSDB_CHECK_IDL_PY($@)
253 OVSDB_CHECK_IDL_REGISTER_COLUMNS_PY($@)
254 OVSDB_CHECK_IDL_TCP_PY($@)
255 OVSDB_CHECK_IDL_TCP_MULTIPLE_REMOTES_PY($@)
256 OVSDB_CHECK_IDL_TCP6_PY($@)
257 OVSDB_CHECK_IDL_TCP6_MULTIPLE_REMOTES_PY($@)
258 OVSDB_CHECK_IDL_SSL_PY($@)])
259
260 # This test uses the Python IDL implementation with passive tcp
261 m4_define([OVSDB_CHECK_IDL_PASSIVE_TCP_PY],
262 [AT_SETUP([$1 - Python3 - ptcp])
263 AT_KEYWORDS([ovsdb server idl positive Python with tcp socket $5])
264 # find free TCP port
265 AT_CHECK([ovsdb_start_idltest "ptcp:0:127.0.0.1"])
266 PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT])
267 OVSDB_SERVER_SHUTDOWN
268 rm -f db
269
270 # start OVSDB server in passive mode
271 AT_CHECK([ovsdb_start_idltest "tcp:127.0.0.1:$TCP_PORT"])
272 AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py -t10 idl_passive $srcdir/idltest.ovsschema ptcp:127.0.0.1:$TCP_PORT $3],
273 [0], [stdout], [ignore])
274 AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]),
275 [0], [$4])
276 OVSDB_SERVER_SHUTDOWN
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
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 [],
297 [['["idltest",
298 {"op": "insert",
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]],
307 "ba": ["set", [true]],
308 "sa": ["set", ["abc", "def"]],
309 "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
310 ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
311 {"op": "insert",
312 "table": "simple",
313 "row": {}}]' \
314 '["idltest",
315 {"op": "update",
316 "table": "simple",
317 "where": [],
318 "row": {"b": true}}]' \
319 '["idltest",
320 {"op": "update",
321 "table": "simple",
322 "where": [],
323 "row": {"r": 123.5}}]' \
324 '["idltest",
325 {"op": "insert",
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]],
334 "sa": ["set", []],
335 "ua": ["set", []]}}]' \
336 '["idltest",
337 {"op": "update",
338 "table": "simple",
339 "where": [["i", "<", 1]],
340 "row": {"s": "newstring"}}]' \
341 '["idltest",
342 {"op": "delete",
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
370 015: done
371 ]])
372
373 OVSDB_CHECK_IDL([simple idl, initially populated],
374 [['["idltest",
375 {"op": "insert",
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]],
384 "ba": ["set", [true]],
385 "sa": ["set", ["abc", "def"]],
386 "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
387 ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
388 {"op": "insert",
389 "table": "simple",
390 "row": {}}]']],
391 [['["idltest",
392 {"op": "update",
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>
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>
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>
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>
401 003: done
402 ]])
403
404 OVSDB_CHECK_IDL([simple idl, writing via IDL],
405 [['["idltest",
406 {"op": "insert",
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]],
415 "ba": ["set", [true]],
416 "sa": ["set", ["abc", "def"]],
417 "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
418 ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
419 {"op": "insert",
420 "table": "simple",
421 "row": {}}]']],
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']],
424 [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
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>
426 001: commit, status=success
427 002: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
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>
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
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
448 m4_define([OVSDB_CHECK_IDL_PY_WITH_EXPOUT],
449 [AT_SETUP([$1 - Python3])
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])])
454 AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket $3],
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
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
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}]}
496 003: commit, status=try again
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
505 OVSDB_CHECK_IDL([simple idl, increment operation],
506 [['["idltest",
507 {"op": "insert",
508 "table": "simple",
509 "row": {}}]']],
510 [['set 0 r 2.0, increment 0']],
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
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
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}}]']],
552 [['condition simple []' \
553 'condition simple [true]']],
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}}]']],
568 [['condition simple []' \
569 'condition simple [true]']],
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}}]']],
589 [['condition simple []' \
590 'condition simple [["i","==",1],["i","==",2]]']],
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}}]']],
606 [['condition simple []' \
607 'condition simple [["i","==",1]]']],
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}}]']],
622 [['condition simple []' \
623 'condition simple [["i","==",1],["i","==",2]]' \
624 'condition simple [["i","==",2]]' \
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"}]']],
657 [['condition simple [];link1 [];link2 []' \
658 'condition simple [["i","==",1]]' \
659 'condition link1 [["i","==",0]]' \
660 'condition link2 [["i","==",3]]' \
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
681 OVSDB_CHECK_IDL([self-linking idl, consistent ops],
682 [],
683 [['["idltest",
684 {"op": "insert",
685 "table": "link1",
686 "row": {"i": 0, "k": ["named-uuid", "self"]},
687 "uuid-name": "self"}]' \
688 '["idltest",
689 {"op": "insert",
690 "table": "link1",
691 "row": {"i": 1, "k": ["named-uuid", "row2"]},
692 "uuid-name": "row1"},
693 {"op": "insert",
694 "table": "link1",
695 "row": {"i": 2, "k": ["named-uuid", "row1"]},
696 "uuid-name": "row2"}]' \
697 '["idltest",
698 {"op": "update",
699 "table": "link1",
700 "where": [["i", "==", 1]],
701 "row": {"k": ["uuid", "#1#"]}}]' \
702 '["idltest",
703 {"op": "update",
704 "table": "link1",
705 "where": [],
706 "row": {"k": ["uuid", "#0#"]}}]']],
707 [[000: empty
708 001: {"error":null,"result":[{"uuid":["uuid","<0>"]}]}
709 002: i=0 k=0 ka=[] l2= uuid=<0>
710 003: {"error":null,"result":[{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]}]}
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>
714 005: {"error":null,"result":[{"count":1}]}
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>
718 007: {"error":null,"result":[{"count":3}]}
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>
722 009: done
723 ]])
724
725 OVSDB_CHECK_IDL([self-linking idl, inconsistent ops],
726 [],
727 [['["idltest",
728 {"op": "insert",
729 "table": "link1",
730 "row": {"i": 0, "k": ["uuid", "cf197cc5-c8c9-42f5-82d5-c71a9f2cb96b"]}}]' \
731 '+["idltest",
732 {"op": "insert",
733 "table": "link1",
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"]}}]' \
739 '["idltest",
740 {"op": "update",
741 "table": "link1",
742 "where": [],
743 "row": {"k": ["uuid", "c2fca39a-e69a-42a4-9c56-5eca85839ce9"]}}]' \
744 '+["idltest",
745 {"op": "delete",
746 "table": "link1",
747 "where": [["_uuid", "==", ["uuid", "#1#"]]]}]' \
748 '+["idltest",
749 {"op": "delete",
750 "table": "link1",
751 "where": [["_uuid", "==", ["uuid", "#2#"]]]}]' \
752 '["idltest",
753 {"op": "delete",
754 "table": "link1",
755 "where": []}]' \
756 ]],
757 [[000: empty
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"}]}
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>
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"}]}
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
769 ]],
770 [],
771 [[sed -e '/004:/s/row <[23]> references/row <x> references/']])
772
773 OVSDB_CHECK_IDL([self-linking idl, sets],
774 [],
775 [['["idltest",
776 {"op": "insert",
777 "table": "link1",
778 "row": {"i": 0, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i0"]]]},
779 "uuid-name": "i0"},
780 {"op": "insert",
781 "table": "link1",
782 "row": {"i": 1, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i1"]]]},
783 "uuid-name": "i1"},
784 {"op": "insert",
785 "table": "link1",
786 "row": {"i": 2, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i2"]]]},
787 "uuid-name": "i2"},
788 {"op": "insert",
789 "table": "link1",
790 "row": {"i": 3, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i3"]]]},
791 "uuid-name": "i3"}]' \
792 '["idltest",
793 {"op": "update",
794 "table": "link1",
795 "where": [],
796 "row": {"ka": ["set", [["uuid", "#0#"], ["uuid", "#1#"], ["uuid", "#2#"], ["uuid", "#3#"]]]}}]' \
797 '["idltest",
798 {"op": "update",
799 "table": "link1",
800 "where": [["i", "==", 2]],
801 "row": {"ka": ["set", [["uuid", "#0#"], ["uuid", "88702e78-845b-4a6e-ad08-cf68922ae84a"], ["uuid", "#2#"]]]}}]' \
802 '+["idltest",
803 {"op": "delete",
804 "table": "link1",
805 "where": []}]']],
806 [[000: empty
807 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]},{"uuid":["uuid","<3>"]}]}
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>
812 003: {"error":null,"result":[{"count":4}]}
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>
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"}]}
818 006: {"error":null,"result":[{"count":4}]}
819 007: empty
820 008: done
821 ]])
822
823 OVSDB_CHECK_IDL([external-linking idl, consistent ops],
824 [],
825 [['["idltest",
826 {"op": "insert",
827 "table": "link2",
828 "row": {"i": 0},
829 "uuid-name": "row0"},
830 {"op": "insert",
831 "table": "link1",
832 "row": {"i": 1, "k": ["named-uuid", "row1"], "l2": ["set", [["named-uuid", "row0"]]]},
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>
837 002: i=1 k=1 ka=[] l2=0 uuid=<1>
838 003: done
839 ]])
840
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
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 ]])
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 ]])
885
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
903 AT_SETUP([idl handling of missing tables and columns - C])
904 AT_KEYWORDS([ovsdb server idl positive])
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.
910 AT_CHECK([ovsdb_start_idltest "" "$abs_srcdir/idltest2.ovsschema"])
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#"]}}]']],
935 [0], [stdout], [stderr])
936 AT_CHECK([sort stdout | uuidfilt], [0],
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
953 ]])
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?)
958 test-ovsdb|ovsdb_idl|idltest database lacks simple5 table (database needs upgrade?)
959 test-ovsdb|ovsdb_idl|idltest database lacks singleton table (database needs upgrade?)
960 test-ovsdb|ovsdb_idl|link1 table in idltest database lacks l2 column (database needs upgrade?)
961 ])
962
963 # Check that ovsdb-idl sent on "monitor" request and that it didn't
964 # mention that table or column, and (for paranoia) that it did mention another
965 # table and column.
966 AT_CHECK([grep -c '"monitor\|monitor_cond"' stderr], [0], [2
967 ])
968 AT_CHECK([grep '"monitor\|monitor_cond"' stderr | grep link2], [1])
969 AT_CHECK([grep '"monitor\|monitor_cond"' stderr | grep l2], [1])
970 AT_CHECK([grep '"monitor\|monitor_cond"' stderr | grep -c '"link1"'], [0], [1
971 ])
972 AT_CHECK([grep '"monitor\|monitor_cond"' stderr | grep -c '"ua"'], [0], [1
973 ])
974 OVSDB_SERVER_SHUTDOWN
975 AT_CLEANUP
976
977 m4_define([OVSDB_CHECK_IDL_FETCH_COLUMNS_PY],
978 [AT_SETUP([$1 - Python3 - fetch])
979 AT_KEYWORDS([ovsdb server idl positive Python increment fetch $6])
980 AT_CHECK([ovsdb_start_idltest])
981 m4_if([$2], [], [],
982 [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])])
983 AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket [$3] $4],
984 [0], [stdout], [ignore])
985 AT_CHECK([sort stdout | uuidfilt]m4_if([$7],,, [[| $7]]),
986 [0], [$5])
987 OVSDB_SERVER_SHUTDOWN
988 AT_CLEANUP])
989
990 m4_define([OVSDB_CHECK_IDL_FETCH_COLUMNS],
991 [OVSDB_CHECK_IDL_FETCH_COLUMNS_PY($@)])
992
993 OVSDB_CHECK_IDL_FETCH_COLUMNS([simple idl, initially populated],
994 [['["idltest",
995 {"op": "insert",
996 "table": "simple",
997 "row": {"i": 1,
998 "r": 2.0,
999 "b": true,
1000 "s": "mystring",
1001 "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"],
1002 "ia": ["set", [1, 2, 3]],
1003 "ra": ["set", [-0.5]],
1004 "ba": ["set", [true]],
1005 "sa": ["set", ["abc", "def"]],
1006 "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
1007 ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
1008 {"op": "insert",
1009 "table": "simple",
1010 "row": {}}]']],
1011 [?simple:i,r!],
1012 ['fetch 0 r'],
1013 [[000: i=0 uuid=<0>
1014 000: i=1 uuid=<1>
1015 001: commit, status=success
1016 002: i=0 r=0 uuid=<0>
1017 002: i=1 uuid=<1>
1018 003: done
1019 ]])
1020
1021 m4_define([OVSDB_CHECK_IDL_WO_MONITOR_COND_PY],
1022 [AT_SETUP([$1 - Python3])
1023 AT_KEYWORDS([ovsdb server idl Python monitor $4])
1024 AT_CHECK([ovsdb_start_idltest])
1025 AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/disable-monitor-cond])
1026 AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket $2],
1027 [0], [stdout], [ignore])
1028 AT_CHECK([sort stdout | uuidfilt]m4_if([$5],,, [[| $5]]),
1029 [0], [$3])
1030 OVSDB_SERVER_SHUTDOWN
1031 AT_CLEANUP])
1032
1033 m4_define([OVSDB_CHECK_IDL_WO_MONITOR_COND],
1034 [OVSDB_CHECK_IDL_WO_MONITOR_COND_PY($@)])
1035
1036
1037 OVSDB_CHECK_IDL_WO_MONITOR_COND([simple idl disable monitor-cond],
1038 [['["idltest",
1039 {"op": "insert",
1040 "table": "simple",
1041 "row": {"i": 1,
1042 "r": 2.0,
1043 "b": true,
1044 "s": "mystring",
1045 "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"],
1046 "ia": ["set", [1, 2, 3]],
1047 "ra": ["set", [-0.5]],
1048 "ba": ["set", [true]],
1049 "sa": ["set", ["abc", "def"]],
1050 "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
1051 ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
1052 {"op": "insert",
1053 "table": "simple",
1054 "row": {}}]' \
1055 '["idltest",
1056 {"op": "update",
1057 "table": "simple",
1058 "where": [],
1059 "row": {"b": true}}]' \
1060 '["idltest",
1061 {"op": "update",
1062 "table": "simple",
1063 "where": [],
1064 "row": {"r": 123.5}}]' \
1065 '["idltest",
1066 {"op": "insert",
1067 "table": "simple",
1068 "row": {"i": -1,
1069 "r": 125,
1070 "b": false,
1071 "s": "",
1072 "ia": ["set", [1]],
1073 "ra": ["set", [1.5]],
1074 "ba": ["set", [false]],
1075 "sa": ["set", []],
1076 "ua": ["set", []]}}]' \
1077 '["idltest",
1078 {"op": "update",
1079 "table": "simple",
1080 "where": [["i", "<", 1]],
1081 "row": {"s": "newstring"}}]' \
1082 '["idltest",
1083 {"op": "delete",
1084 "table": "simple",
1085 "where": [["i", "==", 0]]}]' \
1086 'reconnect']],
1087 [[000: empty
1088 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]}
1089 002: i=0 r=0 b=false s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
1090 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>
1091 003: {"error":null,"result":[{"count":2}]}
1092 004: i=0 r=0 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
1093 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>
1094 005: {"error":null,"result":[{"count":2}]}
1095 006: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
1096 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>
1097 007: {"error":null,"result":[{"uuid":["uuid","<6>"]}]}
1098 008: i=-1 r=125 b=false s= u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
1099 008: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
1100 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>
1101 009: {"error":null,"result":[{"count":2}]}
1102 010: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
1103 010: i=0 r=123.5 b=true s=newstring u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
1104 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>
1105 011: {"error":null,"result":[{"count":1}]}
1106 012: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
1107 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>
1108 013: reconnect
1109 014: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
1110 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>
1111 015: done
1112 ]])
1113
1114 m4_define([OVSDB_CHECK_IDL_TRACK_C],
1115 [AT_SETUP([$1 - C])
1116 AT_KEYWORDS([ovsdb server idl tracking positive $5])
1117 AT_CHECK([ovsdb_start_idltest])
1118 m4_if([$2], [], [],
1119 [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])])
1120 AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl unix:socket $3],
1121 [0], [stdout], [ignore])
1122 AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]),
1123 [0], [$4])
1124 OVSDB_SERVER_SHUTDOWN
1125 AT_CLEANUP])
1126
1127 m4_define([OVSDB_CHECK_IDL_TRACK],
1128 [OVSDB_CHECK_IDL_TRACK_C($@)])
1129
1130 OVSDB_CHECK_IDL_TRACK([track, simple idl, initially populated],
1131 [['["idltest",
1132 {"op": "insert",
1133 "table": "simple",
1134 "row": {"i": 1,
1135 "r": 2.0,
1136 "b": true,
1137 "s": "mystring",
1138 "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"],
1139 "ia": ["set", [1, 2, 3]],
1140 "ra": ["set", [-0.5]],
1141 "ba": ["set", [true]],
1142 "sa": ["set", ["abc", "def"]],
1143 "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
1144 ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
1145 {"op": "insert",
1146 "table": "simple",
1147 "row": {}}]']],
1148 [['["idltest",
1149 {"op": "update",
1150 "table": "simple",
1151 "where": [],
1152 "row": {"b": true}}]']],
1153 [[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>
1154 000: updated columns: b ba i ia r ra s sa u ua
1155 001: {"error":null,"result":[{"count":2}]}
1156 002: i=0 r=0 b=true s= u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<5>
1157 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>
1158 002: updated columns: b
1159 003: done
1160 ]])
1161
1162 OVSDB_CHECK_IDL_TRACK([track, simple idl, initially empty, various ops],
1163 [],
1164 [['["idltest",
1165 {"op": "insert",
1166 "table": "simple",
1167 "row": {"i": 1,
1168 "r": 2.0,
1169 "b": true,
1170 "s": "mystring",
1171 "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"],
1172 "ia": ["set", [1, 2, 3]],
1173 "ra": ["set", [-0.5]],
1174 "ba": ["set", [true]],
1175 "sa": ["set", ["abc", "def"]],
1176 "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
1177 ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
1178 {"op": "insert",
1179 "table": "simple",
1180 "row": {}}]' \
1181 '["idltest",
1182 {"op": "update",
1183 "table": "simple",
1184 "where": [],
1185 "row": {"b": true}}]' \
1186 '["idltest",
1187 {"op": "update",
1188 "table": "simple",
1189 "where": [],
1190 "row": {"r": 123.5}}]' \
1191 '["idltest",
1192 {"op": "insert",
1193 "table": "simple",
1194 "row": {"i": -1,
1195 "r": 125,
1196 "b": false,
1197 "s": "",
1198 "ia": ["set", [1]],
1199 "ra": ["set", [1.5]],
1200 "ba": ["set", [false]],
1201 "sa": ["set", []],
1202 "ua": ["set", []]}}]' \
1203 '["idltest",
1204 {"op": "update",
1205 "table": "simple",
1206 "where": [["i", "<", 1]],
1207 "row": {"s": "newstring"}}]' \
1208 '["idltest",
1209 {"op": "delete",
1210 "table": "simple",
1211 "where": [["i", "==", 0]]}]' \
1212 'reconnect']],
1213 [[000: empty
1214 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]}
1215 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>
1216 002: updated columns: b ba i ia r ra s sa u ua
1217 003: {"error":null,"result":[{"count":2}]}
1218 004: i=0 r=0 b=true s= u=<5> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
1219 004: updated columns: b
1220 005: {"error":null,"result":[{"count":2}]}
1221 006: i=0 r=123.5 b=true s= u=<5> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
1222 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>
1223 006: updated columns: r
1224 006: updated columns: r
1225 007: {"error":null,"result":[{"uuid":["uuid","<6>"]}]}
1226 008: i=-1 r=125 b=false s= u=<5> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
1227 008: updated columns: ba i ia r ra
1228 009: {"error":null,"result":[{"count":2}]}
1229 010: i=-1 r=125 b=false s=newstring u=<5> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
1230 010: i=0 r=123.5 b=true s=newstring u=<5> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
1231 010: updated columns: s
1232 010: updated columns: s
1233 011: {"error":null,"result":[{"count":1}]}
1234 012: ##deleted## uuid=<1>
1235 013: reconnect
1236 014: i=-1 r=125 b=false s=newstring u=<5> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
1237 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>
1238 014: updated columns: b ba i ia r ra s sa u ua
1239 014: updated columns: ba i ia r ra s
1240 015: done
1241 ]])
1242
1243 m4_define([OVSDB_CHECK_IDL_PARTIAL_UPDATE_MAP_COLUMN],
1244 [AT_SETUP([$1 - C])
1245 AT_KEYWORDS([ovsdb server idl partial update map column positive $5])
1246 AT_CHECK([ovsdb_start_idltest])
1247 m4_if([$2], [], [],
1248 [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])])
1249 AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl-partial-update-map-column unix:socket $3],
1250 [0], [stdout], [ignore])
1251 AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]),
1252 [0], [$4])
1253 OVSDB_SERVER_SHUTDOWN
1254 AT_CLEANUP])
1255
1256 OVSDB_CHECK_IDL_PARTIAL_UPDATE_MAP_COLUMN([map, simple2 idl-partial-update-map-column, initially populated],
1257 [['["idltest", {"op":"insert", "table":"simple2",
1258 "row":{"name":"myString1","smap":["map",[["key1","value1"],["key2","value2"]]]} }]']
1259 ],
1260 [],
1261 [[000: Getting records
1262 001: name=myString1 smap=[[key1 : value1],[key2 : value2]] imap=[]
1263 002: After insert element
1264 003: name=String2 smap=[[key1 : myList1],[key2 : value2]] imap=[[3 : myids2]]
1265 004: After insert duplicated element
1266 005: name=String2 smap=[[key1 : myList1],[key2 : value2]] imap=[[3 : myids2]]
1267 006: After delete element
1268 007: name=String2 smap=[[key2 : value2]] imap=[[3 : myids2]]
1269 008: After trying to delete a deleted element
1270 009: name=String2 smap=[[key2 : value2]] imap=[[3 : myids2]]
1271 010: End test
1272 ]])
1273
1274 OVSDB_CHECK_IDL_PY([partial-map idl],
1275 [['["idltest", {"op":"insert", "table":"simple2",
1276 "row":{"name":"myString1","smap":["map",[["key1","value1"],["key2","value2"]]]} }]']
1277 ],
1278 [?simple2:name,smap,imap 'partialmapinsertelement' 'partialmapinsertmultipleelements' 'partialmapdelelements' 'partialmapmutatenew'],
1279 [[000: name=myString1 smap=[(key1 value1) (key2 value2)] imap=[]
1280 001: commit, status=success
1281 002: name=String2 smap=[(key1 myList1) (key2 value2)] imap=[(3 myids2)]
1282 003: commit, status=success
1283 004: name=String2 smap=[(key1 myList1) (key2 myList2) (key3 myList3) (key4 myList4)] imap=[(3 myids2)]
1284 005: commit, status=success
1285 006: name=String2 smap=[(key2 myList2)] imap=[(3 myids2)]
1286 007: commit, status=success
1287 008: name=String2 smap=[(key2 myList2)] imap=[(3 myids2)]
1288 008: name=String2New smap=[(key1 newList1) (key2 newList2)] imap=[]
1289 009: done
1290 ]])
1291
1292 OVSDB_CHECK_IDL_PY([partial-map update set refmap idl],
1293 [['["idltest", {"op":"insert", "table":"simple3", "row":{"name":"myString1"}},
1294 {"op":"insert", "table":"simple5", "row":{"name":"myString2"}}]']],
1295 ['partialmapmutateirefmap'],
1296 [[000: name=myString1 uset=[]
1297 000: name=myString2 irefmap=[]
1298 001: commit, status=success
1299 002: name=myString1 uset=[]
1300 002: name=myString2 irefmap=[(1 <0>)]
1301 003: done
1302 ]])
1303
1304 m4_define([OVSDB_CHECK_IDL_PARTIAL_UPDATE_SET_COLUMN],
1305 [AT_SETUP([$1 - C])
1306 AT_KEYWORDS([ovsdb server idl partial update set column positive $5])
1307 AT_CHECK([ovsdb_start_idltest])
1308 m4_if([$2], [], [],
1309 [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])])
1310 AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl-partial-update-set-column unix:socket $3],
1311 [0], [stdout], [ignore])
1312 AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]),
1313 [0], [$4])
1314 OVSDB_SERVER_SHUTDOWN
1315 AT_CLEANUP])
1316
1317 OVSDB_CHECK_IDL_PARTIAL_UPDATE_SET_COLUMN([set, simple3 idl-partial-update-set-column, initially populated],
1318 [['["idltest", {"op":"insert", "table":"simple3",
1319 "row":{"name":"mySet1","uset":["set", [[ "uuid", "0005b872-f9e5-43be-ae02-3184b9680e75" ], [ "uuid", "000d2f6a-76af-412f-b59d-e7bcd3e84eff" ]]]} }]']
1320 ],
1321 [],
1322 [[000: Getting records
1323 001: name=mySet1 uset=[[<0>],[<1>]] uref=[]
1324 002: After rename+add new value
1325 003: name=String2 uset=[[<0>],[<1>],[<2>]] uref=[]
1326 004: After add new value
1327 005: name=String2 uset=[[<0>],[<1>],[<2>],[<3>]] uref=[]
1328 006: After delete value
1329 007: name=String2 uset=[[<0>],[<1>],[<3>]] uref=[]
1330 008: After trying to delete a deleted value
1331 009: name=String2 uset=[[<0>],[<1>],[<3>]] uref=[]
1332 010: After add to other table + set of strong ref
1333 011: name=String2 uset=[[<0>],[<1>],[<3>]] uref=[[<4>]]
1334 012: End test
1335 ]])
1336
1337 OVSDB_CHECK_IDL_PY([partial-set idl],
1338 [['["idltest", {"op":"insert", "table":"simple3", "uuid-name":"newrow",
1339 "row":{"name":"mySet1","uset":["set", [[ "uuid", "0005b872-f9e5-43be-ae02-3184b9680e75" ]]]} },
1340 {"op":"insert", "table":"simple4", "row":{"name":"seed"}},
1341 {"op":"mutate", "table":"simple3", "where":[["_uuid", "==", ["named-uuid", "newrow"]]],
1342 "mutations": [["uset", "insert", ["set", [["uuid", "000d2f6a-76af-412f-b59d-e7bcd3e84eff"]]]]]}]']
1343 ],
1344 ['partialrenamesetadd' 'partialduplicateadd' 'partialsetdel' 'partialsetref' 'partialsetoverrideops' 'partialsetadddelete' 'partialsetmutatenew'],
1345 [[000: name=mySet1 uset=[<0> <1>]
1346 001: commit, status=success
1347 002: name=String2 uset=[<0> <1> <2>]
1348 003: commit, status=success
1349 004: name=String2 uset=[<0> <1> <2> <3>]
1350 005: commit, status=success
1351 006: name=String2 uset=[<0> <1> <3>]
1352 007: commit, status=success
1353 008: name=String2 uset=[<0> <1> <3>]
1354 009: commit, status=success
1355 010: name=String2 uset=[<3>]
1356 011: commit, status=success
1357 012: name=String2 uset=[<4> <5>]
1358 013: commit, status=success
1359 014: name=String2 uset=[<4> <5>]
1360 014: name=String3 uset=[<6>]
1361 015: done
1362 ]])
1363
1364 m4_define([OVSDB_CHECK_IDL_NOTIFY],
1365 [OVSDB_CHECK_IDL_PY([$1], [], [$2], [$3], [notify $4], [$5])
1366 OVSDB_CHECK_IDL_SSL_PY([$1], [], [$2], [$3], [notify $4], [$5])])
1367
1368 OVSDB_CHECK_IDL_NOTIFY([simple idl verify notify],
1369 [['track-notify' \
1370 '["idltest",
1371 {"op": "insert",
1372 "table": "simple",
1373 "row": {"i": 1,
1374 "r": 2.0,
1375 "b": true,
1376 "s": "mystring",
1377 "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"],
1378 "ia": ["set", [1, 2, 3]],
1379 "ra": ["set", [-0.5]],
1380 "ba": ["set", [true]],
1381 "sa": ["set", ["abc", "def"]],
1382 "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
1383 ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
1384 {"op": "insert",
1385 "table": "simple",
1386 "row": {}}]' \
1387 '["idltest",
1388 {"op": "update",
1389 "table": "simple",
1390 "where": [],
1391 "row": {"b": false}}]' \
1392 '["idltest",
1393 {"op": "update",
1394 "table": "simple",
1395 "where": [],
1396 "row": {"r": 123.5}}]' \
1397 '["idltest",
1398 {"op": "insert",
1399 "table": "simple",
1400 "row": {"i": -1,
1401 "r": 125,
1402 "b": false,
1403 "s": "",
1404 "ia": ["set", [1]],
1405 "ra": ["set", [1.5]],
1406 "ba": ["set", [false]],
1407 "sa": ["set", []],
1408 "ua": ["set", []]}}]' \
1409 '["idltest",
1410 {"op": "update",
1411 "table": "simple",
1412 "where": [["i", "<", 1]],
1413 "row": {"s": "newstring"}}]' \
1414 '["idltest",
1415 {"op": "delete",
1416 "table": "simple",
1417 "where": [["i", "==", 0]]}]' \
1418 'reconnect']],
1419 [[000: empty
1420 000: event:create, row={uuid=<0>}, updates=None
1421 000: event:create, row={uuid=<1>}, updates=None
1422 001: {"error":null,"result":[{"uuid":["uuid","<2>"]},{"uuid":["uuid","<3>"]}]}
1423 002: event:create, row={i=0 r=0 b=false s= u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3>}, updates=None
1424 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
1425 002: i=0 r=0 b=false s= u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3>
1426 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>
1427 003: {"error":null,"result":[{"count":2}]}
1428 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>}
1429 004: i=0 r=0 b=false s= u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3>
1430 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>
1431 005: {"error":null,"result":[{"count":2}]}
1432 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>}
1433 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>}
1434 006: i=0 r=123.5 b=false s= u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3>
1435 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>
1436 007: {"error":null,"result":[{"uuid":["uuid","<8>"]}]}
1437 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
1438 008: i=-1 r=125 b=false s= u=<4> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<8>
1439 008: i=0 r=123.5 b=false s= u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3>
1440 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>
1441 009: {"error":null,"result":[{"count":2}]}
1442 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>}
1443 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>}
1444 010: i=-1 r=125 b=false s=newstring u=<4> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<8>
1445 010: i=0 r=123.5 b=false s=newstring u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3>
1446 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>
1447 011: {"error":null,"result":[{"count":1}]}
1448 012: event:delete, row={i=0 r=123.5 b=false s=newstring u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3>}, updates=None
1449 012: i=-1 r=125 b=false s=newstring u=<4> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<8>
1450 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>
1451 013: reconnect
1452 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
1453 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
1454 014: event:create, row={uuid=<0>}, updates=None
1455 014: event:create, row={uuid=<1>}, updates=None
1456 014: i=-1 r=125 b=false s=newstring u=<4> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<8>
1457 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>
1458 015: done
1459 ]])
1460
1461 # Tests to verify the functionality of the one column compound index.
1462 # It tests index for one column string and integer indexes.
1463 # The run of test-ovsdb generates the output of the display of data using the different indexes defined in
1464 # the program.
1465 # Then, some at_checks are used to verify the correctness of the corresponding index as well as the existence
1466 # of all the rows involved in the test.
1467 m4_define([OVSDB_CHECK_IDL_COMPOUND_INDEX_SINGLE_COLUMN_C],
1468 [AT_SETUP([$1 - C])
1469 AT_KEYWORDS([ovsdb server idl compound_index_single_column compound_index positive $5])
1470 AT_CHECK([ovsdb_start_idltest])
1471 m4_if([$2], [], [],
1472 [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])])
1473 # Generate the data to be tested.
1474 AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl-compound-index unix:socket $3],
1475 [0], [stdout], [ignore])
1476 # Filter the rows of data that corresponds to the string index eliminating the extra columns of data.
1477 # This is done to verifiy that the output data is in the correct and expected order.
1478 AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: s=.*' | sed -e 's/ i=.*//g']],
1479 [0], [$4])
1480 # Here, the data is filtered and sorted in order to have all the rows in the index and be
1481 # able to determined that all the involved rows are present.
1482 AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: s=.*' | sort -k 1,1n -k 2,2 -k 3,3]],
1483 [0], [$5])
1484 # Filter the rows of data that corresponds to the integer index eliminating the extra columns of data.
1485 # This is done to verifiy that the output data is in the correct and expected order.
1486 AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: i=.*' | sed -e 's/ s=.*//g']],
1487 [0], [$6])
1488 # Here again, the data is filtered and sorted in order to have all the rows in the index and be
1489 # able to determined that all the involved rows are present.
1490 AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: i=.*' | sort -k 1,1n -k 2,2 -k 3,3]],
1491 [0], [$7])
1492 OVSDB_SERVER_SHUTDOWN
1493 AT_CLEANUP])
1494
1495 OVSDB_CHECK_IDL_COMPOUND_INDEX_SINGLE_COLUMN_C([Compound_index, single column test ],
1496 [['["idltest",
1497 {"op": "insert", "table": "simple", "row": {"s":"List000", "i": 1, "b":true, "r":101.0}},
1498 {"op": "insert", "table": "simple", "row": {"s":"List000", "i": 2, "b":false, "r":102.0}},
1499 {"op": "insert", "table": "simple", "row": {"s":"List000", "i": 10, "b":true, "r":110.0}},
1500 {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 1, "b":false, "r":110.0}},
1501 {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 2, "b":true, "r":120.0}},
1502 {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 2, "b":true, "r":122.0}},
1503 {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 4, "b":true, "r":130.0}},
1504 {"op": "insert", "table": "simple", "row": {"s":"List005", "i": 5, "b":true, "r":130.0}},
1505 {"op": "insert", "table": "simple", "row": {"s":"List020", "i": 20, "b":true, "r":220.0}},
1506 {"op": "insert", "table": "simple", "row": {"s":"List020", "i": 19, "b":true, "r":219.0}}
1507 ]']],
1508 [idl_compound_index_single_column],
1509 [001: s=List000
1510 001: s=List000
1511 001: s=List000
1512 001: s=List001
1513 001: s=List001
1514 001: s=List001
1515 001: s=List001
1516 001: s=List005
1517 001: s=List020
1518 001: s=List020
1519 003: s=List001
1520 003: s=List001
1521 003: s=List001
1522 003: s=List001
1523 ],
1524 [001: s=List000 i=1 b=True r=101.000000
1525 001: s=List000 i=10 b=True r=110.000000
1526 001: s=List000 i=2 b=False r=102.000000
1527 001: s=List001 i=1 b=False r=110.000000
1528 001: s=List001 i=2 b=True r=120.000000
1529 001: s=List001 i=2 b=True r=122.000000
1530 001: s=List001 i=4 b=True r=130.000000
1531 001: s=List005 i=5 b=True r=130.000000
1532 001: s=List020 i=19 b=True r=219.000000
1533 001: s=List020 i=20 b=True r=220.000000
1534 003: s=List001 i=1 b=False r=110.000000
1535 003: s=List001 i=2 b=True r=120.000000
1536 003: s=List001 i=2 b=True r=122.000000
1537 003: s=List001 i=4 b=True r=130.000000
1538 ],
1539 [002: i=1
1540 002: i=1
1541 002: i=2
1542 002: i=2
1543 002: i=2
1544 002: i=4
1545 002: i=5
1546 002: i=10
1547 002: i=19
1548 002: i=20
1549 004: i=5
1550 005: i=4
1551 005: i=5
1552 006: i=5
1553 006: i=10
1554 006: i=19
1555 006: i=20
1556 006: i=54
1557 007: i=5
1558 007: i=19
1559 007: i=20
1560 007: i=30
1561 007: i=54
1562 008: i=1
1563 008: i=1
1564 008: i=2
1565 008: i=2
1566 008: i=2
1567 008: i=5
1568 008: i=19
1569 008: i=20
1570 008: i=30
1571 008: i=54
1572 ],
1573 [002: i=1 s=List000 b=True r=101.000000
1574 002: i=1 s=List001 b=False r=110.000000
1575 002: i=10 s=List000 b=True r=110.000000
1576 002: i=19 s=List020 b=True r=219.000000
1577 002: i=2 s=List000 b=False r=102.000000
1578 002: i=2 s=List001 b=True r=120.000000
1579 002: i=2 s=List001 b=True r=122.000000
1580 002: i=20 s=List020 b=True r=220.000000
1581 002: i=4 s=List001 b=True r=130.000000
1582 002: i=5 s=List005 b=True r=130.000000
1583 004: i=5 s=List005 b=True r=130.000000
1584 005: i=4 s=List001 b=True r=130.000000
1585 005: i=5 s=List005 b=True r=130.000000
1586 006: i=10 s=List000 b=True r=110.000000
1587 006: i=19 s=List020 b=True r=219.000000
1588 006: i=20 s=List020 b=True r=220.000000
1589 006: i=5 s=List005 b=True r=130.000000
1590 006: i=54 s=Lista054 b=False r=0.000000
1591 007: i=19 s=List020 b=True r=219.000000
1592 007: i=20 s=List020 b=True r=220.000000
1593 007: i=30 s=List000 b=True r=110.000000
1594 007: i=5 s=List005 b=True r=130.000000
1595 007: i=54 s=Lista054 b=False r=0.000000
1596 008: i=1 s=List000 b=True r=101.000000
1597 008: i=1 s=List001 b=False r=110.000000
1598 008: i=19 s=List020 b=True r=219.000000
1599 008: i=2 s=List000 b=False r=102.000000
1600 008: i=2 s=List001 b=True r=120.000000
1601 008: i=2 s=List001 b=True r=122.000000
1602 008: i=20 s=List020 b=True r=220.000000
1603 008: i=30 s=List000 b=True r=110.000000
1604 008: i=5 s=List005 b=True r=130.000000
1605 008: i=54 s=Lista054 b=False r=0.000000
1606 ])
1607
1608 # Tests to verify the functionality of two column compound index.
1609 # It tests index for two columns using string and integer fields.
1610 # The run of test-ovsdb generates the output of the display of data using the different indexes defined in
1611 # the program.
1612 # Then, some at_checks are used to verify the correctness of the corresponding index as well as the existence
1613 # of all the rows involved in the test.
1614 m4_define([OVSDB_CHECK_IDL_COMPOUND_INDEX_DOUBLE_COLUMN_C],
1615 [AT_SETUP([$1 - C])
1616 AT_KEYWORDS([ovsdb server idl compound_index_double_column compound_index positive $5])
1617 AT_CHECK([ovsdb_start_idltest])
1618 m4_if([$2], [], [],
1619 [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])])
1620 # Generate the data to be tested.
1621 AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl-compound-index unix:socket $3],
1622 [0], [stdout], [ignore])
1623 # Filter the rows of data that corresponds to the string-integer index eliminating the extra columns of data.
1624 # This is done to verifiy that the output data is in the correct and expected order.
1625 AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: s=.*' | sed -e 's/ b=.*//g']],
1626 [0], [$4])
1627 # Here, the data is filtered and sorted in order to have all the rows in the index and be
1628 # able to determined that all the involved rows are present.
1629 AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: s=.*' | sort -k 1,1n -k 2,2 -k 3,3]],
1630 [0], [$5])
1631 # Filter the rows of data that corresponds to the integer index eliminating the extra columns of data.
1632 # This is done to verifiy that the output data is in the correct and expected order.
1633 AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: i=.*' | sed -e 's/ b=.*//g']],
1634 [0], [$6])
1635 # Here again, the data is filtered and sorted in order to have all the rows in the index and be
1636 # able to determined that all the involved rows are present.
1637 AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: i=.*' | sort -k 1,1n -k 2,2 -k 3,3]],
1638 [0], [$7])
1639 OVSDB_SERVER_SHUTDOWN
1640 AT_CLEANUP])
1641
1642 OVSDB_CHECK_IDL_COMPOUND_INDEX_DOUBLE_COLUMN_C([Compound_index, double column test ],
1643 [['["idltest",
1644 {"op": "insert", "table": "simple", "row": {"s":"List000", "i": 1, "b":true, "r":101.0}},
1645 {"op": "insert", "table": "simple", "row": {"s":"List000", "i": 2, "b":false, "r":102.0}},
1646 {"op": "insert", "table": "simple", "row": {"s":"List000", "i": 10, "b":true, "r":110.0}},
1647 {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 1, "b":false, "r":110.0}},
1648 {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 2, "b":true, "r":120.0}},
1649 {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 2, "b":true, "r":122.0}},
1650 {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 4, "b":true, "r":130.0}},
1651 {"op": "insert", "table": "simple", "row": {"s":"List005", "i": 5, "b":true, "r":130.0}},
1652 {"op": "insert", "table": "simple", "row": {"s":"List020", "i": 20, "b":true, "r":220.0}},
1653 {"op": "insert", "table": "simple", "row": {"s":"List020", "i": 19, "b":true, "r":219.0}}
1654 ]']],
1655 [idl_compound_index_double_column],
1656 [001: s=List000 i=1
1657 001: s=List000 i=2
1658 001: s=List000 i=10
1659 001: s=List001 i=1
1660 001: s=List001 i=2
1661 001: s=List001 i=2
1662 001: s=List001 i=4
1663 001: s=List005 i=5
1664 001: s=List020 i=19
1665 001: s=List020 i=20
1666 002: s=List000 i=10
1667 002: s=List000 i=2
1668 002: s=List000 i=1
1669 002: s=List001 i=4
1670 002: s=List001 i=2
1671 002: s=List001 i=2
1672 002: s=List001 i=1
1673 002: s=List005 i=5
1674 002: s=List020 i=20
1675 002: s=List020 i=19
1676 003: s=List000 i=10
1677 004: s=List001 i=1
1678 004: s=List001 i=2
1679 004: s=List001 i=2
1680 004: s=List001 i=4
1681 004: s=List005 i=5
1682 ],
1683 [001: s=List000 i=1 b=True r=101.000000
1684 001: s=List000 i=10 b=True r=110.000000
1685 001: s=List000 i=2 b=False r=102.000000
1686 001: s=List001 i=1 b=False r=110.000000
1687 001: s=List001 i=2 b=True r=120.000000
1688 001: s=List001 i=2 b=True r=122.000000
1689 001: s=List001 i=4 b=True r=130.000000
1690 001: s=List005 i=5 b=True r=130.000000
1691 001: s=List020 i=19 b=True r=219.000000
1692 001: s=List020 i=20 b=True r=220.000000
1693 002: s=List000 i=1 b=True r=101.000000
1694 002: s=List000 i=10 b=True r=110.000000
1695 002: s=List000 i=2 b=False r=102.000000
1696 002: s=List001 i=1 b=False r=110.000000
1697 002: s=List001 i=2 b=True r=120.000000
1698 002: s=List001 i=2 b=True r=122.000000
1699 002: s=List001 i=4 b=True r=130.000000
1700 002: s=List005 i=5 b=True r=130.000000
1701 002: s=List020 i=19 b=True r=219.000000
1702 002: s=List020 i=20 b=True r=220.000000
1703 003: s=List000 i=10 b=True r=110.000000
1704 004: s=List001 i=1 b=False r=110.000000
1705 004: s=List001 i=2 b=True r=120.000000
1706 004: s=List001 i=2 b=True r=122.000000
1707 004: s=List001 i=4 b=True r=130.000000
1708 004: s=List005 i=5 b=True r=130.000000
1709 ],
1710 [005: i=1 s=List000
1711 005: i=1 s=List001
1712 005: i=2 s=List000
1713 005: i=2 s=List001
1714 005: i=2 s=List001
1715 005: i=4 s=List001
1716 005: i=5 s=List005
1717 005: i=10 s=List000
1718 005: i=19 s=List020
1719 005: i=20 s=List020
1720 006: i=20 s=List020
1721 006: i=19 s=List020
1722 006: i=10 s=List000
1723 006: i=5 s=List005
1724 006: i=4 s=List001
1725 006: i=2 s=List000
1726 006: i=2 s=List001
1727 006: i=2 s=List001
1728 006: i=1 s=List000
1729 006: i=1 s=List001
1730 ],
1731 [005: i=1 s=List000 b=True r=101.000000
1732 005: i=1 s=List001 b=False r=110.000000
1733 005: i=10 s=List000 b=True r=110.000000
1734 005: i=19 s=List020 b=True r=219.000000
1735 005: i=2 s=List000 b=False r=102.000000
1736 005: i=2 s=List001 b=True r=120.000000
1737 005: i=2 s=List001 b=True r=122.000000
1738 005: i=20 s=List020 b=True r=220.000000
1739 005: i=4 s=List001 b=True r=130.000000
1740 005: i=5 s=List005 b=True r=130.000000
1741 006: i=1 s=List000 b=True r=101.000000
1742 006: i=1 s=List001 b=False r=110.000000
1743 006: i=10 s=List000 b=True r=110.000000
1744 006: i=19 s=List020 b=True r=219.000000
1745 006: i=2 s=List000 b=False r=102.000000
1746 006: i=2 s=List001 b=True r=120.000000
1747 006: i=2 s=List001 b=True r=122.000000
1748 006: i=20 s=List020 b=True r=220.000000
1749 006: i=4 s=List001 b=True r=130.000000
1750 006: i=5 s=List005 b=True r=130.000000
1751 ])
1752
1753 m4_define([OVSDB_CHECK_IDL_COMPOUND_INDEX_WITH_REF],
1754 [AT_SETUP([$1 - C])
1755 AT_KEYWORDS([ovsdb server idl compound_index compound_index_with_ref positive $5])
1756 AT_CHECK([ovsdb_start_idltest])
1757 m4_if([$2], [], [],
1758 [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])])
1759 AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl-compound-index-with-ref unix:socket $3],
1760 [0], [stdout], [ignore])
1761 AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]),
1762 [0], [$4])
1763 OVSDB_SERVER_SHUTDOWN
1764 AT_CLEANUP])
1765
1766 OVSDB_CHECK_IDL_COMPOUND_INDEX_WITH_REF([set, simple3 idl-compound-index-with-ref, initially populated],
1767 [],
1768 [],
1769 [[000: After add to other table + set of strong ref
1770 001: name= uset=[] uref=[[<0>]]
1771 002: check simple4: not empty
1772 003: Query using index with reference
1773 004: name= uset=[] uref=[[<0>]]
1774 005: After delete
1775 007: check simple4: empty
1776 008: End test
1777 ]])
1778
1779 m4_define([CHECK_STREAM_OPEN_BLOCK],
1780 [AT_SETUP([Check Stream open block - C - $1])
1781 AT_SKIP_IF([test "$1" = "tcp6" && test "$IS_WIN32" = "yes"])
1782 AT_SKIP_IF([test "$1" = "tcp6" && test "$HAVE_IPV6" = "no"])
1783 AT_KEYWORDS([Check Stream open block $1])
1784 AT_CHECK([ovsdb_start_idltest "ptcp:0:$2"])
1785 PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT])
1786 WRONG_PORT=$(($TCP_PORT + 101))
1787 AT_CHECK([test-stream tcp:$2:$TCP_PORT], [0], [ignore])
1788 AT_CHECK([test-stream tcp:$2:$WRONG_PORT], [1], [ignore], [ignore])
1789 OVSDB_SERVER_SHUTDOWN
1790 AT_CHECK([test-stream tcp:$2:$TCP_PORT], [1], [ignore], [ignore])
1791 AT_CLEANUP])
1792
1793 CHECK_STREAM_OPEN_BLOCK([tcp], [127.0.0.1])
1794 CHECK_STREAM_OPEN_BLOCK([tcp6], [[[::1]]])
1795
1796 m4_define([CHECK_STREAM_OPEN_BLOCK_PY],
1797 [AT_SETUP([$1 - Python3])
1798 AT_KEYWORDS([Check PY Stream open block - $3])
1799 AT_CHECK([ovsdb_start_idltest "ptcp:0:127.0.0.1"])
1800 PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT])
1801 WRONG_PORT=$(($TCP_PORT + 101))
1802 AT_CHECK([$3 $srcdir/test-stream.py tcp:127.0.0.1:$TCP_PORT], [0], [ignore])
1803 AT_CHECK([$3 $srcdir/test-stream.py tcp:127.0.0.1:$WRONG_PORT], [1], [ignore])
1804 OVSDB_SERVER_SHUTDOWN
1805 AT_CHECK([$3 $srcdir/test-stream.py tcp:127.0.0.1:$TCP_PORT], [1], [ignore])
1806 AT_CLEANUP])
1807
1808 # same as OVSDB_CHECK_IDL but uses Python IDL implementation with tcp
1809 # with multiple remotes to assert the idl connects to the leader of the Raft cluster
1810 m4_define([OVSDB_CHECK_IDL_LEADER_ONLY_PY],
1811 [AT_SETUP([$1 - Python3 (leader only)])
1812 AT_SKIP_IF([test "$IS_ARM64" = "yes"])
1813 AT_KEYWORDS([ovsdb server idl Python leader_only with tcp socket])
1814 m4_define([LPBK],[127.0.0.1])
1815 AT_CHECK([ovsdb_cluster_start_idltest $2 "ptcp:0:"LPBK])
1816 PARSE_LISTENING_PORT([s2.log], [TCP_PORT_1])
1817 PARSE_LISTENING_PORT([s3.log], [TCP_PORT_2])
1818 PARSE_LISTENING_PORT([s1.log], [TCP_PORT_3])
1819 remotes=tcp:LPBK:$TCP_PORT_1,tcp:LPBK:$TCP_PORT_2,tcp:LPBK:$TCP_PORT_3
1820 pids=$(cat s2.pid s3.pid s1.pid | tr '\n' ',')
1821 echo $pids
1822 AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py -t30 idl-cluster $srcdir/idltest.ovsschema $remotes $pids $3],
1823 [0], [stdout], [ignore])
1824 remote=$(ovsdb_cluster_leader $remotes "idltest")
1825 leader=$(echo $remote | cut -d'|' -f 1)
1826 AT_CHECK([grep -F -- "${leader}" stdout], [0], [ignore])
1827 AT_CLEANUP])
1828
1829 OVSDB_CHECK_IDL_LEADER_ONLY_PY([Check Python IDL connects to leader], 3, ['remote'])
1830 OVSDB_CHECK_IDL_LEADER_ONLY_PY([Check Python IDL reconnects to leader], 3, ['remote' '+remotestop' 'remote'])