]>
Commit | Line | Data |
---|---|---|
c3bb4bd7 BP |
1 | AT_BANNER([OVSDB -- interface description language (IDL)]) |
2 | ||
2c487bc8 | 3 | OVS_RUNDIR=`pwd`; export OVS_RUNDIR |
8cdf0349 BP |
4 | # OVSDB_CHECK_IDL_C(TITLE, [PRE-IDL-TXN], TRANSACTIONS, OUTPUT, [KEYWORDS], |
5 | # [FILTER]) | |
c3bb4bd7 BP |
6 | # |
7 | # Creates a database with a schema derived from idltest.ovsidl, runs | |
8 | # each PRE-IDL-TXN (if any), starts an ovsdb-server on that database, | |
9 | # and runs "test-ovsdb idl" passing each of the TRANSACTIONS along. | |
10 | # | |
11 | # Checks that the overall output is OUTPUT. Before comparison, the | |
12 | # output is sorted (using "sort") and UUIDs in the output are replaced | |
13 | # by markers of the form <N> where N is a number. The first unique | |
14 | # UUID is replaced by <0>, the next by <1>, and so on. If a given | |
15 | # UUID appears more than once it is always replaced by the same | |
254604d8 BP |
16 | # marker. If FILTER is supplied then the output is also filtered |
17 | # through the specified program. | |
c3bb4bd7 BP |
18 | # |
19 | # TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS. | |
8cdf0349 BP |
20 | m4_define([OVSDB_CHECK_IDL_C], |
21 | [AT_SETUP([$1 - C]) | |
c3bb4bd7 | 22 | AT_KEYWORDS([ovsdb server idl positive $5]) |
2c487bc8 | 23 | OVS_RUNDIR=`pwd`; export OVS_RUNDIR |
7c126fbb | 24 | AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema], |
00732bf5 | 25 | [0], [stdout], [ignore]) |
77a922c7 | 26 | 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 | 27 | m4_if([$2], [], [], |
028cbd99 | 28 | [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore], [kill `cat pid`])]) |
8cdf0349 | 29 | AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 idl unix:socket $3], |
028cbd99 | 30 | [0], [stdout], [ignore], [kill `cat pid`]) |
5c6d0628 | 31 | AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]), |
254604d8 | 32 | [0], [$4], [], [kill `cat pid`]) |
028cbd99 | 33 | OVSDB_SERVER_SHUTDOWN |
c3bb4bd7 BP |
34 | AT_CLEANUP]) |
35 | ||
8cdf0349 BP |
36 | # same as OVSDB_CHECK_IDL but uses the Python IDL implementation. |
37 | m4_define([OVSDB_CHECK_IDL_PY], | |
38 | [AT_SETUP([$1 - Python]) | |
39 | AT_SKIP_IF([test $HAVE_PYTHON = no]) | |
40 | AT_KEYWORDS([ovsdb server idl positive Python $5]) | |
2c487bc8 | 41 | OVS_RUNDIR=`pwd`; export OVS_RUNDIR |
8cdf0349 BP |
42 | AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema], |
43 | [0], [stdout], [ignore]) | |
77a922c7 | 44 | 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 |
45 | m4_if([$2], [], [], |
46 | [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore], [kill `cat pid`])]) | |
47 | AT_CHECK([$PYTHON $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket $3], | |
48 | [0], [stdout], [ignore], [kill `cat pid`]) | |
5c6d0628 | 49 | AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]), |
8cdf0349 BP |
50 | [0], [$4], [], [kill `cat pid`]) |
51 | OVSDB_SERVER_SHUTDOWN | |
52 | AT_CLEANUP]) | |
53 | ||
e06d06a7 IY |
54 | # same as OVSDB_CHECK_IDL but uses the Python IDL implementation with tcp |
55 | m4_define([OVSDB_CHECK_IDL_TCP_PY], | |
56 | [AT_SETUP([$1 - Python tcp]) | |
57 | AT_SKIP_IF([test $HAVE_PYTHON = no]) | |
58 | AT_KEYWORDS([ovsdb server idl positive Python with tcp socket $5]) | |
2c487bc8 | 59 | OVS_RUNDIR=`pwd`; export OVS_RUNDIR |
1e04fcc8 | 60 | OVS_LOGDIR=`pwd`; export OVS_LOGDIR |
e06d06a7 IY |
61 | AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema], |
62 | [0], [stdout], [ignore]) | |
1e04fcc8 BP |
63 | 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]) |
64 | TCP_PORT=`parse_listening_port < ovsdb-server.log` | |
65 | ||
e06d06a7 IY |
66 | m4_if([$2], [], [], |
67 | [AT_CHECK([ovsdb-client transact tcp:127.0.0.1:$TCP_PORT $2], [0], [ignore], [ignore], [kill `cat pid`])]) | |
68 | AT_CHECK([$PYTHON $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema tcp:127.0.0.1:$TCP_PORT $3], | |
69 | [0], [stdout], [ignore], [kill `cat pid`]) | |
5c6d0628 | 70 | AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]), |
e06d06a7 IY |
71 | [0], [$4], [], [kill `cat pid`]) |
72 | OVSDB_SERVER_SHUTDOWN | |
73 | AT_CLEANUP]) | |
74 | ||
8cdf0349 BP |
75 | m4_define([OVSDB_CHECK_IDL], |
76 | [OVSDB_CHECK_IDL_C($@) | |
e06d06a7 IY |
77 | OVSDB_CHECK_IDL_PY($@) |
78 | OVSDB_CHECK_IDL_TCP_PY($@)]) | |
8cdf0349 | 79 | |
c3bb4bd7 BP |
80 | OVSDB_CHECK_IDL([simple idl, initially empty, no ops], |
81 | [], | |
82 | [], | |
83 | [000: empty | |
84 | 001: done | |
85 | ]) | |
86 | ||
87 | OVSDB_CHECK_IDL([simple idl, initially empty, various ops], | |
88 | [], | |
9cb53f26 BP |
89 | [['["idltest", |
90 | {"op": "insert", | |
c3bb4bd7 BP |
91 | "table": "simple", |
92 | "row": {"i": 1, | |
93 | "r": 2.0, | |
94 | "b": true, | |
95 | "s": "mystring", | |
96 | "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"], | |
97 | "ia": ["set", [1, 2, 3]], | |
98 | "ra": ["set", [-0.5]], | |
7fae24e6 | 99 | "ba": ["set", [true]], |
8cdf0349 | 100 | "sa": ["set", ["abc", "def"]], |
c3bb4bd7 BP |
101 | "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"], |
102 | ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}}, | |
103 | {"op": "insert", | |
104 | "table": "simple", | |
105 | "row": {}}]' \ | |
9cb53f26 BP |
106 | '["idltest", |
107 | {"op": "update", | |
c3bb4bd7 BP |
108 | "table": "simple", |
109 | "where": [], | |
110 | "row": {"b": true}}]' \ | |
9cb53f26 BP |
111 | '["idltest", |
112 | {"op": "update", | |
c3bb4bd7 BP |
113 | "table": "simple", |
114 | "where": [], | |
115 | "row": {"r": 123.5}}]' \ | |
9cb53f26 BP |
116 | '["idltest", |
117 | {"op": "insert", | |
c3bb4bd7 BP |
118 | "table": "simple", |
119 | "row": {"i": -1, | |
120 | "r": 125, | |
121 | "b": false, | |
122 | "s": "", | |
123 | "ia": ["set", [1]], | |
124 | "ra": ["set", [1.5]], | |
125 | "ba": ["set", [false]], | |
8cdf0349 | 126 | "sa": ["set", []], |
c3bb4bd7 | 127 | "ua": ["set", []]}}]' \ |
9cb53f26 BP |
128 | '["idltest", |
129 | {"op": "update", | |
c3bb4bd7 BP |
130 | "table": "simple", |
131 | "where": [["i", "<", 1]], | |
132 | "row": {"s": "newstring"}}]' \ | |
9cb53f26 BP |
133 | '["idltest", |
134 | {"op": "delete", | |
c3bb4bd7 BP |
135 | "table": "simple", |
136 | "where": [["i", "==", 0]]}]' \ | |
137 | 'reconnect']], | |
138 | [[000: empty | |
139 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]} | |
140 | 002: i=0 r=0 b=false s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 141 | 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 |
142 | 003: {"error":null,"result":[{"count":2}]} |
143 | 004: i=0 r=0 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 144 | 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 |
145 | 005: {"error":null,"result":[{"count":2}]} |
146 | 006: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 147 | 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 |
148 | 007: {"error":null,"result":[{"uuid":["uuid","<6>"]}]} |
149 | 008: i=-1 r=125 b=false s= u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
150 | 008: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 151 | 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 |
152 | 009: {"error":null,"result":[{"count":2}]} |
153 | 010: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
154 | 010: i=0 r=123.5 b=true s=newstring u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 155 | 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 |
156 | 011: {"error":null,"result":[{"count":1}]} |
157 | 012: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
7fae24e6 | 158 | 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 |
159 | 013: reconnect |
160 | 014: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
7fae24e6 | 161 | 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 |
162 | 015: done |
163 | ]]) | |
164 | ||
165 | OVSDB_CHECK_IDL([simple idl, initially populated], | |
9cb53f26 BP |
166 | [['["idltest", |
167 | {"op": "insert", | |
c3bb4bd7 BP |
168 | "table": "simple", |
169 | "row": {"i": 1, | |
170 | "r": 2.0, | |
171 | "b": true, | |
172 | "s": "mystring", | |
173 | "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"], | |
174 | "ia": ["set", [1, 2, 3]], | |
175 | "ra": ["set", [-0.5]], | |
7fae24e6 | 176 | "ba": ["set", [true]], |
8cdf0349 | 177 | "sa": ["set", ["abc", "def"]], |
c3bb4bd7 BP |
178 | "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"], |
179 | ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}}, | |
180 | {"op": "insert", | |
181 | "table": "simple", | |
182 | "row": {}}]']], | |
9cb53f26 BP |
183 | [['["idltest", |
184 | {"op": "update", | |
c3bb4bd7 BP |
185 | "table": "simple", |
186 | "where": [], | |
187 | "row": {"b": true}}]']], | |
188 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 189 | 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 |
190 | 001: {"error":null,"result":[{"count":2}]} |
191 | 002: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 192 | 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 |
193 | 003: done |
194 | ]]) | |
195 | ||
475281c0 | 196 | OVSDB_CHECK_IDL([simple idl, writing via IDL], |
9cb53f26 BP |
197 | [['["idltest", |
198 | {"op": "insert", | |
475281c0 BP |
199 | "table": "simple", |
200 | "row": {"i": 1, | |
201 | "r": 2.0, | |
202 | "b": true, | |
203 | "s": "mystring", | |
204 | "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"], | |
205 | "ia": ["set", [1, 2, 3]], | |
206 | "ra": ["set", [-0.5]], | |
7fae24e6 | 207 | "ba": ["set", [true]], |
8cdf0349 | 208 | "sa": ["set", ["abc", "def"]], |
475281c0 BP |
209 | "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"], |
210 | ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}}, | |
211 | {"op": "insert", | |
212 | "table": "simple", | |
213 | "row": {}}]']], | |
a91c6104 BP |
214 | [['verify 0 b, verify 1 r, set 0 b 1, set 1 r 3.5' \ |
215 | 'insert 2, verify 2 i, verify 1 b, delete 1']], | |
475281c0 | 216 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> |
7fae24e6 | 217 | 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 |
218 | 001: commit, status=success |
219 | 002: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 220 | 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 |
221 | 003: commit, status=success |
222 | 004: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
223 | 004: i=2 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<6> | |
224 | 005: done | |
225 | ]]) | |
226 | ||
a91c6104 BP |
227 | OVSDB_CHECK_IDL([simple idl, handling verification failure], |
228 | [['["idltest", | |
229 | {"op": "insert", | |
230 | "table": "simple", | |
231 | "row": {"i": 1, | |
232 | "r": 2.0}}, | |
233 | {"op": "insert", | |
234 | "table": "simple", | |
235 | "row": {}}]']], | |
236 | [['set 0 b 1' \ | |
237 | '+["idltest", | |
238 | {"op": "update", | |
239 | "table": "simple", | |
240 | "where": [["i", "==", 1]], | |
241 | "row": {"r": 5.0}}]' \ | |
242 | '+verify 1 r, set 1 r 3' \ | |
243 | 'verify 1 r, set 1 r 3' \ | |
244 | ]], | |
245 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
246 | 000: i=1 r=2 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> | |
247 | 001: commit, status=success | |
248 | 002: {"error":null,"result":[{"count":1}]} | |
94fbe1aa | 249 | 003: commit, status=try again |
a91c6104 BP |
250 | 004: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> |
251 | 004: i=1 r=5 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> | |
252 | 005: commit, status=success | |
253 | 006: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
254 | 006: i=1 r=3 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> | |
255 | 007: done | |
256 | ]]) | |
257 | ||
b54e22e9 | 258 | OVSDB_CHECK_IDL([simple idl, increment operation], |
9cb53f26 BP |
259 | [['["idltest", |
260 | {"op": "insert", | |
b54e22e9 BP |
261 | "table": "simple", |
262 | "row": {}}]']], | |
94fbe1aa | 263 | [['set 0 r 2.0, increment 0']], |
b54e22e9 BP |
264 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> |
265 | 001: commit, status=success, increment=1 | |
266 | 002: i=1 r=2 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
267 | 003: done | |
268 | ]]) | |
269 | ||
2096903b BP |
270 | OVSDB_CHECK_IDL([simple idl, aborting], |
271 | [['["idltest", | |
272 | {"op": "insert", | |
273 | "table": "simple", | |
274 | "row": {}}]']], | |
275 | [['set 0 r 2.0, abort' \ | |
276 | '+set 0 b 1']], | |
277 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
278 | 001: commit, status=aborted | |
279 | 002: commit, status=success | |
280 | 003: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
281 | 004: done | |
282 | ]]) | |
283 | ||
284 | OVSDB_CHECK_IDL([simple idl, destroy without commit or abort], | |
285 | [['["idltest", | |
286 | {"op": "insert", | |
287 | "table": "simple", | |
288 | "row": {}}]']], | |
289 | [['set 0 r 2.0, destroy' \ | |
290 | '+set 0 b 1']], | |
291 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
292 | 001: destroy | |
293 | 002: commit, status=success | |
294 | 003: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
295 | 004: done | |
296 | ]]) | |
297 | ||
c3bb4bd7 BP |
298 | OVSDB_CHECK_IDL([self-linking idl, consistent ops], |
299 | [], | |
9cb53f26 BP |
300 | [['["idltest", |
301 | {"op": "insert", | |
e9011ac8 | 302 | "table": "link1", |
c3bb4bd7 BP |
303 | "row": {"i": 0, "k": ["named-uuid", "self"]}, |
304 | "uuid-name": "self"}]' \ | |
9cb53f26 BP |
305 | '["idltest", |
306 | {"op": "insert", | |
e9011ac8 | 307 | "table": "link1", |
2d2d6d4a | 308 | "row": {"i": 1, "k": ["named-uuid", "row2"]}, |
c3bb4bd7 BP |
309 | "uuid-name": "row1"}, |
310 | {"op": "insert", | |
e9011ac8 | 311 | "table": "link1", |
c3bb4bd7 | 312 | "row": {"i": 2, "k": ["named-uuid", "row1"]}, |
2d2d6d4a | 313 | "uuid-name": "row2"}]' \ |
9cb53f26 BP |
314 | '["idltest", |
315 | {"op": "update", | |
e9011ac8 | 316 | "table": "link1", |
c3bb4bd7 BP |
317 | "where": [["i", "==", 1]], |
318 | "row": {"k": ["uuid", "#1#"]}}]' \ | |
9cb53f26 BP |
319 | '["idltest", |
320 | {"op": "update", | |
e9011ac8 | 321 | "table": "link1", |
c3bb4bd7 BP |
322 | "where": [], |
323 | "row": {"k": ["uuid", "#0#"]}}]']], | |
324 | [[000: empty | |
325 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]}]} | |
e9011ac8 | 326 | 002: i=0 k=0 ka=[] l2= uuid=<0> |
fbf925e4 | 327 | 003: {"error":null,"result":[{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]}]} |
e9011ac8 BP |
328 | 004: i=0 k=0 ka=[] l2= uuid=<0> |
329 | 004: i=1 k=2 ka=[] l2= uuid=<1> | |
330 | 004: i=2 k=1 ka=[] l2= uuid=<2> | |
c3bb4bd7 | 331 | 005: {"error":null,"result":[{"count":1}]} |
e9011ac8 BP |
332 | 006: i=0 k=0 ka=[] l2= uuid=<0> |
333 | 006: i=1 k=1 ka=[] l2= uuid=<1> | |
334 | 006: i=2 k=1 ka=[] l2= uuid=<2> | |
c3bb4bd7 | 335 | 007: {"error":null,"result":[{"count":3}]} |
e9011ac8 BP |
336 | 008: i=0 k=0 ka=[] l2= uuid=<0> |
337 | 008: i=1 k=0 ka=[] l2= uuid=<1> | |
338 | 008: i=2 k=0 ka=[] l2= uuid=<2> | |
c3bb4bd7 BP |
339 | 009: done |
340 | ]]) | |
341 | ||
342 | OVSDB_CHECK_IDL([self-linking idl, inconsistent ops], | |
343 | [], | |
9cb53f26 BP |
344 | [['["idltest", |
345 | {"op": "insert", | |
e9011ac8 | 346 | "table": "link1", |
c3bb4bd7 | 347 | "row": {"i": 0, "k": ["uuid", "cf197cc5-c8c9-42f5-82d5-c71a9f2cb96b"]}}]' \ |
9cb53f26 BP |
348 | '+["idltest", |
349 | {"op": "insert", | |
e9011ac8 | 350 | "table": "link1", |
0d0f05b9 BP |
351 | "uuid-name": "one", |
352 | "row": {"i": 1, "k": ["named-uuid", "one"]}}, | |
353 | {"op": "insert", | |
354 | "table": "link1", | |
355 | "row": {"i": 2, "k": ["named-uuid", "one"]}}]' \ | |
9cb53f26 BP |
356 | '["idltest", |
357 | {"op": "update", | |
e9011ac8 | 358 | "table": "link1", |
c3bb4bd7 BP |
359 | "where": [], |
360 | "row": {"k": ["uuid", "c2fca39a-e69a-42a4-9c56-5eca85839ce9"]}}]' \ | |
9cb53f26 BP |
361 | '+["idltest", |
362 | {"op": "delete", | |
e9011ac8 | 363 | "table": "link1", |
0d0f05b9 | 364 | "where": [["_uuid", "==", ["uuid", "#1#"]]]}]' \ |
9cb53f26 BP |
365 | '+["idltest", |
366 | {"op": "delete", | |
e9011ac8 | 367 | "table": "link1", |
0d0f05b9 | 368 | "where": [["_uuid", "==", ["uuid", "#2#"]]]}]' \ |
9cb53f26 BP |
369 | '["idltest", |
370 | {"op": "delete", | |
0d0f05b9 BP |
371 | "table": "link1", |
372 | "where": []}]' \ | |
c3bb4bd7 BP |
373 | ]], |
374 | [[000: empty | |
97f7803b | 375 | 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 |
376 | 002: {"error":null,"result":[{"uuid":["uuid","<2>"]},{"uuid":["uuid","<3>"]}]} |
377 | 003: i=1 k=1 ka=[] l2= uuid=<2> | |
378 | 003: i=2 k=1 ka=[] l2= uuid=<3> | |
254604d8 | 379 | 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 |
380 | 005: {"error":null,"result":[{"count":1},{"details":"cannot delete link1 row <2> because of 1 remaining reference(s)","error":"referential integrity violation"}]} |
381 | 006: {"error":null,"result":[{"count":1}]} | |
382 | 007: i=1 k=1 ka=[] l2= uuid=<2> | |
383 | 008: {"error":null,"result":[{"count":1}]} | |
384 | 009: empty | |
385 | 010: done | |
254604d8 BP |
386 | ]], |
387 | [], | |
388 | [[sed -e '/004:/s/row <[23]> references/row <x> references/']]) | |
c3bb4bd7 BP |
389 | |
390 | OVSDB_CHECK_IDL([self-linking idl, sets], | |
391 | [], | |
9cb53f26 BP |
392 | [['["idltest", |
393 | {"op": "insert", | |
e9011ac8 | 394 | "table": "link1", |
0d0f05b9 | 395 | "row": {"i": 0, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i0"]]]}, |
c3bb4bd7 BP |
396 | "uuid-name": "i0"}, |
397 | {"op": "insert", | |
e9011ac8 | 398 | "table": "link1", |
0d0f05b9 | 399 | "row": {"i": 1, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i1"]]]}, |
c3bb4bd7 BP |
400 | "uuid-name": "i1"}, |
401 | {"op": "insert", | |
e9011ac8 | 402 | "table": "link1", |
0d0f05b9 | 403 | "row": {"i": 2, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i2"]]]}, |
c3bb4bd7 BP |
404 | "uuid-name": "i2"}, |
405 | {"op": "insert", | |
e9011ac8 | 406 | "table": "link1", |
0d0f05b9 | 407 | "row": {"i": 3, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i3"]]]}, |
c3bb4bd7 | 408 | "uuid-name": "i3"}]' \ |
9cb53f26 BP |
409 | '["idltest", |
410 | {"op": "update", | |
e9011ac8 | 411 | "table": "link1", |
c3bb4bd7 BP |
412 | "where": [], |
413 | "row": {"ka": ["set", [["uuid", "#0#"], ["uuid", "#1#"], ["uuid", "#2#"], ["uuid", "#3#"]]]}}]' \ | |
9cb53f26 BP |
414 | '["idltest", |
415 | {"op": "update", | |
e9011ac8 | 416 | "table": "link1", |
97f7803b BP |
417 | "where": [["i", "==", 2]], |
418 | "row": {"ka": ["set", [["uuid", "#0#"], ["uuid", "88702e78-845b-4a6e-ad08-cf68922ae84a"], ["uuid", "#2#"]]]}}]' \ | |
9cb53f26 BP |
419 | '+["idltest", |
420 | {"op": "delete", | |
0d0f05b9 BP |
421 | "table": "link1", |
422 | "where": []}]']], | |
c3bb4bd7 BP |
423 | [[000: empty |
424 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]},{"uuid":["uuid","<3>"]}]} | |
0d0f05b9 BP |
425 | 002: i=0 k=0 ka=[0] l2= uuid=<0> |
426 | 002: i=1 k=0 ka=[1] l2= uuid=<1> | |
427 | 002: i=2 k=0 ka=[2] l2= uuid=<2> | |
428 | 002: i=3 k=0 ka=[3] l2= uuid=<3> | |
c3bb4bd7 | 429 | 003: {"error":null,"result":[{"count":4}]} |
0d0f05b9 BP |
430 | 004: i=0 k=0 ka=[0 1 2 3] l2= uuid=<0> |
431 | 004: i=1 k=0 ka=[0 1 2 3] l2= uuid=<1> | |
432 | 004: i=2 k=0 ka=[0 1 2 3] l2= uuid=<2> | |
433 | 004: i=3 k=0 ka=[0 1 2 3] l2= uuid=<3> | |
97f7803b | 434 | 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 |
435 | 006: {"error":null,"result":[{"count":4}]} |
436 | 007: empty | |
437 | 008: done | |
c3bb4bd7 BP |
438 | ]]) |
439 | ||
e9011ac8 BP |
440 | OVSDB_CHECK_IDL([external-linking idl, consistent ops], |
441 | [], | |
9cb53f26 BP |
442 | [['["idltest", |
443 | {"op": "insert", | |
e9011ac8 BP |
444 | "table": "link2", |
445 | "row": {"i": 0}, | |
446 | "uuid-name": "row0"}, | |
447 | {"op": "insert", | |
448 | "table": "link1", | |
0d0f05b9 | 449 | "row": {"i": 1, "k": ["named-uuid", "row1"], "l2": ["set", [["named-uuid", "row0"]]]}, |
e9011ac8 BP |
450 | "uuid-name": "row1"}]']], |
451 | [[000: empty | |
452 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]} | |
453 | 002: i=0 l1= uuid=<0> | |
0d0f05b9 | 454 | 002: i=1 k=1 ka=[] l2=0 uuid=<1> |
e9011ac8 BP |
455 | 003: done |
456 | ]]) | |
225b582a IY |
457 | |
458 | OVSDB_CHECK_IDL_PY([external-linking idl, insert ops], | |
459 | [], | |
460 | [['linktest']], | |
461 | [[000: empty | |
462 | 001: commit, status=success | |
463 | 002: i=1 k=1 ka=[1] l2= uuid=<0> | |
464 | 002: i=2 k=1 ka=[1 2] l2= uuid=<1> | |
465 | 003: done | |
466 | ]]) | |
3b4c362f IY |
467 | |
468 | OVSDB_CHECK_IDL_PY([getattr idl, insert ops], | |
469 | [], | |
470 | [['getattrtest']], | |
471 | [[000: empty | |
472 | 001: commit, status=success | |
473 | 002: i=2 k=2 ka=[] l2= uuid=<0> | |
474 | 003: done | |
475 | ]]) |