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