1 AT_BANNER([OVSDB -- interface description language (IDL)])
3 # OVSDB_CHECK_IDL_C(TITLE, [PRE-IDL-TXN], TRANSACTIONS, OUTPUT, [KEYWORDS],
6 # Creates a database with a schema derived from idltest.ovsidl, runs
7 # each PRE-IDL-TXN (if any), starts an ovsdb-server on that database,
8 # and runs "test-ovsdb idl" passing each of the TRANSACTIONS along.
10 # Checks that the overall output is OUTPUT. Before comparison, the
11 # output is sorted (using "sort") and UUIDs in the output are replaced
12 # by markers of the form <N> where N is a number. The first unique
13 # UUID is replaced by <0>, the next by <1>, and so on. If a given
14 # UUID appears more than once it is always replaced by the same
15 # marker. If FILTER is supplied then the output is also filtered
16 # through the specified program.
18 # TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS.
19 m4_define([OVSDB_CHECK_IDL_C],
21 AT_KEYWORDS([ovsdb server idl positive $5])
22 AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema],
23 [0], [stdout], [ignore])
24 AT_CHECK([ovsdb-server '-vPATTERN:console:ovsdb-server|%c|%m' --detach --pidfile="`pwd`"/pid --remote=punix:socket --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore])
26 [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore], [kill `cat pid`])])
27 AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 idl unix:socket $3],
28 [0], [stdout], [ignore], [kill `cat pid`])
29 AT_CHECK([sort stdout | perl $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]),
30 [0], [$4], [], [kill `cat pid`])
34 # same as OVSDB_CHECK_IDL but uses the Python IDL implementation.
35 m4_define([OVSDB_CHECK_IDL_PY],
36 [AT_SETUP([$1 - Python])
37 AT_SKIP_IF([test $HAVE_PYTHON = no])
38 AT_KEYWORDS([ovsdb server idl positive Python $5])
39 AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema],
40 [0], [stdout], [ignore])
41 AT_CHECK([ovsdb-server '-vPATTERN:console:ovsdb-server|%c|%m' --detach --pidfile="`pwd`"/pid --remote=punix:socket --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore])
43 [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore], [kill `cat pid`])])
44 AT_CHECK([$PYTHON $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket $3],
45 [0], [stdout], [ignore], [kill `cat pid`])
46 AT_CHECK([sort stdout | perl $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]),
47 [0], [$4], [], [kill `cat pid`])
51 m4_define([OVSDB_CHECK_IDL],
52 [OVSDB_CHECK_IDL_C($@)
53 OVSDB_CHECK_IDL_PY($@)])
55 OVSDB_CHECK_IDL([simple idl, initially empty, no ops],
62 OVSDB_CHECK_IDL([simple idl, initially empty, various ops],
71 "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"],
72 "ia": ["set", [1, 2, 3]],
73 "ra": ["set", [-0.5]],
74 "ba": ["set", [true]],
75 "sa": ["set", ["abc", "def"]],
76 "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
77 ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
85 "row": {"b": true}}]' \
90 "row": {"r": 123.5}}]' \
100 "ba": ["set", [false]],
102 "ua": ["set", []]}}]' \
106 "where": [["i", "<", 1]],
107 "row": {"s": "newstring"}}]' \
111 "where": [["i", "==", 0]]}]' \
114 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]}
115 002: i=0 r=0 b=false s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
116 002: i=1 r=2 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0>
117 003: {"error":null,"result":[{"count":2}]}
118 004: i=0 r=0 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
119 004: i=1 r=2 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0>
120 005: {"error":null,"result":[{"count":2}]}
121 006: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
122 006: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0>
123 007: {"error":null,"result":[{"uuid":["uuid","<6>"]}]}
124 008: i=-1 r=125 b=false s= u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
125 008: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
126 008: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0>
127 009: {"error":null,"result":[{"count":2}]}
128 010: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
129 010: i=0 r=123.5 b=true s=newstring u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
130 010: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0>
131 011: {"error":null,"result":[{"count":1}]}
132 012: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
133 012: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0>
135 014: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
136 014: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0>
140 OVSDB_CHECK_IDL([simple idl, initially populated],
148 "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"],
149 "ia": ["set", [1, 2, 3]],
150 "ra": ["set", [-0.5]],
151 "ba": ["set", [true]],
152 "sa": ["set", ["abc", "def"]],
153 "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
154 ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
162 "row": {"b": true}}]']],
163 [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
164 000: i=1 r=2 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<3> <4>] uuid=<5>
165 001: {"error":null,"result":[{"count":2}]}
166 002: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
167 002: i=1 r=2 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<3> <4>] uuid=<5>
171 OVSDB_CHECK_IDL([simple idl, writing via IDL],
179 "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"],
180 "ia": ["set", [1, 2, 3]],
181 "ra": ["set", [-0.5]],
182 "ba": ["set", [true]],
183 "sa": ["set", ["abc", "def"]],
184 "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
185 ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
189 [['verify 0 b, verify 1 r, set 0 b 1, set 1 r 3.5' \
190 'insert 2, verify 2 i, verify 1 b, delete 1']],
191 [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
192 000: i=1 r=2 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<3> <4>] uuid=<5>
193 001: commit, status=success
194 002: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
195 002: i=1 r=3.5 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<3> <4>] uuid=<5>
196 003: commit, status=success
197 004: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
198 004: i=2 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<6>
202 OVSDB_CHECK_IDL([simple idl, handling verification failure],
215 "where": [["i", "==", 1]],
216 "row": {"r": 5.0}}]' \
217 '+verify 1 r, set 1 r 3' \
218 'verify 1 r, set 1 r 3' \
220 [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
221 000: i=1 r=2 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2>
222 001: commit, status=success
223 002: {"error":null,"result":[{"count":1}]}
224 003: commit, status=try again
225 004: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
226 004: i=1 r=5 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2>
227 005: commit, status=success
228 006: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
229 006: i=1 r=3 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2>
233 OVSDB_CHECK_IDL([simple idl, increment operation],
238 [['set 0 r 2.0, increment 0']],
239 [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
240 001: commit, status=success, increment=1
241 002: i=1 r=2 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
245 OVSDB_CHECK_IDL([simple idl, aborting],
250 [['set 0 r 2.0, abort' \
252 [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
253 001: commit, status=aborted
254 002: commit, status=success
255 003: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
259 OVSDB_CHECK_IDL([simple idl, destroy without commit or abort],
264 [['set 0 r 2.0, destroy' \
266 [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
268 002: commit, status=success
269 003: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
273 OVSDB_CHECK_IDL([self-linking idl, consistent ops],
278 "row": {"i": 0, "k": ["named-uuid", "self"]},
279 "uuid-name": "self"}]' \
283 "row": {"i": 1, "k": ["named-uuid", "row2"]},
284 "uuid-name": "row1"},
287 "row": {"i": 2, "k": ["named-uuid", "row1"]},
288 "uuid-name": "row2"}]' \
292 "where": [["i", "==", 1]],
293 "row": {"k": ["uuid", "#1#"]}}]' \
298 "row": {"k": ["uuid", "#0#"]}}]']],
300 001: {"error":null,"result":[{"uuid":["uuid","<0>"]}]}
301 002: i=0 k=0 ka=[] l2= uuid=<0>
302 003: {"error":null,"result":[{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]}]}
303 004: i=0 k=0 ka=[] l2= uuid=<0>
304 004: i=1 k=2 ka=[] l2= uuid=<1>
305 004: i=2 k=1 ka=[] l2= uuid=<2>
306 005: {"error":null,"result":[{"count":1}]}
307 006: i=0 k=0 ka=[] l2= uuid=<0>
308 006: i=1 k=1 ka=[] l2= uuid=<1>
309 006: i=2 k=1 ka=[] l2= uuid=<2>
310 007: {"error":null,"result":[{"count":3}]}
311 008: i=0 k=0 ka=[] l2= uuid=<0>
312 008: i=1 k=0 ka=[] l2= uuid=<1>
313 008: i=2 k=0 ka=[] l2= uuid=<2>
317 OVSDB_CHECK_IDL([self-linking idl, inconsistent ops],
322 "row": {"i": 0, "k": ["uuid", "cf197cc5-c8c9-42f5-82d5-c71a9f2cb96b"]}}]' \
327 "row": {"i": 1, "k": ["named-uuid", "one"]}},
330 "row": {"i": 2, "k": ["named-uuid", "one"]}}]' \
335 "row": {"k": ["uuid", "c2fca39a-e69a-42a4-9c56-5eca85839ce9"]}}]' \
339 "where": [["_uuid", "==", ["uuid", "#1#"]]]}]' \
343 "where": [["_uuid", "==", ["uuid", "#2#"]]]}]' \
350 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"details":"Table link1 column k row <0> references nonexistent row <1> in table link1.","error":"referential integrity violation"}]}
351 002: {"error":null,"result":[{"uuid":["uuid","<2>"]},{"uuid":["uuid","<3>"]}]}
352 003: i=1 k=1 ka=[] l2= uuid=<2>
353 003: i=2 k=1 ka=[] l2= uuid=<3>
354 004: {"error":null,"result":[{"count":2},{"details":"Table link1 column k row <x> references nonexistent row <4> in table link1.","error":"referential integrity violation"}]}
355 005: {"error":null,"result":[{"count":1},{"details":"cannot delete link1 row <2> because of 1 remaining reference(s)","error":"referential integrity violation"}]}
356 006: {"error":null,"result":[{"count":1}]}
357 007: i=1 k=1 ka=[] l2= uuid=<2>
358 008: {"error":null,"result":[{"count":1}]}
363 [[sed -e '/004:/s/row <[23]> references/row <x> references/']])
365 OVSDB_CHECK_IDL([self-linking idl, sets],
370 "row": {"i": 0, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i0"]]]},
374 "row": {"i": 1, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i1"]]]},
378 "row": {"i": 2, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i2"]]]},
382 "row": {"i": 3, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i3"]]]},
383 "uuid-name": "i3"}]' \
388 "row": {"ka": ["set", [["uuid", "#0#"], ["uuid", "#1#"], ["uuid", "#2#"], ["uuid", "#3#"]]]}}]' \
392 "where": [["i", "==", 2]],
393 "row": {"ka": ["set", [["uuid", "#0#"], ["uuid", "88702e78-845b-4a6e-ad08-cf68922ae84a"], ["uuid", "#2#"]]]}}]' \
399 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]},{"uuid":["uuid","<3>"]}]}
400 002: i=0 k=0 ka=[0] l2= uuid=<0>
401 002: i=1 k=0 ka=[1] l2= uuid=<1>
402 002: i=2 k=0 ka=[2] l2= uuid=<2>
403 002: i=3 k=0 ka=[3] l2= uuid=<3>
404 003: {"error":null,"result":[{"count":4}]}
405 004: i=0 k=0 ka=[0 1 2 3] l2= uuid=<0>
406 004: i=1 k=0 ka=[0 1 2 3] l2= uuid=<1>
407 004: i=2 k=0 ka=[0 1 2 3] l2= uuid=<2>
408 004: i=3 k=0 ka=[0 1 2 3] l2= uuid=<3>
409 005: {"error":null,"result":[{"count":1},{"details":"Table link1 column ka row <2> references nonexistent row <4> in table link1.","error":"referential integrity violation"}]}
410 006: {"error":null,"result":[{"count":4}]}
415 OVSDB_CHECK_IDL([external-linking idl, consistent ops],
421 "uuid-name": "row0"},
424 "row": {"i": 1, "k": ["named-uuid", "row1"], "l2": ["set", [["named-uuid", "row0"]]]},
425 "uuid-name": "row1"}]']],
427 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]}
428 002: i=0 l1= uuid=<0>
429 002: i=1 k=1 ka=[] l2=0 uuid=<1>