]>
Commit | Line | Data |
---|---|---|
c3bb4bd7 BP |
1 | AT_BANNER([OVSDB -- interface description language (IDL)]) |
2 | ||
8cdf0349 BP |
3 | # OVSDB_CHECK_IDL_C(TITLE, [PRE-IDL-TXN], TRANSACTIONS, OUTPUT, [KEYWORDS], |
4 | # [FILTER]) | |
c3bb4bd7 BP |
5 | # |
6 | # Creates a database with a schema derived from idltest.ovsidl, runs | |
7 | # each PRE-IDL-TXN (if any), starts an ovsdb-server on that database, | |
8 | # and runs "test-ovsdb idl" passing each of the TRANSACTIONS along. | |
9 | # | |
10 | # Checks that the overall output is OUTPUT. Before comparison, the | |
11 | # output is sorted (using "sort") and UUIDs in the output are replaced | |
12 | # by markers of the form <N> where N is a number. The first unique | |
13 | # UUID is replaced by <0>, the next by <1>, and so on. If a given | |
14 | # UUID appears more than once it is always replaced by the same | |
254604d8 BP |
15 | # marker. If FILTER is supplied then the output is also filtered |
16 | # through the specified program. | |
c3bb4bd7 BP |
17 | # |
18 | # TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS. | |
8cdf0349 BP |
19 | m4_define([OVSDB_CHECK_IDL_C], |
20 | [AT_SETUP([$1 - C]) | |
c3bb4bd7 | 21 | AT_KEYWORDS([ovsdb server idl positive $5]) |
7c126fbb | 22 | AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema], |
00732bf5 | 23 | [0], [stdout], [ignore]) |
77a922c7 | 24 | AT_CHECK([ovsdb-server '-vPATTERN:console:ovsdb-server|%c|%m' --detach --no-chdir --pidfile="`pwd`"/pid --remote=punix:socket --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore]) |
c3bb4bd7 | 25 | m4_if([$2], [], [], |
028cbd99 | 26 | [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore], [kill `cat pid`])]) |
8cdf0349 | 27 | AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 idl unix:socket $3], |
028cbd99 | 28 | [0], [stdout], [ignore], [kill `cat pid`]) |
5c6d0628 | 29 | AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]), |
254604d8 | 30 | [0], [$4], [], [kill `cat pid`]) |
028cbd99 | 31 | OVSDB_SERVER_SHUTDOWN |
c3bb4bd7 BP |
32 | AT_CLEANUP]) |
33 | ||
8cdf0349 | 34 | # same as OVSDB_CHECK_IDL but uses the Python IDL implementation. |
963f66b5 RB |
35 | m4_define([OVSDB_CHECK_IDL_PYN], |
36 | [AT_SETUP([$1]) | |
37 | AT_SKIP_IF([test $7 = no]) | |
8cdf0349 BP |
38 | AT_KEYWORDS([ovsdb server idl positive Python $5]) |
39 | AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema], | |
40 | [0], [stdout], [ignore]) | |
77a922c7 | 41 | AT_CHECK([ovsdb-server '-vPATTERN:console:ovsdb-server|%c|%m' --detach --no-chdir --pidfile="`pwd`"/pid --remote=punix:socket --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore]) |
8cdf0349 BP |
42 | m4_if([$2], [], [], |
43 | [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore], [kill `cat pid`])]) | |
963f66b5 | 44 | AT_CHECK([$8 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket $3], |
8cdf0349 | 45 | [0], [stdout], [ignore], [kill `cat pid`]) |
5c6d0628 | 46 | AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]), |
8cdf0349 BP |
47 | [0], [$4], [], [kill `cat pid`]) |
48 | OVSDB_SERVER_SHUTDOWN | |
49 | AT_CLEANUP]) | |
50 | ||
963f66b5 RB |
51 | m4_define([OVSDB_CHECK_IDL_PY], |
52 | [OVSDB_CHECK_IDL_PYN([$1 - Python2], [$2], [$3], [$4], [$5], [$6], | |
53 | [$HAVE_PYTHON], [$PYTHON]) | |
54 | OVSDB_CHECK_IDL_PYN([$1 - Python3], [$2], [$3], [$4], [$5], [$6], | |
55 | [$HAVE_PYTHON3], [$PYTHON3])]) | |
56 | ||
57 | m4_define([OVSDB_CHECK_IDL_REGISTER_COLUMNS_PYN], | |
58 | [AT_SETUP([$1 - register_columns]) | |
59 | AT_SKIP_IF([test $7 = no]) | |
01dc1516 SA |
60 | AT_KEYWORDS([ovsdb server idl positive Python register_columns $5]) |
61 | AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema], | |
62 | [0], [stdout], [ignore]) | |
63 | AT_CHECK([ovsdb-server '-vPATTERN:console:ovsdb-server|%c|%m' --detach --no-chdir --pidfile="`pwd`"/pid --remote=punix:socket --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore]) | |
64 | m4_if([$2], [], [], | |
65 | [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore], [kill `cat pid`])]) | |
963f66b5 | 66 | 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], |
01dc1516 SA |
67 | [0], [stdout], [ignore], [kill `cat pid`]) |
68 | AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]), | |
69 | [0], [$4], [], [kill `cat pid`]) | |
70 | OVSDB_SERVER_SHUTDOWN | |
71 | AT_CLEANUP]) | |
72 | ||
963f66b5 RB |
73 | m4_define([OVSDB_CHECK_IDL_REGISTER_COLUMNS_PY], |
74 | [OVSDB_CHECK_IDL_REGISTER_COLUMNS_PYN([$1 - Python2], [$2], [$3], [$4], [$5], [$6], | |
75 | [$HAVE_PYTHON], [$PYTHON]) | |
76 | OVSDB_CHECK_IDL_REGISTER_COLUMNS_PYN([$1 - Python3], [$2], [$3], [$4], [$5], [$6], | |
77 | [$HAVE_PYTHON3], [$PYTHON3])]) | |
78 | ||
e06d06a7 | 79 | # same as OVSDB_CHECK_IDL but uses the Python IDL implementation with tcp |
963f66b5 RB |
80 | m4_define([OVSDB_CHECK_IDL_TCP_PYN], |
81 | [AT_SETUP([$1 - tcp]) | |
82 | AT_SKIP_IF([test $7 = no]) | |
e06d06a7 IY |
83 | AT_KEYWORDS([ovsdb server idl positive Python with tcp socket $5]) |
84 | AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema], | |
85 | [0], [stdout], [ignore]) | |
1e04fcc8 | 86 | AT_CHECK([ovsdb-server --log-file '-vPATTERN:console:ovsdb-server|%c|%m' --detach --no-chdir --pidfile="`pwd`"/pid --remote=punix:socket --remote=ptcp:0:127.0.0.1 --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore]) |
fb28ef2d | 87 | PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT]) |
1e04fcc8 | 88 | |
e06d06a7 IY |
89 | m4_if([$2], [], [], |
90 | [AT_CHECK([ovsdb-client transact tcp:127.0.0.1:$TCP_PORT $2], [0], [ignore], [ignore], [kill `cat pid`])]) | |
963f66b5 | 91 | AT_CHECK([$8 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema tcp:127.0.0.1:$TCP_PORT $3], |
e06d06a7 | 92 | [0], [stdout], [ignore], [kill `cat pid`]) |
5c6d0628 | 93 | AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]), |
e06d06a7 IY |
94 | [0], [$4], [], [kill `cat pid`]) |
95 | OVSDB_SERVER_SHUTDOWN | |
96 | AT_CLEANUP]) | |
97 | ||
963f66b5 RB |
98 | m4_define([OVSDB_CHECK_IDL_TCP_PY], |
99 | [OVSDB_CHECK_IDL_TCP_PYN([$1 - Python2], [$2], [$3], [$4], [$5], [$6], | |
100 | [$HAVE_PYTHON], [$PYTHON]) | |
101 | OVSDB_CHECK_IDL_TCP_PYN([$1 - Python3], [$2], [$3], [$4], [$5], [$6], | |
102 | [$HAVE_PYTHON3], [$PYTHON3])]) | |
103 | ||
e731d71b | 104 | # same as OVSDB_CHECK_IDL but uses the Python IDL implementation with tcp6 |
963f66b5 RB |
105 | m4_define([OVSDB_CHECK_IDL_TCP6_PYN], |
106 | [AT_SETUP([$1 - tcp6]) | |
107 | AT_SKIP_IF([test $7 = no]) | |
4819b3a5 | 108 | AT_SKIP_IF([test $HAVE_IPV6 = no]) |
e731d71b | 109 | AT_KEYWORDS([ovsdb server idl positive Python with tcp6 socket $5]) |
e731d71b AS |
110 | AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema], |
111 | [0], [stdout], [ignore]) | |
112 | AT_CHECK([ovsdb-server --log-file '-vPATTERN:console:ovsdb-server|%c|%m' --detach --no-chdir --pidfile="`pwd`"/pid --remote=ptcp:0:[[::1]] --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore]) | |
fb28ef2d | 113 | PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT]) |
e731d71b AS |
114 | echo "TCP_PORT=$TCP_PORT" |
115 | ||
116 | m4_if([$2], [], [], | |
117 | [AT_CHECK([ovsdb-client transact "tcp:[[::1]]:$TCP_PORT" $2], [0], [ignore], [ignore], [kill `cat pid`])]) | |
963f66b5 | 118 | AT_CHECK([$8 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema tcp:[[::1]]:$TCP_PORT $3], |
e731d71b AS |
119 | [0], [stdout], [ignore], [kill `cat pid`]) |
120 | AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]), | |
121 | [0], [$4], [], [kill `cat pid`]) | |
122 | OVSDB_SERVER_SHUTDOWN | |
123 | AT_CLEANUP]) | |
124 | ||
963f66b5 RB |
125 | m4_define([OVSDB_CHECK_IDL_TCP6_PY], |
126 | [OVSDB_CHECK_IDL_TCP6_PYN([$1 - Python2], [$2], [$3], [$4], [$5], [$6], | |
127 | [$HAVE_PYTHON], [$PYTHON]) | |
128 | OVSDB_CHECK_IDL_TCP6_PYN([$1 - Python3], [$2], [$3], [$4], [$5], [$6], | |
129 | [$HAVE_PYTHON3], [$PYTHON3])]) | |
130 | ||
8cdf0349 BP |
131 | m4_define([OVSDB_CHECK_IDL], |
132 | [OVSDB_CHECK_IDL_C($@) | |
e06d06a7 | 133 | OVSDB_CHECK_IDL_PY($@) |
01dc1516 | 134 | OVSDB_CHECK_IDL_REGISTER_COLUMNS_PY($@) |
e731d71b AS |
135 | OVSDB_CHECK_IDL_TCP_PY($@) |
136 | OVSDB_CHECK_IDL_TCP6_PY($@)]) | |
8cdf0349 | 137 | |
c3bb4bd7 BP |
138 | OVSDB_CHECK_IDL([simple idl, initially empty, no ops], |
139 | [], | |
140 | [], | |
141 | [000: empty | |
142 | 001: done | |
143 | ]) | |
144 | ||
145 | OVSDB_CHECK_IDL([simple idl, initially empty, various ops], | |
146 | [], | |
9cb53f26 BP |
147 | [['["idltest", |
148 | {"op": "insert", | |
c3bb4bd7 BP |
149 | "table": "simple", |
150 | "row": {"i": 1, | |
151 | "r": 2.0, | |
152 | "b": true, | |
153 | "s": "mystring", | |
154 | "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"], | |
155 | "ia": ["set", [1, 2, 3]], | |
156 | "ra": ["set", [-0.5]], | |
7fae24e6 | 157 | "ba": ["set", [true]], |
8cdf0349 | 158 | "sa": ["set", ["abc", "def"]], |
c3bb4bd7 BP |
159 | "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"], |
160 | ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}}, | |
161 | {"op": "insert", | |
162 | "table": "simple", | |
163 | "row": {}}]' \ | |
9cb53f26 BP |
164 | '["idltest", |
165 | {"op": "update", | |
c3bb4bd7 BP |
166 | "table": "simple", |
167 | "where": [], | |
168 | "row": {"b": true}}]' \ | |
9cb53f26 BP |
169 | '["idltest", |
170 | {"op": "update", | |
c3bb4bd7 BP |
171 | "table": "simple", |
172 | "where": [], | |
173 | "row": {"r": 123.5}}]' \ | |
9cb53f26 BP |
174 | '["idltest", |
175 | {"op": "insert", | |
c3bb4bd7 BP |
176 | "table": "simple", |
177 | "row": {"i": -1, | |
178 | "r": 125, | |
179 | "b": false, | |
180 | "s": "", | |
181 | "ia": ["set", [1]], | |
182 | "ra": ["set", [1.5]], | |
183 | "ba": ["set", [false]], | |
8cdf0349 | 184 | "sa": ["set", []], |
c3bb4bd7 | 185 | "ua": ["set", []]}}]' \ |
9cb53f26 BP |
186 | '["idltest", |
187 | {"op": "update", | |
c3bb4bd7 BP |
188 | "table": "simple", |
189 | "where": [["i", "<", 1]], | |
190 | "row": {"s": "newstring"}}]' \ | |
9cb53f26 BP |
191 | '["idltest", |
192 | {"op": "delete", | |
c3bb4bd7 BP |
193 | "table": "simple", |
194 | "where": [["i", "==", 0]]}]' \ | |
195 | 'reconnect']], | |
196 | [[000: empty | |
197 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]} | |
198 | 002: i=0 r=0 b=false s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 199 | 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 |
200 | 003: {"error":null,"result":[{"count":2}]} |
201 | 004: i=0 r=0 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 202 | 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 |
203 | 005: {"error":null,"result":[{"count":2}]} |
204 | 006: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 205 | 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 |
206 | 007: {"error":null,"result":[{"uuid":["uuid","<6>"]}]} |
207 | 008: i=-1 r=125 b=false s= u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
208 | 008: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 209 | 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 |
210 | 009: {"error":null,"result":[{"count":2}]} |
211 | 010: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
212 | 010: i=0 r=123.5 b=true s=newstring u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 213 | 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 |
214 | 011: {"error":null,"result":[{"count":1}]} |
215 | 012: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
7fae24e6 | 216 | 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 |
217 | 013: reconnect |
218 | 014: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
7fae24e6 | 219 | 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 |
220 | 015: done |
221 | ]]) | |
222 | ||
223 | OVSDB_CHECK_IDL([simple idl, initially populated], | |
9cb53f26 BP |
224 | [['["idltest", |
225 | {"op": "insert", | |
c3bb4bd7 BP |
226 | "table": "simple", |
227 | "row": {"i": 1, | |
228 | "r": 2.0, | |
229 | "b": true, | |
230 | "s": "mystring", | |
231 | "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"], | |
232 | "ia": ["set", [1, 2, 3]], | |
233 | "ra": ["set", [-0.5]], | |
7fae24e6 | 234 | "ba": ["set", [true]], |
8cdf0349 | 235 | "sa": ["set", ["abc", "def"]], |
c3bb4bd7 BP |
236 | "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"], |
237 | ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}}, | |
238 | {"op": "insert", | |
239 | "table": "simple", | |
240 | "row": {}}]']], | |
9cb53f26 BP |
241 | [['["idltest", |
242 | {"op": "update", | |
c3bb4bd7 BP |
243 | "table": "simple", |
244 | "where": [], | |
245 | "row": {"b": true}}]']], | |
246 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 247 | 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 |
248 | 001: {"error":null,"result":[{"count":2}]} |
249 | 002: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 250 | 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 |
251 | 003: done |
252 | ]]) | |
253 | ||
475281c0 | 254 | OVSDB_CHECK_IDL([simple idl, writing via IDL], |
9cb53f26 BP |
255 | [['["idltest", |
256 | {"op": "insert", | |
475281c0 BP |
257 | "table": "simple", |
258 | "row": {"i": 1, | |
259 | "r": 2.0, | |
260 | "b": true, | |
261 | "s": "mystring", | |
262 | "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"], | |
263 | "ia": ["set", [1, 2, 3]], | |
264 | "ra": ["set", [-0.5]], | |
7fae24e6 | 265 | "ba": ["set", [true]], |
8cdf0349 | 266 | "sa": ["set", ["abc", "def"]], |
475281c0 BP |
267 | "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"], |
268 | ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}}, | |
269 | {"op": "insert", | |
270 | "table": "simple", | |
271 | "row": {}}]']], | |
a91c6104 BP |
272 | [['verify 0 b, verify 1 r, set 0 b 1, set 1 r 3.5' \ |
273 | 'insert 2, verify 2 i, verify 1 b, delete 1']], | |
475281c0 | 274 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> |
7fae24e6 | 275 | 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 |
276 | 001: commit, status=success |
277 | 002: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
7fae24e6 | 278 | 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 |
279 | 003: commit, status=success |
280 | 004: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
281 | 004: i=2 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<6> | |
282 | 005: done | |
283 | ]]) | |
284 | ||
a91c6104 BP |
285 | OVSDB_CHECK_IDL([simple idl, handling verification failure], |
286 | [['["idltest", | |
287 | {"op": "insert", | |
288 | "table": "simple", | |
289 | "row": {"i": 1, | |
290 | "r": 2.0}}, | |
291 | {"op": "insert", | |
292 | "table": "simple", | |
293 | "row": {}}]']], | |
294 | [['set 0 b 1' \ | |
295 | '+["idltest", | |
296 | {"op": "update", | |
297 | "table": "simple", | |
298 | "where": [["i", "==", 1]], | |
299 | "row": {"r": 5.0}}]' \ | |
300 | '+verify 1 r, set 1 r 3' \ | |
301 | 'verify 1 r, set 1 r 3' \ | |
302 | ]], | |
303 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
304 | 000: i=1 r=2 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> | |
305 | 001: commit, status=success | |
306 | 002: {"error":null,"result":[{"count":1}]} | |
94fbe1aa | 307 | 003: commit, status=try again |
a91c6104 BP |
308 | 004: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> |
309 | 004: i=1 r=5 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> | |
310 | 005: commit, status=success | |
311 | 006: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
312 | 006: i=1 r=3 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> | |
313 | 007: done | |
314 | ]]) | |
315 | ||
b54e22e9 | 316 | OVSDB_CHECK_IDL([simple idl, increment operation], |
9cb53f26 BP |
317 | [['["idltest", |
318 | {"op": "insert", | |
b54e22e9 BP |
319 | "table": "simple", |
320 | "row": {}}]']], | |
94fbe1aa | 321 | [['set 0 r 2.0, increment 0']], |
b54e22e9 BP |
322 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> |
323 | 001: commit, status=success, increment=1 | |
324 | 002: i=1 r=2 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
325 | 003: done | |
326 | ]]) | |
327 | ||
2096903b BP |
328 | OVSDB_CHECK_IDL([simple idl, aborting], |
329 | [['["idltest", | |
330 | {"op": "insert", | |
331 | "table": "simple", | |
332 | "row": {}}]']], | |
333 | [['set 0 r 2.0, abort' \ | |
334 | '+set 0 b 1']], | |
335 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
336 | 001: commit, status=aborted | |
337 | 002: commit, status=success | |
338 | 003: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
339 | 004: done | |
340 | ]]) | |
341 | ||
342 | OVSDB_CHECK_IDL([simple idl, destroy without commit or abort], | |
343 | [['["idltest", | |
344 | {"op": "insert", | |
345 | "table": "simple", | |
346 | "row": {}}]']], | |
347 | [['set 0 r 2.0, destroy' \ | |
348 | '+set 0 b 1']], | |
349 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
350 | 001: destroy | |
351 | 002: commit, status=success | |
352 | 003: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
353 | 004: done | |
354 | ]]) | |
355 | ||
c3bb4bd7 BP |
356 | OVSDB_CHECK_IDL([self-linking idl, consistent ops], |
357 | [], | |
9cb53f26 BP |
358 | [['["idltest", |
359 | {"op": "insert", | |
e9011ac8 | 360 | "table": "link1", |
c3bb4bd7 BP |
361 | "row": {"i": 0, "k": ["named-uuid", "self"]}, |
362 | "uuid-name": "self"}]' \ | |
9cb53f26 BP |
363 | '["idltest", |
364 | {"op": "insert", | |
e9011ac8 | 365 | "table": "link1", |
2d2d6d4a | 366 | "row": {"i": 1, "k": ["named-uuid", "row2"]}, |
c3bb4bd7 BP |
367 | "uuid-name": "row1"}, |
368 | {"op": "insert", | |
e9011ac8 | 369 | "table": "link1", |
c3bb4bd7 | 370 | "row": {"i": 2, "k": ["named-uuid", "row1"]}, |
2d2d6d4a | 371 | "uuid-name": "row2"}]' \ |
9cb53f26 BP |
372 | '["idltest", |
373 | {"op": "update", | |
e9011ac8 | 374 | "table": "link1", |
c3bb4bd7 BP |
375 | "where": [["i", "==", 1]], |
376 | "row": {"k": ["uuid", "#1#"]}}]' \ | |
9cb53f26 BP |
377 | '["idltest", |
378 | {"op": "update", | |
e9011ac8 | 379 | "table": "link1", |
c3bb4bd7 BP |
380 | "where": [], |
381 | "row": {"k": ["uuid", "#0#"]}}]']], | |
382 | [[000: empty | |
383 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]}]} | |
e9011ac8 | 384 | 002: i=0 k=0 ka=[] l2= uuid=<0> |
fbf925e4 | 385 | 003: {"error":null,"result":[{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]}]} |
e9011ac8 BP |
386 | 004: i=0 k=0 ka=[] l2= uuid=<0> |
387 | 004: i=1 k=2 ka=[] l2= uuid=<1> | |
388 | 004: i=2 k=1 ka=[] l2= uuid=<2> | |
c3bb4bd7 | 389 | 005: {"error":null,"result":[{"count":1}]} |
e9011ac8 BP |
390 | 006: i=0 k=0 ka=[] l2= uuid=<0> |
391 | 006: i=1 k=1 ka=[] l2= uuid=<1> | |
392 | 006: i=2 k=1 ka=[] l2= uuid=<2> | |
c3bb4bd7 | 393 | 007: {"error":null,"result":[{"count":3}]} |
e9011ac8 BP |
394 | 008: i=0 k=0 ka=[] l2= uuid=<0> |
395 | 008: i=1 k=0 ka=[] l2= uuid=<1> | |
396 | 008: i=2 k=0 ka=[] l2= uuid=<2> | |
c3bb4bd7 BP |
397 | 009: done |
398 | ]]) | |
399 | ||
400 | OVSDB_CHECK_IDL([self-linking idl, inconsistent ops], | |
401 | [], | |
9cb53f26 BP |
402 | [['["idltest", |
403 | {"op": "insert", | |
e9011ac8 | 404 | "table": "link1", |
c3bb4bd7 | 405 | "row": {"i": 0, "k": ["uuid", "cf197cc5-c8c9-42f5-82d5-c71a9f2cb96b"]}}]' \ |
9cb53f26 BP |
406 | '+["idltest", |
407 | {"op": "insert", | |
e9011ac8 | 408 | "table": "link1", |
0d0f05b9 BP |
409 | "uuid-name": "one", |
410 | "row": {"i": 1, "k": ["named-uuid", "one"]}}, | |
411 | {"op": "insert", | |
412 | "table": "link1", | |
413 | "row": {"i": 2, "k": ["named-uuid", "one"]}}]' \ | |
9cb53f26 BP |
414 | '["idltest", |
415 | {"op": "update", | |
e9011ac8 | 416 | "table": "link1", |
c3bb4bd7 BP |
417 | "where": [], |
418 | "row": {"k": ["uuid", "c2fca39a-e69a-42a4-9c56-5eca85839ce9"]}}]' \ | |
9cb53f26 BP |
419 | '+["idltest", |
420 | {"op": "delete", | |
e9011ac8 | 421 | "table": "link1", |
0d0f05b9 | 422 | "where": [["_uuid", "==", ["uuid", "#1#"]]]}]' \ |
9cb53f26 BP |
423 | '+["idltest", |
424 | {"op": "delete", | |
e9011ac8 | 425 | "table": "link1", |
0d0f05b9 | 426 | "where": [["_uuid", "==", ["uuid", "#2#"]]]}]' \ |
9cb53f26 BP |
427 | '["idltest", |
428 | {"op": "delete", | |
0d0f05b9 BP |
429 | "table": "link1", |
430 | "where": []}]' \ | |
c3bb4bd7 BP |
431 | ]], |
432 | [[000: empty | |
97f7803b | 433 | 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 |
434 | 002: {"error":null,"result":[{"uuid":["uuid","<2>"]},{"uuid":["uuid","<3>"]}]} |
435 | 003: i=1 k=1 ka=[] l2= uuid=<2> | |
436 | 003: i=2 k=1 ka=[] l2= uuid=<3> | |
254604d8 | 437 | 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 |
438 | 005: {"error":null,"result":[{"count":1},{"details":"cannot delete link1 row <2> because of 1 remaining reference(s)","error":"referential integrity violation"}]} |
439 | 006: {"error":null,"result":[{"count":1}]} | |
440 | 007: i=1 k=1 ka=[] l2= uuid=<2> | |
441 | 008: {"error":null,"result":[{"count":1}]} | |
442 | 009: empty | |
443 | 010: done | |
254604d8 BP |
444 | ]], |
445 | [], | |
446 | [[sed -e '/004:/s/row <[23]> references/row <x> references/']]) | |
c3bb4bd7 BP |
447 | |
448 | OVSDB_CHECK_IDL([self-linking idl, sets], | |
449 | [], | |
9cb53f26 BP |
450 | [['["idltest", |
451 | {"op": "insert", | |
e9011ac8 | 452 | "table": "link1", |
0d0f05b9 | 453 | "row": {"i": 0, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i0"]]]}, |
c3bb4bd7 BP |
454 | "uuid-name": "i0"}, |
455 | {"op": "insert", | |
e9011ac8 | 456 | "table": "link1", |
0d0f05b9 | 457 | "row": {"i": 1, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i1"]]]}, |
c3bb4bd7 BP |
458 | "uuid-name": "i1"}, |
459 | {"op": "insert", | |
e9011ac8 | 460 | "table": "link1", |
0d0f05b9 | 461 | "row": {"i": 2, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i2"]]]}, |
c3bb4bd7 BP |
462 | "uuid-name": "i2"}, |
463 | {"op": "insert", | |
e9011ac8 | 464 | "table": "link1", |
0d0f05b9 | 465 | "row": {"i": 3, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i3"]]]}, |
c3bb4bd7 | 466 | "uuid-name": "i3"}]' \ |
9cb53f26 BP |
467 | '["idltest", |
468 | {"op": "update", | |
e9011ac8 | 469 | "table": "link1", |
c3bb4bd7 BP |
470 | "where": [], |
471 | "row": {"ka": ["set", [["uuid", "#0#"], ["uuid", "#1#"], ["uuid", "#2#"], ["uuid", "#3#"]]]}}]' \ | |
9cb53f26 BP |
472 | '["idltest", |
473 | {"op": "update", | |
e9011ac8 | 474 | "table": "link1", |
97f7803b BP |
475 | "where": [["i", "==", 2]], |
476 | "row": {"ka": ["set", [["uuid", "#0#"], ["uuid", "88702e78-845b-4a6e-ad08-cf68922ae84a"], ["uuid", "#2#"]]]}}]' \ | |
9cb53f26 BP |
477 | '+["idltest", |
478 | {"op": "delete", | |
0d0f05b9 BP |
479 | "table": "link1", |
480 | "where": []}]']], | |
c3bb4bd7 BP |
481 | [[000: empty |
482 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]},{"uuid":["uuid","<3>"]}]} | |
0d0f05b9 BP |
483 | 002: i=0 k=0 ka=[0] l2= uuid=<0> |
484 | 002: i=1 k=0 ka=[1] l2= uuid=<1> | |
485 | 002: i=2 k=0 ka=[2] l2= uuid=<2> | |
486 | 002: i=3 k=0 ka=[3] l2= uuid=<3> | |
c3bb4bd7 | 487 | 003: {"error":null,"result":[{"count":4}]} |
0d0f05b9 BP |
488 | 004: i=0 k=0 ka=[0 1 2 3] l2= uuid=<0> |
489 | 004: i=1 k=0 ka=[0 1 2 3] l2= uuid=<1> | |
490 | 004: i=2 k=0 ka=[0 1 2 3] l2= uuid=<2> | |
491 | 004: i=3 k=0 ka=[0 1 2 3] l2= uuid=<3> | |
97f7803b | 492 | 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 |
493 | 006: {"error":null,"result":[{"count":4}]} |
494 | 007: empty | |
495 | 008: done | |
c3bb4bd7 BP |
496 | ]]) |
497 | ||
e9011ac8 BP |
498 | OVSDB_CHECK_IDL([external-linking idl, consistent ops], |
499 | [], | |
9cb53f26 BP |
500 | [['["idltest", |
501 | {"op": "insert", | |
e9011ac8 BP |
502 | "table": "link2", |
503 | "row": {"i": 0}, | |
504 | "uuid-name": "row0"}, | |
505 | {"op": "insert", | |
506 | "table": "link1", | |
0d0f05b9 | 507 | "row": {"i": 1, "k": ["named-uuid", "row1"], "l2": ["set", [["named-uuid", "row0"]]]}, |
e9011ac8 BP |
508 | "uuid-name": "row1"}]']], |
509 | [[000: empty | |
510 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]} | |
511 | 002: i=0 l1= uuid=<0> | |
0d0f05b9 | 512 | 002: i=1 k=1 ka=[] l2=0 uuid=<1> |
e9011ac8 BP |
513 | 003: done |
514 | ]]) | |
225b582a IY |
515 | |
516 | OVSDB_CHECK_IDL_PY([external-linking idl, insert ops], | |
517 | [], | |
518 | [['linktest']], | |
519 | [[000: empty | |
520 | 001: commit, status=success | |
521 | 002: i=1 k=1 ka=[1] l2= uuid=<0> | |
522 | 002: i=2 k=1 ka=[1 2] l2= uuid=<1> | |
523 | 003: done | |
524 | ]]) | |
3b4c362f IY |
525 | |
526 | OVSDB_CHECK_IDL_PY([getattr idl, insert ops], | |
527 | [], | |
528 | [['getattrtest']], | |
529 | [[000: empty | |
530 | 001: commit, status=success | |
531 | 002: i=2 k=2 ka=[] l2= uuid=<0> | |
532 | 003: done | |
533 | ]]) | |
d18e52e3 | 534 | |
d7d417fc TW |
535 | OVSDB_CHECK_IDL_PY([row-from-json idl, whats this], |
536 | [['["idltest", | |
537 | {"op": "insert", | |
538 | "table": "simple", | |
539 | "row": {"i": 1}}, | |
540 | {"op": "insert", | |
541 | "table": "simple", | |
542 | "row": {}}]']], | |
543 | [['notifytest insert 2, notifytest set 1 b 1, notifytest delete 0']], | |
544 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
545 | 000: i=1 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> | |
546 | 001: commit, status=success, events=create|2|None, delete|0|None, update|1|b | |
547 | 002: i=1 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> | |
548 | 002: i=2 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3> | |
549 | 003: done | |
550 | ]]) | |
551 | ||
d18e52e3 BP |
552 | AT_SETUP([idl handling of missing tables and columns - C]) |
553 | AT_KEYWORDS([ovsdb server idl positive]) | |
d18e52e3 BP |
554 | |
555 | # idltest2.ovsschema is the same as idltest.ovsschema, except that | |
556 | # table link2 and column l2 have been deleted. But the IDL still | |
557 | # expects them to be there, so this test checks that it properly | |
558 | # tolerates them being missing. | |
559 | AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest2.ovsschema], | |
560 | [0], [stdout], [ignore]) | |
561 | AT_CHECK([ovsdb-server '-vPATTERN:console:ovsdb-server|%c|%m' --detach --no-chdir --pidfile="`pwd`"/pid --remote=punix:socket --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore]) | |
562 | AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 idl unix:socket ['["idltest", | |
563 | {"op": "insert", | |
564 | "table": "link1", | |
565 | "row": {"i": 0, "k": ["named-uuid", "self"]}, | |
566 | "uuid-name": "self"}]' \ | |
567 | '["idltest", | |
568 | {"op": "insert", | |
569 | "table": "link1", | |
570 | "row": {"i": 1, "k": ["named-uuid", "row2"]}, | |
571 | "uuid-name": "row1"}, | |
572 | {"op": "insert", | |
573 | "table": "link1", | |
574 | "row": {"i": 2, "k": ["named-uuid", "row1"]}, | |
575 | "uuid-name": "row2"}]' \ | |
576 | '["idltest", | |
577 | {"op": "update", | |
578 | "table": "link1", | |
579 | "where": [["i", "==", 1]], | |
580 | "row": {"k": ["uuid", "#1#"]}}]' \ | |
581 | '["idltest", | |
582 | {"op": "update", | |
583 | "table": "link1", | |
584 | "where": [], | |
585 | "row": {"k": ["uuid", "#0#"]}}]']], | |
586 | [0], [stdout], [stderr], [kill `cat pid`]) | |
587 | AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl], [0], | |
588 | [[000: empty | |
589 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]}]} | |
590 | 002: i=0 k=0 ka=[] l2= uuid=<0> | |
591 | 003: {"error":null,"result":[{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]}]} | |
592 | 004: i=0 k=0 ka=[] l2= uuid=<0> | |
593 | 004: i=1 k=2 ka=[] l2= uuid=<1> | |
594 | 004: i=2 k=1 ka=[] l2= uuid=<2> | |
595 | 005: {"error":null,"result":[{"count":1}]} | |
596 | 006: i=0 k=0 ka=[] l2= uuid=<0> | |
597 | 006: i=1 k=1 ka=[] l2= uuid=<1> | |
598 | 006: i=2 k=1 ka=[] l2= uuid=<2> | |
599 | 007: {"error":null,"result":[{"count":3}]} | |
600 | 008: i=0 k=0 ka=[] l2= uuid=<0> | |
601 | 008: i=1 k=0 ka=[] l2= uuid=<1> | |
602 | 008: i=2 k=0 ka=[] l2= uuid=<2> | |
603 | 009: done | |
604 | ]], [], [kill `cat pid`]) | |
605 | ||
606 | # Check that ovsdb-idl figured out that table link2 and column l2 are missing. | |
607 | AT_CHECK([grep ovsdb_idl stderr | sort], [0], [dnl | |
608 | test-ovsdb|ovsdb_idl|idltest database lacks link2 table (database needs upgrade?) | |
609 | test-ovsdb|ovsdb_idl|link1 table in idltest database lacks l2 column (database needs upgrade?) | |
610 | ]) | |
611 | ||
612 | # Check that ovsdb-idl sent on "monitor" request and that it didn't | |
613 | # mention that table or column, and (for paranoia) that it did mention another | |
614 | # table and column. | |
db2b5757 | 615 | AT_CHECK([grep -c '"monitor\|monitor2"' stderr], [0], [1 |
d18e52e3 | 616 | ]) |
db2b5757 AZ |
617 | AT_CHECK([grep '"monitor\|monitor2"' stderr | grep link2], [1]) |
618 | AT_CHECK([grep '"monitor\|monitor2"' stderr | grep l2], [1]) | |
619 | AT_CHECK([grep '"monitor\|monitor2"' stderr | grep -c '"link1"'], [0], [1 | |
d18e52e3 | 620 | ]) |
db2b5757 | 621 | AT_CHECK([grep '"monitor\|monitor2"' stderr | grep -c '"ua"'], [0], [1 |
d18e52e3 BP |
622 | ]) |
623 | OVSDB_SERVER_SHUTDOWN | |
624 | AT_CLEANUP | |
80c12152 SA |
625 | |
626 | m4_define([OVSDB_CHECK_IDL_FETCH_COLUMNS_PY], | |
627 | [AT_SETUP([$1 - Python fetch]) | |
628 | AT_SKIP_IF([test $HAVE_PYTHON = no]) | |
629 | AT_KEYWORDS([ovsdb server idl positive Python increment fetch $6]) | |
630 | AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema], | |
631 | [0], [stdout], [ignore]) | |
632 | AT_CHECK([ovsdb-server '-vPATTERN:console:ovsdb-server|%c|%m' --detach --no-chdir --pidfile="`pwd`"/pid --remote=punix:socket --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore]) | |
633 | m4_if([$2], [], [], | |
634 | [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore], [kill `cat pid`])]) | |
635 | AT_CHECK([$PYTHON $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket [$3] $4], | |
636 | [0], [stdout], [ignore], [kill `cat pid`]) | |
637 | AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$7],,, [[| $7]]), | |
638 | [0], [$5], [], [kill `cat pid`]) | |
639 | OVSDB_SERVER_SHUTDOWN | |
640 | AT_CLEANUP]) | |
641 | ||
642 | m4_define([OVSDB_CHECK_IDL_FETCH_COLUMNS], | |
643 | [OVSDB_CHECK_IDL_FETCH_COLUMNS_PY($@)]) | |
644 | ||
645 | OVSDB_CHECK_IDL_FETCH_COLUMNS([simple idl, initially populated], | |
646 | [['["idltest", | |
647 | {"op": "insert", | |
648 | "table": "simple", | |
649 | "row": {"i": 1, | |
650 | "r": 2.0, | |
651 | "b": true, | |
652 | "s": "mystring", | |
653 | "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"], | |
654 | "ia": ["set", [1, 2, 3]], | |
655 | "ra": ["set", [-0.5]], | |
656 | "ba": ["set", [true]], | |
657 | "sa": ["set", ["abc", "def"]], | |
658 | "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"], | |
659 | ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}}, | |
660 | {"op": "insert", | |
661 | "table": "simple", | |
662 | "row": {}}]']], | |
663 | [?simple:i,r!], | |
664 | ['fetch 0 r'], | |
665 | [[000: i=0 uuid=<0> | |
666 | 000: i=1 uuid=<1> | |
667 | 001: commit, status=success | |
668 | 002: i=0 r=0 uuid=<0> | |
669 | 002: i=1 uuid=<1> | |
670 | 003: done | |
671 | ]]) | |
932104f4 SA |
672 | |
673 | m4_define([OVSDB_CHECK_IDL_TRACK_C], | |
674 | [AT_SETUP([$1 - C]) | |
675 | AT_KEYWORDS([ovsdb server idl tracking positive $5]) | |
676 | AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema], | |
677 | [0], [stdout], [ignore]) | |
678 | AT_CHECK([ovsdb-server '-vPATTERN:console:ovsdb-server|%c|%m' --detach --no-chdir --pidfile="`pwd`"/pid --remote=punix:socket --unixctl="`pwd`"/unixctl db], [0], [ignore], [ignore]) | |
679 | m4_if([$2], [], [], | |
680 | [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore], [kill `cat pid`])]) | |
681 | AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 -c idl unix:socket $3], | |
682 | [0], [stdout], [ignore], [kill `cat pid`]) | |
683 | AT_CHECK([sort stdout | ${PERL} $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]), | |
684 | [0], [$4], [], [kill `cat pid`]) | |
685 | OVSDB_SERVER_SHUTDOWN | |
686 | AT_CLEANUP]) | |
687 | ||
688 | m4_define([OVSDB_CHECK_IDL_TRACK], | |
689 | [OVSDB_CHECK_IDL_TRACK_C($@)]) | |
690 | ||
691 | OVSDB_CHECK_IDL_TRACK([track, simple idl, initially populated], | |
692 | [['["idltest", | |
693 | {"op": "insert", | |
694 | "table": "simple", | |
695 | "row": {"i": 1, | |
696 | "r": 2.0, | |
697 | "b": true, | |
698 | "s": "mystring", | |
699 | "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"], | |
700 | "ia": ["set", [1, 2, 3]], | |
701 | "ra": ["set", [-0.5]], | |
702 | "ba": ["set", [true]], | |
703 | "sa": ["set", ["abc", "def"]], | |
704 | "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"], | |
705 | ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}}, | |
706 | {"op": "insert", | |
707 | "table": "simple", | |
708 | "row": {}}]']], | |
709 | [['["idltest", | |
710 | {"op": "update", | |
711 | "table": "simple", | |
712 | "where": [], | |
713 | "row": {"b": true}}]']], | |
714 | [[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 | 715 | 000: updated columns: b ba i ia r ra s sa u ua |
932104f4 SA |
716 | 001: {"error":null,"result":[{"count":2}]} |
717 | 002: i=0 r=0 b=true s= u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<5> | |
718 | 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 | 719 | 002: updated columns: b |
932104f4 SA |
720 | 003: done |
721 | ]]) | |
722 | ||
723 | OVSDB_CHECK_IDL_TRACK([track, simple idl, initially empty, various ops], | |
724 | [], | |
725 | [['["idltest", | |
726 | {"op": "insert", | |
727 | "table": "simple", | |
728 | "row": {"i": 1, | |
729 | "r": 2.0, | |
730 | "b": true, | |
731 | "s": "mystring", | |
732 | "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"], | |
733 | "ia": ["set", [1, 2, 3]], | |
734 | "ra": ["set", [-0.5]], | |
735 | "ba": ["set", [true]], | |
736 | "sa": ["set", ["abc", "def"]], | |
737 | "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"], | |
738 | ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}}, | |
739 | {"op": "insert", | |
740 | "table": "simple", | |
741 | "row": {}}]' \ | |
742 | '["idltest", | |
743 | {"op": "update", | |
744 | "table": "simple", | |
745 | "where": [], | |
746 | "row": {"b": true}}]' \ | |
747 | '["idltest", | |
748 | {"op": "update", | |
749 | "table": "simple", | |
750 | "where": [], | |
751 | "row": {"r": 123.5}}]' \ | |
752 | '["idltest", | |
753 | {"op": "insert", | |
754 | "table": "simple", | |
755 | "row": {"i": -1, | |
756 | "r": 125, | |
757 | "b": false, | |
758 | "s": "", | |
759 | "ia": ["set", [1]], | |
760 | "ra": ["set", [1.5]], | |
761 | "ba": ["set", [false]], | |
762 | "sa": ["set", []], | |
763 | "ua": ["set", []]}}]' \ | |
764 | '["idltest", | |
765 | {"op": "update", | |
766 | "table": "simple", | |
767 | "where": [["i", "<", 1]], | |
768 | "row": {"s": "newstring"}}]' \ | |
769 | '["idltest", | |
770 | {"op": "delete", | |
771 | "table": "simple", | |
772 | "where": [["i", "==", 0]]}]' \ | |
773 | 'reconnect']], | |
774 | [[000: empty | |
775 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]} | |
776 | 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 | 777 | 002: updated columns: b ba i ia r ra s sa u ua |
932104f4 SA |
778 | 003: {"error":null,"result":[{"count":2}]} |
779 | 004: i=0 r=0 b=true s= u=<5> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
32d37ce8 | 780 | 004: updated columns: b |
932104f4 SA |
781 | 005: {"error":null,"result":[{"count":2}]} |
782 | 006: i=0 r=123.5 b=true s= u=<5> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
783 | 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 |
784 | 006: updated columns: r |
785 | 006: updated columns: r | |
932104f4 SA |
786 | 007: {"error":null,"result":[{"uuid":["uuid","<6>"]}]} |
787 | 008: i=-1 r=125 b=false s= u=<5> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
32d37ce8 | 788 | 008: updated columns: ba i ia r ra |
932104f4 SA |
789 | 009: {"error":null,"result":[{"count":2}]} |
790 | 010: i=-1 r=125 b=false s=newstring u=<5> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
791 | 010: i=0 r=123.5 b=true s=newstring u=<5> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
32d37ce8 SA |
792 | 010: updated columns: s |
793 | 010: updated columns: s | |
932104f4 SA |
794 | 011: {"error":null,"result":[{"count":1}]} |
795 | 012: ##deleted## uuid=<1> | |
796 | 013: reconnect | |
797 | 014: i=-1 r=125 b=false s=newstring u=<5> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
798 | 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 |
799 | 014: updated columns: b ba i ia r ra s sa u ua |
800 | 014: updated columns: ba i ia r ra s | |
932104f4 SA |
801 | 015: done |
802 | ]]) |