1 AT_BANNER([OVSDB -- interface description language (IDL)])
3 # OVSDB_CHECK_IDL(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],
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 OVSDB_CHECK_IDL([simple idl, initially empty, no ops],
41 OVSDB_CHECK_IDL([simple idl, initially empty, various ops],
50 "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"],
51 "ia": ["set", [1, 2, 3]],
52 "ra": ["set", [-0.5]],
53 "ba": ["set", [true, false]],
54 "sa": ["set", ["abc", "def"]],
55 "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
56 ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
64 "row": {"b": true}}]' \
69 "row": {"r": 123.5}}]' \
79 "ba": ["set", [false]],
81 "ua": ["set", []]}}]' \
85 "where": [["i", "<", 1]],
86 "row": {"s": "newstring"}}]' \
90 "where": [["i", "==", 0]]}]' \
93 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]}
94 002: i=0 r=0 b=false s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
95 002: i=1 r=2 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[false true] sa=[abc def] ua=[<4> <5>] uuid=<0>
96 003: {"error":null,"result":[{"count":2}]}
97 004: i=0 r=0 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
98 004: i=1 r=2 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[false true] sa=[abc def] ua=[<4> <5>] uuid=<0>
99 005: {"error":null,"result":[{"count":2}]}
100 006: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
101 006: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[false true] sa=[abc def] ua=[<4> <5>] uuid=<0>
102 007: {"error":null,"result":[{"uuid":["uuid","<6>"]}]}
103 008: i=-1 r=125 b=false s= u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
104 008: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
105 008: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[false true] sa=[abc def] ua=[<4> <5>] uuid=<0>
106 009: {"error":null,"result":[{"count":2}]}
107 010: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
108 010: i=0 r=123.5 b=true s=newstring u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
109 010: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[false true] sa=[abc def] ua=[<4> <5>] uuid=<0>
110 011: {"error":null,"result":[{"count":1}]}
111 012: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
112 012: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[false true] sa=[abc def] ua=[<4> <5>] uuid=<0>
114 014: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
115 014: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[false true] sa=[abc def] ua=[<4> <5>] uuid=<0>
119 OVSDB_CHECK_IDL([simple idl, initially populated],
127 "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"],
128 "ia": ["set", [1, 2, 3]],
129 "ra": ["set", [-0.5]],
130 "ba": ["set", [true, false]],
131 "sa": ["set", ["abc", "def"]],
132 "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
133 ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
141 "row": {"b": true}}]']],
142 [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
143 000: i=1 r=2 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[false true] sa=[abc def] ua=[<3> <4>] uuid=<5>
144 001: {"error":null,"result":[{"count":2}]}
145 002: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
146 002: i=1 r=2 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[false true] sa=[abc def] ua=[<3> <4>] uuid=<5>
150 OVSDB_CHECK_IDL([simple idl, writing via IDL],
158 "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"],
159 "ia": ["set", [1, 2, 3]],
160 "ra": ["set", [-0.5]],
161 "ba": ["set", [true, false]],
162 "sa": ["set", ["abc", "def"]],
163 "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
164 ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
168 [['verify 0 b, verify 1 r, set 0 b 1, set 1 r 3.5' \
169 'insert 2, verify 2 i, verify 1 b, delete 1']],
170 [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
171 000: i=1 r=2 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[false true] sa=[abc def] ua=[<3> <4>] uuid=<5>
172 001: commit, status=success
173 002: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
174 002: i=1 r=3.5 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[false true] sa=[abc def] ua=[<3> <4>] uuid=<5>
175 003: commit, status=success
176 004: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
177 004: i=2 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<6>
181 OVSDB_CHECK_IDL([simple idl, handling verification failure],
194 "where": [["i", "==", 1]],
195 "row": {"r": 5.0}}]' \
196 '+verify 1 r, set 1 r 3' \
197 'verify 1 r, set 1 r 3' \
199 [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
200 000: i=1 r=2 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2>
201 001: commit, status=success
202 002: {"error":null,"result":[{"count":1}]}
203 003: commit, status=try again
204 004: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
205 004: i=1 r=5 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2>
206 005: commit, status=success
207 006: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
208 006: i=1 r=3 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2>
212 OVSDB_CHECK_IDL([simple idl, increment operation],
217 [['set 0 r 2.0, increment simple i']],
218 [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
219 001: commit, status=success, increment=1
220 002: i=1 r=2 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
224 OVSDB_CHECK_IDL([self-linking idl, consistent ops],
229 "row": {"i": 0, "k": ["named-uuid", "self"]},
230 "uuid-name": "self"}]' \
234 "row": {"i": 1, "k": ["named-uuid", "row2"]},
235 "uuid-name": "row1"},
238 "row": {"i": 2, "k": ["named-uuid", "row1"]},
239 "uuid-name": "row2"}]' \
243 "where": [["i", "==", 1]],
244 "row": {"k": ["uuid", "#1#"]}}]' \
249 "row": {"k": ["uuid", "#0#"]}}]']],
251 001: {"error":null,"result":[{"uuid":["uuid","<0>"]}]}
252 002: i=0 k=0 ka=[] l2= uuid=<0>
253 003: {"error":null,"result":[{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]}]}
254 004: i=0 k=0 ka=[] l2= uuid=<0>
255 004: i=1 k=2 ka=[] l2= uuid=<1>
256 004: i=2 k=1 ka=[] l2= uuid=<2>
257 005: {"error":null,"result":[{"count":1}]}
258 006: i=0 k=0 ka=[] l2= uuid=<0>
259 006: i=1 k=1 ka=[] l2= uuid=<1>
260 006: i=2 k=1 ka=[] l2= uuid=<2>
261 007: {"error":null,"result":[{"count":3}]}
262 008: i=0 k=0 ka=[] l2= uuid=<0>
263 008: i=1 k=0 ka=[] l2= uuid=<1>
264 008: i=2 k=0 ka=[] l2= uuid=<2>
268 OVSDB_CHECK_IDL([self-linking idl, inconsistent ops],
273 "row": {"i": 0, "k": ["uuid", "cf197cc5-c8c9-42f5-82d5-c71a9f2cb96b"]}}]' \
278 "row": {"i": 1, "k": ["named-uuid", "one"]}},
281 "row": {"i": 2, "k": ["named-uuid", "one"]}}]' \
286 "row": {"k": ["uuid", "c2fca39a-e69a-42a4-9c56-5eca85839ce9"]}}]' \
290 "where": [["_uuid", "==", ["uuid", "#1#"]]]}]' \
294 "where": [["_uuid", "==", ["uuid", "#2#"]]]}]' \
301 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"}]}
302 002: {"error":null,"result":[{"uuid":["uuid","<2>"]},{"uuid":["uuid","<3>"]}]}
303 003: i=1 k=1 ka=[] l2= uuid=<2>
304 003: i=2 k=1 ka=[] l2= uuid=<3>
305 004: {"error":null,"result":[{"count":2},{"details":"Table link1 column k row <x> references nonexistent row <4> in table link1.","error":"referential integrity violation"}]}
306 005: {"error":null,"result":[{"count":1},{"details":"cannot delete link1 row <2> because of 1 remaining reference(s)","error":"referential integrity violation"}]}
307 006: {"error":null,"result":[{"count":1}]}
308 007: i=1 k=1 ka=[] l2= uuid=<2>
309 008: {"error":null,"result":[{"count":1}]}
314 [[sed -e '/004:/s/row <[23]> references/row <x> references/']])
316 OVSDB_CHECK_IDL([self-linking idl, sets],
321 "row": {"i": 0, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i0"]]]},
325 "row": {"i": 1, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i1"]]]},
329 "row": {"i": 2, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i2"]]]},
333 "row": {"i": 3, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i3"]]]},
334 "uuid-name": "i3"}]' \
339 "row": {"ka": ["set", [["uuid", "#0#"], ["uuid", "#1#"], ["uuid", "#2#"], ["uuid", "#3#"]]]}}]' \
343 "where": [["i", "==", 2]],
344 "row": {"ka": ["set", [["uuid", "#0#"], ["uuid", "88702e78-845b-4a6e-ad08-cf68922ae84a"], ["uuid", "#2#"]]]}}]' \
350 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]},{"uuid":["uuid","<3>"]}]}
351 002: i=0 k=0 ka=[0] l2= uuid=<0>
352 002: i=1 k=0 ka=[1] l2= uuid=<1>
353 002: i=2 k=0 ka=[2] l2= uuid=<2>
354 002: i=3 k=0 ka=[3] l2= uuid=<3>
355 003: {"error":null,"result":[{"count":4}]}
356 004: i=0 k=0 ka=[0 1 2 3] l2= uuid=<0>
357 004: i=1 k=0 ka=[0 1 2 3] l2= uuid=<1>
358 004: i=2 k=0 ka=[0 1 2 3] l2= uuid=<2>
359 004: i=3 k=0 ka=[0 1 2 3] l2= uuid=<3>
360 005: {"error":null,"result":[{"count":1},{"details":"Table link1 column ka row <2> references nonexistent row <4> in table link1.","error":"referential integrity violation"}]}
361 006: {"error":null,"result":[{"count":4}]}
366 OVSDB_CHECK_IDL([external-linking idl, consistent ops],
372 "uuid-name": "row0"},
375 "row": {"i": 1, "k": ["named-uuid", "row1"], "l2": ["set", [["named-uuid", "row0"]]]},
376 "uuid-name": "row1"}]']],
378 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]}
379 002: i=0 l1= uuid=<0>
380 002: i=1 k=1 ka=[] l2=0 uuid=<1>