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