]> git.proxmox.com Git - ovs.git/blame - tests/ovsdb-idl.at
system-kmod-macros: Load TFTP module.
[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])
5c6d0628 40 AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]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])])
963f66b5 53 AT_CHECK([$8 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket $3],
7427f2a4 54 [0], [stdout], [ignore])
5c6d0628 55 AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]),
7427f2a4 56 [0], [$4])
8cdf0349
BP
57 OVSDB_SERVER_SHUTDOWN
58 AT_CLEANUP])
59
963f66b5
RB
60m4_define([OVSDB_CHECK_IDL_PY],
61 [OVSDB_CHECK_IDL_PYN([$1 - Python2], [$2], [$3], [$4], [$5], [$6],
62 [$HAVE_PYTHON], [$PYTHON])
63 OVSDB_CHECK_IDL_PYN([$1 - Python3], [$2], [$3], [$4], [$5], [$6],
64 [$HAVE_PYTHON3], [$PYTHON3])])
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])])
963f66b5 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 $3],
7427f2a4 74 [0], [stdout], [ignore])
01dc1516 75 AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]),
7427f2a4 76 [0], [$4])
01dc1516
SA
77 OVSDB_SERVER_SHUTDOWN
78 AT_CLEANUP])
79
963f66b5
RB
80m4_define([OVSDB_CHECK_IDL_REGISTER_COLUMNS_PY],
81 [OVSDB_CHECK_IDL_REGISTER_COLUMNS_PYN([$1 - Python2], [$2], [$3], [$4], [$5], [$6],
82 [$HAVE_PYTHON], [$PYTHON])
83 OVSDB_CHECK_IDL_REGISTER_COLUMNS_PYN([$1 - Python3], [$2], [$3], [$4], [$5], [$6],
84 [$HAVE_PYTHON3], [$PYTHON3])])
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])])
963f66b5 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])
5c6d0628 98 AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]),
7427f2a4 99 [0], [$4])
e06d06a7
IY
100 OVSDB_SERVER_SHUTDOWN
101 AT_CLEANUP])
102
963f66b5
RB
103m4_define([OVSDB_CHECK_IDL_TCP_PY],
104 [OVSDB_CHECK_IDL_TCP_PYN([$1 - Python2], [$2], [$3], [$4], [$5], [$6],
105 [$HAVE_PYTHON], [$PYTHON])
106 OVSDB_CHECK_IDL_TCP_PYN([$1 - Python3], [$2], [$3], [$4], [$5], [$6],
107 [$HAVE_PYTHON3], [$PYTHON3])])
108
e731d71b 109# same as OVSDB_CHECK_IDL but uses the Python IDL implementation with tcp6
963f66b5
RB
110m4_define([OVSDB_CHECK_IDL_TCP6_PYN],
111 [AT_SETUP([$1 - tcp6])
112 AT_SKIP_IF([test $7 = no])
7b9d1b65 113 AT_SKIP_IF([test "$IS_WIN32" = "yes"])
4819b3a5 114 AT_SKIP_IF([test $HAVE_IPV6 = no])
e731d71b 115 AT_KEYWORDS([ovsdb server idl positive Python with tcp6 socket $5])
56120500 116 AT_CHECK([ovsdb_start_idltest "ptcp:0:[[::1]]"])
fb28ef2d 117 PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT])
e731d71b
AS
118 echo "TCP_PORT=$TCP_PORT"
119
120 m4_if([$2], [], [],
7427f2a4 121 [AT_CHECK([ovsdb-client transact "tcp:[[::1]]:$TCP_PORT" $2], [0], [ignore], [ignore])])
963f66b5 122 AT_CHECK([$8 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema tcp:[[::1]]:$TCP_PORT $3],
7427f2a4 123 [0], [stdout], [ignore])
e731d71b 124 AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]),
7427f2a4 125 [0], [$4])
e731d71b
AS
126 OVSDB_SERVER_SHUTDOWN
127 AT_CLEANUP])
128
963f66b5
RB
129m4_define([OVSDB_CHECK_IDL_TCP6_PY],
130 [OVSDB_CHECK_IDL_TCP6_PYN([$1 - Python2], [$2], [$3], [$4], [$5], [$6],
131 [$HAVE_PYTHON], [$PYTHON])
132 OVSDB_CHECK_IDL_TCP6_PYN([$1 - Python3], [$2], [$3], [$4], [$5], [$6],
133 [$HAVE_PYTHON3], [$PYTHON3])])
134
8cdf0349
BP
135m4_define([OVSDB_CHECK_IDL],
136 [OVSDB_CHECK_IDL_C($@)
e06d06a7 137 OVSDB_CHECK_IDL_PY($@)
01dc1516 138 OVSDB_CHECK_IDL_REGISTER_COLUMNS_PY($@)
e731d71b
AS
139 OVSDB_CHECK_IDL_TCP_PY($@)
140 OVSDB_CHECK_IDL_TCP6_PY($@)])
8cdf0349 141
af358237
OBY
142# This test uses the Python IDL implementation with passive tcp
143m4_define([OVSDB_CHECK_IDL_PASSIVE_TCP_PY],
144 [AT_SETUP([$1 - Python ptcp])
145 AT_SKIP_IF([test $HAVE_PYTHON = no])
146 AT_KEYWORDS([ovsdb server idl positive Python with tcp socket $5])
af358237 147 # find free TCP port
56120500 148 AT_CHECK([ovsdb_start_idltest "ptcp:0:127.0.0.1"])
af358237 149 PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT])
7427f2a4 150 OVSDB_SERVER_SHUTDOWN
56120500 151 rm -f db
af358237
OBY
152
153 # start OVSDB server in passive mode
56120500 154 AT_CHECK([ovsdb_start_idltest "tcp:127.0.0.1:$TCP_PORT"])
af358237 155 AT_CHECK([$PYTHON $srcdir/test-ovsdb.py -t10 idl_passive $srcdir/idltest.ovsschema ptcp:127.0.0.1:$TCP_PORT $3],
7427f2a4 156 [0], [stdout], [ignore])
af358237 157 AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]),
7427f2a4
DDP
158 [0], [$4])
159 OVSDB_SERVER_SHUTDOWN
af358237
OBY
160 AT_CLEANUP
161 ])
162
163OVSDB_CHECK_IDL_PASSIVE_TCP_PY([simple passive idl, initially empty, select empty],
164 [],
165 [['["idltest",{"op":"select","table":"link1","where":[]}]']],
166 [[000: empty
167001: {"error":null,"result":[{"rows":[]}]}
168002: done
169]])
170
c3bb4bd7
BP
171OVSDB_CHECK_IDL([simple idl, initially empty, no ops],
172 [],
173 [],
174 [000: empty
175001: done
176])
177
178OVSDB_CHECK_IDL([simple idl, initially empty, various ops],
179 [],
9cb53f26
BP
180 [['["idltest",
181 {"op": "insert",
c3bb4bd7
BP
182 "table": "simple",
183 "row": {"i": 1,
184 "r": 2.0,
185 "b": true,
186 "s": "mystring",
187 "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"],
188 "ia": ["set", [1, 2, 3]],
189 "ra": ["set", [-0.5]],
7fae24e6 190 "ba": ["set", [true]],
8cdf0349 191 "sa": ["set", ["abc", "def"]],
c3bb4bd7
BP
192 "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
193 ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
194 {"op": "insert",
195 "table": "simple",
196 "row": {}}]' \
9cb53f26
BP
197 '["idltest",
198 {"op": "update",
c3bb4bd7
BP
199 "table": "simple",
200 "where": [],
201 "row": {"b": true}}]' \
9cb53f26
BP
202 '["idltest",
203 {"op": "update",
c3bb4bd7
BP
204 "table": "simple",
205 "where": [],
206 "row": {"r": 123.5}}]' \
9cb53f26
BP
207 '["idltest",
208 {"op": "insert",
c3bb4bd7
BP
209 "table": "simple",
210 "row": {"i": -1,
211 "r": 125,
212 "b": false,
213 "s": "",
214 "ia": ["set", [1]],
215 "ra": ["set", [1.5]],
216 "ba": ["set", [false]],
8cdf0349 217 "sa": ["set", []],
c3bb4bd7 218 "ua": ["set", []]}}]' \
9cb53f26
BP
219 '["idltest",
220 {"op": "update",
c3bb4bd7
BP
221 "table": "simple",
222 "where": [["i", "<", 1]],
223 "row": {"s": "newstring"}}]' \
9cb53f26
BP
224 '["idltest",
225 {"op": "delete",
c3bb4bd7
BP
226 "table": "simple",
227 "where": [["i", "==", 0]]}]' \
228 'reconnect']],
229 [[000: empty
230001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]}
231002: i=0 r=0 b=false s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
7fae24e6 232002: 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
233003: {"error":null,"result":[{"count":2}]}
234004: i=0 r=0 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
7fae24e6 235004: 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
236005: {"error":null,"result":[{"count":2}]}
237006: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
7fae24e6 238006: 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
239007: {"error":null,"result":[{"uuid":["uuid","<6>"]}]}
240008: i=-1 r=125 b=false s= u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
241008: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
7fae24e6 242008: 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
243009: {"error":null,"result":[{"count":2}]}
244010: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
245010: i=0 r=123.5 b=true s=newstring u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
7fae24e6 246010: 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
247011: {"error":null,"result":[{"count":1}]}
248012: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
7fae24e6 249012: 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
250013: reconnect
251014: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
7fae24e6 252014: 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
253015: done
254]])
255
256OVSDB_CHECK_IDL([simple idl, initially populated],
9cb53f26
BP
257 [['["idltest",
258 {"op": "insert",
c3bb4bd7
BP
259 "table": "simple",
260 "row": {"i": 1,
261 "r": 2.0,
262 "b": true,
263 "s": "mystring",
264 "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"],
265 "ia": ["set", [1, 2, 3]],
266 "ra": ["set", [-0.5]],
7fae24e6 267 "ba": ["set", [true]],
8cdf0349 268 "sa": ["set", ["abc", "def"]],
c3bb4bd7
BP
269 "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
270 ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
271 {"op": "insert",
272 "table": "simple",
273 "row": {}}]']],
9cb53f26
BP
274 [['["idltest",
275 {"op": "update",
c3bb4bd7
BP
276 "table": "simple",
277 "where": [],
278 "row": {"b": true}}]']],
279 [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
7fae24e6 280000: 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
281001: {"error":null,"result":[{"count":2}]}
282002: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
7fae24e6 283002: 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
284003: done
285]])
286
475281c0 287OVSDB_CHECK_IDL([simple idl, writing via IDL],
9cb53f26
BP
288 [['["idltest",
289 {"op": "insert",
475281c0
BP
290 "table": "simple",
291 "row": {"i": 1,
292 "r": 2.0,
293 "b": true,
294 "s": "mystring",
295 "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"],
296 "ia": ["set", [1, 2, 3]],
297 "ra": ["set", [-0.5]],
7fae24e6 298 "ba": ["set", [true]],
8cdf0349 299 "sa": ["set", ["abc", "def"]],
475281c0
BP
300 "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
301 ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
302 {"op": "insert",
303 "table": "simple",
304 "row": {}}]']],
a91c6104
BP
305 [['verify 0 b, verify 1 r, set 0 b 1, set 1 r 3.5' \
306 'insert 2, verify 2 i, verify 1 b, delete 1']],
475281c0 307 [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
7fae24e6 308000: 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
309001: commit, status=success
310002: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
7fae24e6 311002: 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
312003: commit, status=success
313004: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
314004: i=2 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<6>
315005: done
316]])
317
a91c6104
BP
318OVSDB_CHECK_IDL([simple idl, handling verification failure],
319 [['["idltest",
320 {"op": "insert",
321 "table": "simple",
322 "row": {"i": 1,
323 "r": 2.0}},
324 {"op": "insert",
325 "table": "simple",
326 "row": {}}]']],
327 [['set 0 b 1' \
328 '+["idltest",
329 {"op": "update",
330 "table": "simple",
331 "where": [["i", "==", 1]],
332 "row": {"r": 5.0}}]' \
333 '+verify 1 r, set 1 r 3' \
334 'verify 1 r, set 1 r 3' \
335 ]],
336 [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
337000: i=1 r=2 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2>
338001: commit, status=success
339002: {"error":null,"result":[{"count":1}]}
94fbe1aa 340003: commit, status=try again
a91c6104
BP
341004: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
342004: i=1 r=5 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2>
343005: commit, status=success
344006: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
345006: i=1 r=3 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2>
346007: done
347]])
348
b54e22e9 349OVSDB_CHECK_IDL([simple idl, increment operation],
9cb53f26
BP
350 [['["idltest",
351 {"op": "insert",
b54e22e9
BP
352 "table": "simple",
353 "row": {}}]']],
94fbe1aa 354 [['set 0 r 2.0, increment 0']],
b54e22e9
BP
355 [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
356001: commit, status=success, increment=1
357002: i=1 r=2 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
358003: done
359]])
360
2096903b
BP
361OVSDB_CHECK_IDL([simple idl, aborting],
362 [['["idltest",
363 {"op": "insert",
364 "table": "simple",
365 "row": {}}]']],
366 [['set 0 r 2.0, abort' \
367'+set 0 b 1']],
368 [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
369001: commit, status=aborted
370002: commit, status=success
371003: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
372004: done
373]])
374
375OVSDB_CHECK_IDL([simple idl, destroy without commit or abort],
376 [['["idltest",
377 {"op": "insert",
378 "table": "simple",
379 "row": {}}]']],
380 [['set 0 r 2.0, destroy' \
381'+set 0 b 1']],
382 [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
383001: destroy
384002: commit, status=success
385003: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
386004: done
387]])
388
16ebb90e
LS
389OVSDB_CHECK_IDL([simple idl, conditional, false condition],
390 [['["idltest",
391 {"op": "insert",
392 "table": "simple",
393 "row": {"i": 1,
394 "r": 2.0,
395 "b": true}}]']],
0164e367
BP
396 [['condition simple []' \
397 'condition simple [true]']],
16ebb90e
LS
398 [[000: change conditions
399001: empty
400002: change conditions
401003: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
402004: done
403]])
404
405OVSDB_CHECK_IDL([simple idl, conditional, true condition],
406 [['["idltest",
407 {"op": "insert",
408 "table": "simple",
409 "row": {"i": 1,
410 "r": 2.0,
411 "b": true}}]']],
0164e367
BP
412 [['condition simple []' \
413 'condition simple [true]']],
16ebb90e
LS
414 [[000: change conditions
415001: empty
416002: change conditions
417003: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
418004: done
419]])
420
421OVSDB_CHECK_IDL([simple idl, conditional, multiple clauses in condition],
422 [['["idltest",
423 {"op": "insert",
424 "table": "simple",
425 "row": {"i": 1,
426 "r": 2.0,
427 "b": true}},
428 {"op": "insert",
429 "table": "simple",
430 "row": {"i": 2,
431 "r": 3.0,
432 "b": true}}]']],
0164e367
BP
433 [['condition simple []' \
434 'condition simple [["i","==",1],["i","==",2]]']],
16ebb90e
LS
435 [[000: change conditions
436001: empty
437002: change conditions
438003: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
439003: i=2 r=3 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2>
440004: done
441]])
442
443OVSDB_CHECK_IDL([simple idl, conditional, modify as insert due to condition],
444 [['["idltest",
445 {"op": "insert",
446 "table": "simple",
447 "row": {"i": 1,
448 "r": 2.0,
449 "b": true}}]']],
0164e367
BP
450 [['condition simple []' \
451 'condition simple [["i","==",1]]']],
16ebb90e
LS
452 [[000: change conditions
453001: empty
454002: change conditions
455003: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
456004: done
457]])
458
459OVSDB_CHECK_IDL([simple idl, conditional, modify as delete due to condition],
460 [['["idltest",
461 {"op": "insert",
462 "table": "simple",
463 "row": {"i": 1,
464 "r": 2.0,
465 "b": true}}]']],
0164e367
BP
466 [['condition simple []' \
467 'condition simple [["i","==",1],["i","==",2]]' \
468 'condition simple [["i","==",2]]' \
16ebb90e
LS
469 '["idltest",
470 {"op": "insert",
471 "table": "simple",
472 "row": {"i": 2,
473 "r": 3.0,
474 "b": true}}]']],
475 [[000: change conditions
476001: empty
477002: change conditions
478003: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
479004: change conditions
480005: empty
481006: {"error":null,"result":[{"uuid":["uuid","<2>"]}]}
482007: i=2 r=3 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2>
483008: done
484]])
485
486OVSDB_CHECK_IDL([simple idl, conditional, multiple tables],
487 [['["idltest",
488 {"op": "insert",
489 "table": "simple",
490 "row": {"i": 1,
491 "r": 2.0,
492 "b": true}},
493 {"op": "insert",
494 "table": "link1",
495 "row": {"i": 0, "k": ["named-uuid", "self"]},
496 "uuid-name": "self"},
497 {"op": "insert",
498 "table": "link2",
499 "row": {"i": 2},
500 "uuid-name": "row0"}]']],
0164e367
BP
501 [['condition simple [];link1 [];link2 []' \
502 'condition simple [["i","==",1]]' \
503 'condition link1 [["i","==",0]]' \
504 'condition link2 [["i","==",3]]' \
16ebb90e
LS
505 '+["idltest",
506 {"op": "insert",
507 "table": "link2",
508 "row": {"i": 3},
509 "uuid-name": "row0"}]']],
510 [[000: change conditions
511001: empty
512002: change conditions
513003: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
514004: change conditions
515005: i=0 k=0 ka=[] l2= uuid=<2>
516005: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
517006: change conditions
518007: {"error":null,"result":[{"uuid":["uuid","<3>"]}]}
519008: i=0 k=0 ka=[] l2= uuid=<2>
520008: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
521008: i=3 l1= uuid=<3>
522009: done
523]])
524
c3bb4bd7
BP
525OVSDB_CHECK_IDL([self-linking idl, consistent ops],
526 [],
9cb53f26
BP
527 [['["idltest",
528 {"op": "insert",
e9011ac8 529 "table": "link1",
c3bb4bd7
BP
530 "row": {"i": 0, "k": ["named-uuid", "self"]},
531 "uuid-name": "self"}]' \
9cb53f26
BP
532 '["idltest",
533 {"op": "insert",
e9011ac8 534 "table": "link1",
2d2d6d4a 535 "row": {"i": 1, "k": ["named-uuid", "row2"]},
c3bb4bd7
BP
536 "uuid-name": "row1"},
537 {"op": "insert",
e9011ac8 538 "table": "link1",
c3bb4bd7 539 "row": {"i": 2, "k": ["named-uuid", "row1"]},
2d2d6d4a 540 "uuid-name": "row2"}]' \
9cb53f26
BP
541 '["idltest",
542 {"op": "update",
e9011ac8 543 "table": "link1",
c3bb4bd7
BP
544 "where": [["i", "==", 1]],
545 "row": {"k": ["uuid", "#1#"]}}]' \
9cb53f26
BP
546 '["idltest",
547 {"op": "update",
e9011ac8 548 "table": "link1",
c3bb4bd7
BP
549 "where": [],
550 "row": {"k": ["uuid", "#0#"]}}]']],
551 [[000: empty
552001: {"error":null,"result":[{"uuid":["uuid","<0>"]}]}
e9011ac8 553002: i=0 k=0 ka=[] l2= uuid=<0>
fbf925e4 554003: {"error":null,"result":[{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]}]}
e9011ac8
BP
555004: i=0 k=0 ka=[] l2= uuid=<0>
556004: i=1 k=2 ka=[] l2= uuid=<1>
557004: i=2 k=1 ka=[] l2= uuid=<2>
c3bb4bd7 558005: {"error":null,"result":[{"count":1}]}
e9011ac8
BP
559006: i=0 k=0 ka=[] l2= uuid=<0>
560006: i=1 k=1 ka=[] l2= uuid=<1>
561006: i=2 k=1 ka=[] l2= uuid=<2>
c3bb4bd7 562007: {"error":null,"result":[{"count":3}]}
e9011ac8
BP
563008: i=0 k=0 ka=[] l2= uuid=<0>
564008: i=1 k=0 ka=[] l2= uuid=<1>
565008: i=2 k=0 ka=[] l2= uuid=<2>
c3bb4bd7
BP
566009: done
567]])
568
569OVSDB_CHECK_IDL([self-linking idl, inconsistent ops],
570 [],
9cb53f26
BP
571 [['["idltest",
572 {"op": "insert",
e9011ac8 573 "table": "link1",
c3bb4bd7 574 "row": {"i": 0, "k": ["uuid", "cf197cc5-c8c9-42f5-82d5-c71a9f2cb96b"]}}]' \
9cb53f26
BP
575 '+["idltest",
576 {"op": "insert",
e9011ac8 577 "table": "link1",
0d0f05b9
BP
578 "uuid-name": "one",
579 "row": {"i": 1, "k": ["named-uuid", "one"]}},
580 {"op": "insert",
581 "table": "link1",
582 "row": {"i": 2, "k": ["named-uuid", "one"]}}]' \
9cb53f26
BP
583 '["idltest",
584 {"op": "update",
e9011ac8 585 "table": "link1",
c3bb4bd7
BP
586 "where": [],
587 "row": {"k": ["uuid", "c2fca39a-e69a-42a4-9c56-5eca85839ce9"]}}]' \
9cb53f26
BP
588 '+["idltest",
589 {"op": "delete",
e9011ac8 590 "table": "link1",
0d0f05b9 591 "where": [["_uuid", "==", ["uuid", "#1#"]]]}]' \
9cb53f26
BP
592 '+["idltest",
593 {"op": "delete",
e9011ac8 594 "table": "link1",
0d0f05b9 595 "where": [["_uuid", "==", ["uuid", "#2#"]]]}]' \
9cb53f26
BP
596 '["idltest",
597 {"op": "delete",
0d0f05b9
BP
598 "table": "link1",
599 "where": []}]' \
c3bb4bd7
BP
600]],
601 [[000: empty
97f7803b 602001: {"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
603002: {"error":null,"result":[{"uuid":["uuid","<2>"]},{"uuid":["uuid","<3>"]}]}
604003: i=1 k=1 ka=[] l2= uuid=<2>
605003: i=2 k=1 ka=[] l2= uuid=<3>
254604d8 606004: {"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
607005: {"error":null,"result":[{"count":1},{"details":"cannot delete link1 row <2> because of 1 remaining reference(s)","error":"referential integrity violation"}]}
608006: {"error":null,"result":[{"count":1}]}
609007: i=1 k=1 ka=[] l2= uuid=<2>
610008: {"error":null,"result":[{"count":1}]}
611009: empty
612010: done
254604d8
BP
613]],
614 [],
615 [[sed -e '/004:/s/row <[23]> references/row <x> references/']])
c3bb4bd7
BP
616
617OVSDB_CHECK_IDL([self-linking idl, sets],
618 [],
9cb53f26
BP
619 [['["idltest",
620 {"op": "insert",
e9011ac8 621 "table": "link1",
0d0f05b9 622 "row": {"i": 0, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i0"]]]},
c3bb4bd7
BP
623 "uuid-name": "i0"},
624 {"op": "insert",
e9011ac8 625 "table": "link1",
0d0f05b9 626 "row": {"i": 1, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i1"]]]},
c3bb4bd7
BP
627 "uuid-name": "i1"},
628 {"op": "insert",
e9011ac8 629 "table": "link1",
0d0f05b9 630 "row": {"i": 2, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i2"]]]},
c3bb4bd7
BP
631 "uuid-name": "i2"},
632 {"op": "insert",
e9011ac8 633 "table": "link1",
0d0f05b9 634 "row": {"i": 3, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i3"]]]},
c3bb4bd7 635 "uuid-name": "i3"}]' \
9cb53f26
BP
636 '["idltest",
637 {"op": "update",
e9011ac8 638 "table": "link1",
c3bb4bd7
BP
639 "where": [],
640 "row": {"ka": ["set", [["uuid", "#0#"], ["uuid", "#1#"], ["uuid", "#2#"], ["uuid", "#3#"]]]}}]' \
9cb53f26
BP
641 '["idltest",
642 {"op": "update",
e9011ac8 643 "table": "link1",
97f7803b
BP
644 "where": [["i", "==", 2]],
645 "row": {"ka": ["set", [["uuid", "#0#"], ["uuid", "88702e78-845b-4a6e-ad08-cf68922ae84a"], ["uuid", "#2#"]]]}}]' \
9cb53f26
BP
646 '+["idltest",
647 {"op": "delete",
0d0f05b9
BP
648 "table": "link1",
649 "where": []}]']],
c3bb4bd7
BP
650 [[000: empty
651001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]},{"uuid":["uuid","<3>"]}]}
0d0f05b9
BP
652002: i=0 k=0 ka=[0] l2= uuid=<0>
653002: i=1 k=0 ka=[1] l2= uuid=<1>
654002: i=2 k=0 ka=[2] l2= uuid=<2>
655002: i=3 k=0 ka=[3] l2= uuid=<3>
c3bb4bd7 656003: {"error":null,"result":[{"count":4}]}
0d0f05b9
BP
657004: i=0 k=0 ka=[0 1 2 3] l2= uuid=<0>
658004: i=1 k=0 ka=[0 1 2 3] l2= uuid=<1>
659004: i=2 k=0 ka=[0 1 2 3] l2= uuid=<2>
660004: i=3 k=0 ka=[0 1 2 3] l2= uuid=<3>
97f7803b 661005: {"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
662006: {"error":null,"result":[{"count":4}]}
663007: empty
664008: done
c3bb4bd7
BP
665]])
666
e9011ac8
BP
667OVSDB_CHECK_IDL([external-linking idl, consistent ops],
668 [],
9cb53f26
BP
669 [['["idltest",
670 {"op": "insert",
e9011ac8
BP
671 "table": "link2",
672 "row": {"i": 0},
673 "uuid-name": "row0"},
674 {"op": "insert",
675 "table": "link1",
0d0f05b9 676 "row": {"i": 1, "k": ["named-uuid", "row1"], "l2": ["set", [["named-uuid", "row0"]]]},
e9011ac8
BP
677 "uuid-name": "row1"}]']],
678 [[000: empty
679001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]}
680002: i=0 l1= uuid=<0>
0d0f05b9 681002: i=1 k=1 ka=[] l2=0 uuid=<1>
e9011ac8
BP
682003: done
683]])
225b582a
IY
684
685OVSDB_CHECK_IDL_PY([external-linking idl, insert ops],
686 [],
687 [['linktest']],
688 [[000: empty
689001: commit, status=success
690002: i=1 k=1 ka=[1] l2= uuid=<0>
691002: i=2 k=1 ka=[1 2] l2= uuid=<1>
692003: done
693]])
3b4c362f
IY
694
695OVSDB_CHECK_IDL_PY([getattr idl, insert ops],
696 [],
697 [['getattrtest']],
698 [[000: empty
699001: commit, status=success
700002: i=2 k=2 ka=[] l2= uuid=<0>
701003: done
702]])
d18e52e3 703
d7d417fc
TW
704OVSDB_CHECK_IDL_PY([row-from-json idl, whats this],
705 [['["idltest",
706 {"op": "insert",
707 "table": "simple",
708 "row": {"i": 1}},
709 {"op": "insert",
710 "table": "simple",
711 "row": {}}]']],
712 [['notifytest insert 2, notifytest set 1 b 1, notifytest delete 0']],
713 [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
714000: i=1 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2>
715001: commit, status=success, events=create|2|None, delete|0|None, update|1|b
716002: i=1 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2>
717002: i=2 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3>
718003: done
719]])
720
d18e52e3
BP
721AT_SETUP([idl handling of missing tables and columns - C])
722AT_KEYWORDS([ovsdb server idl positive])
d18e52e3
BP
723
724# idltest2.ovsschema is the same as idltest.ovsschema, except that
725# table link2 and column l2 have been deleted. But the IDL still
726# expects them to be there, so this test checks that it properly
727# tolerates them being missing.
56120500 728AT_CHECK([ovsdb_start_idltest "" "$abs_srcdir/idltest2.ovsschema"])
d18e52e3
BP
729AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 idl unix:socket ['["idltest",
730 {"op": "insert",
731 "table": "link1",
732 "row": {"i": 0, "k": ["named-uuid", "self"]},
733 "uuid-name": "self"}]' \
734 '["idltest",
735 {"op": "insert",
736 "table": "link1",
737 "row": {"i": 1, "k": ["named-uuid", "row2"]},
738 "uuid-name": "row1"},
739 {"op": "insert",
740 "table": "link1",
741 "row": {"i": 2, "k": ["named-uuid", "row1"]},
742 "uuid-name": "row2"}]' \
743 '["idltest",
744 {"op": "update",
745 "table": "link1",
746 "where": [["i", "==", 1]],
747 "row": {"k": ["uuid", "#1#"]}}]' \
748 '["idltest",
749 {"op": "update",
750 "table": "link1",
751 "where": [],
752 "row": {"k": ["uuid", "#0#"]}}]']],
7427f2a4 753 [0], [stdout], [stderr])
d18e52e3
BP
754AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl], [0],
755 [[000: empty
756001: {"error":null,"result":[{"uuid":["uuid","<0>"]}]}
757002: i=0 k=0 ka=[] l2= uuid=<0>
758003: {"error":null,"result":[{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]}]}
759004: i=0 k=0 ka=[] l2= uuid=<0>
760004: i=1 k=2 ka=[] l2= uuid=<1>
761004: i=2 k=1 ka=[] l2= uuid=<2>
762005: {"error":null,"result":[{"count":1}]}
763006: i=0 k=0 ka=[] l2= uuid=<0>
764006: i=1 k=1 ka=[] l2= uuid=<1>
765006: i=2 k=1 ka=[] l2= uuid=<2>
766007: {"error":null,"result":[{"count":3}]}
767008: i=0 k=0 ka=[] l2= uuid=<0>
768008: i=1 k=0 ka=[] l2= uuid=<1>
769008: i=2 k=0 ka=[] l2= uuid=<2>
770009: done
7427f2a4 771]])
d18e52e3
BP
772
773# Check that ovsdb-idl figured out that table link2 and column l2 are missing.
774AT_CHECK([grep ovsdb_idl stderr | sort], [0], [dnl
775test-ovsdb|ovsdb_idl|idltest database lacks link2 table (database needs upgrade?)
776test-ovsdb|ovsdb_idl|link1 table in idltest database lacks l2 column (database needs upgrade?)
777])
778
779# Check that ovsdb-idl sent on "monitor" request and that it didn't
780# mention that table or column, and (for paranoia) that it did mention another
781# table and column.
c383f3bf 782AT_CHECK([grep -c '"monitor\|monitor_cond"' stderr], [0], [1
d18e52e3 783])
c383f3bf
LS
784AT_CHECK([grep '"monitor\|monitor_cond"' stderr | grep link2], [1])
785AT_CHECK([grep '"monitor\|monitor_cond"' stderr | grep l2], [1])
786AT_CHECK([grep '"monitor\|monitor_cond"' stderr | grep -c '"link1"'], [0], [1
d18e52e3 787])
c383f3bf 788AT_CHECK([grep '"monitor\|monitor_cond"' stderr | grep -c '"ua"'], [0], [1
d18e52e3
BP
789])
790OVSDB_SERVER_SHUTDOWN
791AT_CLEANUP
80c12152
SA
792
793m4_define([OVSDB_CHECK_IDL_FETCH_COLUMNS_PY],
794 [AT_SETUP([$1 - Python fetch])
795 AT_SKIP_IF([test $HAVE_PYTHON = no])
796 AT_KEYWORDS([ovsdb server idl positive Python increment fetch $6])
56120500 797 AT_CHECK([ovsdb_start_idltest])
80c12152 798 m4_if([$2], [], [],
7427f2a4 799 [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])])
80c12152 800 AT_CHECK([$PYTHON $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket [$3] $4],
7427f2a4 801 [0], [stdout], [ignore])
80c12152 802 AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$7],,, [[| $7]]),
7427f2a4 803 [0], [$5])
80c12152
SA
804 OVSDB_SERVER_SHUTDOWN
805 AT_CLEANUP])
806
807m4_define([OVSDB_CHECK_IDL_FETCH_COLUMNS],
808 [OVSDB_CHECK_IDL_FETCH_COLUMNS_PY($@)])
809
810OVSDB_CHECK_IDL_FETCH_COLUMNS([simple idl, initially populated],
811 [['["idltest",
812 {"op": "insert",
813 "table": "simple",
814 "row": {"i": 1,
815 "r": 2.0,
816 "b": true,
817 "s": "mystring",
818 "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"],
819 "ia": ["set", [1, 2, 3]],
820 "ra": ["set", [-0.5]],
821 "ba": ["set", [true]],
822 "sa": ["set", ["abc", "def"]],
823 "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
824 ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
825 {"op": "insert",
826 "table": "simple",
827 "row": {}}]']],
828 [?simple:i,r!],
829 ['fetch 0 r'],
830 [[000: i=0 uuid=<0>
831000: i=1 uuid=<1>
832001: commit, status=success
833002: i=0 r=0 uuid=<0>
834002: i=1 uuid=<1>
835003: done
836]])
932104f4 837
897c8064
LS
838m4_define([OVSDB_CHECK_IDL_WO_MONITOR_COND_PY],
839 [AT_SETUP([$1 - Python])
840 AT_SKIP_IF([test $HAVE_PYTHON = no])
841 AT_KEYWORDS([ovsdb server idl Python monitor $4])
56120500
BP
842 AT_CHECK([ovsdb_start_idltest])
843 AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/disable-monitor-cond])
897c8064
LS
844 AT_CHECK([$PYTHON $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket $2],
845 [0], [stdout], [ignore], [kill `cat pid`])
846 AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$5],,, [[| $5]]),
847 [0], [$3], [], [kill `cat pid`])
848 OVSDB_SERVER_SHUTDOWN
849 AT_CLEANUP])
850
851
852m4_define([OVSDB_CHECK_IDL_WO_MONITOR_COND],
853 [OVSDB_CHECK_IDL_WO_MONITOR_COND_PY($@)])
854
855
856OVSDB_CHECK_IDL_WO_MONITOR_COND([simple idl disable monitor-cond],
857 [['["idltest",
858 {"op": "insert",
859 "table": "simple",
860 "row": {"i": 1,
861 "r": 2.0,
862 "b": true,
863 "s": "mystring",
864 "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"],
865 "ia": ["set", [1, 2, 3]],
866 "ra": ["set", [-0.5]],
867 "ba": ["set", [true]],
868 "sa": ["set", ["abc", "def"]],
869 "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
870 ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
871 {"op": "insert",
872 "table": "simple",
873 "row": {}}]' \
874 '["idltest",
875 {"op": "update",
876 "table": "simple",
877 "where": [],
878 "row": {"b": true}}]' \
879 '["idltest",
880 {"op": "update",
881 "table": "simple",
882 "where": [],
883 "row": {"r": 123.5}}]' \
884 '["idltest",
885 {"op": "insert",
886 "table": "simple",
887 "row": {"i": -1,
888 "r": 125,
889 "b": false,
890 "s": "",
891 "ia": ["set", [1]],
892 "ra": ["set", [1.5]],
893 "ba": ["set", [false]],
894 "sa": ["set", []],
895 "ua": ["set", []]}}]' \
896 '["idltest",
897 {"op": "update",
898 "table": "simple",
899 "where": [["i", "<", 1]],
900 "row": {"s": "newstring"}}]' \
901 '["idltest",
902 {"op": "delete",
903 "table": "simple",
904 "where": [["i", "==", 0]]}]' \
905 'reconnect']],
906 [[000: empty
907001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]}
908002: i=0 r=0 b=false s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
909002: 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>
910003: {"error":null,"result":[{"count":2}]}
911004: i=0 r=0 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
912004: 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>
913005: {"error":null,"result":[{"count":2}]}
914006: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
915006: 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>
916007: {"error":null,"result":[{"uuid":["uuid","<6>"]}]}
917008: i=-1 r=125 b=false s= u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
918008: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
919008: 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>
920009: {"error":null,"result":[{"count":2}]}
921010: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
922010: i=0 r=123.5 b=true s=newstring u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
923010: 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>
924011: {"error":null,"result":[{"count":1}]}
925012: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
926012: 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>
927013: reconnect
928014: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
929014: 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>
930015: done
931]])
932
932104f4
SA
933m4_define([OVSDB_CHECK_IDL_TRACK_C],
934 [AT_SETUP([$1 - C])
935 AT_KEYWORDS([ovsdb server idl tracking positive $5])
56120500 936 AT_CHECK([ovsdb_start_idltest])
932104f4 937 m4_if([$2], [], [],
7427f2a4 938 [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])])
932104f4 939 AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl unix:socket $3],
7427f2a4 940 [0], [stdout], [ignore])
932104f4 941 AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]),
7427f2a4 942 [0], [$4])
932104f4
SA
943 OVSDB_SERVER_SHUTDOWN
944 AT_CLEANUP])
945
946m4_define([OVSDB_CHECK_IDL_TRACK],
947 [OVSDB_CHECK_IDL_TRACK_C($@)])
948
949OVSDB_CHECK_IDL_TRACK([track, simple idl, initially populated],
950 [['["idltest",
951 {"op": "insert",
952 "table": "simple",
953 "row": {"i": 1,
954 "r": 2.0,
955 "b": true,
956 "s": "mystring",
957 "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"],
958 "ia": ["set", [1, 2, 3]],
959 "ra": ["set", [-0.5]],
960 "ba": ["set", [true]],
961 "sa": ["set", ["abc", "def"]],
962 "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
963 ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
964 {"op": "insert",
965 "table": "simple",
966 "row": {}}]']],
967 [['["idltest",
968 {"op": "update",
969 "table": "simple",
970 "where": [],
971 "row": {"b": true}}]']],
972 [[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 973000: updated columns: b ba i ia r ra s sa u ua
932104f4
SA
974001: {"error":null,"result":[{"count":2}]}
975002: i=0 r=0 b=true s= u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<5>
976002: 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 977002: updated columns: b
932104f4
SA
978003: done
979]])
980
981OVSDB_CHECK_IDL_TRACK([track, simple idl, initially empty, various ops],
982 [],
983 [['["idltest",
984 {"op": "insert",
985 "table": "simple",
986 "row": {"i": 1,
987 "r": 2.0,
988 "b": true,
989 "s": "mystring",
990 "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"],
991 "ia": ["set", [1, 2, 3]],
992 "ra": ["set", [-0.5]],
993 "ba": ["set", [true]],
994 "sa": ["set", ["abc", "def"]],
995 "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
996 ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
997 {"op": "insert",
998 "table": "simple",
999 "row": {}}]' \
1000 '["idltest",
1001 {"op": "update",
1002 "table": "simple",
1003 "where": [],
1004 "row": {"b": true}}]' \
1005 '["idltest",
1006 {"op": "update",
1007 "table": "simple",
1008 "where": [],
1009 "row": {"r": 123.5}}]' \
1010 '["idltest",
1011 {"op": "insert",
1012 "table": "simple",
1013 "row": {"i": -1,
1014 "r": 125,
1015 "b": false,
1016 "s": "",
1017 "ia": ["set", [1]],
1018 "ra": ["set", [1.5]],
1019 "ba": ["set", [false]],
1020 "sa": ["set", []],
1021 "ua": ["set", []]}}]' \
1022 '["idltest",
1023 {"op": "update",
1024 "table": "simple",
1025 "where": [["i", "<", 1]],
1026 "row": {"s": "newstring"}}]' \
1027 '["idltest",
1028 {"op": "delete",
1029 "table": "simple",
1030 "where": [["i", "==", 0]]}]' \
1031 'reconnect']],
1032 [[000: empty
1033001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]}
1034002: 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 1035002: updated columns: b ba i ia r ra s sa u ua
932104f4
SA
1036003: {"error":null,"result":[{"count":2}]}
1037004: i=0 r=0 b=true s= u=<5> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
32d37ce8 1038004: updated columns: b
932104f4
SA
1039005: {"error":null,"result":[{"count":2}]}
1040006: i=0 r=123.5 b=true s= u=<5> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
1041006: 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
1042006: updated columns: r
1043006: updated columns: r
932104f4
SA
1044007: {"error":null,"result":[{"uuid":["uuid","<6>"]}]}
1045008: i=-1 r=125 b=false s= u=<5> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
32d37ce8 1046008: updated columns: ba i ia r ra
932104f4
SA
1047009: {"error":null,"result":[{"count":2}]}
1048010: i=-1 r=125 b=false s=newstring u=<5> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
1049010: i=0 r=123.5 b=true s=newstring u=<5> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
32d37ce8
SA
1050010: updated columns: s
1051010: updated columns: s
932104f4
SA
1052011: {"error":null,"result":[{"count":1}]}
1053012: ##deleted## uuid=<1>
1054013: reconnect
1055014: i=-1 r=125 b=false s=newstring u=<5> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
1056014: 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
1057014: updated columns: b ba i ia r ra s sa u ua
1058014: updated columns: ba i ia r ra s
932104f4
SA
1059015: done
1060]])
7251075c
EA
1061
1062m4_define([OVSDB_CHECK_IDL_PARTIAL_UPDATE_MAP_COLUMN],
1063 [AT_SETUP([$1 - C])
1064 AT_KEYWORDS([ovsdb server idl partial update map column positive $5])
56120500 1065 AT_CHECK([ovsdb_start_idltest])
7251075c 1066 m4_if([$2], [], [],
7427f2a4 1067 [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])])
7251075c 1068 AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl-partial-update-map-column unix:socket $3],
7427f2a4 1069 [0], [stdout], [ignore])
7251075c 1070 AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]),
7427f2a4 1071 [0], [$4])
7251075c
EA
1072 OVSDB_SERVER_SHUTDOWN
1073 AT_CLEANUP])
1074
1075OVSDB_CHECK_IDL_PARTIAL_UPDATE_MAP_COLUMN([map, simple2 idl-partial-update-map-column, initially populated],
1076[['["idltest", {"op":"insert", "table":"simple2",
1077 "row":{"name":"myString1","smap":["map",[["key1","value1"],["key2","value2"]]]} }]']
1078],
1079[],
1080[[000: Getting records
1081001: name=myString1 smap=[[key1 : value1],[key2 : value2]] imap=[]
1082002: After insert element
1083003: name=String2 smap=[[key1 : myList1],[key2 : value2]] imap=[[3 : myids2]]
1084004: After insert duplicated element
1085005: name=String2 smap=[[key1 : myList1],[key2 : value2]] imap=[[3 : myids2]]
1086006: After delete element
1087007: name=String2 smap=[[key2 : value2]] imap=[[3 : myids2]]
1088008: After trying to delete a deleted element
1089009: name=String2 smap=[[key2 : value2]] imap=[[3 : myids2]]
1090010: End test
1091]])
a7261bf7 1092
a59912a0
RM
1093OVSDB_CHECK_IDL_PY([partial-map idl],
1094[['["idltest", {"op":"insert", "table":"simple2",
330b9c9c 1095 "row":{"name":"myString1","smap":["map",[["key1","value1"],["key2","value2"]]]} }]']
a59912a0 1096],
2d54d801 1097 [?simple2:name,smap,imap 'partialmapinsertelement' 'partialmapinsertmultipleelements' 'partialmapdelelements' 'partialmapmutatenew'],
330b9c9c 1098[[000: name=myString1 smap=[(key1 value1) (key2 value2)] imap=[]
a59912a0 1099001: commit, status=success
330b9c9c 1100002: name=String2 smap=[(key1 myList1) (key2 value2)] imap=[(3 myids2)]
a59912a0 1101003: commit, status=success
2d54d801 1102004: name=String2 smap=[(key1 myList1) (key2 myList2) (key3 myList3) (key4 myList4)] imap=[(3 myids2)]
330b9c9c
AB
1103005: commit, status=success
1104006: name=String2 smap=[(key2 myList2)] imap=[(3 myids2)]
2d54d801
AB
1105007: commit, status=success
1106008: name=String2 smap=[(key2 myList2)] imap=[(3 myids2)]
1107008: name=String2New smap=[(key1 newList1) (key2 newList2)] imap=[]
1108009: done
a59912a0
RM
1109]])
1110
f1ab6e06
RM
1111m4_define([OVSDB_CHECK_IDL_PARTIAL_UPDATE_SET_COLUMN],
1112 [AT_SETUP([$1 - C])
1113 AT_KEYWORDS([ovsdb server idl partial update set column positive $5])
56120500 1114 AT_CHECK([ovsdb_start_idltest])
f1ab6e06
RM
1115 m4_if([$2], [], [],
1116 [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])])
1117 AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl-partial-update-set-column unix:socket $3],
1118 [0], [stdout], [ignore])
1119 AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]),
1120 [0], [$4])
1121 OVSDB_SERVER_SHUTDOWN
1122 AT_CLEANUP])
1123
1124OVSDB_CHECK_IDL_PARTIAL_UPDATE_SET_COLUMN([set, simple3 idl-partial-update-set-column, initially populated],
1125[['["idltest", {"op":"insert", "table":"simple3",
1126 "row":{"name":"mySet1","uset":["set", [[ "uuid", "0005b872-f9e5-43be-ae02-3184b9680e75" ], [ "uuid", "000d2f6a-76af-412f-b59d-e7bcd3e84eff" ]]]} }]']
1127],
1128[],
1129[[000: Getting records
1130001: name=mySet1 uset=[[<0>],[<1>]] uref=[]
1131002: After rename+add new value
1132003: name=String2 uset=[[<0>],[<1>],[<2>]] uref=[]
1133004: After add new value
1134005: name=String2 uset=[[<0>],[<1>],[<2>],[<3>]] uref=[]
1135006: After delete value
1136007: name=String2 uset=[[<0>],[<1>],[<3>]] uref=[]
1137008: After trying to delete a deleted value
1138009: name=String2 uset=[[<0>],[<1>],[<3>]] uref=[]
1139010: After add to other table + set of strong ref
1140011: name=String2 uset=[[<0>],[<1>],[<3>]] uref=[[<4>]]
1141012: End test
1142]])
1143
a59912a0 1144OVSDB_CHECK_IDL_PY([partial-set idl],
b3220c67
AB
1145[['["idltest", {"op":"insert", "table":"simple3", "uuid-name":"newrow",
1146 "row":{"name":"mySet1","uset":["set", [[ "uuid", "0005b872-f9e5-43be-ae02-3184b9680e75" ]]]} },
1147 {"op":"insert", "table":"simple4", "row":{"name":"seed"}},
1148 {"op":"mutate", "table":"simple3", "where":[["_uuid", "==", ["named-uuid", "newrow"]]],
1149 "mutations": [["uset", "insert", ["set", [["uuid", "000d2f6a-76af-412f-b59d-e7bcd3e84eff"]]]]]}]']
a59912a0 1150],
2d54d801 1151 ['partialrenamesetadd' 'partialduplicateadd' 'partialsetdel' 'partialsetref' 'partialsetoverrideops' 'partialsetadddelete' 'partialsetmutatenew'],
a59912a0
RM
1152[[000: name=mySet1 uset=[<0> <1>]
1153001: commit, status=success
1154002: name=String2 uset=[<0> <1> <2>]
1155003: commit, status=success
1156004: name=String2 uset=[<0> <1> <2> <3>]
1157005: commit, status=success
1158006: name=String2 uset=[<0> <1> <3>]
1159007: commit, status=success
1160008: name=String2 uset=[<0> <1> <3>]
330b9c9c
AB
1161009: commit, status=success
1162010: name=String2 uset=[<3>]
b3220c67 1163011: commit, status=success
2d54d801
AB
1164012: name=String2 uset=[<4> <5>]
1165013: commit, status=success
1166014: name=String2 uset=[<4> <5>]
1167014: name=String3 uset=[<6>]
1168015: done
a59912a0
RM
1169]])
1170
a7261bf7
NS
1171m4_define([OVSDB_CHECK_IDL_NOTIFY_PY],
1172 [AT_SETUP([$1 - Python])
1173 AT_SKIP_IF([test $HAVE_PYTHON = no])
1174 AT_KEYWORDS([ovsdb server idl Python notify $4])
56120500 1175 AT_CHECK([ovsdb_start_idltest])
a7261bf7
NS
1176 AT_CHECK([$PYTHON $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket $2],
1177 [0], [stdout], [ignore], [kill `cat pid`])
1178 AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$5],,, [[| $5]]),
1179 [0], [$3], [], [kill `cat pid`])
1180 OVSDB_SERVER_SHUTDOWN
1181 AT_CLEANUP])
1182
d90ed7d6
NS
1183# This test uses the Python IDL implementation with ssl
1184m4_define([OVSDB_CHECK_IDL_NOTIFY_SSL_PY],
1185 [AT_SETUP([$1 - SSL])
1e96502f 1186 AT_SKIP_IF([test "$HAVE_OPENSSL" = no])
d90ed7d6 1187 AT_SKIP_IF([test $HAVE_PYTHON = no])
ca9c2c56 1188 $PYTHON -c "import OpenSSL.SSL"
d90ed7d6
NS
1189 SSL_PRESENT=$?
1190 AT_SKIP_IF([test $SSL_PRESENT != 0])
1191 AT_KEYWORDS([ovsdb server idl Python notify - ssl socket])
1192 AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema],
1193 [0], [stdout], [ignore])
1194 PKIDIR=$abs_top_builddir/tests
56120500
BP
1195 AT_CHECK([ovsdb-server -vconsole:warn --log-file --detach --no-chdir \
1196 --pidfile \
d90ed7d6
NS
1197 --private-key=$PKIDIR/testpki-privkey2.pem \
1198 --certificate=$PKIDIR/testpki-cert2.pem \
1199 --ca-cert=$PKIDIR/testpki-cacert.pem \
56120500
BP
1200 --remote=pssl:0:127.0.0.1 db])
1201 on_exit 'kill `cat ovsdb-server.pid`'
d90ed7d6
NS
1202 PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT])
1203 AT_CHECK([$PYTHON $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema \
1204 ssl:127.0.0.1:$TCP_PORT $PKIDIR/testpki-privkey.pem \
1205 $PKIDIR/testpki-cert.pem $PKIDIR/testpki-cacert.pem $2],
1206 [0], [stdout], [ignore], [kill `cat pid`])
1207 AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$5],,, [[| $5]]),
1208 [0], [$3], [], [kill `cat pid`])
1209 OVSDB_SERVER_SHUTDOWN
1210 AT_CLEANUP])
a7261bf7
NS
1211
1212m4_define([OVSDB_CHECK_IDL_NOTIFY],
d90ed7d6
NS
1213 [OVSDB_CHECK_IDL_NOTIFY_PY($@)
1214 OVSDB_CHECK_IDL_NOTIFY_SSL_PY($@)])
a7261bf7
NS
1215
1216OVSDB_CHECK_IDL_NOTIFY([simple idl verify notify],
1217 [['track-notify' \
1218 '["idltest",
1219 {"op": "insert",
1220 "table": "simple",
1221 "row": {"i": 1,
1222 "r": 2.0,
1223 "b": true,
1224 "s": "mystring",
1225 "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"],
1226 "ia": ["set", [1, 2, 3]],
1227 "ra": ["set", [-0.5]],
1228 "ba": ["set", [true]],
1229 "sa": ["set", ["abc", "def"]],
1230 "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
1231 ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
1232 {"op": "insert",
1233 "table": "simple",
1234 "row": {}}]' \
1235 '["idltest",
1236 {"op": "update",
1237 "table": "simple",
1238 "where": [],
1239 "row": {"b": false}}]' \
1240 '["idltest",
1241 {"op": "update",
1242 "table": "simple",
1243 "where": [],
1244 "row": {"r": 123.5}}]' \
1245 '["idltest",
1246 {"op": "insert",
1247 "table": "simple",
1248 "row": {"i": -1,
1249 "r": 125,
1250 "b": false,
1251 "s": "",
1252 "ia": ["set", [1]],
1253 "ra": ["set", [1.5]],
1254 "ba": ["set", [false]],
1255 "sa": ["set", []],
1256 "ua": ["set", []]}}]' \
1257 '["idltest",
1258 {"op": "update",
1259 "table": "simple",
1260 "where": [["i", "<", 1]],
1261 "row": {"s": "newstring"}}]' \
1262 '["idltest",
1263 {"op": "delete",
1264 "table": "simple",
1265 "where": [["i", "==", 0]]}]' \
1266 'reconnect']],
1267 [[000: empty
1268001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]}
1269002: event:create, row={i=0 r=0 b=false s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>}, updates=None
1270002: 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
1271002: i=0 r=0 b=false s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
1272002: 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>
1273003: {"error":null,"result":[{"count":2}]}
1274004: 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>}
1275004: i=0 r=0 b=false s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
1276004: 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>
1277005: {"error":null,"result":[{"count":2}]}
1278006: 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>}
1279006: 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>}
1280006: i=0 r=123.5 b=false s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
1281006: 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>
1282007: {"error":null,"result":[{"uuid":["uuid","<6>"]}]}
1283008: 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
1284008: i=-1 r=125 b=false s= u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
1285008: i=0 r=123.5 b=false s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
1286008: 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>
1287009: {"error":null,"result":[{"count":2}]}
1288010: 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>}
1289010: 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>}
1290010: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
1291010: i=0 r=123.5 b=false s=newstring u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
1292010: 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>
1293011: {"error":null,"result":[{"count":1}]}
1294012: event:delete, row={i=0 r=123.5 b=false s=newstring u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>}, updates=None
1295012: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
1296012: 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>
1297013: reconnect
1298014: 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
1299014: 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
1300014: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
1301014: 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>
1302015: done
1303]])
0a8606ee
LR
1304
1305# Tests to verify the functionality of the one column compound index.
1306# It tests index for one column string and integer indexes.
1307# The run of test-ovsdb generates the output of the display of data using the different indexes defined in
1308# the program.
1309# Then, some at_checks are used to verify the correctness of the corresponding index as well as the existence
1310# of all the rows involved in the test.
1311m4_define([OVSDB_CHECK_IDL_COMPOUND_INDEX_SINGLE_COLUMN_C],
1312 [AT_SETUP([$1 - C])
1313 AT_KEYWORDS([ovsdb server idl compound_index_single_column compound_index positive $5])
1314 AT_CHECK([ovsdb_start_idltest])
1315 m4_if([$2], [], [],
1316 [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore], [kill `cat pid`])])
1317# Generate the data to be tested.
1318 AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl-compound-index unix:socket $3],
1319 [0], [stdout], [ignore], [kill `cat pid`])
1320# Filter the rows of data that corresponds to the string index eliminating the extra columns of data.
1321# This is done to verifiy that the output data is in the correct and expected order.
1322 AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: s=.*' | sed -e 's/ i=.*//g']],
1323 [0], [$4], [], [kill `cat pid`])
1324# Here, the data is filtered and sorted in order to have all the rows in the index and be
1325# able to determined that all the involved rows are present.
1326 AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: s=.*' | sort -k 1,1n -k 2,2 -k 3,3]],
1327 [0], [$5], [], [kill `cat pid`])
1328# Filter the rows of data that corresponds to the integer index eliminating the extra columns of data.
1329# This is done to verifiy that the output data is in the correct and expected order.
1330 AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: i=.*' | sed -e 's/ s=.*//g']],
1331 [0], [$6], [], [kill `cat pid`])
1332# Here again, the data is filtered and sorted in order to have all the rows in the index and be
1333# able to determined that all the involved rows are present.
1334 AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: i=.*' | sort -k 1,1n -k 2,2 -k 3,3]],
1335 [0], [$7], [], [kill `cat pid`])
1336 OVSDB_SERVER_SHUTDOWN
1337 AT_CLEANUP])
1338
1339OVSDB_CHECK_IDL_COMPOUND_INDEX_SINGLE_COLUMN_C([Compound_index, single column test ],
1340 [['["idltest",
1341 {"op": "insert", "table": "simple", "row": {"s":"List000", "i": 1, "b":true, "r":101.0}},
1342 {"op": "insert", "table": "simple", "row": {"s":"List000", "i": 2, "b":false, "r":102.0}},
1343 {"op": "insert", "table": "simple", "row": {"s":"List000", "i": 10, "b":true, "r":110.0}},
1344 {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 1, "b":false, "r":110.0}},
1345 {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 2, "b":true, "r":120.0}},
1346 {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 2, "b":true, "r":122.0}},
1347 {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 4, "b":true, "r":130.0}},
1348 {"op": "insert", "table": "simple", "row": {"s":"List005", "i": 5, "b":true, "r":130.0}},
1349 {"op": "insert", "table": "simple", "row": {"s":"List020", "i": 20, "b":true, "r":220.0}},
1350 {"op": "insert", "table": "simple", "row": {"s":"List020", "i": 19, "b":true, "r":219.0}}
1351 ]']],
1352 [idl_compound_index_single_column],
1353 [001: s=List000
1354001: s=List000
1355001: s=List000
1356001: s=List001
1357001: s=List001
1358001: s=List001
1359001: s=List001
1360001: s=List005
1361001: s=List020
1362001: s=List020
1363003: s=List001
1364003: s=List001
1365003: s=List001
1366003: s=List001
1367],
1368[001: s=List000 i=1 b=True r=101.000000
1369001: s=List000 i=10 b=True r=110.000000
1370001: s=List000 i=2 b=False r=102.000000
1371001: s=List001 i=1 b=False r=110.000000
1372001: s=List001 i=2 b=True r=120.000000
1373001: s=List001 i=2 b=True r=122.000000
1374001: s=List001 i=4 b=True r=130.000000
1375001: s=List005 i=5 b=True r=130.000000
1376001: s=List020 i=19 b=True r=219.000000
1377001: s=List020 i=20 b=True r=220.000000
1378003: s=List001 i=1 b=False r=110.000000
1379003: s=List001 i=2 b=True r=120.000000
1380003: s=List001 i=2 b=True r=122.000000
1381003: s=List001 i=4 b=True r=130.000000
1382],
1383[002: i=1
1384002: i=1
1385002: i=2
1386002: i=2
1387002: i=2
1388002: i=4
1389002: i=5
1390002: i=10
1391002: i=19
1392002: i=20
1393004: i=5
1394005: i=4
1395005: i=5
1396006: i=5
1397006: i=10
1398006: i=19
1399006: i=20
1400006: i=54
1401007: i=1
1402007: i=1
1403007: i=2
1404007: i=2
1405007: i=2
1406007: i=5
1407007: i=10
1408007: i=19
1409007: i=20
1410007: i=54
1411],
1412[002: i=1 s=List000 b=True r=101.000000
1413002: i=1 s=List001 b=False r=110.000000
1414002: i=10 s=List000 b=True r=110.000000
1415002: i=19 s=List020 b=True r=219.000000
1416002: i=2 s=List000 b=False r=102.000000
1417002: i=2 s=List001 b=True r=120.000000
1418002: i=2 s=List001 b=True r=122.000000
1419002: i=20 s=List020 b=True r=220.000000
1420002: i=4 s=List001 b=True r=130.000000
1421002: i=5 s=List005 b=True r=130.000000
1422004: i=5 s=List005 b=True r=130.000000
1423005: i=4 s=List001 b=True r=130.000000
1424005: i=5 s=List005 b=True r=130.000000
1425006: i=10 s=List000 b=True r=110.000000
1426006: i=19 s=List020 b=True r=219.000000
1427006: i=20 s=List020 b=True r=220.000000
1428006: i=5 s=List005 b=True r=130.000000
1429006: i=54 s=Lista054 b=False r=0.000000
1430007: i=1 s=List000 b=True r=101.000000
1431007: i=1 s=List001 b=False r=110.000000
1432007: i=10 s=List000 b=True r=110.000000
1433007: i=19 s=List020 b=True r=219.000000
1434007: i=2 s=List000 b=False r=102.000000
1435007: i=2 s=List001 b=True r=120.000000
1436007: i=2 s=List001 b=True r=122.000000
1437007: i=20 s=List020 b=True r=220.000000
1438007: i=5 s=List005 b=True r=130.000000
1439007: i=54 s=Lista054 b=False r=0.000000
1440])
1441
1442# Tests to verify the functionality of two column compound index.
1443# It tests index for two columns using string and integer fields.
1444# The run of test-ovsdb generates the output of the display of data using the different indexes defined in
1445# the program.
1446# Then, some at_checks are used to verify the correctness of the corresponding index as well as the existence
1447# of all the rows involved in the test.
1448m4_define([OVSDB_CHECK_IDL_COMPOUND_INDEX_DOUBLE_COLUMN_C],
1449 [AT_SETUP([$1 - C])
1450 AT_KEYWORDS([ovsdb server idl compound_index_double_column compound_index positive $5])
1451 AT_CHECK([ovsdb_start_idltest])
1452 m4_if([$2], [], [],
1453 [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore], [kill `cat pid`])])
1454# Generate the data to be tested.
1455 AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl-compound-index unix:socket $3],
1456 [0], [stdout], [ignore], [kill `cat pid`])
1457# Filter the rows of data that corresponds to the string-integer index eliminating the extra columns of data.
1458# This is done to verifiy that the output data is in the correct and expected order.
1459 AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: s=.*' | sed -e 's/ b=.*//g']],
1460 [0], [$4], [], [kill `cat pid`])
1461# Here, the data is filtered and sorted in order to have all the rows in the index and be
1462# able to determined that all the involved rows are present.
1463 AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: s=.*' | sort -k 1,1n -k 2,2 -k 3,3]],
1464 [0], [$5], [], [kill `cat pid`])
1465# Filter the rows of data that corresponds to the integer index eliminating the extra columns of data.
1466# This is done to verifiy that the output data is in the correct and expected order.
1467 AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: i=.*' | sed -e 's/ b=.*//g']],
1468 [0], [$6], [], [kill `cat pid`])
1469# Here again, the data is filtered and sorted in order to have all the rows in the index and be
1470# able to determined that all the involved rows are present.
1471 AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: i=.*' | sort -k 1,1n -k 2,2 -k 3,3]],
1472 [0], [$7], [], [kill `cat pid`])
1473 OVSDB_SERVER_SHUTDOWN
1474 AT_CLEANUP])
1475
1476OVSDB_CHECK_IDL_COMPOUND_INDEX_DOUBLE_COLUMN_C([Compound_index, double column test ],
1477 [['["idltest",
1478 {"op": "insert", "table": "simple", "row": {"s":"List000", "i": 1, "b":true, "r":101.0}},
1479 {"op": "insert", "table": "simple", "row": {"s":"List000", "i": 2, "b":false, "r":102.0}},
1480 {"op": "insert", "table": "simple", "row": {"s":"List000", "i": 10, "b":true, "r":110.0}},
1481 {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 1, "b":false, "r":110.0}},
1482 {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 2, "b":true, "r":120.0}},
1483 {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 2, "b":true, "r":122.0}},
1484 {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 4, "b":true, "r":130.0}},
1485 {"op": "insert", "table": "simple", "row": {"s":"List005", "i": 5, "b":true, "r":130.0}},
1486 {"op": "insert", "table": "simple", "row": {"s":"List020", "i": 20, "b":true, "r":220.0}},
1487 {"op": "insert", "table": "simple", "row": {"s":"List020", "i": 19, "b":true, "r":219.0}}
1488 ]']],
1489 [idl_compound_index_double_column],
1490 [001: s=List000 i=1
1491001: s=List000 i=2
1492001: s=List000 i=10
1493001: s=List001 i=1
1494001: s=List001 i=2
1495001: s=List001 i=2
1496001: s=List001 i=4
1497001: s=List005 i=5
1498001: s=List020 i=19
1499001: s=List020 i=20
1500002: s=List000 i=10
1501002: s=List000 i=2
1502002: s=List000 i=1
1503002: s=List001 i=4
1504002: s=List001 i=2
1505002: s=List001 i=2
1506002: s=List001 i=1
1507002: s=List005 i=5
1508002: s=List020 i=20
1509002: s=List020 i=19
1510003: s=List000 i=10
1511004: s=List001 i=1
1512004: s=List001 i=2
1513004: s=List001 i=2
1514004: s=List001 i=4
1515004: s=List005 i=5
1516],
1517 [001: s=List000 i=1 b=True r=101.000000
1518001: s=List000 i=10 b=True r=110.000000
1519001: s=List000 i=2 b=False r=102.000000
1520001: s=List001 i=1 b=False r=110.000000
1521001: s=List001 i=2 b=True r=120.000000
1522001: s=List001 i=2 b=True r=122.000000
1523001: s=List001 i=4 b=True r=130.000000
1524001: s=List005 i=5 b=True r=130.000000
1525001: s=List020 i=19 b=True r=219.000000
1526001: s=List020 i=20 b=True r=220.000000
1527002: s=List000 i=1 b=True r=101.000000
1528002: s=List000 i=10 b=True r=110.000000
1529002: s=List000 i=2 b=False r=102.000000
1530002: s=List001 i=1 b=False r=110.000000
1531002: s=List001 i=2 b=True r=120.000000
1532002: s=List001 i=2 b=True r=122.000000
1533002: s=List001 i=4 b=True r=130.000000
1534002: s=List005 i=5 b=True r=130.000000
1535002: s=List020 i=19 b=True r=219.000000
1536002: s=List020 i=20 b=True r=220.000000
1537003: s=List000 i=10 b=True r=110.000000
1538004: s=List001 i=1 b=False r=110.000000
1539004: s=List001 i=2 b=True r=120.000000
1540004: s=List001 i=2 b=True r=122.000000
1541004: s=List001 i=4 b=True r=130.000000
1542004: s=List005 i=5 b=True r=130.000000
1543],
1544 [005: i=1 s=List000
1545005: i=1 s=List001
1546005: i=2 s=List000
1547005: i=2 s=List001
1548005: i=2 s=List001
1549005: i=4 s=List001
1550005: i=5 s=List005
1551005: i=10 s=List000
1552005: i=19 s=List020
1553005: i=20 s=List020
1554006: i=20 s=List020
1555006: i=19 s=List020
1556006: i=10 s=List000
1557006: i=5 s=List005
1558006: i=4 s=List001
1559006: i=2 s=List000
1560006: i=2 s=List001
1561006: i=2 s=List001
1562006: i=1 s=List000
1563006: i=1 s=List001
1564],
1565 [005: i=1 s=List000 b=True r=101.000000
1566005: i=1 s=List001 b=False r=110.000000
1567005: i=10 s=List000 b=True r=110.000000
1568005: i=19 s=List020 b=True r=219.000000
1569005: i=2 s=List000 b=False r=102.000000
1570005: i=2 s=List001 b=True r=120.000000
1571005: i=2 s=List001 b=True r=122.000000
1572005: i=20 s=List020 b=True r=220.000000
1573005: i=4 s=List001 b=True r=130.000000
1574005: i=5 s=List005 b=True r=130.000000
1575006: i=1 s=List000 b=True r=101.000000
1576006: i=1 s=List001 b=False r=110.000000
1577006: i=10 s=List000 b=True r=110.000000
1578006: i=19 s=List020 b=True r=219.000000
1579006: i=2 s=List000 b=False r=102.000000
1580006: i=2 s=List001 b=True r=120.000000
1581006: i=2 s=List001 b=True r=122.000000
1582006: i=20 s=List020 b=True r=220.000000
1583006: i=4 s=List001 b=True r=130.000000
1584006: i=5 s=List005 b=True r=130.000000
1585])