Setting tag sliver-openvswitch-2.2.90-1
[sliver-openvswitch.git] / tests / ovsdb-row.at
1 AT_BANNER([OVSDB -- rows])
2
3 m4_define([RESERVED_COLUMNS], [["_uuid":["uuid","00000000-0000-0000-0000-000000000000"],"_version":["uuid","00000000-0000-0000-0000-000000000000"]]])
4
5 OVSDB_CHECK_POSITIVE([row with one string column],
6   [[parse-rows \
7     '{"columns": {"name": {"type": "string"}}}' \
8     '{"name": "value"}' \
9     '{"name": ""}' \
10     '{"name": "longer string with spaces"}' \
11     '{}']],
12   [{RESERVED_COLUMNS,"name":"value"}
13 name
14 {RESERVED_COLUMNS,"name":""}
15 name
16 {RESERVED_COLUMNS,"name":"longer string with spaces"}
17 name
18 {RESERVED_COLUMNS,"name":""}
19 <none>], [])
20
21 OVSDB_CHECK_POSITIVE([row with one integer column],
22   [[parse-rows \
23     '{"columns": {"count": {"type": "integer"}}}' \
24     '{"count": 1}' \
25     '{"count": -1}' \
26     '{"count": 2e10}' \
27     '{}']],
28   [{RESERVED_COLUMNS,"count":1}
29 count
30 {RESERVED_COLUMNS,"count":-1}
31 count
32 {RESERVED_COLUMNS,"count":20000000000}
33 count
34 {RESERVED_COLUMNS,"count":0}
35 <none>], [])
36
37 OVSDB_CHECK_POSITIVE([row with one real column],
38   [[parse-rows \
39     '{"columns": {"cost": {"type": "real"}}}' \
40     '{"cost": 1.0}' \
41     '{"cost": -2.0}' \
42     '{"cost": 123000}' \
43     '{}']],
44   [{RESERVED_COLUMNS,"cost":1}
45 cost
46 {RESERVED_COLUMNS,"cost":-2}
47 cost
48 {RESERVED_COLUMNS,"cost":123000}
49 cost
50 {RESERVED_COLUMNS,"cost":0}
51 <none>], [])
52
53 OVSDB_CHECK_POSITIVE([row with one boolean column],
54   [[parse-rows \
55     '{"columns": {"feasible": {"type": "boolean"}}}' \
56     '{"feasible": true}' \
57     '{"feasible": false}' \
58     '{}']],
59   [{RESERVED_COLUMNS,"feasible":true}
60 feasible
61 {RESERVED_COLUMNS,"feasible":false}
62 feasible
63 {RESERVED_COLUMNS,"feasible":false}
64 <none>], [])
65
66 OVSDB_CHECK_POSITIVE([row with one uuid column],
67   [[parse-rows \
68     '{"columns": {"ref": {"type": "uuid"}}}' \
69     '{"ref": ["uuid", "f707423d-bf5b-48b5-b6c0-797c900ba4b6"]}' \
70     '{"ref": ["uuid", "33583cc5-d2f4-43de-b1ca-8aac14071b51"]}' \
71     '{}']],
72   [{RESERVED_COLUMNS,"ref":[["uuid","f707423d-bf5b-48b5-b6c0-797c900ba4b6"]]}
73 ref
74 {RESERVED_COLUMNS,"ref":[["uuid","33583cc5-d2f4-43de-b1ca-8aac14071b51"]]}
75 ref
76 {RESERVED_COLUMNS,"ref":[["uuid","00000000-0000-0000-0000-000000000000"]]}
77 <none>], [])
78
79 OVSDB_CHECK_POSITIVE([row with set of 1 to 2 elements],
80   [[parse-rows \
81     '{"columns": {"myset": {"type": {"key": "integer", "min": 1, "max": 2}}}}' \
82     '{}']],
83   [{RESERVED_COLUMNS,["myset":0]}
84 <none>])
85
86 OVSDB_CHECK_POSITIVE([row with map of 1 to 2 elements],
87   [[parse-rows \
88     '{"columns": {"mymap": {"type": {"key": "integer", "value": "uuid", "min": 1, "max": 2}}}}' \
89     '{}']],
90   [{RESERVED_COLUMNS,["mymap":["map",[[0,["uuid","00000000-0000-0000-0000-000000000000"]]]]]}
91 <none>], [])
92
93 OVSDB_CHECK_POSITIVE([row with several columns],
94   [[parse-rows \
95     '{"columns":
96         {"vswitch": {"type": "uuid"},
97          "name": {"type": "string"},
98          "datapath_id": {"type": {"key": "string", "min": 0}},
99          "hwaddr": {"type": "string"},
100          "mirrors": {"type": {"key": "uuid", "min": 0, "max": "unlimited"}},
101          "netflows": {"type": {"key": "uuid", "min": 0, "max": "unlimited"}},
102          "controller": {"type": {"key": "uuid", "min": 0}},
103          "listeners": {"type": {"key": "uuid", "min": 0, "max": "unlimited"}},
104          "snoops": {"type": {"key": "uuid", "min": 0, "max": "unlimited"}}}}' \
105     '{"vswitch": ["uuid", "1a5c7280-0d4c-4e34-9ec7-c772339f7774"],
106       "name": "br0",
107       "datapath_id": "000ae4256bb0",
108       "hwaddr": "00:0a:e4:25:6b:b0"}' \
109     '{}']],
110  [{RESERVED_COLUMNS,["controller":["set",[]],"datapath_id":"000ae4256bb0","hwaddr":"00:0a:e4:25:6b:b0","listeners":["set",[]],"mirrors":["set",[]],"name":"br0","netflows":["set",[]],"snoops":["set",[]],"vswitch":["uuid","1a5c7280-0d4c-4e34-9ec7-c772339f7774"]]}
111 datapath_id, hwaddr, name, vswitch
112 {RESERVED_COLUMNS,["controller":["set",[]],"datapath_id":["set",[]],"hwaddr":"","listeners":["set",[]],"mirrors":["set",[]],"name":"","netflows":["set",[]],"snoops":["set",[]],"vswitch":["uuid","00000000-0000-0000-0000-000000000000"]]}
113 <none>], [])
114
115 OVSDB_CHECK_POSITIVE([row hashing (scalars)],
116   [[compare-rows \
117     '{"columns":
118         {"i": {"type": "integer"},
119          "r": {"type": "real"},
120          "b": {"type": "boolean"},
121          "s": {"type": "string"},
122          "u": {"type": "uuid"}}}' \
123      '["null", {}]' \
124      '["i1", {"i": 1}]' \
125      '["i2", {"i": 2}]' \
126      '["i4", {"i": 4}]' \
127      '["i8", {"i": 8}]' \
128      '["i16", {"i": 16}]' \
129      '["i32", {"i": 32}]' \
130      '["i64", {"i": 64}]' \
131      '["i128", {"i": 128}]' \
132      '["i256", {"i": 256}]' \
133      '["null2", {"r": -0}]' \
134      '["r123", {"r": 123}]' \
135      '["r0.0625", {"r": 0.0625}]' \
136      '["r0.125", {"r": 0.125}]' \
137      '["r0.25", {"r": 0.25}]' \
138      '["r0.5", {"r": 0.5}]' \
139      '["r1", {"r": 1}]' \
140      '["r2", {"r": 2}]' \
141      '["r4", {"r": 4}]' \
142      '["r8", {"r": 8}]' \
143      '["r16", {"r": 16}]' \
144      '["r32", {"r": 32}]' \
145      '["null3", {"b": false}]' \
146      '["b1", {"b": true}]' \
147      '["null4", {"s": ""}]' \
148      '["s0", {"s": "a"}]' \
149      '["s1", {"s": "b"}]' \
150      '["s2", {"s": "c"}]' \
151      '["s3", {"s": "d"}]' \
152      '["s4", {"s": "e"}]' \
153      '["s5", {"s": "f"}]' \
154      '["s6", {"s": "g"}]' \
155      '["s7", {"s": "h"}]' \
156      '["s8", {"s": "i"}]' \
157      '["s9", {"s": "j"}]' \
158      '["null5", {"u": ["uuid","00000000-0000-0000-0000-000000000000"]}]' \
159      '["u1", {"u": ["uuid","10000000-0000-0000-0000-000000000000"]}]' \
160      '["u2", {"u": ["uuid","01000000-0000-0000-0000-000000000000"]}]' \
161      '["u3", {"u": ["uuid","00100000-0000-0000-0000-000000000000"]}]' \
162      '["u4", {"u": ["uuid","00010000-0000-0000-0000-000000000000"]}]' \
163      '["u5", {"u": ["uuid","00001000-0000-0000-0000-000000000000"]}]' \
164      '["u6", {"u": ["uuid","00000100-0000-0000-0000-000000000000"]}]' \
165      '["u7", {"u": ["uuid","00000010-0000-0000-0000-000000000000"]}]' \
166      '["u8", {"u": ["uuid","00000001-0000-0000-0000-000000000000"]}]' \
167      '["null6", {"u": ["uuid","00000000-c6db-4d22-970f-b41fabd20c4b"]}]']],
168   [[null == null2
169 null == null3
170 null == null4
171 null == null5
172 hash(null) == hash(null6)
173 null2 == null3
174 null2 == null4
175 null2 == null5
176 hash(null2) == hash(null6)
177 null3 == null4
178 null3 == null5
179 hash(null3) == hash(null6)
180 null4 == null5
181 hash(null4) == hash(null6)
182 hash(null5) == hash(null6)]])
183
184 OVSDB_CHECK_POSITIVE([row hashing (sets)],
185   [[compare-rows \
186     '{"columns":
187         {"i": {"type": {"key": "integer", "min": 0, "max": "unlimited"}},
188          "r": {"type": {"key": "real", "min": 0, "max": "unlimited"}},
189          "b": {"type": {"key": "boolean", "min": 0, "max": "unlimited"}},
190          "s": {"type": {"key": "string", "min": 0, "max": "unlimited"}},
191          "u": {"type": {"key": "uuid", "min": 0, "max": "unlimited"}}}}' \
192     '["null0", {"i": ["set", []]}]' \
193     '["i0", {"i": ["set", [0]]}]' \
194     '["i01", {"i": ["set", [0, 1]]}]' \
195     '["i012", {"i": ["set", [0, 1, 2]]}]' \
196     '["i021", {"i": ["set", [0, 2, 1]]}]' \
197     '["i201", {"i": ["set", [2, 0, 1]]}]' \
198     '["i102", {"i": ["set", [1, 0, 2]]}]' \
199     '["i120", {"i": ["set", [1, 2, 0]]}]' \
200     '["i210", {"i": ["set", [2, 1, 0]]}]' \
201     '["r0", {"r": ["set", [0]]}]' \
202     '["r01", {"r": ["set", [0, 1]]}]' \
203     '["r012", {"r": ["set", [0, 1, 2]]}]' \
204     '["r201", {"r": ["set", [2, 0, 1]]}]' \
205     '["null1", {"b": ["set", []]}]' \
206     '["b0", {"b": ["set", [false]]}]' \
207     '["b1", {"b": ["set", [true]]}]' \
208     '["b01", {"b": ["set", [false, true]]}]' \
209     '["b10", {"b": ["set", [true, false]]}]' \
210     '["null2", {"s": ["set", []]}]' \
211     '["sa", {"s": ["set", ["a"]]}]' \
212     '["sb", {"s": ["set", ["b"]]}]' \
213     '["sab", {"s": ["set", ["a", "b"]]}]' \
214     '["sba", {"s": ["set", ["b", "a"]]}]']],
215   [[null0 == null1
216 null0 == null2
217 i012 == i021
218 i012 == i201
219 i012 == i102
220 i012 == i120
221 i012 == i210
222 i021 == i201
223 i021 == i102
224 i021 == i120
225 i021 == i210
226 i201 == i102
227 i201 == i120
228 i201 == i210
229 i102 == i120
230 i102 == i210
231 i120 == i210
232 r012 == r201
233 null1 == null2
234 b01 == b10
235 sab == sba]])
236
237 OVSDB_CHECK_POSITIVE([row hashing (maps)],
238   [[compare-rows \
239     '{"columns":
240         {"ii": {"type": {"key": "integer", "value": "integer", 
241                          "min": 0, "max": "unlimited"}},
242          "rr": {"type": {"key": "real", "value": "real",
243                          "min": 0, "max": "unlimited"}},
244          "bb": {"type": {"key": "boolean", "value": "boolean",
245                          "min": 0, "max": "unlimited"}},
246          "ss": {"type": {"key": "string", "value": "string",
247                          "min": 0, "max": "unlimited"}}}}' \
248     '["null", {}]' \
249     '["ii0", {"ii": ["map", [[0, 0]]]}]' \
250     '["ii1", {"ii": ["map", [[0, 1]]]}]' \
251     '["ii00", {"ii": ["map", [[0, 0], [1, 0]]]}]' \
252     '["ii01", {"ii": ["map", [[0, 0], [1, 1]]]}]' \
253     '["ii10", {"ii": ["map", [[0, 1], [1, 0]]]}]' \
254     '["ii11", {"ii": ["map", [[0, 1], [1, 1]]]}]' \
255     '["rr0", {"rr": ["map", [[0, 0]]]}]' \
256     '["rr0", {"rr": ["map", [[0, 1]]]}]' \
257     '["rr00", {"rr": ["map", [[0, 0], [1, 0]]]}]' \
258     '["rr01", {"rr": ["map", [[0, 0], [1, 1]]]}]' \
259     '["rr10", {"rr": ["map", [[0, 1], [1, 0]]]}]' \
260     '["rr11", {"rr": ["map", [[0, 1], [1, 1]]]}]' \
261     '["bb0", {"bb": ["map", [[false, false]]]}]' \
262     '["bb1", {"bb": ["map", [[false, true]]]}]' \
263     '["bb00", {"bb": ["map", [[false, false], [true, false]]]}]' \
264     '["bb01", {"bb": ["map", [[false, false], [true, true]]]}]' \
265     '["bb10", {"bb": ["map", [[false, true], [true, false]]]}]' \
266     '["bb11", {"bb": ["map", [[false, true], [true, true]]]}]' \
267     '["ss0", {"ss": ["map", [["a", "a"]]]}]' \
268     '["ss1", {"ss": ["map", [["a", "b"]]]}]' \
269     '["ss00", {"ss": ["map", [["a", "a"], ["b", "a"]]]}]' \
270     '["ss01", {"ss": ["map", [["a", "a"], ["b", "b"]]]}]' \
271     '["ss10", {"ss": ["map", [["a", "b"], ["b", "a"]]]}]' \
272     '["ss11", {"ss": ["map", [["a", "b"], ["b", "b"]]]}]'; echo
273 ]], [[]])