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_start_idltest [REMOTE] [SCHEMA]
17 # Creates a database using SCHEMA (default: idltest.ovsschema) and
18 # starts a database cluster listening on punix:socket and REMOTE (if
20 ovsdb_cluster_start_idltest () {
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 $?
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 $?
31 on_exit 'kill `cat s*.pid`'
34 # ovsdb_cluster_leader [REMOTES] [DATABASE]
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}"
51 # OVSDB_CHECK_IDL_C(TITLE, [PRE-IDL-TXN], TRANSACTIONS, OUTPUT, [KEYWORDS],
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.
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.
66 # TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS.
67 m4_define([OVSDB_CHECK_IDL_C],
69 AT_KEYWORDS([ovsdb server idl positive $5])
70 AT_CHECK([ovsdb_start_idltest])
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]]),
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])
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]]),
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])
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]]),
111 OVSDB_SERVER_SHUTDOWN
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])
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]]),
125 OVSDB_SERVER_SHUTDOWN
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])
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]]),
138 OVSDB_SERVER_SHUTDOWN
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])
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]]),
154 OVSDB_SERVER_SHUTDOWN
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
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]]),
173 OVSDB_SERVER_SHUTDOWN
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"
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]]),
192 OVSDB_SERVER_SHUTDOWN
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"
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]]),
211 OVSDB_SERVER_SHUTDOWN
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"
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 \
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])
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]]),
245 OVSDB_SERVER_SHUTDOWN
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($@)])
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])
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
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]]),
276 OVSDB_SERVER_SHUTDOWN
280 OVSDB_CHECK_IDL_PASSIVE_TCP_PY([simple passive idl, initially empty, select empty],
282 [['["idltest",{"op":"select","table":"link1","where":[]}]']],
284 001: {"error":null,"result":[{"rows":[]}]}
288 OVSDB_CHECK_IDL([simple idl, initially empty, no ops],
295 OVSDB_CHECK_IDL([simple idl, initially empty, various ops],
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"]]]}},
318 "row": {"b": true}}]' \
323 "row": {"r": 123.5}}]' \
332 "ra": ["set", [1.5]],
333 "ba": ["set", [false]],
335 "ua": ["set", []]}}]' \
339 "where": [["i", "<", 1]],
340 "row": {"s": "newstring"}}]' \
344 "where": [["i", "==", 0]]}]' \
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>
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>
373 OVSDB_CHECK_IDL([simple idl, initially populated],
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"]]]}},
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>
404 OVSDB_CHECK_IDL([simple idl, writing via IDL],
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"]]]}},
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>
435 OVSDB_CHECK_IDL([simple idl, writing via IDL with unicode],
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>
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])
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])
457 AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]),
459 OVSDB_SERVER_SHUTDOWN
462 OVSDB_CHECK_IDL_PY_WITH_EXPOUT([simple idl, writing large data via IDL with unicode],
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>
474 OVSDB_CHECK_IDL([simple idl, handling verification failure],
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' \
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>
505 OVSDB_CHECK_IDL([simple idl, increment operation],
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>
517 OVSDB_CHECK_IDL([simple idl, aborting],
522 [['set 0 r 2.0, abort' \
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>
531 OVSDB_CHECK_IDL([simple idl, destroy without commit or abort],
536 [['set 0 r 2.0, destroy' \
538 [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
540 002: commit, status=success
541 003: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
545 OVSDB_CHECK_IDL([simple idl, conditional, false condition],
552 [['condition simple []' \
553 'condition simple [true]']],
554 [[000: change conditions
556 002: change conditions
557 003: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
561 OVSDB_CHECK_IDL([simple idl, conditional, true condition],
568 [['condition simple []' \
569 'condition simple [true]']],
570 [[000: change conditions
572 002: change conditions
573 003: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
577 OVSDB_CHECK_IDL([simple idl, conditional, multiple clauses in condition],
589 [['condition simple []' \
590 'condition simple [["i","==",1],["i","==",2]]']],
591 [[000: change conditions
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>
599 OVSDB_CHECK_IDL([simple idl, conditional, modify as insert due to condition],
606 [['condition simple []' \
607 'condition simple [["i","==",1]]']],
608 [[000: change conditions
610 002: change conditions
611 003: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
615 OVSDB_CHECK_IDL([simple idl, conditional, modify as delete due to condition],
622 [['condition simple []' \
623 'condition simple [["i","==",1],["i","==",2]]' \
624 'condition simple [["i","==",2]]' \
631 [[000: change conditions
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
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>
642 OVSDB_CHECK_IDL([simple idl, conditional, multiple tables],
651 "row": {"i": 0, "k": ["named-uuid", "self"]},
652 "uuid-name": "self"},
656 "uuid-name": "row0"}]']],
657 [['condition simple [];link1 [];link2 []' \
658 'condition simple [["i","==",1]]' \
659 'condition link1 [["i","==",0]]' \
660 'condition link2 [["i","==",3]]' \
665 "uuid-name": "row0"}]']],
666 [[000: change conditions
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>
681 OVSDB_CHECK_IDL([self-linking idl, consistent ops],
686 "row": {"i": 0, "k": ["named-uuid", "self"]},
687 "uuid-name": "self"}]' \
691 "row": {"i": 1, "k": ["named-uuid", "row2"]},
692 "uuid-name": "row1"},
695 "row": {"i": 2, "k": ["named-uuid", "row1"]},
696 "uuid-name": "row2"}]' \
700 "where": [["i", "==", 1]],
701 "row": {"k": ["uuid", "#1#"]}}]' \
706 "row": {"k": ["uuid", "#0#"]}}]']],
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>
725 OVSDB_CHECK_IDL([self-linking idl, inconsistent ops],
730 "row": {"i": 0, "k": ["uuid", "cf197cc5-c8c9-42f5-82d5-c71a9f2cb96b"]}}]' \
735 "row": {"i": 1, "k": ["named-uuid", "one"]}},
738 "row": {"i": 2, "k": ["named-uuid", "one"]}}]' \
743 "row": {"k": ["uuid", "c2fca39a-e69a-42a4-9c56-5eca85839ce9"]}}]' \
747 "where": [["_uuid", "==", ["uuid", "#1#"]]]}]' \
751 "where": [["_uuid", "==", ["uuid", "#2#"]]]}]' \
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}]}
771 [[sed -e '/004:/s/row <[23]> references/row <x> references/']])
773 OVSDB_CHECK_IDL([self-linking idl, sets],
778 "row": {"i": 0, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i0"]]]},
782 "row": {"i": 1, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i1"]]]},
786 "row": {"i": 2, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i2"]]]},
790 "row": {"i": 3, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i3"]]]},
791 "uuid-name": "i3"}]' \
796 "row": {"ka": ["set", [["uuid", "#0#"], ["uuid", "#1#"], ["uuid", "#2#"], ["uuid", "#3#"]]]}}]' \
800 "where": [["i", "==", 2]],
801 "row": {"ka": ["set", [["uuid", "#0#"], ["uuid", "88702e78-845b-4a6e-ad08-cf68922ae84a"], ["uuid", "#2#"]]]}}]' \
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}]}
823 OVSDB_CHECK_IDL([external-linking idl, consistent ops],
829 "uuid-name": "row0"},
832 "row": {"i": 1, "k": ["named-uuid", "row1"], "l2": ["set", [["named-uuid", "row0"]]]},
833 "uuid-name": "row1"}]']],
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>
841 OVSDB_CHECK_IDL([singleton idl, constraints],
845 "table": "singleton",
846 "row": {"name": "foo"}}]' \
849 "table": "singleton",
850 "row": {"name": "bar"}}]' \
853 "table": "singleton",
854 "where": [["_uuid", "==", ["uuid", "#0#"]]]},
856 "table": "singleton",
857 "row": {"name": "bar"}}]']],
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>
867 OVSDB_CHECK_IDL_PY([external-linking idl, insert ops],
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>
877 OVSDB_CHECK_IDL_PY([getattr idl, insert ops],
881 001: commit, status=success
882 002: i=2 k=2 ka=[] l2= uuid=<0>
886 OVSDB_CHECK_IDL_PY([row-from-json idl, whats this],
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>
903 AT_SETUP([idl handling of missing tables and columns - C])
904 AT_KEYWORDS([ovsdb server idl positive])
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",
914 "row": {"i": 0, "k": ["named-uuid", "self"]},
915 "uuid-name": "self"}]' \
919 "row": {"i": 1, "k": ["named-uuid", "row2"]},
920 "uuid-name": "row1"},
923 "row": {"i": 2, "k": ["named-uuid", "row1"]},
924 "uuid-name": "row2"}]' \
928 "where": [["i", "==", 1]],
929 "row": {"k": ["uuid", "#1#"]}}]' \
934 "row": {"k": ["uuid", "#0#"]}}]']],
935 [0], [stdout], [stderr])
936 AT_CHECK([sort stdout | uuidfilt], [0],
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>
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?)
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
966 AT_CHECK([grep -c '"monitor\|monitor_cond"' stderr], [0], [2
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
972 AT_CHECK([grep '"monitor\|monitor_cond"' stderr | grep -c '"ua"'], [0], [1
974 OVSDB_SERVER_SHUTDOWN
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])
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]]),
987 OVSDB_SERVER_SHUTDOWN
990 m4_define([OVSDB_CHECK_IDL_FETCH_COLUMNS],
991 [OVSDB_CHECK_IDL_FETCH_COLUMNS_PY($@)])
993 OVSDB_CHECK_IDL_FETCH_COLUMNS([simple idl, initially populated],
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"]]]}},
1015 001: commit, status=success
1016 002: i=0 r=0 uuid=<0>
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]]),
1030 OVSDB_SERVER_SHUTDOWN
1033 m4_define([OVSDB_CHECK_IDL_WO_MONITOR_COND],
1034 [OVSDB_CHECK_IDL_WO_MONITOR_COND_PY($@)])
1037 OVSDB_CHECK_IDL_WO_MONITOR_COND([simple idl disable monitor-cond],
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"]]]}},
1059 "row": {"b": true}}]' \
1064 "row": {"r": 123.5}}]' \
1073 "ra": ["set", [1.5]],
1074 "ba": ["set", [false]],
1076 "ua": ["set", []]}}]' \
1080 "where": [["i", "<", 1]],
1081 "row": {"s": "newstring"}}]' \
1085 "where": [["i", "==", 0]]}]' \
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>
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>
1114 m4_define([OVSDB_CHECK_IDL_TRACK_C],
1116 AT_KEYWORDS([ovsdb server idl tracking positive $5])
1117 AT_CHECK([ovsdb_start_idltest])
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]]),
1124 OVSDB_SERVER_SHUTDOWN
1127 m4_define([OVSDB_CHECK_IDL_TRACK],
1128 [OVSDB_CHECK_IDL_TRACK_C($@)])
1130 OVSDB_CHECK_IDL_TRACK([track, simple idl, initially populated],
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"]]]}},
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
1162 OVSDB_CHECK_IDL_TRACK([track, simple idl, initially empty, various ops],
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"]]]}},
1185 "row": {"b": true}}]' \
1190 "row": {"r": 123.5}}]' \
1199 "ra": ["set", [1.5]],
1200 "ba": ["set", [false]],
1202 "ua": ["set", []]}}]' \
1206 "where": [["i", "<", 1]],
1207 "row": {"s": "newstring"}}]' \
1211 "where": [["i", "==", 0]]}]' \
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>
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
1243 m4_define([OVSDB_CHECK_IDL_PARTIAL_UPDATE_MAP_COLUMN],
1245 AT_KEYWORDS([ovsdb server idl partial update map column positive $5])
1246 AT_CHECK([ovsdb_start_idltest])
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]]),
1253 OVSDB_SERVER_SHUTDOWN
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"]]]} }]']
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]]
1274 OVSDB_CHECK_IDL_PY([partial-map idl],
1275 [['["idltest", {"op":"insert", "table":"simple2",
1276 "row":{"name":"myString1","smap":["map",[["key1","value1"],["key2","value2"]]]} }]']
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=[]
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>)]
1304 m4_define([OVSDB_CHECK_IDL_PARTIAL_UPDATE_SET_COLUMN],
1306 AT_KEYWORDS([ovsdb server idl partial update set column positive $5])
1307 AT_CHECK([ovsdb_start_idltest])
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]]),
1314 OVSDB_SERVER_SHUTDOWN
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" ]]]} }]']
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>]]
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"]]]]]}]']
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>]
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])])
1368 OVSDB_CHECK_IDL_NOTIFY([simple idl verify notify],
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"]]]}},
1391 "row": {"b": false}}]' \
1396 "row": {"r": 123.5}}]' \
1405 "ra": ["set", [1.5]],
1406 "ba": ["set", [false]],
1408 "ua": ["set", []]}}]' \
1412 "where": [["i", "<", 1]],
1413 "row": {"s": "newstring"}}]' \
1417 "where": [["i", "==", 0]]}]' \
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>
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>
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
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],
1469 AT_KEYWORDS([ovsdb server idl compound_index_single_column compound_index positive $5])
1470 AT_CHECK([ovsdb_start_idltest])
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']],
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]],
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']],
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]],
1492 OVSDB_SERVER_SHUTDOWN
1495 OVSDB_CHECK_IDL_COMPOUND_INDEX_SINGLE_COLUMN_C([Compound_index, single column test ],
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}}
1508 [idl_compound_index_single_column],
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
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
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
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],
1616 AT_KEYWORDS([ovsdb server idl compound_index_double_column compound_index positive $5])
1617 AT_CHECK([ovsdb_start_idltest])
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']],
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]],
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']],
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]],
1639 OVSDB_SERVER_SHUTDOWN
1642 OVSDB_CHECK_IDL_COMPOUND_INDEX_DOUBLE_COLUMN_C([Compound_index, double column test ],
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}}
1655 [idl_compound_index_double_column],
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
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
1753 m4_define([OVSDB_CHECK_IDL_COMPOUND_INDEX_WITH_REF],
1755 AT_KEYWORDS([ovsdb server idl compound_index compound_index_with_ref positive $5])
1756 AT_CHECK([ovsdb_start_idltest])
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]]),
1763 OVSDB_SERVER_SHUTDOWN
1766 OVSDB_CHECK_IDL_COMPOUND_INDEX_WITH_REF([set, simple3 idl-compound-index-with-ref, initially populated],
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>]]
1775 007: check simple4: empty
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])
1793 CHECK_STREAM_OPEN_BLOCK([tcp], [127.0.0.1])
1794 CHECK_STREAM_OPEN_BLOCK([tcp6], [[[::1]]])
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])
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' ',')
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])
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'])