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 OVS_CHECK_LCOV([ovsdb-tool create db $abs_builddir/idltest.ovsschema],
21 [0], [stdout], [ignore])
22 AT_CHECK([ovsdb-server '-vPATTERN:console:ovsdb-server|%c|%m' --detach --pidfile=$PWD/server-pid --listen=punix:socket --unixctl=$PWD/unixctl db], [0], [ignore], [ignore])
24 [OVS_CHECK_LCOV([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore], [kill `cat server-pid`])])
25 AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 idl unix:socket $3],
26 [0], [stdout], [ignore], [kill `cat server-pid`])
27 AT_CHECK([sort stdout | perl $srcdir/uuidfilt.pl], [0], [$4], [],
28 [kill `cat server-pid`])
32 OVSDB_CHECK_IDL([simple idl, initially empty, no ops],
39 OVSDB_CHECK_IDL([simple idl, initially empty, various ops],
47 "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"],
48 "ia": ["set", [1, 2, 3]],
49 "ra": ["set", [-0.5]],
50 "ba": ["set", [true, false]],
51 "sa": ["set", ["abc", "def"]],
52 "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
53 ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
60 "row": {"b": true}}]' \
64 "row": {"r": 123.5}}]' \
73 "ba": ["set", [false]],
75 "ua": ["set", []]}}]' \
78 "where": [["i", "<", 1]],
79 "row": {"s": "newstring"}}]' \
82 "where": [["i", "==", 0]]}]' \
85 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]}
86 002: i=0 r=0 b=false s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
87 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>
88 003: {"error":null,"result":[{"count":2}]}
89 004: i=0 r=0 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
90 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>
91 005: {"error":null,"result":[{"count":2}]}
92 006: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
93 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>
94 007: {"error":null,"result":[{"uuid":["uuid","<6>"]}]}
95 008: i=-1 r=125 b=false s= u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
96 008: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
97 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>
98 009: {"error":null,"result":[{"count":2}]}
99 010: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
100 010: i=0 r=123.5 b=true s=newstring u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
101 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>
102 011: {"error":null,"result":[{"count":1}]}
103 012: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
104 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>
106 014: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
107 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>
111 OVSDB_CHECK_IDL([simple idl, initially populated],
118 "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"],
119 "ia": ["set", [1, 2, 3]],
120 "ra": ["set", [-0.5]],
121 "ba": ["set", [true, false]],
122 "sa": ["set", ["abc", "def"]],
123 "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
124 ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
131 "row": {"b": true}}]']],
132 [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
133 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>
134 001: {"error":null,"result":[{"count":2}]}
135 002: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
136 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>
140 OVSDB_CHECK_IDL([simple idl, writing via IDL],
147 "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"],
148 "ia": ["set", [1, 2, 3]],
149 "ra": ["set", [-0.5]],
150 "ba": ["set", [true, false]],
151 "sa": ["set", ["abc", "def"]],
152 "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
153 ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
157 [['set 0 b 1, set 1 r 3.5' \
158 'insert 2, delete 1']],
159 [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
160 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>
161 001: commit, status=success
162 002: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
163 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>
164 003: commit, status=success
165 004: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
166 004: i=2 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<6>
170 OVSDB_CHECK_IDL([self-linking idl, consistent ops],
174 "row": {"i": 0, "k": ["named-uuid", "self"]},
175 "uuid-name": "self"}]' \
177 "uuid-name": "row1"},
179 "uuid-name": "row2"},
182 "row": {"i": 1, "k": ["named-uuid", "row2"]},
183 "uuid-name": "row1"},
186 "row": {"i": 2, "k": ["named-uuid", "row1"]},
187 "uuid-name": "row2"}]' \
190 "where": [["i", "==", 1]],
191 "row": {"k": ["uuid", "#1#"]}}]' \
195 "row": {"k": ["uuid", "#0#"]}}]']],
197 001: {"error":null,"result":[{"uuid":["uuid","<0>"]}]}
198 002: i=0 k=0 ka=[] l2= uuid=<0>
199 003: {"error":null,"result":[{"uuid":"<1>"},{"uuid":"<2>"},{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]}]}
200 004: i=0 k=0 ka=[] l2= uuid=<0>
201 004: i=1 k=2 ka=[] l2= uuid=<1>
202 004: i=2 k=1 ka=[] l2= uuid=<2>
203 005: {"error":null,"result":[{"count":1}]}
204 006: i=0 k=0 ka=[] l2= uuid=<0>
205 006: i=1 k=1 ka=[] l2= uuid=<1>
206 006: i=2 k=1 ka=[] l2= uuid=<2>
207 007: {"error":null,"result":[{"count":3}]}
208 008: i=0 k=0 ka=[] l2= uuid=<0>
209 008: i=1 k=0 ka=[] l2= uuid=<1>
210 008: i=2 k=0 ka=[] l2= uuid=<2>
214 OVSDB_CHECK_IDL([self-linking idl, inconsistent ops],
218 "row": {"i": 0, "k": ["uuid", "cf197cc5-c8c9-42f5-82d5-c71a9f2cb96b"]}}]' \
222 "row": {"k": ["uuid", "#0#"]}}]' \
226 "row": {"k": ["uuid", "c2fca39a-e69a-42a4-9c56-5eca85839ce9"]}}]' \
229 "row": {"i": 1, "k": ["uuid", "52d752a3-b062-4668-9446-d2e0d4a14703"]}}]' \
233 "row": {"k": ["uuid", "#1#"]}}]' \
236 001: {"error":null,"result":[{"uuid":["uuid","<0>"]}]}
237 002: i=0 k= ka=[] l2= uuid=<0>
238 003: {"error":null,"result":[{"count":1}]}
239 004: i=0 k=0 ka=[] l2= uuid=<0>
240 005: {"error":null,"result":[{"count":1}]}
241 006: i=0 k= ka=[] l2= uuid=<0>
242 007: {"error":null,"result":[{"uuid":["uuid","<1>"]}]}
243 008: i=0 k= ka=[] l2= uuid=<0>
244 008: i=1 k= ka=[] l2= uuid=<1>
245 009: {"error":null,"result":[{"count":2}]}
246 010: i=0 k=1 ka=[] l2= uuid=<0>
247 010: i=1 k=1 ka=[] l2= uuid=<1>
251 OVSDB_CHECK_IDL([self-linking idl, sets],
255 "row": {"i": 0, "ka": ["set", [["named-uuid", "i0"]]]},
259 "row": {"i": 1, "ka": ["set", [["named-uuid", "i1"]]]},
263 "row": {"i": 2, "ka": ["set", [["named-uuid", "i2"]]]},
267 "row": {"i": 3, "ka": ["set", [["named-uuid", "i3"]]]},
268 "uuid-name": "i3"}]' \
272 "row": {"ka": ["set", [["uuid", "#0#"], ["uuid", "#1#"], ["uuid", "#2#"], ["uuid", "#3#"]]]}}]' \
276 "row": {"ka": ["set", [["uuid", "#0#"], ["uuid", "88702e78-845b-4a6e-ad08-cf68922ae84a"], ["uuid", "#2#"], ["uuid", "1ac2b12e-b767-4805-a55d-43976e40c465"]]]}}]']],
278 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]},{"uuid":["uuid","<3>"]}]}
279 002: i=0 k= ka=[0] l2= uuid=<0>
280 002: i=1 k= ka=[1] l2= uuid=<1>
281 002: i=2 k= ka=[2] l2= uuid=<2>
282 002: i=3 k= ka=[3] l2= uuid=<3>
283 003: {"error":null,"result":[{"count":4}]}
284 004: i=0 k= ka=[0 1 2 3] l2= uuid=<0>
285 004: i=1 k= ka=[0 1 2 3] l2= uuid=<1>
286 004: i=2 k= ka=[0 1 2 3] l2= uuid=<2>
287 004: i=3 k= ka=[0 1 2 3] l2= uuid=<3>
288 005: {"error":null,"result":[{"count":4}]}
289 006: i=0 k= ka=[0 2] l2= uuid=<0>
290 006: i=1 k= ka=[0 2] l2= uuid=<1>
291 006: i=2 k= ka=[0 2] l2= uuid=<2>
292 006: i=3 k= ka=[0 2] l2= uuid=<3>
296 OVSDB_CHECK_IDL([external-linking idl, consistent ops],
301 "uuid-name": "row0"},
304 "row": {"i": 1, "l2": ["set", [["named-uuid", "row0"]]]},
305 "uuid-name": "row1"}]']],
307 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]}
308 002: i=0 l1= uuid=<0>
309 002: i=1 k= ka=[] l2=0 uuid=<1>