]>
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 | 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]) |
b52ecd96 | 64 | TCP_PORT=`parse_listening_port < ovsdb-server.log` |
1e04fcc8 | 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 | ||
e731d71b AS |
75 | # same as OVSDB_CHECK_IDL but uses the Python IDL implementation with tcp6 |
76 | m4_define([OVSDB_CHECK_IDL_TCP6_PY], | |
77 | [AT_SETUP([$1 - Python tcp6]) | |
78 | AT_SKIP_IF([test $HAVE_PYTHON = no]) | |
79 | AT_KEYWORDS([ovsdb server idl positive Python with tcp6 socket $5]) | |
80 | OVS_RUNDIR=`pwd`; export OVS_RUNDIR | |
81 | OVS_LOGDIR=`pwd`; export OVS_LOGDIR | |
82 | AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema], | |
83 | [0], [stdout], [ignore]) | |
84 | 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 | 85 | TCP_PORT=`parse_listening_port < ovsdb-server.log` |
e731d71b AS |
86 | echo "TCP_PORT=$TCP_PORT" |
87 | ||
88 | m4_if([$2], [], [], | |
89 | [AT_CHECK([ovsdb-client transact "tcp:[[::1]]:$TCP_PORT" $2], [0], [ignore], [ignore], [kill `cat pid`])]) | |
a0df641d | 90 | AT_CHECK([$PYTHON $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema tcp:[[::1]]:$TCP_PORT $3], |
e731d71b AS |
91 | [0], [stdout], [ignore], [kill `cat pid`]) |
92 | AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]), | |
93 | [0], [$4], [], [kill `cat pid`]) | |
94 | OVSDB_SERVER_SHUTDOWN | |
95 | AT_CLEANUP]) | |
96 | ||
8cdf0349 BP |
97 | m4_define([OVSDB_CHECK_IDL], |
98 | [OVSDB_CHECK_IDL_C($@) | |
e06d06a7 | 99 | OVSDB_CHECK_IDL_PY($@) |
e731d71b AS |
100 | OVSDB_CHECK_IDL_TCP_PY($@) |
101 | OVSDB_CHECK_IDL_TCP6_PY($@)]) | |
8cdf0349 | 102 | |
c3bb4bd7 BP |
103 | OVSDB_CHECK_IDL([simple idl, initially empty, no ops], |
104 | [], | |
105 | [], | |
106 | [000: empty | |
107 | 001: done | |
108 | ]) | |
109 | ||
110 | OVSDB_CHECK_IDL([simple idl, initially empty, various ops], | |
111 | [], | |
9cb53f26 BP |
112 | [['["idltest", |
113 | {"op": "insert", | |
c3bb4bd7 BP |
114 | "table": "simple", |
115 | "row": {"i": 1, | |
116 | "r": 2.0, | |
117 | "b": true, | |
118 | "s": "mystring", | |
119 | "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"], | |
120 | "ia": ["set", [1, 2, 3]], | |
121 | "ra": ["set", [-0.5]], | |
7fae24e6 | 122 | "ba": ["set", [true]], |
8cdf0349 | 123 | "sa": ["set", ["abc", "def"]], |
c3bb4bd7 BP |
124 | "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"], |
125 | ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}}, | |
126 | {"op": "insert", | |
127 | "table": "simple", | |
128 | "row": {}}]' \ | |
9cb53f26 BP |
129 | '["idltest", |
130 | {"op": "update", | |
c3bb4bd7 BP |
131 | "table": "simple", |
132 | "where": [], | |
133 | "row": {"b": true}}]' \ | |
9cb53f26 BP |
134 | '["idltest", |
135 | {"op": "update", | |
c3bb4bd7 BP |
136 | "table": "simple", |
137 | "where": [], | |
138 | "row": {"r": 123.5}}]' \ | |
9cb53f26 BP |
139 | '["idltest", |
140 | {"op": "insert", | |
c3bb4bd7 BP |
141 | "table": "simple", |
142 | "row": {"i": -1, | |
143 | "r": 125, | |
144 | "b": false, | |
145 | "s": "", | |
146 | "ia": ["set", [1]], | |
147 | "ra": ["set", [1.5]], | |
148 | "ba": ["set", [false]], | |
8cdf0349 | 149 | "sa": ["set", []], |
c3bb4bd7 | 150 | "ua": ["set", []]}}]' \ |
9cb53f26 BP |
151 | '["idltest", |
152 | {"op": "update", | |
c3bb4bd7 BP |
153 | "table": "simple", |
154 | "where": [["i", "<", 1]], | |
155 | "row": {"s": "newstring"}}]' \ | |
9cb53f26 BP |
156 | '["idltest", |
157 | {"op": "delete", | |
c3bb4bd7 BP |
158 | "table": "simple", |
159 | "where": [["i", "==", 0]]}]' \ | |
160 | 'reconnect']], | |
161 | [[000: empty | |
162 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]} | |
163 | 002: i=0 r=0 b=false s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 164 | 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 |
165 | 003: {"error":null,"result":[{"count":2}]} |
166 | 004: i=0 r=0 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 167 | 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 |
168 | 005: {"error":null,"result":[{"count":2}]} |
169 | 006: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 170 | 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 |
171 | 007: {"error":null,"result":[{"uuid":["uuid","<6>"]}]} |
172 | 008: i=-1 r=125 b=false s= u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
173 | 008: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 174 | 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 |
175 | 009: {"error":null,"result":[{"count":2}]} |
176 | 010: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
177 | 010: i=0 r=123.5 b=true s=newstring u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 178 | 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 |
179 | 011: {"error":null,"result":[{"count":1}]} |
180 | 012: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
7fae24e6 | 181 | 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 |
182 | 013: reconnect |
183 | 014: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
7fae24e6 | 184 | 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 |
185 | 015: done |
186 | ]]) | |
187 | ||
188 | OVSDB_CHECK_IDL([simple idl, initially populated], | |
9cb53f26 BP |
189 | [['["idltest", |
190 | {"op": "insert", | |
c3bb4bd7 BP |
191 | "table": "simple", |
192 | "row": {"i": 1, | |
193 | "r": 2.0, | |
194 | "b": true, | |
195 | "s": "mystring", | |
196 | "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"], | |
197 | "ia": ["set", [1, 2, 3]], | |
198 | "ra": ["set", [-0.5]], | |
7fae24e6 | 199 | "ba": ["set", [true]], |
8cdf0349 | 200 | "sa": ["set", ["abc", "def"]], |
c3bb4bd7 BP |
201 | "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"], |
202 | ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}}, | |
203 | {"op": "insert", | |
204 | "table": "simple", | |
205 | "row": {}}]']], | |
9cb53f26 BP |
206 | [['["idltest", |
207 | {"op": "update", | |
c3bb4bd7 BP |
208 | "table": "simple", |
209 | "where": [], | |
210 | "row": {"b": true}}]']], | |
211 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 212 | 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 |
213 | 001: {"error":null,"result":[{"count":2}]} |
214 | 002: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 215 | 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 |
216 | 003: done |
217 | ]]) | |
218 | ||
475281c0 | 219 | OVSDB_CHECK_IDL([simple idl, writing via IDL], |
9cb53f26 BP |
220 | [['["idltest", |
221 | {"op": "insert", | |
475281c0 BP |
222 | "table": "simple", |
223 | "row": {"i": 1, | |
224 | "r": 2.0, | |
225 | "b": true, | |
226 | "s": "mystring", | |
227 | "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"], | |
228 | "ia": ["set", [1, 2, 3]], | |
229 | "ra": ["set", [-0.5]], | |
7fae24e6 | 230 | "ba": ["set", [true]], |
8cdf0349 | 231 | "sa": ["set", ["abc", "def"]], |
475281c0 BP |
232 | "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"], |
233 | ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}}, | |
234 | {"op": "insert", | |
235 | "table": "simple", | |
236 | "row": {}}]']], | |
a91c6104 BP |
237 | [['verify 0 b, verify 1 r, set 0 b 1, set 1 r 3.5' \ |
238 | 'insert 2, verify 2 i, verify 1 b, delete 1']], | |
475281c0 | 239 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> |
7fae24e6 | 240 | 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 |
241 | 001: commit, status=success |
242 | 002: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 243 | 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 |
244 | 003: commit, status=success |
245 | 004: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
246 | 004: i=2 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<6> | |
247 | 005: done | |
248 | ]]) | |
249 | ||
a91c6104 BP |
250 | OVSDB_CHECK_IDL([simple idl, handling verification failure], |
251 | [['["idltest", | |
252 | {"op": "insert", | |
253 | "table": "simple", | |
254 | "row": {"i": 1, | |
255 | "r": 2.0}}, | |
256 | {"op": "insert", | |
257 | "table": "simple", | |
258 | "row": {}}]']], | |
259 | [['set 0 b 1' \ | |
260 | '+["idltest", | |
261 | {"op": "update", | |
262 | "table": "simple", | |
263 | "where": [["i", "==", 1]], | |
264 | "row": {"r": 5.0}}]' \ | |
265 | '+verify 1 r, set 1 r 3' \ | |
266 | 'verify 1 r, set 1 r 3' \ | |
267 | ]], | |
268 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
269 | 000: i=1 r=2 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> | |
270 | 001: commit, status=success | |
271 | 002: {"error":null,"result":[{"count":1}]} | |
94fbe1aa | 272 | 003: commit, status=try again |
a91c6104 BP |
273 | 004: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> |
274 | 004: i=1 r=5 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> | |
275 | 005: commit, status=success | |
276 | 006: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
277 | 006: i=1 r=3 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> | |
278 | 007: done | |
279 | ]]) | |
280 | ||
b54e22e9 | 281 | OVSDB_CHECK_IDL([simple idl, increment operation], |
9cb53f26 BP |
282 | [['["idltest", |
283 | {"op": "insert", | |
b54e22e9 BP |
284 | "table": "simple", |
285 | "row": {}}]']], | |
94fbe1aa | 286 | [['set 0 r 2.0, increment 0']], |
b54e22e9 BP |
287 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> |
288 | 001: commit, status=success, increment=1 | |
289 | 002: i=1 r=2 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
290 | 003: done | |
291 | ]]) | |
292 | ||
2096903b BP |
293 | OVSDB_CHECK_IDL([simple idl, aborting], |
294 | [['["idltest", | |
295 | {"op": "insert", | |
296 | "table": "simple", | |
297 | "row": {}}]']], | |
298 | [['set 0 r 2.0, abort' \ | |
299 | '+set 0 b 1']], | |
300 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
301 | 001: commit, status=aborted | |
302 | 002: commit, status=success | |
303 | 003: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
304 | 004: done | |
305 | ]]) | |
306 | ||
307 | OVSDB_CHECK_IDL([simple idl, destroy without commit or abort], | |
308 | [['["idltest", | |
309 | {"op": "insert", | |
310 | "table": "simple", | |
311 | "row": {}}]']], | |
312 | [['set 0 r 2.0, destroy' \ | |
313 | '+set 0 b 1']], | |
314 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
315 | 001: destroy | |
316 | 002: commit, status=success | |
317 | 003: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
318 | 004: done | |
319 | ]]) | |
320 | ||
c3bb4bd7 BP |
321 | OVSDB_CHECK_IDL([self-linking idl, consistent ops], |
322 | [], | |
9cb53f26 BP |
323 | [['["idltest", |
324 | {"op": "insert", | |
e9011ac8 | 325 | "table": "link1", |
c3bb4bd7 BP |
326 | "row": {"i": 0, "k": ["named-uuid", "self"]}, |
327 | "uuid-name": "self"}]' \ | |
9cb53f26 BP |
328 | '["idltest", |
329 | {"op": "insert", | |
e9011ac8 | 330 | "table": "link1", |
2d2d6d4a | 331 | "row": {"i": 1, "k": ["named-uuid", "row2"]}, |
c3bb4bd7 BP |
332 | "uuid-name": "row1"}, |
333 | {"op": "insert", | |
e9011ac8 | 334 | "table": "link1", |
c3bb4bd7 | 335 | "row": {"i": 2, "k": ["named-uuid", "row1"]}, |
2d2d6d4a | 336 | "uuid-name": "row2"}]' \ |
9cb53f26 BP |
337 | '["idltest", |
338 | {"op": "update", | |
e9011ac8 | 339 | "table": "link1", |
c3bb4bd7 BP |
340 | "where": [["i", "==", 1]], |
341 | "row": {"k": ["uuid", "#1#"]}}]' \ | |
9cb53f26 BP |
342 | '["idltest", |
343 | {"op": "update", | |
e9011ac8 | 344 | "table": "link1", |
c3bb4bd7 BP |
345 | "where": [], |
346 | "row": {"k": ["uuid", "#0#"]}}]']], | |
347 | [[000: empty | |
348 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]}]} | |
e9011ac8 | 349 | 002: i=0 k=0 ka=[] l2= uuid=<0> |
fbf925e4 | 350 | 003: {"error":null,"result":[{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]}]} |
e9011ac8 BP |
351 | 004: i=0 k=0 ka=[] l2= uuid=<0> |
352 | 004: i=1 k=2 ka=[] l2= uuid=<1> | |
353 | 004: i=2 k=1 ka=[] l2= uuid=<2> | |
c3bb4bd7 | 354 | 005: {"error":null,"result":[{"count":1}]} |
e9011ac8 BP |
355 | 006: i=0 k=0 ka=[] l2= uuid=<0> |
356 | 006: i=1 k=1 ka=[] l2= uuid=<1> | |
357 | 006: i=2 k=1 ka=[] l2= uuid=<2> | |
c3bb4bd7 | 358 | 007: {"error":null,"result":[{"count":3}]} |
e9011ac8 BP |
359 | 008: i=0 k=0 ka=[] l2= uuid=<0> |
360 | 008: i=1 k=0 ka=[] l2= uuid=<1> | |
361 | 008: i=2 k=0 ka=[] l2= uuid=<2> | |
c3bb4bd7 BP |
362 | 009: done |
363 | ]]) | |
364 | ||
365 | OVSDB_CHECK_IDL([self-linking idl, inconsistent ops], | |
366 | [], | |
9cb53f26 BP |
367 | [['["idltest", |
368 | {"op": "insert", | |
e9011ac8 | 369 | "table": "link1", |
c3bb4bd7 | 370 | "row": {"i": 0, "k": ["uuid", "cf197cc5-c8c9-42f5-82d5-c71a9f2cb96b"]}}]' \ |
9cb53f26 BP |
371 | '+["idltest", |
372 | {"op": "insert", | |
e9011ac8 | 373 | "table": "link1", |
0d0f05b9 BP |
374 | "uuid-name": "one", |
375 | "row": {"i": 1, "k": ["named-uuid", "one"]}}, | |
376 | {"op": "insert", | |
377 | "table": "link1", | |
378 | "row": {"i": 2, "k": ["named-uuid", "one"]}}]' \ | |
9cb53f26 BP |
379 | '["idltest", |
380 | {"op": "update", | |
e9011ac8 | 381 | "table": "link1", |
c3bb4bd7 BP |
382 | "where": [], |
383 | "row": {"k": ["uuid", "c2fca39a-e69a-42a4-9c56-5eca85839ce9"]}}]' \ | |
9cb53f26 BP |
384 | '+["idltest", |
385 | {"op": "delete", | |
e9011ac8 | 386 | "table": "link1", |
0d0f05b9 | 387 | "where": [["_uuid", "==", ["uuid", "#1#"]]]}]' \ |
9cb53f26 BP |
388 | '+["idltest", |
389 | {"op": "delete", | |
e9011ac8 | 390 | "table": "link1", |
0d0f05b9 | 391 | "where": [["_uuid", "==", ["uuid", "#2#"]]]}]' \ |
9cb53f26 BP |
392 | '["idltest", |
393 | {"op": "delete", | |
0d0f05b9 BP |
394 | "table": "link1", |
395 | "where": []}]' \ | |
c3bb4bd7 BP |
396 | ]], |
397 | [[000: empty | |
97f7803b | 398 | 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 |
399 | 002: {"error":null,"result":[{"uuid":["uuid","<2>"]},{"uuid":["uuid","<3>"]}]} |
400 | 003: i=1 k=1 ka=[] l2= uuid=<2> | |
401 | 003: i=2 k=1 ka=[] l2= uuid=<3> | |
254604d8 | 402 | 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 |
403 | 005: {"error":null,"result":[{"count":1},{"details":"cannot delete link1 row <2> because of 1 remaining reference(s)","error":"referential integrity violation"}]} |
404 | 006: {"error":null,"result":[{"count":1}]} | |
405 | 007: i=1 k=1 ka=[] l2= uuid=<2> | |
406 | 008: {"error":null,"result":[{"count":1}]} | |
407 | 009: empty | |
408 | 010: done | |
254604d8 BP |
409 | ]], |
410 | [], | |
411 | [[sed -e '/004:/s/row <[23]> references/row <x> references/']]) | |
c3bb4bd7 BP |
412 | |
413 | OVSDB_CHECK_IDL([self-linking idl, sets], | |
414 | [], | |
9cb53f26 BP |
415 | [['["idltest", |
416 | {"op": "insert", | |
e9011ac8 | 417 | "table": "link1", |
0d0f05b9 | 418 | "row": {"i": 0, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i0"]]]}, |
c3bb4bd7 BP |
419 | "uuid-name": "i0"}, |
420 | {"op": "insert", | |
e9011ac8 | 421 | "table": "link1", |
0d0f05b9 | 422 | "row": {"i": 1, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i1"]]]}, |
c3bb4bd7 BP |
423 | "uuid-name": "i1"}, |
424 | {"op": "insert", | |
e9011ac8 | 425 | "table": "link1", |
0d0f05b9 | 426 | "row": {"i": 2, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i2"]]]}, |
c3bb4bd7 BP |
427 | "uuid-name": "i2"}, |
428 | {"op": "insert", | |
e9011ac8 | 429 | "table": "link1", |
0d0f05b9 | 430 | "row": {"i": 3, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i3"]]]}, |
c3bb4bd7 | 431 | "uuid-name": "i3"}]' \ |
9cb53f26 BP |
432 | '["idltest", |
433 | {"op": "update", | |
e9011ac8 | 434 | "table": "link1", |
c3bb4bd7 BP |
435 | "where": [], |
436 | "row": {"ka": ["set", [["uuid", "#0#"], ["uuid", "#1#"], ["uuid", "#2#"], ["uuid", "#3#"]]]}}]' \ | |
9cb53f26 BP |
437 | '["idltest", |
438 | {"op": "update", | |
e9011ac8 | 439 | "table": "link1", |
97f7803b BP |
440 | "where": [["i", "==", 2]], |
441 | "row": {"ka": ["set", [["uuid", "#0#"], ["uuid", "88702e78-845b-4a6e-ad08-cf68922ae84a"], ["uuid", "#2#"]]]}}]' \ | |
9cb53f26 BP |
442 | '+["idltest", |
443 | {"op": "delete", | |
0d0f05b9 BP |
444 | "table": "link1", |
445 | "where": []}]']], | |
c3bb4bd7 BP |
446 | [[000: empty |
447 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]},{"uuid":["uuid","<3>"]}]} | |
0d0f05b9 BP |
448 | 002: i=0 k=0 ka=[0] l2= uuid=<0> |
449 | 002: i=1 k=0 ka=[1] l2= uuid=<1> | |
450 | 002: i=2 k=0 ka=[2] l2= uuid=<2> | |
451 | 002: i=3 k=0 ka=[3] l2= uuid=<3> | |
c3bb4bd7 | 452 | 003: {"error":null,"result":[{"count":4}]} |
0d0f05b9 BP |
453 | 004: i=0 k=0 ka=[0 1 2 3] l2= uuid=<0> |
454 | 004: i=1 k=0 ka=[0 1 2 3] l2= uuid=<1> | |
455 | 004: i=2 k=0 ka=[0 1 2 3] l2= uuid=<2> | |
456 | 004: i=3 k=0 ka=[0 1 2 3] l2= uuid=<3> | |
97f7803b | 457 | 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 |
458 | 006: {"error":null,"result":[{"count":4}]} |
459 | 007: empty | |
460 | 008: done | |
c3bb4bd7 BP |
461 | ]]) |
462 | ||
e9011ac8 BP |
463 | OVSDB_CHECK_IDL([external-linking idl, consistent ops], |
464 | [], | |
9cb53f26 BP |
465 | [['["idltest", |
466 | {"op": "insert", | |
e9011ac8 BP |
467 | "table": "link2", |
468 | "row": {"i": 0}, | |
469 | "uuid-name": "row0"}, | |
470 | {"op": "insert", | |
471 | "table": "link1", | |
0d0f05b9 | 472 | "row": {"i": 1, "k": ["named-uuid", "row1"], "l2": ["set", [["named-uuid", "row0"]]]}, |
e9011ac8 BP |
473 | "uuid-name": "row1"}]']], |
474 | [[000: empty | |
475 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]} | |
476 | 002: i=0 l1= uuid=<0> | |
0d0f05b9 | 477 | 002: i=1 k=1 ka=[] l2=0 uuid=<1> |
e9011ac8 BP |
478 | 003: done |
479 | ]]) | |
225b582a IY |
480 | |
481 | OVSDB_CHECK_IDL_PY([external-linking idl, insert ops], | |
482 | [], | |
483 | [['linktest']], | |
484 | [[000: empty | |
485 | 001: commit, status=success | |
486 | 002: i=1 k=1 ka=[1] l2= uuid=<0> | |
487 | 002: i=2 k=1 ka=[1 2] l2= uuid=<1> | |
488 | 003: done | |
489 | ]]) | |
3b4c362f IY |
490 | |
491 | OVSDB_CHECK_IDL_PY([getattr idl, insert ops], | |
492 | [], | |
493 | [['getattrtest']], | |
494 | [[000: empty | |
495 | 001: commit, status=success | |
496 | 002: i=2 k=2 ka=[] l2= uuid=<0> | |
497 | 003: done | |
498 | ]]) |