1 AT_BANNER([OVSDB -- ovsdb-server monitors])
3 # OVSDB_CHECK_MONITOR(TITLE, SCHEMA, [PRE-MONITOR-TXN], MONITOR-ARGS,
4 # TRANSACTIONS, OUTPUT, [KEYWORDS])
6 # Creates a database with the given SCHEMA, starts an ovsdb-server on
7 # that database, and runs each of the TRANSACTIONS (which should be a
8 # quoted list of quoted strings) against it with ovsdb-client one at a
11 # Checks that the overall output is OUTPUT, but UUIDs in the output
12 # are replaced by markers of the form <N> where N is a number. The
13 # first unique UUID is replaced by <0>, the next by <1>, and so on.
14 # If a given UUID appears more than once it is always replaced by the
17 # TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS.
18 m4_define([OVSDB_CHECK_MONITOR],
20 AT_KEYWORDS([ovsdb server monitor positive $7])
23 AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore])
24 m4_foreach([txn], [$3],
25 [AT_CHECK([ovsdb-tool transact db 'txn'], [0], [ignore], [ignore])])
26 AT_CHECK([ovsdb-server --detach --pidfile=$PWD/server-pid --remote=punix:socket --unixctl=$PWD/unixctl db], [0], [ignore], [ignore])
27 AT_CHECK([ovsdb-client --detach --pidfile=$PWD/client-pid monitor --format=csv unix:socket ordinals $4 > output],
28 [0], [ignore], [ignore], [kill `cat server-pid`])
29 m4_foreach([txn], [$5],
30 [AT_CHECK([ovsdb-client transact unix:socket 'txn'], [0],
31 [ignore], [ignore], [kill `cat server-pid client-pid`])])
32 AT_CHECK([ovsdb-client transact unix:socket '[[]]'], [0],
33 [ignore], [ignore], [kill `cat server-pid client-pid`])
34 AT_CHECK([ovs-appctl -t $PWD/unixctl -e exit], [0], [ignore], [ignore])
35 OVS_WAIT_UNTIL([test ! -e server-pid && test ! -e client-pid])
36 AT_CHECK([perl $srcdir/uuidfilt.pl output], [0], [$6], [ignore])
39 OVSDB_CHECK_MONITOR([monitor insert into empty table],
46 "row": {"number": 0, "name": "zero"}}]]]],
47 [[row,action,name,number,_version
48 <0>,insert,"""zero""",0,"[""uuid"",""<1>""]"
51 OVSDB_CHECK_MONITOR([monitor insert into populated table],
56 "row": {"number": 10, "name": "ten"}}]]]],
61 "row": {"number": 0, "name": "zero"}}]]]],
62 [[row,action,name,number,_version
63 <0>,initial,"""ten""",10,"[""uuid"",""<1>""]"
64 row,action,name,number,_version
65 <2>,insert,"""zero""",0,"[""uuid"",""<3>""]"
68 OVSDB_CHECK_MONITOR([monitor delete],
73 "row": {"number": 10, "name": "ten"}}]]]],
78 "where": [["number", "==", 10]]}]]]],
79 [[row,action,name,number,_version
80 <0>,initial,"""ten""",10,"[""uuid"",""<1>""]"
81 row,action,name,number,_version
82 <0>,delete,"""ten""",10,"[""uuid"",""<1>""]"
85 OVSDB_CHECK_MONITOR([monitor row update],
90 "row": {"number": 10, "name": "ten"}}]]]],
95 "where": [["number", "==", 10]],
96 "row": {"name": "five plus five"}}]]]],
97 [[row,action,name,number,_version
98 <0>,initial,"""ten""",10,"[""uuid"",""<1>""]"
99 row,action,name,number,_version
100 <0>,old,"""ten""",,"[""uuid"",""<1>""]"
101 ,new,"""five plus five""",10,"[""uuid"",""<2>""]"
104 OVSDB_CHECK_MONITOR([monitor no-op row updates],
109 "row": {"number": 10, "name": "ten"}}]]]],
114 "where": [["number", "==", 10]],
115 "row": {"number": 10, "name": "ten"}}]]],
119 "row": {"number": 9, "name": "nine"}}]]]],
120 [[row,action,name,number,_version
121 <0>,initial,"""ten""",10,"[""uuid"",""<1>""]"
122 row,action,name,number,_version
123 <2>,insert,"""nine""",9,"[""uuid"",""<3>""]"
126 OVSDB_CHECK_MONITOR([monitor insert-and-update transaction],
131 "row": {"number": 10, "name": "ten"}}]]]],
136 "row": {"number": 9, "name": "nine"},
137 "uuid-name": "nine"},
140 "where": [["_uuid", "==", ["named-uuid", "nine"]]],
141 "row": {"name": "three squared"}}]]]],
142 [[row,action,name,number,_version
143 <0>,initial,"""ten""",10,"[""uuid"",""<1>""]"
144 row,action,name,number,_version
145 <2>,insert,"""three squared""",9,"[""uuid"",""<3>""]"
149 OVSDB_CHECK_MONITOR([monitor insert-update-and-delete transaction],
154 "row": {"number": 10, "name": "ten"}}]]]],
159 "row": {"number": 9, "name": "nine"},
160 "uuid-name": "nine"},
163 "where": [["_uuid", "==", ["named-uuid", "nine"]]],
164 "row": {"name": "three squared"}},
167 "where": [["_uuid", "==", ["named-uuid", "nine"]]]},
170 "row": {"number": 7, "name": "seven"}}]]]],
171 [[row,action,name,number,_version
172 <0>,initial,"""ten""",10,"[""uuid"",""<1>""]"
173 row,action,name,number,_version
174 <2>,insert,"""seven""",7,"[""uuid"",""<3>""]"