]>
Commit | Line | Data |
---|---|---|
a8425c53 BP |
1 | AT_BANNER([OVSDB -- ovsdb-server monitors]) |
2 | ||
1b1d2e6d BP |
3 | OVS_START_SHELL_HELPERS |
4 | # ovsdb_check_monitor SCHEMA_FUNC DB TABLE OUTPUT COLUMNS | |
5 | # PRE-MONITOR-TXN... -- TRANSACTION... | |
6 | ovsdb_check_monitor () { | |
7 | local schema_func=$1 db=$2 table=$3 output=$4 columns=$5 | |
8 | shift; shift; shift; shift; shift | |
9 | $schema_func > schema | |
10 | AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore]) | |
11 | while test "$1" != "--"; do | |
12 | AT_CHECK([ovsdb-tool transact db "$1"], [0], [ignore], [ignore]) | |
13 | shift | |
14 | done | |
15 | shift | |
16 | AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket --log-file db > ovsdb-server.stdout 2> ovsdb-server.stderr], | |
17 | [0], [], []) | |
18 | on_exit 'kill `cat ovsdb-server.pid`' | |
19 | if test "$IS_WIN32" = "yes"; then | |
20 | AT_CHECK([ovsdb-client -vjsonrpc --pidfile --log-file -d json monitor --format=csv unix:socket $db $table $columns > output 2> ovsdb-client.stderr &], | |
21 | [0], [ignore], [ignore]) | |
22 | sleep 1 | |
23 | else | |
24 | AT_CHECK([ovsdb-client -vjsonrpc --detach --pidfile --log-file -d json monitor --format=csv unix:socket $db $table $columns > output 2> ovsdb-client.stderr], | |
25 | [0], [ignore], [ignore]) | |
26 | fi | |
27 | on_exit 'kill `cat ovsdb-client.pid`' | |
28 | for txn in ${1+"$@"} '[["'$db'"]]'; do | |
29 | AT_CHECK([ovsdb-client transact unix:socket "$txn"], [0], [ignore], [ignore]) | |
30 | done | |
31 | OVS_APP_EXIT_AND_WAIT_BY_TARGET([ovsdb-server], [ovsdb-server.pid]) | |
32 | OVS_WAIT_UNTIL([test ! -e ovsdb-client.pid]) | |
33 | AT_CHECK_UNQUOTED([$PYTHON $srcdir/ovsdb-monitor-sort.py < output | uuidfilt], [0], [$output], [ignore]) | |
34 | } | |
35 | OVS_END_SHELL_HELPERS | |
36 | ||
7360012b | 37 | # OVSDB_CHECK_MONITOR(TITLE, SCHEMA, [PRE-MONITOR-TXN], DB, TABLE, |
20aa445d | 38 | # TRANSACTIONS, OUTPUT, [COLUMNS], [KEYWORDS]) |
a8425c53 BP |
39 | # |
40 | # Creates a database with the given SCHEMA, starts an ovsdb-server on | |
41 | # that database, and runs each of the TRANSACTIONS (which should be a | |
42 | # quoted list of quoted strings) against it with ovsdb-client one at a | |
20aa445d BP |
43 | # time. COLUMNS, if specified, is passed to ovsdb-client as the set |
44 | # of columns and operations to select. | |
a8425c53 BP |
45 | # |
46 | # Checks that the overall output is OUTPUT, but UUIDs in the output | |
47 | # are replaced by markers of the form <N> where N is a number. The | |
48 | # first unique UUID is replaced by <0>, the next by <1>, and so on. | |
49 | # If a given UUID appears more than once it is always replaced by the | |
50 | # same marker. | |
51 | # | |
52 | # TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS. | |
1b1d2e6d | 53 | m4_define([OVSDB_CHECK_MONITOR], |
a8425c53 | 54 | [AT_SETUP([$1]) |
fd193af4 | 55 | AT_KEYWORDS([ovsdb server monitor positive $9]) |
1b1d2e6d BP |
56 | AT_CAPTURE_FILE([ovsdb-server.log]) |
57 | AT_CAPTURE_FILE([ovsdb-server.stdout]) | |
58 | AT_CAPTURE_FILE([ovsdb-server.stderr]) | |
59 | AT_CAPTURE_FILE([ovsdb-client.log]) | |
60 | AT_CAPTURE_FILE([ovsdb-client.stderr]) | |
61 | ovsdb_check_monitor '$2' '$4' '$5' '$7' '$8' \ | |
62 | m4_foreach([txn], [$3], ['txn' ]) -- \ | |
63 | m4_foreach([txn], [$6], ['txn' ]) | |
a8425c53 BP |
64 | AT_CLEANUP]) |
65 | ||
c383f3bf LS |
66 | # OVSDB_CHECK_MONITOR_COND(TITLE, SCHEMA, [PRE-MONITOR-TXN], DB, TABLE, |
67 | # TRANSACTIONS, OUTPUT, CONDITIONS, [COLUMNS], [KEYWORDS], | |
68 | # [CONDITIONS_CHANGE]) | |
69 | # | |
70 | # Creates a database with the given SCHEMA, starts an ovsdb-server on | |
71 | # that database, and runs each of the TRANSACTIONS (which should be a | |
72 | # quoted list of quoted strings) against it with ovsdb-client one at a | |
73 | # time. COLUMNS, if specified, is passed to ovsdb-client as the set | |
74 | # of columns and operations to select. | |
75 | # | |
76 | # Checks that the overall output is OUTPUT, but UUIDs in the output | |
77 | # are replaced by markers of the form <N> where N is a number. The | |
78 | # first unique UUID is replaced by <0>, the next by <1>, and so on. | |
79 | # If a given UUID appears more than once it is always replaced by the | |
80 | # same marker. | |
81 | # | |
82 | # TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS. | |
83 | m4_define([OVSDB_CHECK_MONITOR_COND], | |
84 | [AT_SETUP([$1]) | |
85 | AT_KEYWORDS([ovsdb server monitor monitor-cond positive $10]) | |
86 | $2 > schema | |
87 | AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore]) | |
1b1d2e6d BP |
88 | for txn in m4_foreach([txn], [$3], ['txn' ]); do |
89 | AT_CHECK([ovsdb-tool transact db "$txn"], [0], [ignore], [ignore]) | |
90 | done | |
c383f3bf | 91 | AT_CAPTURE_FILE([ovsdb-server-log]) |
56120500 BP |
92 | AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket --log-file="`pwd`"/ovsdb-server-log db >/dev/null 2>&1]) |
93 | on_exit 'kill `cat ovsdb-server.pid`' | |
94 | AT_CHECK([ovsdb-client -vjsonrpc --pidfile --detach --no-chdir -d json monitor-cond --format=csv unix:socket $4 '[$8]' $5 $9 > output], | |
95 | [0], [ignore], [ignore]) | |
96 | on_exit 'kill `cat ovsdb-client.pid`' | |
1b1d2e6d BP |
97 | for txn in m4_foreach([txn], [$6], ['txn' ]); do |
98 | AT_CHECK([ovsdb-client transact unix:socket "$txn"], [0], | |
99 | [ignore], [ignore], [kill `cat server-pid client-pid`]) | |
100 | done | |
101 | for cond in m4_foreach([cond], [$10], ['cond' ]); do | |
102 | AT_CHECK([ovs-appctl -t ovsdb-client ovsdb-client/cond_change $5 "$cond"], [0], [ignore], [ignore]) | |
103 | done | |
c383f3bf | 104 | AT_CHECK([ovsdb-client transact unix:socket '[["$4"]]'], [0], |
56120500 BP |
105 | [ignore], [ignore]) |
106 | AT_CHECK([ovs-appctl -t ovsdb-server -e exit], [0], [ignore], [ignore]) | |
107 | OVS_WAIT_UNTIL([test ! -e ovsdb-server.pid && test ! -e ovsdb-client.pid]) | |
d4cd4d30 | 108 | AT_CHECK([$PYTHON $srcdir/ovsdb-monitor-sort.py < output | uuidfilt], [0], [$7], [ignore]) |
c383f3bf LS |
109 | AT_CLEANUP]) |
110 | ||
8fcf509e | 111 | OVSDB_CHECK_MONITOR([monitor insert into empty table], |
39ab07af | 112 | [ordinal_schema], |
a8425c53 | 113 | [], |
7360012b | 114 | [ordinals], [ordinals], |
9cb53f26 BP |
115 | [[[["ordinals", |
116 | {"op": "insert", | |
a8425c53 BP |
117 | "table": "ordinals", |
118 | "row": {"number": 0, "name": "zero"}}]]]], | |
119 | [[row,action,name,number,_version | |
120 | <0>,insert,"""zero""",0,"[""uuid"",""<1>""]" | |
121 | ]]) | |
8fcf509e BP |
122 | |
123 | OVSDB_CHECK_MONITOR([monitor insert into populated table], | |
39ab07af | 124 | [ordinal_schema], |
9cb53f26 BP |
125 | [[[["ordinals", |
126 | {"op": "insert", | |
8fcf509e BP |
127 | "table": "ordinals", |
128 | "row": {"number": 10, "name": "ten"}}]]]], | |
7360012b | 129 | [ordinals], [ordinals], |
9cb53f26 BP |
130 | [[[["ordinals", |
131 | {"op": "insert", | |
8fcf509e BP |
132 | "table": "ordinals", |
133 | "row": {"number": 0, "name": "zero"}}]]]], | |
134 | [[row,action,name,number,_version | |
135 | <0>,initial,"""ten""",10,"[""uuid"",""<1>""]" | |
e5125481 | 136 | |
8fcf509e BP |
137 | row,action,name,number,_version |
138 | <2>,insert,"""zero""",0,"[""uuid"",""<3>""]" | |
139 | ]]) | |
140 | ||
141 | OVSDB_CHECK_MONITOR([monitor delete], | |
39ab07af | 142 | [ordinal_schema], |
9cb53f26 BP |
143 | [[[["ordinals", |
144 | {"op": "insert", | |
8fcf509e BP |
145 | "table": "ordinals", |
146 | "row": {"number": 10, "name": "ten"}}]]]], | |
7360012b | 147 | [ordinals], [ordinals], |
9cb53f26 BP |
148 | [[[["ordinals", |
149 | {"op": "delete", | |
8fcf509e BP |
150 | "table": "ordinals", |
151 | "where": [["number", "==", 10]]}]]]], | |
152 | [[row,action,name,number,_version | |
153 | <0>,initial,"""ten""",10,"[""uuid"",""<1>""]" | |
e5125481 | 154 | |
8fcf509e BP |
155 | row,action,name,number,_version |
156 | <0>,delete,"""ten""",10,"[""uuid"",""<1>""]" | |
157 | ]]) | |
158 | ||
159 | OVSDB_CHECK_MONITOR([monitor row update], | |
39ab07af | 160 | [ordinal_schema], |
9cb53f26 BP |
161 | [[[["ordinals", |
162 | {"op": "insert", | |
8fcf509e BP |
163 | "table": "ordinals", |
164 | "row": {"number": 10, "name": "ten"}}]]]], | |
7360012b | 165 | [ordinals], [ordinals], |
9cb53f26 BP |
166 | [[[["ordinals", |
167 | {"op": "update", | |
8fcf509e BP |
168 | "table": "ordinals", |
169 | "where": [["number", "==", 10]], | |
170 | "row": {"name": "five plus five"}}]]]], | |
171 | [[row,action,name,number,_version | |
172 | <0>,initial,"""ten""",10,"[""uuid"",""<1>""]" | |
e5125481 | 173 | |
8fcf509e BP |
174 | row,action,name,number,_version |
175 | <0>,old,"""ten""",,"[""uuid"",""<1>""]" | |
176 | ,new,"""five plus five""",10,"[""uuid"",""<2>""]" | |
177 | ]]) | |
178 | ||
179 | OVSDB_CHECK_MONITOR([monitor no-op row updates], | |
39ab07af | 180 | [ordinal_schema], |
9cb53f26 BP |
181 | [[[["ordinals", |
182 | {"op": "insert", | |
8fcf509e BP |
183 | "table": "ordinals", |
184 | "row": {"number": 10, "name": "ten"}}]]]], | |
7360012b | 185 | [ordinals], [ordinals], |
9cb53f26 BP |
186 | [[[["ordinals", |
187 | {"op": "update", | |
8fcf509e BP |
188 | "table": "ordinals", |
189 | "where": [["number", "==", 10]], | |
190 | "row": {"number": 10, "name": "ten"}}]]], | |
9cb53f26 BP |
191 | [[["ordinals", |
192 | {"op": "insert", | |
8fcf509e BP |
193 | "table": "ordinals", |
194 | "row": {"number": 9, "name": "nine"}}]]]], | |
195 | [[row,action,name,number,_version | |
196 | <0>,initial,"""ten""",10,"[""uuid"",""<1>""]" | |
e5125481 | 197 | |
8fcf509e BP |
198 | row,action,name,number,_version |
199 | <2>,insert,"""nine""",9,"[""uuid"",""<3>""]" | |
200 | ]]) | |
201 | ||
202 | OVSDB_CHECK_MONITOR([monitor insert-and-update transaction], | |
39ab07af | 203 | [ordinal_schema], |
9cb53f26 BP |
204 | [[[["ordinals", |
205 | {"op": "insert", | |
8fcf509e BP |
206 | "table": "ordinals", |
207 | "row": {"number": 10, "name": "ten"}}]]]], | |
7360012b | 208 | [ordinals], [ordinals], |
9cb53f26 BP |
209 | [[[["ordinals", |
210 | {"op": "insert", | |
8fcf509e BP |
211 | "table": "ordinals", |
212 | "row": {"number": 9, "name": "nine"}, | |
213 | "uuid-name": "nine"}, | |
214 | {"op": "update", | |
215 | "table": "ordinals", | |
216 | "where": [["_uuid", "==", ["named-uuid", "nine"]]], | |
217 | "row": {"name": "three squared"}}]]]], | |
218 | [[row,action,name,number,_version | |
219 | <0>,initial,"""ten""",10,"[""uuid"",""<1>""]" | |
e5125481 | 220 | |
8fcf509e BP |
221 | row,action,name,number,_version |
222 | <2>,insert,"""three squared""",9,"[""uuid"",""<3>""]" | |
223 | ]]) | |
224 | ||
8fcf509e | 225 | OVSDB_CHECK_MONITOR([monitor insert-update-and-delete transaction], |
39ab07af | 226 | [ordinal_schema], |
9cb53f26 BP |
227 | [[[["ordinals", |
228 | {"op": "insert", | |
8fcf509e BP |
229 | "table": "ordinals", |
230 | "row": {"number": 10, "name": "ten"}}]]]], | |
7360012b | 231 | [ordinals], [ordinals], |
9cb53f26 BP |
232 | [[[["ordinals", |
233 | {"op": "insert", | |
8fcf509e BP |
234 | "table": "ordinals", |
235 | "row": {"number": 9, "name": "nine"}, | |
236 | "uuid-name": "nine"}, | |
237 | {"op": "update", | |
238 | "table": "ordinals", | |
239 | "where": [["_uuid", "==", ["named-uuid", "nine"]]], | |
240 | "row": {"name": "three squared"}}, | |
241 | {"op": "delete", | |
242 | "table": "ordinals", | |
243 | "where": [["_uuid", "==", ["named-uuid", "nine"]]]}, | |
244 | {"op": "insert", | |
245 | "table": "ordinals", | |
246 | "row": {"number": 7, "name": "seven"}}]]]], | |
247 | [[row,action,name,number,_version | |
248 | <0>,initial,"""ten""",10,"[""uuid"",""<1>""]" | |
e5125481 | 249 | |
8fcf509e BP |
250 | row,action,name,number,_version |
251 | <2>,insert,"""seven""",7,"[""uuid"",""<3>""]" | |
252 | ]]) | |
253 | ||
7360012b | 254 | OVSDB_CHECK_MONITOR([monitor weak reference change], |
39ab07af | 255 | [weak_schema], |
7360012b BP |
256 | [[[["weak", |
257 | {"op": "insert", | |
258 | "table": "a", | |
259 | "row": {"a": 0, | |
260 | "a2a1": ["named-uuid", "a0"], | |
261 | "a2b": ["named-uuid", "b2"]}, | |
262 | "uuid-name": "a0"}, | |
263 | {"op": "insert", | |
264 | "table": "a", | |
265 | "row": {"a": 1, | |
266 | "a2a": ["named-uuid", "a0"], | |
267 | "a2a1": ["named-uuid", "a1"], | |
268 | "a2b": ["named-uuid", "b2"]}, | |
269 | "uuid-name": "a1"}, | |
270 | {"op": "insert", | |
271 | "table": "b", | |
272 | "row": {"b": 2}, | |
273 | "uuid-name": "b2"}]]]], | |
274 | [weak], [a], | |
275 | [[[["weak", | |
276 | {"op": "delete", | |
277 | "table": "a", | |
278 | "where": [["a", "==", 0]]}]]]], | |
a1ae5dc8 BP |
279 | [[row,action,a,a2a,a2a1,a2b,_version |
280 | <0>,initial,0,"[""set"",[]]","[""uuid"",""<0>""]","[""uuid"",""<1>""]","[""uuid"",""<2>""]" | |
281 | <3>,initial,1,"[""uuid"",""<0>""]","[""uuid"",""<3>""]","[""uuid"",""<1>""]","[""uuid"",""<4>""]" | |
7360012b | 282 | |
a1ae5dc8 BP |
283 | row,action,a,a2a,a2a1,a2b,_version |
284 | <0>,delete,0,"[""set"",[]]","[""uuid"",""<0>""]","[""uuid"",""<1>""]","[""uuid"",""<2>""]" | |
5cd9f691 | 285 | <3>,old,,"[""uuid"",""<0>""]",,,"[""uuid"",""<4>""]" |
a1ae5dc8 | 286 | ,new,1,"[""set"",[]]","[""uuid"",""<3>""]","[""uuid"",""<1>""]","[""uuid"",""<5>""]" |
7360012b BP |
287 | ]]) |
288 | ||
fd193af4 | 289 | OVSDB_CHECK_MONITOR([monitor insert-update-and-delete transaction], |
39ab07af | 290 | [ordinal_schema], |
fd193af4 BP |
291 | [[[["ordinals", |
292 | {"op": "insert", | |
293 | "table": "ordinals", | |
294 | "row": {"number": 10, "name": "ten"}}]]]], | |
295 | [ordinals], [ordinals], | |
296 | [[[["ordinals", | |
297 | {"op": "insert", | |
298 | "table": "ordinals", | |
299 | "row": {"number": 9, "name": "nine"}, | |
300 | "uuid-name": "nine"}, | |
301 | {"op": "update", | |
302 | "table": "ordinals", | |
303 | "where": [["_uuid", "==", ["named-uuid", "nine"]]], | |
304 | "row": {"name": "three squared"}}, | |
305 | {"op": "delete", | |
306 | "table": "ordinals", | |
307 | "where": [["_uuid", "==", ["named-uuid", "nine"]]]}, | |
308 | {"op": "insert", | |
309 | "table": "ordinals", | |
310 | "row": {"number": 7, "name": "seven"}}]]]], | |
311 | [[row,action,name,number,_version | |
312 | <0>,initial,"""ten""",10,"[""uuid"",""<1>""]" | |
313 | ||
314 | row,action,name,number,_version | |
315 | <2>,insert,"""seven""",7,"[""uuid"",""<3>""]" | |
316 | ]]) | |
317 | \f | |
318 | AT_BANNER([ovsdb -- ovsdb-monitor monitor only some operations]) | |
319 | ||
320 | m4_define([OVSDB_MONITOR_INITIAL], | |
321 | [[[["ordinals", | |
322 | {"op": "insert", | |
323 | "table": "ordinals", | |
324 | "row": {"number": 10, "name": "ten"}}]]]]) | |
325 | m4_define([OVSDB_MONITOR_TXNS], | |
326 | [[[["ordinals", | |
327 | {"op": "insert", | |
328 | "table": "ordinals", | |
329 | "row": {"number": 5, "name": "five"}}]]], | |
330 | [[["ordinals", | |
331 | {"op": "update", | |
332 | "table": "ordinals", | |
333 | "where": [["name", "==", "five"]], | |
334 | "row": {"name": "FIVE"}}]]], | |
335 | [[["ordinals", | |
336 | {"op": "delete", | |
337 | "table": "ordinals", | |
338 | "where": []}]]]]) | |
339 | ||
340 | OVSDB_CHECK_MONITOR([monitor all operations], | |
39ab07af | 341 | [ordinal_schema], [OVSDB_MONITOR_INITIAL], |
fd193af4 BP |
342 | [ordinals], [ordinals], [OVSDB_MONITOR_TXNS], |
343 | [[row,action,name,number,_version | |
344 | <0>,initial,"""ten""",10,"[""uuid"",""<1>""]" | |
345 | ||
346 | row,action,name,number,_version | |
347 | <2>,insert,"""five""",5,"[""uuid"",""<3>""]" | |
348 | ||
349 | row,action,name,number,_version | |
350 | <2>,old,"""five""",,"[""uuid"",""<3>""]" | |
351 | ,new,"""FIVE""",5,"[""uuid"",""<4>""]" | |
352 | ||
353 | row,action,name,number,_version | |
354 | <2>,delete,"""FIVE""",5,"[""uuid"",""<4>""]" | |
355 | <0>,delete,"""ten""",10,"[""uuid"",""<1>""]" | |
356 | ]]) | |
357 | ||
358 | dnl A monitor with "initial" only doesn't really make sense, | |
359 | dnl but it's still allowed and should work. | |
360 | OVSDB_CHECK_MONITOR([monitor initial only], | |
39ab07af | 361 | [ordinal_schema], [OVSDB_MONITOR_INITIAL], |
fd193af4 BP |
362 | [ordinals], [ordinals], [OVSDB_MONITOR_TXNS], |
363 | [[row,action,name,number,_version | |
364 | <0>,initial,"""ten""",10,"[""uuid"",""<1>""]" | |
20aa445d | 365 | ]], [!insert,!delete,!modify]) |
fd193af4 BP |
366 | |
367 | OVSDB_CHECK_MONITOR([monitor insert only], | |
39ab07af | 368 | [ordinal_schema], [OVSDB_MONITOR_INITIAL], |
fd193af4 BP |
369 | [ordinals], [ordinals], [OVSDB_MONITOR_TXNS], |
370 | [[row,action,name,number,_version | |
371 | <0>,insert,"""five""",5,"[""uuid"",""<1>""]" | |
20aa445d | 372 | ]], [!initial,!delete,!modify]) |
fd193af4 BP |
373 | |
374 | OVSDB_CHECK_MONITOR([monitor delete only], | |
39ab07af | 375 | [ordinal_schema], [OVSDB_MONITOR_INITIAL], |
fd193af4 BP |
376 | [ordinals], [ordinals], [OVSDB_MONITOR_TXNS], |
377 | [[row,action,name,number,_version | |
378 | <0>,delete,"""FIVE""",5,"[""uuid"",""<1>""]" | |
379 | <2>,delete,"""ten""",10,"[""uuid"",""<3>""]" | |
20aa445d | 380 | ]], [!initial,!insert,!modify]) |
fd193af4 BP |
381 | |
382 | OVSDB_CHECK_MONITOR([monitor modify only], | |
39ab07af | 383 | [ordinal_schema], [OVSDB_MONITOR_INITIAL], |
fd193af4 BP |
384 | [ordinals], [ordinals], [OVSDB_MONITOR_TXNS], |
385 | [[row,action,name,number,_version | |
386 | <0>,old,"""five""",,"[""uuid"",""<1>""]" | |
387 | ,new,"""FIVE""",5,"[""uuid"",""<2>""]" | |
20aa445d | 388 | ]], [!initial,!insert,!delete]) |
c383f3bf LS |
389 | |
390 | AT_BANNER([ovsdb -- ovsdb-monitor-cond conditional monitor only some operations]) | |
391 | ||
392 | OVSDB_CHECK_MONITOR_COND([monitor-cond empty condition], | |
393 | [ordinal_schema], | |
394 | [[[["ordinals", | |
395 | {"op": "insert", | |
396 | "table": "ordinals", | |
397 | "row": {"number": 0, "name": "zero"}}, | |
398 | {"op": "insert", | |
399 | "table": "ordinals", | |
400 | "row": {"number": 1, "name": "one"}}, | |
401 | {"op": "insert", | |
402 | "table": "ordinals", | |
403 | "row": {"number": 2, "name": "two"}}]]]], | |
404 | [ordinals], [ordinals], | |
405 | [[[["ordinals", | |
406 | {"op": "insert", | |
407 | "table": "ordinals", | |
408 | "row": {"number": 10, "name": "ten"}}, | |
409 | {"op": "insert", | |
410 | "table": "ordinals", | |
411 | "row": {"number": 11, "name": "eleven"}}]]]], | |
412 | [[row,action,name,number,_version | |
413 | <0>,initial,"""one""",1,"[""uuid"",""<1>""]" | |
414 | <2>,initial,"""two""",2,"[""uuid"",""<3>""]" | |
415 | <4>,initial,"""zero""",,"[""uuid"",""<5>""]" | |
416 | ||
417 | row,action,name,number,_version | |
418 | <6>,insert,"""eleven""",11,"[""uuid"",""<7>""]" | |
419 | <8>,insert,"""ten""",10,"[""uuid"",""<9>""]" | |
420 | ]], | |
421 | [[]]) | |
422 | ||
423 | OVSDB_CHECK_MONITOR_COND([monitor-cond multiple conditions], | |
424 | [ordinal_schema], | |
425 | [[[["ordinals", | |
426 | {"op": "insert", | |
427 | "table": "ordinals", | |
428 | "row": {"number": 0, "name": "zero"}}, | |
429 | {"op": "insert", | |
430 | "table": "ordinals", | |
431 | "row": {"number": 1, "name": "one"}}, | |
432 | {"op": "insert", | |
433 | "table": "ordinals", | |
434 | "row": {"number": 2, "name": "two"}}]]]], | |
435 | [ordinals], [ordinals], | |
436 | [[[["ordinals", | |
437 | {"op": "insert", | |
438 | "table": "ordinals", | |
439 | "row": {"number": 10, "name": "ten"}}, | |
440 | {"op": "insert", | |
441 | "table": "ordinals", | |
442 | "row": {"number": 11, "name": "eleven"}}]]]], | |
443 | [[row,action,name,number,_version | |
444 | <0>,initial,"""one""",1,"[""uuid"",""<1>""]" | |
445 | ||
446 | row,action,name,number,_version | |
447 | <2>,insert,"""ten""",10,"[""uuid"",""<3>""]" | |
448 | ]], | |
449 | [[["name","==","one"],["name","==","ten"]]]) | |
450 | ||
451 | OVSDB_CHECK_MONITOR_COND([monitor-cond delete from populated table], | |
452 | [ordinal_schema], | |
453 | [[[["ordinals", | |
454 | {"op": "insert", | |
455 | "table": "ordinals", | |
456 | "row": {"number": 0, "name": "zero"}}, | |
457 | {"op": "insert", | |
458 | "table": "ordinals", | |
459 | "row": {"number": 1, "name": "one"}}, | |
460 | {"op": "insert", | |
461 | "table": "ordinals", | |
462 | "row": {"number": 2, "name": "two"}}]]]], | |
463 | [ordinals], [ordinals], | |
464 | [[[["ordinals", | |
465 | {"op": "delete", | |
466 | "table": "ordinals", | |
467 | "where": []}]]]], | |
468 | [[row,action,name,number,_version | |
469 | <0>,initial,"""one""",1,"[""uuid"",""<1>""]" | |
470 | ||
471 | row,action,name,number,_version | |
472 | <0>,delete,,, | |
473 | ]], | |
474 | [[["name","==","one"],["name","==","ten"]]]) | |
475 | ||
476 | OVSDB_CHECK_MONITOR_COND([monitor-cond insert due to modify], | |
477 | [ordinal_schema], | |
478 | [[[["ordinals", | |
479 | {"op": "insert", | |
480 | "table": "ordinals", | |
481 | "row": {"number": 0, "name": "zero"}}, | |
482 | {"op": "insert", | |
483 | "table": "ordinals", | |
484 | "row": {"number": 1, "name": "one"}}, | |
485 | {"op": "insert", | |
486 | "table": "ordinals", | |
487 | "row": {"number": 2, "name": "two"}}]]]], | |
488 | [ordinals], [ordinals], | |
489 | [[[["ordinals", | |
490 | {"op": "update", | |
491 | "table": "ordinals", | |
492 | "where": [["name", "==", "one"]], | |
493 | "row": {"name": "ONE"}}]]]], | |
494 | [[row,action,name,number,_version | |
495 | <0>,insert,"""ONE""",1,"[""uuid"",""<1>""]" | |
496 | ]], | |
497 | [[["name","==","ONE"]]], | |
498 | [!initial,!delete,!modify]) | |
499 | ||
500 | OVSDB_CHECK_MONITOR_COND([monitor-cond delete due to modify], | |
501 | [ordinal_schema], | |
502 | [[[["ordinals", | |
503 | {"op": "insert", | |
504 | "table": "ordinals", | |
505 | "row": {"number": 0, "name": "zero"}}, | |
506 | {"op": "insert", | |
507 | "table": "ordinals", | |
508 | "row": {"number": 1, "name": "one"}}, | |
509 | {"op": "insert", | |
510 | "table": "ordinals", | |
511 | "row": {"number": 2, "name": "two"}}]]]], | |
512 | [ordinals], [ordinals], | |
513 | [[[["ordinals", | |
514 | {"op": "update", | |
515 | "table": "ordinals", | |
516 | "where": [["name", "==", "one"]], | |
517 | "row": {"name": "ONE"}}]]]], | |
518 | [[row,action,name,number,_version | |
519 | <0>,delete,,, | |
520 | ]], | |
521 | [[["name","==","one"]]], | |
522 | [!initial,!insert,!modify]) | |
523 | ||
524 | OVSDB_CHECK_MONITOR_COND([monitor-cond condition non-monitored columns], | |
525 | [ordinal_schema], | |
526 | [[[["ordinals", | |
527 | {"op": "insert", | |
528 | "table": "ordinals", | |
529 | "row": {"number": 0, "name": "zero"}}, | |
530 | {"op": "insert", | |
531 | "table": "ordinals", | |
532 | "row": {"number": 1, "name": "one"}}, | |
533 | {"op": "insert", | |
534 | "table": "ordinals", | |
535 | "row": {"number": 2, "name": "two"}}]]]], | |
536 | [ordinals], [ordinals], | |
537 | [[[["ordinals", | |
538 | {"op": "insert", | |
539 | "table": "ordinals", | |
540 | "row": {"number": 10, "name": "ten"}}, | |
541 | {"op": "insert", | |
542 | "table": "ordinals", | |
543 | "row": {"number": 11, "name": "eleven"}}]]]], | |
544 | [[row,action,number | |
545 | <0>,initial,1 | |
546 | ||
547 | row,action,number | |
548 | <1>,insert,10 | |
549 | ]], | |
550 | [[["name","==","one"],["name","==","ten"]]], | |
551 | ["number"]) | |
552 | ||
553 | OVSDB_CHECK_MONITOR_COND([monitor-cond-change], | |
554 | [ordinal_schema], | |
555 | [[[["ordinals", | |
556 | {"op": "insert", | |
557 | "table": "ordinals", | |
558 | "row": {"number": 0, "name": "zero"}}, | |
559 | {"op": "insert", | |
560 | "table": "ordinals", | |
561 | "row": {"number": 1, "name": "one"}}, | |
562 | {"op": "insert", | |
563 | "table": "ordinals", | |
564 | "row": {"number": 2, "name": "two"}}]]]], | |
565 | [ordinals], [ordinals], | |
566 | [], | |
567 | [[row,action,name,number,_version | |
568 | <0>,initial,"""one""",1,"[""uuid"",""<1>""]" | |
569 | <2>,initial,"""two""",2,"[""uuid"",""<3>""]" | |
570 | <4>,initial,"""zero""",,"[""uuid"",""<5>""]" | |
571 | ||
572 | row,action,name,number,_version | |
573 | <4>,delete,,, | |
574 | ||
575 | row,action,name,number,_version | |
576 | <2>,delete,,, | |
577 | ||
578 | row,action,name,number,_version | |
579 | <0>,delete,,, | |
580 | ||
581 | row,action,name,number,_version | |
582 | <0>,insert,"""one""",1,"[""uuid"",""<1>""]" | |
583 | <2>,insert,"""two""",2,"[""uuid"",""<3>""]" | |
584 | <4>,insert,"""zero""",,"[""uuid"",""<5>""]" | |
585 | ]], | |
586 | [[]], | |
587 | [], | |
588 | [[[[["name","==","one"],["name","==","two"]]]], | |
589 | [[[["name","==","one"]]]], | |
590 | [[[false]]], | |
591 | [[[true]]]]) |