]>
Commit | Line | Data |
---|---|---|
c3bb4bd7 BP |
1 | AT_BANNER([OVSDB -- interface description language (IDL)]) |
2 | ||
3 | # OVSDB_CHECK_IDL(TITLE, [PRE-IDL-TXN], TRANSACTIONS, OUTPUT, [KEYWORDS]) | |
4 | # | |
5 | # Creates a database with a schema derived from idltest.ovsidl, runs | |
6 | # each PRE-IDL-TXN (if any), starts an ovsdb-server on that database, | |
7 | # and runs "test-ovsdb idl" passing each of the TRANSACTIONS along. | |
8 | # | |
9 | # Checks that the overall output is OUTPUT. Before comparison, the | |
10 | # output is sorted (using "sort") and UUIDs in the output are replaced | |
11 | # by markers of the form <N> where N is a number. The first unique | |
12 | # UUID is replaced by <0>, the next by <1>, and so on. If a given | |
13 | # UUID appears more than once it is always replaced by the same | |
14 | # marker. | |
15 | # | |
16 | # TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS. | |
17 | m4_define([OVSDB_CHECK_IDL], | |
18 | [AT_SETUP([$1]) | |
19 | AT_KEYWORDS([ovsdb server idl positive $5]) | |
20 | OVS_CHECK_LCOV([ovsdb-tool create db $abs_builddir/idltest.ovsschema], | |
21 | [0], [stdout], [ignore]) | |
22 | AT_CHECK([ovsdb-server --detach --pidfile=$PWD/server-pid --listen=punix:socket --unixctl=$PWD/unixctl db]) | |
23 | m4_if([$2], [], [], | |
24 | [OVS_CHECK_LCOV([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore], [kill `cat server-pid`])]) | |
25 | AT_CHECK([test-ovsdb -vjsonrpc -t10 idl unix:socket $3], | |
26 | [0], [stdout], [ignore], [kill `cat server-pid`]) | |
27 | AT_CHECK([sort stdout | perl $srcdir/uuidfilt.pl], [0], [$4], [], | |
28 | [kill `cat server-pid`]) | |
29 | kill `cat server-pid` | |
30 | AT_CLEANUP]) | |
31 | ||
32 | OVSDB_CHECK_IDL([simple idl, initially empty, no ops], | |
33 | [], | |
34 | [], | |
35 | [000: empty | |
36 | 001: done | |
37 | ]) | |
38 | ||
39 | OVSDB_CHECK_IDL([simple idl, initially empty, various ops], | |
40 | [], | |
41 | [['[{"op": "insert", | |
42 | "table": "simple", | |
43 | "row": {"i": 1, | |
44 | "r": 2.0, | |
45 | "b": true, | |
46 | "s": "mystring", | |
47 | "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"], | |
48 | "ia": ["set", [1, 2, 3]], | |
49 | "ra": ["set", [-0.5]], | |
50 | "ba": ["set", [true, false]], | |
51 | "sa": ["set", ["abc", "def"]], | |
52 | "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"], | |
53 | ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}}, | |
54 | {"op": "insert", | |
55 | "table": "simple", | |
56 | "row": {}}]' \ | |
57 | '[{"op": "update", | |
58 | "table": "simple", | |
59 | "where": [], | |
60 | "row": {"b": true}}]' \ | |
61 | '[{"op": "update", | |
62 | "table": "simple", | |
63 | "where": [], | |
64 | "row": {"r": 123.5}}]' \ | |
65 | '[{"op": "insert", | |
66 | "table": "simple", | |
67 | "row": {"i": -1, | |
68 | "r": 125, | |
69 | "b": false, | |
70 | "s": "", | |
71 | "ia": ["set", [1]], | |
72 | "ra": ["set", [1.5]], | |
73 | "ba": ["set", [false]], | |
74 | "sa": ["set", []], | |
75 | "ua": ["set", []]}}]' \ | |
76 | '[{"op": "update", | |
77 | "table": "simple", | |
78 | "where": [["i", "<", 1]], | |
79 | "row": {"s": "newstring"}}]' \ | |
80 | '[{"op": "delete", | |
81 | "table": "simple", | |
82 | "where": [["i", "==", 0]]}]' \ | |
83 | 'reconnect']], | |
84 | [[000: empty | |
85 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]} | |
86 | 002: i=0 r=0 b=false s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
87 | 002: i=1 r=2 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[false true] sa=[abc def] ua=[<4> <5>] uuid=<0> | |
88 | 003: {"error":null,"result":[{"count":2}]} | |
89 | 004: i=0 r=0 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
90 | 004: i=1 r=2 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[false true] sa=[abc def] ua=[<4> <5>] uuid=<0> | |
91 | 005: {"error":null,"result":[{"count":2}]} | |
92 | 006: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
93 | 006: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[false true] sa=[abc def] ua=[<4> <5>] uuid=<0> | |
94 | 007: {"error":null,"result":[{"uuid":["uuid","<6>"]}]} | |
95 | 008: i=-1 r=125 b=false s= u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
96 | 008: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
97 | 008: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[false true] sa=[abc def] ua=[<4> <5>] uuid=<0> | |
98 | 009: {"error":null,"result":[{"count":2}]} | |
99 | 010: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
100 | 010: i=0 r=123.5 b=true s=newstring u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
101 | 010: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[false true] sa=[abc def] ua=[<4> <5>] uuid=<0> | |
102 | 011: {"error":null,"result":[{"count":1}]} | |
103 | 012: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
104 | 012: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[false true] sa=[abc def] ua=[<4> <5>] uuid=<0> | |
105 | 013: reconnect | |
106 | 014: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> | |
107 | 014: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[false true] sa=[abc def] ua=[<4> <5>] uuid=<0> | |
108 | 015: done | |
109 | ]]) | |
110 | ||
111 | OVSDB_CHECK_IDL([simple idl, initially populated], | |
112 | [['[{"op": "insert", | |
113 | "table": "simple", | |
114 | "row": {"i": 1, | |
115 | "r": 2.0, | |
116 | "b": true, | |
117 | "s": "mystring", | |
118 | "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"], | |
119 | "ia": ["set", [1, 2, 3]], | |
120 | "ra": ["set", [-0.5]], | |
121 | "ba": ["set", [true, false]], | |
122 | "sa": ["set", ["abc", "def"]], | |
123 | "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"], | |
124 | ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}}, | |
125 | {"op": "insert", | |
126 | "table": "simple", | |
127 | "row": {}}]']], | |
128 | [['[{"op": "update", | |
129 | "table": "simple", | |
130 | "where": [], | |
131 | "row": {"b": true}}]']], | |
132 | [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
133 | 000: i=1 r=2 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[false true] sa=[abc def] ua=[<3> <4>] uuid=<5> | |
134 | 001: {"error":null,"result":[{"count":2}]} | |
135 | 002: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> | |
136 | 002: i=1 r=2 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[false true] sa=[abc def] ua=[<3> <4>] uuid=<5> | |
137 | 003: done | |
138 | ]]) | |
139 | ||
140 | OVSDB_CHECK_IDL([self-linking idl, consistent ops], | |
141 | [], | |
142 | [['[{"op": "insert", | |
143 | "table": "selfLink", | |
144 | "row": {"i": 0, "k": ["named-uuid", "self"]}, | |
145 | "uuid-name": "self"}]' \ | |
146 | '[{"op": "insert", | |
147 | "table": "selfLink", | |
148 | "row": {"i": 1}, | |
149 | "uuid-name": "row1"}, | |
150 | {"op": "insert", | |
151 | "table": "selfLink", | |
152 | "row": {"i": 2, "k": ["named-uuid", "row1"]}, | |
153 | "uuid-name": "row2"}, | |
154 | {"op": "update", | |
155 | "table": "selfLink", | |
156 | "where": [["i", "==", 1]], | |
157 | "row": {"k": ["named-uuid", "row2"]}}]' \ | |
158 | '[{"op": "update", | |
159 | "table": "selfLink", | |
160 | "where": [["i", "==", 1]], | |
161 | "row": {"k": ["uuid", "#1#"]}}]' \ | |
162 | '[{"op": "update", | |
163 | "table": "selfLink", | |
164 | "where": [], | |
165 | "row": {"k": ["uuid", "#0#"]}}]']], | |
166 | [[000: empty | |
167 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]}]} | |
168 | 002: i=0 k=0 ka=[] uuid=<0> | |
169 | 003: {"error":null,"result":[{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]},{"count":1}]} | |
170 | 004: i=0 k=0 ka=[] uuid=<0> | |
171 | 004: i=1 k=2 ka=[] uuid=<1> | |
172 | 004: i=2 k=1 ka=[] uuid=<2> | |
173 | 005: {"error":null,"result":[{"count":1}]} | |
174 | 006: i=0 k=0 ka=[] uuid=<0> | |
175 | 006: i=1 k=1 ka=[] uuid=<1> | |
176 | 006: i=2 k=1 ka=[] uuid=<2> | |
177 | 007: {"error":null,"result":[{"count":3}]} | |
178 | 008: i=0 k=0 ka=[] uuid=<0> | |
179 | 008: i=1 k=0 ka=[] uuid=<1> | |
180 | 008: i=2 k=0 ka=[] uuid=<2> | |
181 | 009: done | |
182 | ]]) | |
183 | ||
184 | OVSDB_CHECK_IDL([self-linking idl, inconsistent ops], | |
185 | [], | |
186 | [['[{"op": "insert", | |
187 | "table": "selfLink", | |
188 | "row": {"i": 0, "k": ["uuid", "cf197cc5-c8c9-42f5-82d5-c71a9f2cb96b"]}}]' \ | |
189 | '[{"op": "update", | |
190 | "table": "selfLink", | |
191 | "where": [], | |
192 | "row": {"k": ["uuid", "#0#"]}}]' \ | |
193 | '[{"op": "update", | |
194 | "table": "selfLink", | |
195 | "where": [], | |
196 | "row": {"k": ["uuid", "c2fca39a-e69a-42a4-9c56-5eca85839ce9"]}}]' \ | |
197 | '[{"op": "insert", | |
198 | "table": "selfLink", | |
199 | "row": {"i": 1, "k": ["uuid", "52d752a3-b062-4668-9446-d2e0d4a14703"]}}]' \ | |
200 | '[{"op": "update", | |
201 | "table": "selfLink", | |
202 | "where": [], | |
203 | "row": {"k": ["uuid", "#1#"]}}]' \ | |
204 | ]], | |
205 | [[000: empty | |
206 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]}]} | |
207 | 002: i=0 k= ka=[] uuid=<0> | |
208 | 003: {"error":null,"result":[{"count":1}]} | |
209 | 004: i=0 k=0 ka=[] uuid=<0> | |
210 | 005: {"error":null,"result":[{"count":1}]} | |
211 | 006: i=0 k= ka=[] uuid=<0> | |
212 | 007: {"error":null,"result":[{"uuid":["uuid","<1>"]}]} | |
213 | 008: i=0 k= ka=[] uuid=<0> | |
214 | 008: i=1 k= ka=[] uuid=<1> | |
215 | 009: {"error":null,"result":[{"count":2}]} | |
216 | 010: i=0 k=1 ka=[] uuid=<0> | |
217 | 010: i=1 k=1 ka=[] uuid=<1> | |
218 | 011: done | |
219 | ]]) | |
220 | ||
221 | OVSDB_CHECK_IDL([self-linking idl, sets], | |
222 | [], | |
223 | [['[{"op": "insert", | |
224 | "table": "selfLink", | |
225 | "row": {"i": 0, "ka": ["set", [["named-uuid", "i0"]]]}, | |
226 | "uuid-name": "i0"}, | |
227 | {"op": "insert", | |
228 | "table": "selfLink", | |
229 | "row": {"i": 1, "ka": ["set", [["named-uuid", "i1"]]]}, | |
230 | "uuid-name": "i1"}, | |
231 | {"op": "insert", | |
232 | "table": "selfLink", | |
233 | "row": {"i": 2, "ka": ["set", [["named-uuid", "i2"]]]}, | |
234 | "uuid-name": "i2"}, | |
235 | {"op": "insert", | |
236 | "table": "selfLink", | |
237 | "row": {"i": 3, "ka": ["set", [["named-uuid", "i3"]]]}, | |
238 | "uuid-name": "i3"}]' \ | |
239 | '[{"op": "update", | |
240 | "table": "selfLink", | |
241 | "where": [], | |
242 | "row": {"ka": ["set", [["uuid", "#0#"], ["uuid", "#1#"], ["uuid", "#2#"], ["uuid", "#3#"]]]}}]' \ | |
243 | '[{"op": "update", | |
244 | "table": "selfLink", | |
245 | "where": [], | |
246 | "row": {"ka": ["set", [["uuid", "#0#"], ["uuid", "88702e78-845b-4a6e-ad08-cf68922ae84a"], ["uuid", "#2#"], ["uuid", "1ac2b12e-b767-4805-a55d-43976e40c465"]]]}}]']], | |
247 | [[000: empty | |
248 | 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]},{"uuid":["uuid","<3>"]}]} | |
249 | 002: i=0 k= ka=[0] uuid=<0> | |
250 | 002: i=1 k= ka=[1] uuid=<1> | |
251 | 002: i=2 k= ka=[2] uuid=<2> | |
252 | 002: i=3 k= ka=[3] uuid=<3> | |
253 | 003: {"error":null,"result":[{"count":4}]} | |
254 | 004: i=0 k= ka=[0 1 2 3] uuid=<0> | |
255 | 004: i=1 k= ka=[0 1 2 3] uuid=<1> | |
256 | 004: i=2 k= ka=[0 1 2 3] uuid=<2> | |
257 | 004: i=3 k= ka=[0 1 2 3] uuid=<3> | |
258 | 005: {"error":null,"result":[{"count":4}]} | |
259 | 006: i=0 k= ka=[0 2] uuid=<0> | |
260 | 006: i=1 k= ka=[0 2] uuid=<1> | |
261 | 006: i=2 k= ka=[0 2] uuid=<2> | |
262 | 006: i=3 k= ka=[0 2] uuid=<3> | |
263 | 007: done | |
264 | ]]) | |
265 | ||
266 | # XXX self-linking idl, maps |