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