]>
Commit | Line | Data |
---|---|---|
1 | AT_BANNER([OVSDB -- interface description language (IDL)]) | |
2 | ||
3 | # OVSDB_CHECK_IDL_C(TITLE, [PRE-IDL-TXN], TRANSACTIONS, OUTPUT, [KEYWORDS], | |
4 | # [FILTER]) | |
5 | # | |
6 | # Creates a database with a schema derived from idltest.ovsidl, runs | |
7 | # each PRE-IDL-TXN (if any), starts an ovsdb-server on that database, | |
8 | # and runs "test-ovsdb idl" passing each of the TRANSACTIONS along. | |
9 | # | |
10 | # Checks that the overall output is OUTPUT. Before comparison, the | |
11 | # output is sorted (using "sort") and UUIDs in the output are replaced | |
12 | # by markers of the form <N> where N is a number. The first unique | |
13 | # UUID is replaced by <0>, the next by <1>, and so on. If a given | |
14 | # UUID appears more than once it is always replaced by the same | |
15 | # marker. If FILTER is supplied then the output is also filtered | |
16 | # through the specified program. | |
17 | # | |
18 | # TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS. | |
19 | m4_define([OVSDB_CHECK_IDL_C], | |
20 | [AT_SETUP([$1 - C]) | |
21 | AT_KEYWORDS([ovsdb server idl positive $5]) | |
22 | AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema], | |
23 | [0], [stdout], [ignore]) | |
24 | AT_CHECK([ovsdb-server '-vPATTERN:console:ovsdb-server|%c|%m' --detach --no-chdir --pidfile="`pwd`"/pid --remote=punix:socket --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore]) | |
25 | on_exit 'kill `cat pid`' | |
26 | m4_if([$2], [], [], | |
27 | [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])]) | |
28 | AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 idl unix:socket $3], | |
29 | [0], [stdout], [ignore]) | |
30 | AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]), | |
31 | [0], [$4]) | |
32 | OVSDB_SERVER_SHUTDOWN | |
33 | AT_CLEANUP]) | |
34 | ||
35 | # same as OVSDB_CHECK_IDL but uses the Python IDL implementation. | |
36 | m4_define([OVSDB_CHECK_IDL_PYN], | |
37 | [AT_SETUP([$1]) | |
38 | AT_SKIP_IF([test $7 = no]) | |
39 | AT_KEYWORDS([ovsdb server idl positive Python $5]) | |
40 | AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema], | |
41 | [0], [stdout], [ignore]) | |
42 | AT_CHECK([ovsdb-server '-vPATTERN:console:ovsdb-server|%c|%m' --detach --no-chdir --pidfile="`pwd`"/pid --remote=punix:socket --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore]) | |
43 | on_exit 'kill `cat pid`' | |
44 | m4_if([$2], [], [], | |
45 | [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])]) | |
46 | AT_CHECK([$8 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket $3], | |
47 | [0], [stdout], [ignore]) | |
48 | AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]), | |
49 | [0], [$4]) | |
50 | OVSDB_SERVER_SHUTDOWN | |
51 | AT_CLEANUP]) | |
52 | ||
53 | m4_define([OVSDB_CHECK_IDL_PY], | |
54 | [OVSDB_CHECK_IDL_PYN([$1 - Python2], [$2], [$3], [$4], [$5], [$6], | |
55 | [$HAVE_PYTHON], [$PYTHON]) | |
56 | OVSDB_CHECK_IDL_PYN([$1 - Python3], [$2], [$3], [$4], [$5], [$6], | |
57 | [$HAVE_PYTHON3], [$PYTHON3])]) | |
58 | ||
59 | m4_define([OVSDB_CHECK_IDL_REGISTER_COLUMNS_PYN], | |
60 | [AT_SETUP([$1 - register_columns]) | |
61 | AT_SKIP_IF([test $7 = no]) | |
62 | AT_KEYWORDS([ovsdb server idl positive Python register_columns $5]) | |
63 | AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema], | |
64 | [0], [stdout], [ignore]) | |
65 | AT_CHECK([ovsdb-server '-vPATTERN:console:ovsdb-server|%c|%m' --detach --no-chdir --pidfile="`pwd`"/pid --remote=punix:socket --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore]) | |
66 | on_exit 'kill `cat pid`' | |
67 | m4_if([$2], [], [], | |
68 | [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])]) | |
69 | AT_CHECK([$8 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket ?simple:b,ba,i,ia,r,ra,s,sa,u,ua?link1:i,k,ka,l2?link2:i,l1 $3], | |
70 | [0], [stdout], [ignore]) | |
71 | AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]), | |
72 | [0], [$4]) | |
73 | OVSDB_SERVER_SHUTDOWN | |
74 | AT_CLEANUP]) | |
75 | ||
76 | m4_define([OVSDB_CHECK_IDL_REGISTER_COLUMNS_PY], | |
77 | [OVSDB_CHECK_IDL_REGISTER_COLUMNS_PYN([$1 - Python2], [$2], [$3], [$4], [$5], [$6], | |
78 | [$HAVE_PYTHON], [$PYTHON]) | |
79 | OVSDB_CHECK_IDL_REGISTER_COLUMNS_PYN([$1 - Python3], [$2], [$3], [$4], [$5], [$6], | |
80 | [$HAVE_PYTHON3], [$PYTHON3])]) | |
81 | ||
82 | # same as OVSDB_CHECK_IDL but uses the Python IDL implementation with tcp | |
83 | m4_define([OVSDB_CHECK_IDL_TCP_PYN], | |
84 | [AT_SETUP([$1 - tcp]) | |
85 | AT_SKIP_IF([test $7 = no]) | |
86 | AT_KEYWORDS([ovsdb server idl positive Python with tcp socket $5]) | |
87 | AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema], | |
88 | [0], [stdout], [ignore]) | |
89 | AT_CHECK([ovsdb-server --log-file '-vPATTERN:console:ovsdb-server|%c|%m' --detach --no-chdir --pidfile="`pwd`"/pid --remote=punix:socket --remote=ptcp:0:127.0.0.1 --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore]) | |
90 | on_exit 'kill `cat pid`' | |
91 | PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT]) | |
92 | ||
93 | m4_if([$2], [], [], | |
94 | [AT_CHECK([ovsdb-client transact tcp:127.0.0.1:$TCP_PORT $2], [0], [ignore], [ignore])]) | |
95 | AT_CHECK([$8 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema tcp:127.0.0.1:$TCP_PORT $3], | |
96 | [0], [stdout], [ignore]) | |
97 | AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]), | |
98 | [0], [$4]) | |
99 | OVSDB_SERVER_SHUTDOWN | |
100 | AT_CLEANUP]) | |
101 | ||
102 | m4_define([OVSDB_CHECK_IDL_TCP_PY], | |
103 | [OVSDB_CHECK_IDL_TCP_PYN([$1 - Python2], [$2], [$3], [$4], [$5], [$6], | |
104 | [$HAVE_PYTHON], [$PYTHON]) | |
105 | OVSDB_CHECK_IDL_TCP_PYN([$1 - Python3], [$2], [$3], [$4], [$5], [$6], | |
106 | [$HAVE_PYTHON3], [$PYTHON3])]) | |
107 | ||
108 | # same as OVSDB_CHECK_IDL but uses the Python IDL implementation with tcp6 | |
109 | m4_define([OVSDB_CHECK_IDL_TCP6_PYN], | |
110 | [AT_SETUP([$1 - tcp6]) | |
111 | AT_SKIP_IF([test $7 = no]) | |
112 | AT_SKIP_IF([test $HAVE_IPV6 = no]) | |
113 | AT_KEYWORDS([ovsdb server idl positive Python with tcp6 socket $5]) | |
114 | AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema], | |
115 | [0], [stdout], [ignore]) | |
116 | AT_CHECK([ovsdb-server --log-file '-vPATTERN:console:ovsdb-server|%c|%m' --detach --no-chdir --pidfile="`pwd`"/pid --remote=ptcp:0:[[::1]] --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore]) | |
117 | on_exit 'kill `cat pid`' | |
118 | PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT]) | |
119 | echo "TCP_PORT=$TCP_PORT" | |
120 | ||
121 | m4_if([$2], [], [], | |
122 | [AT_CHECK([ovsdb-client transact "tcp:[[::1]]:$TCP_PORT" $2], [0], [ignore], [ignore])]) | |
123 | AT_CHECK([$8 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema tcp:[[::1]]:$TCP_PORT $3], | |
124 | [0], [stdout], [ignore]) | |
125 | AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]), | |
126 | [0], [$4]) | |
127 | OVSDB_SERVER_SHUTDOWN | |
128 | AT_CLEANUP]) | |
129 | ||
130 | m4_define([OVSDB_CHECK_IDL_TCP6_PY], | |
131 | [OVSDB_CHECK_IDL_TCP6_PYN([$1 - Python2], [$2], [$3], [$4], [$5], [$6], | |
132 | [$HAVE_PYTHON], [$PYTHON]) | |
133 | OVSDB_CHECK_IDL_TCP6_PYN([$1 - Python3], [$2], [$3], [$4], [$5], [$6], | |
134 | [$HAVE_PYTHON3], [$PYTHON3])]) | |
135 | ||
136 | m4_define([OVSDB_CHECK_IDL], | |
137 | [OVSDB_CHECK_IDL_C($@) | |
138 | OVSDB_CHECK_IDL_PY($@) | |
139 | OVSDB_CHECK_IDL_REGISTER_COLUMNS_PY($@) | |
140 | OVSDB_CHECK_IDL_TCP_PY($@) | |
141 | OVSDB_CHECK_IDL_TCP6_PY($@)]) | |
142 | ||
143 | # This test uses the Python IDL implementation with passive tcp | |
144 | m4_define([OVSDB_CHECK_IDL_PASSIVE_TCP_PY], | |
145 | [AT_SETUP([$1 - Python ptcp]) | |
146 | AT_SKIP_IF([test $HAVE_PYTHON = no]) | |
147 | AT_KEYWORDS([ovsdb server idl positive Python with tcp socket $5]) | |
148 | AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema], | |
149 | [0], [stdout], [ignore]) | |
150 | # find free TCP port | |
151 | AT_CHECK([ovsdb-server --log-file '-vPATTERN:console:ovsdb-server|%c|%m' --detach --no-chdir --pidfile="`pwd`"/pid --remote=ptcp:0:127.0.0.1 --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore]) | |
152 | on_exit 'kill `cat pid`' | |
153 | PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT]) | |
154 | OVSDB_SERVER_SHUTDOWN | |
155 | ||
156 | # start OVSDB server in passive mode | |
157 | AT_CHECK([ovsdb-server --log-file '-vPATTERN:console:ovsdb-server|%c|%m' --detach --no-chdir --pidfile="`pwd`"/pid --remote=punix:socket --remote=tcp:127.0.0.1:$TCP_PORT --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore]) | |
158 | AT_CHECK([$PYTHON $srcdir/test-ovsdb.py -t10 idl_passive $srcdir/idltest.ovsschema ptcp:127.0.0.1:$TCP_PORT $3], | |
159 | [0], [stdout], [ignore]) | |
160 | AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]), | |
161 | [0], [$4]) | |
162 | OVSDB_SERVER_SHUTDOWN | |
163 | AT_CLEANUP | |
164 | ]) | |
165 | ||
166 | OVSDB_CHECK_IDL_PASSIVE_TCP_PY([simple passive idl, initially empty, select empty], | |
167 | [], | |
168 | [['["idltest",{"op":"select","table":"link1","where":[]}]']], | |
169 | [[000: empty | |
170 | 001: {"error":null,"result":[{"rows":[]}]} | |
171 | 002: done | |
172 | ]]) | |
173 | ||
174 | OVSDB_CHECK_IDL([simple idl, initially empty, no ops], | |
175 | [], | |
176 | [], | |
177 | [000: empty | |
178 | 001: done | |
179 | ]) | |
180 | ||
181 | OVSDB_CHECK_IDL([simple idl, initially empty, various ops], | |
182 | [], | |
183 | [['["idltest", | |
184 | {"op": "insert", | |
185 | "table": "simple", | |
186 | "row": {"i": 1, | |
187 | "r": 2.0, | |
188 | "b": true, | |
189 | "s": "mystring", | |
190 | "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"], | |
191 | "ia": ["set", [1, 2, 3]], | |
192 | "ra": ["set", [-0.5]], | |
193 | "ba": ["set", [true]], | |
194 | "sa": ["set", ["abc", "def"]], | |
195 | "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"], | |
196 | ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}}, | |
197 | {"op": "insert", | |
198 | "table": "simple", | |
199 | "row": {}}]' \ | |
200 | '["idltest", | |
201 | {"op": "update", | |
202 | "table": "simple", | |
203 | "where": [], | |
204 | "row": {"b": true}}]' \ | |
205 | '["idltest", | |
206 | {"op": "update", | |
207 | "table": "simple", | |
208 | "where": [], | |
209 | "row": {"r": 123.5}}]' \ | |
210 | '["idltest", | |
211 | {"op": "insert", | |
212 | "table": "simple", | |
213 | "row": {"i": -1, | |
214 | "r": 125, | |
215 | "b": false, | |
216 | "s": "", | |
217 | "ia": ["set", [1]], | |
218 | "ra": ["set", [1.5]], | |
219 | "ba": ["set", [false]], | |
220 | "sa": ["set", []], | |
221 | "ua": ["set", []]}}]' \ | |
222 | '["idltest", | |
223 | {"op": "update", | |
224 | "table": "simple", | |
225 | "where": [["i", "<", 1]], | |
226 | "row": {"s": "newstring"}}]' \ | |
227 | '["idltest", | |
228 | {"op": "delete", | |
229 | "table": "simple", | |
230 | "where": [["i", "==", 0]]}]' \ | |
231 | 'reconnect']], | |
232 | [[000: empty | |
233 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]} | |
234 | 002: i=0 r=0 b=false s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
235 | 002: i=1 r=2 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> | |
236 | 003: {"error":null,"result":[{"count":2}]} | |
237 | 004: i=0 r=0 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
238 | 004: i=1 r=2 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> | |
239 | 005: {"error":null,"result":[{"count":2}]} | |
240 | 006: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
241 | 006: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> | |
242 | 007: {"error":null,"result":[{"uuid":["uuid","<6>"]}]} | |
243 | 008: i=-1 r=125 b=false s= u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
244 | 008: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
245 | 008: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> | |
246 | 009: {"error":null,"result":[{"count":2}]} | |
247 | 010: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
248 | 010: i=0 r=123.5 b=true s=newstring u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
249 | 010: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> | |
250 | 011: {"error":null,"result":[{"count":1}]} | |
251 | 012: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
252 | 012: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> | |
253 | 013: reconnect | |
254 | 014: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
255 | 014: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> | |
256 | 015: done | |
257 | ]]) | |
258 | ||
259 | OVSDB_CHECK_IDL([simple idl, initially populated], | |
260 | [['["idltest", | |
261 | {"op": "insert", | |
262 | "table": "simple", | |
263 | "row": {"i": 1, | |
264 | "r": 2.0, | |
265 | "b": true, | |
266 | "s": "mystring", | |
267 | "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"], | |
268 | "ia": ["set", [1, 2, 3]], | |
269 | "ra": ["set", [-0.5]], | |
270 | "ba": ["set", [true]], | |
271 | "sa": ["set", ["abc", "def"]], | |
272 | "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"], | |
273 | ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}}, | |
274 | {"op": "insert", | |
275 | "table": "simple", | |
276 | "row": {}}]']], | |
277 | [['["idltest", | |
278 | {"op": "update", | |
279 | "table": "simple", | |
280 | "where": [], | |
281 | "row": {"b": true}}]']], | |
282 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
283 | 000: i=1 r=2 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<3> <4>] uuid=<5> | |
284 | 001: {"error":null,"result":[{"count":2}]} | |
285 | 002: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
286 | 002: i=1 r=2 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<3> <4>] uuid=<5> | |
287 | 003: done | |
288 | ]]) | |
289 | ||
290 | OVSDB_CHECK_IDL([simple idl, writing via IDL], | |
291 | [['["idltest", | |
292 | {"op": "insert", | |
293 | "table": "simple", | |
294 | "row": {"i": 1, | |
295 | "r": 2.0, | |
296 | "b": true, | |
297 | "s": "mystring", | |
298 | "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"], | |
299 | "ia": ["set", [1, 2, 3]], | |
300 | "ra": ["set", [-0.5]], | |
301 | "ba": ["set", [true]], | |
302 | "sa": ["set", ["abc", "def"]], | |
303 | "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"], | |
304 | ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}}, | |
305 | {"op": "insert", | |
306 | "table": "simple", | |
307 | "row": {}}]']], | |
308 | [['verify 0 b, verify 1 r, set 0 b 1, set 1 r 3.5' \ | |
309 | 'insert 2, verify 2 i, verify 1 b, delete 1']], | |
310 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
311 | 000: i=1 r=2 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<3> <4>] uuid=<5> | |
312 | 001: commit, status=success | |
313 | 002: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
314 | 002: i=1 r=3.5 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<3> <4>] uuid=<5> | |
315 | 003: commit, status=success | |
316 | 004: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
317 | 004: i=2 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<6> | |
318 | 005: done | |
319 | ]]) | |
320 | ||
321 | OVSDB_CHECK_IDL([simple idl, handling verification failure], | |
322 | [['["idltest", | |
323 | {"op": "insert", | |
324 | "table": "simple", | |
325 | "row": {"i": 1, | |
326 | "r": 2.0}}, | |
327 | {"op": "insert", | |
328 | "table": "simple", | |
329 | "row": {}}]']], | |
330 | [['set 0 b 1' \ | |
331 | '+["idltest", | |
332 | {"op": "update", | |
333 | "table": "simple", | |
334 | "where": [["i", "==", 1]], | |
335 | "row": {"r": 5.0}}]' \ | |
336 | '+verify 1 r, set 1 r 3' \ | |
337 | 'verify 1 r, set 1 r 3' \ | |
338 | ]], | |
339 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
340 | 000: i=1 r=2 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> | |
341 | 001: commit, status=success | |
342 | 002: {"error":null,"result":[{"count":1}]} | |
343 | 003: commit, status=try again | |
344 | 004: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
345 | 004: i=1 r=5 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> | |
346 | 005: commit, status=success | |
347 | 006: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
348 | 006: i=1 r=3 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> | |
349 | 007: done | |
350 | ]]) | |
351 | ||
352 | OVSDB_CHECK_IDL([simple idl, increment operation], | |
353 | [['["idltest", | |
354 | {"op": "insert", | |
355 | "table": "simple", | |
356 | "row": {}}]']], | |
357 | [['set 0 r 2.0, increment 0']], | |
358 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
359 | 001: commit, status=success, increment=1 | |
360 | 002: i=1 r=2 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
361 | 003: done | |
362 | ]]) | |
363 | ||
364 | OVSDB_CHECK_IDL([simple idl, aborting], | |
365 | [['["idltest", | |
366 | {"op": "insert", | |
367 | "table": "simple", | |
368 | "row": {}}]']], | |
369 | [['set 0 r 2.0, abort' \ | |
370 | '+set 0 b 1']], | |
371 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
372 | 001: commit, status=aborted | |
373 | 002: commit, status=success | |
374 | 003: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
375 | 004: done | |
376 | ]]) | |
377 | ||
378 | OVSDB_CHECK_IDL([simple idl, destroy without commit or abort], | |
379 | [['["idltest", | |
380 | {"op": "insert", | |
381 | "table": "simple", | |
382 | "row": {}}]']], | |
383 | [['set 0 r 2.0, destroy' \ | |
384 | '+set 0 b 1']], | |
385 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
386 | 001: destroy | |
387 | 002: commit, status=success | |
388 | 003: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
389 | 004: done | |
390 | ]]) | |
391 | ||
392 | OVSDB_CHECK_IDL([self-linking idl, consistent ops], | |
393 | [], | |
394 | [['["idltest", | |
395 | {"op": "insert", | |
396 | "table": "link1", | |
397 | "row": {"i": 0, "k": ["named-uuid", "self"]}, | |
398 | "uuid-name": "self"}]' \ | |
399 | '["idltest", | |
400 | {"op": "insert", | |
401 | "table": "link1", | |
402 | "row": {"i": 1, "k": ["named-uuid", "row2"]}, | |
403 | "uuid-name": "row1"}, | |
404 | {"op": "insert", | |
405 | "table": "link1", | |
406 | "row": {"i": 2, "k": ["named-uuid", "row1"]}, | |
407 | "uuid-name": "row2"}]' \ | |
408 | '["idltest", | |
409 | {"op": "update", | |
410 | "table": "link1", | |
411 | "where": [["i", "==", 1]], | |
412 | "row": {"k": ["uuid", "#1#"]}}]' \ | |
413 | '["idltest", | |
414 | {"op": "update", | |
415 | "table": "link1", | |
416 | "where": [], | |
417 | "row": {"k": ["uuid", "#0#"]}}]']], | |
418 | [[000: empty | |
419 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]}]} | |
420 | 002: i=0 k=0 ka=[] l2= uuid=<0> | |
421 | 003: {"error":null,"result":[{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]}]} | |
422 | 004: i=0 k=0 ka=[] l2= uuid=<0> | |
423 | 004: i=1 k=2 ka=[] l2= uuid=<1> | |
424 | 004: i=2 k=1 ka=[] l2= uuid=<2> | |
425 | 005: {"error":null,"result":[{"count":1}]} | |
426 | 006: i=0 k=0 ka=[] l2= uuid=<0> | |
427 | 006: i=1 k=1 ka=[] l2= uuid=<1> | |
428 | 006: i=2 k=1 ka=[] l2= uuid=<2> | |
429 | 007: {"error":null,"result":[{"count":3}]} | |
430 | 008: i=0 k=0 ka=[] l2= uuid=<0> | |
431 | 008: i=1 k=0 ka=[] l2= uuid=<1> | |
432 | 008: i=2 k=0 ka=[] l2= uuid=<2> | |
433 | 009: done | |
434 | ]]) | |
435 | ||
436 | OVSDB_CHECK_IDL([self-linking idl, inconsistent ops], | |
437 | [], | |
438 | [['["idltest", | |
439 | {"op": "insert", | |
440 | "table": "link1", | |
441 | "row": {"i": 0, "k": ["uuid", "cf197cc5-c8c9-42f5-82d5-c71a9f2cb96b"]}}]' \ | |
442 | '+["idltest", | |
443 | {"op": "insert", | |
444 | "table": "link1", | |
445 | "uuid-name": "one", | |
446 | "row": {"i": 1, "k": ["named-uuid", "one"]}}, | |
447 | {"op": "insert", | |
448 | "table": "link1", | |
449 | "row": {"i": 2, "k": ["named-uuid", "one"]}}]' \ | |
450 | '["idltest", | |
451 | {"op": "update", | |
452 | "table": "link1", | |
453 | "where": [], | |
454 | "row": {"k": ["uuid", "c2fca39a-e69a-42a4-9c56-5eca85839ce9"]}}]' \ | |
455 | '+["idltest", | |
456 | {"op": "delete", | |
457 | "table": "link1", | |
458 | "where": [["_uuid", "==", ["uuid", "#1#"]]]}]' \ | |
459 | '+["idltest", | |
460 | {"op": "delete", | |
461 | "table": "link1", | |
462 | "where": [["_uuid", "==", ["uuid", "#2#"]]]}]' \ | |
463 | '["idltest", | |
464 | {"op": "delete", | |
465 | "table": "link1", | |
466 | "where": []}]' \ | |
467 | ]], | |
468 | [[000: empty | |
469 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"details":"Table link1 column k row <0> references nonexistent row <1> in table link1.","error":"referential integrity violation"}]} | |
470 | 002: {"error":null,"result":[{"uuid":["uuid","<2>"]},{"uuid":["uuid","<3>"]}]} | |
471 | 003: i=1 k=1 ka=[] l2= uuid=<2> | |
472 | 003: i=2 k=1 ka=[] l2= uuid=<3> | |
473 | 004: {"error":null,"result":[{"count":2},{"details":"Table link1 column k row <x> references nonexistent row <4> in table link1.","error":"referential integrity violation"}]} | |
474 | 005: {"error":null,"result":[{"count":1},{"details":"cannot delete link1 row <2> because of 1 remaining reference(s)","error":"referential integrity violation"}]} | |
475 | 006: {"error":null,"result":[{"count":1}]} | |
476 | 007: i=1 k=1 ka=[] l2= uuid=<2> | |
477 | 008: {"error":null,"result":[{"count":1}]} | |
478 | 009: empty | |
479 | 010: done | |
480 | ]], | |
481 | [], | |
482 | [[sed -e '/004:/s/row <[23]> references/row <x> references/']]) | |
483 | ||
484 | OVSDB_CHECK_IDL([self-linking idl, sets], | |
485 | [], | |
486 | [['["idltest", | |
487 | {"op": "insert", | |
488 | "table": "link1", | |
489 | "row": {"i": 0, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i0"]]]}, | |
490 | "uuid-name": "i0"}, | |
491 | {"op": "insert", | |
492 | "table": "link1", | |
493 | "row": {"i": 1, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i1"]]]}, | |
494 | "uuid-name": "i1"}, | |
495 | {"op": "insert", | |
496 | "table": "link1", | |
497 | "row": {"i": 2, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i2"]]]}, | |
498 | "uuid-name": "i2"}, | |
499 | {"op": "insert", | |
500 | "table": "link1", | |
501 | "row": {"i": 3, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i3"]]]}, | |
502 | "uuid-name": "i3"}]' \ | |
503 | '["idltest", | |
504 | {"op": "update", | |
505 | "table": "link1", | |
506 | "where": [], | |
507 | "row": {"ka": ["set", [["uuid", "#0#"], ["uuid", "#1#"], ["uuid", "#2#"], ["uuid", "#3#"]]]}}]' \ | |
508 | '["idltest", | |
509 | {"op": "update", | |
510 | "table": "link1", | |
511 | "where": [["i", "==", 2]], | |
512 | "row": {"ka": ["set", [["uuid", "#0#"], ["uuid", "88702e78-845b-4a6e-ad08-cf68922ae84a"], ["uuid", "#2#"]]]}}]' \ | |
513 | '+["idltest", | |
514 | {"op": "delete", | |
515 | "table": "link1", | |
516 | "where": []}]']], | |
517 | [[000: empty | |
518 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]},{"uuid":["uuid","<3>"]}]} | |
519 | 002: i=0 k=0 ka=[0] l2= uuid=<0> | |
520 | 002: i=1 k=0 ka=[1] l2= uuid=<1> | |
521 | 002: i=2 k=0 ka=[2] l2= uuid=<2> | |
522 | 002: i=3 k=0 ka=[3] l2= uuid=<3> | |
523 | 003: {"error":null,"result":[{"count":4}]} | |
524 | 004: i=0 k=0 ka=[0 1 2 3] l2= uuid=<0> | |
525 | 004: i=1 k=0 ka=[0 1 2 3] l2= uuid=<1> | |
526 | 004: i=2 k=0 ka=[0 1 2 3] l2= uuid=<2> | |
527 | 004: i=3 k=0 ka=[0 1 2 3] l2= uuid=<3> | |
528 | 005: {"error":null,"result":[{"count":1},{"details":"Table link1 column ka row <2> references nonexistent row <4> in table link1.","error":"referential integrity violation"}]} | |
529 | 006: {"error":null,"result":[{"count":4}]} | |
530 | 007: empty | |
531 | 008: done | |
532 | ]]) | |
533 | ||
534 | OVSDB_CHECK_IDL([external-linking idl, consistent ops], | |
535 | [], | |
536 | [['["idltest", | |
537 | {"op": "insert", | |
538 | "table": "link2", | |
539 | "row": {"i": 0}, | |
540 | "uuid-name": "row0"}, | |
541 | {"op": "insert", | |
542 | "table": "link1", | |
543 | "row": {"i": 1, "k": ["named-uuid", "row1"], "l2": ["set", [["named-uuid", "row0"]]]}, | |
544 | "uuid-name": "row1"}]']], | |
545 | [[000: empty | |
546 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]} | |
547 | 002: i=0 l1= uuid=<0> | |
548 | 002: i=1 k=1 ka=[] l2=0 uuid=<1> | |
549 | 003: done | |
550 | ]]) | |
551 | ||
552 | OVSDB_CHECK_IDL_PY([external-linking idl, insert ops], | |
553 | [], | |
554 | [['linktest']], | |
555 | [[000: empty | |
556 | 001: commit, status=success | |
557 | 002: i=1 k=1 ka=[1] l2= uuid=<0> | |
558 | 002: i=2 k=1 ka=[1 2] l2= uuid=<1> | |
559 | 003: done | |
560 | ]]) | |
561 | ||
562 | OVSDB_CHECK_IDL_PY([getattr idl, insert ops], | |
563 | [], | |
564 | [['getattrtest']], | |
565 | [[000: empty | |
566 | 001: commit, status=success | |
567 | 002: i=2 k=2 ka=[] l2= uuid=<0> | |
568 | 003: done | |
569 | ]]) | |
570 | ||
571 | OVSDB_CHECK_IDL_PY([row-from-json idl, whats this], | |
572 | [['["idltest", | |
573 | {"op": "insert", | |
574 | "table": "simple", | |
575 | "row": {"i": 1}}, | |
576 | {"op": "insert", | |
577 | "table": "simple", | |
578 | "row": {}}]']], | |
579 | [['notifytest insert 2, notifytest set 1 b 1, notifytest delete 0']], | |
580 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
581 | 000: i=1 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> | |
582 | 001: commit, status=success, events=create|2|None, delete|0|None, update|1|b | |
583 | 002: i=1 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> | |
584 | 002: i=2 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3> | |
585 | 003: done | |
586 | ]]) | |
587 | ||
588 | AT_SETUP([idl handling of missing tables and columns - C]) | |
589 | AT_KEYWORDS([ovsdb server idl positive]) | |
590 | ||
591 | # idltest2.ovsschema is the same as idltest.ovsschema, except that | |
592 | # table link2 and column l2 have been deleted. But the IDL still | |
593 | # expects them to be there, so this test checks that it properly | |
594 | # tolerates them being missing. | |
595 | AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest2.ovsschema], | |
596 | [0], [stdout], [ignore]) | |
597 | AT_CHECK([ovsdb-server '-vPATTERN:console:ovsdb-server|%c|%m' --detach --no-chdir --pidfile="`pwd`"/pid --remote=punix:socket --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore]) | |
598 | on_exit 'kill `cat pid`' | |
599 | AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 idl unix:socket ['["idltest", | |
600 | {"op": "insert", | |
601 | "table": "link1", | |
602 | "row": {"i": 0, "k": ["named-uuid", "self"]}, | |
603 | "uuid-name": "self"}]' \ | |
604 | '["idltest", | |
605 | {"op": "insert", | |
606 | "table": "link1", | |
607 | "row": {"i": 1, "k": ["named-uuid", "row2"]}, | |
608 | "uuid-name": "row1"}, | |
609 | {"op": "insert", | |
610 | "table": "link1", | |
611 | "row": {"i": 2, "k": ["named-uuid", "row1"]}, | |
612 | "uuid-name": "row2"}]' \ | |
613 | '["idltest", | |
614 | {"op": "update", | |
615 | "table": "link1", | |
616 | "where": [["i", "==", 1]], | |
617 | "row": {"k": ["uuid", "#1#"]}}]' \ | |
618 | '["idltest", | |
619 | {"op": "update", | |
620 | "table": "link1", | |
621 | "where": [], | |
622 | "row": {"k": ["uuid", "#0#"]}}]']], | |
623 | [0], [stdout], [stderr]) | |
624 | AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl], [0], | |
625 | [[000: empty | |
626 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]}]} | |
627 | 002: i=0 k=0 ka=[] l2= uuid=<0> | |
628 | 003: {"error":null,"result":[{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]}]} | |
629 | 004: i=0 k=0 ka=[] l2= uuid=<0> | |
630 | 004: i=1 k=2 ka=[] l2= uuid=<1> | |
631 | 004: i=2 k=1 ka=[] l2= uuid=<2> | |
632 | 005: {"error":null,"result":[{"count":1}]} | |
633 | 006: i=0 k=0 ka=[] l2= uuid=<0> | |
634 | 006: i=1 k=1 ka=[] l2= uuid=<1> | |
635 | 006: i=2 k=1 ka=[] l2= uuid=<2> | |
636 | 007: {"error":null,"result":[{"count":3}]} | |
637 | 008: i=0 k=0 ka=[] l2= uuid=<0> | |
638 | 008: i=1 k=0 ka=[] l2= uuid=<1> | |
639 | 008: i=2 k=0 ka=[] l2= uuid=<2> | |
640 | 009: done | |
641 | ]]) | |
642 | ||
643 | # Check that ovsdb-idl figured out that table link2 and column l2 are missing. | |
644 | AT_CHECK([grep ovsdb_idl stderr | sort], [0], [dnl | |
645 | test-ovsdb|ovsdb_idl|idltest database lacks link2 table (database needs upgrade?) | |
646 | test-ovsdb|ovsdb_idl|link1 table in idltest database lacks l2 column (database needs upgrade?) | |
647 | ]) | |
648 | ||
649 | # Check that ovsdb-idl sent on "monitor" request and that it didn't | |
650 | # mention that table or column, and (for paranoia) that it did mention another | |
651 | # table and column. | |
652 | AT_CHECK([grep -c '"monitor\|monitor_cond"' stderr], [0], [1 | |
653 | ]) | |
654 | AT_CHECK([grep '"monitor\|monitor_cond"' stderr | grep link2], [1]) | |
655 | AT_CHECK([grep '"monitor\|monitor_cond"' stderr | grep l2], [1]) | |
656 | AT_CHECK([grep '"monitor\|monitor_cond"' stderr | grep -c '"link1"'], [0], [1 | |
657 | ]) | |
658 | AT_CHECK([grep '"monitor\|monitor_cond"' stderr | grep -c '"ua"'], [0], [1 | |
659 | ]) | |
660 | OVSDB_SERVER_SHUTDOWN | |
661 | AT_CLEANUP | |
662 | ||
663 | m4_define([OVSDB_CHECK_IDL_FETCH_COLUMNS_PY], | |
664 | [AT_SETUP([$1 - Python fetch]) | |
665 | AT_SKIP_IF([test $HAVE_PYTHON = no]) | |
666 | AT_KEYWORDS([ovsdb server idl positive Python increment fetch $6]) | |
667 | AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema], | |
668 | [0], [stdout], [ignore]) | |
669 | AT_CHECK([ovsdb-server '-vPATTERN:console:ovsdb-server|%c|%m' --detach --no-chdir --pidfile="`pwd`"/pid --remote=punix:socket --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore]) | |
670 | on_exit 'kill `cat pid`' | |
671 | m4_if([$2], [], [], | |
672 | [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])]) | |
673 | AT_CHECK([$PYTHON $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket [$3] $4], | |
674 | [0], [stdout], [ignore]) | |
675 | AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$7],,, [[| $7]]), | |
676 | [0], [$5]) | |
677 | OVSDB_SERVER_SHUTDOWN | |
678 | AT_CLEANUP]) | |
679 | ||
680 | m4_define([OVSDB_CHECK_IDL_FETCH_COLUMNS], | |
681 | [OVSDB_CHECK_IDL_FETCH_COLUMNS_PY($@)]) | |
682 | ||
683 | OVSDB_CHECK_IDL_FETCH_COLUMNS([simple idl, initially populated], | |
684 | [['["idltest", | |
685 | {"op": "insert", | |
686 | "table": "simple", | |
687 | "row": {"i": 1, | |
688 | "r": 2.0, | |
689 | "b": true, | |
690 | "s": "mystring", | |
691 | "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"], | |
692 | "ia": ["set", [1, 2, 3]], | |
693 | "ra": ["set", [-0.5]], | |
694 | "ba": ["set", [true]], | |
695 | "sa": ["set", ["abc", "def"]], | |
696 | "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"], | |
697 | ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}}, | |
698 | {"op": "insert", | |
699 | "table": "simple", | |
700 | "row": {}}]']], | |
701 | [?simple:i,r!], | |
702 | ['fetch 0 r'], | |
703 | [[000: i=0 uuid=<0> | |
704 | 000: i=1 uuid=<1> | |
705 | 001: commit, status=success | |
706 | 002: i=0 r=0 uuid=<0> | |
707 | 002: i=1 uuid=<1> | |
708 | 003: done | |
709 | ]]) | |
710 | ||
711 | m4_define([OVSDB_CHECK_IDL_TRACK_C], | |
712 | [AT_SETUP([$1 - C]) | |
713 | AT_KEYWORDS([ovsdb server idl tracking positive $5]) | |
714 | AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema], | |
715 | [0], [stdout], [ignore]) | |
716 | AT_CHECK([ovsdb-server '-vPATTERN:console:ovsdb-server|%c|%m' --detach --no-chdir --pidfile="`pwd`"/pid --remote=punix:socket --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore]) | |
717 | on_exit 'kill `cat pid`' | |
718 | m4_if([$2], [], [], | |
719 | [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])]) | |
720 | AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl unix:socket $3], | |
721 | [0], [stdout], [ignore]) | |
722 | AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]), | |
723 | [0], [$4]) | |
724 | OVSDB_SERVER_SHUTDOWN | |
725 | AT_CLEANUP]) | |
726 | ||
727 | m4_define([OVSDB_CHECK_IDL_TRACK], | |
728 | [OVSDB_CHECK_IDL_TRACK_C($@)]) | |
729 | ||
730 | OVSDB_CHECK_IDL_TRACK([track, simple idl, initially populated], | |
731 | [['["idltest", | |
732 | {"op": "insert", | |
733 | "table": "simple", | |
734 | "row": {"i": 1, | |
735 | "r": 2.0, | |
736 | "b": true, | |
737 | "s": "mystring", | |
738 | "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"], | |
739 | "ia": ["set", [1, 2, 3]], | |
740 | "ra": ["set", [-0.5]], | |
741 | "ba": ["set", [true]], | |
742 | "sa": ["set", ["abc", "def"]], | |
743 | "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"], | |
744 | ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}}, | |
745 | {"op": "insert", | |
746 | "table": "simple", | |
747 | "row": {}}]']], | |
748 | [['["idltest", | |
749 | {"op": "update", | |
750 | "table": "simple", | |
751 | "where": [], | |
752 | "row": {"b": true}}]']], | |
753 | [[000: i=1 r=2 b=true s=mystring u=<0> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<1> <2>] uuid=<3> | |
754 | 000: updated columns: b ba i ia r ra s sa u ua | |
755 | 001: {"error":null,"result":[{"count":2}]} | |
756 | 002: i=0 r=0 b=true s= u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<5> | |
757 | 002: i=1 r=2 b=true s=mystring u=<0> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<1> <2>] uuid=<3> | |
758 | 002: updated columns: b | |
759 | 003: done | |
760 | ]]) | |
761 | ||
762 | OVSDB_CHECK_IDL_TRACK([track, simple idl, initially empty, various ops], | |
763 | [], | |
764 | [['["idltest", | |
765 | {"op": "insert", | |
766 | "table": "simple", | |
767 | "row": {"i": 1, | |
768 | "r": 2.0, | |
769 | "b": true, | |
770 | "s": "mystring", | |
771 | "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"], | |
772 | "ia": ["set", [1, 2, 3]], | |
773 | "ra": ["set", [-0.5]], | |
774 | "ba": ["set", [true]], | |
775 | "sa": ["set", ["abc", "def"]], | |
776 | "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"], | |
777 | ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}}, | |
778 | {"op": "insert", | |
779 | "table": "simple", | |
780 | "row": {}}]' \ | |
781 | '["idltest", | |
782 | {"op": "update", | |
783 | "table": "simple", | |
784 | "where": [], | |
785 | "row": {"b": true}}]' \ | |
786 | '["idltest", | |
787 | {"op": "update", | |
788 | "table": "simple", | |
789 | "where": [], | |
790 | "row": {"r": 123.5}}]' \ | |
791 | '["idltest", | |
792 | {"op": "insert", | |
793 | "table": "simple", | |
794 | "row": {"i": -1, | |
795 | "r": 125, | |
796 | "b": false, | |
797 | "s": "", | |
798 | "ia": ["set", [1]], | |
799 | "ra": ["set", [1.5]], | |
800 | "ba": ["set", [false]], | |
801 | "sa": ["set", []], | |
802 | "ua": ["set", []]}}]' \ | |
803 | '["idltest", | |
804 | {"op": "update", | |
805 | "table": "simple", | |
806 | "where": [["i", "<", 1]], | |
807 | "row": {"s": "newstring"}}]' \ | |
808 | '["idltest", | |
809 | {"op": "delete", | |
810 | "table": "simple", | |
811 | "where": [["i", "==", 0]]}]' \ | |
812 | 'reconnect']], | |
813 | [[000: empty | |
814 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]} | |
815 | 002: i=1 r=2 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<3> <4>] uuid=<0> | |
816 | 002: updated columns: b ba i ia r ra s sa u ua | |
817 | 003: {"error":null,"result":[{"count":2}]} | |
818 | 004: i=0 r=0 b=true s= u=<5> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
819 | 004: updated columns: b | |
820 | 005: {"error":null,"result":[{"count":2}]} | |
821 | 006: i=0 r=123.5 b=true s= u=<5> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
822 | 006: i=1 r=123.5 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<3> <4>] uuid=<0> | |
823 | 006: updated columns: r | |
824 | 006: updated columns: r | |
825 | 007: {"error":null,"result":[{"uuid":["uuid","<6>"]}]} | |
826 | 008: i=-1 r=125 b=false s= u=<5> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
827 | 008: updated columns: ba i ia r ra | |
828 | 009: {"error":null,"result":[{"count":2}]} | |
829 | 010: i=-1 r=125 b=false s=newstring u=<5> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
830 | 010: i=0 r=123.5 b=true s=newstring u=<5> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
831 | 010: updated columns: s | |
832 | 010: updated columns: s | |
833 | 011: {"error":null,"result":[{"count":1}]} | |
834 | 012: ##deleted## uuid=<1> | |
835 | 013: reconnect | |
836 | 014: i=-1 r=125 b=false s=newstring u=<5> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
837 | 014: i=1 r=123.5 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<3> <4>] uuid=<0> | |
838 | 014: updated columns: b ba i ia r ra s sa u ua | |
839 | 014: updated columns: ba i ia r ra s | |
840 | 015: done | |
841 | ]]) | |
842 | ||
843 | m4_define([OVSDB_CHECK_IDL_PARTIAL_UPDATE_MAP_COLUMN], | |
844 | [AT_SETUP([$1 - C]) | |
845 | AT_KEYWORDS([ovsdb server idl partial update map column positive $5]) | |
846 | AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema], | |
847 | [0], [stdout], [ignore]) | |
848 | AT_CHECK([ovsdb-server '-vPATTERN:console:ovsdb-server|%c|%m' --detach --no-chdir --pidfile="`pwd`"/pid --remote=punix:socket --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore]) | |
849 | on_exit 'kill `cat pid`' | |
850 | m4_if([$2], [], [], | |
851 | [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])]) | |
852 | AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl-partial-update-map-column unix:socket $3], | |
853 | [0], [stdout], [ignore]) | |
854 | AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]), | |
855 | [0], [$4]) | |
856 | OVSDB_SERVER_SHUTDOWN | |
857 | AT_CLEANUP]) | |
858 | ||
859 | OVSDB_CHECK_IDL_PARTIAL_UPDATE_MAP_COLUMN([map, simple2 idl-partial-update-map-column, initially populated], | |
860 | [['["idltest", {"op":"insert", "table":"simple2", | |
861 | "row":{"name":"myString1","smap":["map",[["key1","value1"],["key2","value2"]]]} }]'] | |
862 | ], | |
863 | [], | |
864 | [[000: Getting records | |
865 | 001: name=myString1 smap=[[key1 : value1],[key2 : value2]] imap=[] | |
866 | 002: After insert element | |
867 | 003: name=String2 smap=[[key1 : myList1],[key2 : value2]] imap=[[3 : myids2]] | |
868 | 004: After insert duplicated element | |
869 | 005: name=String2 smap=[[key1 : myList1],[key2 : value2]] imap=[[3 : myids2]] | |
870 | 006: After delete element | |
871 | 007: name=String2 smap=[[key2 : value2]] imap=[[3 : myids2]] | |
872 | 008: After trying to delete a deleted element | |
873 | 009: name=String2 smap=[[key2 : value2]] imap=[[3 : myids2]] | |
874 | 010: End test | |
875 | ]]) |