]>
Commit | Line | Data |
---|---|---|
c3bb4bd7 BP |
1 | AT_BANNER([OVSDB -- interface description language (IDL)]) |
2 | ||
8cdf0349 BP |
3 | # OVSDB_CHECK_IDL_C(TITLE, [PRE-IDL-TXN], TRANSACTIONS, OUTPUT, [KEYWORDS], |
4 | # [FILTER]) | |
c3bb4bd7 BP |
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 | |
254604d8 BP |
15 | # marker. If FILTER is supplied then the output is also filtered |
16 | # through the specified program. | |
c3bb4bd7 BP |
17 | # |
18 | # TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS. | |
8cdf0349 BP |
19 | m4_define([OVSDB_CHECK_IDL_C], |
20 | [AT_SETUP([$1 - C]) | |
c3bb4bd7 | 21 | AT_KEYWORDS([ovsdb server idl positive $5]) |
7c126fbb | 22 | AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema], |
00732bf5 | 23 | [0], [stdout], [ignore]) |
77a922c7 | 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]) |
c3bb4bd7 | 25 | m4_if([$2], [], [], |
028cbd99 | 26 | [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore], [kill `cat pid`])]) |
8cdf0349 | 27 | AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 idl unix:socket $3], |
028cbd99 | 28 | [0], [stdout], [ignore], [kill `cat pid`]) |
5c6d0628 | 29 | AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]), |
254604d8 | 30 | [0], [$4], [], [kill `cat pid`]) |
028cbd99 | 31 | OVSDB_SERVER_SHUTDOWN |
c3bb4bd7 BP |
32 | AT_CLEANUP]) |
33 | ||
8cdf0349 BP |
34 | # same as OVSDB_CHECK_IDL but uses the Python IDL implementation. |
35 | m4_define([OVSDB_CHECK_IDL_PY], | |
36 | [AT_SETUP([$1 - Python]) | |
37 | AT_SKIP_IF([test $HAVE_PYTHON = no]) | |
38 | AT_KEYWORDS([ovsdb server idl positive Python $5]) | |
39 | AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema], | |
40 | [0], [stdout], [ignore]) | |
77a922c7 | 41 | 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]) |
8cdf0349 BP |
42 | m4_if([$2], [], [], |
43 | [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore], [kill `cat pid`])]) | |
44 | AT_CHECK([$PYTHON $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket $3], | |
45 | [0], [stdout], [ignore], [kill `cat pid`]) | |
5c6d0628 | 46 | AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]), |
8cdf0349 BP |
47 | [0], [$4], [], [kill `cat pid`]) |
48 | OVSDB_SERVER_SHUTDOWN | |
49 | AT_CLEANUP]) | |
50 | ||
e06d06a7 IY |
51 | # same as OVSDB_CHECK_IDL but uses the Python IDL implementation with tcp |
52 | m4_define([OVSDB_CHECK_IDL_TCP_PY], | |
53 | [AT_SETUP([$1 - Python tcp]) | |
54 | AT_SKIP_IF([test $HAVE_PYTHON = no]) | |
55 | AT_KEYWORDS([ovsdb server idl positive Python with tcp socket $5]) | |
56 | AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema], | |
57 | [0], [stdout], [ignore]) | |
1e04fcc8 | 58 | 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]) |
b52ecd96 | 59 | TCP_PORT=`parse_listening_port < ovsdb-server.log` |
1e04fcc8 | 60 | |
e06d06a7 IY |
61 | m4_if([$2], [], [], |
62 | [AT_CHECK([ovsdb-client transact tcp:127.0.0.1:$TCP_PORT $2], [0], [ignore], [ignore], [kill `cat pid`])]) | |
63 | AT_CHECK([$PYTHON $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema tcp:127.0.0.1:$TCP_PORT $3], | |
64 | [0], [stdout], [ignore], [kill `cat pid`]) | |
5c6d0628 | 65 | AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]), |
e06d06a7 IY |
66 | [0], [$4], [], [kill `cat pid`]) |
67 | OVSDB_SERVER_SHUTDOWN | |
68 | AT_CLEANUP]) | |
69 | ||
e731d71b AS |
70 | # same as OVSDB_CHECK_IDL but uses the Python IDL implementation with tcp6 |
71 | m4_define([OVSDB_CHECK_IDL_TCP6_PY], | |
72 | [AT_SETUP([$1 - Python tcp6]) | |
73 | AT_SKIP_IF([test $HAVE_PYTHON = no]) | |
4819b3a5 | 74 | AT_SKIP_IF([test $HAVE_IPV6 = no]) |
e731d71b | 75 | AT_KEYWORDS([ovsdb server idl positive Python with tcp6 socket $5]) |
e731d71b AS |
76 | AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema], |
77 | [0], [stdout], [ignore]) | |
78 | 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]) | |
b52ecd96 | 79 | TCP_PORT=`parse_listening_port < ovsdb-server.log` |
e731d71b AS |
80 | echo "TCP_PORT=$TCP_PORT" |
81 | ||
82 | m4_if([$2], [], [], | |
83 | [AT_CHECK([ovsdb-client transact "tcp:[[::1]]:$TCP_PORT" $2], [0], [ignore], [ignore], [kill `cat pid`])]) | |
a0df641d | 84 | AT_CHECK([$PYTHON $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema tcp:[[::1]]:$TCP_PORT $3], |
e731d71b AS |
85 | [0], [stdout], [ignore], [kill `cat pid`]) |
86 | AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]), | |
87 | [0], [$4], [], [kill `cat pid`]) | |
88 | OVSDB_SERVER_SHUTDOWN | |
89 | AT_CLEANUP]) | |
90 | ||
8cdf0349 BP |
91 | m4_define([OVSDB_CHECK_IDL], |
92 | [OVSDB_CHECK_IDL_C($@) | |
e06d06a7 | 93 | OVSDB_CHECK_IDL_PY($@) |
e731d71b AS |
94 | OVSDB_CHECK_IDL_TCP_PY($@) |
95 | OVSDB_CHECK_IDL_TCP6_PY($@)]) | |
8cdf0349 | 96 | |
c3bb4bd7 BP |
97 | OVSDB_CHECK_IDL([simple idl, initially empty, no ops], |
98 | [], | |
99 | [], | |
100 | [000: empty | |
101 | 001: done | |
102 | ]) | |
103 | ||
104 | OVSDB_CHECK_IDL([simple idl, initially empty, various ops], | |
105 | [], | |
9cb53f26 BP |
106 | [['["idltest", |
107 | {"op": "insert", | |
c3bb4bd7 BP |
108 | "table": "simple", |
109 | "row": {"i": 1, | |
110 | "r": 2.0, | |
111 | "b": true, | |
112 | "s": "mystring", | |
113 | "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"], | |
114 | "ia": ["set", [1, 2, 3]], | |
115 | "ra": ["set", [-0.5]], | |
7fae24e6 | 116 | "ba": ["set", [true]], |
8cdf0349 | 117 | "sa": ["set", ["abc", "def"]], |
c3bb4bd7 BP |
118 | "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"], |
119 | ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}}, | |
120 | {"op": "insert", | |
121 | "table": "simple", | |
122 | "row": {}}]' \ | |
9cb53f26 BP |
123 | '["idltest", |
124 | {"op": "update", | |
c3bb4bd7 BP |
125 | "table": "simple", |
126 | "where": [], | |
127 | "row": {"b": true}}]' \ | |
9cb53f26 BP |
128 | '["idltest", |
129 | {"op": "update", | |
c3bb4bd7 BP |
130 | "table": "simple", |
131 | "where": [], | |
132 | "row": {"r": 123.5}}]' \ | |
9cb53f26 BP |
133 | '["idltest", |
134 | {"op": "insert", | |
c3bb4bd7 BP |
135 | "table": "simple", |
136 | "row": {"i": -1, | |
137 | "r": 125, | |
138 | "b": false, | |
139 | "s": "", | |
140 | "ia": ["set", [1]], | |
141 | "ra": ["set", [1.5]], | |
142 | "ba": ["set", [false]], | |
8cdf0349 | 143 | "sa": ["set", []], |
c3bb4bd7 | 144 | "ua": ["set", []]}}]' \ |
9cb53f26 BP |
145 | '["idltest", |
146 | {"op": "update", | |
c3bb4bd7 BP |
147 | "table": "simple", |
148 | "where": [["i", "<", 1]], | |
149 | "row": {"s": "newstring"}}]' \ | |
9cb53f26 BP |
150 | '["idltest", |
151 | {"op": "delete", | |
c3bb4bd7 BP |
152 | "table": "simple", |
153 | "where": [["i", "==", 0]]}]' \ | |
154 | 'reconnect']], | |
155 | [[000: empty | |
156 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]} | |
157 | 002: i=0 r=0 b=false s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 158 | 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> |
c3bb4bd7 BP |
159 | 003: {"error":null,"result":[{"count":2}]} |
160 | 004: i=0 r=0 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 161 | 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> |
c3bb4bd7 BP |
162 | 005: {"error":null,"result":[{"count":2}]} |
163 | 006: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 164 | 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> |
c3bb4bd7 BP |
165 | 007: {"error":null,"result":[{"uuid":["uuid","<6>"]}]} |
166 | 008: i=-1 r=125 b=false s= u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
167 | 008: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 168 | 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> |
c3bb4bd7 BP |
169 | 009: {"error":null,"result":[{"count":2}]} |
170 | 010: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
171 | 010: i=0 r=123.5 b=true s=newstring u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 172 | 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> |
c3bb4bd7 BP |
173 | 011: {"error":null,"result":[{"count":1}]} |
174 | 012: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
7fae24e6 | 175 | 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> |
c3bb4bd7 BP |
176 | 013: reconnect |
177 | 014: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
7fae24e6 | 178 | 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> |
c3bb4bd7 BP |
179 | 015: done |
180 | ]]) | |
181 | ||
182 | OVSDB_CHECK_IDL([simple idl, initially populated], | |
9cb53f26 BP |
183 | [['["idltest", |
184 | {"op": "insert", | |
c3bb4bd7 BP |
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]], | |
7fae24e6 | 193 | "ba": ["set", [true]], |
8cdf0349 | 194 | "sa": ["set", ["abc", "def"]], |
c3bb4bd7 BP |
195 | "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"], |
196 | ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}}, | |
197 | {"op": "insert", | |
198 | "table": "simple", | |
199 | "row": {}}]']], | |
9cb53f26 BP |
200 | [['["idltest", |
201 | {"op": "update", | |
c3bb4bd7 BP |
202 | "table": "simple", |
203 | "where": [], | |
204 | "row": {"b": true}}]']], | |
205 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 206 | 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> |
c3bb4bd7 BP |
207 | 001: {"error":null,"result":[{"count":2}]} |
208 | 002: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 209 | 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> |
c3bb4bd7 BP |
210 | 003: done |
211 | ]]) | |
212 | ||
475281c0 | 213 | OVSDB_CHECK_IDL([simple idl, writing via IDL], |
9cb53f26 BP |
214 | [['["idltest", |
215 | {"op": "insert", | |
475281c0 BP |
216 | "table": "simple", |
217 | "row": {"i": 1, | |
218 | "r": 2.0, | |
219 | "b": true, | |
220 | "s": "mystring", | |
221 | "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"], | |
222 | "ia": ["set", [1, 2, 3]], | |
223 | "ra": ["set", [-0.5]], | |
7fae24e6 | 224 | "ba": ["set", [true]], |
8cdf0349 | 225 | "sa": ["set", ["abc", "def"]], |
475281c0 BP |
226 | "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"], |
227 | ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}}, | |
228 | {"op": "insert", | |
229 | "table": "simple", | |
230 | "row": {}}]']], | |
a91c6104 BP |
231 | [['verify 0 b, verify 1 r, set 0 b 1, set 1 r 3.5' \ |
232 | 'insert 2, verify 2 i, verify 1 b, delete 1']], | |
475281c0 | 233 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> |
7fae24e6 | 234 | 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> |
475281c0 BP |
235 | 001: commit, status=success |
236 | 002: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 237 | 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> |
475281c0 BP |
238 | 003: commit, status=success |
239 | 004: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
240 | 004: i=2 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<6> | |
241 | 005: done | |
242 | ]]) | |
243 | ||
a91c6104 BP |
244 | OVSDB_CHECK_IDL([simple idl, handling verification failure], |
245 | [['["idltest", | |
246 | {"op": "insert", | |
247 | "table": "simple", | |
248 | "row": {"i": 1, | |
249 | "r": 2.0}}, | |
250 | {"op": "insert", | |
251 | "table": "simple", | |
252 | "row": {}}]']], | |
253 | [['set 0 b 1' \ | |
254 | '+["idltest", | |
255 | {"op": "update", | |
256 | "table": "simple", | |
257 | "where": [["i", "==", 1]], | |
258 | "row": {"r": 5.0}}]' \ | |
259 | '+verify 1 r, set 1 r 3' \ | |
260 | 'verify 1 r, set 1 r 3' \ | |
261 | ]], | |
262 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
263 | 000: i=1 r=2 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> | |
264 | 001: commit, status=success | |
265 | 002: {"error":null,"result":[{"count":1}]} | |
94fbe1aa | 266 | 003: commit, status=try again |
a91c6104 BP |
267 | 004: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> |
268 | 004: i=1 r=5 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> | |
269 | 005: commit, status=success | |
270 | 006: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
271 | 006: i=1 r=3 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> | |
272 | 007: done | |
273 | ]]) | |
274 | ||
b54e22e9 | 275 | OVSDB_CHECK_IDL([simple idl, increment operation], |
9cb53f26 BP |
276 | [['["idltest", |
277 | {"op": "insert", | |
b54e22e9 BP |
278 | "table": "simple", |
279 | "row": {}}]']], | |
94fbe1aa | 280 | [['set 0 r 2.0, increment 0']], |
b54e22e9 BP |
281 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> |
282 | 001: commit, status=success, increment=1 | |
283 | 002: i=1 r=2 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
284 | 003: done | |
285 | ]]) | |
286 | ||
2096903b BP |
287 | OVSDB_CHECK_IDL([simple idl, aborting], |
288 | [['["idltest", | |
289 | {"op": "insert", | |
290 | "table": "simple", | |
291 | "row": {}}]']], | |
292 | [['set 0 r 2.0, abort' \ | |
293 | '+set 0 b 1']], | |
294 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
295 | 001: commit, status=aborted | |
296 | 002: commit, status=success | |
297 | 003: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
298 | 004: done | |
299 | ]]) | |
300 | ||
301 | OVSDB_CHECK_IDL([simple idl, destroy without commit or abort], | |
302 | [['["idltest", | |
303 | {"op": "insert", | |
304 | "table": "simple", | |
305 | "row": {}}]']], | |
306 | [['set 0 r 2.0, destroy' \ | |
307 | '+set 0 b 1']], | |
308 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
309 | 001: destroy | |
310 | 002: commit, status=success | |
311 | 003: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
312 | 004: done | |
313 | ]]) | |
314 | ||
c3bb4bd7 BP |
315 | OVSDB_CHECK_IDL([self-linking idl, consistent ops], |
316 | [], | |
9cb53f26 BP |
317 | [['["idltest", |
318 | {"op": "insert", | |
e9011ac8 | 319 | "table": "link1", |
c3bb4bd7 BP |
320 | "row": {"i": 0, "k": ["named-uuid", "self"]}, |
321 | "uuid-name": "self"}]' \ | |
9cb53f26 BP |
322 | '["idltest", |
323 | {"op": "insert", | |
e9011ac8 | 324 | "table": "link1", |
2d2d6d4a | 325 | "row": {"i": 1, "k": ["named-uuid", "row2"]}, |
c3bb4bd7 BP |
326 | "uuid-name": "row1"}, |
327 | {"op": "insert", | |
e9011ac8 | 328 | "table": "link1", |
c3bb4bd7 | 329 | "row": {"i": 2, "k": ["named-uuid", "row1"]}, |
2d2d6d4a | 330 | "uuid-name": "row2"}]' \ |
9cb53f26 BP |
331 | '["idltest", |
332 | {"op": "update", | |
e9011ac8 | 333 | "table": "link1", |
c3bb4bd7 BP |
334 | "where": [["i", "==", 1]], |
335 | "row": {"k": ["uuid", "#1#"]}}]' \ | |
9cb53f26 BP |
336 | '["idltest", |
337 | {"op": "update", | |
e9011ac8 | 338 | "table": "link1", |
c3bb4bd7 BP |
339 | "where": [], |
340 | "row": {"k": ["uuid", "#0#"]}}]']], | |
341 | [[000: empty | |
342 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]}]} | |
e9011ac8 | 343 | 002: i=0 k=0 ka=[] l2= uuid=<0> |
fbf925e4 | 344 | 003: {"error":null,"result":[{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]}]} |
e9011ac8 BP |
345 | 004: i=0 k=0 ka=[] l2= uuid=<0> |
346 | 004: i=1 k=2 ka=[] l2= uuid=<1> | |
347 | 004: i=2 k=1 ka=[] l2= uuid=<2> | |
c3bb4bd7 | 348 | 005: {"error":null,"result":[{"count":1}]} |
e9011ac8 BP |
349 | 006: i=0 k=0 ka=[] l2= uuid=<0> |
350 | 006: i=1 k=1 ka=[] l2= uuid=<1> | |
351 | 006: i=2 k=1 ka=[] l2= uuid=<2> | |
c3bb4bd7 | 352 | 007: {"error":null,"result":[{"count":3}]} |
e9011ac8 BP |
353 | 008: i=0 k=0 ka=[] l2= uuid=<0> |
354 | 008: i=1 k=0 ka=[] l2= uuid=<1> | |
355 | 008: i=2 k=0 ka=[] l2= uuid=<2> | |
c3bb4bd7 BP |
356 | 009: done |
357 | ]]) | |
358 | ||
359 | OVSDB_CHECK_IDL([self-linking idl, inconsistent ops], | |
360 | [], | |
9cb53f26 BP |
361 | [['["idltest", |
362 | {"op": "insert", | |
e9011ac8 | 363 | "table": "link1", |
c3bb4bd7 | 364 | "row": {"i": 0, "k": ["uuid", "cf197cc5-c8c9-42f5-82d5-c71a9f2cb96b"]}}]' \ |
9cb53f26 BP |
365 | '+["idltest", |
366 | {"op": "insert", | |
e9011ac8 | 367 | "table": "link1", |
0d0f05b9 BP |
368 | "uuid-name": "one", |
369 | "row": {"i": 1, "k": ["named-uuid", "one"]}}, | |
370 | {"op": "insert", | |
371 | "table": "link1", | |
372 | "row": {"i": 2, "k": ["named-uuid", "one"]}}]' \ | |
9cb53f26 BP |
373 | '["idltest", |
374 | {"op": "update", | |
e9011ac8 | 375 | "table": "link1", |
c3bb4bd7 BP |
376 | "where": [], |
377 | "row": {"k": ["uuid", "c2fca39a-e69a-42a4-9c56-5eca85839ce9"]}}]' \ | |
9cb53f26 BP |
378 | '+["idltest", |
379 | {"op": "delete", | |
e9011ac8 | 380 | "table": "link1", |
0d0f05b9 | 381 | "where": [["_uuid", "==", ["uuid", "#1#"]]]}]' \ |
9cb53f26 BP |
382 | '+["idltest", |
383 | {"op": "delete", | |
e9011ac8 | 384 | "table": "link1", |
0d0f05b9 | 385 | "where": [["_uuid", "==", ["uuid", "#2#"]]]}]' \ |
9cb53f26 BP |
386 | '["idltest", |
387 | {"op": "delete", | |
0d0f05b9 BP |
388 | "table": "link1", |
389 | "where": []}]' \ | |
c3bb4bd7 BP |
390 | ]], |
391 | [[000: empty | |
97f7803b | 392 | 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"}]} |
0d0f05b9 BP |
393 | 002: {"error":null,"result":[{"uuid":["uuid","<2>"]},{"uuid":["uuid","<3>"]}]} |
394 | 003: i=1 k=1 ka=[] l2= uuid=<2> | |
395 | 003: i=2 k=1 ka=[] l2= uuid=<3> | |
254604d8 | 396 | 004: {"error":null,"result":[{"count":2},{"details":"Table link1 column k row <x> references nonexistent row <4> in table link1.","error":"referential integrity violation"}]} |
0d0f05b9 BP |
397 | 005: {"error":null,"result":[{"count":1},{"details":"cannot delete link1 row <2> because of 1 remaining reference(s)","error":"referential integrity violation"}]} |
398 | 006: {"error":null,"result":[{"count":1}]} | |
399 | 007: i=1 k=1 ka=[] l2= uuid=<2> | |
400 | 008: {"error":null,"result":[{"count":1}]} | |
401 | 009: empty | |
402 | 010: done | |
254604d8 BP |
403 | ]], |
404 | [], | |
405 | [[sed -e '/004:/s/row <[23]> references/row <x> references/']]) | |
c3bb4bd7 BP |
406 | |
407 | OVSDB_CHECK_IDL([self-linking idl, sets], | |
408 | [], | |
9cb53f26 BP |
409 | [['["idltest", |
410 | {"op": "insert", | |
e9011ac8 | 411 | "table": "link1", |
0d0f05b9 | 412 | "row": {"i": 0, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i0"]]]}, |
c3bb4bd7 BP |
413 | "uuid-name": "i0"}, |
414 | {"op": "insert", | |
e9011ac8 | 415 | "table": "link1", |
0d0f05b9 | 416 | "row": {"i": 1, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i1"]]]}, |
c3bb4bd7 BP |
417 | "uuid-name": "i1"}, |
418 | {"op": "insert", | |
e9011ac8 | 419 | "table": "link1", |
0d0f05b9 | 420 | "row": {"i": 2, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i2"]]]}, |
c3bb4bd7 BP |
421 | "uuid-name": "i2"}, |
422 | {"op": "insert", | |
e9011ac8 | 423 | "table": "link1", |
0d0f05b9 | 424 | "row": {"i": 3, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i3"]]]}, |
c3bb4bd7 | 425 | "uuid-name": "i3"}]' \ |
9cb53f26 BP |
426 | '["idltest", |
427 | {"op": "update", | |
e9011ac8 | 428 | "table": "link1", |
c3bb4bd7 BP |
429 | "where": [], |
430 | "row": {"ka": ["set", [["uuid", "#0#"], ["uuid", "#1#"], ["uuid", "#2#"], ["uuid", "#3#"]]]}}]' \ | |
9cb53f26 BP |
431 | '["idltest", |
432 | {"op": "update", | |
e9011ac8 | 433 | "table": "link1", |
97f7803b BP |
434 | "where": [["i", "==", 2]], |
435 | "row": {"ka": ["set", [["uuid", "#0#"], ["uuid", "88702e78-845b-4a6e-ad08-cf68922ae84a"], ["uuid", "#2#"]]]}}]' \ | |
9cb53f26 BP |
436 | '+["idltest", |
437 | {"op": "delete", | |
0d0f05b9 BP |
438 | "table": "link1", |
439 | "where": []}]']], | |
c3bb4bd7 BP |
440 | [[000: empty |
441 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]},{"uuid":["uuid","<3>"]}]} | |
0d0f05b9 BP |
442 | 002: i=0 k=0 ka=[0] l2= uuid=<0> |
443 | 002: i=1 k=0 ka=[1] l2= uuid=<1> | |
444 | 002: i=2 k=0 ka=[2] l2= uuid=<2> | |
445 | 002: i=3 k=0 ka=[3] l2= uuid=<3> | |
c3bb4bd7 | 446 | 003: {"error":null,"result":[{"count":4}]} |
0d0f05b9 BP |
447 | 004: i=0 k=0 ka=[0 1 2 3] l2= uuid=<0> |
448 | 004: i=1 k=0 ka=[0 1 2 3] l2= uuid=<1> | |
449 | 004: i=2 k=0 ka=[0 1 2 3] l2= uuid=<2> | |
450 | 004: i=3 k=0 ka=[0 1 2 3] l2= uuid=<3> | |
97f7803b | 451 | 005: {"error":null,"result":[{"count":1},{"details":"Table link1 column ka row <2> references nonexistent row <4> in table link1.","error":"referential integrity violation"}]} |
0d0f05b9 BP |
452 | 006: {"error":null,"result":[{"count":4}]} |
453 | 007: empty | |
454 | 008: done | |
c3bb4bd7 BP |
455 | ]]) |
456 | ||
e9011ac8 BP |
457 | OVSDB_CHECK_IDL([external-linking idl, consistent ops], |
458 | [], | |
9cb53f26 BP |
459 | [['["idltest", |
460 | {"op": "insert", | |
e9011ac8 BP |
461 | "table": "link2", |
462 | "row": {"i": 0}, | |
463 | "uuid-name": "row0"}, | |
464 | {"op": "insert", | |
465 | "table": "link1", | |
0d0f05b9 | 466 | "row": {"i": 1, "k": ["named-uuid", "row1"], "l2": ["set", [["named-uuid", "row0"]]]}, |
e9011ac8 BP |
467 | "uuid-name": "row1"}]']], |
468 | [[000: empty | |
469 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]} | |
470 | 002: i=0 l1= uuid=<0> | |
0d0f05b9 | 471 | 002: i=1 k=1 ka=[] l2=0 uuid=<1> |
e9011ac8 BP |
472 | 003: done |
473 | ]]) | |
225b582a IY |
474 | |
475 | OVSDB_CHECK_IDL_PY([external-linking idl, insert ops], | |
476 | [], | |
477 | [['linktest']], | |
478 | [[000: empty | |
479 | 001: commit, status=success | |
480 | 002: i=1 k=1 ka=[1] l2= uuid=<0> | |
481 | 002: i=2 k=1 ka=[1 2] l2= uuid=<1> | |
482 | 003: done | |
483 | ]]) | |
3b4c362f IY |
484 | |
485 | OVSDB_CHECK_IDL_PY([getattr idl, insert ops], | |
486 | [], | |
487 | [['getattrtest']], | |
488 | [[000: empty | |
489 | 001: commit, status=success | |
490 | 002: i=2 k=2 ka=[] l2= uuid=<0> | |
491 | 003: done | |
492 | ]]) | |
d18e52e3 | 493 | |
d7d417fc TW |
494 | OVSDB_CHECK_IDL_PY([row-from-json idl, whats this], |
495 | [['["idltest", | |
496 | {"op": "insert", | |
497 | "table": "simple", | |
498 | "row": {"i": 1}}, | |
499 | {"op": "insert", | |
500 | "table": "simple", | |
501 | "row": {}}]']], | |
502 | [['notifytest insert 2, notifytest set 1 b 1, notifytest delete 0']], | |
503 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
504 | 000: i=1 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> | |
505 | 001: commit, status=success, events=create|2|None, delete|0|None, update|1|b | |
506 | 002: i=1 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> | |
507 | 002: i=2 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3> | |
508 | 003: done | |
509 | ]]) | |
510 | ||
d18e52e3 BP |
511 | AT_SETUP([idl handling of missing tables and columns - C]) |
512 | AT_KEYWORDS([ovsdb server idl positive]) | |
d18e52e3 BP |
513 | |
514 | # idltest2.ovsschema is the same as idltest.ovsschema, except that | |
515 | # table link2 and column l2 have been deleted. But the IDL still | |
516 | # expects them to be there, so this test checks that it properly | |
517 | # tolerates them being missing. | |
518 | AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest2.ovsschema], | |
519 | [0], [stdout], [ignore]) | |
520 | 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]) | |
521 | AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 idl unix:socket ['["idltest", | |
522 | {"op": "insert", | |
523 | "table": "link1", | |
524 | "row": {"i": 0, "k": ["named-uuid", "self"]}, | |
525 | "uuid-name": "self"}]' \ | |
526 | '["idltest", | |
527 | {"op": "insert", | |
528 | "table": "link1", | |
529 | "row": {"i": 1, "k": ["named-uuid", "row2"]}, | |
530 | "uuid-name": "row1"}, | |
531 | {"op": "insert", | |
532 | "table": "link1", | |
533 | "row": {"i": 2, "k": ["named-uuid", "row1"]}, | |
534 | "uuid-name": "row2"}]' \ | |
535 | '["idltest", | |
536 | {"op": "update", | |
537 | "table": "link1", | |
538 | "where": [["i", "==", 1]], | |
539 | "row": {"k": ["uuid", "#1#"]}}]' \ | |
540 | '["idltest", | |
541 | {"op": "update", | |
542 | "table": "link1", | |
543 | "where": [], | |
544 | "row": {"k": ["uuid", "#0#"]}}]']], | |
545 | [0], [stdout], [stderr], [kill `cat pid`]) | |
546 | AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl], [0], | |
547 | [[000: empty | |
548 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]}]} | |
549 | 002: i=0 k=0 ka=[] l2= uuid=<0> | |
550 | 003: {"error":null,"result":[{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]}]} | |
551 | 004: i=0 k=0 ka=[] l2= uuid=<0> | |
552 | 004: i=1 k=2 ka=[] l2= uuid=<1> | |
553 | 004: i=2 k=1 ka=[] l2= uuid=<2> | |
554 | 005: {"error":null,"result":[{"count":1}]} | |
555 | 006: i=0 k=0 ka=[] l2= uuid=<0> | |
556 | 006: i=1 k=1 ka=[] l2= uuid=<1> | |
557 | 006: i=2 k=1 ka=[] l2= uuid=<2> | |
558 | 007: {"error":null,"result":[{"count":3}]} | |
559 | 008: i=0 k=0 ka=[] l2= uuid=<0> | |
560 | 008: i=1 k=0 ka=[] l2= uuid=<1> | |
561 | 008: i=2 k=0 ka=[] l2= uuid=<2> | |
562 | 009: done | |
563 | ]], [], [kill `cat pid`]) | |
564 | ||
565 | # Check that ovsdb-idl figured out that table link2 and column l2 are missing. | |
566 | AT_CHECK([grep ovsdb_idl stderr | sort], [0], [dnl | |
567 | test-ovsdb|ovsdb_idl|idltest database lacks link2 table (database needs upgrade?) | |
568 | test-ovsdb|ovsdb_idl|link1 table in idltest database lacks l2 column (database needs upgrade?) | |
569 | ]) | |
570 | ||
571 | # Check that ovsdb-idl sent on "monitor" request and that it didn't | |
572 | # mention that table or column, and (for paranoia) that it did mention another | |
573 | # table and column. | |
574 | AT_CHECK([grep -c '"monitor"' stderr], [0], [1 | |
575 | ]) | |
576 | AT_CHECK([grep '"monitor"' stderr | grep link2], [1]) | |
577 | AT_CHECK([grep '"monitor"' stderr | grep l2], [1]) | |
578 | AT_CHECK([grep '"monitor"' stderr | grep -c '"link1"'], [0], [1 | |
579 | ]) | |
580 | AT_CHECK([grep '"monitor"' stderr | grep -c '"ua"'], [0], [1 | |
581 | ]) | |
582 | OVSDB_SERVER_SHUTDOWN | |
583 | AT_CLEANUP |