]> git.proxmox.com Git - ovs.git/blob - tests/ovsdb-row.at
dpif-netdev: Incremental addition/deletion of PMD threads.
[ovs.git] / tests / ovsdb-row.at
1 AT_BANNER([OVSDB -- rows])
2
3 OVSDB_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 '{}']],
10 [[{"_uuid":["uuid","00000000-0000-0000-0000-000000000000"],"_version":["uuid","00000000-0000-0000-0000-000000000000"],"name":"value"}
11 name
12 {"_uuid":["uuid","00000000-0000-0000-0000-000000000000"],"_version":["uuid","00000000-0000-0000-0000-000000000000"],"name":""}
13 name
14 {"_uuid":["uuid","00000000-0000-0000-0000-000000000000"],"_version":["uuid","00000000-0000-0000-0000-000000000000"],"name":"longer string with spaces"}
15 name
16 {"_uuid":["uuid","00000000-0000-0000-0000-000000000000"],"_version":["uuid","00000000-0000-0000-0000-000000000000"],"name":""}
17 <none>]], [])
18
19 OVSDB_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 '{}']],
26 [[{"_uuid":["uuid","00000000-0000-0000-0000-000000000000"],"_version":["uuid","00000000-0000-0000-0000-000000000000"],"count":1}
27 count
28 {"_uuid":["uuid","00000000-0000-0000-0000-000000000000"],"_version":["uuid","00000000-0000-0000-0000-000000000000"],"count":-1}
29 count
30 {"_uuid":["uuid","00000000-0000-0000-0000-000000000000"],"_version":["uuid","00000000-0000-0000-0000-000000000000"],"count":20000000000}
31 count
32 {"_uuid":["uuid","00000000-0000-0000-0000-000000000000"],"_version":["uuid","00000000-0000-0000-0000-000000000000"],"count":0}
33 <none>]], [])
34
35 OVSDB_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 '{}']],
42 [[{"_uuid":["uuid","00000000-0000-0000-0000-000000000000"],"_version":["uuid","00000000-0000-0000-0000-000000000000"],"cost":1}
43 cost
44 {"_uuid":["uuid","00000000-0000-0000-0000-000000000000"],"_version":["uuid","00000000-0000-0000-0000-000000000000"],"cost":-2}
45 cost
46 {"_uuid":["uuid","00000000-0000-0000-0000-000000000000"],"_version":["uuid","00000000-0000-0000-0000-000000000000"],"cost":123000}
47 cost
48 {"_uuid":["uuid","00000000-0000-0000-0000-000000000000"],"_version":["uuid","00000000-0000-0000-0000-000000000000"],"cost":0}
49 <none>]], [])
50
51 OVSDB_CHECK_POSITIVE([row with one boolean column],
52 [[parse-rows \
53 '{"columns": {"feasible": {"type": "boolean"}}}' \
54 '{"feasible": true}' \
55 '{"feasible": false}' \
56 '{}']],
57 [[{"_uuid":["uuid","00000000-0000-0000-0000-000000000000"],"_version":["uuid","00000000-0000-0000-0000-000000000000"],"feasible":true}
58 feasible
59 {"_uuid":["uuid","00000000-0000-0000-0000-000000000000"],"_version":["uuid","00000000-0000-0000-0000-000000000000"],"feasible":false}
60 feasible
61 {"_uuid":["uuid","00000000-0000-0000-0000-000000000000"],"_version":["uuid","00000000-0000-0000-0000-000000000000"],"feasible":false}
62 <none>]], [])
63
64 OVSDB_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 '{}']],
70 [[{"_uuid":["uuid","00000000-0000-0000-0000-000000000000"],"_version":["uuid","00000000-0000-0000-0000-000000000000"],"ref":["uuid","f707423d-bf5b-48b5-b6c0-797c900ba4b6"]}
71 ref
72 {"_uuid":["uuid","00000000-0000-0000-0000-000000000000"],"_version":["uuid","00000000-0000-0000-0000-000000000000"],"ref":["uuid","33583cc5-d2f4-43de-b1ca-8aac14071b51"]}
73 ref
74 {"_uuid":["uuid","00000000-0000-0000-0000-000000000000"],"_version":["uuid","00000000-0000-0000-0000-000000000000"],"ref":["uuid","00000000-0000-0000-0000-000000000000"]}
75 <none>]], [])
76
77 OVSDB_CHECK_POSITIVE([row with set of 1 to 2 elements],
78 [[parse-rows \
79 '{"columns": {"myset": {"type": {"key": "integer", "min": 1, "max": 2}}}}' \
80 '{}']],
81 [[{"_uuid":["uuid","00000000-0000-0000-0000-000000000000"],"_version":["uuid","00000000-0000-0000-0000-000000000000"],"myset":0}
82 <none>]])
83
84 OVSDB_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 '{}']],
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>]], [])
90
91 OVSDB_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",
105 "datapath_id": "000ae4256bb0",
106 "hwaddr": "00:0a:e4:25:6b:b0"}' \
107 '{}']],
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"]}
109 datapath_id, hwaddr, name, vswitch
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>]], [])
112
113 OVSDB_CHECK_POSITIVE([row hashing (scalars)],
114 [[compare-rows \
115 '{"columns":
116 {"i": {"type": "integer"},
117 "r": {"type": "real"},
118 "b": {"type": "boolean"},
119 "s": {"type": "string"},
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
167 null == null3
168 null == null4
169 null == null5
170 hash(null) == hash(null6)
171 null2 == null3
172 null2 == null4
173 null2 == null5
174 hash(null2) == hash(null6)
175 null3 == null4
176 null3 == null5
177 hash(null3) == hash(null6)
178 null4 == null5
179 hash(null4) == hash(null6)
180 hash(null5) == hash(null6)]])
181
182 OVSDB_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"}},
188 "s": {"type": {"key": "string", "min": 0, "max": "unlimited"}},
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
214 null0 == null2
215 i012 == i021
216 i012 == i201
217 i012 == i102
218 i012 == i120
219 i012 == i210
220 i021 == i201
221 i021 == i102
222 i021 == i120
223 i021 == i210
224 i201 == i102
225 i201 == i120
226 i201 == i210
227 i102 == i120
228 i102 == i210
229 i120 == i210
230 r012 == r201
231 null1 == null2
232 b01 == b10
233 sab == sba]])
234
235 OVSDB_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"}},
244 "ss": {"type": {"key": "string", "value": "string",
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 ]], [[]])