]> git.proxmox.com Git - ovs.git/blob - tests/vtep-ctl.at
Prepare for post-2.8.0 (2.8.90).
[ovs.git] / tests / vtep-ctl.at
1 dnl VTEP_OVSDB_INIT([$1])
2 dnl
3 dnl Creates an empty database named $1.
4 m4_define([VTEP_OVSDB_INIT],
5 [AT_CHECK(
6 [ovsdb-tool create $1 $abs_top_srcdir/vtep/vtep.ovsschema],
7 [0], [stdout], [ignore])
8 AT_CHECK(
9 [[ovsdb-tool transact $1 \
10 '["hardware_vtep",
11 {"op": "insert",
12 "table": "Global",
13 "row": {}}]']],
14 [0], [ignore], [ignore])])
15
16 dnl VTEP_CTL_SETUP
17 dnl
18 dnl Creates an empty database in the current directory and then starts
19 dnl an ovsdb-server on it for vtep-ctl to connect to.
20 m4_define([VTEP_CTL_SETUP],
21 [VTEP_OVSDB_INIT([db])
22 AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket db >/dev/null 2>&1], [0], [ignore], [ignore])])
23
24 dnl VTEP_CTL_CLEANUP
25 dnl
26 dnl Kills off the database server.
27 m4_define([VTEP_CTL_CLEANUP], [OVSDB_SERVER_SHUTDOWN])
28
29 dnl RUN_VTEP_CTL(COMMAND, ...)
30 dnl
31 dnl Executes each vtep-ctl COMMAND.
32 m4_define([RUN_VTEP_CTL],
33 [m4_foreach([command], [$@], [vtep-ctl --timeout=5 -vreconnect:emer --db=unix:socket command
34 ])])
35 m4_define([RUN_VTEP_CTL_ONELINE],
36 [m4_foreach([command], [$@], [vtep-ctl --timeout=5 -vreconnect:emer --db=unix:socket --oneline -- command
37 ])])
38
39 dnl RUN_VTEP_CTL_TOGETHER(COMMAND, ...)
40 dnl
41 dnl Executes each vtep-ctl COMMAND in a single run of vtep-ctl.
42 m4_define([RUN_VTEP_CTL_TOGETHER],
43 [vtep-ctl --timeout=5 -vreconnect:emer --db=unix:socket --oneline dnl
44 m4_foreach([command], [$@], [ -- command])])
45
46 dnl CHECK_PSWITCHES([PSWITCH], ...)
47 dnl
48 dnl Verifies that "vtep-ctl list-ps" prints the specified list of
49 dnl physical switches, which must be in alphabetical order.
50 m4_define([CHECK_PSWITCHES],
51 [dnl Check that the pswitches appear on list-ps, without --oneline.
52 AT_CHECK(
53 [RUN_VTEP_CTL([list-ps])],
54 [0],
55 [m4_foreach([psinfo], [$@], [m4_car(psinfo)
56 ])],
57 [],
58 [VTEP_CTL_CLEANUP])
59
60 dnl Check that the pswitches appear on list-ps, with --oneline.
61 AT_CHECK(
62 [RUN_VTEP_CTL_ONELINE([list-ps])],
63 [0],
64 [m4_join([\n], m4_foreach([psinfo], [$@], [m4_car(psinfo),]))
65 ],
66 [],
67 [VTEP_CTL_CLEANUP])
68
69 dnl Check that each pswitch exists according to ps-exists and that
70 dnl a pswitch that should not exist does not.
71 m4_foreach([psinfo], [$@],
72 [AT_CHECK([RUN_VTEP_CTL([ps-exists m4_car(psinfo)])], [0], [],
73 [], [VTEP_CTL_CLEANUP])])
74 AT_CHECK([RUN_VTEP_CTL([ps-exists nonexistent])], [2], [], [],
75 [VTEP_CTL_CLEANUP])])
76
77 dnl CHECK_PORTS(PSWITCH, PORT[, PORT...])
78 dnl
79 dnl Verifies that "vtep-ctl list-ports PSWITCH" prints the specified
80 dnl list of ports, which must be in alphabetical order.
81 m4_define([CHECK_PORTS],
82 [dnl Check ports without --oneline.
83 AT_CHECK(
84 [RUN_VTEP_CTL([list-ports $1])],
85 [0],
86 [m4_foreach([port], m4_cdr($@), [port
87 ])],
88 [],
89 [VTEP_CTL_CLEANUP])
90
91 dnl Check ports with --oneline.
92 AT_CHECK(
93 [RUN_VTEP_CTL_ONELINE([list-ports $1])],
94 [0],
95 [m4_join([\n], m4_shift($@))
96 ],
97 [],
98 [VTEP_CTL_CLEANUP])])
99
100
101 dnl CHECK_LSWITCHES([LSWITCH], ...)
102 dnl
103 dnl Verifies that "vtep-ctl list-ls" prints the specified list of
104 dnl logical switches, which must be in alphabetical order.
105 m4_define([CHECK_LSWITCHES],
106 [dnl Check that the lswitches appear on list-ls, without --oneline.
107 AT_CHECK(
108 [RUN_VTEP_CTL([list-ls])],
109 [0],
110 [m4_foreach([lsinfo], [$@], [m4_car(lsinfo)
111 ])],
112 [],
113 [VTEP_CTL_CLEANUP])
114
115 dnl Check that the lswitches appear on list-ls, with --oneline.
116 AT_CHECK(
117 [RUN_VTEP_CTL_ONELINE([list-ls])],
118 [0],
119 [m4_join([\n], m4_foreach([lsinfo], [$@], [m4_car(lsinfo),]))
120 ],
121 [],
122 [VTEP_CTL_CLEANUP])
123
124 dnl Check that each lswitch exists according to ls-exists and that
125 dnl a pswitch that should not exist does not.
126 m4_foreach([lsinfo], [$@],
127 [AT_CHECK([RUN_VTEP_CTL([ls-exists m4_car(lsinfo)])], [0], [],
128 [], [VTEP_CTL_CLEANUP])])
129 AT_CHECK([RUN_VTEP_CTL([ls-exists nonexistent])], [2], [], [],
130 [VTEP_CTL_CLEANUP])])
131
132 dnl ----------------------------------------------------------------------
133 AT_BANNER([vtep-ctl unit tests -- physical switch tests])
134
135 AT_SETUP([add-ps a])
136 AT_KEYWORDS([vtep-ctl])
137 VTEP_CTL_SETUP
138 AT_CHECK([RUN_VTEP_CTL([add-ps a])], [0], [], [], [VTEP_CTL_CLEANUP])
139 CHECK_PSWITCHES([a])
140 VTEP_CTL_CLEANUP
141 AT_CLEANUP
142
143 AT_SETUP([add-ps a, add-ps a])
144 AT_KEYWORDS([vtep-ctl])
145 VTEP_CTL_SETUP
146 AT_CHECK([RUN_VTEP_CTL([add-ps a])], [0], [], [], [VTEP_CTL_CLEANUP])
147 AT_CHECK([RUN_VTEP_CTL([add-ps a])], [1], [],
148 [vtep-ctl: cannot create physical switch a because it already exists
149 ], [VTEP_CTL_CLEANUP])
150 VTEP_CTL_CLEANUP
151 AT_CLEANUP
152
153 AT_SETUP([add-ps a, add-ps b])
154 AT_KEYWORDS([vtep-ctl])
155 VTEP_CTL_SETUP
156 AT_CHECK([RUN_VTEP_CTL([add-ps a], [add-ps b])], [0], [], [],
157 [VTEP_CTL_CLEANUP])
158 CHECK_PSWITCHES([a], [b])
159 VTEP_CTL_CLEANUP
160 AT_CLEANUP
161
162 AT_SETUP([add-ps a, add-ps b, del-ps a])
163 AT_KEYWORDS([vtep-ctl])
164 VTEP_CTL_SETUP
165 AT_CHECK([RUN_VTEP_CTL([add-ps a], [add-ps b], [del-ps a])], [0], [], [],
166 [VTEP_CTL_CLEANUP])
167 CHECK_PSWITCHES([b])
168 VTEP_CTL_CLEANUP
169 AT_CLEANUP
170
171 AT_SETUP([add-ps a, del-ps a, add-ps a])
172 AT_KEYWORDS([vtep-ctl])
173 VTEP_CTL_SETUP
174 AT_CHECK([RUN_VTEP_CTL_TOGETHER(
175 [add-ps a],
176 [del-ps a],
177 [add-ps a])], [0], [
178
179
180 ], [], [VTEP_CTL_CLEANUP])
181 CHECK_PSWITCHES([a])
182 VTEP_CTL_CLEANUP
183 AT_CLEANUP
184
185 AT_SETUP([add-ps a, add-port a a1, add-port a a2])
186 AT_KEYWORDS([vtep-ctl])
187 VTEP_CTL_SETUP
188 AT_CHECK([RUN_VTEP_CTL(
189 [add-ps a],
190 [--if-exists del-ps b],
191 [add-port a a1],
192 [add-port a a2])], [0], [], [], [VTEP_CTL_CLEANUP])
193 CHECK_PSWITCHES([a])
194 CHECK_PORTS([a], [a1], [a2])
195 VTEP_CTL_CLEANUP
196 AT_CLEANUP
197
198 AT_SETUP([add-ps a, add-port a a1, add-port a a1])
199 AT_KEYWORDS([vtep-ctl])
200 VTEP_CTL_SETUP
201 AT_CHECK([RUN_VTEP_CTL(
202 [add-ps a],
203 [add-port a a1])], [0], [], [], [VTEP_CTL_CLEANUP])
204 AT_CHECK([RUN_VTEP_CTL([add-port a a1])], [1], [],
205 [vtep-ctl: cannot create a port named a1 on a because a port with that name already exists
206 ], [VTEP_CTL_CLEANUP])
207 VTEP_CTL_CLEANUP
208 AT_CLEANUP
209
210 AT_SETUP([add-ps a b, add-port a a1, add-port b b1, del-ps a])
211 AT_KEYWORDS([vtep-ctl])
212 VTEP_CTL_SETUP
213 AT_CHECK([RUN_VTEP_CTL_TOGETHER(
214 [add-ps a],
215 [add-ps b],
216 [add-port a a1],
217 [add-port b b1],
218 [--if-exists del-port b b2],
219 [del-ps a])], [0], [
220
221
222
223
224
225 ], [], [VTEP_CTL_CLEANUP])
226 CHECK_PSWITCHES([b])
227 CHECK_PORTS([b], [b1])
228 VTEP_CTL_CLEANUP
229 AT_CLEANUP
230
231 AT_SETUP([add-ps a b, add-port a a1, add-port b b1, del-port a a1])
232 AT_KEYWORDS([vtep-ctl])
233 VTEP_CTL_SETUP
234 AT_CHECK([RUN_VTEP_CTL(
235 [add-ps a],
236 [add-ps b],
237 [add-port a a1],
238 [--may-exist add-port b b1],
239 [del-port a a1])], [0], [], [], [VTEP_CTL_CLEANUP])
240 AT_CHECK([RUN_VTEP_CTL([--may-exist add-port b b1])], [0], [], [],
241 [VTEP_CTL_CLEANUP])
242 CHECK_PSWITCHES([a], [b])
243 CHECK_PORTS([a])
244 CHECK_PORTS([b], [b1])
245 VTEP_CTL_CLEANUP
246 AT_CLEANUP
247
248 AT_SETUP([add-ps a b, add-port a p1, add-port b p1, del-port a p1])
249 AT_KEYWORDS([vtep-ctl])
250 VTEP_CTL_SETUP
251 AT_CHECK([RUN_VTEP_CTL(
252 [add-ps a],
253 [add-ps b],
254 [add-port a p1],
255 [add-port b p1])], [0], [], [], [VTEP_CTL_CLEANUP])
256 CHECK_PSWITCHES([a], [b])
257 CHECK_PORTS([a], [p1])
258 CHECK_PORTS([b], [p1])
259 AT_CHECK([RUN_VTEP_CTL([del-port a p1])], [0], [], [],
260 [VTEP_CTL_CLEANUP])
261 CHECK_PSWITCHES([a], [b])
262 CHECK_PORTS([a])
263 CHECK_PORTS([b], [p1])
264 VTEP_CTL_CLEANUP
265 AT_CLEANUP
266
267
268 dnl ----------------------------------------------------------------------
269 AT_BANNER([vtep-ctl unit tests -- logical switch tests])
270
271 AT_SETUP([add-ls a])
272 AT_KEYWORDS([vtep-ctl])
273 VTEP_CTL_SETUP
274 AT_CHECK([RUN_VTEP_CTL([add-ls a])], [0], [], [], [VTEP_CTL_CLEANUP])
275 CHECK_LSWITCHES([a])
276 VTEP_CTL_CLEANUP
277 AT_CLEANUP
278
279 AT_SETUP([add-ls a, add-ls a])
280 AT_KEYWORDS([vtep-ctl])
281 VTEP_CTL_SETUP
282 AT_CHECK([RUN_VTEP_CTL([add-ls a])], [0], [], [], [VTEP_CTL_CLEANUP])
283 AT_CHECK([RUN_VTEP_CTL([add-ls a])], [1], [],
284 [vtep-ctl: cannot create logical switch a because it already exists
285 ], [VTEP_CTL_CLEANUP])
286 VTEP_CTL_CLEANUP
287 AT_CLEANUP
288
289 AT_SETUP([add-ls a, add-ls b])
290 AT_KEYWORDS([vtep-ctl])
291 VTEP_CTL_SETUP
292 AT_CHECK([RUN_VTEP_CTL([add-ls a], [add-ls b])], [0], [], [],
293 [VTEP_CTL_CLEANUP])
294 CHECK_LSWITCHES([a], [b])
295 VTEP_CTL_CLEANUP
296 AT_CLEANUP
297
298 AT_SETUP([add-ls a, add-ls b, del-ls a])
299 AT_KEYWORDS([vtep-ctl])
300 VTEP_CTL_SETUP
301 AT_CHECK([RUN_VTEP_CTL([add-ls a], [add-ls b], [del-ls a])], [0], [], [],
302 [VTEP_CTL_CLEANUP])
303 CHECK_LSWITCHES([b])
304 VTEP_CTL_CLEANUP
305 AT_CLEANUP
306
307 AT_SETUP([add-ls a, del-ls a, add-ls a])
308 AT_KEYWORDS([vtep-ctl])
309 VTEP_CTL_SETUP
310 AT_CHECK([RUN_VTEP_CTL_TOGETHER(
311 [add-ls a],
312 [del-ls a],
313 [add-ls a])], [0], [
314
315
316 ], [], [VTEP_CTL_CLEANUP])
317 CHECK_LSWITCHES([a])
318 VTEP_CTL_CLEANUP
319 AT_CLEANUP
320
321 AT_SETUP([add-ls a, get-replication-mode a])
322 AT_KEYWORDS([vtep-ctl])
323 VTEP_CTL_SETUP
324 AT_CHECK([RUN_VTEP_CTL(
325 [add-ls a],
326 [get-replication-mode a])],
327 [0], [[(null)]
328 ], [], [VTEP_CTL_CLEANUP])
329 VTEP_CTL_CLEANUP
330 AT_CLEANUP
331
332 AT_SETUP([add-ls a, set-replication-mode a source_node])
333 AT_KEYWORDS([vtep-ctl])
334 VTEP_CTL_SETUP
335 AT_CHECK([RUN_VTEP_CTL(
336 [add-ls a],[set-replication-mode a source_node],
337 [get-replication-mode a])],
338 [0], [source_node
339 ], [], [VTEP_CTL_CLEANUP])
340 VTEP_CTL_CLEANUP
341 AT_CLEANUP
342
343 AT_SETUP([add-ls a, set-replication-mode a service_node])
344 AT_KEYWORDS([vtep-ctl])
345 VTEP_CTL_SETUP
346 AT_CHECK([RUN_VTEP_CTL(
347 [add-ls a],[set-replication-mode a service_node],
348 [get-replication-mode a])],
349 [0], [service_node
350 ], [], [VTEP_CTL_CLEANUP])
351 VTEP_CTL_CLEANUP
352 AT_CLEANUP
353
354 dnl ----------------------------------------------------------------------
355 AT_BANNER([vtep-ctl unit tests -- logical binding tests])
356
357 AT_SETUP([bind-ls ps1 pp1 300 ls1])
358 AT_KEYWORDS([vtep-ctl])
359 VTEP_CTL_SETUP
360 AT_CHECK([RUN_VTEP_CTL(
361 [add-ps ps1],
362 [add-port ps1 pp1],
363 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
364 CHECK_PSWITCHES([ps1])
365 CHECK_PORTS([ps1], [pp1])
366 CHECK_LSWITCHES([ls1])
367 AT_CHECK([RUN_VTEP_CTL(
368 [bind-ls ps1 pp1 300 ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
369 AT_CHECK([RUN_VTEP_CTL([list-bindings ps1 pp1])], [0],
370 [0300 ls1
371 ], [], [VTEP_CTL_CLEANUP])
372 VTEP_CTL_CLEANUP
373 AT_CLEANUP
374
375 AT_SETUP([bind-ls ps1 pp1 300 ls1, bind-ls ps1 pp1 400 ls2])
376 AT_KEYWORDS([vtep-ctl])
377 VTEP_CTL_SETUP
378 AT_CHECK([RUN_VTEP_CTL(
379 [add-ps ps1],
380 [add-port ps1 pp1],
381 [add-ls ls1],
382 [add-ls ls2])], [0], [], [], [VTEP_CTL_CLEANUP])
383 CHECK_PSWITCHES([ps1])
384 CHECK_PORTS([ps1], [pp1])
385 CHECK_LSWITCHES([ls1], [ls2])
386 AT_CHECK([RUN_VTEP_CTL(
387 [bind-ls ps1 pp1 300 ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
388 AT_CHECK([RUN_VTEP_CTL(
389 [bind-ls ps1 pp1 400 ls2])], [0], [], [], [VTEP_CTL_CLEANUP])
390 AT_CHECK([RUN_VTEP_CTL([list-bindings ps1 pp1])], [0],
391 [0300 ls1
392 0400 ls2
393 ], [], [VTEP_CTL_CLEANUP])
394 VTEP_CTL_CLEANUP
395 AT_CLEANUP
396
397 AT_SETUP([bind-ls ps1 pp1 300, bind-ls ps2 pp2 300 ls2])
398 AT_KEYWORDS([vtep-ctl])
399 VTEP_CTL_SETUP
400 AT_CHECK([RUN_VTEP_CTL(
401 [add-ps ps1],
402 [add-ps ps2],
403 [add-port ps1 pp1],
404 [add-port ps2 pp2],
405 [add-ls ls1],
406 [add-ls ls2])], [0], [], [], [VTEP_CTL_CLEANUP])
407 CHECK_PSWITCHES([ps1], [ps2])
408 CHECK_PORTS([ps1], [pp1])
409 CHECK_PORTS([ps2], [pp2])
410 CHECK_LSWITCHES([ls1], [ls2])
411 AT_CHECK([RUN_VTEP_CTL(
412 [bind-ls ps1 pp1 300 ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
413 AT_CHECK([RUN_VTEP_CTL(
414 [bind-ls ps2 pp2 300 ls2])], [0], [], [], [VTEP_CTL_CLEANUP])
415 AT_CHECK([RUN_VTEP_CTL([list-bindings ps1 pp1])], [0],
416 [0300 ls1
417 ], [], [VTEP_CTL_CLEANUP])
418 AT_CHECK([RUN_VTEP_CTL([list-bindings ps2 pp2])], [0],
419 [0300 ls2
420 ], [], [VTEP_CTL_CLEANUP])
421 VTEP_CTL_CLEANUP
422 AT_CLEANUP
423
424
425 dnl ----------------------------------------------------------------------
426 AT_BANNER([vtep-ctl unit tests -- MAC binding tests])
427
428 AT_SETUP([add-ucast-local ls1])
429 AT_KEYWORDS([vtep-ctl])
430 VTEP_CTL_SETUP
431 AT_CHECK([RUN_VTEP_CTL(
432 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
433 CHECK_LSWITCHES([ls1])
434 AT_CHECK([RUN_VTEP_CTL(
435 [add-ucast-local ls1 00:11:22:33:44:55 10.0.0.10],
436 [add-ucast-local ls1 00:11:22:33:44:66 vxlan_over_ipv4 10.0.0.11])
437 ], [0], [], [], [VTEP_CTL_CLEANUP])
438 AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0],
439 [ucast-mac-local
440 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
441 00:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11
442
443 mcast-mac-local
444
445 ], [], [VTEP_CTL_CLEANUP])
446 AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0],
447 [ucast-mac-remote
448
449 mcast-mac-remote
450
451 ], [], [VTEP_CTL_CLEANUP])
452 VTEP_CTL_CLEANUP
453 AT_CLEANUP
454
455 AT_SETUP([add-ucast-local ls1, overwrite])
456 AT_KEYWORDS([vtep-ctl])
457 VTEP_CTL_SETUP
458 AT_CHECK([RUN_VTEP_CTL(
459 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
460 CHECK_LSWITCHES([ls1])
461 AT_CHECK([RUN_VTEP_CTL(
462 [add-ucast-local ls1 00:11:22:33:44:55 10.0.0.10],
463 [add-ucast-local ls1 00:11:22:33:44:55 10.0.0.11])
464 ], [0], [], [], [VTEP_CTL_CLEANUP])
465 AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0],
466 [ucast-mac-local
467 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.11
468
469 mcast-mac-local
470
471 ], [], [VTEP_CTL_CLEANUP])
472 VTEP_CTL_CLEANUP
473 AT_CLEANUP
474
475 AT_SETUP([add-ucast-local ls1, del-ucast-local ls1])
476 AT_KEYWORDS([vtep-ctl])
477 VTEP_CTL_SETUP
478 AT_CHECK([RUN_VTEP_CTL(
479 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
480 CHECK_LSWITCHES([ls1])
481 AT_CHECK([RUN_VTEP_CTL(
482 [add-ucast-local ls1 00:11:22:33:44:55 10.0.0.10],
483 [add-ucast-local ls1 00:11:22:33:44:66 vxlan_over_ipv4 10.0.0.11])
484 ], [0], [], [], [VTEP_CTL_CLEANUP])
485 AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0],
486 [ucast-mac-local
487 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
488 00:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11
489
490 mcast-mac-local
491
492 ], [], [VTEP_CTL_CLEANUP])
493 AT_CHECK([RUN_VTEP_CTL(
494 [del-ucast-local ls1 00:11:22:33:44:55])
495 ], [0], [], [], [VTEP_CTL_CLEANUP])
496 AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0],
497 [ucast-mac-local
498 00:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11
499
500 mcast-mac-local
501
502 ], [], [VTEP_CTL_CLEANUP])
503 VTEP_CTL_CLEANUP
504 AT_CLEANUP
505
506 AT_SETUP([add-ucast-remote ls1])
507 AT_KEYWORDS([vtep-ctl])
508 VTEP_CTL_SETUP
509 AT_CHECK([RUN_VTEP_CTL(
510 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
511 CHECK_LSWITCHES([ls1])
512 AT_CHECK([RUN_VTEP_CTL(
513 [add-ucast-remote ls1 00:11:22:33:44:55 10.0.0.10],
514 [add-ucast-remote ls1 00:11:22:33:44:66 vxlan_over_ipv4 10.0.0.11])
515 ], [0], [], [], [VTEP_CTL_CLEANUP])
516 AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0],
517 [ucast-mac-remote
518 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
519 00:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11
520
521 mcast-mac-remote
522
523 ], [], [VTEP_CTL_CLEANUP])
524 AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0],
525 [ucast-mac-local
526
527 mcast-mac-local
528
529 ], [], [VTEP_CTL_CLEANUP])
530 VTEP_CTL_CLEANUP
531 AT_CLEANUP
532
533 AT_SETUP([add-ucast-remote ls1, overwrite])
534 AT_KEYWORDS([vtep-ctl])
535 VTEP_CTL_SETUP
536 AT_CHECK([RUN_VTEP_CTL(
537 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
538 CHECK_LSWITCHES([ls1])
539 AT_CHECK([RUN_VTEP_CTL(
540 [add-ucast-remote ls1 00:11:22:33:44:55 10.0.0.10],
541 [add-ucast-remote ls1 00:11:22:33:44:55 10.0.0.11])
542 ], [0], [], [], [VTEP_CTL_CLEANUP])
543 AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0],
544 [ucast-mac-remote
545 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.11
546
547 mcast-mac-remote
548
549 ], [], [VTEP_CTL_CLEANUP])
550 VTEP_CTL_CLEANUP
551 AT_CLEANUP
552
553 AT_SETUP([add-ucast-remote ls1, del-ucast-remote ls1])
554 AT_KEYWORDS([vtep-ctl])
555 VTEP_CTL_SETUP
556 AT_CHECK([RUN_VTEP_CTL(
557 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
558 CHECK_LSWITCHES([ls1])
559 AT_CHECK([RUN_VTEP_CTL(
560 [add-ucast-remote ls1 00:11:22:33:44:55 10.0.0.10],
561 [add-ucast-remote ls1 00:11:22:33:44:66 vxlan_over_ipv4 10.0.0.11])
562 ], [0], [], [], [VTEP_CTL_CLEANUP])
563 AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0],
564 [ucast-mac-remote
565 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
566 00:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11
567
568 mcast-mac-remote
569
570 ], [], [VTEP_CTL_CLEANUP])
571 AT_CHECK([RUN_VTEP_CTL(
572 [del-ucast-remote ls1 00:11:22:33:44:55])
573 ], [0], [], [], [VTEP_CTL_CLEANUP])
574 AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0],
575 [ucast-mac-remote
576 00:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11
577
578 mcast-mac-remote
579
580 ], [], [VTEP_CTL_CLEANUP])
581 VTEP_CTL_CLEANUP
582 AT_CLEANUP
583
584 AT_SETUP([add-ucast-local ls1, add-ucast-remote ls1])
585 AT_KEYWORDS([vtep-ctl])
586 VTEP_CTL_SETUP
587 AT_CHECK([RUN_VTEP_CTL(
588 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
589 CHECK_LSWITCHES([ls1])
590 AT_CHECK([RUN_VTEP_CTL(
591 [add-ucast-local ls1 00:11:22:33:44:55 10.0.0.10],
592 [add-ucast-local ls1 00:11:22:33:44:66 10.0.0.11],
593 [add-ucast-remote ls1 02:11:22:33:44:55 10.0.0.10],
594 [add-ucast-remote ls1 02:11:22:33:44:66 vxlan_over_ipv4 10.0.0.11])
595 ], [0], [], [], [VTEP_CTL_CLEANUP])
596 AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0],
597 [ucast-mac-local
598 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
599 00:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11
600
601 mcast-mac-local
602
603 ], [], [VTEP_CTL_CLEANUP])
604 AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0],
605 [ucast-mac-remote
606 02:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
607 02:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11
608
609 mcast-mac-remote
610
611 ], [], [VTEP_CTL_CLEANUP])
612 VTEP_CTL_CLEANUP
613 AT_CLEANUP
614
615 AT_SETUP([add-mcast-local ls1])
616 AT_KEYWORDS([vtep-ctl])
617 VTEP_CTL_SETUP
618 AT_CHECK([RUN_VTEP_CTL(
619 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
620 CHECK_LSWITCHES([ls1])
621 AT_CHECK([RUN_VTEP_CTL(
622 [add-mcast-local ls1 01:11:22:33:44:55 10.0.0.10],
623 [add-mcast-local ls1 01:11:22:33:44:66 vxlan_over_ipv4 10.0.0.11],
624 [add-mcast-local ls1 01:11:22:33:44:55 10.0.0.12])
625 ], [0], [], [], [VTEP_CTL_CLEANUP])
626 AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0],
627 [ucast-mac-local
628
629 mcast-mac-local
630 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
631 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12
632 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11
633
634 ], [], [VTEP_CTL_CLEANUP])
635 AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0],
636 [ucast-mac-remote
637
638 mcast-mac-remote
639
640 ], [], [VTEP_CTL_CLEANUP])
641 VTEP_CTL_CLEANUP
642 AT_CLEANUP
643
644 AT_SETUP([add-mcast-local ls1, del-mcast-local ls1])
645 AT_KEYWORDS([vtep-ctl])
646 VTEP_CTL_SETUP
647 AT_CHECK([RUN_VTEP_CTL(
648 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
649 CHECK_LSWITCHES([ls1])
650 AT_CHECK([RUN_VTEP_CTL(
651 [add-mcast-local ls1 01:11:22:33:44:55 10.0.0.10],
652 [add-mcast-local ls1 01:11:22:33:44:66 vxlan_over_ipv4 10.0.0.11],
653 [add-mcast-local ls1 01:11:22:33:44:55 10.0.0.12],
654 [add-mcast-local ls1 01:11:22:33:44:55 10.0.0.13])
655 ], [0], [], [], [VTEP_CTL_CLEANUP])
656 AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0],
657 [ucast-mac-local
658
659 mcast-mac-local
660 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
661 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12
662 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.13
663 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11
664
665 ], [], [VTEP_CTL_CLEANUP])
666 AT_CHECK([RUN_VTEP_CTL(
667 [del-mcast-local ls1 01:11:22:33:44:55 10.0.0.12])
668 ], [0], [], [], [VTEP_CTL_CLEANUP])
669 AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0],
670 [ucast-mac-local
671
672 mcast-mac-local
673 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
674 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.13
675 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11
676
677 ], [], [VTEP_CTL_CLEANUP])
678 VTEP_CTL_CLEANUP
679 AT_CLEANUP
680
681 AT_SETUP([add-mcast-remote ls1])
682 AT_KEYWORDS([vtep-ctl])
683 VTEP_CTL_SETUP
684 AT_CHECK([RUN_VTEP_CTL(
685 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
686 CHECK_LSWITCHES([ls1])
687 AT_CHECK([RUN_VTEP_CTL(
688 [add-mcast-remote ls1 01:11:22:33:44:55 10.0.0.10],
689 [add-mcast-remote ls1 01:11:22:33:44:66 vxlan_over_ipv4 10.0.0.11],
690 [add-mcast-remote ls1 01:11:22:33:44:55 10.0.0.12])
691 ], [0], [], [], [VTEP_CTL_CLEANUP])
692 AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0],
693 [ucast-mac-remote
694
695 mcast-mac-remote
696 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
697 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12
698 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11
699
700 ], [], [VTEP_CTL_CLEANUP])
701 AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0],
702 [ucast-mac-local
703
704 mcast-mac-local
705
706 ], [], [VTEP_CTL_CLEANUP])
707 VTEP_CTL_CLEANUP
708 AT_CLEANUP
709
710 AT_SETUP([add-mcast-remote ls1, del-mcast-remote ls1])
711 AT_KEYWORDS([vtep-ctl])
712 VTEP_CTL_SETUP
713 AT_CHECK([RUN_VTEP_CTL(
714 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
715 CHECK_LSWITCHES([ls1])
716 AT_CHECK([RUN_VTEP_CTL(
717 [add-mcast-remote ls1 01:11:22:33:44:55 10.0.0.10],
718 [add-mcast-remote ls1 01:11:22:33:44:66 vxlan_over_ipv4 10.0.0.11],
719 [add-mcast-remote ls1 01:11:22:33:44:55 10.0.0.12],
720 [add-mcast-remote ls1 01:11:22:33:44:55 10.0.0.13])
721 ], [0], [], [], [VTEP_CTL_CLEANUP])
722 AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0],
723 [ucast-mac-remote
724
725 mcast-mac-remote
726 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
727 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12
728 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.13
729 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11
730
731 ], [], [VTEP_CTL_CLEANUP])
732 AT_CHECK([RUN_VTEP_CTL(
733 [del-mcast-remote ls1 01:11:22:33:44:55 10.0.0.12])
734 ], [0], [], [], [VTEP_CTL_CLEANUP])
735 AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0],
736 [ucast-mac-remote
737
738 mcast-mac-remote
739 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
740 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.13
741 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11
742
743 ], [], [VTEP_CTL_CLEANUP])
744 VTEP_CTL_CLEANUP
745 AT_CLEANUP
746
747 AT_SETUP([add-mcast-local ls1, add-mcast-remote ls1])
748 AT_KEYWORDS([vtep-ctl])
749 VTEP_CTL_SETUP
750 AT_CHECK([RUN_VTEP_CTL(
751 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
752 CHECK_LSWITCHES([ls1])
753 AT_CHECK([RUN_VTEP_CTL(
754 [add-mcast-local ls1 01:11:22:33:44:55 10.0.0.10],
755 [add-mcast-local ls1 01:11:22:33:44:66 10.0.0.11],
756 [add-mcast-local ls1 01:11:22:33:44:55 10.0.0.12],
757 [add-mcast-remote ls1 03:11:22:33:44:55 10.0.0.10],
758 [add-mcast-remote ls1 03:11:22:33:44:66 vxlan_over_ipv4 10.0.0.11],
759 [add-mcast-remote ls1 03:11:22:33:44:55 10.0.0.12])
760 ], [0], [], [], [VTEP_CTL_CLEANUP])
761 AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0],
762 [ucast-mac-local
763
764 mcast-mac-local
765 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
766 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12
767 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11
768
769 ], [], [VTEP_CTL_CLEANUP])
770 AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0],
771 [ucast-mac-remote
772
773 mcast-mac-remote
774 03:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
775 03:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12
776 03:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11
777
778 ], [], [VTEP_CTL_CLEANUP])
779 VTEP_CTL_CLEANUP
780 AT_CLEANUP
781
782 AT_SETUP([add local and remote macs, clear-local-macs])
783 AT_KEYWORDS([vtep-ctl])
784 VTEP_CTL_SETUP
785 AT_CHECK([RUN_VTEP_CTL(
786 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
787 CHECK_LSWITCHES([ls1])
788 AT_CHECK([RUN_VTEP_CTL(
789 [add-ucast-local ls1 00:11:22:33:44:55 10.0.0.10],
790 [add-mcast-local ls1 01:11:22:33:44:55 10.0.0.10],
791 [add-mcast-local ls1 01:11:22:33:44:66 vxlan_over_ipv4 10.0.0.11],
792 [add-mcast-local ls1 01:11:22:33:44:55 10.0.0.12],
793 [add-ucast-remote ls1 00:11:22:33:44:55 10.0.0.10],
794 [add-mcast-remote ls1 01:11:22:33:44:55 10.0.0.10],
795 [add-mcast-remote ls1 01:11:22:33:44:66 vxlan_over_ipv4 10.0.0.11],
796 [add-mcast-remote ls1 01:11:22:33:44:55 10.0.0.12])
797 ], [0], [], [], [VTEP_CTL_CLEANUP])
798 AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0],
799 [ucast-mac-local
800 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
801
802 mcast-mac-local
803 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
804 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12
805 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11
806
807 ], [], [VTEP_CTL_CLEANUP])
808 AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0],
809 [ucast-mac-remote
810 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
811
812 mcast-mac-remote
813 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
814 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12
815 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11
816
817 ], [], [VTEP_CTL_CLEANUP])
818 AT_CHECK([RUN_VTEP_CTL(
819 [clear-local-macs ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
820 AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0],
821 [ucast-mac-local
822
823 mcast-mac-local
824
825 ], [], [VTEP_CTL_CLEANUP])
826 AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0],
827 [ucast-mac-remote
828 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
829
830 mcast-mac-remote
831 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
832 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12
833 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11
834
835 ], [], [VTEP_CTL_CLEANUP])
836 VTEP_CTL_CLEANUP
837 AT_CLEANUP
838
839 AT_SETUP([add local and remote macs, clear-remote-macs])
840 AT_KEYWORDS([vtep-ctl])
841 VTEP_CTL_SETUP
842 AT_CHECK([RUN_VTEP_CTL(
843 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
844 CHECK_LSWITCHES([ls1])
845 AT_CHECK([RUN_VTEP_CTL(
846 [add-ucast-local ls1 00:11:22:33:44:55 10.0.0.10],
847 [add-mcast-local ls1 01:11:22:33:44:55 10.0.0.10],
848 [add-mcast-local ls1 01:11:22:33:44:66 vxlan_over_ipv4 10.0.0.11],
849 [add-mcast-local ls1 01:11:22:33:44:55 10.0.0.12],
850 [add-ucast-remote ls1 00:11:22:33:44:55 10.0.0.10],
851 [add-mcast-remote ls1 01:11:22:33:44:55 10.0.0.10],
852 [add-mcast-remote ls1 01:11:22:33:44:66 vxlan_over_ipv4 10.0.0.11],
853 [add-mcast-remote ls1 01:11:22:33:44:55 10.0.0.12])
854 ], [0], [], [], [VTEP_CTL_CLEANUP])
855 AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0],
856 [ucast-mac-local
857 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
858
859 mcast-mac-local
860 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
861 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12
862 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11
863
864 ], [], [VTEP_CTL_CLEANUP])
865 AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0],
866 [ucast-mac-remote
867 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
868
869 mcast-mac-remote
870 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
871 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12
872 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11
873
874 ], [], [VTEP_CTL_CLEANUP])
875 AT_CHECK([RUN_VTEP_CTL(
876 [clear-remote-macs ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
877 AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0],
878 [ucast-mac-local
879 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
880
881 mcast-mac-local
882 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
883 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12
884 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11
885
886 ], [], [VTEP_CTL_CLEANUP])
887 AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0],
888 [ucast-mac-remote
889
890 mcast-mac-remote
891
892 ], [], [VTEP_CTL_CLEANUP])
893 VTEP_CTL_CLEANUP
894 AT_CLEANUP
895
896 dnl ----------------------------------------------------------------------
897 AT_BANNER([vtep-ctl unit tests -- manager commands])
898
899 AT_SETUP([managers])
900 AT_KEYWORDS([manager vtep-ctl])
901 VTEP_CTL_SETUP
902 AT_CHECK([RUN_VTEP_CTL_TOGETHER(
903 [del-manager],
904 [get-manager],
905 [set-manager tcp:4.5.6.7],
906 [get-manager],
907 [set-manager tcp:8.9.10.11 tcp:5.4.3.2],
908 [get-manager],
909 [del-manager],
910 [get-manager])], [0], [
911
912
913 tcp:4.5.6.7
914
915 tcp:5.4.3.2\ntcp:8.9.10.11
916
917
918 ], [], [VTEP_CTL_CLEANUP])
919 VTEP_CTL_CLEANUP
920 AT_CLEANUP
921
922 AT_SETUP([show command])
923 AT_KEYWORDS([vtep-ctl show])
924 VTEP_CTL_SETUP
925 AT_CHECK([RUN_VTEP_CTL(
926 [set-manager tcp:4.5.6.7],
927 [add-ps a],
928 [add-port a a1],
929 [add-ls ls1],
930 [bind-ls a a1 100 ls1],
931 [set Physical_Switch a management_ips=[[4.3.2.1]] tunnel_ips=[[1.2.3.4]]])], [0], [ignore], [], [VTEP_CTL_CLEANUP])
932
933 AT_CHECK([vtep-ctl --timeout=5 -vreconnect:emer --db=unix:socket show | tail -n+2 | sed 's/=[[a-f0-9-]][[a-f0-9-]]*}/=<ls>}/' ], [0], [dnl
934 Manager "tcp:4.5.6.7"
935 Physical_Switch a
936 management_ips: [["4.3.2.1"]]
937 tunnel_ips: [["1.2.3.4"]]
938 Physical_Port "a1"
939 vlan_bindings:
940 100="ls1"
941 ], [], [VTEP_CTL_CLEANUP])
942
943 VTEP_CTL_CLEANUP
944 AT_CLEANUP