]>
Commit | Line | Data |
---|---|---|
c3bb4bd7 BP |
1 | AT_BANNER([OVSDB -- interface description language (IDL)]) |
2 | ||
56120500 BP |
3 | m4_divert_text([PREPARE_TESTS], [ |
4 | # ovsdb_start_idltest [REMOTE] [SCHEMA] | |
5 | # | |
6 | # Creates a database using SCHEMA (default: idltest.ovsschema) and | |
7 | # starts a database server listening on punix:socket and REMOTE (if | |
8 | # specified). | |
9 | ovsdb_start_idltest () { | |
10 | ovsdb-tool create db ${2:-$abs_srcdir/idltest.ovsschema} || return $? | |
11 | ovsdb-server -vconsole:warn --log-file --detach --no-chdir --pidfile --remote=punix:socket ${1:+--remote=$1} db || return $? | |
12 | on_exit 'kill `cat ovsdb-server.pid`' | |
13 | } | |
14 | ]) | |
15 | ||
8cdf0349 BP |
16 | # OVSDB_CHECK_IDL_C(TITLE, [PRE-IDL-TXN], TRANSACTIONS, OUTPUT, [KEYWORDS], |
17 | # [FILTER]) | |
c3bb4bd7 BP |
18 | # |
19 | # Creates a database with a schema derived from idltest.ovsidl, runs | |
20 | # each PRE-IDL-TXN (if any), starts an ovsdb-server on that database, | |
21 | # and runs "test-ovsdb idl" passing each of the TRANSACTIONS along. | |
22 | # | |
23 | # Checks that the overall output is OUTPUT. Before comparison, the | |
24 | # output is sorted (using "sort") and UUIDs in the output are replaced | |
25 | # by markers of the form <N> where N is a number. The first unique | |
26 | # UUID is replaced by <0>, the next by <1>, and so on. If a given | |
27 | # UUID appears more than once it is always replaced by the same | |
254604d8 BP |
28 | # marker. If FILTER is supplied then the output is also filtered |
29 | # through the specified program. | |
c3bb4bd7 BP |
30 | # |
31 | # TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS. | |
8cdf0349 BP |
32 | m4_define([OVSDB_CHECK_IDL_C], |
33 | [AT_SETUP([$1 - C]) | |
c3bb4bd7 | 34 | AT_KEYWORDS([ovsdb server idl positive $5]) |
56120500 | 35 | AT_CHECK([ovsdb_start_idltest]) |
c3bb4bd7 | 36 | m4_if([$2], [], [], |
7427f2a4 | 37 | [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])]) |
8cdf0349 | 38 | AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 idl unix:socket $3], |
7427f2a4 | 39 | [0], [stdout], [ignore]) |
c724bd67 | 40 | AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]), |
7427f2a4 | 41 | [0], [$4]) |
028cbd99 | 42 | OVSDB_SERVER_SHUTDOWN |
c3bb4bd7 BP |
43 | AT_CLEANUP]) |
44 | ||
8cdf0349 | 45 | # same as OVSDB_CHECK_IDL but uses the Python IDL implementation. |
963f66b5 RB |
46 | m4_define([OVSDB_CHECK_IDL_PYN], |
47 | [AT_SETUP([$1]) | |
48 | AT_SKIP_IF([test $7 = no]) | |
8cdf0349 | 49 | AT_KEYWORDS([ovsdb server idl positive Python $5]) |
56120500 | 50 | AT_CHECK([ovsdb_start_idltest]) |
8cdf0349 | 51 | m4_if([$2], [], [], |
7427f2a4 | 52 | [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])]) |
963f66b5 | 53 | AT_CHECK([$8 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket $3], |
7427f2a4 | 54 | [0], [stdout], [ignore]) |
c724bd67 | 55 | AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]), |
7427f2a4 | 56 | [0], [$4]) |
8cdf0349 BP |
57 | OVSDB_SERVER_SHUTDOWN |
58 | AT_CLEANUP]) | |
59 | ||
963f66b5 RB |
60 | m4_define([OVSDB_CHECK_IDL_PY], |
61 | [OVSDB_CHECK_IDL_PYN([$1 - Python2], [$2], [$3], [$4], [$5], [$6], | |
62 | [$HAVE_PYTHON], [$PYTHON]) | |
63 | OVSDB_CHECK_IDL_PYN([$1 - Python3], [$2], [$3], [$4], [$5], [$6], | |
64 | [$HAVE_PYTHON3], [$PYTHON3])]) | |
65 | ||
66 | m4_define([OVSDB_CHECK_IDL_REGISTER_COLUMNS_PYN], | |
67 | [AT_SETUP([$1 - register_columns]) | |
68 | AT_SKIP_IF([test $7 = no]) | |
01dc1516 | 69 | AT_KEYWORDS([ovsdb server idl positive Python register_columns $5]) |
56120500 | 70 | AT_CHECK([ovsdb_start_idltest]) |
01dc1516 | 71 | m4_if([$2], [], [], |
7427f2a4 | 72 | [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])]) |
963f66b5 | 73 | 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 | 74 | [0], [stdout], [ignore]) |
c724bd67 | 75 | AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]), |
7427f2a4 | 76 | [0], [$4]) |
01dc1516 SA |
77 | OVSDB_SERVER_SHUTDOWN |
78 | AT_CLEANUP]) | |
79 | ||
963f66b5 RB |
80 | m4_define([OVSDB_CHECK_IDL_REGISTER_COLUMNS_PY], |
81 | [OVSDB_CHECK_IDL_REGISTER_COLUMNS_PYN([$1 - Python2], [$2], [$3], [$4], [$5], [$6], | |
82 | [$HAVE_PYTHON], [$PYTHON]) | |
83 | OVSDB_CHECK_IDL_REGISTER_COLUMNS_PYN([$1 - Python3], [$2], [$3], [$4], [$5], [$6], | |
84 | [$HAVE_PYTHON3], [$PYTHON3])]) | |
85 | ||
e06d06a7 | 86 | # same as OVSDB_CHECK_IDL but uses the Python IDL implementation with tcp |
963f66b5 RB |
87 | m4_define([OVSDB_CHECK_IDL_TCP_PYN], |
88 | [AT_SETUP([$1 - tcp]) | |
89 | AT_SKIP_IF([test $7 = no]) | |
e06d06a7 | 90 | AT_KEYWORDS([ovsdb server idl positive Python with tcp socket $5]) |
56120500 | 91 | AT_CHECK([ovsdb_start_idltest "ptcp:0:127.0.0.1"]) |
fb28ef2d | 92 | PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT]) |
1e04fcc8 | 93 | |
e06d06a7 | 94 | m4_if([$2], [], [], |
7427f2a4 | 95 | [AT_CHECK([ovsdb-client transact tcp:127.0.0.1:$TCP_PORT $2], [0], [ignore], [ignore])]) |
963f66b5 | 96 | AT_CHECK([$8 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema tcp:127.0.0.1:$TCP_PORT $3], |
7427f2a4 | 97 | [0], [stdout], [ignore]) |
c724bd67 | 98 | AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]), |
7427f2a4 | 99 | [0], [$4]) |
e06d06a7 IY |
100 | OVSDB_SERVER_SHUTDOWN |
101 | AT_CLEANUP]) | |
102 | ||
963f66b5 RB |
103 | m4_define([OVSDB_CHECK_IDL_TCP_PY], |
104 | [OVSDB_CHECK_IDL_TCP_PYN([$1 - Python2], [$2], [$3], [$4], [$5], [$6], | |
105 | [$HAVE_PYTHON], [$PYTHON]) | |
106 | OVSDB_CHECK_IDL_TCP_PYN([$1 - Python3], [$2], [$3], [$4], [$5], [$6], | |
107 | [$HAVE_PYTHON3], [$PYTHON3])]) | |
108 | ||
e731d71b | 109 | # same as OVSDB_CHECK_IDL but uses the Python IDL implementation with tcp6 |
963f66b5 RB |
110 | m4_define([OVSDB_CHECK_IDL_TCP6_PYN], |
111 | [AT_SETUP([$1 - tcp6]) | |
112 | AT_SKIP_IF([test $7 = no]) | |
7b9d1b65 | 113 | AT_SKIP_IF([test "$IS_WIN32" = "yes"]) |
4819b3a5 | 114 | AT_SKIP_IF([test $HAVE_IPV6 = no]) |
e731d71b | 115 | AT_KEYWORDS([ovsdb server idl positive Python with tcp6 socket $5]) |
56120500 | 116 | AT_CHECK([ovsdb_start_idltest "ptcp:0:[[::1]]"]) |
fb28ef2d | 117 | PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT]) |
e731d71b AS |
118 | echo "TCP_PORT=$TCP_PORT" |
119 | ||
120 | m4_if([$2], [], [], | |
7427f2a4 | 121 | [AT_CHECK([ovsdb-client transact "tcp:[[::1]]:$TCP_PORT" $2], [0], [ignore], [ignore])]) |
963f66b5 | 122 | AT_CHECK([$8 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema tcp:[[::1]]:$TCP_PORT $3], |
7427f2a4 | 123 | [0], [stdout], [ignore]) |
c724bd67 | 124 | AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]), |
7427f2a4 | 125 | [0], [$4]) |
e731d71b AS |
126 | OVSDB_SERVER_SHUTDOWN |
127 | AT_CLEANUP]) | |
128 | ||
963f66b5 RB |
129 | m4_define([OVSDB_CHECK_IDL_TCP6_PY], |
130 | [OVSDB_CHECK_IDL_TCP6_PYN([$1 - Python2], [$2], [$3], [$4], [$5], [$6], | |
131 | [$HAVE_PYTHON], [$PYTHON]) | |
132 | OVSDB_CHECK_IDL_TCP6_PYN([$1 - Python3], [$2], [$3], [$4], [$5], [$6], | |
133 | [$HAVE_PYTHON3], [$PYTHON3])]) | |
134 | ||
61845323 JS |
135 | # same as OVSDB_CHECK_IDL but uses the Python IDL implementation with SSL |
136 | m4_define([OVSDB_CHECK_IDL_SSL_PYN], | |
137 | [AT_SETUP([$1 - SSL]) | |
138 | AT_SKIP_IF([test "$HAVE_OPENSSL" = no]) | |
139 | AT_SKIP_IF([test $7 = no]) | |
140 | $8 -c "import OpenSSL.SSL" | |
141 | SSL_PRESENT=$? | |
142 | AT_SKIP_IF([test $SSL_PRESENT != 0]) | |
143 | AT_KEYWORDS([ovsdb server idl positive Python with ssl socket $5]) | |
144 | AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema], | |
145 | [0], [stdout], [ignore]) | |
146 | PKIDIR=$abs_top_builddir/tests | |
147 | AT_CHECK([ovsdb-server -vconsole:warn --log-file --detach --no-chdir \ | |
148 | --pidfile \ | |
149 | --private-key=$PKIDIR/testpki-privkey2.pem \ | |
150 | --certificate=$PKIDIR/testpki-cert2.pem \ | |
151 | --ca-cert=$PKIDIR/testpki-cacert.pem \ | |
152 | --remote=pssl:0:127.0.0.1 db]) | |
153 | on_exit 'kill `cat ovsdb-server.pid`' | |
154 | PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT]) | |
155 | m4_if([$2], [], [], | |
156 | [AT_CHECK([ovsdb-client \ | |
157 | --private-key=$PKIDIR/testpki-privkey2.pem \ | |
158 | --certificate=$PKIDIR/testpki-cert2.pem \ | |
159 | --ca-cert=$PKIDIR/testpki-cacert.pem \ | |
160 | transact "ssl:127.0.0.1:$TCP_PORT" $2], [0], [ignore], [ignore])]) | |
161 | AT_CHECK([$8 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema \ | |
162 | ssl:127.0.0.1:$TCP_PORT $PKIDIR/testpki-privkey.pem \ | |
163 | $PKIDIR/testpki-cert.pem $PKIDIR/testpki-cacert.pem $3], | |
164 | [0], [stdout], [ignore]) | |
165 | AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]), | |
166 | [0], [$4]) | |
167 | OVSDB_SERVER_SHUTDOWN | |
168 | AT_CLEANUP]) | |
169 | ||
170 | m4_define([OVSDB_CHECK_IDL_SSL_PY], | |
171 | [OVSDB_CHECK_IDL_SSL_PYN([$1 - Python2], [$2], [$3], [$4], [$5], [$6], | |
172 | [$HAVE_PYTHON], [$PYTHON]) | |
173 | OVSDB_CHECK_IDL_SSL_PYN([$1 - Python3], [$2], [$3], [$4], [$5], [$6], | |
174 | [$HAVE_PYTHON3], [$PYTHON3])]) | |
175 | ||
8cdf0349 BP |
176 | m4_define([OVSDB_CHECK_IDL], |
177 | [OVSDB_CHECK_IDL_C($@) | |
e06d06a7 | 178 | OVSDB_CHECK_IDL_PY($@) |
01dc1516 | 179 | OVSDB_CHECK_IDL_REGISTER_COLUMNS_PY($@) |
e731d71b | 180 | OVSDB_CHECK_IDL_TCP_PY($@) |
61845323 JS |
181 | OVSDB_CHECK_IDL_TCP6_PY($@) |
182 | OVSDB_CHECK_IDL_SSL_PY($@)]) | |
8cdf0349 | 183 | |
af358237 | 184 | # This test uses the Python IDL implementation with passive tcp |
f62a20d8 TR |
185 | m4_define([OVSDB_CHECK_IDL_PASSIVE_TCP_PYN], |
186 | [AT_SETUP([$1 ptcp]) | |
187 | AT_SKIP_IF([test $7 = no]) | |
af358237 | 188 | AT_KEYWORDS([ovsdb server idl positive Python with tcp socket $5]) |
af358237 | 189 | # find free TCP port |
56120500 | 190 | AT_CHECK([ovsdb_start_idltest "ptcp:0:127.0.0.1"]) |
af358237 | 191 | PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT]) |
7427f2a4 | 192 | OVSDB_SERVER_SHUTDOWN |
56120500 | 193 | rm -f db |
af358237 OBY |
194 | |
195 | # start OVSDB server in passive mode | |
56120500 | 196 | AT_CHECK([ovsdb_start_idltest "tcp:127.0.0.1:$TCP_PORT"]) |
f62a20d8 | 197 | AT_CHECK([$8 $srcdir/test-ovsdb.py -t10 idl_passive $srcdir/idltest.ovsschema ptcp:127.0.0.1:$TCP_PORT $3], |
7427f2a4 | 198 | [0], [stdout], [ignore]) |
c724bd67 | 199 | AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]), |
7427f2a4 DDP |
200 | [0], [$4]) |
201 | OVSDB_SERVER_SHUTDOWN | |
af358237 OBY |
202 | AT_CLEANUP |
203 | ]) | |
204 | ||
f62a20d8 TR |
205 | m4_define([OVSDB_CHECK_IDL_PASSIVE_TCP_PY], |
206 | [OVSDB_CHECK_IDL_PASSIVE_TCP_PYN([$1 - Python2], [$2], [$3], [$4], [$5], [$6], | |
207 | [$HAVE_PYTHON], [$PYTHON]) | |
208 | OVSDB_CHECK_IDL_PASSIVE_TCP_PYN([$1 - Python3], [$2], [$3], [$4], [$5], [$6], | |
209 | [$HAVE_PYTHON3], [$PYTHON3])]) | |
210 | ||
af358237 OBY |
211 | OVSDB_CHECK_IDL_PASSIVE_TCP_PY([simple passive idl, initially empty, select empty], |
212 | [], | |
213 | [['["idltest",{"op":"select","table":"link1","where":[]}]']], | |
214 | [[000: empty | |
215 | 001: {"error":null,"result":[{"rows":[]}]} | |
216 | 002: done | |
217 | ]]) | |
218 | ||
c3bb4bd7 BP |
219 | OVSDB_CHECK_IDL([simple idl, initially empty, no ops], |
220 | [], | |
221 | [], | |
222 | [000: empty | |
223 | 001: done | |
224 | ]) | |
225 | ||
226 | OVSDB_CHECK_IDL([simple idl, initially empty, various ops], | |
227 | [], | |
9cb53f26 BP |
228 | [['["idltest", |
229 | {"op": "insert", | |
c3bb4bd7 BP |
230 | "table": "simple", |
231 | "row": {"i": 1, | |
232 | "r": 2.0, | |
233 | "b": true, | |
234 | "s": "mystring", | |
235 | "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"], | |
236 | "ia": ["set", [1, 2, 3]], | |
237 | "ra": ["set", [-0.5]], | |
7fae24e6 | 238 | "ba": ["set", [true]], |
8cdf0349 | 239 | "sa": ["set", ["abc", "def"]], |
c3bb4bd7 BP |
240 | "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"], |
241 | ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}}, | |
242 | {"op": "insert", | |
243 | "table": "simple", | |
244 | "row": {}}]' \ | |
9cb53f26 BP |
245 | '["idltest", |
246 | {"op": "update", | |
c3bb4bd7 BP |
247 | "table": "simple", |
248 | "where": [], | |
249 | "row": {"b": true}}]' \ | |
9cb53f26 BP |
250 | '["idltest", |
251 | {"op": "update", | |
c3bb4bd7 BP |
252 | "table": "simple", |
253 | "where": [], | |
254 | "row": {"r": 123.5}}]' \ | |
9cb53f26 BP |
255 | '["idltest", |
256 | {"op": "insert", | |
c3bb4bd7 BP |
257 | "table": "simple", |
258 | "row": {"i": -1, | |
259 | "r": 125, | |
260 | "b": false, | |
261 | "s": "", | |
262 | "ia": ["set", [1]], | |
263 | "ra": ["set", [1.5]], | |
264 | "ba": ["set", [false]], | |
8cdf0349 | 265 | "sa": ["set", []], |
c3bb4bd7 | 266 | "ua": ["set", []]}}]' \ |
9cb53f26 BP |
267 | '["idltest", |
268 | {"op": "update", | |
c3bb4bd7 BP |
269 | "table": "simple", |
270 | "where": [["i", "<", 1]], | |
271 | "row": {"s": "newstring"}}]' \ | |
9cb53f26 BP |
272 | '["idltest", |
273 | {"op": "delete", | |
c3bb4bd7 BP |
274 | "table": "simple", |
275 | "where": [["i", "==", 0]]}]' \ | |
276 | 'reconnect']], | |
277 | [[000: empty | |
278 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]} | |
279 | 002: i=0 r=0 b=false s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 280 | 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 |
281 | 003: {"error":null,"result":[{"count":2}]} |
282 | 004: i=0 r=0 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 283 | 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 |
284 | 005: {"error":null,"result":[{"count":2}]} |
285 | 006: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 286 | 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 |
287 | 007: {"error":null,"result":[{"uuid":["uuid","<6>"]}]} |
288 | 008: i=-1 r=125 b=false s= u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
289 | 008: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 290 | 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 |
291 | 009: {"error":null,"result":[{"count":2}]} |
292 | 010: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
293 | 010: i=0 r=123.5 b=true s=newstring u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 294 | 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 |
295 | 011: {"error":null,"result":[{"count":1}]} |
296 | 012: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
7fae24e6 | 297 | 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 |
298 | 013: reconnect |
299 | 014: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
7fae24e6 | 300 | 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 |
301 | 015: done |
302 | ]]) | |
303 | ||
304 | OVSDB_CHECK_IDL([simple idl, initially populated], | |
9cb53f26 BP |
305 | [['["idltest", |
306 | {"op": "insert", | |
c3bb4bd7 BP |
307 | "table": "simple", |
308 | "row": {"i": 1, | |
309 | "r": 2.0, | |
310 | "b": true, | |
311 | "s": "mystring", | |
312 | "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"], | |
313 | "ia": ["set", [1, 2, 3]], | |
314 | "ra": ["set", [-0.5]], | |
7fae24e6 | 315 | "ba": ["set", [true]], |
8cdf0349 | 316 | "sa": ["set", ["abc", "def"]], |
c3bb4bd7 BP |
317 | "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"], |
318 | ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}}, | |
319 | {"op": "insert", | |
320 | "table": "simple", | |
321 | "row": {}}]']], | |
9cb53f26 BP |
322 | [['["idltest", |
323 | {"op": "update", | |
c3bb4bd7 BP |
324 | "table": "simple", |
325 | "where": [], | |
326 | "row": {"b": true}}]']], | |
327 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 328 | 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 |
329 | 001: {"error":null,"result":[{"count":2}]} |
330 | 002: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 331 | 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 |
332 | 003: done |
333 | ]]) | |
334 | ||
475281c0 | 335 | OVSDB_CHECK_IDL([simple idl, writing via IDL], |
9cb53f26 BP |
336 | [['["idltest", |
337 | {"op": "insert", | |
475281c0 BP |
338 | "table": "simple", |
339 | "row": {"i": 1, | |
340 | "r": 2.0, | |
341 | "b": true, | |
342 | "s": "mystring", | |
343 | "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"], | |
344 | "ia": ["set", [1, 2, 3]], | |
345 | "ra": ["set", [-0.5]], | |
7fae24e6 | 346 | "ba": ["set", [true]], |
8cdf0349 | 347 | "sa": ["set", ["abc", "def"]], |
475281c0 BP |
348 | "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"], |
349 | ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}}, | |
350 | {"op": "insert", | |
351 | "table": "simple", | |
352 | "row": {}}]']], | |
a91c6104 BP |
353 | [['verify 0 b, verify 1 r, set 0 b 1, set 1 r 3.5' \ |
354 | 'insert 2, verify 2 i, verify 1 b, delete 1']], | |
475281c0 | 355 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> |
7fae24e6 | 356 | 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 |
357 | 001: commit, status=success |
358 | 002: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 359 | 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 |
360 | 003: commit, status=success |
361 | 004: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
362 | 004: i=2 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<6> | |
363 | 005: done | |
364 | ]]) | |
365 | ||
e7164d96 LR |
366 | OVSDB_CHECK_IDL([simple idl, writing via IDL with unicode], |
367 | [['["idltest", | |
368 | {"op": "insert", | |
369 | "table": "simple", | |
370 | "row": {"s": "(╯°□°)╯︵ ┻━┻"}}]']], | |
371 | [['set 0 b 1, insert 1, set 1 s "¯\_(ツ)_/¯"']], | |
372 | [[000: i=0 r=0 b=false s=(╯°□°)╯︵ ┻━┻ u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
373 | 001: commit, status=success | |
374 | 002: i=0 r=0 b=true s=(╯°□°)╯︵ ┻━┻ u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
375 | 002: i=1 r=0 b=false s="¯\_(ツ)_/¯" u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> | |
376 | 003: done | |
377 | ]]) | |
378 | ||
980211b7 GL |
379 | m4_define([OVSDB_CHECK_IDL_PYN_WITH_EXPOUT], |
380 | [AT_SETUP([$1]) | |
381 | AT_SKIP_IF([test $7 = no]) | |
382 | AT_KEYWORDS([ovsdb server idl positive Python $5]) | |
383 | AT_CHECK([ovsdb_start_idltest]) | |
384 | m4_if([$2], [], [], | |
385 | [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])]) | |
386 | AT_CHECK([$8 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket $3], | |
387 | [0], [stdout], [ignore]) | |
388 | echo "$4" > expout | |
389 | AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]), | |
390 | [0], [expout]) | |
391 | OVSDB_SERVER_SHUTDOWN | |
392 | AT_CLEANUP]) | |
393 | ||
394 | m4_define([OVSDB_CHECK_IDL_PY_WITH_EXPOUT], | |
395 | [OVSDB_CHECK_IDL_PYN_WITH_EXPOUT([$1 - Python2], [$2], [$3], [$4], [$5], [$6], | |
396 | [$HAVE_PYTHON], [$PYTHON]) | |
397 | OVSDB_CHECK_IDL_PYN_WITH_EXPOUT([$1 - Python3], [$2], [$3], [$4], [$5], [$6], | |
398 | [$HAVE_PYTHON3], [$PYTHON3])]) | |
399 | ||
400 | OVSDB_CHECK_IDL_PY_WITH_EXPOUT([simple idl, writing large data via IDL with unicode], | |
401 | [['["idltest", | |
402 | {"op": "insert", | |
403 | "table": "simple", | |
404 | "row": {"s": "'$(printf "测试超过四千零九十六个字节的中文字符串以使解码出现问题。%.0s" {1..50})'"}}]']], | |
405 | [['set 0 b 1, insert 1, set 1 s '$(printf "测试超过四千零九十六个字节的中文字符串以使解码出现问题。%.0s" {1..100})'']], | |
406 | [[000: i=0 r=0 b=false s=$(printf "测试超过四千零九十六个字节的中文字符串以使解码出现问题。%.0s" {1..50}) u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
407 | 001: commit, status=success | |
408 | 002: i=0 r=0 b=true s=$(printf "测试超过四千零九十六个字节的中文字符串以使解码出现问题。%.0s" {1..50}) u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
409 | 002: i=1 r=0 b=false s=$(printf "测试超过四千零九十六个字节的中文字符串以使解码出现问题。%.0s" {1..100}) u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> | |
410 | 003: done]]) | |
411 | ||
a91c6104 BP |
412 | OVSDB_CHECK_IDL([simple idl, handling verification failure], |
413 | [['["idltest", | |
414 | {"op": "insert", | |
415 | "table": "simple", | |
416 | "row": {"i": 1, | |
417 | "r": 2.0}}, | |
418 | {"op": "insert", | |
419 | "table": "simple", | |
420 | "row": {}}]']], | |
421 | [['set 0 b 1' \ | |
422 | '+["idltest", | |
423 | {"op": "update", | |
424 | "table": "simple", | |
425 | "where": [["i", "==", 1]], | |
426 | "row": {"r": 5.0}}]' \ | |
427 | '+verify 1 r, set 1 r 3' \ | |
428 | 'verify 1 r, set 1 r 3' \ | |
429 | ]], | |
430 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
431 | 000: i=1 r=2 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> | |
432 | 001: commit, status=success | |
433 | 002: {"error":null,"result":[{"count":1}]} | |
94fbe1aa | 434 | 003: commit, status=try again |
a91c6104 BP |
435 | 004: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> |
436 | 004: i=1 r=5 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> | |
437 | 005: commit, status=success | |
438 | 006: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
439 | 006: i=1 r=3 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> | |
440 | 007: done | |
441 | ]]) | |
442 | ||
b54e22e9 | 443 | OVSDB_CHECK_IDL([simple idl, increment operation], |
9cb53f26 BP |
444 | [['["idltest", |
445 | {"op": "insert", | |
b54e22e9 BP |
446 | "table": "simple", |
447 | "row": {}}]']], | |
94fbe1aa | 448 | [['set 0 r 2.0, increment 0']], |
b54e22e9 BP |
449 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> |
450 | 001: commit, status=success, increment=1 | |
451 | 002: i=1 r=2 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
452 | 003: done | |
453 | ]]) | |
454 | ||
2096903b BP |
455 | OVSDB_CHECK_IDL([simple idl, aborting], |
456 | [['["idltest", | |
457 | {"op": "insert", | |
458 | "table": "simple", | |
459 | "row": {}}]']], | |
460 | [['set 0 r 2.0, abort' \ | |
461 | '+set 0 b 1']], | |
462 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
463 | 001: commit, status=aborted | |
464 | 002: commit, status=success | |
465 | 003: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
466 | 004: done | |
467 | ]]) | |
468 | ||
469 | OVSDB_CHECK_IDL([simple idl, destroy without commit or abort], | |
470 | [['["idltest", | |
471 | {"op": "insert", | |
472 | "table": "simple", | |
473 | "row": {}}]']], | |
474 | [['set 0 r 2.0, destroy' \ | |
475 | '+set 0 b 1']], | |
476 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
477 | 001: destroy | |
478 | 002: commit, status=success | |
479 | 003: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
480 | 004: done | |
481 | ]]) | |
482 | ||
16ebb90e LS |
483 | OVSDB_CHECK_IDL([simple idl, conditional, false condition], |
484 | [['["idltest", | |
485 | {"op": "insert", | |
486 | "table": "simple", | |
487 | "row": {"i": 1, | |
488 | "r": 2.0, | |
489 | "b": true}}]']], | |
0164e367 BP |
490 | [['condition simple []' \ |
491 | 'condition simple [true]']], | |
16ebb90e LS |
492 | [[000: change conditions |
493 | 001: empty | |
494 | 002: change conditions | |
495 | 003: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
496 | 004: done | |
497 | ]]) | |
498 | ||
499 | OVSDB_CHECK_IDL([simple idl, conditional, true condition], | |
500 | [['["idltest", | |
501 | {"op": "insert", | |
502 | "table": "simple", | |
503 | "row": {"i": 1, | |
504 | "r": 2.0, | |
505 | "b": true}}]']], | |
0164e367 BP |
506 | [['condition simple []' \ |
507 | 'condition simple [true]']], | |
16ebb90e LS |
508 | [[000: change conditions |
509 | 001: empty | |
510 | 002: change conditions | |
511 | 003: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
512 | 004: done | |
513 | ]]) | |
514 | ||
515 | OVSDB_CHECK_IDL([simple idl, conditional, multiple clauses in condition], | |
516 | [['["idltest", | |
517 | {"op": "insert", | |
518 | "table": "simple", | |
519 | "row": {"i": 1, | |
520 | "r": 2.0, | |
521 | "b": true}}, | |
522 | {"op": "insert", | |
523 | "table": "simple", | |
524 | "row": {"i": 2, | |
525 | "r": 3.0, | |
526 | "b": true}}]']], | |
0164e367 BP |
527 | [['condition simple []' \ |
528 | 'condition simple [["i","==",1],["i","==",2]]']], | |
16ebb90e LS |
529 | [[000: change conditions |
530 | 001: empty | |
531 | 002: change conditions | |
532 | 003: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
533 | 003: i=2 r=3 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> | |
534 | 004: done | |
535 | ]]) | |
536 | ||
537 | OVSDB_CHECK_IDL([simple idl, conditional, modify as insert due to condition], | |
538 | [['["idltest", | |
539 | {"op": "insert", | |
540 | "table": "simple", | |
541 | "row": {"i": 1, | |
542 | "r": 2.0, | |
543 | "b": true}}]']], | |
0164e367 BP |
544 | [['condition simple []' \ |
545 | 'condition simple [["i","==",1]]']], | |
16ebb90e LS |
546 | [[000: change conditions |
547 | 001: empty | |
548 | 002: change conditions | |
549 | 003: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
550 | 004: done | |
551 | ]]) | |
552 | ||
553 | OVSDB_CHECK_IDL([simple idl, conditional, modify as delete due to condition], | |
554 | [['["idltest", | |
555 | {"op": "insert", | |
556 | "table": "simple", | |
557 | "row": {"i": 1, | |
558 | "r": 2.0, | |
559 | "b": true}}]']], | |
0164e367 BP |
560 | [['condition simple []' \ |
561 | 'condition simple [["i","==",1],["i","==",2]]' \ | |
562 | 'condition simple [["i","==",2]]' \ | |
16ebb90e LS |
563 | '["idltest", |
564 | {"op": "insert", | |
565 | "table": "simple", | |
566 | "row": {"i": 2, | |
567 | "r": 3.0, | |
568 | "b": true}}]']], | |
569 | [[000: change conditions | |
570 | 001: empty | |
571 | 002: change conditions | |
572 | 003: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
573 | 004: change conditions | |
574 | 005: empty | |
575 | 006: {"error":null,"result":[{"uuid":["uuid","<2>"]}]} | |
576 | 007: i=2 r=3 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> | |
577 | 008: done | |
578 | ]]) | |
579 | ||
580 | OVSDB_CHECK_IDL([simple idl, conditional, multiple tables], | |
581 | [['["idltest", | |
582 | {"op": "insert", | |
583 | "table": "simple", | |
584 | "row": {"i": 1, | |
585 | "r": 2.0, | |
586 | "b": true}}, | |
587 | {"op": "insert", | |
588 | "table": "link1", | |
589 | "row": {"i": 0, "k": ["named-uuid", "self"]}, | |
590 | "uuid-name": "self"}, | |
591 | {"op": "insert", | |
592 | "table": "link2", | |
593 | "row": {"i": 2}, | |
594 | "uuid-name": "row0"}]']], | |
0164e367 BP |
595 | [['condition simple [];link1 [];link2 []' \ |
596 | 'condition simple [["i","==",1]]' \ | |
597 | 'condition link1 [["i","==",0]]' \ | |
598 | 'condition link2 [["i","==",3]]' \ | |
16ebb90e LS |
599 | '+["idltest", |
600 | {"op": "insert", | |
601 | "table": "link2", | |
602 | "row": {"i": 3}, | |
603 | "uuid-name": "row0"}]']], | |
604 | [[000: change conditions | |
605 | 001: empty | |
606 | 002: change conditions | |
607 | 003: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
608 | 004: change conditions | |
609 | 005: i=0 k=0 ka=[] l2= uuid=<2> | |
610 | 005: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
611 | 006: change conditions | |
612 | 007: {"error":null,"result":[{"uuid":["uuid","<3>"]}]} | |
613 | 008: i=0 k=0 ka=[] l2= uuid=<2> | |
614 | 008: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
615 | 008: i=3 l1= uuid=<3> | |
616 | 009: done | |
617 | ]]) | |
618 | ||
c3bb4bd7 BP |
619 | OVSDB_CHECK_IDL([self-linking idl, consistent ops], |
620 | [], | |
9cb53f26 BP |
621 | [['["idltest", |
622 | {"op": "insert", | |
e9011ac8 | 623 | "table": "link1", |
c3bb4bd7 BP |
624 | "row": {"i": 0, "k": ["named-uuid", "self"]}, |
625 | "uuid-name": "self"}]' \ | |
9cb53f26 BP |
626 | '["idltest", |
627 | {"op": "insert", | |
e9011ac8 | 628 | "table": "link1", |
2d2d6d4a | 629 | "row": {"i": 1, "k": ["named-uuid", "row2"]}, |
c3bb4bd7 BP |
630 | "uuid-name": "row1"}, |
631 | {"op": "insert", | |
e9011ac8 | 632 | "table": "link1", |
c3bb4bd7 | 633 | "row": {"i": 2, "k": ["named-uuid", "row1"]}, |
2d2d6d4a | 634 | "uuid-name": "row2"}]' \ |
9cb53f26 BP |
635 | '["idltest", |
636 | {"op": "update", | |
e9011ac8 | 637 | "table": "link1", |
c3bb4bd7 BP |
638 | "where": [["i", "==", 1]], |
639 | "row": {"k": ["uuid", "#1#"]}}]' \ | |
9cb53f26 BP |
640 | '["idltest", |
641 | {"op": "update", | |
e9011ac8 | 642 | "table": "link1", |
c3bb4bd7 BP |
643 | "where": [], |
644 | "row": {"k": ["uuid", "#0#"]}}]']], | |
645 | [[000: empty | |
646 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]}]} | |
e9011ac8 | 647 | 002: i=0 k=0 ka=[] l2= uuid=<0> |
fbf925e4 | 648 | 003: {"error":null,"result":[{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]}]} |
e9011ac8 BP |
649 | 004: i=0 k=0 ka=[] l2= uuid=<0> |
650 | 004: i=1 k=2 ka=[] l2= uuid=<1> | |
651 | 004: i=2 k=1 ka=[] l2= uuid=<2> | |
c3bb4bd7 | 652 | 005: {"error":null,"result":[{"count":1}]} |
e9011ac8 BP |
653 | 006: i=0 k=0 ka=[] l2= uuid=<0> |
654 | 006: i=1 k=1 ka=[] l2= uuid=<1> | |
655 | 006: i=2 k=1 ka=[] l2= uuid=<2> | |
c3bb4bd7 | 656 | 007: {"error":null,"result":[{"count":3}]} |
e9011ac8 BP |
657 | 008: i=0 k=0 ka=[] l2= uuid=<0> |
658 | 008: i=1 k=0 ka=[] l2= uuid=<1> | |
659 | 008: i=2 k=0 ka=[] l2= uuid=<2> | |
c3bb4bd7 BP |
660 | 009: done |
661 | ]]) | |
662 | ||
663 | OVSDB_CHECK_IDL([self-linking idl, inconsistent ops], | |
664 | [], | |
9cb53f26 BP |
665 | [['["idltest", |
666 | {"op": "insert", | |
e9011ac8 | 667 | "table": "link1", |
c3bb4bd7 | 668 | "row": {"i": 0, "k": ["uuid", "cf197cc5-c8c9-42f5-82d5-c71a9f2cb96b"]}}]' \ |
9cb53f26 BP |
669 | '+["idltest", |
670 | {"op": "insert", | |
e9011ac8 | 671 | "table": "link1", |
0d0f05b9 BP |
672 | "uuid-name": "one", |
673 | "row": {"i": 1, "k": ["named-uuid", "one"]}}, | |
674 | {"op": "insert", | |
675 | "table": "link1", | |
676 | "row": {"i": 2, "k": ["named-uuid", "one"]}}]' \ | |
9cb53f26 BP |
677 | '["idltest", |
678 | {"op": "update", | |
e9011ac8 | 679 | "table": "link1", |
c3bb4bd7 BP |
680 | "where": [], |
681 | "row": {"k": ["uuid", "c2fca39a-e69a-42a4-9c56-5eca85839ce9"]}}]' \ | |
9cb53f26 BP |
682 | '+["idltest", |
683 | {"op": "delete", | |
e9011ac8 | 684 | "table": "link1", |
0d0f05b9 | 685 | "where": [["_uuid", "==", ["uuid", "#1#"]]]}]' \ |
9cb53f26 BP |
686 | '+["idltest", |
687 | {"op": "delete", | |
e9011ac8 | 688 | "table": "link1", |
0d0f05b9 | 689 | "where": [["_uuid", "==", ["uuid", "#2#"]]]}]' \ |
9cb53f26 BP |
690 | '["idltest", |
691 | {"op": "delete", | |
0d0f05b9 BP |
692 | "table": "link1", |
693 | "where": []}]' \ | |
c3bb4bd7 BP |
694 | ]], |
695 | [[000: empty | |
97f7803b | 696 | 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 |
697 | 002: {"error":null,"result":[{"uuid":["uuid","<2>"]},{"uuid":["uuid","<3>"]}]} |
698 | 003: i=1 k=1 ka=[] l2= uuid=<2> | |
699 | 003: i=2 k=1 ka=[] l2= uuid=<3> | |
254604d8 | 700 | 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 |
701 | 005: {"error":null,"result":[{"count":1},{"details":"cannot delete link1 row <2> because of 1 remaining reference(s)","error":"referential integrity violation"}]} |
702 | 006: {"error":null,"result":[{"count":1}]} | |
703 | 007: i=1 k=1 ka=[] l2= uuid=<2> | |
704 | 008: {"error":null,"result":[{"count":1}]} | |
705 | 009: empty | |
706 | 010: done | |
254604d8 BP |
707 | ]], |
708 | [], | |
709 | [[sed -e '/004:/s/row <[23]> references/row <x> references/']]) | |
c3bb4bd7 BP |
710 | |
711 | OVSDB_CHECK_IDL([self-linking idl, sets], | |
712 | [], | |
9cb53f26 BP |
713 | [['["idltest", |
714 | {"op": "insert", | |
e9011ac8 | 715 | "table": "link1", |
0d0f05b9 | 716 | "row": {"i": 0, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i0"]]]}, |
c3bb4bd7 BP |
717 | "uuid-name": "i0"}, |
718 | {"op": "insert", | |
e9011ac8 | 719 | "table": "link1", |
0d0f05b9 | 720 | "row": {"i": 1, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i1"]]]}, |
c3bb4bd7 BP |
721 | "uuid-name": "i1"}, |
722 | {"op": "insert", | |
e9011ac8 | 723 | "table": "link1", |
0d0f05b9 | 724 | "row": {"i": 2, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i2"]]]}, |
c3bb4bd7 BP |
725 | "uuid-name": "i2"}, |
726 | {"op": "insert", | |
e9011ac8 | 727 | "table": "link1", |
0d0f05b9 | 728 | "row": {"i": 3, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i3"]]]}, |
c3bb4bd7 | 729 | "uuid-name": "i3"}]' \ |
9cb53f26 BP |
730 | '["idltest", |
731 | {"op": "update", | |
e9011ac8 | 732 | "table": "link1", |
c3bb4bd7 BP |
733 | "where": [], |
734 | "row": {"ka": ["set", [["uuid", "#0#"], ["uuid", "#1#"], ["uuid", "#2#"], ["uuid", "#3#"]]]}}]' \ | |
9cb53f26 BP |
735 | '["idltest", |
736 | {"op": "update", | |
e9011ac8 | 737 | "table": "link1", |
97f7803b BP |
738 | "where": [["i", "==", 2]], |
739 | "row": {"ka": ["set", [["uuid", "#0#"], ["uuid", "88702e78-845b-4a6e-ad08-cf68922ae84a"], ["uuid", "#2#"]]]}}]' \ | |
9cb53f26 BP |
740 | '+["idltest", |
741 | {"op": "delete", | |
0d0f05b9 BP |
742 | "table": "link1", |
743 | "where": []}]']], | |
c3bb4bd7 BP |
744 | [[000: empty |
745 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]},{"uuid":["uuid","<3>"]}]} | |
0d0f05b9 BP |
746 | 002: i=0 k=0 ka=[0] l2= uuid=<0> |
747 | 002: i=1 k=0 ka=[1] l2= uuid=<1> | |
748 | 002: i=2 k=0 ka=[2] l2= uuid=<2> | |
749 | 002: i=3 k=0 ka=[3] l2= uuid=<3> | |
c3bb4bd7 | 750 | 003: {"error":null,"result":[{"count":4}]} |
0d0f05b9 BP |
751 | 004: i=0 k=0 ka=[0 1 2 3] l2= uuid=<0> |
752 | 004: i=1 k=0 ka=[0 1 2 3] l2= uuid=<1> | |
753 | 004: i=2 k=0 ka=[0 1 2 3] l2= uuid=<2> | |
754 | 004: i=3 k=0 ka=[0 1 2 3] l2= uuid=<3> | |
97f7803b | 755 | 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 |
756 | 006: {"error":null,"result":[{"count":4}]} |
757 | 007: empty | |
758 | 008: done | |
c3bb4bd7 BP |
759 | ]]) |
760 | ||
e9011ac8 BP |
761 | OVSDB_CHECK_IDL([external-linking idl, consistent ops], |
762 | [], | |
9cb53f26 BP |
763 | [['["idltest", |
764 | {"op": "insert", | |
e9011ac8 BP |
765 | "table": "link2", |
766 | "row": {"i": 0}, | |
767 | "uuid-name": "row0"}, | |
768 | {"op": "insert", | |
769 | "table": "link1", | |
0d0f05b9 | 770 | "row": {"i": 1, "k": ["named-uuid", "row1"], "l2": ["set", [["named-uuid", "row0"]]]}, |
e9011ac8 BP |
771 | "uuid-name": "row1"}]']], |
772 | [[000: empty | |
773 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]} | |
774 | 002: i=0 l1= uuid=<0> | |
0d0f05b9 | 775 | 002: i=1 k=1 ka=[] l2=0 uuid=<1> |
e9011ac8 BP |
776 | 003: done |
777 | ]]) | |
225b582a IY |
778 | |
779 | OVSDB_CHECK_IDL_PY([external-linking idl, insert ops], | |
780 | [], | |
781 | [['linktest']], | |
782 | [[000: empty | |
783 | 001: commit, status=success | |
784 | 002: i=1 k=1 ka=[1] l2= uuid=<0> | |
785 | 002: i=2 k=1 ka=[1 2] l2= uuid=<1> | |
786 | 003: done | |
787 | ]]) | |
3b4c362f IY |
788 | |
789 | OVSDB_CHECK_IDL_PY([getattr idl, insert ops], | |
790 | [], | |
791 | [['getattrtest']], | |
792 | [[000: empty | |
793 | 001: commit, status=success | |
794 | 002: i=2 k=2 ka=[] l2= uuid=<0> | |
795 | 003: done | |
796 | ]]) | |
d18e52e3 | 797 | |
d7d417fc TW |
798 | OVSDB_CHECK_IDL_PY([row-from-json idl, whats this], |
799 | [['["idltest", | |
800 | {"op": "insert", | |
801 | "table": "simple", | |
802 | "row": {"i": 1}}, | |
803 | {"op": "insert", | |
804 | "table": "simple", | |
805 | "row": {}}]']], | |
806 | [['notifytest insert 2, notifytest set 1 b 1, notifytest delete 0']], | |
807 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
808 | 000: i=1 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> | |
809 | 001: commit, status=success, events=create|2|None, delete|0|None, update|1|b | |
810 | 002: i=1 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> | |
811 | 002: i=2 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3> | |
812 | 003: done | |
813 | ]]) | |
814 | ||
d18e52e3 BP |
815 | AT_SETUP([idl handling of missing tables and columns - C]) |
816 | AT_KEYWORDS([ovsdb server idl positive]) | |
d18e52e3 BP |
817 | |
818 | # idltest2.ovsschema is the same as idltest.ovsschema, except that | |
819 | # table link2 and column l2 have been deleted. But the IDL still | |
820 | # expects them to be there, so this test checks that it properly | |
821 | # tolerates them being missing. | |
56120500 | 822 | AT_CHECK([ovsdb_start_idltest "" "$abs_srcdir/idltest2.ovsschema"]) |
d18e52e3 BP |
823 | AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 idl unix:socket ['["idltest", |
824 | {"op": "insert", | |
825 | "table": "link1", | |
826 | "row": {"i": 0, "k": ["named-uuid", "self"]}, | |
827 | "uuid-name": "self"}]' \ | |
828 | '["idltest", | |
829 | {"op": "insert", | |
830 | "table": "link1", | |
831 | "row": {"i": 1, "k": ["named-uuid", "row2"]}, | |
832 | "uuid-name": "row1"}, | |
833 | {"op": "insert", | |
834 | "table": "link1", | |
835 | "row": {"i": 2, "k": ["named-uuid", "row1"]}, | |
836 | "uuid-name": "row2"}]' \ | |
837 | '["idltest", | |
838 | {"op": "update", | |
839 | "table": "link1", | |
840 | "where": [["i", "==", 1]], | |
841 | "row": {"k": ["uuid", "#1#"]}}]' \ | |
842 | '["idltest", | |
843 | {"op": "update", | |
844 | "table": "link1", | |
845 | "where": [], | |
846 | "row": {"k": ["uuid", "#0#"]}}]']], | |
5a0e4aec | 847 | [0], [stdout], [stderr]) |
c724bd67 | 848 | AT_CHECK([sort stdout | uuidfilt], [0], |
d18e52e3 BP |
849 | [[000: empty |
850 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]}]} | |
851 | 002: i=0 k=0 ka=[] l2= uuid=<0> | |
852 | 003: {"error":null,"result":[{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]}]} | |
853 | 004: i=0 k=0 ka=[] l2= uuid=<0> | |
854 | 004: i=1 k=2 ka=[] l2= uuid=<1> | |
855 | 004: i=2 k=1 ka=[] l2= uuid=<2> | |
856 | 005: {"error":null,"result":[{"count":1}]} | |
857 | 006: i=0 k=0 ka=[] l2= uuid=<0> | |
858 | 006: i=1 k=1 ka=[] l2= uuid=<1> | |
859 | 006: i=2 k=1 ka=[] l2= uuid=<2> | |
860 | 007: {"error":null,"result":[{"count":3}]} | |
861 | 008: i=0 k=0 ka=[] l2= uuid=<0> | |
862 | 008: i=1 k=0 ka=[] l2= uuid=<1> | |
863 | 008: i=2 k=0 ka=[] l2= uuid=<2> | |
864 | 009: done | |
7427f2a4 | 865 | ]]) |
d18e52e3 BP |
866 | |
867 | # Check that ovsdb-idl figured out that table link2 and column l2 are missing. | |
868 | AT_CHECK([grep ovsdb_idl stderr | sort], [0], [dnl | |
869 | test-ovsdb|ovsdb_idl|idltest database lacks link2 table (database needs upgrade?) | |
870 | test-ovsdb|ovsdb_idl|link1 table in idltest database lacks l2 column (database needs upgrade?) | |
871 | ]) | |
872 | ||
873 | # Check that ovsdb-idl sent on "monitor" request and that it didn't | |
874 | # mention that table or column, and (for paranoia) that it did mention another | |
875 | # table and column. | |
1b1d2e6d | 876 | AT_CHECK([grep -c '"monitor\|monitor_cond"' stderr], [0], [2 |
d18e52e3 | 877 | ]) |
c383f3bf LS |
878 | AT_CHECK([grep '"monitor\|monitor_cond"' stderr | grep link2], [1]) |
879 | AT_CHECK([grep '"monitor\|monitor_cond"' stderr | grep l2], [1]) | |
880 | AT_CHECK([grep '"monitor\|monitor_cond"' stderr | grep -c '"link1"'], [0], [1 | |
d18e52e3 | 881 | ]) |
c383f3bf | 882 | AT_CHECK([grep '"monitor\|monitor_cond"' stderr | grep -c '"ua"'], [0], [1 |
d18e52e3 BP |
883 | ]) |
884 | OVSDB_SERVER_SHUTDOWN | |
885 | AT_CLEANUP | |
80c12152 | 886 | |
f62a20d8 TR |
887 | m4_define([OVSDB_CHECK_IDL_FETCH_COLUMNS_PYN], |
888 | [AT_SETUP([$1 fetch]) | |
889 | AT_SKIP_IF([test $8 = no]) | |
80c12152 | 890 | AT_KEYWORDS([ovsdb server idl positive Python increment fetch $6]) |
56120500 | 891 | AT_CHECK([ovsdb_start_idltest]) |
80c12152 | 892 | m4_if([$2], [], [], |
7427f2a4 | 893 | [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])]) |
f62a20d8 | 894 | AT_CHECK([$9 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket [$3] $4], |
7427f2a4 | 895 | [0], [stdout], [ignore]) |
c724bd67 | 896 | AT_CHECK([sort stdout | uuidfilt]m4_if([$7],,, [[| $7]]), |
7427f2a4 | 897 | [0], [$5]) |
80c12152 SA |
898 | OVSDB_SERVER_SHUTDOWN |
899 | AT_CLEANUP]) | |
900 | ||
f62a20d8 TR |
901 | m4_define([OVSDB_CHECK_IDL_FETCH_COLUMNS_PY], |
902 | [OVSDB_CHECK_IDL_FETCH_COLUMNS_PYN([$1 - Python2], [$2], [$3], [$4], [$5], [$6], [$7], | |
903 | [$HAVE_PYTHON], [$PYTHON]) | |
904 | OVSDB_CHECK_IDL_FETCH_COLUMNS_PYN([$1 - Python3], [$2], [$3], [$4], [$5], [$6], [$7], | |
905 | [$HAVE_PYTHON3], [$PYTHON3])]) | |
906 | ||
80c12152 SA |
907 | m4_define([OVSDB_CHECK_IDL_FETCH_COLUMNS], |
908 | [OVSDB_CHECK_IDL_FETCH_COLUMNS_PY($@)]) | |
909 | ||
910 | OVSDB_CHECK_IDL_FETCH_COLUMNS([simple idl, initially populated], | |
911 | [['["idltest", | |
912 | {"op": "insert", | |
913 | "table": "simple", | |
914 | "row": {"i": 1, | |
915 | "r": 2.0, | |
916 | "b": true, | |
917 | "s": "mystring", | |
918 | "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"], | |
919 | "ia": ["set", [1, 2, 3]], | |
920 | "ra": ["set", [-0.5]], | |
921 | "ba": ["set", [true]], | |
922 | "sa": ["set", ["abc", "def"]], | |
923 | "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"], | |
924 | ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}}, | |
925 | {"op": "insert", | |
926 | "table": "simple", | |
927 | "row": {}}]']], | |
928 | [?simple:i,r!], | |
929 | ['fetch 0 r'], | |
930 | [[000: i=0 uuid=<0> | |
931 | 000: i=1 uuid=<1> | |
932 | 001: commit, status=success | |
933 | 002: i=0 r=0 uuid=<0> | |
934 | 002: i=1 uuid=<1> | |
935 | 003: done | |
936 | ]]) | |
932104f4 | 937 | |
f62a20d8 TR |
938 | m4_define([OVSDB_CHECK_IDL_WO_MONITOR_COND_PYN], |
939 | [AT_SETUP([$1]) | |
940 | AT_SKIP_IF([test $6 = no]) | |
897c8064 | 941 | AT_KEYWORDS([ovsdb server idl Python monitor $4]) |
56120500 BP |
942 | AT_CHECK([ovsdb_start_idltest]) |
943 | AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/disable-monitor-cond]) | |
f62a20d8 | 944 | AT_CHECK([$7 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket $2], |
7ef00082 | 945 | [0], [stdout], [ignore]) |
c724bd67 | 946 | AT_CHECK([sort stdout | uuidfilt]m4_if([$5],,, [[| $5]]), |
7ef00082 | 947 | [0], [$3]) |
897c8064 LS |
948 | OVSDB_SERVER_SHUTDOWN |
949 | AT_CLEANUP]) | |
950 | ||
f62a20d8 TR |
951 | m4_define([OVSDB_CHECK_IDL_WO_MONITOR_COND_PY], |
952 | [OVSDB_CHECK_IDL_WO_MONITOR_COND_PYN([$1 - Python2], [$2], [$3], [$4], [$5], | |
953 | [$HAVE_PYTHON], [$PYTHON]) | |
954 | OVSDB_CHECK_IDL_WO_MONITOR_COND_PYN([$1 - Python3], [$2], [$3], [$4], [$5], | |
955 | [$HAVE_PYTHON3], [$PYTHON3])]) | |
956 | ||
897c8064 LS |
957 | |
958 | m4_define([OVSDB_CHECK_IDL_WO_MONITOR_COND], | |
959 | [OVSDB_CHECK_IDL_WO_MONITOR_COND_PY($@)]) | |
960 | ||
961 | ||
962 | OVSDB_CHECK_IDL_WO_MONITOR_COND([simple idl disable monitor-cond], | |
963 | [['["idltest", | |
964 | {"op": "insert", | |
965 | "table": "simple", | |
966 | "row": {"i": 1, | |
967 | "r": 2.0, | |
968 | "b": true, | |
969 | "s": "mystring", | |
970 | "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"], | |
971 | "ia": ["set", [1, 2, 3]], | |
972 | "ra": ["set", [-0.5]], | |
973 | "ba": ["set", [true]], | |
974 | "sa": ["set", ["abc", "def"]], | |
975 | "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"], | |
976 | ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}}, | |
977 | {"op": "insert", | |
978 | "table": "simple", | |
979 | "row": {}}]' \ | |
980 | '["idltest", | |
981 | {"op": "update", | |
982 | "table": "simple", | |
983 | "where": [], | |
984 | "row": {"b": true}}]' \ | |
985 | '["idltest", | |
986 | {"op": "update", | |
987 | "table": "simple", | |
988 | "where": [], | |
989 | "row": {"r": 123.5}}]' \ | |
990 | '["idltest", | |
991 | {"op": "insert", | |
992 | "table": "simple", | |
993 | "row": {"i": -1, | |
994 | "r": 125, | |
995 | "b": false, | |
996 | "s": "", | |
997 | "ia": ["set", [1]], | |
998 | "ra": ["set", [1.5]], | |
999 | "ba": ["set", [false]], | |
1000 | "sa": ["set", []], | |
1001 | "ua": ["set", []]}}]' \ | |
1002 | '["idltest", | |
1003 | {"op": "update", | |
1004 | "table": "simple", | |
1005 | "where": [["i", "<", 1]], | |
1006 | "row": {"s": "newstring"}}]' \ | |
1007 | '["idltest", | |
1008 | {"op": "delete", | |
1009 | "table": "simple", | |
1010 | "where": [["i", "==", 0]]}]' \ | |
1011 | 'reconnect']], | |
1012 | [[000: empty | |
1013 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]} | |
1014 | 002: i=0 r=0 b=false s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
1015 | 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> | |
1016 | 003: {"error":null,"result":[{"count":2}]} | |
1017 | 004: i=0 r=0 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
1018 | 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> | |
1019 | 005: {"error":null,"result":[{"count":2}]} | |
1020 | 006: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
1021 | 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> | |
1022 | 007: {"error":null,"result":[{"uuid":["uuid","<6>"]}]} | |
1023 | 008: i=-1 r=125 b=false s= u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
1024 | 008: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
1025 | 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> | |
1026 | 009: {"error":null,"result":[{"count":2}]} | |
1027 | 010: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
1028 | 010: i=0 r=123.5 b=true s=newstring u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
1029 | 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> | |
1030 | 011: {"error":null,"result":[{"count":1}]} | |
1031 | 012: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
1032 | 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> | |
1033 | 013: reconnect | |
1034 | 014: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
1035 | 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> | |
1036 | 015: done | |
1037 | ]]) | |
1038 | ||
932104f4 SA |
1039 | m4_define([OVSDB_CHECK_IDL_TRACK_C], |
1040 | [AT_SETUP([$1 - C]) | |
1041 | AT_KEYWORDS([ovsdb server idl tracking positive $5]) | |
56120500 | 1042 | AT_CHECK([ovsdb_start_idltest]) |
932104f4 | 1043 | m4_if([$2], [], [], |
7427f2a4 | 1044 | [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])]) |
932104f4 | 1045 | AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl unix:socket $3], |
7427f2a4 | 1046 | [0], [stdout], [ignore]) |
c724bd67 | 1047 | AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]), |
7427f2a4 | 1048 | [0], [$4]) |
932104f4 SA |
1049 | OVSDB_SERVER_SHUTDOWN |
1050 | AT_CLEANUP]) | |
1051 | ||
1052 | m4_define([OVSDB_CHECK_IDL_TRACK], | |
1053 | [OVSDB_CHECK_IDL_TRACK_C($@)]) | |
1054 | ||
1055 | OVSDB_CHECK_IDL_TRACK([track, simple idl, initially populated], | |
1056 | [['["idltest", | |
1057 | {"op": "insert", | |
1058 | "table": "simple", | |
1059 | "row": {"i": 1, | |
1060 | "r": 2.0, | |
1061 | "b": true, | |
1062 | "s": "mystring", | |
1063 | "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"], | |
1064 | "ia": ["set", [1, 2, 3]], | |
1065 | "ra": ["set", [-0.5]], | |
1066 | "ba": ["set", [true]], | |
1067 | "sa": ["set", ["abc", "def"]], | |
1068 | "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"], | |
1069 | ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}}, | |
1070 | {"op": "insert", | |
1071 | "table": "simple", | |
1072 | "row": {}}]']], | |
1073 | [['["idltest", | |
1074 | {"op": "update", | |
1075 | "table": "simple", | |
1076 | "where": [], | |
1077 | "row": {"b": true}}]']], | |
1078 | [[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 | 1079 | 000: updated columns: b ba i ia r ra s sa u ua |
932104f4 SA |
1080 | 001: {"error":null,"result":[{"count":2}]} |
1081 | 002: i=0 r=0 b=true s= u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<5> | |
1082 | 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 | 1083 | 002: updated columns: b |
932104f4 SA |
1084 | 003: done |
1085 | ]]) | |
1086 | ||
1087 | OVSDB_CHECK_IDL_TRACK([track, simple idl, initially empty, various ops], | |
1088 | [], | |
1089 | [['["idltest", | |
1090 | {"op": "insert", | |
1091 | "table": "simple", | |
1092 | "row": {"i": 1, | |
1093 | "r": 2.0, | |
1094 | "b": true, | |
1095 | "s": "mystring", | |
1096 | "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"], | |
1097 | "ia": ["set", [1, 2, 3]], | |
1098 | "ra": ["set", [-0.5]], | |
1099 | "ba": ["set", [true]], | |
1100 | "sa": ["set", ["abc", "def"]], | |
1101 | "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"], | |
1102 | ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}}, | |
1103 | {"op": "insert", | |
1104 | "table": "simple", | |
1105 | "row": {}}]' \ | |
1106 | '["idltest", | |
1107 | {"op": "update", | |
1108 | "table": "simple", | |
1109 | "where": [], | |
1110 | "row": {"b": true}}]' \ | |
1111 | '["idltest", | |
1112 | {"op": "update", | |
1113 | "table": "simple", | |
1114 | "where": [], | |
1115 | "row": {"r": 123.5}}]' \ | |
1116 | '["idltest", | |
1117 | {"op": "insert", | |
1118 | "table": "simple", | |
1119 | "row": {"i": -1, | |
1120 | "r": 125, | |
1121 | "b": false, | |
1122 | "s": "", | |
1123 | "ia": ["set", [1]], | |
1124 | "ra": ["set", [1.5]], | |
1125 | "ba": ["set", [false]], | |
1126 | "sa": ["set", []], | |
1127 | "ua": ["set", []]}}]' \ | |
1128 | '["idltest", | |
1129 | {"op": "update", | |
1130 | "table": "simple", | |
1131 | "where": [["i", "<", 1]], | |
1132 | "row": {"s": "newstring"}}]' \ | |
1133 | '["idltest", | |
1134 | {"op": "delete", | |
1135 | "table": "simple", | |
1136 | "where": [["i", "==", 0]]}]' \ | |
1137 | 'reconnect']], | |
1138 | [[000: empty | |
1139 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]} | |
1140 | 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 | 1141 | 002: updated columns: b ba i ia r ra s sa u ua |
932104f4 SA |
1142 | 003: {"error":null,"result":[{"count":2}]} |
1143 | 004: i=0 r=0 b=true s= u=<5> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
32d37ce8 | 1144 | 004: updated columns: b |
932104f4 SA |
1145 | 005: {"error":null,"result":[{"count":2}]} |
1146 | 006: i=0 r=123.5 b=true s= u=<5> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
1147 | 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 |
1148 | 006: updated columns: r |
1149 | 006: updated columns: r | |
932104f4 SA |
1150 | 007: {"error":null,"result":[{"uuid":["uuid","<6>"]}]} |
1151 | 008: i=-1 r=125 b=false s= u=<5> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
32d37ce8 | 1152 | 008: updated columns: ba i ia r ra |
932104f4 SA |
1153 | 009: {"error":null,"result":[{"count":2}]} |
1154 | 010: i=-1 r=125 b=false s=newstring u=<5> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
1155 | 010: i=0 r=123.5 b=true s=newstring u=<5> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
32d37ce8 SA |
1156 | 010: updated columns: s |
1157 | 010: updated columns: s | |
932104f4 SA |
1158 | 011: {"error":null,"result":[{"count":1}]} |
1159 | 012: ##deleted## uuid=<1> | |
1160 | 013: reconnect | |
1161 | 014: i=-1 r=125 b=false s=newstring u=<5> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
1162 | 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 |
1163 | 014: updated columns: b ba i ia r ra s sa u ua |
1164 | 014: updated columns: ba i ia r ra s | |
932104f4 SA |
1165 | 015: done |
1166 | ]]) | |
7251075c EA |
1167 | |
1168 | m4_define([OVSDB_CHECK_IDL_PARTIAL_UPDATE_MAP_COLUMN], | |
1169 | [AT_SETUP([$1 - C]) | |
1170 | AT_KEYWORDS([ovsdb server idl partial update map column positive $5]) | |
56120500 | 1171 | AT_CHECK([ovsdb_start_idltest]) |
7251075c | 1172 | m4_if([$2], [], [], |
7427f2a4 | 1173 | [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])]) |
7251075c | 1174 | AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl-partial-update-map-column unix:socket $3], |
7427f2a4 | 1175 | [0], [stdout], [ignore]) |
c724bd67 | 1176 | AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]), |
7427f2a4 | 1177 | [0], [$4]) |
7251075c EA |
1178 | OVSDB_SERVER_SHUTDOWN |
1179 | AT_CLEANUP]) | |
1180 | ||
1181 | OVSDB_CHECK_IDL_PARTIAL_UPDATE_MAP_COLUMN([map, simple2 idl-partial-update-map-column, initially populated], | |
1182 | [['["idltest", {"op":"insert", "table":"simple2", | |
1183 | "row":{"name":"myString1","smap":["map",[["key1","value1"],["key2","value2"]]]} }]'] | |
1184 | ], | |
1185 | [], | |
1186 | [[000: Getting records | |
1187 | 001: name=myString1 smap=[[key1 : value1],[key2 : value2]] imap=[] | |
1188 | 002: After insert element | |
1189 | 003: name=String2 smap=[[key1 : myList1],[key2 : value2]] imap=[[3 : myids2]] | |
1190 | 004: After insert duplicated element | |
1191 | 005: name=String2 smap=[[key1 : myList1],[key2 : value2]] imap=[[3 : myids2]] | |
1192 | 006: After delete element | |
1193 | 007: name=String2 smap=[[key2 : value2]] imap=[[3 : myids2]] | |
1194 | 008: After trying to delete a deleted element | |
1195 | 009: name=String2 smap=[[key2 : value2]] imap=[[3 : myids2]] | |
1196 | 010: End test | |
1197 | ]]) | |
a7261bf7 | 1198 | |
a59912a0 RM |
1199 | OVSDB_CHECK_IDL_PY([partial-map idl], |
1200 | [['["idltest", {"op":"insert", "table":"simple2", | |
330b9c9c | 1201 | "row":{"name":"myString1","smap":["map",[["key1","value1"],["key2","value2"]]]} }]'] |
a59912a0 | 1202 | ], |
2d54d801 | 1203 | [?simple2:name,smap,imap 'partialmapinsertelement' 'partialmapinsertmultipleelements' 'partialmapdelelements' 'partialmapmutatenew'], |
330b9c9c | 1204 | [[000: name=myString1 smap=[(key1 value1) (key2 value2)] imap=[] |
a59912a0 | 1205 | 001: commit, status=success |
330b9c9c | 1206 | 002: name=String2 smap=[(key1 myList1) (key2 value2)] imap=[(3 myids2)] |
a59912a0 | 1207 | 003: commit, status=success |
2d54d801 | 1208 | 004: name=String2 smap=[(key1 myList1) (key2 myList2) (key3 myList3) (key4 myList4)] imap=[(3 myids2)] |
330b9c9c AB |
1209 | 005: commit, status=success |
1210 | 006: name=String2 smap=[(key2 myList2)] imap=[(3 myids2)] | |
2d54d801 AB |
1211 | 007: commit, status=success |
1212 | 008: name=String2 smap=[(key2 myList2)] imap=[(3 myids2)] | |
1213 | 008: name=String2New smap=[(key1 newList1) (key2 newList2)] imap=[] | |
1214 | 009: done | |
a59912a0 RM |
1215 | ]]) |
1216 | ||
f1ab6e06 RM |
1217 | m4_define([OVSDB_CHECK_IDL_PARTIAL_UPDATE_SET_COLUMN], |
1218 | [AT_SETUP([$1 - C]) | |
1219 | AT_KEYWORDS([ovsdb server idl partial update set column positive $5]) | |
56120500 | 1220 | AT_CHECK([ovsdb_start_idltest]) |
f1ab6e06 RM |
1221 | m4_if([$2], [], [], |
1222 | [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])]) | |
1223 | AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl-partial-update-set-column unix:socket $3], | |
1224 | [0], [stdout], [ignore]) | |
c724bd67 | 1225 | AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]), |
f1ab6e06 RM |
1226 | [0], [$4]) |
1227 | OVSDB_SERVER_SHUTDOWN | |
1228 | AT_CLEANUP]) | |
1229 | ||
1230 | OVSDB_CHECK_IDL_PARTIAL_UPDATE_SET_COLUMN([set, simple3 idl-partial-update-set-column, initially populated], | |
1231 | [['["idltest", {"op":"insert", "table":"simple3", | |
1232 | "row":{"name":"mySet1","uset":["set", [[ "uuid", "0005b872-f9e5-43be-ae02-3184b9680e75" ], [ "uuid", "000d2f6a-76af-412f-b59d-e7bcd3e84eff" ]]]} }]'] | |
1233 | ], | |
1234 | [], | |
1235 | [[000: Getting records | |
1236 | 001: name=mySet1 uset=[[<0>],[<1>]] uref=[] | |
1237 | 002: After rename+add new value | |
1238 | 003: name=String2 uset=[[<0>],[<1>],[<2>]] uref=[] | |
1239 | 004: After add new value | |
1240 | 005: name=String2 uset=[[<0>],[<1>],[<2>],[<3>]] uref=[] | |
1241 | 006: After delete value | |
1242 | 007: name=String2 uset=[[<0>],[<1>],[<3>]] uref=[] | |
1243 | 008: After trying to delete a deleted value | |
1244 | 009: name=String2 uset=[[<0>],[<1>],[<3>]] uref=[] | |
1245 | 010: After add to other table + set of strong ref | |
1246 | 011: name=String2 uset=[[<0>],[<1>],[<3>]] uref=[[<4>]] | |
1247 | 012: End test | |
1248 | ]]) | |
1249 | ||
a59912a0 | 1250 | OVSDB_CHECK_IDL_PY([partial-set idl], |
b3220c67 AB |
1251 | [['["idltest", {"op":"insert", "table":"simple3", "uuid-name":"newrow", |
1252 | "row":{"name":"mySet1","uset":["set", [[ "uuid", "0005b872-f9e5-43be-ae02-3184b9680e75" ]]]} }, | |
1253 | {"op":"insert", "table":"simple4", "row":{"name":"seed"}}, | |
1254 | {"op":"mutate", "table":"simple3", "where":[["_uuid", "==", ["named-uuid", "newrow"]]], | |
1255 | "mutations": [["uset", "insert", ["set", [["uuid", "000d2f6a-76af-412f-b59d-e7bcd3e84eff"]]]]]}]'] | |
a59912a0 | 1256 | ], |
2d54d801 | 1257 | ['partialrenamesetadd' 'partialduplicateadd' 'partialsetdel' 'partialsetref' 'partialsetoverrideops' 'partialsetadddelete' 'partialsetmutatenew'], |
a59912a0 RM |
1258 | [[000: name=mySet1 uset=[<0> <1>] |
1259 | 001: commit, status=success | |
1260 | 002: name=String2 uset=[<0> <1> <2>] | |
1261 | 003: commit, status=success | |
1262 | 004: name=String2 uset=[<0> <1> <2> <3>] | |
1263 | 005: commit, status=success | |
1264 | 006: name=String2 uset=[<0> <1> <3>] | |
1265 | 007: commit, status=success | |
1266 | 008: name=String2 uset=[<0> <1> <3>] | |
330b9c9c AB |
1267 | 009: commit, status=success |
1268 | 010: name=String2 uset=[<3>] | |
b3220c67 | 1269 | 011: commit, status=success |
2d54d801 AB |
1270 | 012: name=String2 uset=[<4> <5>] |
1271 | 013: commit, status=success | |
1272 | 014: name=String2 uset=[<4> <5>] | |
1273 | 014: name=String3 uset=[<6>] | |
1274 | 015: done | |
a59912a0 RM |
1275 | ]]) |
1276 | ||
f62a20d8 | 1277 | m4_define([OVSDB_CHECK_IDL_NOTIFY_PYN], |
b4273ac9 | 1278 | [OVSDB_CHECK_IDL_PYN([$1], [], [$2], [$3], [notify $4], [$5], [$6], [$7])]) |
a7261bf7 | 1279 | |
f62a20d8 TR |
1280 | m4_define([OVSDB_CHECK_IDL_NOTIFY_PY], |
1281 | [OVSDB_CHECK_IDL_NOTIFY_PYN([$1 - Python2], [$2], [$3], [$4], [$5], | |
1282 | [$HAVE_PYTHON], [$PYTHON]) | |
1283 | OVSDB_CHECK_IDL_NOTIFY_PYN([$1 - Python3], [$2], [$3], [$4], [$5], | |
1284 | [$HAVE_PYTHON3], [$PYTHON3])]) | |
1285 | ||
d90ed7d6 | 1286 | # This test uses the Python IDL implementation with ssl |
f62a20d8 | 1287 | m4_define([OVSDB_CHECK_IDL_NOTIFY_SSL_PYN], |
61845323 | 1288 | [OVSDB_CHECK_IDL_SSL_PYN([$1], [], [$2], [$3], [notify $4], [$5], [$6], [$7])]) |
a7261bf7 | 1289 | |
f62a20d8 TR |
1290 | m4_define([OVSDB_CHECK_IDL_NOTIFY_SSL_PY], |
1291 | [OVSDB_CHECK_IDL_NOTIFY_SSL_PYN([$1 - Python2], [$2], [$3], [$4], [$5], | |
1292 | [$HAVE_PYTHON], [$PYTHON]) | |
1293 | OVSDB_CHECK_IDL_NOTIFY_SSL_PYN([$1 - Python3], [$2], [$3], [$4], [$5], | |
1294 | [$HAVE_PYTHON3], [$PYTHON3])]) | |
1295 | ||
a7261bf7 | 1296 | m4_define([OVSDB_CHECK_IDL_NOTIFY], |
d90ed7d6 NS |
1297 | [OVSDB_CHECK_IDL_NOTIFY_PY($@) |
1298 | OVSDB_CHECK_IDL_NOTIFY_SSL_PY($@)]) | |
a7261bf7 NS |
1299 | |
1300 | OVSDB_CHECK_IDL_NOTIFY([simple idl verify notify], | |
1301 | [['track-notify' \ | |
1302 | '["idltest", | |
1303 | {"op": "insert", | |
1304 | "table": "simple", | |
1305 | "row": {"i": 1, | |
1306 | "r": 2.0, | |
1307 | "b": true, | |
1308 | "s": "mystring", | |
1309 | "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"], | |
1310 | "ia": ["set", [1, 2, 3]], | |
1311 | "ra": ["set", [-0.5]], | |
1312 | "ba": ["set", [true]], | |
1313 | "sa": ["set", ["abc", "def"]], | |
1314 | "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"], | |
1315 | ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}}, | |
1316 | {"op": "insert", | |
1317 | "table": "simple", | |
1318 | "row": {}}]' \ | |
1319 | '["idltest", | |
1320 | {"op": "update", | |
1321 | "table": "simple", | |
1322 | "where": [], | |
1323 | "row": {"b": false}}]' \ | |
1324 | '["idltest", | |
1325 | {"op": "update", | |
1326 | "table": "simple", | |
1327 | "where": [], | |
1328 | "row": {"r": 123.5}}]' \ | |
1329 | '["idltest", | |
1330 | {"op": "insert", | |
1331 | "table": "simple", | |
1332 | "row": {"i": -1, | |
1333 | "r": 125, | |
1334 | "b": false, | |
1335 | "s": "", | |
1336 | "ia": ["set", [1]], | |
1337 | "ra": ["set", [1.5]], | |
1338 | "ba": ["set", [false]], | |
1339 | "sa": ["set", []], | |
1340 | "ua": ["set", []]}}]' \ | |
1341 | '["idltest", | |
1342 | {"op": "update", | |
1343 | "table": "simple", | |
1344 | "where": [["i", "<", 1]], | |
1345 | "row": {"s": "newstring"}}]' \ | |
1346 | '["idltest", | |
1347 | {"op": "delete", | |
1348 | "table": "simple", | |
1349 | "where": [["i", "==", 0]]}]' \ | |
1350 | 'reconnect']], | |
1351 | [[000: empty | |
1352 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]} | |
1353 | 002: event:create, row={i=0 r=0 b=false s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>}, updates=None | |
1354 | 002: event:create, row={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>}, updates=None | |
1355 | 002: i=0 r=0 b=false s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
1356 | 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> | |
1357 | 003: {"error":null,"result":[{"count":2}]} | |
1358 | 004: event:update, row={i=1 r=2 b=false s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0>}, updates={b=true uuid=<0>} | |
1359 | 004: i=0 r=0 b=false s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
1360 | 004: i=1 r=2 b=false s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> | |
1361 | 005: {"error":null,"result":[{"count":2}]} | |
1362 | 006: event:update, row={i=0 r=123.5 b=false s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>}, updates={r=0 uuid=<1>} | |
1363 | 006: event:update, row={i=1 r=123.5 b=false s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0>}, updates={r=2 uuid=<0>} | |
1364 | 006: i=0 r=123.5 b=false s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
1365 | 006: i=1 r=123.5 b=false s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> | |
1366 | 007: {"error":null,"result":[{"uuid":["uuid","<6>"]}]} | |
1367 | 008: event:create, row={i=-1 r=125 b=false s= u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>}, updates=None | |
1368 | 008: i=-1 r=125 b=false s= u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
1369 | 008: i=0 r=123.5 b=false s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
1370 | 008: i=1 r=123.5 b=false s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> | |
1371 | 009: {"error":null,"result":[{"count":2}]} | |
1372 | 010: event:update, row={i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>}, updates={s= uuid=<6>} | |
1373 | 010: event:update, row={i=0 r=123.5 b=false s=newstring u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>}, updates={s= uuid=<1>} | |
1374 | 010: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
1375 | 010: i=0 r=123.5 b=false s=newstring u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
1376 | 010: i=1 r=123.5 b=false s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> | |
1377 | 011: {"error":null,"result":[{"count":1}]} | |
1378 | 012: event:delete, row={i=0 r=123.5 b=false s=newstring u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>}, updates=None | |
1379 | 012: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
1380 | 012: i=1 r=123.5 b=false s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> | |
1381 | 013: reconnect | |
1382 | 014: event:create, row={i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>}, updates=None | |
1383 | 014: event:create, row={i=1 r=123.5 b=false s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0>}, updates=None | |
1384 | 014: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
1385 | 014: i=1 r=123.5 b=false s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> | |
1386 | 015: done | |
1387 | ]]) | |
0a8606ee LR |
1388 | |
1389 | # Tests to verify the functionality of the one column compound index. | |
1390 | # It tests index for one column string and integer indexes. | |
1391 | # The run of test-ovsdb generates the output of the display of data using the different indexes defined in | |
1392 | # the program. | |
1393 | # Then, some at_checks are used to verify the correctness of the corresponding index as well as the existence | |
1394 | # of all the rows involved in the test. | |
1395 | m4_define([OVSDB_CHECK_IDL_COMPOUND_INDEX_SINGLE_COLUMN_C], | |
1396 | [AT_SETUP([$1 - C]) | |
1397 | AT_KEYWORDS([ovsdb server idl compound_index_single_column compound_index positive $5]) | |
1398 | AT_CHECK([ovsdb_start_idltest]) | |
1399 | m4_if([$2], [], [], | |
7ef00082 | 1400 | [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])]) |
0a8606ee LR |
1401 | # Generate the data to be tested. |
1402 | AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl-compound-index unix:socket $3], | |
7ef00082 | 1403 | [0], [stdout], [ignore]) |
0a8606ee LR |
1404 | # Filter the rows of data that corresponds to the string index eliminating the extra columns of data. |
1405 | # This is done to verifiy that the output data is in the correct and expected order. | |
1406 | AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: s=.*' | sed -e 's/ i=.*//g']], | |
7ef00082 | 1407 | [0], [$4]) |
0a8606ee LR |
1408 | # Here, the data is filtered and sorted in order to have all the rows in the index and be |
1409 | # able to determined that all the involved rows are present. | |
1410 | AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: s=.*' | sort -k 1,1n -k 2,2 -k 3,3]], | |
7ef00082 | 1411 | [0], [$5]) |
0a8606ee LR |
1412 | # Filter the rows of data that corresponds to the integer index eliminating the extra columns of data. |
1413 | # This is done to verifiy that the output data is in the correct and expected order. | |
1414 | AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: i=.*' | sed -e 's/ s=.*//g']], | |
7ef00082 | 1415 | [0], [$6]) |
0a8606ee LR |
1416 | # Here again, the data is filtered and sorted in order to have all the rows in the index and be |
1417 | # able to determined that all the involved rows are present. | |
1418 | AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: i=.*' | sort -k 1,1n -k 2,2 -k 3,3]], | |
7ef00082 | 1419 | [0], [$7]) |
0a8606ee LR |
1420 | OVSDB_SERVER_SHUTDOWN |
1421 | AT_CLEANUP]) | |
1422 | ||
1423 | OVSDB_CHECK_IDL_COMPOUND_INDEX_SINGLE_COLUMN_C([Compound_index, single column test ], | |
1424 | [['["idltest", | |
1425 | {"op": "insert", "table": "simple", "row": {"s":"List000", "i": 1, "b":true, "r":101.0}}, | |
1426 | {"op": "insert", "table": "simple", "row": {"s":"List000", "i": 2, "b":false, "r":102.0}}, | |
1427 | {"op": "insert", "table": "simple", "row": {"s":"List000", "i": 10, "b":true, "r":110.0}}, | |
1428 | {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 1, "b":false, "r":110.0}}, | |
1429 | {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 2, "b":true, "r":120.0}}, | |
1430 | {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 2, "b":true, "r":122.0}}, | |
1431 | {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 4, "b":true, "r":130.0}}, | |
1432 | {"op": "insert", "table": "simple", "row": {"s":"List005", "i": 5, "b":true, "r":130.0}}, | |
1433 | {"op": "insert", "table": "simple", "row": {"s":"List020", "i": 20, "b":true, "r":220.0}}, | |
1434 | {"op": "insert", "table": "simple", "row": {"s":"List020", "i": 19, "b":true, "r":219.0}} | |
1435 | ]']], | |
1436 | [idl_compound_index_single_column], | |
1437 | [001: s=List000 | |
1438 | 001: s=List000 | |
1439 | 001: s=List000 | |
1440 | 001: s=List001 | |
1441 | 001: s=List001 | |
1442 | 001: s=List001 | |
1443 | 001: s=List001 | |
1444 | 001: s=List005 | |
1445 | 001: s=List020 | |
1446 | 001: s=List020 | |
1447 | 003: s=List001 | |
1448 | 003: s=List001 | |
1449 | 003: s=List001 | |
1450 | 003: s=List001 | |
1451 | ], | |
1452 | [001: s=List000 i=1 b=True r=101.000000 | |
1453 | 001: s=List000 i=10 b=True r=110.000000 | |
1454 | 001: s=List000 i=2 b=False r=102.000000 | |
1455 | 001: s=List001 i=1 b=False r=110.000000 | |
1456 | 001: s=List001 i=2 b=True r=120.000000 | |
1457 | 001: s=List001 i=2 b=True r=122.000000 | |
1458 | 001: s=List001 i=4 b=True r=130.000000 | |
1459 | 001: s=List005 i=5 b=True r=130.000000 | |
1460 | 001: s=List020 i=19 b=True r=219.000000 | |
1461 | 001: s=List020 i=20 b=True r=220.000000 | |
1462 | 003: s=List001 i=1 b=False r=110.000000 | |
1463 | 003: s=List001 i=2 b=True r=120.000000 | |
1464 | 003: s=List001 i=2 b=True r=122.000000 | |
1465 | 003: s=List001 i=4 b=True r=130.000000 | |
1466 | ], | |
1467 | [002: i=1 | |
1468 | 002: i=1 | |
1469 | 002: i=2 | |
1470 | 002: i=2 | |
1471 | 002: i=2 | |
1472 | 002: i=4 | |
1473 | 002: i=5 | |
1474 | 002: i=10 | |
1475 | 002: i=19 | |
1476 | 002: i=20 | |
1477 | 004: i=5 | |
1478 | 005: i=4 | |
1479 | 005: i=5 | |
1480 | 006: i=5 | |
1481 | 006: i=10 | |
1482 | 006: i=19 | |
1483 | 006: i=20 | |
1484 | 006: i=54 | |
1485 | 007: i=1 | |
1486 | 007: i=1 | |
1487 | 007: i=2 | |
1488 | 007: i=2 | |
1489 | 007: i=2 | |
1490 | 007: i=5 | |
1491 | 007: i=10 | |
1492 | 007: i=19 | |
1493 | 007: i=20 | |
1494 | 007: i=54 | |
1495 | ], | |
1496 | [002: i=1 s=List000 b=True r=101.000000 | |
1497 | 002: i=1 s=List001 b=False r=110.000000 | |
1498 | 002: i=10 s=List000 b=True r=110.000000 | |
1499 | 002: i=19 s=List020 b=True r=219.000000 | |
1500 | 002: i=2 s=List000 b=False r=102.000000 | |
1501 | 002: i=2 s=List001 b=True r=120.000000 | |
1502 | 002: i=2 s=List001 b=True r=122.000000 | |
1503 | 002: i=20 s=List020 b=True r=220.000000 | |
1504 | 002: i=4 s=List001 b=True r=130.000000 | |
1505 | 002: i=5 s=List005 b=True r=130.000000 | |
1506 | 004: i=5 s=List005 b=True r=130.000000 | |
1507 | 005: i=4 s=List001 b=True r=130.000000 | |
1508 | 005: i=5 s=List005 b=True r=130.000000 | |
1509 | 006: i=10 s=List000 b=True r=110.000000 | |
1510 | 006: i=19 s=List020 b=True r=219.000000 | |
1511 | 006: i=20 s=List020 b=True r=220.000000 | |
1512 | 006: i=5 s=List005 b=True r=130.000000 | |
1513 | 006: i=54 s=Lista054 b=False r=0.000000 | |
1514 | 007: i=1 s=List000 b=True r=101.000000 | |
1515 | 007: i=1 s=List001 b=False r=110.000000 | |
1516 | 007: i=10 s=List000 b=True r=110.000000 | |
1517 | 007: i=19 s=List020 b=True r=219.000000 | |
1518 | 007: i=2 s=List000 b=False r=102.000000 | |
1519 | 007: i=2 s=List001 b=True r=120.000000 | |
1520 | 007: i=2 s=List001 b=True r=122.000000 | |
1521 | 007: i=20 s=List020 b=True r=220.000000 | |
1522 | 007: i=5 s=List005 b=True r=130.000000 | |
1523 | 007: i=54 s=Lista054 b=False r=0.000000 | |
1524 | ]) | |
1525 | ||
1526 | # Tests to verify the functionality of two column compound index. | |
1527 | # It tests index for two columns using string and integer fields. | |
1528 | # The run of test-ovsdb generates the output of the display of data using the different indexes defined in | |
1529 | # the program. | |
1530 | # Then, some at_checks are used to verify the correctness of the corresponding index as well as the existence | |
1531 | # of all the rows involved in the test. | |
1532 | m4_define([OVSDB_CHECK_IDL_COMPOUND_INDEX_DOUBLE_COLUMN_C], | |
1533 | [AT_SETUP([$1 - C]) | |
1534 | AT_KEYWORDS([ovsdb server idl compound_index_double_column compound_index positive $5]) | |
1535 | AT_CHECK([ovsdb_start_idltest]) | |
1536 | m4_if([$2], [], [], | |
7ef00082 | 1537 | [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])]) |
0a8606ee LR |
1538 | # Generate the data to be tested. |
1539 | AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl-compound-index unix:socket $3], | |
7ef00082 | 1540 | [0], [stdout], [ignore]) |
0a8606ee LR |
1541 | # Filter the rows of data that corresponds to the string-integer index eliminating the extra columns of data. |
1542 | # This is done to verifiy that the output data is in the correct and expected order. | |
1543 | AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: s=.*' | sed -e 's/ b=.*//g']], | |
7ef00082 | 1544 | [0], [$4]) |
0a8606ee LR |
1545 | # Here, the data is filtered and sorted in order to have all the rows in the index and be |
1546 | # able to determined that all the involved rows are present. | |
1547 | AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: s=.*' | sort -k 1,1n -k 2,2 -k 3,3]], | |
7ef00082 | 1548 | [0], [$5]) |
0a8606ee LR |
1549 | # Filter the rows of data that corresponds to the integer index eliminating the extra columns of data. |
1550 | # This is done to verifiy that the output data is in the correct and expected order. | |
1551 | AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: i=.*' | sed -e 's/ b=.*//g']], | |
7ef00082 | 1552 | [0], [$6]) |
0a8606ee LR |
1553 | # Here again, the data is filtered and sorted in order to have all the rows in the index and be |
1554 | # able to determined that all the involved rows are present. | |
1555 | AT_CHECK([[cat stdout | grep -oh '[0-9]\{3\}: i=.*' | sort -k 1,1n -k 2,2 -k 3,3]], | |
7ef00082 | 1556 | [0], [$7]) |
0a8606ee LR |
1557 | OVSDB_SERVER_SHUTDOWN |
1558 | AT_CLEANUP]) | |
1559 | ||
1560 | OVSDB_CHECK_IDL_COMPOUND_INDEX_DOUBLE_COLUMN_C([Compound_index, double column test ], | |
1561 | [['["idltest", | |
1562 | {"op": "insert", "table": "simple", "row": {"s":"List000", "i": 1, "b":true, "r":101.0}}, | |
1563 | {"op": "insert", "table": "simple", "row": {"s":"List000", "i": 2, "b":false, "r":102.0}}, | |
1564 | {"op": "insert", "table": "simple", "row": {"s":"List000", "i": 10, "b":true, "r":110.0}}, | |
1565 | {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 1, "b":false, "r":110.0}}, | |
1566 | {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 2, "b":true, "r":120.0}}, | |
1567 | {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 2, "b":true, "r":122.0}}, | |
1568 | {"op": "insert", "table": "simple", "row": {"s":"List001", "i": 4, "b":true, "r":130.0}}, | |
1569 | {"op": "insert", "table": "simple", "row": {"s":"List005", "i": 5, "b":true, "r":130.0}}, | |
1570 | {"op": "insert", "table": "simple", "row": {"s":"List020", "i": 20, "b":true, "r":220.0}}, | |
1571 | {"op": "insert", "table": "simple", "row": {"s":"List020", "i": 19, "b":true, "r":219.0}} | |
1572 | ]']], | |
1573 | [idl_compound_index_double_column], | |
1574 | [001: s=List000 i=1 | |
1575 | 001: s=List000 i=2 | |
1576 | 001: s=List000 i=10 | |
1577 | 001: s=List001 i=1 | |
1578 | 001: s=List001 i=2 | |
1579 | 001: s=List001 i=2 | |
1580 | 001: s=List001 i=4 | |
1581 | 001: s=List005 i=5 | |
1582 | 001: s=List020 i=19 | |
1583 | 001: s=List020 i=20 | |
1584 | 002: s=List000 i=10 | |
1585 | 002: s=List000 i=2 | |
1586 | 002: s=List000 i=1 | |
1587 | 002: s=List001 i=4 | |
1588 | 002: s=List001 i=2 | |
1589 | 002: s=List001 i=2 | |
1590 | 002: s=List001 i=1 | |
1591 | 002: s=List005 i=5 | |
1592 | 002: s=List020 i=20 | |
1593 | 002: s=List020 i=19 | |
1594 | 003: s=List000 i=10 | |
1595 | 004: s=List001 i=1 | |
1596 | 004: s=List001 i=2 | |
1597 | 004: s=List001 i=2 | |
1598 | 004: s=List001 i=4 | |
1599 | 004: s=List005 i=5 | |
1600 | ], | |
1601 | [001: s=List000 i=1 b=True r=101.000000 | |
1602 | 001: s=List000 i=10 b=True r=110.000000 | |
1603 | 001: s=List000 i=2 b=False r=102.000000 | |
1604 | 001: s=List001 i=1 b=False r=110.000000 | |
1605 | 001: s=List001 i=2 b=True r=120.000000 | |
1606 | 001: s=List001 i=2 b=True r=122.000000 | |
1607 | 001: s=List001 i=4 b=True r=130.000000 | |
1608 | 001: s=List005 i=5 b=True r=130.000000 | |
1609 | 001: s=List020 i=19 b=True r=219.000000 | |
1610 | 001: s=List020 i=20 b=True r=220.000000 | |
1611 | 002: s=List000 i=1 b=True r=101.000000 | |
1612 | 002: s=List000 i=10 b=True r=110.000000 | |
1613 | 002: s=List000 i=2 b=False r=102.000000 | |
1614 | 002: s=List001 i=1 b=False r=110.000000 | |
1615 | 002: s=List001 i=2 b=True r=120.000000 | |
1616 | 002: s=List001 i=2 b=True r=122.000000 | |
1617 | 002: s=List001 i=4 b=True r=130.000000 | |
1618 | 002: s=List005 i=5 b=True r=130.000000 | |
1619 | 002: s=List020 i=19 b=True r=219.000000 | |
1620 | 002: s=List020 i=20 b=True r=220.000000 | |
1621 | 003: s=List000 i=10 b=True r=110.000000 | |
1622 | 004: s=List001 i=1 b=False r=110.000000 | |
1623 | 004: s=List001 i=2 b=True r=120.000000 | |
1624 | 004: s=List001 i=2 b=True r=122.000000 | |
1625 | 004: s=List001 i=4 b=True r=130.000000 | |
1626 | 004: s=List005 i=5 b=True r=130.000000 | |
1627 | ], | |
1628 | [005: i=1 s=List000 | |
1629 | 005: i=1 s=List001 | |
1630 | 005: i=2 s=List000 | |
1631 | 005: i=2 s=List001 | |
1632 | 005: i=2 s=List001 | |
1633 | 005: i=4 s=List001 | |
1634 | 005: i=5 s=List005 | |
1635 | 005: i=10 s=List000 | |
1636 | 005: i=19 s=List020 | |
1637 | 005: i=20 s=List020 | |
1638 | 006: i=20 s=List020 | |
1639 | 006: i=19 s=List020 | |
1640 | 006: i=10 s=List000 | |
1641 | 006: i=5 s=List005 | |
1642 | 006: i=4 s=List001 | |
1643 | 006: i=2 s=List000 | |
1644 | 006: i=2 s=List001 | |
1645 | 006: i=2 s=List001 | |
1646 | 006: i=1 s=List000 | |
1647 | 006: i=1 s=List001 | |
1648 | ], | |
1649 | [005: i=1 s=List000 b=True r=101.000000 | |
1650 | 005: i=1 s=List001 b=False r=110.000000 | |
1651 | 005: i=10 s=List000 b=True r=110.000000 | |
1652 | 005: i=19 s=List020 b=True r=219.000000 | |
1653 | 005: i=2 s=List000 b=False r=102.000000 | |
1654 | 005: i=2 s=List001 b=True r=120.000000 | |
1655 | 005: i=2 s=List001 b=True r=122.000000 | |
1656 | 005: i=20 s=List020 b=True r=220.000000 | |
1657 | 005: i=4 s=List001 b=True r=130.000000 | |
1658 | 005: i=5 s=List005 b=True r=130.000000 | |
1659 | 006: i=1 s=List000 b=True r=101.000000 | |
1660 | 006: i=1 s=List001 b=False r=110.000000 | |
1661 | 006: i=10 s=List000 b=True r=110.000000 | |
1662 | 006: i=19 s=List020 b=True r=219.000000 | |
1663 | 006: i=2 s=List000 b=False r=102.000000 | |
1664 | 006: i=2 s=List001 b=True r=120.000000 | |
1665 | 006: i=2 s=List001 b=True r=122.000000 | |
1666 | 006: i=20 s=List020 b=True r=220.000000 | |
1667 | 006: i=4 s=List001 b=True r=130.000000 | |
1668 | 006: i=5 s=List005 b=True r=130.000000 | |
1669 | ]) | |
3cc1634f HZ |
1670 | |
1671 | m4_define([OVSDB_CHECK_IDL_COMPOUND_INDEX_WITH_REF], | |
1672 | [AT_SETUP([$1 - C]) | |
1673 | AT_KEYWORDS([ovsdb server idl compound_index compound_index_with_ref positive $5]) | |
1674 | AT_CHECK([ovsdb_start_idltest]) | |
1675 | m4_if([$2], [], [], | |
1676 | [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])]) | |
1677 | AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl-compound-index-with-ref unix:socket $3], | |
1678 | [0], [stdout], [ignore]) | |
c724bd67 | 1679 | AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]), |
3cc1634f HZ |
1680 | [0], [$4]) |
1681 | OVSDB_SERVER_SHUTDOWN | |
1682 | AT_CLEANUP]) | |
1683 | ||
1684 | OVSDB_CHECK_IDL_COMPOUND_INDEX_WITH_REF([set, simple3 idl-compound-index-with-ref, initially populated], | |
1685 | [], | |
1686 | [], | |
1687 | [[000: After add to other table + set of strong ref | |
1688 | 001: name= uset=[] uref=[[<0>]] | |
1689 | 002: check simple4: not empty | |
1690 | 003: Query using index with reference | |
1691 | 004: name= uset=[] uref=[[<0>]] | |
1692 | 005: After delete | |
1693 | 007: check simple4: empty | |
1694 | 008: End test | |
1695 | ]]) |