]>
Commit | Line | Data |
---|---|---|
f4e38e30 JP |
1 | AT_BANNER([ovn-nbctl]) |
2 | ||
3 | # OVN_NBCTL_TEST_START | |
4 | m4_define([OVN_NBCTL_TEST_START], | |
6132b241 | 5 | [dnl Create ovn-nb database. |
dfef14ee | 6 | AT_KEYWORDS([ovn]) |
f4e38e30 JP |
7 | AT_CHECK([ovsdb-tool create ovn-nb.db $abs_top_srcdir/ovn/ovn-nb.ovsschema]) |
8 | ||
9 | dnl Start ovsdb-server. | |
60bdd011 | 10 | AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --log-file --remote=punix:$OVS_RUNDIR/ovnnb_db.sock ovn-nb.db], [0], [], [stderr]) |
53eb8cb8 | 11 | on_exit "kill `cat ovsdb-server.pid`" |
fa183acc | 12 | AT_CHECK([ovn-nbctl init]) |
f4e38e30 JP |
13 | AT_CHECK([[sed < stderr ' |
14 | /vlog|INFO|opened log file/d | |
15 | /ovsdb_server|INFO|ovsdb-server (Open vSwitch)/d']]) | |
16 | AT_CAPTURE_FILE([ovsdb-server.log]) | |
17 | ]) | |
18 | ||
19 | # OVN_NBCTL_TEST_STOP | |
20 | m4_define([OVN_NBCTL_TEST_STOP], | |
fb496f92 NS |
21 | [# removes all 'Broken pipe' warning logs from ovsdb-server.log. this is in |
22 | # that *ctl command (e.g. ovn-nbctl) exits right after committing the change | |
23 | # to database. however, in reaction, some daemon (e.g. ovn-controller-vtep) | |
24 | # may immediately update the database. this later update may cause database | |
25 | # sending update back to *ctl command if *ctl has not proceeded to exit yet. | |
26 | # and if *ctl command exits before database calling send, the send from | |
247447ff LR |
27 | # database will fail with 'Broken pipe' error. Also removes all "connection |
28 | # reset" warning logs by a similar rationale (either EPIPE or ECONNRESET can | |
29 | # be returned on a send depending on whether the peer had unconsumed data when | |
30 | # it closed the socket). | |
fb496f92 | 31 | AT_CHECK([check_logs "$1 |
247447ff | 32 | /reset by peer/d |
fb496f92 | 33 | /Broken pipe/d"]) |
d9c8c57c | 34 | OVS_APP_EXIT_AND_WAIT([ovsdb-server])]) |
f4e38e30 JP |
35 | |
36 | ||
ea46a4e9 | 37 | AT_SETUP([ovn-nbctl - basic switch commands]) |
f4e38e30 JP |
38 | OVN_NBCTL_TEST_START |
39 | ||
ea46a4e9 JP |
40 | AT_CHECK([ovn-nbctl ls-add ls0]) |
41 | AT_CHECK([ovn-nbctl ls-list | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl | |
f4e38e30 JP |
42 | <0> (ls0) |
43 | ]) | |
44 | ||
ea46a4e9 JP |
45 | AT_CHECK([ovn-nbctl ls-add ls1]) |
46 | AT_CHECK([ovn-nbctl ls-list | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl | |
f4e38e30 JP |
47 | <0> (ls0) |
48 | <1> (ls1) | |
49 | ]) | |
50 | ||
ea46a4e9 JP |
51 | AT_CHECK([ovn-nbctl ls-del ls0]) |
52 | AT_CHECK([ovn-nbctl ls-list | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl | |
f4e38e30 JP |
53 | <0> (ls1) |
54 | ]) | |
55 | ||
d24d3372 | 56 | AT_CHECK([ovn-nbctl show ls0]) |
ea46a4e9 | 57 | AT_CHECK([ovn-nbctl ls-add ls0]) |
d24d3372 | 58 | AT_CHECK([ovn-nbctl show ls0 | ${PERL} $srcdir/uuidfilt.pl], [0], |
7a16f569 | 59 | [switch <0> (ls0) |
d24d3372 | 60 | ]) |
ea46a4e9 JP |
61 | AT_CHECK([ovn-nbctl ls-add ls0], [1], [], |
62 | [ovn-nbctl: ls0: a switch with this name already exists | |
4ff6642f | 63 | ]) |
ea46a4e9 | 64 | AT_CHECK([ovn-nbctl --may-exist ls-add ls0]) |
4ff6642f | 65 | AT_CHECK([ovn-nbctl show ls0 | ${PERL} $srcdir/uuidfilt.pl], [0], |
7a16f569 | 66 | [switch <0> (ls0) |
4ff6642f | 67 | ]) |
ea46a4e9 JP |
68 | AT_CHECK([ovn-nbctl --add-duplicate ls-add ls0]) |
69 | AT_CHECK([ovn-nbctl --may-exist --add-duplicate ls-add ls0], [1], [], | |
4ff6642f BP |
70 | [ovn-nbctl: --may-exist and --add-duplicate may not be used together |
71 | ]) | |
ea46a4e9 | 72 | AT_CHECK([ovn-nbctl ls-del ls0], [1], [], |
d24d3372 BP |
73 | [ovn-nbctl: Multiple logical switches named 'ls0'. Use a UUID. |
74 | ]) | |
75 | ||
ea46a4e9 JP |
76 | AT_CHECK([ovn-nbctl ls-del ls2], [1], [], |
77 | [ovn-nbctl: ls2: switch name not found | |
d24d3372 | 78 | ]) |
ea46a4e9 | 79 | AT_CHECK([ovn-nbctl --if-exists ls-del ls2]) |
d24d3372 | 80 | |
ea46a4e9 JP |
81 | AT_CHECK([ovn-nbctl ls-add]) |
82 | AT_CHECK([ovn-nbctl ls-add]) | |
83 | AT_CHECK([ovn-nbctl --add-duplicate ls-add], [1], [], | |
4ff6642f BP |
84 | [ovn-nbctl: --add-duplicate requires specifying a name |
85 | ]) | |
ea46a4e9 | 86 | AT_CHECK([ovn-nbctl --may-exist ls-add], [1], [], |
4ff6642f BP |
87 | [ovn-nbctl: --may-exist requires specifying a name |
88 | ]) | |
89 | ||
f4e38e30 JP |
90 | OVN_NBCTL_TEST_STOP |
91 | AT_CLEANUP | |
92 | ||
93 | dnl --------------------------------------------------------------------- | |
94 | ||
31ed1192 | 95 | AT_SETUP([ovn-nbctl - basic logical switch port commands]) |
f4e38e30 JP |
96 | OVN_NBCTL_TEST_START |
97 | ||
ea46a4e9 | 98 | AT_CHECK([ovn-nbctl ls-add ls0]) |
31ed1192 JP |
99 | AT_CHECK([ovn-nbctl lsp-add ls0 lp0]) |
100 | AT_CHECK([ovn-nbctl lsp-add ls0 lp0], [1], [], | |
101 | [ovn-nbctl: lp0: a port with this name already exists | |
d24d3372 | 102 | ]) |
31ed1192 JP |
103 | AT_CHECK([ovn-nbctl --may-exist lsp-add ls0 lp0]) |
104 | AT_CHECK([ovn-nbctl lsp-list ls0 | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl | |
f4e38e30 JP |
105 | <0> (lp0) |
106 | ]) | |
107 | ||
31ed1192 JP |
108 | AT_CHECK([ovn-nbctl lsp-add ls0 lp1]) |
109 | AT_CHECK([ovn-nbctl lsp-list ls0 | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl | |
f4e38e30 JP |
110 | <0> (lp0) |
111 | <1> (lp1) | |
112 | ]) | |
113 | ||
ea46a4e9 | 114 | AT_CHECK([ovn-nbctl ls-add ls1]) |
31ed1192 JP |
115 | AT_CHECK([ovn-nbctl lsp-add ls0 lp1], [1], [], |
116 | [ovn-nbctl: lp1: a port with this name already exists | |
d24d3372 | 117 | ]) |
31ed1192 | 118 | AT_CHECK([ovn-nbctl --may-exist lsp-add ls1 lp1], [1], [], |
ea46a4e9 | 119 | [ovn-nbctl: lp1: port already exists but in switch ls0 |
d24d3372 | 120 | ]) |
31ed1192 JP |
121 | AT_CHECK([ovn-nbctl --may-exist lsp-add ls0 lp1 lp0 5], [1], [], |
122 | [ovn-nbctl: lp1: port already exists but has no parent | |
d24d3372 BP |
123 | ]) |
124 | ||
31ed1192 JP |
125 | AT_CHECK([ovn-nbctl lsp-del lp1]) |
126 | AT_CHECK([ovn-nbctl lsp-list ls0 | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl | |
f4e38e30 JP |
127 | <0> (lp0) |
128 | ]) | |
129 | ||
31ed1192 JP |
130 | AT_CHECK([ovn-nbctl lsp-add ls0 lp2 lp3 5]) |
131 | AT_CHECK([ovn-nbctl --may-exist lsp-add ls0 lp2 lp4 5], [1], [], | |
132 | [ovn-nbctl: lp2: port already exists with different parent lp3 | |
d24d3372 | 133 | ]) |
31ed1192 | 134 | AT_CHECK([ovn-nbctl --may-exist lsp-add ls0 lp2 lp3 10], [1], [], |
b511690b | 135 | [ovn-nbctl: lp2: port already exists with different tag_request 5 |
d24d3372 | 136 | ]) |
b511690b | 137 | AT_CHECK([ovn-nbctl clear Logical_Switch_Port lp2 tag_request]) |
31ed1192 | 138 | AT_CHECK([ovn-nbctl --may-exist lsp-add ls0 lp2 lp3 5], [1], [], |
b511690b | 139 | [ovn-nbctl: lp2: port already exists but has no tag_request |
d24d3372 BP |
140 | ]) |
141 | ||
f4e38e30 JP |
142 | OVN_NBCTL_TEST_STOP |
143 | AT_CLEANUP | |
144 | ||
145 | dnl --------------------------------------------------------------------- | |
146 | ||
7127583d | 147 | AT_SETUP([ovn-nbctl - lport addresses]) |
f4e38e30 JP |
148 | OVN_NBCTL_TEST_START |
149 | ||
ea46a4e9 | 150 | AT_CHECK([ovn-nbctl ls-add ls0]) |
31ed1192 JP |
151 | AT_CHECK([ovn-nbctl lsp-add ls0 lp0]) |
152 | AT_CHECK([ovn-nbctl lsp-get-addresses lp0], [0], [dnl | |
f4e38e30 JP |
153 | ]) |
154 | ||
31ed1192 JP |
155 | AT_CHECK([ovn-nbctl lsp-set-addresses lp0 00:11:22:33:44:55 unknown]) |
156 | AT_CHECK([ovn-nbctl lsp-get-addresses lp0], [0], [dnl | |
f4e38e30 JP |
157 | 00:11:22:33:44:55 |
158 | unknown | |
159 | ]) | |
160 | ||
31ed1192 JP |
161 | AT_CHECK([ovn-nbctl lsp-set-addresses lp0]) |
162 | AT_CHECK([ovn-nbctl lsp-get-addresses lp0], [0], [dnl | |
f4e38e30 JP |
163 | ]) |
164 | ||
165 | OVN_NBCTL_TEST_STOP | |
166 | AT_CLEANUP | |
167 | ||
168 | dnl --------------------------------------------------------------------- | |
169 | ||
170 | AT_SETUP([ovn-nbctl - port security]) | |
171 | OVN_NBCTL_TEST_START | |
172 | ||
ea46a4e9 | 173 | AT_CHECK([ovn-nbctl ls-add ls0]) |
31ed1192 JP |
174 | AT_CHECK([ovn-nbctl lsp-add ls0 lp0]) |
175 | AT_CHECK([ovn-nbctl lsp-get-addresses lp0], [0], [dnl | |
f4e38e30 JP |
176 | ]) |
177 | ||
31ed1192 JP |
178 | AT_CHECK([ovn-nbctl lsp-set-port-security lp0 aa:bb:cc:dd:ee:ff 00:11:22:33:44:55]) |
179 | AT_CHECK([ovn-nbctl lsp-get-port-security lp0], [0], [dnl | |
f4e38e30 JP |
180 | 00:11:22:33:44:55 |
181 | aa:bb:cc:dd:ee:ff | |
182 | ]) | |
183 | ||
31ed1192 JP |
184 | AT_CHECK([ovn-nbctl lsp-set-port-security lp0]) |
185 | AT_CHECK([ovn-nbctl lsp-get-port-security lp0], [0], [dnl | |
f4e38e30 JP |
186 | ]) |
187 | ||
188 | OVN_NBCTL_TEST_STOP | |
189 | AT_CLEANUP | |
8f96455d JP |
190 | |
191 | dnl --------------------------------------------------------------------- | |
192 | ||
193 | AT_SETUP([ovn-nbctl - ACLs]) | |
194 | OVN_NBCTL_TEST_START | |
195 | ||
ea46a4e9 | 196 | AT_CHECK([ovn-nbctl ls-add ls0]) |
70799ae8 | 197 | AT_CHECK([ovn-nbctl --log acl-add ls0 from-lport 600 udp drop]) |
d383eed5 | 198 | AT_CHECK([ovn-nbctl --log --name=test --severity=info acl-add ls0 to-lport 500 udp drop]) |
8f96455d JP |
199 | AT_CHECK([ovn-nbctl acl-add ls0 from-lport 400 tcp drop]) |
200 | AT_CHECK([ovn-nbctl acl-add ls0 to-lport 300 tcp drop]) | |
201 | AT_CHECK([ovn-nbctl acl-add ls0 from-lport 200 ip drop]) | |
202 | AT_CHECK([ovn-nbctl acl-add ls0 to-lport 100 ip drop]) | |
fa3cc9b9 HZ |
203 | dnl Add duplicated ACL |
204 | AT_CHECK([ovn-nbctl acl-add ls0 to-lport 100 ip drop], [1], [], [stderr]) | |
205 | AT_CHECK([grep 'already existed' stderr], [0], [ignore]) | |
206 | AT_CHECK([ovn-nbctl --may-exist acl-add ls0 to-lport 100 ip drop]) | |
8f96455d JP |
207 | |
208 | AT_CHECK([ovn-nbctl acl-list ls0], [0], [dnl | |
d383eed5 | 209 | from-lport 600 (udp) drop log() |
8f96455d JP |
210 | from-lport 400 (tcp) drop |
211 | from-lport 200 (ip) drop | |
d383eed5 | 212 | to-lport 500 (udp) drop log(name=test,severity=info) |
8f96455d JP |
213 | to-lport 300 (tcp) drop |
214 | to-lport 100 (ip) drop | |
215 | ]) | |
216 | ||
217 | dnl Delete in one direction. | |
218 | AT_CHECK([ovn-nbctl acl-del ls0 to-lport]) | |
219 | AT_CHECK([ovn-nbctl acl-list ls0], [0], [dnl | |
d383eed5 | 220 | from-lport 600 (udp) drop log() |
8f96455d JP |
221 | from-lport 400 (tcp) drop |
222 | from-lport 200 (ip) drop | |
223 | ]) | |
224 | ||
225 | dnl Delete all ACLs. | |
226 | AT_CHECK([ovn-nbctl acl-del ls0]) | |
227 | AT_CHECK([ovn-nbctl acl-list ls0], [0], [dnl | |
228 | ]) | |
229 | ||
230 | AT_CHECK([ovn-nbctl acl-add ls0 from-lport 600 udp drop]) | |
231 | AT_CHECK([ovn-nbctl acl-add ls0 from-lport 400 tcp drop]) | |
232 | AT_CHECK([ovn-nbctl acl-add ls0 from-lport 200 ip drop]) | |
233 | ||
234 | dnl Delete a single flow. | |
235 | AT_CHECK([ovn-nbctl acl-del ls0 from-lport 400 tcp]) | |
236 | AT_CHECK([ovn-nbctl acl-list ls0], [0], [dnl | |
237 | from-lport 600 (udp) drop | |
238 | from-lport 200 (ip) drop | |
239 | ]) | |
240 | ||
241 | OVN_NBCTL_TEST_STOP | |
e2bfcad6 | 242 | AT_CLEANUP |
243 | ||
3722730e | 244 | dnl --------------------------------------------------------------------- |
245 | AT_SETUP([ovn-nbctl - NATs]) | |
246 | OVN_NBCTL_TEST_START | |
247 | AT_CHECK([ovn-nbctl lr-add lr0]) | |
248 | AT_CHECK([ovn-nbctl lr-nat-add lr0 snatt 30.0.0.2 192.168.1.2], [1], [], | |
249 | [ovn-nbctl: snatt: type must be one of "dnat", "snat" and "dnat_and_snat". | |
250 | ]) | |
251 | AT_CHECK([ovn-nbctl lr-nat-add lr0 snat 30.0.0.2a 192.168.1.2], [1], [], | |
252 | [ovn-nbctl: 30.0.0.2a: should be an IPv4 address. | |
253 | ]) | |
254 | AT_CHECK([ovn-nbctl lr-nat-add lr0 snat 30.0.0 192.168.1.2], [1], [], | |
255 | [ovn-nbctl: 30.0.0: should be an IPv4 address. | |
256 | ]) | |
257 | AT_CHECK([ovn-nbctl lr-nat-add lr0 snat 30.0.0.2/24 192.168.1.2], [1], [], | |
258 | [ovn-nbctl: 30.0.0.2/24: should be an IPv4 address. | |
259 | ]) | |
260 | AT_CHECK([ovn-nbctl lr-nat-add lr0 snat 30.0.0.2:80 192.168.1.2], [1], [], | |
261 | [ovn-nbctl: 30.0.0.2:80: should be an IPv4 address. | |
262 | ]) | |
263 | AT_CHECK([ovn-nbctl lr-nat-add lr0 snat 30.0.0.2 192.168.1.2a], [1], [], | |
264 | [ovn-nbctl: 192.168.1.2a: should be an IPv4 address or network. | |
265 | ]) | |
266 | AT_CHECK([ovn-nbctl lr-nat-add lr0 snat 30.0.0.2 192.168.1], [1], [], | |
267 | [ovn-nbctl: 192.168.1: should be an IPv4 address or network. | |
268 | ]) | |
269 | AT_CHECK([ovn-nbctl lr-nat-add lr0 snat 30.0.0.2 192.168.1.2:80], [1], [], | |
270 | [ovn-nbctl: 192.168.1.2:80: should be an IPv4 address or network. | |
271 | ]) | |
272 | AT_CHECK([ovn-nbctl lr-nat-add lr0 snat 30.0.0.2 192.168.1.2/a], [1], [], | |
273 | [ovn-nbctl: 192.168.1.2/a: should be an IPv4 address or network. | |
274 | ]) | |
275 | AT_CHECK([ovn-nbctl lr-nat-add lr0 dnat 30.0.0.2 192.168.1.2a], [1], [], | |
276 | [ovn-nbctl: 192.168.1.2a: should be an IPv4 address. | |
277 | ]) | |
278 | AT_CHECK([ovn-nbctl lr-nat-add lr0 dnat 30.0.0.2 192.168.1], [1], [], | |
279 | [ovn-nbctl: 192.168.1: should be an IPv4 address. | |
280 | ]) | |
281 | AT_CHECK([ovn-nbctl lr-nat-add lr0 dnat 30.0.0.2 192.168.1.2:80], [1], [], | |
282 | [ovn-nbctl: 192.168.1.2:80: should be an IPv4 address. | |
283 | ]) | |
284 | AT_CHECK([ovn-nbctl lr-nat-add lr0 dnat 30.0.0.2 192.168.1.2/24], [1], [], | |
285 | [ovn-nbctl: 192.168.1.2/24: should be an IPv4 address. | |
286 | ]) | |
287 | AT_CHECK([ovn-nbctl lr-nat-add lr0 dnat_and_snat 30.0.0.2 192.168.1.2/24], [1], [], | |
288 | [ovn-nbctl: 192.168.1.2/24: should be an IPv4 address. | |
289 | ]) | |
6a725785 MS |
290 | AT_CHECK([ovn-nbctl lr-nat-add lr0 dnat_and_snat 30.0.0.2 192.168.1.2 lp0], [1], [], |
291 | [ovn-nbctl: lr-nat-add with logical_port must also specify external_mac. | |
292 | ]) | |
293 | AT_CHECK([ovn-nbctl lr-nat-add lr0 dnat 30.0.0.2 192.168.1.2 lp0 00:00:00:01:02:03], [1], [], | |
294 | [ovn-nbctl: logical_port and external_mac are only valid when type is "dnat_and_snat". | |
295 | ]) | |
296 | AT_CHECK([ovn-nbctl lr-nat-add lr0 snat 30.0.0.2 192.168.1.2 lp0 00:00:00:01:02:03], [1], [], | |
297 | [ovn-nbctl: logical_port and external_mac are only valid when type is "dnat_and_snat". | |
298 | ]) | |
299 | AT_CHECK([ovn-nbctl lr-nat-add lr0 dnat_and_snat 30.0.0.2 192.168.1.2 lp0 00:00:00:01:02:03], [1], [], | |
300 | [ovn-nbctl: lp0: port name not found | |
301 | ]) | |
302 | AT_CHECK([ovn-nbctl ls-add ls0]) | |
303 | AT_CHECK([ovn-nbctl lsp-add ls0 lp0]) | |
304 | AT_CHECK([ovn-nbctl lr-nat-add lr0 dnat_and_snat 30.0.0.2 192.168.1.2 lp0 00:00:00:01:02], [1], [], | |
305 | [ovn-nbctl: invalid mac address 00:00:00:01:02. | |
306 | ]) | |
3722730e | 307 | |
308 | dnl Add snat and dnat | |
309 | AT_CHECK([ovn-nbctl lr-nat-add lr0 snat 30.0.0.1 192.168.1.0/24]) | |
310 | AT_CHECK([ovn-nbctl lr-nat-add lr0 dnat 30.0.0.1 192.168.1.2]) | |
311 | AT_CHECK([ovn-nbctl lr-nat-add lr0 dnat_and_snat 30.0.0.1 192.168.1.2]) | |
6a725785 | 312 | AT_CHECK([ovn-nbctl lr-nat-add lr0 dnat_and_snat 30.0.0.2 192.168.1.3 lp0 00:00:00:01:02:03]) |
3722730e | 313 | AT_CHECK([ovn-nbctl lr-nat-list lr0], [0], [dnl |
6a725785 | 314 | TYPE EXTERNAL_IP LOGICAL_IP EXTERNAL_MAC LOGICAL_PORT |
3722730e | 315 | dnat 30.0.0.1 192.168.1.2 |
316 | dnat_and_snat 30.0.0.1 192.168.1.2 | |
6a725785 | 317 | dnat_and_snat 30.0.0.2 192.168.1.3 00:00:00:01:02:03 lp0 |
3722730e | 318 | snat 30.0.0.1 192.168.1.0/24 |
319 | ]) | |
320 | AT_CHECK([ovn-nbctl lr-nat-add lr0 snat 30.0.0.1 192.168.1.0/24], [1], [], | |
321 | [ovn-nbctl: 30.0.0.1, 192.168.1.0/24: a NAT with this external_ip and logical_ip already exists | |
322 | ]) | |
323 | AT_CHECK([ovn-nbctl lr-nat-add lr0 snat 30.0.0.1 192.168.1.10/24], [1], [], | |
324 | [ovn-nbctl: 30.0.0.1, 192.168.1.0/24: a NAT with this external_ip and logical_ip already exists | |
325 | ]) | |
326 | AT_CHECK([ovn-nbctl --may-exist lr-nat-add lr0 snat 30.0.0.1 192.168.1.0/24]) | |
327 | AT_CHECK([ovn-nbctl lr-nat-add lr0 snat 30.0.0.2 192.168.1.0/24], [1], [], | |
328 | [ovn-nbctl: a NAT with this type (snat) and logical_ip (192.168.1.0/24) already exists | |
329 | ]) | |
330 | AT_CHECK([ovn-nbctl lr-nat-add lr0 dnat 30.0.0.1 192.168.1.2], [1], [], | |
331 | [ovn-nbctl: 30.0.0.1, 192.168.1.2: a NAT with this external_ip and logical_ip already exists | |
332 | ]) | |
333 | AT_CHECK([ovn-nbctl --may-exist lr-nat-add lr0 dnat 30.0.0.1 192.168.1.2]) | |
334 | AT_CHECK([ovn-nbctl lr-nat-add lr0 dnat 30.0.0.1 192.168.1.3], [1], [], | |
335 | [ovn-nbctl: a NAT with this type (dnat) and external_ip (30.0.0.1) already exists | |
336 | ]) | |
337 | AT_CHECK([ovn-nbctl lr-nat-add lr0 dnat_and_snat 30.0.0.1 192.168.1.2], [1], [], | |
338 | [ovn-nbctl: 30.0.0.1, 192.168.1.2: a NAT with this external_ip and logical_ip already exists | |
339 | ]) | |
340 | AT_CHECK([ovn-nbctl --may-exist lr-nat-add lr0 dnat_and_snat 30.0.0.1 192.168.1.2]) | |
341 | AT_CHECK([ovn-nbctl lr-nat-add lr0 dnat_and_snat 30.0.0.1 192.168.1.3], [1], [], | |
342 | [ovn-nbctl: a NAT with this type (dnat_and_snat) and external_ip (30.0.0.1) already exists | |
343 | ]) | |
6a725785 MS |
344 | AT_CHECK([ovn-nbctl --may-exist lr-nat-add lr0 dnat_and_snat 30.0.0.2 192.168.1.3 lp0 00:00:00:04:05:06]) |
345 | AT_CHECK([ovn-nbctl lr-nat-list lr0], [0], [dnl | |
346 | TYPE EXTERNAL_IP LOGICAL_IP EXTERNAL_MAC LOGICAL_PORT | |
347 | dnat 30.0.0.1 192.168.1.2 | |
348 | dnat_and_snat 30.0.0.1 192.168.1.2 | |
349 | dnat_and_snat 30.0.0.2 192.168.1.3 00:00:00:04:05:06 lp0 | |
350 | snat 30.0.0.1 192.168.1.0/24 | |
351 | ]) | |
352 | AT_CHECK([ovn-nbctl --may-exist lr-nat-add lr0 dnat_and_snat 30.0.0.2 192.168.1.3]) | |
353 | AT_CHECK([ovn-nbctl lr-nat-list lr0], [0], [dnl | |
354 | TYPE EXTERNAL_IP LOGICAL_IP EXTERNAL_MAC LOGICAL_PORT | |
355 | dnat 30.0.0.1 192.168.1.2 | |
356 | dnat_and_snat 30.0.0.1 192.168.1.2 | |
357 | dnat_and_snat 30.0.0.2 192.168.1.3 | |
358 | snat 30.0.0.1 192.168.1.0/24 | |
359 | ]) | |
3722730e | 360 | |
361 | dnl Deletes the NATs | |
6a725785 MS |
362 | AT_CHECK([ovn-nbctl lr-nat-del lr0 dnat_and_snat 30.0.0.3], [1], [], |
363 | [ovn-nbctl: no matching NAT with the type (dnat_and_snat) and external_ip (30.0.0.3) | |
3722730e | 364 | ]) |
365 | AT_CHECK([ovn-nbctl lr-nat-del lr0 dnat 30.0.0.2], [1], [], | |
366 | [ovn-nbctl: no matching NAT with the type (dnat) and external_ip (30.0.0.2) | |
367 | ]) | |
368 | AT_CHECK([ovn-nbctl lr-nat-del lr0 snat 192.168.10.0/24], [1], [], | |
369 | [ovn-nbctl: no matching NAT with the type (snat) and logical_ip (192.168.10.0/24) | |
370 | ]) | |
371 | AT_CHECK([ovn-nbctl --if-exists lr-nat-del lr0 snat 192.168.10.0/24]) | |
372 | ||
373 | AT_CHECK([ovn-nbctl lr-nat-del lr0 dnat_and_snat 30.0.0.1]) | |
374 | AT_CHECK([ovn-nbctl lr-nat-list lr0], [0], [dnl | |
6a725785 | 375 | TYPE EXTERNAL_IP LOGICAL_IP EXTERNAL_MAC LOGICAL_PORT |
3722730e | 376 | dnat 30.0.0.1 192.168.1.2 |
6a725785 | 377 | dnat_and_snat 30.0.0.2 192.168.1.3 |
3722730e | 378 | snat 30.0.0.1 192.168.1.0/24 |
379 | ]) | |
380 | ||
381 | AT_CHECK([ovn-nbctl lr-nat-del lr0 dnat]) | |
382 | AT_CHECK([ovn-nbctl lr-nat-list lr0], [0], [dnl | |
6a725785 MS |
383 | TYPE EXTERNAL_IP LOGICAL_IP EXTERNAL_MAC LOGICAL_PORT |
384 | dnat_and_snat 30.0.0.2 192.168.1.3 | |
3722730e | 385 | snat 30.0.0.1 192.168.1.0/24 |
386 | ]) | |
387 | ||
388 | AT_CHECK([ovn-nbctl lr-nat-del lr0]) | |
389 | AT_CHECK([ovn-nbctl lr-nat-list lr0], [0], []) | |
390 | AT_CHECK([ovn-nbctl lr-nat-del lr0]) | |
391 | AT_CHECK([ovn-nbctl lr-nat-del lr0 dnat]) | |
392 | OVN_NBCTL_TEST_STOP | |
393 | AT_CLEANUP | |
394 | ||
e2bfcad6 | 395 | dnl --------------------------------------------------------------------- |
396 | ||
397 | AT_SETUP([ovn-nbctl - LBs]) | |
398 | OVN_NBCTL_TEST_START | |
399 | ||
400 | dnl Add two LBs. | |
401 | AT_CHECK([ovn-nbctl lb-add lb0 30.0.0.10:80a 192.168.10.10:80,192.168.10.20:80 tcp], [1], [], | |
c19105a0 | 402 | [ovn-nbctl: 30.0.0.10:80a: should be an IP address (or an IP address and a port number with : as a separator). |
e2bfcad6 | 403 | ]) |
404 | ||
405 | AT_CHECK([ovn-nbctl lb-add lb0 30.0.0.10:a80 192.168.10.10:80,192.168.10.20:80 tcp], [1], [], | |
c19105a0 | 406 | [ovn-nbctl: 30.0.0.10:a80: should be an IP address (or an IP address and a port number with : as a separator). |
e2bfcad6 | 407 | ]) |
408 | ||
409 | AT_CHECK([ovn-nbctl lb-add lb0 30.0.0.10: 192.168.10.10:80,192.168.10.20:80 tcp], [1], [], | |
c19105a0 | 410 | [ovn-nbctl: 30.0.0.10:: should be an IP address (or an IP address and a port number with : as a separator). |
e2bfcad6 | 411 | ]) |
412 | ||
413 | AT_CHECK([ovn-nbctl lb-add lb0 30.0.0.10:80 192.168.10.10:80,192.168.10.20 tcp], [1], [], | |
c19105a0 | 414 | [ovn-nbctl: 192.168.10.20: should be an IP address and a port number with : as a separator. |
e2bfcad6 | 415 | ]) |
416 | ||
417 | AT_CHECK([ovn-nbctl lb-add lb0 30.0.0.1a 192.168.10.10:80,192.168.10.20:80], [1], [], | |
c19105a0 | 418 | [ovn-nbctl: 30.0.0.1a: should be an IP address (or an IP address and a port number with : as a separator). |
e2bfcad6 | 419 | ]) |
420 | ||
421 | AT_CHECK([ovn-nbctl lb-add lb0 30.0.0 192.168.10.10:80,192.168.10.20:80], [1], [], | |
c19105a0 | 422 | [ovn-nbctl: 192.168.10.10:80: should be an IP address. |
e2bfcad6 | 423 | ]) |
424 | ||
425 | AT_CHECK([ovn-nbctl lb-add lb0 30.0.0.10 192.168.10.10,192.168.10.20:80], [1], [], | |
c19105a0 | 426 | [ovn-nbctl: 192.168.10.20:80: should be an IP address. |
e2bfcad6 | 427 | ]) |
428 | ||
429 | AT_CHECK([ovn-nbctl lb-add lb0 30.0.0.10 192.168.10.10:a80], [1], [], | |
c19105a0 | 430 | [ovn-nbctl: 192.168.10.10:a80: should be an IP address. |
e2bfcad6 | 431 | ]) |
432 | ||
433 | AT_CHECK([ovn-nbctl lb-add lb0 30.0.0.10 192.168.10.10:], [1], [], | |
c19105a0 | 434 | [ovn-nbctl: 192.168.10.10:: should be an IP address. |
e2bfcad6 | 435 | ]) |
436 | ||
437 | AT_CHECK([ovn-nbctl lb-add lb0 30.0.0.10 192.168.10.1a], [1], [], | |
c19105a0 | 438 | [ovn-nbctl: 192.168.10.1a: should be an IP address. |
e2bfcad6 | 439 | ]) |
440 | ||
441 | AT_CHECK([ovn-nbctl lb-add lb0 30.0.0.10 192.168.10.10 tcp], [1], [], | |
442 | [ovn-nbctl: Protocol is unnecessary when no port of vip is given. | |
443 | ]) | |
444 | ||
445 | AT_CHECK([ovn-nbctl lb-add lb0 30.0.0.10 192.168.10.10:900 tcp], [1], [], | |
446 | [ovn-nbctl: Protocol is unnecessary when no port of vip is given. | |
447 | ]) | |
448 | ||
449 | dnl Add ips to lb | |
450 | AT_CHECK([ovn-nbctl lb-add lb0 30.0.0.10:80 ,,,192.168.10.10:80,,,,,]) | |
451 | AT_CHECK([ovn-nbctl lb-add lb1 30.0.0.10:80 ,,,192.168.10.10:80,,,,192.168.10.20:80,,,,]) | |
452 | AT_CHECK([ovn-nbctl lb-list | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl | |
c19105a0 MM |
453 | UUID LB PROTO VIP IPs |
454 | <0> lb0 tcp 30.0.0.10:80 192.168.10.10:80 | |
455 | <1> lb1 tcp 30.0.0.10:80 192.168.10.10:80,192.168.10.20:80 | |
e2bfcad6 | 456 | ]) |
457 | AT_CHECK([ovn-nbctl lb-del lb0]) | |
458 | AT_CHECK([ovn-nbctl lb-del lb1]) | |
459 | ||
460 | AT_CHECK([ovn-nbctl lb-add lb0 30.0.0.10:80 192.168.10.10:80,192.168.10.20:80]) | |
461 | AT_CHECK([ovn-nbctl lb-add lb1 30.0.0.10:80 192.168.10.10:80,192.168.10.20:80 tcp]) | |
462 | AT_CHECK([ovn-nbctl lb-list | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl | |
c19105a0 MM |
463 | UUID LB PROTO VIP IPs |
464 | <0> lb0 tcp 30.0.0.10:80 192.168.10.10:80,192.168.10.20:80 | |
465 | <1> lb1 tcp 30.0.0.10:80 192.168.10.10:80,192.168.10.20:80 | |
e2bfcad6 | 466 | ]) |
467 | ||
468 | dnl Update the VIP of the lb1. | |
469 | AT_CHECK([ovn-nbctl --may-exist lb-add lb1 30.0.0.10:80 192.168.10.10:80,192.168.10.20:8080]) | |
470 | AT_CHECK([ovn-nbctl lb-list | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl | |
c19105a0 MM |
471 | UUID LB PROTO VIP IPs |
472 | <0> lb0 tcp 30.0.0.10:80 192.168.10.10:80,192.168.10.20:80 | |
473 | <1> lb1 tcp 30.0.0.10:80 192.168.10.10:80,192.168.10.20:8080 | |
e2bfcad6 | 474 | ]) |
475 | ||
476 | AT_CHECK([ovn-nbctl --may-exist lb-add lb1 30.0.0.10:80 192.168.10.10:80,192.168.10.20:8080 udp]) | |
477 | AT_CHECK([ovn-nbctl lb-list | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl | |
c19105a0 MM |
478 | UUID LB PROTO VIP IPs |
479 | <0> lb0 tcp 30.0.0.10:80 192.168.10.10:80,192.168.10.20:80 | |
480 | <1> lb1 udp 30.0.0.10:80 192.168.10.10:80,192.168.10.20:8080 | |
e2bfcad6 | 481 | ]) |
482 | ||
483 | dnl Config lb1 with another VIP. | |
484 | AT_CHECK([ovn-nbctl lb-add lb1 30.0.0.20:80 192.168.10.10:80 udp]) | |
485 | AT_CHECK([ovn-nbctl lb-list | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl | |
c19105a0 MM |
486 | UUID LB PROTO VIP IPs |
487 | <0> lb0 tcp 30.0.0.10:80 192.168.10.10:80,192.168.10.20:80 | |
488 | <1> lb1 udp 30.0.0.10:80 192.168.10.10:80,192.168.10.20:8080 | |
489 | udp 30.0.0.20:80 192.168.10.10:80 | |
e2bfcad6 | 490 | ]) |
491 | ||
492 | AT_CHECK([ovn-nbctl lb-del lb1 30.0.0.20:80]) | |
493 | AT_CHECK([ovn-nbctl lb-list | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl | |
c19105a0 MM |
494 | UUID LB PROTO VIP IPs |
495 | <0> lb0 tcp 30.0.0.10:80 192.168.10.10:80,192.168.10.20:80 | |
496 | <1> lb1 udp 30.0.0.10:80 192.168.10.10:80,192.168.10.20:8080 | |
e2bfcad6 | 497 | ]) |
498 | ||
499 | dnl Add LBs whose vip is just an IP address. | |
500 | AT_CHECK([ovn-nbctl lb-add lb2 30.0.0.30 192.168.10.10]) | |
501 | AT_CHECK([ovn-nbctl lb-add lb3 30.0.0.30 192.168.10.10]) | |
502 | AT_CHECK([ovn-nbctl lb-list | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl | |
c19105a0 MM |
503 | UUID LB PROTO VIP IPs |
504 | <0> lb0 tcp 30.0.0.10:80 192.168.10.10:80,192.168.10.20:80 | |
505 | <1> lb1 udp 30.0.0.10:80 192.168.10.10:80,192.168.10.20:8080 | |
506 | <2> lb2 tcp/udp 30.0.0.30 192.168.10.10 | |
507 | <3> lb3 tcp/udp 30.0.0.30 192.168.10.10 | |
e2bfcad6 | 508 | ]) |
509 | AT_CHECK([ovn-nbctl lb-del lb2 30.0.0.30]) | |
510 | AT_CHECK([ovn-nbctl lb-del lb3 30.0.0.30]) | |
511 | ||
512 | AT_CHECK([ovn-nbctl lb-add lb2 30.0.0.10:8080 192.168.10.10:80,192.168.10.20:80 tcp]) | |
513 | AT_CHECK([ovn-nbctl --add-duplicate lb-add lb2 30.0.0.10:8080 192.168.10.10:80,192.168.10.20:80 tcp]) | |
514 | AT_CHECK([ovn-nbctl lb-list | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl | |
c19105a0 MM |
515 | UUID LB PROTO VIP IPs |
516 | <0> lb0 tcp 30.0.0.10:80 192.168.10.10:80,192.168.10.20:80 | |
517 | <1> lb1 udp 30.0.0.10:80 192.168.10.10:80,192.168.10.20:8080 | |
518 | <2> lb2 tcp 30.0.0.10:8080 192.168.10.10:80,192.168.10.20:80 | |
519 | <3> lb2 tcp 30.0.0.10:8080 192.168.10.10:80,192.168.10.20:80 | |
e2bfcad6 | 520 | ]) |
521 | ||
522 | dnl If there are multiple load balancers with the same name, use a UUID to update/delete. | |
523 | AT_CHECK([ovn-nbctl lb-add lb2 30.0.0.10:8080 192.168.10.10:80,192.168.10.20:80 tcp], [1], [], | |
524 | [ovn-nbctl: Multiple load balancers named 'lb2'. Use a UUID. | |
525 | ]) | |
526 | ||
527 | AT_CHECK([ovn-nbctl lb-del lb2], [1], [], | |
528 | [ovn-nbctl: Multiple load balancers named 'lb2'. Use a UUID. | |
529 | ]) | |
530 | ||
531 | AT_CHECK([ovn-nbctl --may-exist lb-add lb1 30.0.0.10:80 192.168.10.10:8080,192.168.10.20:8080 udp]) | |
532 | AT_CHECK([ovn-nbctl --may-exist lb-add lb1 30.0.0.10:8080 192.168.10.10:8080,192.168.10.20:8080 udp]) | |
533 | AT_CHECK([ovn-nbctl --may-exist lb-add lb1 30.0.0.10:9090 192.168.10.10:8080,192.168.10.20:8080 udp]) | |
534 | AT_CHECK([ovn-nbctl lb-del lb0 30.0.0.10:80]) | |
535 | AT_CHECK([ovn-nbctl lb-del lb1]) | |
536 | AT_CHECK([ovn-nbctl lb-list | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl | |
c19105a0 MM |
537 | UUID LB PROTO VIP IPs |
538 | <0> lb2 tcp 30.0.0.10:8080 192.168.10.10:80,192.168.10.20:80 | |
539 | <1> lb2 tcp 30.0.0.10:8080 192.168.10.10:80,192.168.10.20:80 | |
e2bfcad6 | 540 | ]) |
541 | ||
542 | dnl Add load balancer to logical switch. | |
543 | AT_CHECK([ovn-nbctl ls-add ls0]) | |
544 | AT_CHECK([ovn-nbctl lb-add lb0 30.0.0.10:80 192.168.10.10:80,192.168.10.20:80]) | |
545 | AT_CHECK([ovn-nbctl lb-add lb1 30.0.0.10:80 192.168.10.10:80,192.168.10.20:80 udp]) | |
546 | AT_CHECK([ovn-nbctl lb-add lb3 30.0.0.10 192.168.10.10,192.168.10.20]) | |
547 | AT_CHECK([ovn-nbctl ls-lb-add ls0 lb0]) | |
548 | AT_CHECK([ovn-nbctl ls-lb-add ls0 lb1]) | |
549 | AT_CHECK([ovn-nbctl --may-exist ls-lb-add ls0 lb1]) | |
550 | AT_CHECK([ovn-nbctl ls-lb-add ls0 lb2], [1], [], | |
551 | [ovn-nbctl: Multiple load balancers named 'lb2'. Use a UUID. | |
552 | ]) | |
553 | AT_CHECK([ovn-nbctl ls-lb-add ls0 lb3]) | |
554 | ||
555 | AT_CHECK([ovn-nbctl ls-lb-list ls0 | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl | |
c19105a0 MM |
556 | UUID LB PROTO VIP IPs |
557 | <0> lb0 tcp 30.0.0.10:80 192.168.10.10:80,192.168.10.20:80 | |
558 | <1> lb1 udp 30.0.0.10:80 192.168.10.10:80,192.168.10.20:80 | |
559 | <2> lb3 tcp/udp 30.0.0.10 192.168.10.10,192.168.10.20 | |
e2bfcad6 | 560 | ]) |
561 | ||
562 | AT_CHECK([ovn-nbctl ls-lb-del ls0 lb0]) | |
563 | AT_CHECK([ovn-nbctl ls-lb-list ls0 | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl | |
c19105a0 MM |
564 | UUID LB PROTO VIP IPs |
565 | <0> lb1 udp 30.0.0.10:80 192.168.10.10:80,192.168.10.20:80 | |
566 | <1> lb3 tcp/udp 30.0.0.10 192.168.10.10,192.168.10.20 | |
e2bfcad6 | 567 | ]) |
568 | ||
569 | AT_CHECK([ovn-nbctl ls-lb-del ls0 lb1]) | |
570 | AT_CHECK([ovn-nbctl ls-lb-del ls0 lb3]) | |
571 | AT_CHECK([ovn-nbctl ls-lb-list ls0 | ${PERL} $srcdir/uuidfilt.pl], [0], []) | |
572 | AT_CHECK([ovn-nbctl --if-exists ls-lb-del ls0 lb1]) | |
573 | ||
574 | dnl Remove all load balancers from logical switch. | |
575 | AT_CHECK([ovn-nbctl ls-lb-add ls0 lb0]) | |
576 | AT_CHECK([ovn-nbctl ls-lb-add ls0 lb1]) | |
577 | AT_CHECK([ovn-nbctl ls-lb-add ls0 lb3]) | |
578 | AT_CHECK([ovn-nbctl ls-lb-del ls0]) | |
579 | AT_CHECK([ovn-nbctl ls-lb-list ls0 | ${PERL} $srcdir/uuidfilt.pl], [0], []) | |
580 | ||
581 | dnl Add load balancer to logical router. | |
582 | AT_CHECK([ovn-nbctl lr-add lr0]) | |
583 | AT_CHECK([ovn-nbctl lr-lb-add lr0 lb0]) | |
584 | AT_CHECK([ovn-nbctl lr-lb-add lr0 lb1]) | |
585 | AT_CHECK([ovn-nbctl --may-exist lr-lb-add lr0 lb1]) | |
586 | AT_CHECK([ovn-nbctl lr-lb-add lr0 lb2], [1], [], | |
587 | [ovn-nbctl: Multiple load balancers named 'lb2'. Use a UUID. | |
588 | ]) | |
589 | AT_CHECK([ovn-nbctl lr-lb-add lr0 lb3]) | |
590 | ||
591 | AT_CHECK([ovn-nbctl lr-lb-list lr0 | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl | |
c19105a0 MM |
592 | UUID LB PROTO VIP IPs |
593 | <0> lb0 tcp 30.0.0.10:80 192.168.10.10:80,192.168.10.20:80 | |
594 | <1> lb1 udp 30.0.0.10:80 192.168.10.10:80,192.168.10.20:80 | |
595 | <2> lb3 tcp/udp 30.0.0.10 192.168.10.10,192.168.10.20 | |
e2bfcad6 | 596 | ]) |
597 | ||
598 | AT_CHECK([ovn-nbctl lr-lb-del lr0 lb0]) | |
599 | AT_CHECK([ovn-nbctl lr-lb-list lr0 | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl | |
c19105a0 MM |
600 | UUID LB PROTO VIP IPs |
601 | <0> lb1 udp 30.0.0.10:80 192.168.10.10:80,192.168.10.20:80 | |
602 | <1> lb3 tcp/udp 30.0.0.10 192.168.10.10,192.168.10.20 | |
e2bfcad6 | 603 | ]) |
604 | ||
605 | AT_CHECK([ovn-nbctl lr-lb-del lr0 lb1]) | |
606 | AT_CHECK([ovn-nbctl lr-lb-del lr0 lb3]) | |
607 | AT_CHECK([ovn-nbctl lr-lb-list lr0 | ${PERL} $srcdir/uuidfilt.pl], [0], []) | |
608 | AT_CHECK([ovn-nbctl --if-exists lr-lb-del lr0 lb1]) | |
609 | ||
610 | dnl Remove all load balancers from logical router. | |
611 | AT_CHECK([ovn-nbctl lr-lb-add lr0 lb0]) | |
612 | AT_CHECK([ovn-nbctl lr-lb-add lr0 lb1]) | |
613 | AT_CHECK([ovn-nbctl lr-lb-add lr0 lb3]) | |
614 | AT_CHECK([ovn-nbctl lr-lb-del lr0]) | |
615 | AT_CHECK([ovn-nbctl lr-lb-list lr0 | ${PERL} $srcdir/uuidfilt.pl], [0], []) | |
616 | ||
617 | OVN_NBCTL_TEST_STOP | |
8f96455d | 618 | AT_CLEANUP |
c19105a0 MM |
619 | dnl |
620 | dnl --------------------------------------------------------------------- | |
621 | ||
622 | AT_SETUP([ovn-nbctl - LBs IPv6]) | |
623 | OVN_NBCTL_TEST_START | |
624 | ||
625 | dnl A bunch of commands that should fail | |
626 | AT_CHECK([ovn-nbctl lb-add lb0 [[ae0f::10]]:80a [[fd0f::10]]:80,[[fd0f::20]]:80 tcp], [1], [], | |
627 | [ovn-nbctl: [[ae0f::10]]:80a: should be an IP address (or an IP address and a port number with : as a separator). | |
628 | ]) | |
629 | ||
630 | ||
631 | AT_CHECK([ovn-nbctl lb-add lb0 [[ae0f::10]]:a80 [[fd0f::10]]:80,[[fd0f::20]]:80 tcp], [1], [], | |
632 | [ovn-nbctl: [[ae0f::10]]:a80: should be an IP address (or an IP address and a port number with : as a separator). | |
633 | ]) | |
634 | ||
635 | ||
636 | AT_CHECK([ovn-nbctl lb-add lb0 [[ae0f::10]]: [[fd0f::10]]:80,[[fd0f::20]]:80 tcp], [1], [], | |
637 | [ovn-nbctl: [[ae0f::10]]:: should be an IP address (or an IP address and a port number with : as a separator). | |
638 | ]) | |
639 | ||
640 | ||
641 | AT_CHECK([ovn-nbctl lb-add lb0 [[ae0f::10]]:80 [[fd0f::10]]:80,fd0f::20 tcp], [1], [], | |
642 | [ovn-nbctl: fd0f::20: should be an IP address and a port number with : as a separator. | |
643 | ]) | |
644 | ||
645 | ||
646 | AT_CHECK([ovn-nbctl lb-add lb0 ae0f::10fff [[fd0f::10]]:80,fd0f::20 tcp], [1], [], | |
647 | [ovn-nbctl: ae0f::10fff: should be an IP address (or an IP address and a port number with : as a separator). | |
648 | ]) | |
649 | ||
650 | ||
651 | AT_CHECK([ovn-nbctl lb-add lb0 ae0f::10 [[fd0f::10]]:80,[[fd0f::20]]:80], [1], [], | |
652 | [ovn-nbctl: [[fd0f::10]]:80: should be an IP address. | |
653 | ]) | |
654 | ||
655 | ||
656 | AT_CHECK([ovn-nbctl lb-add lb0 ae0f::10 fd0f::10,[[fd0f::20]]:80], [1], [], | |
657 | [ovn-nbctl: [[fd0f::20]]:80: should be an IP address. | |
658 | ]) | |
659 | ||
660 | ||
661 | AT_CHECK([ovn-nbctl lb-add lb0 ae0f::10 [[fd0f::10]]:a80], [1], [], | |
662 | [ovn-nbctl: [[fd0f::10]]:a80: should be an IP address. | |
663 | ]) | |
664 | ||
665 | ||
666 | AT_CHECK([ovn-nbctl lb-add lb0 ae0f::10 [[fd0f::10]]:], [1], [], | |
667 | [ovn-nbctl: [[fd0f::10]]:: should be an IP address. | |
668 | ]) | |
669 | ||
670 | ||
671 | AT_CHECK([ovn-nbctl lb-add lb0 ae0f::10 fd0f::1001a], [1], [], | |
672 | [ovn-nbctl: fd0f::1001a: should be an IP address. | |
673 | ]) | |
674 | ||
675 | ||
676 | AT_CHECK([ovn-nbctl lb-add lb0 ae0f::10 fd0f::10 tcp], [1], [], | |
677 | [ovn-nbctl: Protocol is unnecessary when no port of vip is given. | |
678 | ]) | |
679 | ||
680 | ||
681 | AT_CHECK([ovn-nbctl lb-add lb0 ae0f::10 [[fd0f::10]]:900 tcp], [1], [], | |
682 | [ovn-nbctl: Protocol is unnecessary when no port of vip is given. | |
683 | ]) | |
684 | ||
685 | AT_CHECK([ovn-nbctl lb-add lb0 ae0f::10 192.168.10.10], [1], [], | |
686 | [ovn-nbctl: 192.168.10.10: IP address family is different from VIP ae0f::10. | |
687 | ]) | |
688 | ||
689 | AT_CHECK([ovn-nbctl lb-add lb0 ae0f::10 192.168.10.10], [1], [], | |
690 | [ovn-nbctl: 192.168.10.10: IP address family is different from VIP ae0f::10. | |
691 | ]) | |
692 | ||
693 | AT_CHECK([ovn-nbctl lb-add lb0 [[ae0f::10]]:80 192.168.10.10:80], [1], [], | |
694 | [ovn-nbctl: 192.168.10.10:80: IP address family is different from VIP [[ae0f::10]]:80. | |
695 | ]) | |
696 | ||
697 | AT_CHECK([ovn-nbctl lb-add lb0 30.0.0.10 ae0f::10], [1], [], | |
698 | [ovn-nbctl: ae0f::10: IP address family is different from VIP 30.0.0.10. | |
699 | ]) | |
700 | ||
701 | AT_CHECK([ovn-nbctl lb-add lb0 30.0.0.10:80 [[ae0f::10]]:80], [1], [], | |
702 | [ovn-nbctl: [[ae0f::10]]:80: IP address family is different from VIP 30.0.0.10:80. | |
703 | ]) | |
704 | ||
705 | AT_CHECK([ovn-nbctl lb-add lb0 ae0f::10 fd0f::10]) | |
706 | AT_CHECK([ovn-nbctl lb-add lb0 ae0f:0000:0000:0000:0000:0000:0000:0010 fd0f::20], | |
707 | [1], [], [ovn-nbctl: lb0: a load balancer with this vip (ae0f::10) already exists | |
708 | ]) | |
709 | ||
710 | AT_CHECK([ovn-nbctl lb-del lb0]) | |
711 | ||
712 | dnl Add ips to lb | |
713 | AT_CHECK([ovn-nbctl lb-add lb0 [[ae0f::10]]:80 ,,,[[fd0f::10]]:80,,,,,]) | |
714 | AT_CHECK([ovn-nbctl lb-add lb1 [[ae0f::10]]:80 ,,,[[fd0f::10]]:80,,,,[[fd0f::20]]:80,,,,]) | |
715 | AT_CHECK([ovn-nbctl lb-list | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl | |
716 | UUID LB PROTO VIP IPs | |
717 | <0> lb0 tcp [[ae0f::10]]:80 [[fd0f::10]]:80 | |
718 | <1> lb1 tcp [[ae0f::10]]:80 [[fd0f::10]]:80,[[fd0f::20]]:80 | |
719 | ]) | |
720 | AT_CHECK([ovn-nbctl lb-del lb0]) | |
721 | AT_CHECK([ovn-nbctl lb-del lb1]) | |
722 | ||
723 | ||
724 | AT_CHECK([ovn-nbctl lb-add lb0 [[ae0f::10]]:80 [[fd0f::10]]:80,[[fd0f::20]]:80]) | |
725 | AT_CHECK([ovn-nbctl lb-add lb1 [[ae0f::10]]:80 [[fd0f::10]]:80,[[fd0f::20]]:80 tcp]) | |
726 | AT_CHECK([ovn-nbctl lb-list | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl | |
727 | UUID LB PROTO VIP IPs | |
728 | <0> lb0 tcp [[ae0f::10]]:80 [[fd0f::10]]:80,[[fd0f::20]]:80 | |
729 | <1> lb1 tcp [[ae0f::10]]:80 [[fd0f::10]]:80,[[fd0f::20]]:80 | |
730 | ]) | |
731 | ||
732 | dnl Update the VIP of the lb1. | |
733 | AT_CHECK([ovn-nbctl --may-exist lb-add lb1 [[ae0f::10]]:80 [[fd0f::10]]:80,[[fd0f::20]]:8080]) | |
734 | AT_CHECK([ovn-nbctl lb-list | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl | |
735 | UUID LB PROTO VIP IPs | |
736 | <0> lb0 tcp [[ae0f::10]]:80 [[fd0f::10]]:80,[[fd0f::20]]:80 | |
737 | <1> lb1 tcp [[ae0f::10]]:80 [[fd0f::10]]:80,[[fd0f::20]]:8080 | |
738 | ]) | |
739 | ||
740 | AT_CHECK([ovn-nbctl --may-exist lb-add lb1 [[ae0f::10]]:80 [[fd0f::10]]:80,[[fd0f::20]]:8080 udp]) | |
741 | AT_CHECK([ovn-nbctl lb-list | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl | |
742 | UUID LB PROTO VIP IPs | |
743 | <0> lb0 tcp [[ae0f::10]]:80 [[fd0f::10]]:80,[[fd0f::20]]:80 | |
744 | <1> lb1 udp [[ae0f::10]]:80 [[fd0f::10]]:80,[[fd0f::20]]:8080 | |
745 | ]) | |
746 | ||
747 | dnl Config lb1 with another VIP. | |
748 | AT_CHECK([ovn-nbctl lb-add lb1 [[ae0f::20]]:80 [[fd0f::10]]:80 udp]) | |
749 | AT_CHECK([ovn-nbctl lb-list | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl | |
750 | UUID LB PROTO VIP IPs | |
751 | <0> lb0 tcp [[ae0f::10]]:80 [[fd0f::10]]:80,[[fd0f::20]]:80 | |
752 | <1> lb1 udp [[ae0f::10]]:80 [[fd0f::10]]:80,[[fd0f::20]]:8080 | |
753 | udp [[ae0f::20]]:80 [[fd0f::10]]:80 | |
754 | ]) | |
755 | ||
756 | AT_CHECK([ovn-nbctl lb-del lb1 [[ae0f::20]]:80]) | |
757 | AT_CHECK([ovn-nbctl lb-list | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl | |
758 | UUID LB PROTO VIP IPs | |
759 | <0> lb0 tcp [[ae0f::10]]:80 [[fd0f::10]]:80,[[fd0f::20]]:80 | |
760 | <1> lb1 udp [[ae0f::10]]:80 [[fd0f::10]]:80,[[fd0f::20]]:8080 | |
761 | ]) | |
7127583d | 762 | |
c19105a0 MM |
763 | dnl Add LBs whose vip is just an IP address. |
764 | AT_CHECK([ovn-nbctl lb-add lb2 ae0f::30 fd0f::10]) | |
765 | AT_CHECK([ovn-nbctl lb-add lb3 ae0f::30 fd0f::10]) | |
766 | AT_CHECK([ovn-nbctl lb-list | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl | |
767 | UUID LB PROTO VIP IPs | |
768 | <0> lb0 tcp [[ae0f::10]]:80 [[fd0f::10]]:80,[[fd0f::20]]:80 | |
769 | <1> lb1 udp [[ae0f::10]]:80 [[fd0f::10]]:80,[[fd0f::20]]:8080 | |
770 | <2> lb2 tcp/udp ae0f::30 fd0f::10 | |
771 | <3> lb3 tcp/udp ae0f::30 fd0f::10 | |
772 | ]) | |
773 | AT_CHECK([ovn-nbctl lb-del lb2 ae0f::30]) | |
774 | AT_CHECK([ovn-nbctl lb-del lb3 ae0f::30]) | |
775 | ||
776 | AT_CHECK([ovn-nbctl lb-add lb2 [[ae0f::10]]:8080 [[fd0f::10]]:80,[[fd0f::20]]:80 tcp]) | |
777 | AT_CHECK([ovn-nbctl --add-duplicate lb-add lb2 [[ae0f::10]]:8080 [[fd0f::10]]:80,[[fd0f::20]]:80 tcp]) | |
778 | AT_CHECK([ovn-nbctl lb-list | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl | |
779 | UUID LB PROTO VIP IPs | |
780 | <0> lb0 tcp [[ae0f::10]]:80 [[fd0f::10]]:80,[[fd0f::20]]:80 | |
781 | <1> lb1 udp [[ae0f::10]]:80 [[fd0f::10]]:80,[[fd0f::20]]:8080 | |
782 | <2> lb2 tcp [[ae0f::10]]:8080 [[fd0f::10]]:80,[[fd0f::20]]:80 | |
783 | <3> lb2 tcp [[ae0f::10]]:8080 [[fd0f::10]]:80,[[fd0f::20]]:80 | |
784 | ]) | |
785 | ||
786 | dnl If there are multiple load balancers with the same name, use a UUID to update/delete. | |
787 | AT_CHECK([ovn-nbctl lb-add lb2 [[ae0f::10]]:8080 [[fd0f::10]]:80,[[fd0f::20]]:80 tcp], [1], [], | |
788 | [ovn-nbctl: Multiple load balancers named 'lb2'. Use a UUID. | |
789 | ]) | |
790 | ||
791 | AT_CHECK([ovn-nbctl lb-del lb2], [1], [], | |
792 | [ovn-nbctl: Multiple load balancers named 'lb2'. Use a UUID. | |
793 | ]) | |
794 | ||
795 | AT_CHECK([ovn-nbctl --may-exist lb-add lb1 [[ae0f::10]]:80 [[fd0f::10]]:8080,[[fd0f::20]]:8080 udp]) | |
796 | AT_CHECK([ovn-nbctl --may-exist lb-add lb1 [[ae0f::10]]:8080 [[fd0f::10]]:8080,[[fd0f::20]]:8080 udp]) | |
797 | AT_CHECK([ovn-nbctl --may-exist lb-add lb1 [[ae0f::10]]:9090 [[fd0f::10]]:8080,[[fd0f::20]]:8080 udp]) | |
798 | AT_CHECK([ovn-nbctl lb-del lb0 [[ae0f::10]]:80]) | |
799 | AT_CHECK([ovn-nbctl lb-del lb1]) | |
800 | AT_CHECK([ovn-nbctl lb-list | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl | |
801 | UUID LB PROTO VIP IPs | |
802 | <0> lb2 tcp [[ae0f::10]]:8080 [[fd0f::10]]:80,[[fd0f::20]]:80 | |
803 | <1> lb2 tcp [[ae0f::10]]:8080 [[fd0f::10]]:80,[[fd0f::20]]:80 | |
804 | ]) | |
805 | ||
806 | dnl Add load balancer to logical switch. | |
807 | AT_CHECK([ovn-nbctl ls-add ls0]) | |
808 | AT_CHECK([ovn-nbctl lb-add lb0 [[ae0f::10]]:80 [[fd0f::10]]:80,[[fd0f::20]]:80]) | |
809 | AT_CHECK([ovn-nbctl lb-add lb1 [[ae0f::10]]:80 [[fd0f::10]]:80,[[fd0f::20]]:80 udp]) | |
810 | AT_CHECK([ovn-nbctl lb-add lb3 ae0f::10 fd0f::10,fd0f::20]) | |
811 | AT_CHECK([ovn-nbctl ls-lb-add ls0 lb0]) | |
812 | AT_CHECK([ovn-nbctl ls-lb-add ls0 lb1]) | |
813 | AT_CHECK([ovn-nbctl --may-exist ls-lb-add ls0 lb1]) | |
814 | AT_CHECK([ovn-nbctl ls-lb-add ls0 lb2], [1], [], | |
815 | [ovn-nbctl: Multiple load balancers named 'lb2'. Use a UUID. | |
816 | ]) | |
817 | AT_CHECK([ovn-nbctl ls-lb-add ls0 lb3]) | |
818 | ||
819 | AT_CHECK([ovn-nbctl ls-lb-list ls0 | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl | |
820 | UUID LB PROTO VIP IPs | |
821 | <0> lb0 tcp [[ae0f::10]]:80 [[fd0f::10]]:80,[[fd0f::20]]:80 | |
822 | <1> lb1 udp [[ae0f::10]]:80 [[fd0f::10]]:80,[[fd0f::20]]:80 | |
823 | <2> lb3 tcp/udp ae0f::10 fd0f::10,fd0f::20 | |
824 | ]) | |
825 | ||
826 | AT_CHECK([ovn-nbctl ls-lb-del ls0 lb0]) | |
827 | AT_CHECK([ovn-nbctl ls-lb-list ls0 | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl | |
828 | UUID LB PROTO VIP IPs | |
829 | <0> lb1 udp [[ae0f::10]]:80 [[fd0f::10]]:80,[[fd0f::20]]:80 | |
830 | <1> lb3 tcp/udp ae0f::10 fd0f::10,fd0f::20 | |
831 | ]) | |
832 | ||
833 | AT_CHECK([ovn-nbctl ls-lb-del ls0 lb1]) | |
834 | AT_CHECK([ovn-nbctl ls-lb-del ls0 lb3]) | |
835 | AT_CHECK([ovn-nbctl ls-lb-list ls0 | ${PERL} $srcdir/uuidfilt.pl], [0], []) | |
836 | AT_CHECK([ovn-nbctl --if-exists ls-lb-del ls0 lb1]) | |
837 | ||
838 | dnl Remove all load balancers from logical switch. | |
839 | AT_CHECK([ovn-nbctl ls-lb-add ls0 lb0]) | |
840 | AT_CHECK([ovn-nbctl ls-lb-add ls0 lb1]) | |
841 | AT_CHECK([ovn-nbctl ls-lb-add ls0 lb3]) | |
842 | AT_CHECK([ovn-nbctl ls-lb-del ls0]) | |
843 | AT_CHECK([ovn-nbctl ls-lb-list ls0 | ${PERL} $srcdir/uuidfilt.pl], [0], []) | |
844 | ||
845 | dnl Add load balancer to logical router. | |
846 | AT_CHECK([ovn-nbctl lr-add lr0]) | |
847 | AT_CHECK([ovn-nbctl lr-lb-add lr0 lb0]) | |
848 | AT_CHECK([ovn-nbctl lr-lb-add lr0 lb1]) | |
849 | AT_CHECK([ovn-nbctl --may-exist lr-lb-add lr0 lb1]) | |
850 | AT_CHECK([ovn-nbctl lr-lb-add lr0 lb2], [1], [], | |
851 | [ovn-nbctl: Multiple load balancers named 'lb2'. Use a UUID. | |
852 | ]) | |
853 | AT_CHECK([ovn-nbctl lr-lb-add lr0 lb3]) | |
854 | ||
855 | AT_CHECK([ovn-nbctl lr-lb-list lr0 | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl | |
856 | UUID LB PROTO VIP IPs | |
857 | <0> lb0 tcp [[ae0f::10]]:80 [[fd0f::10]]:80,[[fd0f::20]]:80 | |
858 | <1> lb1 udp [[ae0f::10]]:80 [[fd0f::10]]:80,[[fd0f::20]]:80 | |
859 | <2> lb3 tcp/udp ae0f::10 fd0f::10,fd0f::20 | |
860 | ]) | |
861 | ||
862 | AT_CHECK([ovn-nbctl lr-lb-del lr0 lb0]) | |
863 | AT_CHECK([ovn-nbctl lr-lb-list lr0 | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl | |
864 | UUID LB PROTO VIP IPs | |
865 | <0> lb1 udp [[ae0f::10]]:80 [[fd0f::10]]:80,[[fd0f::20]]:80 | |
866 | <1> lb3 tcp/udp ae0f::10 fd0f::10,fd0f::20 | |
867 | ]) | |
868 | ||
869 | AT_CHECK([ovn-nbctl lr-lb-del lr0 lb1]) | |
870 | AT_CHECK([ovn-nbctl lr-lb-del lr0 lb3]) | |
871 | AT_CHECK([ovn-nbctl lr-lb-list lr0 | ${PERL} $srcdir/uuidfilt.pl], [0], []) | |
872 | AT_CHECK([ovn-nbctl --if-exists lr-lb-del lr0 lb1]) | |
873 | ||
874 | dnl Remove all load balancers from logical router. | |
875 | AT_CHECK([ovn-nbctl lr-lb-add lr0 lb0]) | |
876 | AT_CHECK([ovn-nbctl lr-lb-add lr0 lb1]) | |
877 | AT_CHECK([ovn-nbctl lr-lb-add lr0 lb3]) | |
878 | AT_CHECK([ovn-nbctl lr-lb-del lr0]) | |
879 | AT_CHECK([ovn-nbctl lr-lb-list lr0 | ${PERL} $srcdir/uuidfilt.pl], [0], []) | |
880 | ||
881 | OVN_NBCTL_TEST_STOP | |
882 | AT_CLEANUP | |
7127583d NG |
883 | dnl --------------------------------------------------------------------- |
884 | ||
fa2a27b2 | 885 | AT_SETUP([ovn-nbctl - basic logical router commands]) |
7127583d NG |
886 | OVN_NBCTL_TEST_START |
887 | ||
fa2a27b2 JP |
888 | AT_CHECK([ovn-nbctl lr-add lr0]) |
889 | AT_CHECK([ovn-nbctl lr-list | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl | |
7127583d NG |
890 | <0> (lr0) |
891 | ]) | |
892 | ||
fa2a27b2 JP |
893 | AT_CHECK([ovn-nbctl lr-add lr1]) |
894 | AT_CHECK([ovn-nbctl lr-list | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl | |
7127583d NG |
895 | <0> (lr0) |
896 | <1> (lr1) | |
897 | ]) | |
898 | ||
fa2a27b2 JP |
899 | AT_CHECK([ovn-nbctl lr-del lr0]) |
900 | AT_CHECK([ovn-nbctl lr-list | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl | |
7127583d NG |
901 | <0> (lr1) |
902 | ]) | |
903 | ||
904 | AT_CHECK([ovn-nbctl show lr0]) | |
fa2a27b2 | 905 | AT_CHECK([ovn-nbctl lr-add lr0]) |
7127583d | 906 | AT_CHECK([ovn-nbctl show lr0 | ${PERL} $srcdir/uuidfilt.pl], [0], |
7a16f569 | 907 | [router <0> (lr0) |
7127583d | 908 | ]) |
fa2a27b2 JP |
909 | AT_CHECK([ovn-nbctl lr-add lr0], [1], [], |
910 | [ovn-nbctl: lr0: a router with this name already exists | |
7127583d | 911 | ]) |
fa2a27b2 | 912 | AT_CHECK([ovn-nbctl --may-exist lr-add lr0]) |
7127583d | 913 | AT_CHECK([ovn-nbctl show lr0 | ${PERL} $srcdir/uuidfilt.pl], [0], |
7a16f569 | 914 | [router <0> (lr0) |
7127583d | 915 | ]) |
fa2a27b2 JP |
916 | AT_CHECK([ovn-nbctl --add-duplicate lr-add lr0]) |
917 | AT_CHECK([ovn-nbctl --may-exist --add-duplicate lr-add lr0], [1], [], | |
7127583d NG |
918 | [ovn-nbctl: --may-exist and --add-duplicate may not be used together |
919 | ]) | |
fa2a27b2 | 920 | AT_CHECK([ovn-nbctl lr-del lr0], [1], [], |
7127583d NG |
921 | [ovn-nbctl: Multiple logical routers named 'lr0'. Use a UUID. |
922 | ]) | |
923 | ||
fa2a27b2 JP |
924 | AT_CHECK([ovn-nbctl lr-del lr2], [1], [], |
925 | [ovn-nbctl: lr2: router name not found | |
7127583d | 926 | ]) |
fa2a27b2 | 927 | AT_CHECK([ovn-nbctl --if-exists lr-del lr2]) |
7127583d | 928 | |
fa2a27b2 JP |
929 | AT_CHECK([ovn-nbctl lr-add]) |
930 | AT_CHECK([ovn-nbctl lr-add]) | |
931 | AT_CHECK([ovn-nbctl --add-duplicate lr-add], [1], [], | |
7127583d NG |
932 | [ovn-nbctl: --add-duplicate requires specifying a name |
933 | ]) | |
fa2a27b2 | 934 | AT_CHECK([ovn-nbctl --may-exist lr-add], [1], [], |
7127583d NG |
935 | [ovn-nbctl: --may-exist requires specifying a name |
936 | ]) | |
937 | ||
938 | OVN_NBCTL_TEST_STOP | |
939 | AT_CLEANUP | |
940 | ||
941 | dnl --------------------------------------------------------------------- | |
942 | ||
31114af7 | 943 | AT_SETUP([ovn-nbctl - basic logical router port commands]) |
7127583d NG |
944 | OVN_NBCTL_TEST_START |
945 | ||
fa2a27b2 | 946 | AT_CHECK([ovn-nbctl lr-add lr0]) |
10c3fcdf | 947 | AT_CHECK([ovn-nbctl lrp-add lr0 lrp0 00:00:00:01:02 192.168.1.1/24], [1], [], |
948 | [ovn-nbctl: lrp0: invalid mac address 00:00:00:01:02 | |
949 | ]) | |
950 | AT_CHECK([ovn-nbctl lrp-add lr0 lrp0 00:00:00:01:02:03:04 192.168.1.1/24], [1], [], | |
951 | [ovn-nbctl: lrp0: invalid mac address 00:00:00:01:02:03:04 | |
952 | ]) | |
953 | ||
31114af7 | 954 | AT_CHECK([ovn-nbctl lrp-add lr0 lrp0 00:00:00:01:02:03 192.168.1.1/24]) |
34a88a45 JP |
955 | |
956 | AT_CHECK([ovn-nbctl show lr0 | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl | |
7a16f569 BP |
957 | router <0> (lr0) |
958 | port lrp0 | |
959 | mac: "00:00:00:01:02:03" | |
960 | networks: [["192.168.1.1/24"]] | |
34a88a45 JP |
961 | ]) |
962 | ||
31114af7 JP |
963 | AT_CHECK([ovn-nbctl lrp-add lr0 lrp0 00:00:00:01:02:03 192.168.1.1/24], [1], [], |
964 | [ovn-nbctl: lrp0: a port with this name already exists | |
7127583d | 965 | ]) |
31114af7 JP |
966 | AT_CHECK([ovn-nbctl --may-exist lrp-add lr0 lrp0 00:00:00:01:02:03 192.168.1.1/24]) |
967 | AT_CHECK([ovn-nbctl lrp-list lr0 | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl | |
7127583d NG |
968 | <0> (lrp0) |
969 | ]) | |
970 | ||
4685e523 | 971 | AT_CHECK([ovn-nbctl lrp-add lr0 lrp1 00:00:00:01:02:03 192.168.1.1/24 peer=lrp1-peer]) |
31114af7 | 972 | AT_CHECK([ovn-nbctl lrp-list lr0 | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl |
7127583d NG |
973 | <0> (lrp0) |
974 | <1> (lrp1) | |
975 | ]) | |
976 | ||
fa2a27b2 | 977 | AT_CHECK([ovn-nbctl lr-add lr1]) |
31114af7 JP |
978 | AT_CHECK([ovn-nbctl lrp-add lr0 lrp1 00:00:00:01:02:03 192.168.1.1/24], [1], [], |
979 | [ovn-nbctl: lrp1: a port with this name already exists | |
7127583d NG |
980 | ]) |
981 | ||
31114af7 JP |
982 | AT_CHECK([ovn-nbctl --may-exist lrp-add lr1 lrp1 00:00:00:01:02:03 192.168.1.1/24], [1], [], |
983 | [ovn-nbctl: lrp1: port already exists but in router lr0 | |
7127583d NG |
984 | ]) |
985 | ||
31114af7 JP |
986 | AT_CHECK([ovn-nbctl --may-exist lrp-add lr0 lrp1 00:00:00:04:05:06 192.168.1.1/24], [1], [], |
987 | [ovn-nbctl: lrp1: port already exists with mac 00:00:00:01:02:03 | |
7127583d NG |
988 | ]) |
989 | ||
31114af7 JP |
990 | AT_CHECK([ovn-nbctl --may-exist lrp-add lr0 lrp1 00:00:00:01:02:03 192.168.1.1/24], [1], [], |
991 | [ovn-nbctl: lrp1: port already exists with mismatching peer | |
7127583d NG |
992 | ]) |
993 | ||
4685e523 JP |
994 | AT_CHECK([ovn-nbctl --may-exist lrp-add lr0 lrp1 00:00:00:01:02:03 10.0.0.1/24 peer=lrp1-peer], [1], [], |
995 | [ovn-nbctl: lrp1: port already exists with different network | |
996 | ]) | |
997 | ||
998 | AT_CHECK([ovn-nbctl --may-exist lrp-add lr0 lrp1 00:00:00:01:02:03 192.168.1.1/24 peer=lrp1-peer]) | |
31114af7 JP |
999 | |
1000 | AT_CHECK([ovn-nbctl lrp-del lrp1]) | |
1001 | AT_CHECK([ovn-nbctl lrp-list lr0 | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl | |
1002 | <0> (lrp0) | |
7127583d NG |
1003 | ]) |
1004 | ||
4685e523 JP |
1005 | AT_CHECK([ovn-nbctl --may-exist lrp-add lr0 lrp1 00:00:00:01:02:03 192.168.1.1/24 10.0.0.1/24 peer=lrp1-peer]) |
1006 | ||
1007 | AT_CHECK([ovn-nbctl --may-exist lrp-add lr0 lrp1 00:00:00:01:02:03 192.168.1.1/24 172.16.0.1/24 peer=lrp1-peer], [1], [], | |
1008 | [ovn-nbctl: lrp1: port already exists with different network | |
1009 | ]) | |
1010 | ||
1011 | AT_CHECK([ovn-nbctl --may-exist lrp-add lr0 lrp1 00:00:00:01:02:03 10.0.0.1/24 192.168.1.1/24 peer=lrp1-peer]) | |
36f232bc VA |
1012 | |
1013 | OVN_NBCTL_TEST_STOP | |
1014 | AT_CLEANUP | |
1015 | ||
1016 | dnl --------------------------------------------------------------------- | |
1017 | ||
1018 | AT_SETUP([ovn-nbctl - logical router port gateway chassis]) | |
1019 | OVN_NBCTL_TEST_START | |
1020 | AT_CHECK([ovn-nbctl lr-add lr0]) | |
1021 | AT_CHECK([ovn-nbctl lrp-add lr0 lrp0 00:00:00:01:02:03 192.168.1.1/24]) | |
1022 | AT_CHECK([ovn-nbctl lrp-get-gateway-chassis lrp0], [0], []) | |
1023 | ||
1024 | AT_CHECK([ovn-nbctl lrp-set-gateway-chassis lp0 chassis1], [1], [], | |
1025 | [ovn-nbctl: lp0: port name not found | |
1026 | ]) | |
1027 | ||
1028 | AT_CHECK([ovn-nbctl lrp-get-gateway-chassis lp0], [1], [], | |
1029 | [ovn-nbctl: lp0: port name not found | |
1030 | ]) | |
1031 | ||
1032 | AT_CHECK([ovn-nbctl lrp-del-gateway-chassis lp0 chassis1], [1], [], | |
1033 | [ovn-nbctl: lp0: port name not found | |
1034 | ]) | |
1035 | ||
1036 | AT_CHECK([ovn-nbctl lrp-del-gateway-chassis lrp0 chassis1], [1], [], | |
1037 | [ovn-nbctl: chassis chassis1 is not added to logical port lrp0 | |
1038 | ]) | |
1039 | AT_CHECK([ovn-nbctl lrp-set-gateway-chassis lrp0 chassis1]) | |
1040 | ||
1041 | AT_CHECK([ovn-nbctl lrp-get-gateway-chassis lrp0], [0], [dnl | |
1042 | lrp0-chassis1 0 | |
1043 | ]) | |
1044 | AT_CHECK([ovn-nbctl lrp-set-gateway-chassis lrp0 chassis1 10]) | |
1045 | ||
1046 | AT_CHECK([ovn-nbctl lrp-get-gateway-chassis lrp0], [0], [dnl | |
1047 | lrp0-chassis1 10 | |
1048 | ]) | |
1049 | AT_CHECK([ovn-nbctl lrp-set-gateway-chassis lrp0 chassis1 20]) | |
1050 | ||
1051 | AT_CHECK([ovn-nbctl lrp-get-gateway-chassis lrp0], [0], [dnl | |
1052 | lrp0-chassis1 20 | |
1053 | ]) | |
1054 | AT_CHECK([ovn-nbctl lrp-set-gateway-chassis lrp0 chassis2 5]) | |
1055 | AT_CHECK([ovn-nbctl lrp-get-gateway-chassis lrp0], [0], [dnl | |
1056 | lrp0-chassis1 20 | |
1057 | lrp0-chassis2 5 | |
1058 | ]) | |
1059 | ||
1060 | AT_CHECK([ovn-nbctl lrp-del-gateway-chassis lrp0 chassis1]) | |
1061 | AT_CHECK([ovn-nbctl lrp-get-gateway-chassis lrp0], [0], [dnl | |
1062 | lrp0-chassis2 5 | |
1063 | ]) | |
1064 | ||
1065 | AT_CHECK([ovn-nbctl lrp-del-gateway-chassis lrp0 chassis2]) | |
1066 | AT_CHECK([ovn-nbctl lrp-get-gateway-chassis lrp0]) | |
4685e523 | 1067 | |
7127583d NG |
1068 | OVN_NBCTL_TEST_STOP |
1069 | AT_CLEANUP | |
1070 | ||
1071 | dnl --------------------------------------------------------------------- | |
1072 | ||
31114af7 | 1073 | AT_SETUP([ovn-nbctl - logical router port enable and disable]) |
7127583d NG |
1074 | OVN_NBCTL_TEST_START |
1075 | ||
fa2a27b2 | 1076 | AT_CHECK([ovn-nbctl lr-add lr0]) |
31114af7 JP |
1077 | AT_CHECK([ovn-nbctl lrp-add lr0 lrp0 00:00:00:01:02:03 192.168.1.1/24]) |
1078 | AT_CHECK([ovn-nbctl lrp-get-enabled lrp0], [0], [enabled | |
7127583d NG |
1079 | ]) |
1080 | ||
31114af7 JP |
1081 | AT_CHECK([ovn-nbctl lrp-set-enabled lrp0 disabled]) |
1082 | AT_CHECK([ovn-nbctl lrp-get-enabled lrp0], [0], [disabled | |
7127583d NG |
1083 | ]) |
1084 | ||
31114af7 JP |
1085 | AT_CHECK([ovn-nbctl lrp-set-enabled lrp0 enabled]) |
1086 | AT_CHECK([ovn-nbctl lrp-get-enabled lrp0], [0], [enabled | |
7127583d NG |
1087 | ]) |
1088 | ||
31114af7 | 1089 | AT_CHECK([ovn-nbctl lrp-set-enabled lrp0 xyzzy], [1], [], |
7127583d NG |
1090 | [ovn-nbctl: xyzzy: state must be "enabled" or "disabled" |
1091 | ]) | |
1092 | ||
1093 | OVN_NBCTL_TEST_STOP | |
1094 | AT_CLEANUP | |
e48ccf3c JP |
1095 | |
1096 | dnl --------------------------------------------------------------------- | |
1097 | ||
1098 | AT_SETUP([ovn-nbctl - routes]) | |
1099 | OVN_NBCTL_TEST_START | |
1100 | ||
1101 | AT_CHECK([ovn-nbctl lr-add lr0]) | |
1102 | ||
1103 | dnl Check IPv4 routes | |
1104 | AT_CHECK([ovn-nbctl lr-route-add lr0 0.0.0.0/0 192.168.0.1]) | |
1105 | AT_CHECK([ovn-nbctl lr-route-add lr0 10.0.1.0/24 11.0.1.1 lp0]) | |
1106 | AT_CHECK([ovn-nbctl lr-route-add lr0 10.0.0.1/24 11.0.0.2]) | |
1107 | ||
1108 | dnl Add overlapping route with 10.0.0.1/24 | |
1109 | AT_CHECK([ovn-nbctl lr-route-add lr0 10.0.0.111/24 11.0.0.1], [1], [], | |
1110 | [ovn-nbctl: duplicate prefix: 10.0.0.0/24 | |
1111 | ]) | |
b712dea0 | 1112 | AT_CHECK([ovn-nbctl lr-route-add lr0 10.0.0.111a/24 11.0.0.1], [1], [], |
1113 | [ovn-nbctl: bad prefix argument: 10.0.0.111a/24 | |
1114 | ]) | |
1115 | AT_CHECK([ovn-nbctl lr-route-add lr0 10.0.0.111/24a 11.0.0.1], [1], [], | |
1116 | [ovn-nbctl: bad prefix argument: 10.0.0.111/24a | |
1117 | ]) | |
1118 | AT_CHECK([ovn-nbctl lr-route-add lr0 10.0.0.111/24 11.0.0.1a], [1], [], | |
1119 | [ovn-nbctl: bad next hop argument: 11.0.0.1a | |
1120 | ]) | |
1121 | AT_CHECK([ovn-nbctl lr-route-add lr0 10.0.0.111/24 11.0.0.1/24], [1], [], | |
1122 | [ovn-nbctl: bad IPv4 nexthop argument: 11.0.0.1/24 | |
1123 | ]) | |
1124 | AT_CHECK([ovn-nbctl lr-route-add lr0 2001:0db8:1::/64 2001:0db8:0:f103::1/64], [1], [], | |
1125 | [ovn-nbctl: bad IPv6 nexthop argument: 2001:0db8:0:f103::1/64 | |
1126 | ]) | |
1127 | ||
e48ccf3c | 1128 | AT_CHECK([ovn-nbctl --may-exist lr-route-add lr0 10.0.0.111/24 11.0.0.1]) |
440a9f4b | 1129 | AT_CHECK([ovn-nbctl --policy=src-ip lr-route-add lr0 9.16.1.0/24 11.0.0.1]) |
e48ccf3c JP |
1130 | |
1131 | AT_CHECK([ovn-nbctl lr-route-list lr0], [0], [dnl | |
1132 | IPv4 Routes | |
440a9f4b GS |
1133 | 10.0.0.0/24 11.0.0.1 dst-ip |
1134 | 10.0.1.0/24 11.0.1.1 dst-ip lp0 | |
1135 | 9.16.1.0/24 11.0.0.1 src-ip | |
1136 | 0.0.0.0/0 192.168.0.1 dst-ip | |
e48ccf3c JP |
1137 | ]) |
1138 | ||
01a528f3 GS |
1139 | AT_CHECK([ovn-nbctl --may-exist lr-route-add lr0 10.0.0.111/24 11.0.0.1 lp1]) |
1140 | AT_CHECK([ovn-nbctl lr-route-list lr0], [0], [dnl | |
1141 | IPv4 Routes | |
440a9f4b GS |
1142 | 10.0.0.0/24 11.0.0.1 dst-ip lp1 |
1143 | 10.0.1.0/24 11.0.1.1 dst-ip lp0 | |
1144 | 9.16.1.0/24 11.0.0.1 src-ip | |
1145 | 0.0.0.0/0 192.168.0.1 dst-ip | |
01a528f3 GS |
1146 | ]) |
1147 | ||
e48ccf3c JP |
1148 | dnl Delete non-existent prefix |
1149 | AT_CHECK([ovn-nbctl lr-route-del lr0 10.0.2.1/24], [1], [], | |
1150 | [ovn-nbctl: no matching prefix: 10.0.2.0/24 | |
1151 | ]) | |
1152 | AT_CHECK([ovn-nbctl --if-exists lr-route-del lr0 10.0.2.1/24]) | |
1153 | ||
1154 | AT_CHECK([ovn-nbctl lr-route-del lr0 10.0.1.1/24]) | |
440a9f4b | 1155 | AT_CHECK([ovn-nbctl lr-route-del lr0 9.16.1.0/24]) |
e48ccf3c JP |
1156 | |
1157 | AT_CHECK([ovn-nbctl lr-route-list lr0], [0], [dnl | |
1158 | IPv4 Routes | |
440a9f4b GS |
1159 | 10.0.0.0/24 11.0.0.1 dst-ip lp1 |
1160 | 0.0.0.0/0 192.168.0.1 dst-ip | |
e48ccf3c JP |
1161 | ]) |
1162 | ||
1163 | AT_CHECK([ovn-nbctl lr-route-del lr0]) | |
1164 | AT_CHECK([ovn-nbctl lr-route-list lr0], [0], [dnl | |
1165 | ]) | |
1166 | ||
1167 | dnl Check IPv6 routes | |
8c7623fe | 1168 | AT_CHECK([ovn-nbctl lr-route-add lr0 0:0:0:0:0:0:0:0/0 2001:0db8:0:f101::1]) |
e48ccf3c JP |
1169 | AT_CHECK([ovn-nbctl lr-route-add lr0 2001:0db8:0::/64 2001:0db8:0:f102::1 lp0]) |
1170 | AT_CHECK([ovn-nbctl lr-route-add lr0 2001:0db8:1::/64 2001:0db8:0:f103::1]) | |
1171 | ||
1172 | AT_CHECK([ovn-nbctl lr-route-list lr0], [0], [dnl | |
1173 | IPv6 Routes | |
440a9f4b GS |
1174 | 2001:db8::/64 2001:db8:0:f102::1 dst-ip lp0 |
1175 | 2001:db8:1::/64 2001:db8:0:f103::1 dst-ip | |
1176 | ::/0 2001:db8:0:f101::1 dst-ip | |
e48ccf3c JP |
1177 | ]) |
1178 | ||
1179 | AT_CHECK([ovn-nbctl lr-route-del lr0 2001:0db8:0::/64]) | |
1180 | ||
1181 | AT_CHECK([ovn-nbctl lr-route-list lr0], [0], [dnl | |
1182 | IPv6 Routes | |
440a9f4b GS |
1183 | 2001:db8:1::/64 2001:db8:0:f103::1 dst-ip |
1184 | ::/0 2001:db8:0:f101::1 dst-ip | |
e48ccf3c JP |
1185 | ]) |
1186 | ||
1187 | AT_CHECK([ovn-nbctl lr-route-del lr0]) | |
1188 | AT_CHECK([ovn-nbctl lr-route-list lr0], [0], [dnl | |
1189 | ]) | |
1190 | ||
1191 | dnl Check IPv4 and IPv6 routes | |
1192 | AT_CHECK([ovn-nbctl lr-route-add lr0 0.0.0.0/0 192.168.0.1]) | |
1193 | AT_CHECK([ovn-nbctl lr-route-add lr0 10.0.1.1/24 11.0.1.1 lp0]) | |
1194 | AT_CHECK([ovn-nbctl lr-route-add lr0 10.0.0.1/24 11.0.0.1]) | |
8c7623fe | 1195 | AT_CHECK([ovn-nbctl lr-route-add lr0 0:0:0:0:0:0:0:0/0 2001:0db8:0:f101::1]) |
e48ccf3c JP |
1196 | AT_CHECK([ovn-nbctl lr-route-add lr0 2001:0db8:0::/64 2001:0db8:0:f102::1 lp0]) |
1197 | AT_CHECK([ovn-nbctl lr-route-add lr0 2001:0db8:1::/64 2001:0db8:0:f103::1]) | |
1198 | ||
1199 | AT_CHECK([ovn-nbctl lr-route-list lr0], [0], [dnl | |
1200 | IPv4 Routes | |
440a9f4b GS |
1201 | 10.0.0.0/24 11.0.0.1 dst-ip |
1202 | 10.0.1.0/24 11.0.1.1 dst-ip lp0 | |
1203 | 0.0.0.0/0 192.168.0.1 dst-ip | |
e48ccf3c JP |
1204 | |
1205 | IPv6 Routes | |
440a9f4b GS |
1206 | 2001:db8::/64 2001:db8:0:f102::1 dst-ip lp0 |
1207 | 2001:db8:1::/64 2001:db8:0:f103::1 dst-ip | |
1208 | ::/0 2001:db8:0:f101::1 dst-ip | |
e48ccf3c JP |
1209 | ]) |
1210 | ||
1211 | OVN_NBCTL_TEST_STOP | |
1212 | AT_CLEANUP | |
173acc1c MM |
1213 | |
1214 | dnl --------------------------------------------------------------------- | |
1215 | ||
1216 | AT_SETUP([ovn-nbctl - lsp types]) | |
1217 | OVN_NBCTL_TEST_START | |
1218 | ||
1219 | AT_CHECK([ovn-nbctl ls-add ls0]) | |
1220 | AT_CHECK([ovn-nbctl lsp-add ls0 lp0]) | |
1221 | ||
1222 | dnl switchport type defaults to empty | |
1223 | AT_CHECK([ovn-nbctl lsp-get-type lp0], [0], [dnl | |
1224 | ||
1225 | ]) | |
1226 | ||
1227 | dnl The following are the valid entries for | |
1228 | dnl switchport type | |
1229 | AT_CHECK([ovn-nbctl lsp-set-type lp0 l2gateway]) | |
1230 | AT_CHECK([ovn-nbctl lsp-get-type lp0], [0], [dnl | |
1231 | l2gateway | |
1232 | ]) | |
1233 | ||
1234 | AT_CHECK([ovn-nbctl lsp-set-type lp0 router]) | |
1235 | AT_CHECK([ovn-nbctl lsp-get-type lp0], [0], [dnl | |
1236 | router | |
1237 | ]) | |
1238 | ||
1239 | AT_CHECK([ovn-nbctl lsp-set-type lp0 localnet]) | |
1240 | AT_CHECK([ovn-nbctl lsp-get-type lp0], [0], [dnl | |
1241 | localnet | |
1242 | ]) | |
1243 | ||
1244 | AT_CHECK([ovn-nbctl lsp-set-type lp0 localport]) | |
1245 | AT_CHECK([ovn-nbctl lsp-get-type lp0], [0], [dnl | |
1246 | localport | |
1247 | ]) | |
1248 | ||
1249 | AT_CHECK([ovn-nbctl lsp-set-type lp0 vtep]) | |
1250 | AT_CHECK([ovn-nbctl lsp-get-type lp0], [0], [dnl | |
1251 | vtep | |
1252 | ]) | |
1253 | ||
1254 | dnl All of these are valid southbound port types but | |
1255 | dnl should be rejected for northbound logical switch | |
1256 | dnl ports. | |
1257 | AT_CHECK([ovn-nbctl lsp-set-type lp0 l3gateway], [1], [], [dnl | |
1258 | ovn-nbctl: Logical switch port type 'l3gateway' is unrecognized. Not setting type. | |
1259 | ]) | |
1260 | AT_CHECK([ovn-nbctl lsp-set-type lp0 patch], [1], [], [dnl | |
1261 | ovn-nbctl: Logical switch port type 'patch' is unrecognized. Not setting type. | |
1262 | ]) | |
1263 | AT_CHECK([ovn-nbctl lsp-set-type lp0 chassisredirect], [1], [], [dnl | |
1264 | ovn-nbctl: Logical switch port type 'chassisredirect' is unrecognized. Not setting type. | |
1265 | ]) | |
1266 | ||
1267 | dnl switch port type should still be "vtep" since previous | |
1268 | dnl commands failed. | |
1269 | AT_CHECK([ovn-nbctl lsp-get-type lp0], [0], [dnl | |
1270 | vtep | |
1271 | ]) | |
1272 | ||
1273 | dnl Attempt a nonsense type | |
1274 | AT_CHECK([ovn-nbctl lsp-set-type lp0 eggs], [1], [], [dnl | |
1275 | ovn-nbctl: Logical switch port type 'eggs' is unrecognized. Not setting type. | |
1276 | ]) | |
1277 | ||
1278 | dnl Empty string should work too | |
1279 | AT_CHECK([ovn-nbctl lsp-set-type lp0 ""]) | |
1280 | AT_CHECK([ovn-nbctl lsp-get-type lp0], [0], [dnl | |
1281 | ||
1282 | ]) | |
1283 | ||
1284 | OVN_NBCTL_TEST_STOP | |
1285 | AT_CLEANUP |