]>
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]) |
8a16ab90 LR |
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`' | |
c3bb4bd7 | 26 | m4_if([$2], [], [], |
7427f2a4 | 27 | [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])]) |
8cdf0349 | 28 | AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 idl unix:socket $3], |
7427f2a4 | 29 | [0], [stdout], [ignore]) |
5c6d0628 | 30 | AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]), |
7427f2a4 | 31 | [0], [$4]) |
028cbd99 | 32 | OVSDB_SERVER_SHUTDOWN |
c3bb4bd7 BP |
33 | AT_CLEANUP]) |
34 | ||
8cdf0349 | 35 | # same as OVSDB_CHECK_IDL but uses the Python IDL implementation. |
963f66b5 RB |
36 | m4_define([OVSDB_CHECK_IDL_PYN], |
37 | [AT_SETUP([$1]) | |
38 | AT_SKIP_IF([test $7 = no]) | |
8cdf0349 BP |
39 | AT_KEYWORDS([ovsdb server idl positive Python $5]) |
40 | AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema], | |
41 | [0], [stdout], [ignore]) | |
8a16ab90 LR |
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`' | |
8cdf0349 | 44 | m4_if([$2], [], [], |
7427f2a4 | 45 | [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])]) |
963f66b5 | 46 | AT_CHECK([$8 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket $3], |
7427f2a4 | 47 | [0], [stdout], [ignore]) |
5c6d0628 | 48 | AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]), |
7427f2a4 | 49 | [0], [$4]) |
8cdf0349 BP |
50 | OVSDB_SERVER_SHUTDOWN |
51 | AT_CLEANUP]) | |
52 | ||
963f66b5 RB |
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]) | |
01dc1516 SA |
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]) | |
8a16ab90 LR |
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`' | |
01dc1516 | 67 | m4_if([$2], [], [], |
7427f2a4 | 68 | [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])]) |
963f66b5 | 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], |
7427f2a4 | 70 | [0], [stdout], [ignore]) |
01dc1516 | 71 | AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]), |
7427f2a4 | 72 | [0], [$4]) |
01dc1516 SA |
73 | OVSDB_SERVER_SHUTDOWN |
74 | AT_CLEANUP]) | |
75 | ||
963f66b5 RB |
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 | ||
e06d06a7 | 82 | # same as OVSDB_CHECK_IDL but uses the Python IDL implementation with tcp |
963f66b5 RB |
83 | m4_define([OVSDB_CHECK_IDL_TCP_PYN], |
84 | [AT_SETUP([$1 - tcp]) | |
85 | AT_SKIP_IF([test $7 = no]) | |
e06d06a7 IY |
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]) | |
8a16ab90 LR |
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`' | |
fb28ef2d | 91 | PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT]) |
1e04fcc8 | 92 | |
e06d06a7 | 93 | m4_if([$2], [], [], |
7427f2a4 | 94 | [AT_CHECK([ovsdb-client transact tcp:127.0.0.1:$TCP_PORT $2], [0], [ignore], [ignore])]) |
963f66b5 | 95 | AT_CHECK([$8 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema tcp:127.0.0.1:$TCP_PORT $3], |
7427f2a4 | 96 | [0], [stdout], [ignore]) |
5c6d0628 | 97 | AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]), |
7427f2a4 | 98 | [0], [$4]) |
e06d06a7 IY |
99 | OVSDB_SERVER_SHUTDOWN |
100 | AT_CLEANUP]) | |
101 | ||
963f66b5 RB |
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 | ||
e731d71b | 108 | # same as OVSDB_CHECK_IDL but uses the Python IDL implementation with tcp6 |
963f66b5 RB |
109 | m4_define([OVSDB_CHECK_IDL_TCP6_PYN], |
110 | [AT_SETUP([$1 - tcp6]) | |
111 | AT_SKIP_IF([test $7 = no]) | |
4819b3a5 | 112 | AT_SKIP_IF([test $HAVE_IPV6 = no]) |
e731d71b | 113 | AT_KEYWORDS([ovsdb server idl positive Python with tcp6 socket $5]) |
e731d71b AS |
114 | AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema], |
115 | [0], [stdout], [ignore]) | |
8a16ab90 LR |
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`' | |
fb28ef2d | 118 | PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT]) |
e731d71b AS |
119 | echo "TCP_PORT=$TCP_PORT" |
120 | ||
121 | m4_if([$2], [], [], | |
7427f2a4 | 122 | [AT_CHECK([ovsdb-client transact "tcp:[[::1]]:$TCP_PORT" $2], [0], [ignore], [ignore])]) |
963f66b5 | 123 | AT_CHECK([$8 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema tcp:[[::1]]:$TCP_PORT $3], |
7427f2a4 | 124 | [0], [stdout], [ignore]) |
e731d71b | 125 | AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]), |
7427f2a4 | 126 | [0], [$4]) |
e731d71b AS |
127 | OVSDB_SERVER_SHUTDOWN |
128 | AT_CLEANUP]) | |
129 | ||
963f66b5 RB |
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 | ||
8cdf0349 BP |
136 | m4_define([OVSDB_CHECK_IDL], |
137 | [OVSDB_CHECK_IDL_C($@) | |
e06d06a7 | 138 | OVSDB_CHECK_IDL_PY($@) |
01dc1516 | 139 | OVSDB_CHECK_IDL_REGISTER_COLUMNS_PY($@) |
e731d71b AS |
140 | OVSDB_CHECK_IDL_TCP_PY($@) |
141 | OVSDB_CHECK_IDL_TCP6_PY($@)]) | |
8cdf0349 | 142 | |
af358237 OBY |
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 | |
8a16ab90 LR |
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`' | |
af358237 | 153 | PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT]) |
7427f2a4 | 154 | OVSDB_SERVER_SHUTDOWN |
af358237 OBY |
155 | |
156 | # start OVSDB server in passive mode | |
8a16ab90 | 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]) |
af358237 | 158 | AT_CHECK([$PYTHON $srcdir/test-ovsdb.py -t10 idl_passive $srcdir/idltest.ovsschema ptcp:127.0.0.1:$TCP_PORT $3], |
7427f2a4 | 159 | [0], [stdout], [ignore]) |
af358237 | 160 | AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]), |
7427f2a4 DDP |
161 | [0], [$4]) |
162 | OVSDB_SERVER_SHUTDOWN | |
af358237 OBY |
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 | ||
c3bb4bd7 BP |
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 | [], | |
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}}]' \ | |
9cb53f26 BP |
205 | '["idltest", |
206 | {"op": "update", | |
c3bb4bd7 BP |
207 | "table": "simple", |
208 | "where": [], | |
209 | "row": {"r": 123.5}}]' \ | |
9cb53f26 BP |
210 | '["idltest", |
211 | {"op": "insert", | |
c3bb4bd7 BP |
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]], | |
8cdf0349 | 220 | "sa": ["set", []], |
c3bb4bd7 | 221 | "ua": ["set", []]}}]' \ |
9cb53f26 BP |
222 | '["idltest", |
223 | {"op": "update", | |
c3bb4bd7 BP |
224 | "table": "simple", |
225 | "where": [["i", "<", 1]], | |
226 | "row": {"s": "newstring"}}]' \ | |
9cb53f26 BP |
227 | '["idltest", |
228 | {"op": "delete", | |
c3bb4bd7 BP |
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> | |
7fae24e6 | 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> |
c3bb4bd7 BP |
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> | |
7fae24e6 | 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> |
c3bb4bd7 BP |
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> | |
7fae24e6 | 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> |
c3bb4bd7 BP |
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> | |
7fae24e6 | 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> |
c3bb4bd7 BP |
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> | |
7fae24e6 | 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> |
c3bb4bd7 BP |
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> | |
7fae24e6 | 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> |
c3bb4bd7 BP |
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> | |
7fae24e6 | 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> |
c3bb4bd7 BP |
256 | 015: done |
257 | ]]) | |
258 | ||
259 | OVSDB_CHECK_IDL([simple idl, initially populated], | |
9cb53f26 BP |
260 | [['["idltest", |
261 | {"op": "insert", | |
c3bb4bd7 BP |
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]], | |
7fae24e6 | 270 | "ba": ["set", [true]], |
8cdf0349 | 271 | "sa": ["set", ["abc", "def"]], |
c3bb4bd7 BP |
272 | "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"], |
273 | ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}}, | |
274 | {"op": "insert", | |
275 | "table": "simple", | |
276 | "row": {}}]']], | |
9cb53f26 BP |
277 | [['["idltest", |
278 | {"op": "update", | |
c3bb4bd7 BP |
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> | |
7fae24e6 | 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> |
c3bb4bd7 BP |
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> | |
7fae24e6 | 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> |
c3bb4bd7 BP |
287 | 003: done |
288 | ]]) | |
289 | ||
475281c0 | 290 | OVSDB_CHECK_IDL([simple idl, writing via IDL], |
9cb53f26 BP |
291 | [['["idltest", |
292 | {"op": "insert", | |
475281c0 BP |
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]], | |
7fae24e6 | 301 | "ba": ["set", [true]], |
8cdf0349 | 302 | "sa": ["set", ["abc", "def"]], |
475281c0 BP |
303 | "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"], |
304 | ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}}, | |
305 | {"op": "insert", | |
306 | "table": "simple", | |
307 | "row": {}}]']], | |
a91c6104 BP |
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']], | |
475281c0 | 310 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> |
7fae24e6 | 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> |
475281c0 BP |
312 | 001: commit, status=success |
313 | 002: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 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> |
475281c0 BP |
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 | ||
a91c6104 BP |
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}]} | |
94fbe1aa | 343 | 003: commit, status=try again |
a91c6104 BP |
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 | ||
b54e22e9 | 352 | OVSDB_CHECK_IDL([simple idl, increment operation], |
9cb53f26 BP |
353 | [['["idltest", |
354 | {"op": "insert", | |
b54e22e9 BP |
355 | "table": "simple", |
356 | "row": {}}]']], | |
94fbe1aa | 357 | [['set 0 r 2.0, increment 0']], |
b54e22e9 BP |
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 | ||
2096903b BP |
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 | ||
c3bb4bd7 BP |
392 | OVSDB_CHECK_IDL([self-linking idl, consistent ops], |
393 | [], | |
9cb53f26 BP |
394 | [['["idltest", |
395 | {"op": "insert", | |
e9011ac8 | 396 | "table": "link1", |
c3bb4bd7 BP |
397 | "row": {"i": 0, "k": ["named-uuid", "self"]}, |
398 | "uuid-name": "self"}]' \ | |
9cb53f26 BP |
399 | '["idltest", |
400 | {"op": "insert", | |
e9011ac8 | 401 | "table": "link1", |
2d2d6d4a | 402 | "row": {"i": 1, "k": ["named-uuid", "row2"]}, |
c3bb4bd7 BP |
403 | "uuid-name": "row1"}, |
404 | {"op": "insert", | |
e9011ac8 | 405 | "table": "link1", |
c3bb4bd7 | 406 | "row": {"i": 2, "k": ["named-uuid", "row1"]}, |
2d2d6d4a | 407 | "uuid-name": "row2"}]' \ |
9cb53f26 BP |
408 | '["idltest", |
409 | {"op": "update", | |
e9011ac8 | 410 | "table": "link1", |
c3bb4bd7 BP |
411 | "where": [["i", "==", 1]], |
412 | "row": {"k": ["uuid", "#1#"]}}]' \ | |
9cb53f26 BP |
413 | '["idltest", |
414 | {"op": "update", | |
e9011ac8 | 415 | "table": "link1", |
c3bb4bd7 BP |
416 | "where": [], |
417 | "row": {"k": ["uuid", "#0#"]}}]']], | |
418 | [[000: empty | |
419 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]}]} | |
e9011ac8 | 420 | 002: i=0 k=0 ka=[] l2= uuid=<0> |
fbf925e4 | 421 | 003: {"error":null,"result":[{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]}]} |
e9011ac8 BP |
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> | |
c3bb4bd7 | 425 | 005: {"error":null,"result":[{"count":1}]} |
e9011ac8 BP |
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> | |
c3bb4bd7 | 429 | 007: {"error":null,"result":[{"count":3}]} |
e9011ac8 BP |
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> | |
c3bb4bd7 BP |
433 | 009: done |
434 | ]]) | |
435 | ||
436 | OVSDB_CHECK_IDL([self-linking idl, inconsistent ops], | |
437 | [], | |
9cb53f26 BP |
438 | [['["idltest", |
439 | {"op": "insert", | |
e9011ac8 | 440 | "table": "link1", |
c3bb4bd7 | 441 | "row": {"i": 0, "k": ["uuid", "cf197cc5-c8c9-42f5-82d5-c71a9f2cb96b"]}}]' \ |
9cb53f26 BP |
442 | '+["idltest", |
443 | {"op": "insert", | |
e9011ac8 | 444 | "table": "link1", |
0d0f05b9 BP |
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"]}}]' \ | |
9cb53f26 BP |
450 | '["idltest", |
451 | {"op": "update", | |
e9011ac8 | 452 | "table": "link1", |
c3bb4bd7 BP |
453 | "where": [], |
454 | "row": {"k": ["uuid", "c2fca39a-e69a-42a4-9c56-5eca85839ce9"]}}]' \ | |
9cb53f26 BP |
455 | '+["idltest", |
456 | {"op": "delete", | |
e9011ac8 | 457 | "table": "link1", |
0d0f05b9 | 458 | "where": [["_uuid", "==", ["uuid", "#1#"]]]}]' \ |
9cb53f26 BP |
459 | '+["idltest", |
460 | {"op": "delete", | |
e9011ac8 | 461 | "table": "link1", |
0d0f05b9 | 462 | "where": [["_uuid", "==", ["uuid", "#2#"]]]}]' \ |
9cb53f26 BP |
463 | '["idltest", |
464 | {"op": "delete", | |
0d0f05b9 BP |
465 | "table": "link1", |
466 | "where": []}]' \ | |
c3bb4bd7 BP |
467 | ]], |
468 | [[000: empty | |
97f7803b | 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"}]} |
0d0f05b9 BP |
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> | |
254604d8 | 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"}]} |
0d0f05b9 BP |
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 | |
254604d8 BP |
480 | ]], |
481 | [], | |
482 | [[sed -e '/004:/s/row <[23]> references/row <x> references/']]) | |
c3bb4bd7 BP |
483 | |
484 | OVSDB_CHECK_IDL([self-linking idl, sets], | |
485 | [], | |
9cb53f26 BP |
486 | [['["idltest", |
487 | {"op": "insert", | |
e9011ac8 | 488 | "table": "link1", |
0d0f05b9 | 489 | "row": {"i": 0, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i0"]]]}, |
c3bb4bd7 BP |
490 | "uuid-name": "i0"}, |
491 | {"op": "insert", | |
e9011ac8 | 492 | "table": "link1", |
0d0f05b9 | 493 | "row": {"i": 1, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i1"]]]}, |
c3bb4bd7 BP |
494 | "uuid-name": "i1"}, |
495 | {"op": "insert", | |
e9011ac8 | 496 | "table": "link1", |
0d0f05b9 | 497 | "row": {"i": 2, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i2"]]]}, |
c3bb4bd7 BP |
498 | "uuid-name": "i2"}, |
499 | {"op": "insert", | |
e9011ac8 | 500 | "table": "link1", |
0d0f05b9 | 501 | "row": {"i": 3, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i3"]]]}, |
c3bb4bd7 | 502 | "uuid-name": "i3"}]' \ |
9cb53f26 BP |
503 | '["idltest", |
504 | {"op": "update", | |
e9011ac8 | 505 | "table": "link1", |
c3bb4bd7 BP |
506 | "where": [], |
507 | "row": {"ka": ["set", [["uuid", "#0#"], ["uuid", "#1#"], ["uuid", "#2#"], ["uuid", "#3#"]]]}}]' \ | |
9cb53f26 BP |
508 | '["idltest", |
509 | {"op": "update", | |
e9011ac8 | 510 | "table": "link1", |
97f7803b BP |
511 | "where": [["i", "==", 2]], |
512 | "row": {"ka": ["set", [["uuid", "#0#"], ["uuid", "88702e78-845b-4a6e-ad08-cf68922ae84a"], ["uuid", "#2#"]]]}}]' \ | |
9cb53f26 BP |
513 | '+["idltest", |
514 | {"op": "delete", | |
0d0f05b9 BP |
515 | "table": "link1", |
516 | "where": []}]']], | |
c3bb4bd7 BP |
517 | [[000: empty |
518 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]},{"uuid":["uuid","<3>"]}]} | |
0d0f05b9 BP |
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> | |
c3bb4bd7 | 523 | 003: {"error":null,"result":[{"count":4}]} |
0d0f05b9 BP |
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> | |
97f7803b | 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"}]} |
0d0f05b9 BP |
529 | 006: {"error":null,"result":[{"count":4}]} |
530 | 007: empty | |
531 | 008: done | |
c3bb4bd7 BP |
532 | ]]) |
533 | ||
e9011ac8 BP |
534 | OVSDB_CHECK_IDL([external-linking idl, consistent ops], |
535 | [], | |
9cb53f26 BP |
536 | [['["idltest", |
537 | {"op": "insert", | |
e9011ac8 BP |
538 | "table": "link2", |
539 | "row": {"i": 0}, | |
540 | "uuid-name": "row0"}, | |
541 | {"op": "insert", | |
542 | "table": "link1", | |
0d0f05b9 | 543 | "row": {"i": 1, "k": ["named-uuid", "row1"], "l2": ["set", [["named-uuid", "row0"]]]}, |
e9011ac8 BP |
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> | |
0d0f05b9 | 548 | 002: i=1 k=1 ka=[] l2=0 uuid=<1> |
e9011ac8 BP |
549 | 003: done |
550 | ]]) | |
225b582a IY |
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 | ]]) | |
3b4c362f IY |
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 | ]]) | |
d18e52e3 | 570 | |
d7d417fc TW |
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 | ||
d18e52e3 BP |
588 | AT_SETUP([idl handling of missing tables and columns - C]) |
589 | AT_KEYWORDS([ovsdb server idl positive]) | |
d18e52e3 BP |
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]) | |
8a16ab90 LR |
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`' | |
d18e52e3 BP |
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#"]}}]']], | |
7427f2a4 | 623 | [0], [stdout], [stderr]) |
d18e52e3 BP |
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 | |
7427f2a4 | 641 | ]]) |
d18e52e3 BP |
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. | |
c383f3bf | 652 | AT_CHECK([grep -c '"monitor\|monitor_cond"' stderr], [0], [1 |
d18e52e3 | 653 | ]) |
c383f3bf LS |
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 | |
d18e52e3 | 657 | ]) |
c383f3bf | 658 | AT_CHECK([grep '"monitor\|monitor_cond"' stderr | grep -c '"ua"'], [0], [1 |
d18e52e3 BP |
659 | ]) |
660 | OVSDB_SERVER_SHUTDOWN | |
661 | AT_CLEANUP | |
80c12152 SA |
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]) | |
8a16ab90 LR |
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`' | |
80c12152 | 671 | m4_if([$2], [], [], |
7427f2a4 | 672 | [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])]) |
80c12152 | 673 | AT_CHECK([$PYTHON $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket [$3] $4], |
7427f2a4 | 674 | [0], [stdout], [ignore]) |
80c12152 | 675 | AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$7],,, [[| $7]]), |
7427f2a4 | 676 | [0], [$5]) |
80c12152 SA |
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 | ]]) | |
932104f4 SA |
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]) | |
8a16ab90 LR |
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`' | |
932104f4 | 718 | m4_if([$2], [], [], |
7427f2a4 | 719 | [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])]) |
932104f4 | 720 | AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl unix:socket $3], |
7427f2a4 | 721 | [0], [stdout], [ignore]) |
932104f4 | 722 | AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]), |
7427f2a4 | 723 | [0], [$4]) |
932104f4 SA |
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> | |
32d37ce8 | 754 | 000: updated columns: b ba i ia r ra s sa u ua |
932104f4 SA |
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> | |
32d37ce8 | 758 | 002: updated columns: b |
932104f4 SA |
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> | |
32d37ce8 | 816 | 002: updated columns: b ba i ia r ra s sa u ua |
932104f4 SA |
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> | |
32d37ce8 | 819 | 004: updated columns: b |
932104f4 SA |
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> | |
32d37ce8 SA |
823 | 006: updated columns: r |
824 | 006: updated columns: r | |
932104f4 SA |
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> | |
32d37ce8 | 827 | 008: updated columns: ba i ia r ra |
932104f4 SA |
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> | |
32d37ce8 SA |
831 | 010: updated columns: s |
832 | 010: updated columns: s | |
932104f4 SA |
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> | |
32d37ce8 SA |
838 | 014: updated columns: b ba i ia r ra s sa u ua |
839 | 014: updated columns: ba i ia r ra s | |
932104f4 SA |
840 | 015: done |
841 | ]]) | |
7251075c EA |
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]) | |
8a16ab90 LR |
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`' | |
7251075c | 850 | m4_if([$2], [], [], |
7427f2a4 | 851 | [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])]) |
7251075c | 852 | AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl-partial-update-map-column unix:socket $3], |
7427f2a4 | 853 | [0], [stdout], [ignore]) |
7251075c | 854 | AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]), |
7427f2a4 | 855 | [0], [$4]) |
7251075c EA |
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 | ]]) |