]> git.proxmox.com Git - mirror_ovs.git/blame - tests/ovsdb-idl.at
socket-util: Report POLLHUP as an error while connection completion checking.
[mirror_ovs.git] / tests / ovsdb-idl.at
CommitLineData
c3bb4bd7
BP
1AT_BANNER([OVSDB -- interface description language (IDL)])
2
56120500
BP
3m4_divert_text([PREPARE_TESTS], [
4# ovsdb_start_idltest [REMOTE] [SCHEMA]
5#
6# Creates a database using SCHEMA (default: idltest.ovsschema) and
7# starts a database server listening on punix:socket and REMOTE (if
8# specified).
9ovsdb_start_idltest () {
10 ovsdb-tool create db ${2:-$abs_srcdir/idltest.ovsschema} || return $?
11 ovsdb-server -vconsole:warn --log-file --detach --no-chdir --pidfile --remote=punix:socket ${1:+--remote=$1} db || return $?
12 on_exit 'kill `cat ovsdb-server.pid`'
13}
14])
15
8cdf0349
BP
16# OVSDB_CHECK_IDL_C(TITLE, [PRE-IDL-TXN], TRANSACTIONS, OUTPUT, [KEYWORDS],
17# [FILTER])
c3bb4bd7
BP
18#
19# Creates a database with a schema derived from idltest.ovsidl, runs
20# each PRE-IDL-TXN (if any), starts an ovsdb-server on that database,
21# and runs "test-ovsdb idl" passing each of the TRANSACTIONS along.
22#
23# Checks that the overall output is OUTPUT. Before comparison, the
24# output is sorted (using "sort") and UUIDs in the output are replaced
25# by markers of the form <N> where N is a number. The first unique
26# UUID is replaced by <0>, the next by <1>, and so on. If a given
27# UUID appears more than once it is always replaced by the same
254604d8
BP
28# marker. If FILTER is supplied then the output is also filtered
29# through the specified program.
c3bb4bd7
BP
30#
31# TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS.
8cdf0349
BP
32m4_define([OVSDB_CHECK_IDL_C],
33 [AT_SETUP([$1 - C])
c3bb4bd7 34 AT_KEYWORDS([ovsdb server idl positive $5])
56120500 35 AT_CHECK([ovsdb_start_idltest])
c3bb4bd7 36 m4_if([$2], [], [],
7427f2a4 37 [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])])
8cdf0349 38 AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 idl unix:socket $3],
7427f2a4 39 [0], [stdout], [ignore])
c724bd67 40 AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]),
7427f2a4 41 [0], [$4])
028cbd99 42 OVSDB_SERVER_SHUTDOWN
c3bb4bd7
BP
43 AT_CLEANUP])
44
8cdf0349 45# same as OVSDB_CHECK_IDL but uses the Python IDL implementation.
963f66b5
RB
46m4_define([OVSDB_CHECK_IDL_PYN],
47 [AT_SETUP([$1])
48 AT_SKIP_IF([test $7 = no])
8cdf0349 49 AT_KEYWORDS([ovsdb server idl positive Python $5])
56120500 50 AT_CHECK([ovsdb_start_idltest])
8cdf0349 51 m4_if([$2], [], [],
7427f2a4 52 [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])])
e6703555 53 AT_CHECK([$8 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket $3],
7427f2a4 54 [0], [stdout], [ignore])
c724bd67 55 AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]),
7427f2a4 56 [0], [$4])
8cdf0349
BP
57 OVSDB_SERVER_SHUTDOWN
58 AT_CLEANUP])
59
963f66b5 60m4_define([OVSDB_CHECK_IDL_PY],
e6703555 61 [OVSDB_CHECK_IDL_PYN([$1 - Python2], [$2], [$3], [$4], [$5], [$6],
9ec53312 62 [$HAVE_PYTHON2], [$PYTHON2])
e6703555
IM
63 OVSDB_CHECK_IDL_PYN([$1 - Python3], [$2], [$3], [$4], [$5], [$6],
64 [$HAVE_PYTHON3], [$PYTHON3])])
963f66b5
RB
65
66m4_define([OVSDB_CHECK_IDL_REGISTER_COLUMNS_PYN],
67 [AT_SETUP([$1 - register_columns])
68 AT_SKIP_IF([test $7 = no])
01dc1516 69 AT_KEYWORDS([ovsdb server idl positive Python register_columns $5])
56120500 70 AT_CHECK([ovsdb_start_idltest])
01dc1516 71 m4_if([$2], [], [],
7427f2a4 72 [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])])
e6703555 73 AT_CHECK([$8 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket ?simple:b,ba,i,ia,r,ra,s,sa,u,ua?link1:i,k,ka,l2?link2:i,l1?singleton:name $3],
7427f2a4 74 [0], [stdout], [ignore])
c724bd67 75 AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]),
7427f2a4 76 [0], [$4])
01dc1516
SA
77 OVSDB_SERVER_SHUTDOWN
78 AT_CLEANUP])
79
963f66b5 80m4_define([OVSDB_CHECK_IDL_REGISTER_COLUMNS_PY],
e6703555 81 [OVSDB_CHECK_IDL_REGISTER_COLUMNS_PYN([$1 - Python2], [$2], [$3], [$4], [$5], [$6],
9ec53312 82 [$HAVE_PYTHON2], [$PYTHON2])
e6703555
IM
83 OVSDB_CHECK_IDL_REGISTER_COLUMNS_PYN([$1 - Python3], [$2], [$3], [$4], [$5], [$6],
84 [$HAVE_PYTHON3], [$PYTHON3])])
963f66b5 85
e06d06a7 86# same as OVSDB_CHECK_IDL but uses the Python IDL implementation with tcp
963f66b5
RB
87m4_define([OVSDB_CHECK_IDL_TCP_PYN],
88 [AT_SETUP([$1 - tcp])
89 AT_SKIP_IF([test $7 = no])
e06d06a7 90 AT_KEYWORDS([ovsdb server idl positive Python with tcp socket $5])
56120500 91 AT_CHECK([ovsdb_start_idltest "ptcp:0:127.0.0.1"])
fb28ef2d 92 PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT])
1e04fcc8 93
e06d06a7 94 m4_if([$2], [], [],
7427f2a4 95 [AT_CHECK([ovsdb-client transact tcp:127.0.0.1:$TCP_PORT $2], [0], [ignore], [ignore])])
e6703555 96 AT_CHECK([$8 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema tcp:127.0.0.1:$TCP_PORT $3],
7427f2a4 97 [0], [stdout], [ignore])
c724bd67 98 AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]),
7427f2a4 99 [0], [$4])
e06d06a7
IY
100 OVSDB_SERVER_SHUTDOWN
101 AT_CLEANUP])
102
963f66b5 103m4_define([OVSDB_CHECK_IDL_TCP_PY],
e6703555 104 [OVSDB_CHECK_IDL_TCP_PYN([$1 - Python2], [$2], [$3], [$4], [$5], [$6],
9ec53312 105 [$HAVE_PYTHON2], [$PYTHON2])
e6703555
IM
106 OVSDB_CHECK_IDL_TCP_PYN([$1 - Python3], [$2], [$3], [$4], [$5], [$6],
107 [$HAVE_PYTHON3], [$PYTHON3])])
963f66b5 108
31e434fc
NS
109# same as OVSDB_CHECK_IDL but uses the Python IDL implementation with tcp
110# with multiple remotes with only one remote reachable
111m4_define([OVSDB_CHECK_IDL_TCP_MULTIPLE_REMOTES_PYN],
112 [AT_SETUP([$1 - tcp])
113 AT_SKIP_IF([test $7 = no])
114 AT_KEYWORDS([ovsdb server idl positive Python with tcp socket $5])
115 AT_CHECK([ovsdb_start_idltest "ptcp:0:127.0.0.1"])
116 PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT])
117 WRONG_PORT_1=$((TCP_PORT + 1))
118 WRONG_PORT_2=$((TCP_PORT + 2))
119 remote=tcp:127.0.0.1:$WRONG_PORT_1,tcp:127.0.0.1:$TCP_PORT,tcp:127.0.0.1:$WRONG_PORT_2
120 m4_if([$2], [], [],
121 [AT_CHECK([ovsdb-client transact tcp:127.0.0.1:$TCP_PORT $2], [0], [ignore], [ignore])])
e6703555 122 AT_CHECK([$8 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema $remote $3],
31e434fc
NS
123 [0], [stdout], [ignore])
124 AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]),
125 [0], [$4])
126 OVSDB_SERVER_SHUTDOWN
127 AT_CLEANUP])
128
129m4_define([OVSDB_CHECK_IDL_TCP_MULTIPLE_REMOTES_PY],
e6703555 130 [OVSDB_CHECK_IDL_TCP_MULTIPLE_REMOTES_PYN([$1 - Python2 (multiple remotes)], [$2], [$3], [$4], [$5], [$6],
31e434fc 131 [$HAVE_PYTHON], [$PYTHON])
e6703555
IM
132 OVSDB_CHECK_IDL_TCP_MULTIPLE_REMOTES_PYN([$1 - Python3 (multiple remotes)], [$2], [$3], [$4], [$5], [$6],
133 [$HAVE_PYTHON3], [$PYTHON3])])
31e434fc 134
e731d71b 135# same as OVSDB_CHECK_IDL but uses the Python IDL implementation with tcp6
963f66b5
RB
136m4_define([OVSDB_CHECK_IDL_TCP6_PYN],
137 [AT_SETUP([$1 - tcp6])
138 AT_SKIP_IF([test $7 = no])
7b9d1b65 139 AT_SKIP_IF([test "$IS_WIN32" = "yes"])
4819b3a5 140 AT_SKIP_IF([test $HAVE_IPV6 = no])
e731d71b 141 AT_KEYWORDS([ovsdb server idl positive Python with tcp6 socket $5])
56120500 142 AT_CHECK([ovsdb_start_idltest "ptcp:0:[[::1]]"])
fb28ef2d 143 PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT])
e731d71b
AS
144 echo "TCP_PORT=$TCP_PORT"
145
146 m4_if([$2], [], [],
7427f2a4 147 [AT_CHECK([ovsdb-client transact "tcp:[[::1]]:$TCP_PORT" $2], [0], [ignore], [ignore])])
e6703555 148 AT_CHECK([$8 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema tcp:[[::1]]:$TCP_PORT $3],
7427f2a4 149 [0], [stdout], [ignore])
c724bd67 150 AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]),
7427f2a4 151 [0], [$4])
e731d71b
AS
152 OVSDB_SERVER_SHUTDOWN
153 AT_CLEANUP])
154
963f66b5 155m4_define([OVSDB_CHECK_IDL_TCP6_PY],
e6703555 156 [OVSDB_CHECK_IDL_TCP6_PYN([$1 - Python2], [$2], [$3], [$4], [$5], [$6],
9ec53312 157 [$HAVE_PYTHON2], [$PYTHON2])
e6703555
IM
158 OVSDB_CHECK_IDL_TCP6_PYN([$1 - Python3], [$2], [$3], [$4], [$5], [$6],
159 [$HAVE_PYTHON3], [$PYTHON3])])
963f66b5 160
31e434fc
NS
161m4_define([OVSDB_CHECK_IDL_TCP6_MULTIPLE_REMOTES_PYN],
162 [AT_SETUP([$1 - tcp6])
163 AT_SKIP_IF([test $7 = no])
164 AT_SKIP_IF([test "$IS_WIN32" = "yes"])
165 AT_SKIP_IF([test $HAVE_IPV6 = no])
166 AT_KEYWORDS([ovsdb server idl positive Python with tcp6 socket $5])
167 AT_CHECK([ovsdb_start_idltest "ptcp:0:[[::1]]"])
168 PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT])
169 WRONG_PORT_1=$((TCP_PORT + 1))
170 WRONG_PORT_2=$((TCP_PORT + 2))
171 remote="tcp:[[::1]]:$WRONG_PORT_1,tcp:[[::1]]:$TCP_PORT,tcp:[[::1]]:$WRONG_PORT_2"
172 m4_if([$2], [], [],
173 [AT_CHECK([ovsdb-client transact "tcp:[[::1]]:$TCP_PORT" $2], [0], [ignore], [ignore])])
e6703555 174 AT_CHECK([$8 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema $remote $3],
31e434fc
NS
175 [0], [stdout], [ignore])
176 AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]),
177 [0], [$4])
178 OVSDB_SERVER_SHUTDOWN
179 AT_CLEANUP])
180
181m4_define([OVSDB_CHECK_IDL_TCP6_MULTIPLE_REMOTES_PY],
e6703555 182 [OVSDB_CHECK_IDL_TCP6_MULTIPLE_REMOTES_PYN([$1 - Python2 (multiple remotes)], [$2], [$3], [$4], [$5], [$6],
31e434fc 183 [$HAVE_PYTHON], [$PYTHON])
e6703555
IM
184 OVSDB_CHECK_IDL_TCP6_MULTIPLE_REMOTES_PYN([$1 - Python3 (multiple remotes)], [$2], [$3], [$4], [$5], [$6],
185 [$HAVE_PYTHON3], [$PYTHON3])])
31e434fc 186
61845323
JS
187# same as OVSDB_CHECK_IDL but uses the Python IDL implementation with SSL
188m4_define([OVSDB_CHECK_IDL_SSL_PYN],
189 [AT_SETUP([$1 - SSL])
190 AT_SKIP_IF([test "$HAVE_OPENSSL" = no])
191 AT_SKIP_IF([test $7 = no])
192 $8 -c "import OpenSSL.SSL"
193 SSL_PRESENT=$?
194 AT_SKIP_IF([test $SSL_PRESENT != 0])
195 AT_KEYWORDS([ovsdb server idl positive Python with ssl socket $5])
196 AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema],
197 [0], [stdout], [ignore])
198 PKIDIR=$abs_top_builddir/tests
199 AT_CHECK([ovsdb-server -vconsole:warn --log-file --detach --no-chdir \
200 --pidfile \
201 --private-key=$PKIDIR/testpki-privkey2.pem \
202 --certificate=$PKIDIR/testpki-cert2.pem \
203 --ca-cert=$PKIDIR/testpki-cacert.pem \
204 --remote=pssl:0:127.0.0.1 db])
205 on_exit 'kill `cat ovsdb-server.pid`'
206 PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT])
207 m4_if([$2], [], [],
208 [AT_CHECK([ovsdb-client \
209 --private-key=$PKIDIR/testpki-privkey2.pem \
210 --certificate=$PKIDIR/testpki-cert2.pem \
211 --ca-cert=$PKIDIR/testpki-cacert.pem \
212 transact "ssl:127.0.0.1:$TCP_PORT" $2], [0], [ignore], [ignore])])
e6703555 213 AT_CHECK([$8 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema \
61845323
JS
214 ssl:127.0.0.1:$TCP_PORT $PKIDIR/testpki-privkey.pem \
215 $PKIDIR/testpki-cert.pem $PKIDIR/testpki-cacert.pem $3],
216 [0], [stdout], [ignore])
217 AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]),
218 [0], [$4])
219 OVSDB_SERVER_SHUTDOWN
220 AT_CLEANUP])
221
222m4_define([OVSDB_CHECK_IDL_SSL_PY],
e6703555 223 [OVSDB_CHECK_IDL_SSL_PYN([$1 - Python2], [$2], [$3], [$4], [$5], [$6],
61845323 224 [$HAVE_PYTHON], [$PYTHON])
e6703555
IM
225 OVSDB_CHECK_IDL_SSL_PYN([$1 - Python3], [$2], [$3], [$4], [$5], [$6],
226 [$HAVE_PYTHON3], [$PYTHON3])])
61845323 227
8cdf0349
BP
228m4_define([OVSDB_CHECK_IDL],
229 [OVSDB_CHECK_IDL_C($@)
e06d06a7 230 OVSDB_CHECK_IDL_PY($@)
01dc1516 231 OVSDB_CHECK_IDL_REGISTER_COLUMNS_PY($@)
e731d71b 232 OVSDB_CHECK_IDL_TCP_PY($@)
31e434fc 233 OVSDB_CHECK_IDL_TCP_MULTIPLE_REMOTES_PY($@)
61845323 234 OVSDB_CHECK_IDL_TCP6_PY($@)
31e434fc 235 OVSDB_CHECK_IDL_TCP6_MULTIPLE_REMOTES_PY($@)
61845323 236 OVSDB_CHECK_IDL_SSL_PY($@)])
8cdf0349 237
af358237 238# This test uses the Python IDL implementation with passive tcp
f62a20d8
TR
239m4_define([OVSDB_CHECK_IDL_PASSIVE_TCP_PYN],
240 [AT_SETUP([$1 ptcp])
241 AT_SKIP_IF([test $7 = no])
af358237 242 AT_KEYWORDS([ovsdb server idl positive Python with tcp socket $5])
af358237 243 # find free TCP port
56120500 244 AT_CHECK([ovsdb_start_idltest "ptcp:0:127.0.0.1"])
af358237 245 PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT])
7427f2a4 246 OVSDB_SERVER_SHUTDOWN
56120500 247 rm -f db
af358237
OBY
248
249 # start OVSDB server in passive mode
56120500 250 AT_CHECK([ovsdb_start_idltest "tcp:127.0.0.1:$TCP_PORT"])
e6703555 251 AT_CHECK([$8 $srcdir/test-ovsdb.py -t10 idl_passive $srcdir/idltest.ovsschema ptcp:127.0.0.1:$TCP_PORT $3],
7427f2a4 252 [0], [stdout], [ignore])
c724bd67 253 AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]),
7427f2a4
DDP
254 [0], [$4])
255 OVSDB_SERVER_SHUTDOWN
af358237
OBY
256 AT_CLEANUP
257 ])
258
f62a20d8 259m4_define([OVSDB_CHECK_IDL_PASSIVE_TCP_PY],
e6703555 260 [OVSDB_CHECK_IDL_PASSIVE_TCP_PYN([$1 - Python2], [$2], [$3], [$4], [$5], [$6],
9ec53312 261 [$HAVE_PYTHON2], [$PYTHON2])
e6703555
IM
262 OVSDB_CHECK_IDL_PASSIVE_TCP_PYN([$1 - Python3], [$2], [$3], [$4], [$5], [$6],
263 [$HAVE_PYTHON3], [$PYTHON3])])
f62a20d8 264
af358237
OBY
265OVSDB_CHECK_IDL_PASSIVE_TCP_PY([simple passive idl, initially empty, select empty],
266 [],
267 [['["idltest",{"op":"select","table":"link1","where":[]}]']],
268 [[000: empty
269001: {"error":null,"result":[{"rows":[]}]}
270002: done
271]])
272
c3bb4bd7
BP
273OVSDB_CHECK_IDL([simple idl, initially empty, no ops],
274 [],
275 [],
276 [000: empty
277001: done
278])
279
280OVSDB_CHECK_IDL([simple idl, initially empty, various ops],
281 [],
9cb53f26
BP
282 [['["idltest",
283 {"op": "insert",
c3bb4bd7
BP
284 "table": "simple",
285 "row": {"i": 1,
286 "r": 2.0,
287 "b": true,
288 "s": "mystring",
289 "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"],
290 "ia": ["set", [1, 2, 3]],
291 "ra": ["set", [-0.5]],
7fae24e6 292 "ba": ["set", [true]],
8cdf0349 293 "sa": ["set", ["abc", "def"]],
c3bb4bd7
BP
294 "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
295 ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
296 {"op": "insert",
297 "table": "simple",
298 "row": {}}]' \
9cb53f26
BP
299 '["idltest",
300 {"op": "update",
c3bb4bd7
BP
301 "table": "simple",
302 "where": [],
303 "row": {"b": true}}]' \
9cb53f26
BP
304 '["idltest",
305 {"op": "update",
c3bb4bd7
BP
306 "table": "simple",
307 "where": [],
308 "row": {"r": 123.5}}]' \
9cb53f26
BP
309 '["idltest",
310 {"op": "insert",
c3bb4bd7
BP
311 "table": "simple",
312 "row": {"i": -1,
313 "r": 125,
314 "b": false,
315 "s": "",
316 "ia": ["set", [1]],
317 "ra": ["set", [1.5]],
318 "ba": ["set", [false]],
8cdf0349 319 "sa": ["set", []],
c3bb4bd7 320 "ua": ["set", []]}}]' \
9cb53f26
BP
321 '["idltest",
322 {"op": "update",
c3bb4bd7
BP
323 "table": "simple",
324 "where": [["i", "<", 1]],
325 "row": {"s": "newstring"}}]' \
9cb53f26
BP
326 '["idltest",
327 {"op": "delete",
c3bb4bd7
BP
328 "table": "simple",
329 "where": [["i", "==", 0]]}]' \
330 'reconnect']],
331 [[000: empty
332001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]}
333002: i=0 r=0 b=false s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
7fae24e6 334002: i=1 r=2 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0>
c3bb4bd7
BP
335003: {"error":null,"result":[{"count":2}]}
336004: i=0 r=0 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
7fae24e6 337004: i=1 r=2 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0>
c3bb4bd7
BP
338005: {"error":null,"result":[{"count":2}]}
339006: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
7fae24e6 340006: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0>
c3bb4bd7
BP
341007: {"error":null,"result":[{"uuid":["uuid","<6>"]}]}
342008: i=-1 r=125 b=false s= u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
343008: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
7fae24e6 344008: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0>
c3bb4bd7
BP
345009: {"error":null,"result":[{"count":2}]}
346010: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
347010: i=0 r=123.5 b=true s=newstring u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
7fae24e6 348010: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0>
c3bb4bd7
BP
349011: {"error":null,"result":[{"count":1}]}
350012: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
7fae24e6 351012: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0>
c3bb4bd7
BP
352013: reconnect
353014: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
7fae24e6 354014: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0>
c3bb4bd7
BP
355015: done
356]])
357
358OVSDB_CHECK_IDL([simple idl, initially populated],
9cb53f26
BP
359 [['["idltest",
360 {"op": "insert",
c3bb4bd7
BP
361 "table": "simple",
362 "row": {"i": 1,
363 "r": 2.0,
364 "b": true,
365 "s": "mystring",
366 "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"],
367 "ia": ["set", [1, 2, 3]],
368 "ra": ["set", [-0.5]],
7fae24e6 369 "ba": ["set", [true]],
8cdf0349 370 "sa": ["set", ["abc", "def"]],
c3bb4bd7
BP
371 "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
372 ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
373 {"op": "insert",
374 "table": "simple",
375 "row": {}}]']],
9cb53f26
BP
376 [['["idltest",
377 {"op": "update",
c3bb4bd7
BP
378 "table": "simple",
379 "where": [],
380 "row": {"b": true}}]']],
381 [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
7fae24e6 382000: i=1 r=2 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<3> <4>] uuid=<5>
c3bb4bd7
BP
383001: {"error":null,"result":[{"count":2}]}
384002: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
7fae24e6 385002: i=1 r=2 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<3> <4>] uuid=<5>
c3bb4bd7
BP
386003: done
387]])
388
475281c0 389OVSDB_CHECK_IDL([simple idl, writing via IDL],
9cb53f26
BP
390 [['["idltest",
391 {"op": "insert",
475281c0
BP
392 "table": "simple",
393 "row": {"i": 1,
394 "r": 2.0,
395 "b": true,
396 "s": "mystring",
397 "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"],
398 "ia": ["set", [1, 2, 3]],
399 "ra": ["set", [-0.5]],
7fae24e6 400 "ba": ["set", [true]],
8cdf0349 401 "sa": ["set", ["abc", "def"]],
475281c0
BP
402 "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
403 ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
404 {"op": "insert",
405 "table": "simple",
406 "row": {}}]']],
a91c6104
BP
407 [['verify 0 b, verify 1 r, set 0 b 1, set 1 r 3.5' \
408 'insert 2, verify 2 i, verify 1 b, delete 1']],
475281c0 409 [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
7fae24e6 410000: i=1 r=2 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<3> <4>] uuid=<5>
475281c0
BP
411001: commit, status=success
412002: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
7fae24e6 413002: i=1 r=3.5 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<3> <4>] uuid=<5>
475281c0
BP
414003: commit, status=success
415004: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
416004: i=2 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<6>
417005: done
418]])
419
e7164d96
LR
420OVSDB_CHECK_IDL([simple idl, writing via IDL with unicode],
421 [['["idltest",
422 {"op": "insert",
423 "table": "simple",
424 "row": {"s": "(╯°□°)╯︵ ┻━┻"}}]']],
425 [['set 0 b 1, insert 1, set 1 s "¯\_(ツ)_/¯"']],
426 [[000: i=0 r=0 b=false s=(╯°□°)╯︵ ┻━┻ u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
427001: commit, status=success
428002: i=0 r=0 b=true s=(╯°□°)╯︵ ┻━┻ u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
429002: i=1 r=0 b=false s="¯\_(ツ)_/¯" u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2>
430003: done
431]])
432
980211b7
GL
433m4_define([OVSDB_CHECK_IDL_PYN_WITH_EXPOUT],
434 [AT_SETUP([$1])
435 AT_SKIP_IF([test $7 = no])
436 AT_KEYWORDS([ovsdb server idl positive Python $5])
437 AT_CHECK([ovsdb_start_idltest])
438 m4_if([$2], [], [],
439 [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])])
e6703555 440 AT_CHECK([$8 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket $3],
980211b7
GL
441 [0], [stdout], [ignore])
442 echo "$4" > expout
443 AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]),
444 [0], [expout])
445 OVSDB_SERVER_SHUTDOWN
446 AT_CLEANUP])
447
448m4_define([OVSDB_CHECK_IDL_PY_WITH_EXPOUT],
e6703555 449 [OVSDB_CHECK_IDL_PYN_WITH_EXPOUT([$1 - Python2], [$2], [$3], [$4], [$5], [$6],
9ec53312 450 [$HAVE_PYTHON2], [$PYTHON2])
e6703555
IM
451 OVSDB_CHECK_IDL_PYN_WITH_EXPOUT([$1 - Python3], [$2], [$3], [$4], [$5], [$6],
452 [$HAVE_PYTHON3], [$PYTHON3])])
980211b7
GL
453
454OVSDB_CHECK_IDL_PY_WITH_EXPOUT([simple idl, writing large data via IDL with unicode],
455 [['["idltest",
456 {"op": "insert",
457 "table": "simple",
458 "row": {"s": "'$(printf "测试超过四千零九十六个字节的中文字符串以使解码出现问题。%.0s" {1..50})'"}}]']],
459 [['set 0 b 1, insert 1, set 1 s '$(printf "测试超过四千零九十六个字节的中文字符串以使解码出现问题。%.0s" {1..100})'']],
460 [[000: i=0 r=0 b=false s=$(printf "测试超过四千零九十六个字节的中文字符串以使解码出现问题。%.0s" {1..50}) u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
461001: commit, status=success
462002: i=0 r=0 b=true s=$(printf "测试超过四千零九十六个字节的中文字符串以使解码出现问题。%.0s" {1..50}) u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
463002: i=1 r=0 b=false s=$(printf "测试超过四千零九十六个字节的中文字符串以使解码出现问题。%.0s" {1..100}) u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2>
464003: done]])
465
a91c6104
BP
466OVSDB_CHECK_IDL([simple idl, handling verification failure],
467 [['["idltest",
468 {"op": "insert",
469 "table": "simple",
470 "row": {"i": 1,
471 "r": 2.0}},
472 {"op": "insert",
473 "table": "simple",
474 "row": {}}]']],
475 [['set 0 b 1' \
476 '+["idltest",
477 {"op": "update",
478 "table": "simple",
479 "where": [["i", "==", 1]],
480 "row": {"r": 5.0}}]' \
481 '+verify 1 r, set 1 r 3' \
482 'verify 1 r, set 1 r 3' \
483 ]],
484 [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
485000: i=1 r=2 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2>
486001: commit, status=success
487002: {"error":null,"result":[{"count":1}]}
94fbe1aa 488003: commit, status=try again
a91c6104
BP
489004: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
490004: i=1 r=5 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2>
491005: commit, status=success
492006: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
493006: i=1 r=3 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2>
494007: done
495]])
496
b54e22e9 497OVSDB_CHECK_IDL([simple idl, increment operation],
9cb53f26
BP
498 [['["idltest",
499 {"op": "insert",
b54e22e9
BP
500 "table": "simple",
501 "row": {}}]']],
94fbe1aa 502 [['set 0 r 2.0, increment 0']],
b54e22e9
BP
503 [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
504001: commit, status=success, increment=1
505002: i=1 r=2 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
506003: done
507]])
508
2096903b
BP
509OVSDB_CHECK_IDL([simple idl, aborting],
510 [['["idltest",
511 {"op": "insert",
512 "table": "simple",
513 "row": {}}]']],
514 [['set 0 r 2.0, abort' \
515'+set 0 b 1']],
516 [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
517001: commit, status=aborted
518002: commit, status=success
519003: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
520004: done
521]])
522
523OVSDB_CHECK_IDL([simple idl, destroy without commit or abort],
524 [['["idltest",
525 {"op": "insert",
526 "table": "simple",
527 "row": {}}]']],
528 [['set 0 r 2.0, destroy' \
529'+set 0 b 1']],
530 [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
531001: destroy
532002: commit, status=success
533003: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
534004: done
535]])
536
16ebb90e
LS
537OVSDB_CHECK_IDL([simple idl, conditional, false condition],
538 [['["idltest",
539 {"op": "insert",
540 "table": "simple",
541 "row": {"i": 1,
542 "r": 2.0,
543 "b": true}}]']],
0164e367
BP
544 [['condition simple []' \
545 'condition simple [true]']],
16ebb90e
LS
546 [[000: change conditions
547001: empty
548002: change conditions
549003: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
550004: done
551]])
552
553OVSDB_CHECK_IDL([simple idl, conditional, true condition],
554 [['["idltest",
555 {"op": "insert",
556 "table": "simple",
557 "row": {"i": 1,
558 "r": 2.0,
559 "b": true}}]']],
0164e367
BP
560 [['condition simple []' \
561 'condition simple [true]']],
16ebb90e
LS
562 [[000: change conditions
563001: empty
564002: change conditions
565003: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
566004: done
567]])
568
569OVSDB_CHECK_IDL([simple idl, conditional, multiple clauses in condition],
570 [['["idltest",
571 {"op": "insert",
572 "table": "simple",
573 "row": {"i": 1,
574 "r": 2.0,
575 "b": true}},
576 {"op": "insert",
577 "table": "simple",
578 "row": {"i": 2,
579 "r": 3.0,
580 "b": true}}]']],
0164e367
BP
581 [['condition simple []' \
582 'condition simple [["i","==",1],["i","==",2]]']],
16ebb90e
LS
583 [[000: change conditions
584001: empty
585002: change conditions
586003: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
587003: i=2 r=3 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2>
588004: done
589]])
590
591OVSDB_CHECK_IDL([simple idl, conditional, modify as insert due to condition],
592 [['["idltest",
593 {"op": "insert",
594 "table": "simple",
595 "row": {"i": 1,
596 "r": 2.0,
597 "b": true}}]']],
0164e367
BP
598 [['condition simple []' \
599 'condition simple [["i","==",1]]']],
16ebb90e
LS
600 [[000: change conditions
601001: empty
602002: change conditions
603003: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
604004: done
605]])
606
607OVSDB_CHECK_IDL([simple idl, conditional, modify as delete due to condition],
608 [['["idltest",
609 {"op": "insert",
610 "table": "simple",
611 "row": {"i": 1,
612 "r": 2.0,
613 "b": true}}]']],
0164e367
BP
614 [['condition simple []' \
615 'condition simple [["i","==",1],["i","==",2]]' \
616 'condition simple [["i","==",2]]' \
16ebb90e
LS
617 '["idltest",
618 {"op": "insert",
619 "table": "simple",
620 "row": {"i": 2,
621 "r": 3.0,
622 "b": true}}]']],
623 [[000: change conditions
624001: empty
625002: change conditions
626003: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
627004: change conditions
628005: empty
629006: {"error":null,"result":[{"uuid":["uuid","<2>"]}]}
630007: i=2 r=3 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2>
631008: done
632]])
633
634OVSDB_CHECK_IDL([simple idl, conditional, multiple tables],
635 [['["idltest",
636 {"op": "insert",
637 "table": "simple",
638 "row": {"i": 1,
639 "r": 2.0,
640 "b": true}},
641 {"op": "insert",
642 "table": "link1",
643 "row": {"i": 0, "k": ["named-uuid", "self"]},
644 "uuid-name": "self"},
645 {"op": "insert",
646 "table": "link2",
647 "row": {"i": 2},
648 "uuid-name": "row0"}]']],
0164e367
BP
649 [['condition simple [];link1 [];link2 []' \
650 'condition simple [["i","==",1]]' \
651 'condition link1 [["i","==",0]]' \
652 'condition link2 [["i","==",3]]' \
16ebb90e
LS
653 '+["idltest",
654 {"op": "insert",
655 "table": "link2",
656 "row": {"i": 3},
657 "uuid-name": "row0"}]']],
658 [[000: change conditions
659001: empty
660002: change conditions
661003: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
662004: change conditions
663005: i=0 k=0 ka=[] l2= uuid=<2>
664005: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
665006: change conditions
666007: {"error":null,"result":[{"uuid":["uuid","<3>"]}]}
667008: i=0 k=0 ka=[] l2= uuid=<2>
668008: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
669008: i=3 l1= uuid=<3>
670009: done
671]])
672
c3bb4bd7
BP
673OVSDB_CHECK_IDL([self-linking idl, consistent ops],
674 [],
9cb53f26
BP
675 [['["idltest",
676 {"op": "insert",
e9011ac8 677 "table": "link1",
c3bb4bd7
BP
678 "row": {"i": 0, "k": ["named-uuid", "self"]},
679 "uuid-name": "self"}]' \
9cb53f26
BP
680 '["idltest",
681 {"op": "insert",
e9011ac8 682 "table": "link1",
2d2d6d4a 683 "row": {"i": 1, "k": ["named-uuid", "row2"]},
c3bb4bd7
BP
684 "uuid-name": "row1"},
685 {"op": "insert",
e9011ac8 686 "table": "link1",
c3bb4bd7 687 "row": {"i": 2, "k": ["named-uuid", "row1"]},
2d2d6d4a 688 "uuid-name": "row2"}]' \
9cb53f26
BP
689 '["idltest",
690 {"op": "update",
e9011ac8 691 "table": "link1",
c3bb4bd7
BP
692 "where": [["i", "==", 1]],
693 "row": {"k": ["uuid", "#1#"]}}]' \
9cb53f26
BP
694 '["idltest",
695 {"op": "update",
e9011ac8 696 "table": "link1",
c3bb4bd7
BP
697 "where": [],
698 "row": {"k": ["uuid", "#0#"]}}]']],
699 [[000: empty
700001: {"error":null,"result":[{"uuid":["uuid","<0>"]}]}
e9011ac8 701002: i=0 k=0 ka=[] l2= uuid=<0>
fbf925e4 702003: {"error":null,"result":[{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]}]}
e9011ac8
BP
703004: i=0 k=0 ka=[] l2= uuid=<0>
704004: i=1 k=2 ka=[] l2= uuid=<1>
705004: i=2 k=1 ka=[] l2= uuid=<2>
c3bb4bd7 706005: {"error":null,"result":[{"count":1}]}
e9011ac8
BP
707006: i=0 k=0 ka=[] l2= uuid=<0>
708006: i=1 k=1 ka=[] l2= uuid=<1>
709006: i=2 k=1 ka=[] l2= uuid=<2>
c3bb4bd7 710007: {"error":null,"result":[{"count":3}]}
e9011ac8
BP
711008: i=0 k=0 ka=[] l2= uuid=<0>
712008: i=1 k=0 ka=[] l2= uuid=<1>
713008: i=2 k=0 ka=[] l2= uuid=<2>
c3bb4bd7
BP
714009: done
715]])
716
717OVSDB_CHECK_IDL([self-linking idl, inconsistent ops],
718 [],
9cb53f26
BP
719 [['["idltest",
720 {"op": "insert",
e9011ac8 721 "table": "link1",
c3bb4bd7 722 "row": {"i": 0, "k": ["uuid", "cf197cc5-c8c9-42f5-82d5-c71a9f2cb96b"]}}]' \
9cb53f26
BP
723 '+["idltest",
724 {"op": "insert",
e9011ac8 725 "table": "link1",
0d0f05b9
BP
726 "uuid-name": "one",
727 "row": {"i": 1, "k": ["named-uuid", "one"]}},
728 {"op": "insert",
729 "table": "link1",
730 "row": {"i": 2, "k": ["named-uuid", "one"]}}]' \
9cb53f26
BP
731 '["idltest",
732 {"op": "update",
e9011ac8 733 "table": "link1",
c3bb4bd7
BP
734 "where": [],
735 "row": {"k": ["uuid", "c2fca39a-e69a-42a4-9c56-5eca85839ce9"]}}]' \
9cb53f26
BP
736 '+["idltest",
737 {"op": "delete",
e9011ac8 738 "table": "link1",
0d0f05b9 739 "where": [["_uuid", "==", ["uuid", "#1#"]]]}]' \
9cb53f26
BP
740 '+["idltest",
741 {"op": "delete",
e9011ac8 742 "table": "link1",
0d0f05b9 743 "where": [["_uuid", "==", ["uuid", "#2#"]]]}]' \
9cb53f26
BP
744 '["idltest",
745 {"op": "delete",
0d0f05b9
BP
746 "table": "link1",
747 "where": []}]' \
c3bb4bd7
BP
748]],
749 [[000: empty
97f7803b 750001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"details":"Table link1 column k row <0> references nonexistent row <1> in table link1.","error":"referential integrity violation"}]}
0d0f05b9
BP
751002: {"error":null,"result":[{"uuid":["uuid","<2>"]},{"uuid":["uuid","<3>"]}]}
752003: i=1 k=1 ka=[] l2= uuid=<2>
753003: i=2 k=1 ka=[] l2= uuid=<3>
254604d8 754004: {"error":null,"result":[{"count":2},{"details":"Table link1 column k row <x> references nonexistent row <4> in table link1.","error":"referential integrity violation"}]}
0d0f05b9
BP
755005: {"error":null,"result":[{"count":1},{"details":"cannot delete link1 row <2> because of 1 remaining reference(s)","error":"referential integrity violation"}]}
756006: {"error":null,"result":[{"count":1}]}
757007: i=1 k=1 ka=[] l2= uuid=<2>
758008: {"error":null,"result":[{"count":1}]}
759009: empty
760010: done
254604d8
BP
761]],
762 [],
763 [[sed -e '/004:/s/row <[23]> references/row <x> references/']])
c3bb4bd7
BP
764
765OVSDB_CHECK_IDL([self-linking idl, sets],
766 [],
9cb53f26
BP
767 [['["idltest",
768 {"op": "insert",
e9011ac8 769 "table": "link1",
0d0f05b9 770 "row": {"i": 0, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i0"]]]},
c3bb4bd7
BP
771 "uuid-name": "i0"},
772 {"op": "insert",
e9011ac8 773 "table": "link1",
0d0f05b9 774 "row": {"i": 1, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i1"]]]},
c3bb4bd7
BP
775 "uuid-name": "i1"},
776 {"op": "insert",
e9011ac8 777 "table": "link1",
0d0f05b9 778 "row": {"i": 2, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i2"]]]},
c3bb4bd7
BP
779 "uuid-name": "i2"},
780 {"op": "insert",
e9011ac8 781 "table": "link1",
0d0f05b9 782 "row": {"i": 3, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i3"]]]},
c3bb4bd7 783 "uuid-name": "i3"}]' \
9cb53f26
BP
784 '["idltest",
785 {"op": "update",
e9011ac8 786 "table": "link1",
c3bb4bd7
BP
787 "where": [],
788 "row": {"ka": ["set", [["uuid", "#0#"], ["uuid", "#1#"], ["uuid", "#2#"], ["uuid", "#3#"]]]}}]' \
9cb53f26
BP
789 '["idltest",
790 {"op": "update",
e9011ac8 791 "table": "link1",
97f7803b
BP
792 "where": [["i", "==", 2]],
793 "row": {"ka": ["set", [["uuid", "#0#"], ["uuid", "88702e78-845b-4a6e-ad08-cf68922ae84a"], ["uuid", "#2#"]]]}}]' \
9cb53f26
BP
794 '+["idltest",
795 {"op": "delete",
0d0f05b9
BP
796 "table": "link1",
797 "where": []}]']],
c3bb4bd7
BP
798 [[000: empty
799001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]},{"uuid":["uuid","<3>"]}]}
0d0f05b9
BP
800002: i=0 k=0 ka=[0] l2= uuid=<0>
801002: i=1 k=0 ka=[1] l2= uuid=<1>
802002: i=2 k=0 ka=[2] l2= uuid=<2>
803002: i=3 k=0 ka=[3] l2= uuid=<3>
c3bb4bd7 804003: {"error":null,"result":[{"count":4}]}
0d0f05b9
BP
805004: i=0 k=0 ka=[0 1 2 3] l2= uuid=<0>
806004: i=1 k=0 ka=[0 1 2 3] l2= uuid=<1>
807004: i=2 k=0 ka=[0 1 2 3] l2= uuid=<2>
808004: i=3 k=0 ka=[0 1 2 3] l2= uuid=<3>
97f7803b 809005: {"error":null,"result":[{"count":1},{"details":"Table link1 column ka row <2> references nonexistent row <4> in table link1.","error":"referential integrity violation"}]}
0d0f05b9
BP
810006: {"error":null,"result":[{"count":4}]}
811007: empty
812008: done
c3bb4bd7
BP
813]])
814
e9011ac8
BP
815OVSDB_CHECK_IDL([external-linking idl, consistent ops],
816 [],
9cb53f26
BP
817 [['["idltest",
818 {"op": "insert",
e9011ac8
BP
819 "table": "link2",
820 "row": {"i": 0},
821 "uuid-name": "row0"},
822 {"op": "insert",
823 "table": "link1",
0d0f05b9 824 "row": {"i": 1, "k": ["named-uuid", "row1"], "l2": ["set", [["named-uuid", "row0"]]]},
e9011ac8
BP
825 "uuid-name": "row1"}]']],
826 [[000: empty
827001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]}
828002: i=0 l1= uuid=<0>
0d0f05b9 829002: i=1 k=1 ka=[] l2=0 uuid=<1>
e9011ac8
BP
830003: done
831]])
225b582a 832
079ace1f
MM
833OVSDB_CHECK_IDL([singleton idl, constraints],
834 [],
835 [['["idltest",
836 {"op": "insert",
837 "table": "singleton",
838 "row": {"name": "foo"}}]' \
839 '["idltest",
840 {"op": "insert",
841 "table": "singleton",
842 "row": {"name": "bar"}}]' \
843 '+["idltest",
844 {"op": "delete",
845 "table": "singleton",
846 "where": [["_uuid", "==", ["uuid", "#0#"]]]},
847 {"op": "insert",
848 "table": "singleton",
849 "row": {"name": "bar"}}]']],
850 [[000: empty
851001: {"error":null,"result":[{"uuid":["uuid","<0>"]}]}
852002: name=foo uuid=<0>
853003: {"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"}]}
854004: {"error":null,"result":[{"count":1},{"uuid":["uuid","<2>"]}]}
855005: name=bar uuid=<2>
856006: done
857]])
858
225b582a
IY
859OVSDB_CHECK_IDL_PY([external-linking idl, insert ops],
860 [],
861 [['linktest']],
862 [[000: empty
863001: commit, status=success
864002: i=1 k=1 ka=[1] l2= uuid=<0>
865002: i=2 k=1 ka=[1 2] l2= uuid=<1>
866003: done
867]])
3b4c362f
IY
868
869OVSDB_CHECK_IDL_PY([getattr idl, insert ops],
870 [],
871 [['getattrtest']],
872 [[000: empty
873001: commit, status=success
874002: i=2 k=2 ka=[] l2= uuid=<0>
875003: done
876]])
d18e52e3 877
d7d417fc
TW
878OVSDB_CHECK_IDL_PY([row-from-json idl, whats this],
879 [['["idltest",
880 {"op": "insert",
881 "table": "simple",
882 "row": {"i": 1}},
883 {"op": "insert",
884 "table": "simple",
885 "row": {}}]']],
886 [['notifytest insert 2, notifytest set 1 b 1, notifytest delete 0']],
887 [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
888000: i=1 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2>
889001: commit, status=success, events=create|2|None, delete|0|None, update|1|b
890002: i=1 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2>
891002: i=2 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3>
892003: done
893]])
894
d18e52e3
BP
895AT_SETUP([idl handling of missing tables and columns - C])
896AT_KEYWORDS([ovsdb server idl positive])
d18e52e3
BP
897
898# idltest2.ovsschema is the same as idltest.ovsschema, except that
899# table link2 and column l2 have been deleted. But the IDL still
900# expects them to be there, so this test checks that it properly
901# tolerates them being missing.
56120500 902AT_CHECK([ovsdb_start_idltest "" "$abs_srcdir/idltest2.ovsschema"])
d18e52e3
BP
903AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 idl unix:socket ['["idltest",
904 {"op": "insert",
905 "table": "link1",
906 "row": {"i": 0, "k": ["named-uuid", "self"]},
907 "uuid-name": "self"}]' \
908 '["idltest",
909 {"op": "insert",
910 "table": "link1",
911 "row": {"i": 1, "k": ["named-uuid", "row2"]},
912 "uuid-name": "row1"},
913 {"op": "insert",
914 "table": "link1",
915 "row": {"i": 2, "k": ["named-uuid", "row1"]},
916 "uuid-name": "row2"}]' \
917 '["idltest",
918 {"op": "update",
919 "table": "link1",
920 "where": [["i", "==", 1]],
921 "row": {"k": ["uuid", "#1#"]}}]' \
922 '["idltest",
923 {"op": "update",
924 "table": "link1",
925 "where": [],
926 "row": {"k": ["uuid", "#0#"]}}]']],
5a0e4aec 927 [0], [stdout], [stderr])
c724bd67 928AT_CHECK([sort stdout | uuidfilt], [0],
d18e52e3
BP
929 [[000: empty
930001: {"error":null,"result":[{"uuid":["uuid","<0>"]}]}
931002: i=0 k=0 ka=[] l2= uuid=<0>
932003: {"error":null,"result":[{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]}]}
933004: i=0 k=0 ka=[] l2= uuid=<0>
934004: i=1 k=2 ka=[] l2= uuid=<1>
935004: i=2 k=1 ka=[] l2= uuid=<2>
936005: {"error":null,"result":[{"count":1}]}
937006: i=0 k=0 ka=[] l2= uuid=<0>
938006: i=1 k=1 ka=[] l2= uuid=<1>
939006: i=2 k=1 ka=[] l2= uuid=<2>
940007: {"error":null,"result":[{"count":3}]}
941008: i=0 k=0 ka=[] l2= uuid=<0>
942008: i=1 k=0 ka=[] l2= uuid=<1>
943008: i=2 k=0 ka=[] l2= uuid=<2>
944009: done
7427f2a4 945]])
d18e52e3
BP
946
947# Check that ovsdb-idl figured out that table link2 and column l2 are missing.
948AT_CHECK([grep ovsdb_idl stderr | sort], [0], [dnl
949test-ovsdb|ovsdb_idl|idltest database lacks link2 table (database needs upgrade?)
079ace1f 950test-ovsdb|ovsdb_idl|idltest database lacks singleton table (database needs upgrade?)
d18e52e3
BP
951test-ovsdb|ovsdb_idl|link1 table in idltest database lacks l2 column (database needs upgrade?)
952])
953
954# Check that ovsdb-idl sent on "monitor" request and that it didn't
955# mention that table or column, and (for paranoia) that it did mention another
956# table and column.
1b1d2e6d 957AT_CHECK([grep -c '"monitor\|monitor_cond"' stderr], [0], [2
d18e52e3 958])
c383f3bf
LS
959AT_CHECK([grep '"monitor\|monitor_cond"' stderr | grep link2], [1])
960AT_CHECK([grep '"monitor\|monitor_cond"' stderr | grep l2], [1])
961AT_CHECK([grep '"monitor\|monitor_cond"' stderr | grep -c '"link1"'], [0], [1
d18e52e3 962])
c383f3bf 963AT_CHECK([grep '"monitor\|monitor_cond"' stderr | grep -c '"ua"'], [0], [1
d18e52e3
BP
964])
965OVSDB_SERVER_SHUTDOWN
966AT_CLEANUP
80c12152 967
f62a20d8
TR
968m4_define([OVSDB_CHECK_IDL_FETCH_COLUMNS_PYN],
969 [AT_SETUP([$1 fetch])
970 AT_SKIP_IF([test $8 = no])
80c12152 971 AT_KEYWORDS([ovsdb server idl positive Python increment fetch $6])
56120500 972 AT_CHECK([ovsdb_start_idltest])
80c12152 973 m4_if([$2], [], [],
7427f2a4 974 [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])])
e6703555 975 AT_CHECK([$9 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket [$3] $4],
7427f2a4 976 [0], [stdout], [ignore])
c724bd67 977 AT_CHECK([sort stdout | uuidfilt]m4_if([$7],,, [[| $7]]),
7427f2a4 978 [0], [$5])
80c12152
SA
979 OVSDB_SERVER_SHUTDOWN
980 AT_CLEANUP])
981
f62a20d8 982m4_define([OVSDB_CHECK_IDL_FETCH_COLUMNS_PY],
e6703555 983 [OVSDB_CHECK_IDL_FETCH_COLUMNS_PYN([$1 - Python2], [$2], [$3], [$4], [$5], [$6], [$7],
9ec53312 984 [$HAVE_PYTHON2], [$PYTHON2])
e6703555
IM
985 OVSDB_CHECK_IDL_FETCH_COLUMNS_PYN([$1 - Python3], [$2], [$3], [$4], [$5], [$6], [$7],
986 [$HAVE_PYTHON3], [$PYTHON3])])
f62a20d8 987
80c12152
SA
988m4_define([OVSDB_CHECK_IDL_FETCH_COLUMNS],
989 [OVSDB_CHECK_IDL_FETCH_COLUMNS_PY($@)])
990
991OVSDB_CHECK_IDL_FETCH_COLUMNS([simple idl, initially populated],
992 [['["idltest",
993 {"op": "insert",
994 "table": "simple",
995 "row": {"i": 1,
996 "r": 2.0,
997 "b": true,
998 "s": "mystring",
999 "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"],
1000 "ia": ["set", [1, 2, 3]],
1001 "ra": ["set", [-0.5]],
1002 "ba": ["set", [true]],
1003 "sa": ["set", ["abc", "def"]],
1004 "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
1005 ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
1006 {"op": "insert",
1007 "table": "simple",
1008 "row": {}}]']],
1009 [?simple:i,r!],
1010 ['fetch 0 r'],
1011 [[000: i=0 uuid=<0>
1012000: i=1 uuid=<1>
1013001: commit, status=success
1014002: i=0 r=0 uuid=<0>
1015002: i=1 uuid=<1>
1016003: done
1017]])
932104f4 1018
f62a20d8
TR
1019m4_define([OVSDB_CHECK_IDL_WO_MONITOR_COND_PYN],
1020 [AT_SETUP([$1])
1021 AT_SKIP_IF([test $6 = no])
897c8064 1022 AT_KEYWORDS([ovsdb server idl Python monitor $4])
56120500
BP
1023 AT_CHECK([ovsdb_start_idltest])
1024 AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/disable-monitor-cond])
e6703555 1025 AT_CHECK([$7 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket $2],
7ef00082 1026 [0], [stdout], [ignore])
c724bd67 1027 AT_CHECK([sort stdout | uuidfilt]m4_if([$5],,, [[| $5]]),
7ef00082 1028 [0], [$3])
897c8064
LS
1029 OVSDB_SERVER_SHUTDOWN
1030 AT_CLEANUP])
1031
f62a20d8 1032m4_define([OVSDB_CHECK_IDL_WO_MONITOR_COND_PY],
e6703555 1033 [OVSDB_CHECK_IDL_WO_MONITOR_COND_PYN([$1 - Python2], [$2], [$3], [$4], [$5],
9ec53312 1034 [$HAVE_PYTHON2], [$PYTHON2])
e6703555
IM
1035 OVSDB_CHECK_IDL_WO_MONITOR_COND_PYN([$1 - Python3], [$2], [$3], [$4], [$5],
1036 [$HAVE_PYTHON3], [$PYTHON3])])
f62a20d8 1037
897c8064
LS
1038
1039m4_define([OVSDB_CHECK_IDL_WO_MONITOR_COND],
1040 [OVSDB_CHECK_IDL_WO_MONITOR_COND_PY($@)])
1041
1042
1043OVSDB_CHECK_IDL_WO_MONITOR_COND([simple idl disable monitor-cond],
1044 [['["idltest",
1045 {"op": "insert",
1046 "table": "simple",
1047 "row": {"i": 1,
1048 "r": 2.0,
1049 "b": true,
1050 "s": "mystring",
1051 "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"],
1052 "ia": ["set", [1, 2, 3]],
1053 "ra": ["set", [-0.5]],
1054 "ba": ["set", [true]],
1055 "sa": ["set", ["abc", "def"]],
1056 "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
1057 ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
1058 {"op": "insert",
1059 "table": "simple",
1060 "row": {}}]' \
1061 '["idltest",
1062 {"op": "update",
1063 "table": "simple",
1064 "where": [],
1065 "row": {"b": true}}]' \
1066 '["idltest",
1067 {"op": "update",
1068 "table": "simple",
1069 "where": [],
1070 "row": {"r": 123.5}}]' \
1071 '["idltest",
1072 {"op": "insert",
1073 "table": "simple",
1074 "row": {"i": -1,
1075 "r": 125,
1076 "b": false,
1077 "s": "",
1078 "ia": ["set", [1]],
1079 "ra": ["set", [1.5]],
1080 "ba": ["set", [false]],
1081 "sa": ["set", []],
1082 "ua": ["set", []]}}]' \
1083 '["idltest",
1084 {"op": "update",
1085 "table": "simple",
1086 "where": [["i", "<", 1]],
1087 "row": {"s": "newstring"}}]' \
1088 '["idltest",
1089 {"op": "delete",
1090 "table": "simple",
1091 "where": [["i", "==", 0]]}]' \
1092 'reconnect']],
1093 [[000: empty
1094001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]}
1095002: i=0 r=0 b=false s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
1096002: 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>
1097003: {"error":null,"result":[{"count":2}]}
1098004: i=0 r=0 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
1099004: 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>
1100005: {"error":null,"result":[{"count":2}]}
1101006: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
1102006: 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>
1103007: {"error":null,"result":[{"uuid":["uuid","<6>"]}]}
1104008: i=-1 r=125 b=false s= u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
1105008: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
1106008: 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>
1107009: {"error":null,"result":[{"count":2}]}
1108010: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
1109010: i=0 r=123.5 b=true s=newstring u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
1110010: 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>
1111011: {"error":null,"result":[{"count":1}]}
1112012: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
1113012: 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>
1114013: reconnect
1115014: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
1116014: 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>
1117015: done
1118]])
1119
932104f4
SA
1120m4_define([OVSDB_CHECK_IDL_TRACK_C],
1121 [AT_SETUP([$1 - C])
1122 AT_KEYWORDS([ovsdb server idl tracking positive $5])
56120500 1123 AT_CHECK([ovsdb_start_idltest])
932104f4 1124 m4_if([$2], [], [],
7427f2a4 1125 [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])])
932104f4 1126 AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl unix:socket $3],
7427f2a4 1127 [0], [stdout], [ignore])
c724bd67 1128 AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]),
7427f2a4 1129 [0], [$4])
932104f4
SA
1130 OVSDB_SERVER_SHUTDOWN
1131 AT_CLEANUP])
1132
1133m4_define([OVSDB_CHECK_IDL_TRACK],
1134 [OVSDB_CHECK_IDL_TRACK_C($@)])
1135
1136OVSDB_CHECK_IDL_TRACK([track, simple idl, initially populated],
1137 [['["idltest",
1138 {"op": "insert",
1139 "table": "simple",
1140 "row": {"i": 1,
1141 "r": 2.0,
1142 "b": true,
1143 "s": "mystring",
1144 "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"],
1145 "ia": ["set", [1, 2, 3]],
1146 "ra": ["set", [-0.5]],
1147 "ba": ["set", [true]],
1148 "sa": ["set", ["abc", "def"]],
1149 "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
1150 ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
1151 {"op": "insert",
1152 "table": "simple",
1153 "row": {}}]']],
1154 [['["idltest",
1155 {"op": "update",
1156 "table": "simple",
1157 "where": [],
1158 "row": {"b": true}}]']],
1159 [[000: i=1 r=2 b=true s=mystring u=<0> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<1> <2>] uuid=<3>
32d37ce8 1160000: updated columns: b ba i ia r ra s sa u ua
932104f4
SA
1161001: {"error":null,"result":[{"count":2}]}
1162002: i=0 r=0 b=true s= u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<5>
1163002: i=1 r=2 b=true s=mystring u=<0> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<1> <2>] uuid=<3>
32d37ce8 1164002: updated columns: b
932104f4
SA
1165003: done
1166]])
1167
1168OVSDB_CHECK_IDL_TRACK([track, simple idl, initially empty, various ops],
1169 [],
1170 [['["idltest",
1171 {"op": "insert",
1172 "table": "simple",
1173 "row": {"i": 1,
1174 "r": 2.0,
1175 "b": true,
1176 "s": "mystring",
1177 "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"],
1178 "ia": ["set", [1, 2, 3]],
1179 "ra": ["set", [-0.5]],
1180 "ba": ["set", [true]],
1181 "sa": ["set", ["abc", "def"]],
1182 "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
1183 ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
1184 {"op": "insert",
1185 "table": "simple",
1186 "row": {}}]' \
1187 '["idltest",
1188 {"op": "update",
1189 "table": "simple",
1190 "where": [],
1191 "row": {"b": true}}]' \
1192 '["idltest",
1193 {"op": "update",
1194 "table": "simple",
1195 "where": [],
1196 "row": {"r": 123.5}}]' \
1197 '["idltest",
1198 {"op": "insert",
1199 "table": "simple",
1200 "row": {"i": -1,
1201 "r": 125,
1202 "b": false,
1203 "s": "",
1204 "ia": ["set", [1]],
1205 "ra": ["set", [1.5]],
1206 "ba": ["set", [false]],
1207 "sa": ["set", []],
1208 "ua": ["set", []]}}]' \
1209 '["idltest",
1210 {"op": "update",
1211 "table": "simple",
1212 "where": [["i", "<", 1]],
1213 "row": {"s": "newstring"}}]' \
1214 '["idltest",
1215 {"op": "delete",
1216 "table": "simple",
1217 "where": [["i", "==", 0]]}]' \
1218 'reconnect']],
1219 [[000: empty
1220001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]}
1221002: i=1 r=2 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<3> <4>] uuid=<0>
32d37ce8 1222002: updated columns: b ba i ia r ra s sa u ua
932104f4
SA
1223003: {"error":null,"result":[{"count":2}]}
1224004: i=0 r=0 b=true s= u=<5> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
32d37ce8 1225004: updated columns: b
932104f4
SA
1226005: {"error":null,"result":[{"count":2}]}
1227006: i=0 r=123.5 b=true s= u=<5> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
1228006: i=1 r=123.5 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<3> <4>] uuid=<0>
32d37ce8
SA
1229006: updated columns: r
1230006: updated columns: r
932104f4
SA
1231007: {"error":null,"result":[{"uuid":["uuid","<6>"]}]}
1232008: i=-1 r=125 b=false s= u=<5> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
32d37ce8 1233008: updated columns: ba i ia r ra
932104f4
SA
1234009: {"error":null,"result":[{"count":2}]}
1235010: i=-1 r=125 b=false s=newstring u=<5> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
1236010: i=0 r=123.5 b=true s=newstring u=<5> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
32d37ce8
SA
1237010: updated columns: s
1238010: updated columns: s
932104f4
SA
1239011: {"error":null,"result":[{"count":1}]}
1240012: ##deleted## uuid=<1>
1241013: reconnect
1242014: i=-1 r=125 b=false s=newstring u=<5> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
1243014: i=1 r=123.5 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<3> <4>] uuid=<0>
32d37ce8
SA
1244014: updated columns: b ba i ia r ra s sa u ua
1245014: updated columns: ba i ia r ra s
932104f4
SA
1246015: done
1247]])
7251075c
EA
1248
1249m4_define([OVSDB_CHECK_IDL_PARTIAL_UPDATE_MAP_COLUMN],
1250 [AT_SETUP([$1 - C])
1251 AT_KEYWORDS([ovsdb server idl partial update map column positive $5])
56120500 1252 AT_CHECK([ovsdb_start_idltest])
7251075c 1253 m4_if([$2], [], [],
7427f2a4 1254 [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])])
7251075c 1255 AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl-partial-update-map-column unix:socket $3],
7427f2a4 1256 [0], [stdout], [ignore])
c724bd67 1257 AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]),
7427f2a4 1258 [0], [$4])
7251075c
EA
1259 OVSDB_SERVER_SHUTDOWN
1260 AT_CLEANUP])
1261
1262OVSDB_CHECK_IDL_PARTIAL_UPDATE_MAP_COLUMN([map, simple2 idl-partial-update-map-column, initially populated],
1263[['["idltest", {"op":"insert", "table":"simple2",
1264 "row":{"name":"myString1","smap":["map",[["key1","value1"],["key2","value2"]]]} }]']
1265],
1266[],
1267[[000: Getting records
1268001: name=myString1 smap=[[key1 : value1],[key2 : value2]] imap=[]
1269002: After insert element
1270003: name=String2 smap=[[key1 : myList1],[key2 : value2]] imap=[[3 : myids2]]
1271004: After insert duplicated element
1272005: name=String2 smap=[[key1 : myList1],[key2 : value2]] imap=[[3 : myids2]]
1273006: After delete element
1274007: name=String2 smap=[[key2 : value2]] imap=[[3 : myids2]]
1275008: After trying to delete a deleted element
1276009: name=String2 smap=[[key2 : value2]] imap=[[3 : myids2]]
1277010: End test
1278]])
a7261bf7 1279
a59912a0
RM
1280OVSDB_CHECK_IDL_PY([partial-map idl],
1281[['["idltest", {"op":"insert", "table":"simple2",
330b9c9c 1282 "row":{"name":"myString1","smap":["map",[["key1","value1"],["key2","value2"]]]} }]']
a59912a0 1283],
2d54d801 1284 [?simple2:name,smap,imap 'partialmapinsertelement' 'partialmapinsertmultipleelements' 'partialmapdelelements' 'partialmapmutatenew'],
330b9c9c 1285[[000: name=myString1 smap=[(key1 value1) (key2 value2)] imap=[]
a59912a0 1286001: commit, status=success
330b9c9c 1287002: name=String2 smap=[(key1 myList1) (key2 value2)] imap=[(3 myids2)]
a59912a0 1288003: commit, status=success
2d54d801 1289004: name=String2 smap=[(key1 myList1) (key2 myList2) (key3 myList3) (key4 myList4)] imap=[(3 myids2)]
330b9c9c
AB
1290005: commit, status=success
1291006: name=String2 smap=[(key2 myList2)] imap=[(3 myids2)]
2d54d801
AB
1292007: commit, status=success
1293008: name=String2 smap=[(key2 myList2)] imap=[(3 myids2)]
1294008: name=String2New smap=[(key1 newList1) (key2 newList2)] imap=[]
1295009: done
a59912a0
RM
1296]])
1297
f1ab6e06
RM
1298m4_define([OVSDB_CHECK_IDL_PARTIAL_UPDATE_SET_COLUMN],
1299 [AT_SETUP([$1 - C])
1300 AT_KEYWORDS([ovsdb server idl partial update set column positive $5])
56120500 1301 AT_CHECK([ovsdb_start_idltest])
f1ab6e06
RM
1302 m4_if([$2], [], [],
1303 [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])])
1304 AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl-partial-update-set-column unix:socket $3],
1305 [0], [stdout], [ignore])
c724bd67 1306 AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]),
f1ab6e06
RM
1307 [0], [$4])
1308 OVSDB_SERVER_SHUTDOWN
1309 AT_CLEANUP])
1310
1311OVSDB_CHECK_IDL_PARTIAL_UPDATE_SET_COLUMN([set, simple3 idl-partial-update-set-column, initially populated],
1312[['["idltest", {"op":"insert", "table":"simple3",
1313 "row":{"name":"mySet1","uset":["set", [[ "uuid", "0005b872-f9e5-43be-ae02-3184b9680e75" ], [ "uuid", "000d2f6a-76af-412f-b59d-e7bcd3e84eff" ]]]} }]']
1314],
1315[],
1316[[000: Getting records
1317001: name=mySet1 uset=[[<0>],[<1>]] uref=[]
1318002: After rename+add new value
1319003: name=String2 uset=[[<0>],[<1>],[<2>]] uref=[]
1320004: After add new value
1321005: name=String2 uset=[[<0>],[<1>],[<2>],[<3>]] uref=[]
1322006: After delete value
1323007: name=String2 uset=[[<0>],[<1>],[<3>]] uref=[]
1324008: After trying to delete a deleted value
1325009: name=String2 uset=[[<0>],[<1>],[<3>]] uref=[]
1326010: After add to other table + set of strong ref
1327011: name=String2 uset=[[<0>],[<1>],[<3>]] uref=[[<4>]]
1328012: End test
1329]])
1330
a59912a0 1331OVSDB_CHECK_IDL_PY([partial-set idl],
b3220c67
AB
1332[['["idltest", {"op":"insert", "table":"simple3", "uuid-name":"newrow",
1333 "row":{"name":"mySet1","uset":["set", [[ "uuid", "0005b872-f9e5-43be-ae02-3184b9680e75" ]]]} },
1334 {"op":"insert", "table":"simple4", "row":{"name":"seed"}},
1335 {"op":"mutate", "table":"simple3", "where":[["_uuid", "==", ["named-uuid", "newrow"]]],
1336 "mutations": [["uset", "insert", ["set", [["uuid", "000d2f6a-76af-412f-b59d-e7bcd3e84eff"]]]]]}]']
a59912a0 1337],
2d54d801 1338 ['partialrenamesetadd' 'partialduplicateadd' 'partialsetdel' 'partialsetref' 'partialsetoverrideops' 'partialsetadddelete' 'partialsetmutatenew'],
a59912a0
RM
1339[[000: name=mySet1 uset=[<0> <1>]
1340001: commit, status=success
1341002: name=String2 uset=[<0> <1> <2>]
1342003: commit, status=success
1343004: name=String2 uset=[<0> <1> <2> <3>]
1344005: commit, status=success
1345006: name=String2 uset=[<0> <1> <3>]
1346007: commit, status=success
1347008: name=String2 uset=[<0> <1> <3>]
330b9c9c
AB
1348009: commit, status=success
1349010: name=String2 uset=[<3>]
b3220c67 1350011: commit, status=success
2d54d801
AB
1351012: name=String2 uset=[<4> <5>]
1352013: commit, status=success
1353014: name=String2 uset=[<4> <5>]
1354014: name=String3 uset=[<6>]
1355015: done
a59912a0
RM
1356]])
1357
f62a20d8 1358m4_define([OVSDB_CHECK_IDL_NOTIFY_PYN],
e6703555 1359 [OVSDB_CHECK_IDL_PYN([$1], [], [$2], [$3], [notify $4], [$5], [$6], [$7])])
a7261bf7 1360
f62a20d8
TR
1361m4_define([OVSDB_CHECK_IDL_NOTIFY_PY],
1362 [OVSDB_CHECK_IDL_NOTIFY_PYN([$1 - Python2], [$2], [$3], [$4], [$5],
9ec53312 1363 [$HAVE_PYTHON2], [$PYTHON2])
f62a20d8
TR
1364 OVSDB_CHECK_IDL_NOTIFY_PYN([$1 - Python3], [$2], [$3], [$4], [$5],
1365 [$HAVE_PYTHON3], [$PYTHON3])])
1366
d90ed7d6 1367# This test uses the Python IDL implementation with ssl
f62a20d8 1368m4_define([OVSDB_CHECK_IDL_NOTIFY_SSL_PYN],
e6703555 1369 [OVSDB_CHECK_IDL_SSL_PYN([$1], [], [$2], [$3], [notify $4], [$5], [$6], [$7])])
a7261bf7 1370
f62a20d8
TR
1371m4_define([OVSDB_CHECK_IDL_NOTIFY_SSL_PY],
1372 [OVSDB_CHECK_IDL_NOTIFY_SSL_PYN([$1 - Python2], [$2], [$3], [$4], [$5],
9ec53312 1373 [$HAVE_PYTHON2], [$PYTHON2])
f62a20d8
TR
1374 OVSDB_CHECK_IDL_NOTIFY_SSL_PYN([$1 - Python3], [$2], [$3], [$4], [$5],
1375 [$HAVE_PYTHON3], [$PYTHON3])])
1376
a7261bf7 1377m4_define([OVSDB_CHECK_IDL_NOTIFY],
d90ed7d6
NS
1378 [OVSDB_CHECK_IDL_NOTIFY_PY($@)
1379 OVSDB_CHECK_IDL_NOTIFY_SSL_PY($@)])
a7261bf7
NS
1380
1381OVSDB_CHECK_IDL_NOTIFY([simple idl verify notify],
1382 [['track-notify' \
1383 '["idltest",
1384 {"op": "insert",
1385 "table": "simple",
1386 "row": {"i": 1,
1387 "r": 2.0,
1388 "b": true,
1389 "s": "mystring",
1390 "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"],
1391 "ia": ["set", [1, 2, 3]],
1392 "ra": ["set", [-0.5]],
1393 "ba": ["set", [true]],
1394 "sa": ["set", ["abc", "def"]],
1395 "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
1396 ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
1397 {"op": "insert",
1398 "table": "simple",
1399 "row": {}}]' \
1400 '["idltest",
1401 {"op": "update",
1402 "table": "simple",
1403 "where": [],
1404 "row": {"b": false}}]' \
1405 '["idltest",
1406 {"op": "update",
1407 "table": "simple",
1408 "where": [],
1409 "row": {"r": 123.5}}]' \
1410 '["idltest",
1411 {"op": "insert",
1412 "table": "simple",
1413 "row": {"i": -1,
1414 "r": 125,
1415 "b": false,
1416 "s": "",
1417 "ia": ["set", [1]],
1418 "ra": ["set", [1.5]],
1419 "ba": ["set", [false]],
1420 "sa": ["set", []],
1421 "ua": ["set", []]}}]' \
1422 '["idltest",
1423 {"op": "update",
1424 "table": "simple",
1425 "where": [["i", "<", 1]],
1426 "row": {"s": "newstring"}}]' \
1427 '["idltest",
1428 {"op": "delete",
1429 "table": "simple",
1430 "where": [["i", "==", 0]]}]' \
1431 'reconnect']],
1432 [[000: empty
1433001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]}
1434002: event:create, row={i=0 r=0 b=false s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>}, updates=None
1435002: event:create, row={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>}, updates=None
1436002: i=0 r=0 b=false s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
1437002: 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>
1438003: {"error":null,"result":[{"count":2}]}
1439004: event:update, row={i=1 r=2 b=false s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0>}, updates={b=true uuid=<0>}
1440004: i=0 r=0 b=false s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
1441004: i=1 r=2 b=false s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0>
1442005: {"error":null,"result":[{"count":2}]}
1443006: event:update, row={i=0 r=123.5 b=false s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>}, updates={r=0 uuid=<1>}
1444006: event:update, row={i=1 r=123.5 b=false s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0>}, updates={r=2 uuid=<0>}
1445006: i=0 r=123.5 b=false s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
1446006: i=1 r=123.5 b=false s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0>
1447007: {"error":null,"result":[{"uuid":["uuid","<6>"]}]}
1448008: event:create, row={i=-1 r=125 b=false s= u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>}, updates=None
1449008: i=-1 r=125 b=false s= u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
1450008: i=0 r=123.5 b=false s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
1451008: i=1 r=123.5 b=false s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0>
1452009: {"error":null,"result":[{"count":2}]}
1453010: event:update, row={i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>}, updates={s= uuid=<6>}
1454010: event:update, row={i=0 r=123.5 b=false s=newstring u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>}, updates={s= uuid=<1>}
1455010: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
1456010: i=0 r=123.5 b=false s=newstring u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
1457010: i=1 r=123.5 b=false s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0>
1458011: {"error":null,"result":[{"count":1}]}
1459012: event:delete, row={i=0 r=123.5 b=false s=newstring u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>}, updates=None
1460012: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
1461012: i=1 r=123.5 b=false s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0>
1462013: reconnect
1463014: event:create, row={i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>}, updates=None
1464014: event:create, row={i=1 r=123.5 b=false s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0>}, updates=None
1465014: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
1466014: i=1 r=123.5 b=false s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0>
1467015: done
1468]])
0a8606ee
LR
1469
1470# Tests to verify the functionality of the one column compound index.
1471# It tests index for one column string and integer indexes.
1472# The run of test-ovsdb generates the output of the display of data using the different indexes defined in
1473# the program.
1474# Then, some at_checks are used to verify the correctness of the corresponding index as well as the existence
1475# of all the rows involved in the test.
1476m4_define([OVSDB_CHECK_IDL_COMPOUND_INDEX_SINGLE_COLUMN_C],
1477 [AT_SETUP([$1 - C])
1478 AT_KEYWORDS([ovsdb server idl compound_index_single_column compound_index positive $5])
1479 AT_CHECK([ovsdb_start_idltest])
1480 m4_if([$2], [], [],
7ef00082 1481 [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])])
0a8606ee
LR
1482# Generate the data to be tested.
1483 AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl-compound-index unix:socket $3],
7ef00082 1484 [0], [stdout], [ignore])
0a8606ee
LR
1485# Filter the rows of data that corresponds to the string index eliminating the extra columns of data.
1486# This is done to verifiy that the output data is in the correct and expected order.
1487 AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: s=.*' | sed -e 's/ i=.*//g']],
7ef00082 1488 [0], [$4])
0a8606ee
LR
1489# Here, the data is filtered and sorted in order to have all the rows in the index and be
1490# able to determined that all the involved rows are present.
1491 AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: s=.*' | sort -k 1,1n -k 2,2 -k 3,3]],
7ef00082 1492 [0], [$5])
0a8606ee
LR
1493# Filter the rows of data that corresponds to the integer index eliminating the extra columns of data.
1494# This is done to verifiy that the output data is in the correct and expected order.
1495 AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: i=.*' | sed -e 's/ s=.*//g']],
7ef00082 1496 [0], [$6])
0a8606ee
LR
1497# Here again, the data is filtered and sorted in order to have all the rows in the index and be
1498# able to determined that all the involved rows are present.
1499 AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: i=.*' | sort -k 1,1n -k 2,2 -k 3,3]],
7ef00082 1500 [0], [$7])
0a8606ee
LR
1501 OVSDB_SERVER_SHUTDOWN
1502 AT_CLEANUP])
1503
1504OVSDB_CHECK_IDL_COMPOUND_INDEX_SINGLE_COLUMN_C([Compound_index, single column test ],
1505 [['["idltest",
1506 {"op": "insert", "table": "simple", "row": {"s":"List000", "i": 1, "b":true, "r":101.0}},
1507 {"op": "insert", "table": "simple", "row": {"s":"List000", "i": 2, "b":false, "r":102.0}},
1508 {"op": "insert", "table": "simple", "row": {"s":"List000", "i": 10, "b":true, "r":110.0}},
1509 {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 1, "b":false, "r":110.0}},
1510 {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 2, "b":true, "r":120.0}},
1511 {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 2, "b":true, "r":122.0}},
1512 {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 4, "b":true, "r":130.0}},
1513 {"op": "insert", "table": "simple", "row": {"s":"List005", "i": 5, "b":true, "r":130.0}},
1514 {"op": "insert", "table": "simple", "row": {"s":"List020", "i": 20, "b":true, "r":220.0}},
1515 {"op": "insert", "table": "simple", "row": {"s":"List020", "i": 19, "b":true, "r":219.0}}
1516 ]']],
1517 [idl_compound_index_single_column],
1518 [001: s=List000
1519001: s=List000
1520001: s=List000
1521001: s=List001
1522001: s=List001
1523001: s=List001
1524001: s=List001
1525001: s=List005
1526001: s=List020
1527001: s=List020
1528003: s=List001
1529003: s=List001
1530003: s=List001
1531003: s=List001
1532],
1533[001: s=List000 i=1 b=True r=101.000000
1534001: s=List000 i=10 b=True r=110.000000
1535001: s=List000 i=2 b=False r=102.000000
1536001: s=List001 i=1 b=False r=110.000000
1537001: s=List001 i=2 b=True r=120.000000
1538001: s=List001 i=2 b=True r=122.000000
1539001: s=List001 i=4 b=True r=130.000000
1540001: s=List005 i=5 b=True r=130.000000
1541001: s=List020 i=19 b=True r=219.000000
1542001: s=List020 i=20 b=True r=220.000000
1543003: s=List001 i=1 b=False r=110.000000
1544003: s=List001 i=2 b=True r=120.000000
1545003: s=List001 i=2 b=True r=122.000000
1546003: s=List001 i=4 b=True r=130.000000
1547],
1548[002: i=1
1549002: i=1
1550002: i=2
1551002: i=2
1552002: i=2
1553002: i=4
1554002: i=5
1555002: i=10
1556002: i=19
1557002: i=20
1558004: i=5
1559005: i=4
1560005: i=5
1561006: i=5
1562006: i=10
1563006: i=19
1564006: i=20
1565006: i=54
0a8606ee 1566007: i=5
0a8606ee
LR
1567007: i=19
1568007: i=20
d0bde286 1569007: i=30
0a8606ee 1570007: i=54
d0bde286
HZ
1571008: i=1
1572008: i=1
1573008: i=2
1574008: i=2
1575008: i=2
1576008: i=5
1577008: i=19
1578008: i=20
1579008: i=30
1580008: i=54
0a8606ee
LR
1581],
1582[002: i=1 s=List000 b=True r=101.000000
1583002: i=1 s=List001 b=False r=110.000000
1584002: i=10 s=List000 b=True r=110.000000
1585002: i=19 s=List020 b=True r=219.000000
1586002: i=2 s=List000 b=False r=102.000000
1587002: i=2 s=List001 b=True r=120.000000
1588002: i=2 s=List001 b=True r=122.000000
1589002: i=20 s=List020 b=True r=220.000000
1590002: i=4 s=List001 b=True r=130.000000
1591002: i=5 s=List005 b=True r=130.000000
1592004: i=5 s=List005 b=True r=130.000000
1593005: i=4 s=List001 b=True r=130.000000
1594005: i=5 s=List005 b=True r=130.000000
1595006: i=10 s=List000 b=True r=110.000000
1596006: i=19 s=List020 b=True r=219.000000
1597006: i=20 s=List020 b=True r=220.000000
1598006: i=5 s=List005 b=True r=130.000000
1599006: i=54 s=Lista054 b=False r=0.000000
0a8606ee 1600007: i=19 s=List020 b=True r=219.000000
0a8606ee 1601007: i=20 s=List020 b=True r=220.000000
d0bde286 1602007: i=30 s=List000 b=True r=110.000000
0a8606ee
LR
1603007: i=5 s=List005 b=True r=130.000000
1604007: i=54 s=Lista054 b=False r=0.000000
d0bde286
HZ
1605008: i=1 s=List000 b=True r=101.000000
1606008: i=1 s=List001 b=False r=110.000000
1607008: i=19 s=List020 b=True r=219.000000
1608008: i=2 s=List000 b=False r=102.000000
1609008: i=2 s=List001 b=True r=120.000000
1610008: i=2 s=List001 b=True r=122.000000
1611008: i=20 s=List020 b=True r=220.000000
1612008: i=30 s=List000 b=True r=110.000000
1613008: i=5 s=List005 b=True r=130.000000
1614008: i=54 s=Lista054 b=False r=0.000000
0a8606ee
LR
1615])
1616
1617# Tests to verify the functionality of two column compound index.
1618# It tests index for two columns using string and integer fields.
1619# The run of test-ovsdb generates the output of the display of data using the different indexes defined in
1620# the program.
1621# Then, some at_checks are used to verify the correctness of the corresponding index as well as the existence
1622# of all the rows involved in the test.
1623m4_define([OVSDB_CHECK_IDL_COMPOUND_INDEX_DOUBLE_COLUMN_C],
1624 [AT_SETUP([$1 - C])
1625 AT_KEYWORDS([ovsdb server idl compound_index_double_column compound_index positive $5])
1626 AT_CHECK([ovsdb_start_idltest])
1627 m4_if([$2], [], [],
7ef00082 1628 [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])])
0a8606ee
LR
1629# Generate the data to be tested.
1630 AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl-compound-index unix:socket $3],
7ef00082 1631 [0], [stdout], [ignore])
0a8606ee
LR
1632# Filter the rows of data that corresponds to the string-integer index eliminating the extra columns of data.
1633# This is done to verifiy that the output data is in the correct and expected order.
1634 AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: s=.*' | sed -e 's/ b=.*//g']],
7ef00082 1635 [0], [$4])
0a8606ee
LR
1636# Here, the data is filtered and sorted in order to have all the rows in the index and be
1637# able to determined that all the involved rows are present.
1638 AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: s=.*' | sort -k 1,1n -k 2,2 -k 3,3]],
7ef00082 1639 [0], [$5])
0a8606ee
LR
1640# Filter the rows of data that corresponds to the integer index eliminating the extra columns of data.
1641# This is done to verifiy that the output data is in the correct and expected order.
1642 AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: i=.*' | sed -e 's/ b=.*//g']],
7ef00082 1643 [0], [$6])
0a8606ee
LR
1644# Here again, the data is filtered and sorted in order to have all the rows in the index and be
1645# able to determined that all the involved rows are present.
1646 AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: i=.*' | sort -k 1,1n -k 2,2 -k 3,3]],
7ef00082 1647 [0], [$7])
0a8606ee
LR
1648 OVSDB_SERVER_SHUTDOWN
1649 AT_CLEANUP])
1650
1651OVSDB_CHECK_IDL_COMPOUND_INDEX_DOUBLE_COLUMN_C([Compound_index, double column test ],
1652 [['["idltest",
1653 {"op": "insert", "table": "simple", "row": {"s":"List000", "i": 1, "b":true, "r":101.0}},
1654 {"op": "insert", "table": "simple", "row": {"s":"List000", "i": 2, "b":false, "r":102.0}},
1655 {"op": "insert", "table": "simple", "row": {"s":"List000", "i": 10, "b":true, "r":110.0}},
1656 {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 1, "b":false, "r":110.0}},
1657 {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 2, "b":true, "r":120.0}},
1658 {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 2, "b":true, "r":122.0}},
1659 {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 4, "b":true, "r":130.0}},
1660 {"op": "insert", "table": "simple", "row": {"s":"List005", "i": 5, "b":true, "r":130.0}},
1661 {"op": "insert", "table": "simple", "row": {"s":"List020", "i": 20, "b":true, "r":220.0}},
1662 {"op": "insert", "table": "simple", "row": {"s":"List020", "i": 19, "b":true, "r":219.0}}
1663 ]']],
1664 [idl_compound_index_double_column],
1665 [001: s=List000 i=1
1666001: s=List000 i=2
1667001: s=List000 i=10
1668001: s=List001 i=1
1669001: s=List001 i=2
1670001: s=List001 i=2
1671001: s=List001 i=4
1672001: s=List005 i=5
1673001: s=List020 i=19
1674001: s=List020 i=20
1675002: s=List000 i=10
1676002: s=List000 i=2
1677002: s=List000 i=1
1678002: s=List001 i=4
1679002: s=List001 i=2
1680002: s=List001 i=2
1681002: s=List001 i=1
1682002: s=List005 i=5
1683002: s=List020 i=20
1684002: s=List020 i=19
1685003: s=List000 i=10
1686004: s=List001 i=1
1687004: s=List001 i=2
1688004: s=List001 i=2
1689004: s=List001 i=4
1690004: s=List005 i=5
1691],
1692 [001: s=List000 i=1 b=True r=101.000000
1693001: s=List000 i=10 b=True r=110.000000
1694001: s=List000 i=2 b=False r=102.000000
1695001: s=List001 i=1 b=False r=110.000000
1696001: s=List001 i=2 b=True r=120.000000
1697001: s=List001 i=2 b=True r=122.000000
1698001: s=List001 i=4 b=True r=130.000000
1699001: s=List005 i=5 b=True r=130.000000
1700001: s=List020 i=19 b=True r=219.000000
1701001: s=List020 i=20 b=True r=220.000000
1702002: s=List000 i=1 b=True r=101.000000
1703002: s=List000 i=10 b=True r=110.000000
1704002: s=List000 i=2 b=False r=102.000000
1705002: s=List001 i=1 b=False r=110.000000
1706002: s=List001 i=2 b=True r=120.000000
1707002: s=List001 i=2 b=True r=122.000000
1708002: s=List001 i=4 b=True r=130.000000
1709002: s=List005 i=5 b=True r=130.000000
1710002: s=List020 i=19 b=True r=219.000000
1711002: s=List020 i=20 b=True r=220.000000
1712003: s=List000 i=10 b=True r=110.000000
1713004: s=List001 i=1 b=False r=110.000000
1714004: s=List001 i=2 b=True r=120.000000
1715004: s=List001 i=2 b=True r=122.000000
1716004: s=List001 i=4 b=True r=130.000000
1717004: s=List005 i=5 b=True r=130.000000
1718],
1719 [005: i=1 s=List000
1720005: i=1 s=List001
1721005: i=2 s=List000
1722005: i=2 s=List001
1723005: i=2 s=List001
1724005: i=4 s=List001
1725005: i=5 s=List005
1726005: i=10 s=List000
1727005: i=19 s=List020
1728005: i=20 s=List020
1729006: i=20 s=List020
1730006: i=19 s=List020
1731006: i=10 s=List000
1732006: i=5 s=List005
1733006: i=4 s=List001
1734006: i=2 s=List000
1735006: i=2 s=List001
1736006: i=2 s=List001
1737006: i=1 s=List000
1738006: i=1 s=List001
1739],
1740 [005: i=1 s=List000 b=True r=101.000000
1741005: i=1 s=List001 b=False r=110.000000
1742005: i=10 s=List000 b=True r=110.000000
1743005: i=19 s=List020 b=True r=219.000000
1744005: i=2 s=List000 b=False r=102.000000
1745005: i=2 s=List001 b=True r=120.000000
1746005: i=2 s=List001 b=True r=122.000000
1747005: i=20 s=List020 b=True r=220.000000
1748005: i=4 s=List001 b=True r=130.000000
1749005: i=5 s=List005 b=True r=130.000000
1750006: i=1 s=List000 b=True r=101.000000
1751006: i=1 s=List001 b=False r=110.000000
1752006: i=10 s=List000 b=True r=110.000000
1753006: i=19 s=List020 b=True r=219.000000
1754006: i=2 s=List000 b=False r=102.000000
1755006: i=2 s=List001 b=True r=120.000000
1756006: i=2 s=List001 b=True r=122.000000
1757006: i=20 s=List020 b=True r=220.000000
1758006: i=4 s=List001 b=True r=130.000000
1759006: i=5 s=List005 b=True r=130.000000
1760])
3cc1634f
HZ
1761
1762m4_define([OVSDB_CHECK_IDL_COMPOUND_INDEX_WITH_REF],
1763 [AT_SETUP([$1 - C])
1764 AT_KEYWORDS([ovsdb server idl compound_index compound_index_with_ref positive $5])
1765 AT_CHECK([ovsdb_start_idltest])
1766 m4_if([$2], [], [],
1767 [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])])
1768 AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl-compound-index-with-ref unix:socket $3],
1769 [0], [stdout], [ignore])
c724bd67 1770 AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]),
3cc1634f
HZ
1771 [0], [$4])
1772 OVSDB_SERVER_SHUTDOWN
1773 AT_CLEANUP])
1774
1775OVSDB_CHECK_IDL_COMPOUND_INDEX_WITH_REF([set, simple3 idl-compound-index-with-ref, initially populated],
1776[],
1777[],
1778[[000: After add to other table + set of strong ref
1779001: name= uset=[] uref=[[<0>]]
1780002: check simple4: not empty
1781003: Query using index with reference
1782004: name= uset=[] uref=[[<0>]]
1783005: After delete
1784007: check simple4: empty
1785008: End test
1786]])
c1aa16d1 1787
cfef5ae8
IM
1788m4_define([CHECK_STREAM_OPEN_BLOCK],
1789 [AT_SETUP([Check Stream open block - C - $1])
1790 AT_SKIP_IF([test "$1" = "tcp6" && test "$IS_WIN32" = "yes"])
1791 AT_SKIP_IF([test "$1" = "tcp6" && test "$HAVE_IPV6" = "no"])
1792 AT_KEYWORDS([Check Stream open block $1])
1793 AT_CHECK([ovsdb_start_idltest "ptcp:0:$2"])
1794 PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT])
1795 WRONG_PORT=$(($TCP_PORT+1))
1796 AT_CHECK([test-stream tcp:$2:$TCP_PORT], [0], [ignore])
1797 AT_CHECK([test-stream tcp:$2:$WRONG_PORT], [1], [ignore], [ignore])
1798 OVSDB_SERVER_SHUTDOWN
1799 AT_CHECK([test-stream tcp:$2:$TCP_PORT], [1], [ignore], [ignore])
1800 AT_CLEANUP])
1801
1802CHECK_STREAM_OPEN_BLOCK([tcp], [127.0.0.1])
1803CHECK_STREAM_OPEN_BLOCK([tcp6], [[[::1]]])
1804
c1aa16d1
NS
1805m4_define([CHECK_STREAM_OPEN_BLOCK_PY],
1806 [AT_SETUP([$1])
1807 AT_SKIP_IF([test $2 = no])
1808 AT_KEYWORDS([Check PY Stream open block - $3])
1809 AT_CHECK([ovsdb_start_idltest "ptcp:0:127.0.0.1"])
1810 PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT])
1811 WRONG_PORT=$(($TCP_PORT+1))
1812 AT_CHECK([$3 $srcdir/test-stream.py tcp:127.0.0.1:$TCP_PORT], [0], [ignore])
1813 AT_CHECK([$3 $srcdir/test-stream.py tcp:127.0.0.1:$WRONG_PORT], [1], [ignore])
1814 OVSDB_SERVER_SHUTDOWN
1815 AT_CHECK([$3 $srcdir/test-stream.py tcp:127.0.0.1:$TCP_PORT], [1], [ignore])
1816 AT_CLEANUP])
1817
1dd218ae
BP
1818CHECK_STREAM_OPEN_BLOCK_PY([Check PY2 Stream open block], [$HAVE_PYTHON2], [$PYTHON2])
1819CHECK_STREAM_OPEN_BLOCK_PY([Check PY3 Stream open block], [$HAVE_PYTHON3], [$PYTHON3])