1 AT_BANNER([OVSDB -- queries])
3 OVSDB_CHECK_POSITIVE([queries on scalars],
6 {"i": {"type": "integer"},
8 "b": {"type": "boolean"},
9 "s": {"type": "string"},
10 "u": {"type": "uuid"}}}' \
15 "u": ["uuid", "b10d28f7-af18-4a67-9e78-2a6394516c59"]},
20 "u": ["uuid", "9179ca6d-6d65-400a-b455-3ad92783a099"]},
25 "u": ["uuid", "ad0fa355-8b84-4a36-a4b5-b2c1bfd91758"]},
30 "u": ["uuid", "62315898-64e0-40b9-b26f-ff74225303e6"]},
35 "u": ["uuid", "4a5127e2-0256-4a72-a7dc-6246213967c7"]}]' \
43 [["i", "includes", 3]],
44 [["i", "excludes", 2]],
51 [["r", "includes", 1]],
52 [["r", "excludes", 3]],
55 [["b", "includes", false]],
56 [["b", "excludes", true]],
59 [["s", "includes", "c"]],
60 [["s", "excludes", "d"]],
61 [["u", "==", ["uuid", "b10d28f7-af18-4a67-9e78-2a6394516c59"]]],
62 [["u", "!=", ["uuid", "9179ca6d-6d65-400a-b455-3ad92783a099"]]],
63 [["u", "includes",["uuid", "ad0fa355-8b84-4a36-a4b5-b2c1bfd91758"]]]]']],
95 OVSDB_CHECK_POSITIVE([queries on sets],
97 '{"columns": {"i": {"type": {"key": "integer", "min": 0, "max": "unlimited"}}}}' \
101 {"i": ["set", [0, 1]]},
103 {"i": ["set", [2, 0]]},
104 {"i": ["set", [2, 1]]},
105 {"i": ["set", [2, 1, 0]]}]' \
107 [["i", "==", ["set", []]]],
108 [["i", "==", ["set", [0]]]],
109 [["i", "==", ["set", [1]]]],
110 [["i", "==", ["set", [0, 1]]]],
111 [["i", "==", ["set", [2]]]],
112 [["i", "==", ["set", [2, 0]]]],
113 [["i", "==", ["set", [2, 1]]]],
114 [["i", "==", ["set", [2, 1, 0]]]],
115 [["i", "!=", ["set", []]]],
116 [["i", "!=", ["set", [0]]]],
117 [["i", "!=", ["set", [1]]]],
118 [["i", "!=", ["set", [0, 1]]]],
119 [["i", "!=", ["set", [2]]]],
120 [["i", "!=", ["set", [2, 0]]]],
121 [["i", "!=", ["set", [2, 1]]]],
122 [["i", "!=", ["set", [2, 1, 0]]]],
123 [["i", "includes", ["set", []]]],
124 [["i", "includes", ["set", [0]]]],
125 [["i", "includes", ["set", [1]]]],
126 [["i", "includes", ["set", [0, 1]]]],
127 [["i", "includes", ["set", [2]]]],
128 [["i", "includes", ["set", [2, 0]]]],
129 [["i", "includes", ["set", [2, 1]]]],
130 [["i", "includes", ["set", [2, 1, 0]]]],
131 [["i", "excludes", ["set", []]]],
132 [["i", "excludes", ["set", [0]]]],
133 [["i", "excludes", ["set", [1]]]],
134 [["i", "excludes", ["set", [0, 1]]]],
135 [["i", "excludes", ["set", [2]]]],
136 [["i", "excludes", ["set", [2, 0]]]],
137 [["i", "excludes", ["set", [2, 1]]]],
138 [["i", "excludes", ["set", [2, 1, 0]]]]]']],
172 query 32: 1---- ---], [query])
174 # This is the same as the "set" test except that it adds values,
175 # all of which always match.
176 OVSDB_CHECK_POSITIVE([queries on maps (1)],
178 '{"columns": {"i": {"type": {"key": "integer",
181 "max": "unlimited"}}}}' \
182 '[{"i": ["map", []]},
183 {"i": ["map", [[0, true]]]},
184 {"i": ["map", [[1, false]]]},
185 {"i": ["map", [[0, true], [1, false]]]},
186 {"i": ["map", [[2, true]]]},
187 {"i": ["map", [[2, true], [0, true]]]},
188 {"i": ["map", [[2, true], [1, false]]]},
189 {"i": ["map", [[2, true], [1, false], [0, true]]]}]' \
191 [["i", "==", ["map", []]]],
192 [["i", "==", ["map", [[0, true]]]]],
193 [["i", "==", ["map", [[1, false]]]]],
194 [["i", "==", ["map", [[0, true], [1, false]]]]],
195 [["i", "==", ["map", [[2, true]]]]],
196 [["i", "==", ["map", [[2, true], [0, true]]]]],
197 [["i", "==", ["map", [[2, true], [1, false]]]]],
198 [["i", "==", ["map", [[2, true], [1, false], [0, true]]]]],
199 [["i", "!=", ["map", []]]],
200 [["i", "!=", ["map", [[0, true]]]]],
201 [["i", "!=", ["map", [[1, false]]]]],
202 [["i", "!=", ["map", [[0, true], [1, false]]]]],
203 [["i", "!=", ["map", [[2, true]]]]],
204 [["i", "!=", ["map", [[2, true], [0, true]]]]],
205 [["i", "!=", ["map", [[2, true], [1, false]]]]],
206 [["i", "!=", ["map", [[2, true], [1, false], [0, true]]]]],
207 [["i", "includes", ["map", []]]],
208 [["i", "includes", ["map", [[0, true]]]]],
209 [["i", "includes", ["map", [[1, false]]]]],
210 [["i", "includes", ["map", [[0, true], [1, false]]]]],
211 [["i", "includes", ["map", [[2, true]]]]],
212 [["i", "includes", ["map", [[2, true], [0, true]]]]],
213 [["i", "includes", ["map", [[2, true], [1, false]]]]],
214 [["i", "includes", ["map", [[2, true], [1, false], [0, true]]]]],
215 [["i", "excludes", ["map", []]]],
216 [["i", "excludes", ["map", [[0, true]]]]],
217 [["i", "excludes", ["map", [[1, false]]]]],
218 [["i", "excludes", ["map", [[0, true], [1, false]]]]],
219 [["i", "excludes", ["map", [[2, true]]]]],
220 [["i", "excludes", ["map", [[2, true], [0, true]]]]],
221 [["i", "excludes", ["map", [[2, true], [1, false]]]]],
222 [["i", "excludes", ["map", [[2, true], [1, false], [0, true]]]]]]']],
256 query 32: 1---- ---], [query])
258 # This is the same as the "set" test except that it adds values,
259 # and those values don't always match.
260 OVSDB_CHECK_POSITIVE([queries on maps (2)],
262 '{"columns": {"i": {"type": {"key": "integer",
265 "max": "unlimited"}}}}' \
266 '[{"i": ["map", []]},
267 {"i": ["map", [[0, true]]]},
268 {"i": ["map", [[0, false]]]},
269 {"i": ["map", [[1, false]]]},
270 {"i": ["map", [[1, true]]]},
272 {"i": ["map", [[0, true], [1, false]]]},
273 {"i": ["map", [[0, true], [1, true]]]},
274 {"i": ["map", [[2, true]]]},
275 {"i": ["map", [[2, false]]]},
276 {"i": ["map", [[2, true], [0, true]]]},
278 {"i": ["map", [[2, false], [0, true]]]},
279 {"i": ["map", [[2, true], [1, false]]]},
280 {"i": ["map", [[2, true], [1, true]]]},
281 {"i": ["map", [[2, true], [1, false], [0, true]]]},
282 {"i": ["map", [[2, true], [1, false], [0, false]]]}]' \
284 [["i", "==", ["map", []]]],
285 [["i", "==", ["map", [[0, true]]]]],
286 [["i", "==", ["map", [[1, false]]]]],
287 [["i", "==", ["map", [[0, true], [1, false]]]]],
288 [["i", "==", ["map", [[2, true]]]]],
289 [["i", "==", ["map", [[2, true], [0, true]]]]],
290 [["i", "==", ["map", [[2, true], [1, false]]]]],
291 [["i", "==", ["map", [[2, true], [1, false], [0, true]]]]],
292 [["i", "!=", ["map", []]]],
293 [["i", "!=", ["map", [[0, true]]]]],
294 [["i", "!=", ["map", [[1, false]]]]],
295 [["i", "!=", ["map", [[0, true], [1, false]]]]],
296 [["i", "!=", ["map", [[2, true]]]]],
297 [["i", "!=", ["map", [[2, true], [0, true]]]]],
298 [["i", "!=", ["map", [[2, true], [1, false]]]]],
299 [["i", "!=", ["map", [[2, true], [1, false], [0, true]]]]],
300 [["i", "includes", ["map", []]]],
301 [["i", "includes", ["map", [[0, true]]]]],
302 [["i", "includes", ["map", [[1, false]]]]],
303 [["i", "includes", ["map", [[0, true], [1, false]]]]],
304 [["i", "includes", ["map", [[2, true]]]]],
305 [["i", "includes", ["map", [[2, true], [0, true]]]]],
306 [["i", "includes", ["map", [[2, true], [1, false]]]]],
307 [["i", "includes", ["map", [[2, true], [1, false], [0, true]]]]],
308 [["i", "excludes", ["map", []]]],
309 [["i", "excludes", ["map", [[0, true]]]]],
310 [["i", "excludes", ["map", [[1, false]]]]],
311 [["i", "excludes", ["map", [[0, true], [1, false]]]]],
312 [["i", "excludes", ["map", [[2, true]]]]],
313 [["i", "excludes", ["map", [[2, true], [0, true]]]]],
314 [["i", "excludes", ["map", [[2, true], [1, false]]]]],
315 [["i", "excludes", ["map", [[2, true], [1, false], [0, true]]]]]]']],
317 query 0: 11111 11111 11111
318 query 1: 1---- ----- -----
319 query 2: -1--- ----- -----
320 query 3: ---1- ----- -----
321 query 4: ----- 1---- -----
322 query 5: ----- --1-- -----
323 query 6: ----- ----1 -----
324 query 7: ----- ----- -1---
325 query 8: ----- ----- ---1-
326 query 9: -1111 11111 11111
327 query 10: 1-111 11111 11111
328 query 11: 111-1 11111 11111
329 query 12: 11111 -1111 11111
330 query 13: 11111 11-11 11111
331 query 14: 11111 1111- 11111
332 query 15: 11111 11111 1-111
333 query 16: 11111 11111 111-1
334 query 17: 11111 11111 11111
335 query 18: -1--- 11--1 1--1-
336 query 19: ---1- 1---- -1-11
337 query 20: ----- 1---- ---1-
338 query 21: ----- --1-1 -1111
339 query 22: ----- ----1 ---1-
340 query 23: ----- ----- -1-11
341 query 24: ----- ----- ---1-
342 query 25: 11111 11111 11111
343 query 26: 1-111 --11- -11-1
344 query 27: 111-1 -1111 1-1--
345 query 28: 1-1-1 --11- --1--
346 query 29: 11111 11-1- 1----
347 query 30: 1-111 ---1- -----
348 query 31: 111-1 -1-1- 1----
349 query 32: 1-1-1 ---1- -----], [query])
351 OVSDB_CHECK_POSITIVE([UUID-distinct queries on scalars],
354 {"i": {"type": "integer"},
355 "r": {"type": "real"},
356 "b": {"type": "boolean"},
357 "s": {"type": "string"},
358 "u": {"type": "uuid"}}}' \
363 "u": ["uuid", "b10d28f7-af18-4a67-9e78-2a6394516c59"]},
368 "u": ["uuid", "9179ca6d-6d65-400a-b455-3ad92783a099"]},
373 "u": ["uuid", "ad0fa355-8b84-4a36-a4b5-b2c1bfd91758"]},
378 "u": ["uuid", "62315898-64e0-40b9-b26f-ff74225303e6"]},
383 "u": ["uuid", "4a5127e2-0256-4a72-a7dc-6246213967c7"]}]' \
391 [["i", "includes", 3]],
392 [["i", "excludes", 2]],
399 [["r", "includes", 1]],
400 [["r", "excludes", 3]],
403 [["b", "includes", false]],
404 [["b", "excludes", true]],
407 [["s", "includes", "c"]],
408 [["s", "excludes", "d"]],
409 [["u", "==", ["uuid", "b10d28f7-af18-4a67-9e78-2a6394516c59"]]],
410 [["u", "!=", ["uuid", "9179ca6d-6d65-400a-b455-3ad92783a099"]]],
411 [["u", "includes",["uuid", "ad0fa355-8b84-4a36-a4b5-b2c1bfd91758"]]]]' \
444 OVSDB_CHECK_POSITIVE([Boolean-distinct queries on scalars],
447 {"i": {"type": "integer"},
448 "r": {"type": "real"},
449 "b": {"type": "boolean"},
450 "s": {"type": "string"},
451 "u": {"type": "uuid"}}}' \
456 "u": ["uuid", "b10d28f7-af18-4a67-9e78-2a6394516c59"]},
461 "u": ["uuid", "9179ca6d-6d65-400a-b455-3ad92783a099"]},
466 "u": ["uuid", "ad0fa355-8b84-4a36-a4b5-b2c1bfd91758"]},
471 "u": ["uuid", "62315898-64e0-40b9-b26f-ff74225303e6"]},
476 "u": ["uuid", "4a5127e2-0256-4a72-a7dc-6246213967c7"]}]' \
484 [["i", "includes", 3]],
485 [["i", "excludes", 2]],
492 [["r", "includes", 1]],
493 [["r", "excludes", 3]],
496 [["b", "includes", false]],
497 [["b", "excludes", true]],
500 [["s", "includes", "c"]],
501 [["s", "excludes", "d"]],
502 [["u", "==", ["uuid", "b10d28f7-af18-4a67-9e78-2a6394516c59"]]],
503 [["u", "!=", ["uuid", "9179ca6d-6d65-400a-b455-3ad92783a099"]]],
504 [["u", "includes",["uuid", "ad0fa355-8b84-4a36-a4b5-b2c1bfd91758"]]]]' \