1 AT_BANNER([OVSDB -- interface description language (IDL)])
3 m4_divert_text([PREPARE_TESTS], [
4 # ovsdb_start_idltest [REMOTE] [SCHEMA]
6 # Creates a database using SCHEMA (default: idltest.ovsschema) and
7 # starts a database server listening on punix:socket and REMOTE (if
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`'
15 # ovsdb_cluster_leader [REMOTES] [DATABASE]
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}"
32 # OVSDB_CLUSTER_START_IDLTEST([N], [REMOTE])
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],
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])
46 for i in $(seq $n); do
47 AT_CHECK([ovsdb-server -vraft -vconsole:warn --detach --no-chdir \
48 --log-file=s$i.log --pidfile=s$i.pid --unixctl=s$i \
49 --remote=punix:s$i.ovsdb \
50 m4_if([$2], [], [], [--remote=$2]) s$i.db])
52 on_exit 'kill $(cat s*.pid)'
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'])
61 # OVSDB_CHECK_IDL_C(TITLE, [PRE-IDL-TXN], TRANSACTIONS, OUTPUT, [KEYWORDS],
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.
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.
76 # TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS.
77 m4_define([OVSDB_CHECK_IDL_C],
79 AT_KEYWORDS([ovsdb server idl positive $5])
80 AT_CHECK([ovsdb_start_idltest])
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]]),
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])
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]]),
103 OVSDB_SERVER_SHUTDOWN
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])
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]]),
121 OVSDB_SERVER_SHUTDOWN
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])
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]]),
135 OVSDB_SERVER_SHUTDOWN
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])
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]]),
148 OVSDB_SERVER_SHUTDOWN
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])
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]]),
164 OVSDB_SERVER_SHUTDOWN
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
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]]),
183 OVSDB_SERVER_SHUTDOWN
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"
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]]),
202 OVSDB_SERVER_SHUTDOWN
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"
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]]),
221 OVSDB_SERVER_SHUTDOWN
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"
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 \
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])
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]]),
255 OVSDB_SERVER_SHUTDOWN
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($@)])
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])
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
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]]),
286 OVSDB_SERVER_SHUTDOWN
290 OVSDB_CHECK_IDL_PASSIVE_TCP_PY([simple passive idl, initially empty, select empty],
292 [['["idltest",{"op":"select","table":"link1","where":[]}]']],
294 001: {"error":null,"result":[{"rows":[]}]}
298 OVSDB_CHECK_IDL([simple idl, initially empty, no ops],
305 OVSDB_CHECK_IDL([simple idl, initially empty, various ops],
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"]]]}},
328 "row": {"b": true}}]' \
333 "row": {"r": 123.5}}]' \
342 "ra": ["set", [1.5]],
343 "ba": ["set", [false]],
345 "ua": ["set", []]}}]' \
349 "where": [["i", "<", 1]],
350 "row": {"s": "newstring"}}]' \
354 "where": [["i", "==", 0]]}]' \
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>
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>
383 OVSDB_CHECK_IDL([simple idl, initially populated],
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"]]]}},
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>
414 OVSDB_CHECK_IDL([simple idl, writing via IDL],
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"]]]}},
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>
445 OVSDB_CHECK_IDL([simple idl, writing via IDL with unicode],
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>
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])
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])
467 AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]),
469 OVSDB_SERVER_SHUTDOWN
472 OVSDB_CHECK_IDL_PY_WITH_EXPOUT([simple idl, writing large data via IDL with unicode],
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>
484 OVSDB_CHECK_IDL([simple idl, handling verification failure],
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' \
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>
515 OVSDB_CHECK_IDL([simple idl, increment operation],
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>
527 OVSDB_CHECK_IDL([simple idl, aborting],
532 [['set 0 r 2.0, abort' \
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>
541 OVSDB_CHECK_IDL([simple idl, destroy without commit or abort],
546 [['set 0 r 2.0, destroy' \
548 [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
550 002: commit, status=success
551 003: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
555 OVSDB_CHECK_IDL([simple idl, conditional, false condition],
562 [['condition simple []' \
563 'condition simple [true]']],
564 [[000: change conditions
566 002: change conditions
567 003: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
571 OVSDB_CHECK_IDL([simple idl, conditional, true condition],
578 [['condition simple []' \
579 'condition simple [true]']],
580 [[000: change conditions
582 002: change conditions
583 003: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
587 OVSDB_CHECK_IDL([simple idl, conditional, multiple clauses in condition],
599 [['condition simple []' \
600 'condition simple [["i","==",1],["i","==",2]]']],
601 [[000: change conditions
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>
609 OVSDB_CHECK_IDL([simple idl, conditional, modify as insert due to condition],
616 [['condition simple []' \
617 'condition simple [["i","==",1]]']],
618 [[000: change conditions
620 002: change conditions
621 003: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
625 OVSDB_CHECK_IDL([simple idl, conditional, modify as delete due to condition],
632 [['condition simple []' \
633 'condition simple [["i","==",1],["i","==",2]]' \
634 'condition simple [["i","==",2]]' \
641 [[000: change conditions
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
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>
652 OVSDB_CHECK_IDL([simple idl, conditional, multiple tables],
661 "row": {"i": 0, "k": ["named-uuid", "self"]},
662 "uuid-name": "self"},
666 "uuid-name": "row0"}]']],
667 [['condition simple [];link1 [];link2 []' \
668 'condition simple [["i","==",1]]' \
669 'condition link1 [["i","==",0]]' \
670 'condition link2 [["i","==",3]]' \
675 "uuid-name": "row0"}]']],
676 [[000: change conditions
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>
691 OVSDB_CHECK_IDL([self-linking idl, consistent ops],
696 "row": {"i": 0, "k": ["named-uuid", "self"]},
697 "uuid-name": "self"}]' \
701 "row": {"i": 1, "k": ["named-uuid", "row2"]},
702 "uuid-name": "row1"},
705 "row": {"i": 2, "k": ["named-uuid", "row1"]},
706 "uuid-name": "row2"}]' \
710 "where": [["i", "==", 1]],
711 "row": {"k": ["uuid", "#1#"]}}]' \
716 "row": {"k": ["uuid", "#0#"]}}]']],
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>
735 OVSDB_CHECK_IDL([self-linking idl, inconsistent ops],
740 "row": {"i": 0, "k": ["uuid", "cf197cc5-c8c9-42f5-82d5-c71a9f2cb96b"]}}]' \
745 "row": {"i": 1, "k": ["named-uuid", "one"]}},
748 "row": {"i": 2, "k": ["named-uuid", "one"]}}]' \
753 "row": {"k": ["uuid", "c2fca39a-e69a-42a4-9c56-5eca85839ce9"]}}]' \
757 "where": [["_uuid", "==", ["uuid", "#1#"]]]}]' \
761 "where": [["_uuid", "==", ["uuid", "#2#"]]]}]' \
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}]}
781 [[sed -e '/004:/s/row <[23]> references/row <x> references/']])
783 OVSDB_CHECK_IDL([self-linking idl, sets],
788 "row": {"i": 0, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i0"]]]},
792 "row": {"i": 1, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i1"]]]},
796 "row": {"i": 2, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i2"]]]},
800 "row": {"i": 3, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i3"]]]},
801 "uuid-name": "i3"}]' \
806 "row": {"ka": ["set", [["uuid", "#0#"], ["uuid", "#1#"], ["uuid", "#2#"], ["uuid", "#3#"]]]}}]' \
810 "where": [["i", "==", 2]],
811 "row": {"ka": ["set", [["uuid", "#0#"], ["uuid", "88702e78-845b-4a6e-ad08-cf68922ae84a"], ["uuid", "#2#"]]]}}]' \
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}]}
833 OVSDB_CHECK_IDL([external-linking idl, consistent ops],
839 "uuid-name": "row0"},
842 "row": {"i": 1, "k": ["named-uuid", "row1"], "l2": ["set", [["named-uuid", "row0"]]]},
843 "uuid-name": "row1"}]']],
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>
851 OVSDB_CHECK_IDL([singleton idl, constraints],
855 "table": "singleton",
856 "row": {"name": "foo"}}]' \
859 "table": "singleton",
860 "row": {"name": "bar"}}]' \
863 "table": "singleton",
864 "where": [["_uuid", "==", ["uuid", "#0#"]]]},
866 "table": "singleton",
867 "row": {"name": "bar"}}]']],
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>
877 OVSDB_CHECK_IDL_PY([external-linking idl, insert ops],
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>
887 OVSDB_CHECK_IDL_PY([getattr idl, insert ops],
891 001: commit, status=success
892 002: i=2 k=2 ka=[] l2= uuid=<0>
896 OVSDB_CHECK_IDL_PY([row-from-json idl, whats this],
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>
913 AT_SETUP([idl handling of missing tables and columns - C])
914 AT_KEYWORDS([ovsdb server idl positive])
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",
924 "row": {"i": 0, "k": ["named-uuid", "self"]},
925 "uuid-name": "self"}]' \
929 "row": {"i": 1, "k": ["named-uuid", "row2"]},
930 "uuid-name": "row1"},
933 "row": {"i": 2, "k": ["named-uuid", "row1"]},
934 "uuid-name": "row2"}]' \
938 "where": [["i", "==", 1]],
939 "row": {"k": ["uuid", "#1#"]}}]' \
944 "row": {"k": ["uuid", "#0#"]}}]']],
945 [0], [stdout], [stderr])
946 AT_CHECK([sort stdout | uuidfilt], [0],
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>
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 singleton table (database needs upgrade?)
971 test-ovsdb|ovsdb_idl|link1 table in idltest database lacks l2 column (database needs upgrade?)
974 # Check that ovsdb-idl sent on "monitor" request and that it didn't
975 # mention that table or column, and (for paranoia) that it did mention another
977 AT_CHECK([grep -c '"monitor\|monitor_cond"' stderr], [0], [2
979 AT_CHECK([grep '"monitor\|monitor_cond"' stderr | grep link2], [1])
980 AT_CHECK([grep '"monitor\|monitor_cond"' stderr | grep l2], [1])
981 AT_CHECK([grep '"monitor\|monitor_cond"' stderr | grep -c '"link1"'], [0], [1
983 AT_CHECK([grep '"monitor\|monitor_cond"' stderr | grep -c '"ua"'], [0], [1
985 OVSDB_SERVER_SHUTDOWN
988 m4_define([OVSDB_CHECK_IDL_FETCH_COLUMNS_PY],
989 [AT_SETUP([$1 - Python3 - fetch])
990 AT_KEYWORDS([ovsdb server idl positive Python increment fetch $6])
991 AT_CHECK([ovsdb_start_idltest])
993 [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])])
994 AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket [$3] $4],
995 [0], [stdout], [ignore])
996 AT_CHECK([sort stdout | uuidfilt]m4_if([$7],,, [[| $7]]),
998 OVSDB_SERVER_SHUTDOWN
1001 m4_define([OVSDB_CHECK_IDL_FETCH_COLUMNS],
1002 [OVSDB_CHECK_IDL_FETCH_COLUMNS_PY($@)])
1004 OVSDB_CHECK_IDL_FETCH_COLUMNS([simple idl, initially populated],
1012 "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"],
1013 "ia": ["set", [1, 2, 3]],
1014 "ra": ["set", [-0.5]],
1015 "ba": ["set", [true]],
1016 "sa": ["set", ["abc", "def"]],
1017 "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
1018 ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
1026 001: commit, status=success
1027 002: i=0 r=0 uuid=<0>
1032 m4_define([OVSDB_CHECK_IDL_WO_MONITOR_COND_PY],
1033 [AT_SETUP([$1 - Python3])
1034 AT_KEYWORDS([ovsdb server idl Python monitor $4])
1035 AT_CHECK([ovsdb_start_idltest])
1036 AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/disable-monitor-cond])
1037 AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket $2],
1038 [0], [stdout], [ignore])
1039 AT_CHECK([sort stdout | uuidfilt]m4_if([$5],,, [[| $5]]),
1041 OVSDB_SERVER_SHUTDOWN
1044 m4_define([OVSDB_CHECK_IDL_WO_MONITOR_COND],
1045 [OVSDB_CHECK_IDL_WO_MONITOR_COND_PY($@)])
1048 OVSDB_CHECK_IDL_WO_MONITOR_COND([simple idl disable monitor-cond],
1056 "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"],
1057 "ia": ["set", [1, 2, 3]],
1058 "ra": ["set", [-0.5]],
1059 "ba": ["set", [true]],
1060 "sa": ["set", ["abc", "def"]],
1061 "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
1062 ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
1070 "row": {"b": true}}]' \
1075 "row": {"r": 123.5}}]' \
1084 "ra": ["set", [1.5]],
1085 "ba": ["set", [false]],
1087 "ua": ["set", []]}}]' \
1091 "where": [["i", "<", 1]],
1092 "row": {"s": "newstring"}}]' \
1096 "where": [["i", "==", 0]]}]' \
1099 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]}
1100 002: i=0 r=0 b=false s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
1101 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>
1102 003: {"error":null,"result":[{"count":2}]}
1103 004: i=0 r=0 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
1104 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>
1105 005: {"error":null,"result":[{"count":2}]}
1106 006: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
1107 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>
1108 007: {"error":null,"result":[{"uuid":["uuid","<6>"]}]}
1109 008: i=-1 r=125 b=false s= u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
1110 008: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
1111 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>
1112 009: {"error":null,"result":[{"count":2}]}
1113 010: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
1114 010: i=0 r=123.5 b=true s=newstring u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
1115 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>
1116 011: {"error":null,"result":[{"count":1}]}
1117 012: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
1118 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 014: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
1121 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>
1125 m4_define([OVSDB_CHECK_IDL_TRACK_C],
1127 AT_KEYWORDS([ovsdb server idl tracking positive $5])
1128 AT_CHECK([ovsdb_start_idltest])
1130 [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])])
1131 AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl unix:socket $3],
1132 [0], [stdout], [ignore])
1133 AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]),
1135 OVSDB_SERVER_SHUTDOWN
1138 m4_define([OVSDB_CHECK_IDL_TRACK],
1139 [OVSDB_CHECK_IDL_TRACK_C($@)])
1141 OVSDB_CHECK_IDL_TRACK([track, simple idl, initially populated],
1149 "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"],
1150 "ia": ["set", [1, 2, 3]],
1151 "ra": ["set", [-0.5]],
1152 "ba": ["set", [true]],
1153 "sa": ["set", ["abc", "def"]],
1154 "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
1155 ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
1163 "row": {"b": true}}]']],
1164 [[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>
1165 000: updated columns: b ba i ia r ra s sa u ua
1166 001: {"error":null,"result":[{"count":2}]}
1167 002: i=0 r=0 b=true s= u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<5>
1168 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>
1169 002: updated columns: b
1173 OVSDB_CHECK_IDL_TRACK([track, simple idl, initially empty, various ops],
1182 "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"],
1183 "ia": ["set", [1, 2, 3]],
1184 "ra": ["set", [-0.5]],
1185 "ba": ["set", [true]],
1186 "sa": ["set", ["abc", "def"]],
1187 "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
1188 ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
1196 "row": {"b": true}}]' \
1201 "row": {"r": 123.5}}]' \
1210 "ra": ["set", [1.5]],
1211 "ba": ["set", [false]],
1213 "ua": ["set", []]}}]' \
1217 "where": [["i", "<", 1]],
1218 "row": {"s": "newstring"}}]' \
1222 "where": [["i", "==", 0]]}]' \
1225 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]}
1226 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>
1227 002: updated columns: b ba i ia r ra s sa u ua
1228 003: {"error":null,"result":[{"count":2}]}
1229 004: i=0 r=0 b=true s= u=<5> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
1230 004: updated columns: b
1231 005: {"error":null,"result":[{"count":2}]}
1232 006: i=0 r=123.5 b=true s= u=<5> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
1233 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>
1234 006: updated columns: r
1235 006: updated columns: r
1236 007: {"error":null,"result":[{"uuid":["uuid","<6>"]}]}
1237 008: i=-1 r=125 b=false s= u=<5> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
1238 008: updated columns: ba i ia r ra
1239 009: {"error":null,"result":[{"count":2}]}
1240 010: i=-1 r=125 b=false s=newstring u=<5> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
1241 010: i=0 r=123.5 b=true s=newstring u=<5> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
1242 010: updated columns: s
1243 010: updated columns: s
1244 011: {"error":null,"result":[{"count":1}]}
1245 012: ##deleted## uuid=<1>
1247 014: i=-1 r=125 b=false s=newstring u=<5> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
1248 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>
1249 014: updated columns: b ba i ia r ra s sa u ua
1250 014: updated columns: ba i ia r ra s
1254 m4_define([OVSDB_CHECK_IDL_PARTIAL_UPDATE_MAP_COLUMN],
1256 AT_KEYWORDS([ovsdb server idl partial update map column positive $5])
1257 AT_CHECK([ovsdb_start_idltest])
1259 [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])])
1260 AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl-partial-update-map-column unix:socket $3],
1261 [0], [stdout], [ignore])
1262 AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]),
1264 OVSDB_SERVER_SHUTDOWN
1267 OVSDB_CHECK_IDL_PARTIAL_UPDATE_MAP_COLUMN([map, simple2 idl-partial-update-map-column, initially populated],
1268 [['["idltest", {"op":"insert", "table":"simple2",
1269 "row":{"name":"myString1","smap":["map",[["key1","value1"],["key2","value2"]]]} }]']
1272 [[000: Getting records
1273 001: name=myString1 smap=[[key1 : value1],[key2 : value2]] imap=[]
1274 002: After insert element
1275 003: name=String2 smap=[[key1 : myList1],[key2 : value2]] imap=[[3 : myids2]]
1276 004: After insert duplicated element
1277 005: name=String2 smap=[[key1 : myList1],[key2 : value2]] imap=[[3 : myids2]]
1278 006: After delete element
1279 007: name=String2 smap=[[key2 : value2]] imap=[[3 : myids2]]
1280 008: After trying to delete a deleted element
1281 009: name=String2 smap=[[key2 : value2]] imap=[[3 : myids2]]
1285 OVSDB_CHECK_IDL_PY([partial-map idl],
1286 [['["idltest", {"op":"insert", "table":"simple2",
1287 "row":{"name":"myString1","smap":["map",[["key1","value1"],["key2","value2"]]]} }]']
1289 [?simple2:name,smap,imap 'partialmapinsertelement' 'partialmapinsertmultipleelements' 'partialmapdelelements' 'partialmapmutatenew'],
1290 [[000: name=myString1 smap=[(key1 value1) (key2 value2)] imap=[]
1291 001: commit, status=success
1292 002: name=String2 smap=[(key1 myList1) (key2 value2)] imap=[(3 myids2)]
1293 003: commit, status=success
1294 004: name=String2 smap=[(key1 myList1) (key2 myList2) (key3 myList3) (key4 myList4)] imap=[(3 myids2)]
1295 005: commit, status=success
1296 006: name=String2 smap=[(key2 myList2)] imap=[(3 myids2)]
1297 007: commit, status=success
1298 008: name=String2 smap=[(key2 myList2)] imap=[(3 myids2)]
1299 008: name=String2New smap=[(key1 newList1) (key2 newList2)] imap=[]
1303 OVSDB_CHECK_IDL_PY([partial-map update set refmap idl],
1304 [['["idltest", {"op":"insert", "table":"simple3", "row":{"name":"myString1"}},
1305 {"op":"insert", "table":"simple5", "row":{"name":"myString2"}}]']],
1306 ['partialmapmutateirefmap'],
1307 [[000: name=myString1 uset=[]
1308 000: name=myString2 irefmap=[]
1309 001: commit, status=success
1310 002: name=myString1 uset=[]
1311 002: name=myString2 irefmap=[(1 <0>)]
1315 m4_define([OVSDB_CHECK_IDL_PARTIAL_UPDATE_SET_COLUMN],
1317 AT_KEYWORDS([ovsdb server idl partial update set column positive $5])
1318 AT_CHECK([ovsdb_start_idltest])
1320 [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])])
1321 AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl-partial-update-set-column unix:socket $3],
1322 [0], [stdout], [ignore])
1323 AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]),
1325 OVSDB_SERVER_SHUTDOWN
1328 OVSDB_CHECK_IDL_PARTIAL_UPDATE_SET_COLUMN([set, simple3 idl-partial-update-set-column, initially populated],
1329 [['["idltest", {"op":"insert", "table":"simple3",
1330 "row":{"name":"mySet1","uset":["set", [[ "uuid", "0005b872-f9e5-43be-ae02-3184b9680e75" ], [ "uuid", "000d2f6a-76af-412f-b59d-e7bcd3e84eff" ]]]} }]']
1333 [[000: Getting records
1334 001: name=mySet1 uset=[[<0>],[<1>]] uref=[]
1335 002: After rename+add new value
1336 003: name=String2 uset=[[<0>],[<1>],[<2>]] uref=[]
1337 004: After add new value
1338 005: name=String2 uset=[[<0>],[<1>],[<2>],[<3>]] uref=[]
1339 006: After delete value
1340 007: name=String2 uset=[[<0>],[<1>],[<3>]] uref=[]
1341 008: After trying to delete a deleted value
1342 009: name=String2 uset=[[<0>],[<1>],[<3>]] uref=[]
1343 010: After add to other table + set of strong ref
1344 011: name=String2 uset=[[<0>],[<1>],[<3>]] uref=[[<4>]]
1348 OVSDB_CHECK_IDL_PY([partial-set idl],
1349 [['["idltest", {"op":"insert", "table":"simple3", "uuid-name":"newrow",
1350 "row":{"name":"mySet1","uset":["set", [[ "uuid", "0005b872-f9e5-43be-ae02-3184b9680e75" ]]]} },
1351 {"op":"insert", "table":"simple4", "row":{"name":"seed"}},
1352 {"op":"mutate", "table":"simple3", "where":[["_uuid", "==", ["named-uuid", "newrow"]]],
1353 "mutations": [["uset", "insert", ["set", [["uuid", "000d2f6a-76af-412f-b59d-e7bcd3e84eff"]]]]]}]']
1355 ['partialrenamesetadd' 'partialduplicateadd' 'partialsetdel' 'partialsetref' 'partialsetoverrideops' 'partialsetadddelete' 'partialsetmutatenew'],
1356 [[000: name=mySet1 uset=[<0> <1>]
1357 001: commit, status=success
1358 002: name=String2 uset=[<0> <1> <2>]
1359 003: commit, status=success
1360 004: name=String2 uset=[<0> <1> <2> <3>]
1361 005: commit, status=success
1362 006: name=String2 uset=[<0> <1> <3>]
1363 007: commit, status=success
1364 008: name=String2 uset=[<0> <1> <3>]
1365 009: commit, status=success
1366 010: name=String2 uset=[<3>]
1367 011: commit, status=success
1368 012: name=String2 uset=[<4> <5>]
1369 013: commit, status=success
1370 014: name=String2 uset=[<4> <5>]
1371 014: name=String3 uset=[<6>]
1375 m4_define([OVSDB_CHECK_IDL_NOTIFY],
1376 [OVSDB_CHECK_IDL_PY([$1], [], [$2], [$3], [notify $4], [$5])
1377 OVSDB_CHECK_IDL_SSL_PY([$1], [], [$2], [$3], [notify $4], [$5])])
1379 OVSDB_CHECK_IDL_NOTIFY([simple idl verify notify],
1388 "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"],
1389 "ia": ["set", [1, 2, 3]],
1390 "ra": ["set", [-0.5]],
1391 "ba": ["set", [true]],
1392 "sa": ["set", ["abc", "def"]],
1393 "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
1394 ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
1402 "row": {"b": false}}]' \
1407 "row": {"r": 123.5}}]' \
1416 "ra": ["set", [1.5]],
1417 "ba": ["set", [false]],
1419 "ua": ["set", []]}}]' \
1423 "where": [["i", "<", 1]],
1424 "row": {"s": "newstring"}}]' \
1428 "where": [["i", "==", 0]]}]' \
1431 000: event:create, row={uuid=<0>}, updates=None
1432 000: event:create, row={uuid=<1>}, updates=None
1433 001: {"error":null,"result":[{"uuid":["uuid","<2>"]},{"uuid":["uuid","<3>"]}]}
1434 002: event:create, row={i=0 r=0 b=false s= u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3>}, updates=None
1435 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
1436 002: i=0 r=0 b=false s= u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3>
1437 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>
1438 003: {"error":null,"result":[{"count":2}]}
1439 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>}
1440 004: i=0 r=0 b=false s= u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3>
1441 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>
1442 005: {"error":null,"result":[{"count":2}]}
1443 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>}
1444 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>}
1445 006: i=0 r=123.5 b=false s= u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3>
1446 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>
1447 007: {"error":null,"result":[{"uuid":["uuid","<8>"]}]}
1448 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
1449 008: i=-1 r=125 b=false s= u=<4> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<8>
1450 008: i=0 r=123.5 b=false s= u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3>
1451 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>
1452 009: {"error":null,"result":[{"count":2}]}
1453 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>}
1454 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>}
1455 010: i=-1 r=125 b=false s=newstring u=<4> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<8>
1456 010: i=0 r=123.5 b=false s=newstring u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3>
1457 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>
1458 011: {"error":null,"result":[{"count":1}]}
1459 012: event:delete, row={i=0 r=123.5 b=false s=newstring u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3>}, updates=None
1460 012: i=-1 r=125 b=false s=newstring u=<4> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<8>
1461 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>
1463 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
1464 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
1465 014: event:create, row={uuid=<0>}, updates=None
1466 014: event:create, row={uuid=<1>}, updates=None
1467 014: i=-1 r=125 b=false s=newstring u=<4> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<8>
1468 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>
1472 # Tests to verify the functionality of the one column compound index.
1473 # It tests index for one column string and integer indexes.
1474 # The run of test-ovsdb generates the output of the display of data using the different indexes defined in
1476 # Then, some at_checks are used to verify the correctness of the corresponding index as well as the existence
1477 # of all the rows involved in the test.
1478 m4_define([OVSDB_CHECK_IDL_COMPOUND_INDEX_SINGLE_COLUMN_C],
1480 AT_KEYWORDS([ovsdb server idl compound_index_single_column compound_index positive $5])
1481 AT_CHECK([ovsdb_start_idltest])
1483 [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])])
1484 # Generate the data to be tested.
1485 AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl-compound-index unix:socket $3],
1486 [0], [stdout], [ignore])
1487 # Filter the rows of data that corresponds to the string index eliminating the extra columns of data.
1488 # This is done to verifiy that the output data is in the correct and expected order.
1489 AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: s=.*' | sed -e 's/ i=.*//g']],
1491 # Here, the data is filtered and sorted in order to have all the rows in the index and be
1492 # able to determined that all the involved rows are present.
1493 AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: s=.*' | sort -k 1,1n -k 2,2 -k 3,3]],
1495 # Filter the rows of data that corresponds to the integer index eliminating the extra columns of data.
1496 # This is done to verifiy that the output data is in the correct and expected order.
1497 AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: i=.*' | sed -e 's/ s=.*//g']],
1499 # Here again, the data is filtered and sorted in order to have all the rows in the index and be
1500 # able to determined that all the involved rows are present.
1501 AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: i=.*' | sort -k 1,1n -k 2,2 -k 3,3]],
1503 OVSDB_SERVER_SHUTDOWN
1506 OVSDB_CHECK_IDL_COMPOUND_INDEX_SINGLE_COLUMN_C([Compound_index, single column test ],
1508 {"op": "insert", "table": "simple", "row": {"s":"List000", "i": 1, "b":true, "r":101.0}},
1509 {"op": "insert", "table": "simple", "row": {"s":"List000", "i": 2, "b":false, "r":102.0}},
1510 {"op": "insert", "table": "simple", "row": {"s":"List000", "i": 10, "b":true, "r":110.0}},
1511 {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 1, "b":false, "r":110.0}},
1512 {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 2, "b":true, "r":120.0}},
1513 {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 2, "b":true, "r":122.0}},
1514 {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 4, "b":true, "r":130.0}},
1515 {"op": "insert", "table": "simple", "row": {"s":"List005", "i": 5, "b":true, "r":130.0}},
1516 {"op": "insert", "table": "simple", "row": {"s":"List020", "i": 20, "b":true, "r":220.0}},
1517 {"op": "insert", "table": "simple", "row": {"s":"List020", "i": 19, "b":true, "r":219.0}}
1519 [idl_compound_index_single_column],
1535 [001: s=List000 i=1 b=True r=101.000000
1536 001: s=List000 i=10 b=True r=110.000000
1537 001: s=List000 i=2 b=False r=102.000000
1538 001: s=List001 i=1 b=False r=110.000000
1539 001: s=List001 i=2 b=True r=120.000000
1540 001: s=List001 i=2 b=True r=122.000000
1541 001: s=List001 i=4 b=True r=130.000000
1542 001: s=List005 i=5 b=True r=130.000000
1543 001: s=List020 i=19 b=True r=219.000000
1544 001: s=List020 i=20 b=True r=220.000000
1545 003: s=List001 i=1 b=False r=110.000000
1546 003: s=List001 i=2 b=True r=120.000000
1547 003: s=List001 i=2 b=True r=122.000000
1548 003: s=List001 i=4 b=True r=130.000000
1584 [002: i=1 s=List000 b=True r=101.000000
1585 002: i=1 s=List001 b=False r=110.000000
1586 002: i=10 s=List000 b=True r=110.000000
1587 002: i=19 s=List020 b=True r=219.000000
1588 002: i=2 s=List000 b=False r=102.000000
1589 002: i=2 s=List001 b=True r=120.000000
1590 002: i=2 s=List001 b=True r=122.000000
1591 002: i=20 s=List020 b=True r=220.000000
1592 002: i=4 s=List001 b=True r=130.000000
1593 002: i=5 s=List005 b=True r=130.000000
1594 004: i=5 s=List005 b=True r=130.000000
1595 005: i=4 s=List001 b=True r=130.000000
1596 005: i=5 s=List005 b=True r=130.000000
1597 006: i=10 s=List000 b=True r=110.000000
1598 006: i=19 s=List020 b=True r=219.000000
1599 006: i=20 s=List020 b=True r=220.000000
1600 006: i=5 s=List005 b=True r=130.000000
1601 006: i=54 s=Lista054 b=False r=0.000000
1602 007: i=19 s=List020 b=True r=219.000000
1603 007: i=20 s=List020 b=True r=220.000000
1604 007: i=30 s=List000 b=True r=110.000000
1605 007: i=5 s=List005 b=True r=130.000000
1606 007: i=54 s=Lista054 b=False r=0.000000
1607 008: i=1 s=List000 b=True r=101.000000
1608 008: i=1 s=List001 b=False r=110.000000
1609 008: i=19 s=List020 b=True r=219.000000
1610 008: i=2 s=List000 b=False r=102.000000
1611 008: i=2 s=List001 b=True r=120.000000
1612 008: i=2 s=List001 b=True r=122.000000
1613 008: i=20 s=List020 b=True r=220.000000
1614 008: i=30 s=List000 b=True r=110.000000
1615 008: i=5 s=List005 b=True r=130.000000
1616 008: i=54 s=Lista054 b=False r=0.000000
1619 # Tests to verify the functionality of two column compound index.
1620 # It tests index for two columns using string and integer fields.
1621 # The run of test-ovsdb generates the output of the display of data using the different indexes defined in
1623 # Then, some at_checks are used to verify the correctness of the corresponding index as well as the existence
1624 # of all the rows involved in the test.
1625 m4_define([OVSDB_CHECK_IDL_COMPOUND_INDEX_DOUBLE_COLUMN_C],
1627 AT_KEYWORDS([ovsdb server idl compound_index_double_column compound_index positive $5])
1628 AT_CHECK([ovsdb_start_idltest])
1630 [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])])
1631 # Generate the data to be tested.
1632 AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl-compound-index unix:socket $3],
1633 [0], [stdout], [ignore])
1634 # Filter the rows of data that corresponds to the string-integer index eliminating the extra columns of data.
1635 # This is done to verifiy that the output data is in the correct and expected order.
1636 AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: s=.*' | sed -e 's/ b=.*//g']],
1638 # Here, the data is filtered and sorted in order to have all the rows in the index and be
1639 # able to determined that all the involved rows are present.
1640 AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: s=.*' | sort -k 1,1n -k 2,2 -k 3,3]],
1642 # Filter the rows of data that corresponds to the integer index eliminating the extra columns of data.
1643 # This is done to verifiy that the output data is in the correct and expected order.
1644 AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: i=.*' | sed -e 's/ b=.*//g']],
1646 # Here again, the data is filtered and sorted in order to have all the rows in the index and be
1647 # able to determined that all the involved rows are present.
1648 AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: i=.*' | sort -k 1,1n -k 2,2 -k 3,3]],
1650 OVSDB_SERVER_SHUTDOWN
1653 OVSDB_CHECK_IDL_COMPOUND_INDEX_DOUBLE_COLUMN_C([Compound_index, double column test ],
1655 {"op": "insert", "table": "simple", "row": {"s":"List000", "i": 1, "b":true, "r":101.0}},
1656 {"op": "insert", "table": "simple", "row": {"s":"List000", "i": 2, "b":false, "r":102.0}},
1657 {"op": "insert", "table": "simple", "row": {"s":"List000", "i": 10, "b":true, "r":110.0}},
1658 {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 1, "b":false, "r":110.0}},
1659 {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 2, "b":true, "r":120.0}},
1660 {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 2, "b":true, "r":122.0}},
1661 {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 4, "b":true, "r":130.0}},
1662 {"op": "insert", "table": "simple", "row": {"s":"List005", "i": 5, "b":true, "r":130.0}},
1663 {"op": "insert", "table": "simple", "row": {"s":"List020", "i": 20, "b":true, "r":220.0}},
1664 {"op": "insert", "table": "simple", "row": {"s":"List020", "i": 19, "b":true, "r":219.0}}
1666 [idl_compound_index_double_column],
1694 [001: s=List000 i=1 b=True r=101.000000
1695 001: s=List000 i=10 b=True r=110.000000
1696 001: s=List000 i=2 b=False r=102.000000
1697 001: s=List001 i=1 b=False r=110.000000
1698 001: s=List001 i=2 b=True r=120.000000
1699 001: s=List001 i=2 b=True r=122.000000
1700 001: s=List001 i=4 b=True r=130.000000
1701 001: s=List005 i=5 b=True r=130.000000
1702 001: s=List020 i=19 b=True r=219.000000
1703 001: s=List020 i=20 b=True r=220.000000
1704 002: s=List000 i=1 b=True r=101.000000
1705 002: s=List000 i=10 b=True r=110.000000
1706 002: s=List000 i=2 b=False r=102.000000
1707 002: s=List001 i=1 b=False r=110.000000
1708 002: s=List001 i=2 b=True r=120.000000
1709 002: s=List001 i=2 b=True r=122.000000
1710 002: s=List001 i=4 b=True r=130.000000
1711 002: s=List005 i=5 b=True r=130.000000
1712 002: s=List020 i=19 b=True r=219.000000
1713 002: s=List020 i=20 b=True r=220.000000
1714 003: s=List000 i=10 b=True r=110.000000
1715 004: s=List001 i=1 b=False r=110.000000
1716 004: s=List001 i=2 b=True r=120.000000
1717 004: s=List001 i=2 b=True r=122.000000
1718 004: s=List001 i=4 b=True r=130.000000
1719 004: s=List005 i=5 b=True r=130.000000
1742 [005: i=1 s=List000 b=True r=101.000000
1743 005: i=1 s=List001 b=False r=110.000000
1744 005: i=10 s=List000 b=True r=110.000000
1745 005: i=19 s=List020 b=True r=219.000000
1746 005: i=2 s=List000 b=False r=102.000000
1747 005: i=2 s=List001 b=True r=120.000000
1748 005: i=2 s=List001 b=True r=122.000000
1749 005: i=20 s=List020 b=True r=220.000000
1750 005: i=4 s=List001 b=True r=130.000000
1751 005: i=5 s=List005 b=True r=130.000000
1752 006: i=1 s=List000 b=True r=101.000000
1753 006: i=1 s=List001 b=False r=110.000000
1754 006: i=10 s=List000 b=True r=110.000000
1755 006: i=19 s=List020 b=True r=219.000000
1756 006: i=2 s=List000 b=False r=102.000000
1757 006: i=2 s=List001 b=True r=120.000000
1758 006: i=2 s=List001 b=True r=122.000000
1759 006: i=20 s=List020 b=True r=220.000000
1760 006: i=4 s=List001 b=True r=130.000000
1761 006: i=5 s=List005 b=True r=130.000000
1764 m4_define([OVSDB_CHECK_IDL_COMPOUND_INDEX_WITH_REF],
1766 AT_KEYWORDS([ovsdb server idl compound_index compound_index_with_ref positive $5])
1767 AT_CHECK([ovsdb_start_idltest])
1769 [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])])
1770 AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl-compound-index-with-ref unix:socket $3],
1771 [0], [stdout], [ignore])
1772 AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]),
1774 OVSDB_SERVER_SHUTDOWN
1777 OVSDB_CHECK_IDL_COMPOUND_INDEX_WITH_REF([set, simple3 idl-compound-index-with-ref, initially populated],
1780 [[000: After add to other table + set of strong ref
1781 001: name= uset=[] uref=[[<0>]]
1782 002: check simple4: not empty
1783 003: Query using index with reference
1784 004: name= uset=[] uref=[[<0>]]
1786 007: check simple4: empty
1790 m4_define([CHECK_STREAM_OPEN_BLOCK],
1791 [AT_SETUP([Check Stream open block - C - $1])
1792 AT_SKIP_IF([test "$1" = "tcp6" && test "$IS_WIN32" = "yes"])
1793 AT_SKIP_IF([test "$1" = "tcp6" && test "$HAVE_IPV6" = "no"])
1794 AT_KEYWORDS([Check Stream open block $1])
1795 AT_CHECK([ovsdb_start_idltest "ptcp:0:$2"])
1796 PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT])
1797 WRONG_PORT=$(($TCP_PORT + 101))
1798 AT_CHECK([test-stream tcp:$2:$TCP_PORT], [0], [ignore])
1799 AT_CHECK([test-stream tcp:$2:$WRONG_PORT], [1], [ignore], [ignore])
1800 OVSDB_SERVER_SHUTDOWN
1801 AT_CHECK([test-stream tcp:$2:$TCP_PORT], [1], [ignore], [ignore])
1804 CHECK_STREAM_OPEN_BLOCK([tcp], [127.0.0.1])
1805 CHECK_STREAM_OPEN_BLOCK([tcp6], [[[::1]]])
1807 m4_define([CHECK_STREAM_OPEN_BLOCK_PY],
1808 [AT_SETUP([$1 - Python3])
1809 AT_KEYWORDS([Check PY Stream open block - $3])
1810 AT_CHECK([ovsdb_start_idltest "ptcp:0:127.0.0.1"])
1811 PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT])
1812 WRONG_PORT=$(($TCP_PORT + 101))
1813 AT_CHECK([$3 $srcdir/test-stream.py tcp:127.0.0.1:$TCP_PORT], [0], [ignore])
1814 AT_CHECK([$3 $srcdir/test-stream.py tcp:127.0.0.1:$WRONG_PORT], [1], [ignore])
1815 OVSDB_SERVER_SHUTDOWN
1816 AT_CHECK([$3 $srcdir/test-stream.py tcp:127.0.0.1:$TCP_PORT], [1], [ignore])
1819 # same as OVSDB_CHECK_IDL but uses Python IDL implementation with tcp
1820 # with multiple remotes to assert the idl connects to the leader of the Raft cluster
1821 m4_define([OVSDB_CHECK_IDL_LEADER_ONLY_PY],
1822 [AT_SETUP([$1 - Python3 (leader only)])
1823 AT_SKIP_IF([test "$IS_ARM64" = "yes"])
1824 AT_KEYWORDS([ovsdb server idl Python leader_only with tcp socket])
1825 m4_define([LPBK],[127.0.0.1])
1826 OVSDB_CLUSTER_START_IDLTEST([$2], ["ptcp:0:"LPBK])
1827 PARSE_LISTENING_PORT([s2.log], [TCP_PORT_1])
1828 PARSE_LISTENING_PORT([s3.log], [TCP_PORT_2])
1829 PARSE_LISTENING_PORT([s1.log], [TCP_PORT_3])
1830 remotes=tcp:LPBK:$TCP_PORT_1,tcp:LPBK:$TCP_PORT_2,tcp:LPBK:$TCP_PORT_3
1831 pids=$(cat s2.pid s3.pid s1.pid | tr '\n' ',')
1833 AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py -t30 idl-cluster $srcdir/idltest.ovsschema $remotes $pids $3],
1834 [0], [stdout], [ignore])
1835 remote=$(ovsdb_cluster_leader $remotes "idltest")
1836 leader=$(echo $remote | cut -d'|' -f 1)
1837 AT_CHECK([grep -F -- "${leader}" stdout], [0], [ignore])
1840 OVSDB_CHECK_IDL_LEADER_ONLY_PY([Check Python IDL connects to leader], 3, ['remote'])
1841 OVSDB_CHECK_IDL_LEADER_ONLY_PY([Check Python IDL reconnects to leader], 3, ['remote' '+remotestop' 'remote'])
1843 # same as OVSDB_CHECK_IDL but uses C IDL implementation with tcp
1844 # with multiple remotes.
1845 m4_define([OVSDB_CHECK_CLUSTER_IDL_C],
1846 [AT_SETUP([$1 - C - tcp])
1847 AT_KEYWORDS([ovsdb server idl positive tcp socket $5])
1848 m4_define([LPBK],[127.0.0.1])
1849 OVSDB_CLUSTER_START_IDLTEST([$2], ["ptcp:0:"LPBK])
1850 PARSE_LISTENING_PORT([s1.log], [TCP_PORT_1])
1851 PARSE_LISTENING_PORT([s2.log], [TCP_PORT_2])
1852 PARSE_LISTENING_PORT([s3.log], [TCP_PORT_3])
1853 remotes=tcp:LPBK:$TCP_PORT_1,tcp:LPBK:$TCP_PORT_2,tcp:LPBK:$TCP_PORT_3
1856 [AT_CHECK([ovsdb-client transact $remotes $3], [0], [ignore], [ignore])])
1857 AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 idl tcp:LPBK:$TCP_PORT_1 $4],
1858 [0], [stdout], [ignore])
1859 AT_CHECK([sort stdout | uuidfilt]m4_if([$7],,, [[| $7]]),
1863 # Checks that monitor_cond_since works fine when disconnects happen
1864 # with cond_change requests in flight (i.e., IDL is properly updated).
1865 OVSDB_CHECK_CLUSTER_IDL_C([simple idl, monitor_cond_since, cluster disconnect],
1878 [['condition simple []' \
1879 'condition simple [["i","==",2]]' \
1880 'condition simple [["i","==",1]]' \
1885 "where": [["i", "==", 1]],
1886 "row": {"r": 2.0 }}]']],
1887 [[000: change conditions
1889 002: change conditions
1890 003: i=2 r=1 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
1891 004: change conditions
1893 006: i=2 r=1 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
1894 007: {"error":null,"result":[{"count":1}]}
1895 008: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2>