1 AT_BANNER([OVSDB -- interface description language (IDL)])
3 # OVSDB_CHECK_IDL(TITLE, [PRE-IDL-TXN], TRANSACTIONS, OUTPUT, [KEYWORDS])
5 # Creates a database with a schema derived from idltest.ovsidl, runs
6 # each PRE-IDL-TXN (if any), starts an ovsdb-server on that database,
7 # and runs "test-ovsdb idl" passing each of the TRANSACTIONS along.
9 # Checks that the overall output is OUTPUT. Before comparison, the
10 # output is sorted (using "sort") and UUIDs in the output are replaced
11 # by markers of the form <N> where N is a number. The first unique
12 # UUID is replaced by <0>, the next by <1>, and so on. If a given
13 # UUID appears more than once it is always replaced by the same
16 # TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS.
17 m4_define([OVSDB_CHECK_IDL],
19 AT_KEYWORDS([ovsdb server idl positive $5])
20 AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema],
21 [0], [stdout], [ignore])
22 AT_CHECK([ovsdb-server '-vPATTERN:console:ovsdb-server|%c|%m' --detach --pidfile=$PWD/pid --remote=punix:socket --unixctl=$PWD/unixctl db], [0], [ignore], [ignore])
24 [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore], [kill `cat pid`])])
25 AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 idl unix:socket $3],
26 [0], [stdout], [ignore], [kill `cat pid`])
27 AT_CHECK([sort stdout | perl $srcdir/uuidfilt.pl], [0], [$4], [],
32 OVSDB_CHECK_IDL([simple idl, initially empty, no ops],
39 OVSDB_CHECK_IDL([simple idl, initially empty, various ops],
48 "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"],
49 "ia": ["set", [1, 2, 3]],
50 "ra": ["set", [-0.5]],
51 "ba": ["set", [true, false]],
52 "sa": ["set", ["abc", "def"]],
53 "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
54 ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
62 "row": {"b": true}}]' \
67 "row": {"r": 123.5}}]' \
77 "ba": ["set", [false]],
79 "ua": ["set", []]}}]' \
83 "where": [["i", "<", 1]],
84 "row": {"s": "newstring"}}]' \
88 "where": [["i", "==", 0]]}]' \
91 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]}
92 002: i=0 r=0 b=false s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
93 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>
94 003: {"error":null,"result":[{"count":2}]}
95 004: i=0 r=0 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
96 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>
97 005: {"error":null,"result":[{"count":2}]}
98 006: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
99 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>
100 007: {"error":null,"result":[{"uuid":["uuid","<6>"]}]}
101 008: i=-1 r=125 b=false s= u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
102 008: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
103 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>
104 009: {"error":null,"result":[{"count":2}]}
105 010: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
106 010: i=0 r=123.5 b=true s=newstring u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
107 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>
108 011: {"error":null,"result":[{"count":1}]}
109 012: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
110 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>
112 014: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
113 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>
117 OVSDB_CHECK_IDL([simple idl, initially populated],
125 "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"],
126 "ia": ["set", [1, 2, 3]],
127 "ra": ["set", [-0.5]],
128 "ba": ["set", [true, false]],
129 "sa": ["set", ["abc", "def"]],
130 "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
131 ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
139 "row": {"b": true}}]']],
140 [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
141 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>
142 001: {"error":null,"result":[{"count":2}]}
143 002: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
144 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>
148 OVSDB_CHECK_IDL([simple idl, writing via IDL],
156 "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"],
157 "ia": ["set", [1, 2, 3]],
158 "ra": ["set", [-0.5]],
159 "ba": ["set", [true, false]],
160 "sa": ["set", ["abc", "def"]],
161 "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
162 ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
166 [['set 0 b 1, set 1 r 3.5' \
167 'insert 2, delete 1']],
168 [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
169 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>
170 001: commit, status=success
171 002: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
172 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>
173 003: commit, status=success
174 004: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
175 004: i=2 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<6>
179 OVSDB_CHECK_IDL([simple idl, increment operation],
184 [['set 0 r 2.0, increment simple i']],
185 [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
186 001: commit, status=success, increment=1
187 002: i=1 r=2 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
191 OVSDB_CHECK_IDL([self-linking idl, consistent ops],
196 "row": {"i": 0, "k": ["named-uuid", "self"]},
197 "uuid-name": "self"}]' \
201 "row": {"i": 1, "k": ["named-uuid", "row2"]},
202 "uuid-name": "row1"},
205 "row": {"i": 2, "k": ["named-uuid", "row1"]},
206 "uuid-name": "row2"}]' \
210 "where": [["i", "==", 1]],
211 "row": {"k": ["uuid", "#1#"]}}]' \
216 "row": {"k": ["uuid", "#0#"]}}]']],
218 001: {"error":null,"result":[{"uuid":["uuid","<0>"]}]}
219 002: i=0 k=0 ka=[] l2= uuid=<0>
220 003: {"error":null,"result":[{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]}]}
221 004: i=0 k=0 ka=[] l2= uuid=<0>
222 004: i=1 k=2 ka=[] l2= uuid=<1>
223 004: i=2 k=1 ka=[] l2= uuid=<2>
224 005: {"error":null,"result":[{"count":1}]}
225 006: i=0 k=0 ka=[] l2= uuid=<0>
226 006: i=1 k=1 ka=[] l2= uuid=<1>
227 006: i=2 k=1 ka=[] l2= uuid=<2>
228 007: {"error":null,"result":[{"count":3}]}
229 008: i=0 k=0 ka=[] l2= uuid=<0>
230 008: i=1 k=0 ka=[] l2= uuid=<1>
231 008: i=2 k=0 ka=[] l2= uuid=<2>
235 OVSDB_CHECK_IDL([self-linking idl, inconsistent ops],
240 "row": {"i": 0, "k": ["uuid", "cf197cc5-c8c9-42f5-82d5-c71a9f2cb96b"]}}]' \
245 "row": {"i": 1, "k": ["named-uuid", "one"]}},
248 "row": {"i": 2, "k": ["named-uuid", "one"]}}]' \
253 "row": {"k": ["uuid", "c2fca39a-e69a-42a4-9c56-5eca85839ce9"]}}]' \
257 "where": [["_uuid", "==", ["uuid", "#1#"]]]}]' \
261 "where": [["_uuid", "==", ["uuid", "#2#"]]]}]' \
268 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"}]}
269 002: {"error":null,"result":[{"uuid":["uuid","<2>"]},{"uuid":["uuid","<3>"]}]}
270 003: i=1 k=1 ka=[] l2= uuid=<2>
271 003: i=2 k=1 ka=[] l2= uuid=<3>
272 004: {"error":null,"result":[{"count":2},{"details":"Table link1 column k row <2> references nonexistent row <4> in table link1.","error":"referential integrity violation"}]}
273 005: {"error":null,"result":[{"count":1},{"details":"cannot delete link1 row <2> because of 1 remaining reference(s)","error":"referential integrity violation"}]}
274 006: {"error":null,"result":[{"count":1}]}
275 007: i=1 k=1 ka=[] l2= uuid=<2>
276 008: {"error":null,"result":[{"count":1}]}
281 OVSDB_CHECK_IDL([self-linking idl, sets],
286 "row": {"i": 0, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i0"]]]},
290 "row": {"i": 1, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i1"]]]},
294 "row": {"i": 2, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i2"]]]},
298 "row": {"i": 3, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i3"]]]},
299 "uuid-name": "i3"}]' \
304 "row": {"ka": ["set", [["uuid", "#0#"], ["uuid", "#1#"], ["uuid", "#2#"], ["uuid", "#3#"]]]}}]' \
308 "where": [["i", "==", 2]],
309 "row": {"ka": ["set", [["uuid", "#0#"], ["uuid", "88702e78-845b-4a6e-ad08-cf68922ae84a"], ["uuid", "#2#"]]]}}]' \
315 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]},{"uuid":["uuid","<3>"]}]}
316 002: i=0 k=0 ka=[0] l2= uuid=<0>
317 002: i=1 k=0 ka=[1] l2= uuid=<1>
318 002: i=2 k=0 ka=[2] l2= uuid=<2>
319 002: i=3 k=0 ka=[3] l2= uuid=<3>
320 003: {"error":null,"result":[{"count":4}]}
321 004: i=0 k=0 ka=[0 1 2 3] l2= uuid=<0>
322 004: i=1 k=0 ka=[0 1 2 3] l2= uuid=<1>
323 004: i=2 k=0 ka=[0 1 2 3] l2= uuid=<2>
324 004: i=3 k=0 ka=[0 1 2 3] l2= uuid=<3>
325 005: {"error":null,"result":[{"count":1},{"details":"Table link1 column ka row <2> references nonexistent row <4> in table link1.","error":"referential integrity violation"}]}
326 006: {"error":null,"result":[{"count":4}]}
331 OVSDB_CHECK_IDL([external-linking idl, consistent ops],
337 "uuid-name": "row0"},
340 "row": {"i": 1, "k": ["named-uuid", "row1"], "l2": ["set", [["named-uuid", "row0"]]]},
341 "uuid-name": "row1"}]']],
343 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]}
344 002: i=0 l1= uuid=<0>
345 002: i=1 k=1 ka=[] l2=0 uuid=<1>