1 dnl VTEP_OVSDB_INIT([$1])
3 dnl Creates an empty database named $1.
4 m4_define([VTEP_OVSDB_INIT],
6 [ovsdb-tool create $1 $abs_top_srcdir/vtep/vtep.ovsschema],
7 [0], [stdout], [ignore])
9 [[ovsdb-tool transact $1 \
14 [0], [ignore], [ignore])])
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])])
26 dnl Kills off the database server.
27 m4_define([VTEP_CTL_CLEANUP], [OVSDB_SERVER_SHUTDOWN])
29 dnl RUN_VTEP_CTL(COMMAND, ...)
31 dnl Executes each vtep-ctl COMMAND.
32 m4_define([RUN_VTEP_CTL],
33 [m4_foreach([command], [$@], [vtep-ctl -vreconnect:emer --db=unix:socket command
35 m4_define([RUN_VTEP_CTL_ONELINE],
36 [m4_foreach([command], [$@], [vtep-ctl -vreconnect:emer --db=unix:socket --oneline -- command
39 dnl RUN_VTEP_CTL_TOGETHER(COMMAND, ...)
41 dnl Executes each vtep-ctl COMMAND in a single run of vtep-ctl.
42 m4_define([RUN_VTEP_CTL_TOGETHER],
43 [vtep-ctl -vreconnect:emer --db=unix:socket --oneline dnl
44 m4_foreach([command], [$@], [ -- command])])
46 dnl CHECK_PSWITCHES([PSWITCH], ...)
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.
53 [RUN_VTEP_CTL([list-ps])],
55 [m4_foreach([psinfo], [$@], [m4_car(psinfo)
60 dnl Check that the pswitches appear on list-ps, with --oneline.
62 [RUN_VTEP_CTL_ONELINE([list-ps])],
64 [m4_join([\n], m4_foreach([psinfo], [$@], [m4_car(psinfo),]))
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], [], [],
77 dnl CHECK_PORTS(PSWITCH, PORT[, PORT...])
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.
84 [RUN_VTEP_CTL([list-ports $1])],
86 [m4_foreach([port], m4_cdr($@), [port
91 dnl Check ports with --oneline.
93 [RUN_VTEP_CTL_ONELINE([list-ports $1])],
95 [m4_join([\n], m4_shift($@))
101 dnl CHECK_LSWITCHES([LSWITCH], ...)
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.
108 [RUN_VTEP_CTL([list-ls])],
110 [m4_foreach([lsinfo], [$@], [m4_car(lsinfo)
115 dnl Check that the lswitches appear on list-ls, with --oneline.
117 [RUN_VTEP_CTL_ONELINE([list-ls])],
119 [m4_join([\n], m4_foreach([lsinfo], [$@], [m4_car(lsinfo),]))
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])])
133 dnl CHECK_LROUTERS([LROUTER], ...)
135 dnl Verifies that "vtep-ctl list-lr" prints the specified list of
136 dnl logical routers, which must be in alphabetical order.
137 m4_define([CHECK_LROUTERS],
138 [dnl Check that the lrouters appear on list-lr, without --oneline.
140 [RUN_VTEP_CTL([list-lr])],
142 [m4_foreach([lrinfo], [$@], [m4_car(lrinfo)
147 dnl Check that the lswitches appear on list-lr, with --oneline.
149 [RUN_VTEP_CTL_ONELINE([list-lr])],
151 [m4_join([\n], m4_foreach([lrinfo], [$@], [m4_car(lrinfo),]))
156 dnl Check that each lrouter exists according to lr-exists and that
157 dnl a prouter that should not exist does not.
158 m4_foreach([lrinfo], [$@],
159 [AT_CHECK([RUN_VTEP_CTL([lr-exists m4_car(lrinfo)])], [0], [],
160 [], [VTEP_CTL_CLEANUP])])
161 AT_CHECK([RUN_VTEP_CTL([lr-exists nonexistent])], [2], [], [],
162 [VTEP_CTL_CLEANUP])])
165 dnl ----------------------------------------------------------------------
166 AT_BANNER([vtep-ctl unit tests -- physical switch tests])
169 AT_KEYWORDS([vtep-ctl])
171 AT_CHECK([RUN_VTEP_CTL([add-ps a])], [0], [], [], [VTEP_CTL_CLEANUP])
176 AT_SETUP([add-ps a, add-ps a])
177 AT_KEYWORDS([vtep-ctl])
179 AT_CHECK([RUN_VTEP_CTL([add-ps a])], [0], [], [], [VTEP_CTL_CLEANUP])
180 AT_CHECK([RUN_VTEP_CTL([add-ps a])], [1], [],
181 [vtep-ctl: cannot create physical switch a because it already exists
182 ], [VTEP_CTL_CLEANUP])
186 AT_SETUP([add-ps a, add-ps b])
187 AT_KEYWORDS([vtep-ctl])
189 AT_CHECK([RUN_VTEP_CTL([add-ps a], [add-ps b])], [0], [], [],
191 CHECK_PSWITCHES([a], [b])
195 AT_SETUP([add-ps a, add-ps b, del-ps a])
196 AT_KEYWORDS([vtep-ctl])
198 AT_CHECK([RUN_VTEP_CTL([add-ps a], [add-ps b], [del-ps a])], [0], [], [],
204 AT_SETUP([add-ps a, del-ps a, add-ps a])
205 AT_KEYWORDS([vtep-ctl])
207 AT_CHECK([RUN_VTEP_CTL_TOGETHER(
213 ], [], [VTEP_CTL_CLEANUP])
218 AT_SETUP([add-ps a, add-port a a1, add-port a a2])
219 AT_KEYWORDS([vtep-ctl])
221 AT_CHECK([RUN_VTEP_CTL(
223 [--if-exists del-ps b],
225 [add-port a a2])], [0], [], [], [VTEP_CTL_CLEANUP])
227 CHECK_PORTS([a], [a1], [a2])
231 AT_SETUP([add-ps a, add-port a a1, add-port a a1])
232 AT_KEYWORDS([vtep-ctl])
234 AT_CHECK([RUN_VTEP_CTL(
236 [add-port a a1])], [0], [], [], [VTEP_CTL_CLEANUP])
237 AT_CHECK([RUN_VTEP_CTL([add-port a a1])], [1], [],
238 [vtep-ctl: cannot create a port named a1 on a because a port with that name already exists
239 ], [VTEP_CTL_CLEANUP])
243 AT_SETUP([add-ps a b, add-port a a1, add-port b b1, del-ps a])
244 AT_KEYWORDS([vtep-ctl])
246 AT_CHECK([RUN_VTEP_CTL_TOGETHER(
251 [--if-exists del-port b b2],
258 ], [], [VTEP_CTL_CLEANUP])
260 CHECK_PORTS([b], [b1])
264 AT_SETUP([add-ps a b, add-port a a1, add-port b b1, del-port a a1])
265 AT_KEYWORDS([vtep-ctl])
267 AT_CHECK([RUN_VTEP_CTL(
271 [--may-exist add-port b b1],
272 [del-port a a1])], [0], [], [], [VTEP_CTL_CLEANUP])
273 AT_CHECK([RUN_VTEP_CTL([--may-exist add-port b b1])], [0], [], [],
275 CHECK_PSWITCHES([a], [b])
277 CHECK_PORTS([b], [b1])
281 AT_SETUP([add-ps a b, add-port a p1, add-port b p1, del-port a p1])
282 AT_KEYWORDS([vtep-ctl])
284 AT_CHECK([RUN_VTEP_CTL(
288 [add-port b p1])], [0], [], [], [VTEP_CTL_CLEANUP])
289 CHECK_PSWITCHES([a], [b])
290 CHECK_PORTS([a], [p1])
291 CHECK_PORTS([b], [p1])
292 AT_CHECK([RUN_VTEP_CTL([del-port a p1])], [0], [], [],
294 CHECK_PSWITCHES([a], [b])
296 CHECK_PORTS([b], [p1])
301 dnl ----------------------------------------------------------------------
302 AT_BANNER([vtep-ctl unit tests -- logical switch tests])
305 AT_KEYWORDS([vtep-ctl])
307 AT_CHECK([RUN_VTEP_CTL([add-ls a])], [0], [], [], [VTEP_CTL_CLEANUP])
312 AT_SETUP([add-ls a, add-ls a])
313 AT_KEYWORDS([vtep-ctl])
315 AT_CHECK([RUN_VTEP_CTL([add-ls a])], [0], [], [], [VTEP_CTL_CLEANUP])
316 AT_CHECK([RUN_VTEP_CTL([add-ls a])], [1], [],
317 [vtep-ctl: cannot create logical switch a because it already exists
318 ], [VTEP_CTL_CLEANUP])
322 AT_SETUP([add-ls a, add-ls b])
323 AT_KEYWORDS([vtep-ctl])
325 AT_CHECK([RUN_VTEP_CTL([add-ls a], [add-ls b])], [0], [], [],
327 CHECK_LSWITCHES([a], [b])
331 AT_SETUP([add-ls a, add-ls b, del-ls a])
332 AT_KEYWORDS([vtep-ctl])
334 AT_CHECK([RUN_VTEP_CTL([add-ls a], [add-ls b], [del-ls a])], [0], [], [],
340 AT_SETUP([add-ls a, del-ls a, add-ls a])
341 AT_KEYWORDS([vtep-ctl])
343 AT_CHECK([RUN_VTEP_CTL_TOGETHER(
349 ], [], [VTEP_CTL_CLEANUP])
354 AT_SETUP([add-ls a, get-replication-mode a])
355 AT_KEYWORDS([vtep-ctl])
357 AT_CHECK([RUN_VTEP_CTL(
359 [get-replication-mode a])],
361 ], [], [VTEP_CTL_CLEANUP])
365 AT_SETUP([add-ls a, set-replication-mode a source_node])
366 AT_KEYWORDS([vtep-ctl])
368 AT_CHECK([RUN_VTEP_CTL(
369 [add-ls a],[set-replication-mode a source_node],
370 [get-replication-mode a])],
372 ], [], [VTEP_CTL_CLEANUP])
376 AT_SETUP([add-ls a, set-replication-mode a service_node])
377 AT_KEYWORDS([vtep-ctl])
379 AT_CHECK([RUN_VTEP_CTL(
380 [add-ls a],[set-replication-mode a service_node],
381 [get-replication-mode a])],
383 ], [], [VTEP_CTL_CLEANUP])
388 dnl ----------------------------------------------------------------------
389 AT_BANNER([vtep-ctl unit tests -- logical router tests])
392 AT_KEYWORDS([vtep-ctl])
394 AT_CHECK([RUN_VTEP_CTL([add-lr a])], [0], [], [], [VTEP_CTL_CLEANUP])
399 AT_SETUP([add-lr a, add-lr a])
400 AT_KEYWORDS([vtep-ctl])
402 AT_CHECK([RUN_VTEP_CTL([add-lr a])], [0], [], [], [VTEP_CTL_CLEANUP])
403 AT_CHECK([RUN_VTEP_CTL([add-lr a])], [1], [],
404 [vtep-ctl: cannot create logical router a because it already exists
405 ], [VTEP_CTL_CLEANUP])
409 AT_SETUP([add-lr a, add-lr b])
410 AT_KEYWORDS([vtep-ctl])
412 AT_CHECK([RUN_VTEP_CTL([add-lr a], [add-lr b])], [0], [], [],
414 CHECK_LROUTERS([a], [b])
418 AT_SETUP([add-lr a, add-lr b, del-lr a])
419 AT_KEYWORDS([vtep-ctl])
421 AT_CHECK([RUN_VTEP_CTL([add-lr a], [add-lr b], [del-lr a])], [0], [], [],
427 AT_SETUP([add-lr a, del-lr a, add-lr a])
428 AT_KEYWORDS([vtep-ctl])
430 AT_CHECK([RUN_VTEP_CTL_TOGETHER(
436 ], [], [VTEP_CTL_CLEANUP])
441 dnl ----------------------------------------------------------------------
442 AT_BANNER([vtep-ctl unit tests -- logical binding tests])
444 AT_SETUP([bind-ls ps1 pp1 300 ls1])
445 AT_KEYWORDS([vtep-ctl])
447 AT_CHECK([RUN_VTEP_CTL(
450 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
451 CHECK_PSWITCHES([ps1])
452 CHECK_PORTS([ps1], [pp1])
453 CHECK_LSWITCHES([ls1])
454 AT_CHECK([RUN_VTEP_CTL(
455 [bind-ls ps1 pp1 300 ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
456 AT_CHECK([RUN_VTEP_CTL([list-bindings ps1 pp1])], [0],
458 ], [], [VTEP_CTL_CLEANUP])
462 AT_SETUP([bind-ls ps1 pp1 300 ls1, bind-ls ps1 pp1 400 ls2])
463 AT_KEYWORDS([vtep-ctl])
465 AT_CHECK([RUN_VTEP_CTL(
469 [add-ls ls2])], [0], [], [], [VTEP_CTL_CLEANUP])
470 CHECK_PSWITCHES([ps1])
471 CHECK_PORTS([ps1], [pp1])
472 CHECK_LSWITCHES([ls1], [ls2])
473 AT_CHECK([RUN_VTEP_CTL(
474 [bind-ls ps1 pp1 300 ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
475 AT_CHECK([RUN_VTEP_CTL(
476 [bind-ls ps1 pp1 400 ls2])], [0], [], [], [VTEP_CTL_CLEANUP])
477 AT_CHECK([RUN_VTEP_CTL([list-bindings ps1 pp1])], [0],
480 ], [], [VTEP_CTL_CLEANUP])
484 AT_SETUP([bind-ls ps1 pp1 300, bind-ls ps2 pp2 300 ls2])
485 AT_KEYWORDS([vtep-ctl])
487 AT_CHECK([RUN_VTEP_CTL(
493 [add-ls ls2])], [0], [], [], [VTEP_CTL_CLEANUP])
494 CHECK_PSWITCHES([ps1], [ps2])
495 CHECK_PORTS([ps1], [pp1])
496 CHECK_PORTS([ps2], [pp2])
497 CHECK_LSWITCHES([ls1], [ls2])
498 AT_CHECK([RUN_VTEP_CTL(
499 [bind-ls ps1 pp1 300 ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
500 AT_CHECK([RUN_VTEP_CTL(
501 [bind-ls ps2 pp2 300 ls2])], [0], [], [], [VTEP_CTL_CLEANUP])
502 AT_CHECK([RUN_VTEP_CTL([list-bindings ps1 pp1])], [0],
504 ], [], [VTEP_CTL_CLEANUP])
505 AT_CHECK([RUN_VTEP_CTL([list-bindings ps2 pp2])], [0],
507 ], [], [VTEP_CTL_CLEANUP])
512 dnl ----------------------------------------------------------------------
513 AT_BANNER([vtep-ctl unit tests -- MAC binding tests])
515 AT_SETUP([add-ucast-local ls1])
516 AT_KEYWORDS([vtep-ctl])
518 AT_CHECK([RUN_VTEP_CTL(
519 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
520 CHECK_LSWITCHES([ls1])
521 AT_CHECK([RUN_VTEP_CTL(
522 [add-ucast-local ls1 00:11:22:33:44:55 10.0.0.10],
523 [add-ucast-local ls1 00:11:22:33:44:66 vxlan_over_ipv4 10.0.0.11])
524 ], [0], [], [], [VTEP_CTL_CLEANUP])
525 AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0],
527 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
528 00:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11
532 ], [], [VTEP_CTL_CLEANUP])
533 AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0],
538 ], [], [VTEP_CTL_CLEANUP])
542 AT_SETUP([add-ucast-local ls1, overwrite])
543 AT_KEYWORDS([vtep-ctl])
545 AT_CHECK([RUN_VTEP_CTL(
546 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
547 CHECK_LSWITCHES([ls1])
548 AT_CHECK([RUN_VTEP_CTL(
549 [add-ucast-local ls1 00:11:22:33:44:55 10.0.0.10],
550 [add-ucast-local ls1 00:11:22:33:44:55 10.0.0.11])
551 ], [0], [], [], [VTEP_CTL_CLEANUP])
552 AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0],
554 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.11
558 ], [], [VTEP_CTL_CLEANUP])
562 AT_SETUP([add-ucast-local ls1, del-ucast-local ls1])
563 AT_KEYWORDS([vtep-ctl])
565 AT_CHECK([RUN_VTEP_CTL(
566 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
567 CHECK_LSWITCHES([ls1])
568 AT_CHECK([RUN_VTEP_CTL(
569 [add-ucast-local ls1 00:11:22:33:44:55 10.0.0.10],
570 [add-ucast-local ls1 00:11:22:33:44:66 vxlan_over_ipv4 10.0.0.11])
571 ], [0], [], [], [VTEP_CTL_CLEANUP])
572 AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0],
574 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
575 00:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11
579 ], [], [VTEP_CTL_CLEANUP])
580 AT_CHECK([RUN_VTEP_CTL(
581 [del-ucast-local ls1 00:11:22:33:44:55])
582 ], [0], [], [], [VTEP_CTL_CLEANUP])
583 AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0],
585 00:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11
589 ], [], [VTEP_CTL_CLEANUP])
593 AT_SETUP([add-ucast-remote ls1])
594 AT_KEYWORDS([vtep-ctl])
596 AT_CHECK([RUN_VTEP_CTL(
597 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
598 CHECK_LSWITCHES([ls1])
599 AT_CHECK([RUN_VTEP_CTL(
600 [add-ucast-remote ls1 00:11:22:33:44:55 10.0.0.10],
601 [add-ucast-remote ls1 00:11:22:33:44:66 vxlan_over_ipv4 10.0.0.11])
602 ], [0], [], [], [VTEP_CTL_CLEANUP])
603 AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0],
605 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
606 00:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11
610 ], [], [VTEP_CTL_CLEANUP])
611 AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0],
616 ], [], [VTEP_CTL_CLEANUP])
620 AT_SETUP([add-ucast-remote ls1, overwrite])
621 AT_KEYWORDS([vtep-ctl])
623 AT_CHECK([RUN_VTEP_CTL(
624 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
625 CHECK_LSWITCHES([ls1])
626 AT_CHECK([RUN_VTEP_CTL(
627 [add-ucast-remote ls1 00:11:22:33:44:55 10.0.0.10],
628 [add-ucast-remote ls1 00:11:22:33:44:55 10.0.0.11])
629 ], [0], [], [], [VTEP_CTL_CLEANUP])
630 AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0],
632 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.11
636 ], [], [VTEP_CTL_CLEANUP])
640 AT_SETUP([add-ucast-remote ls1, del-ucast-remote ls1])
641 AT_KEYWORDS([vtep-ctl])
643 AT_CHECK([RUN_VTEP_CTL(
644 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
645 CHECK_LSWITCHES([ls1])
646 AT_CHECK([RUN_VTEP_CTL(
647 [add-ucast-remote ls1 00:11:22:33:44:55 10.0.0.10],
648 [add-ucast-remote ls1 00:11:22:33:44:66 vxlan_over_ipv4 10.0.0.11])
649 ], [0], [], [], [VTEP_CTL_CLEANUP])
650 AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0],
652 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
653 00:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11
657 ], [], [VTEP_CTL_CLEANUP])
658 AT_CHECK([RUN_VTEP_CTL(
659 [del-ucast-remote ls1 00:11:22:33:44:55])
660 ], [0], [], [], [VTEP_CTL_CLEANUP])
661 AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0],
663 00:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11
667 ], [], [VTEP_CTL_CLEANUP])
671 AT_SETUP([add-ucast-local ls1, add-ucast-remote ls1])
672 AT_KEYWORDS([vtep-ctl])
674 AT_CHECK([RUN_VTEP_CTL(
675 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
676 CHECK_LSWITCHES([ls1])
677 AT_CHECK([RUN_VTEP_CTL(
678 [add-ucast-local ls1 00:11:22:33:44:55 10.0.0.10],
679 [add-ucast-local ls1 00:11:22:33:44:66 10.0.0.11],
680 [add-ucast-remote ls1 02:11:22:33:44:55 10.0.0.10],
681 [add-ucast-remote ls1 02:11:22:33:44:66 vxlan_over_ipv4 10.0.0.11])
682 ], [0], [], [], [VTEP_CTL_CLEANUP])
683 AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0],
685 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
686 00:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11
690 ], [], [VTEP_CTL_CLEANUP])
691 AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0],
693 02:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
694 02:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11
698 ], [], [VTEP_CTL_CLEANUP])
702 AT_SETUP([add-mcast-local ls1])
703 AT_KEYWORDS([vtep-ctl])
705 AT_CHECK([RUN_VTEP_CTL(
706 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
707 CHECK_LSWITCHES([ls1])
708 AT_CHECK([RUN_VTEP_CTL(
709 [add-mcast-local ls1 01:11:22:33:44:55 10.0.0.10],
710 [add-mcast-local ls1 01:11:22:33:44:66 vxlan_over_ipv4 10.0.0.11],
711 [add-mcast-local ls1 01:11:22:33:44:55 10.0.0.12])
712 ], [0], [], [], [VTEP_CTL_CLEANUP])
713 AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0],
717 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
718 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12
719 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11
721 ], [], [VTEP_CTL_CLEANUP])
722 AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0],
727 ], [], [VTEP_CTL_CLEANUP])
731 AT_SETUP([add-mcast-local ls1, del-mcast-local ls1])
732 AT_KEYWORDS([vtep-ctl])
734 AT_CHECK([RUN_VTEP_CTL(
735 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
736 CHECK_LSWITCHES([ls1])
737 AT_CHECK([RUN_VTEP_CTL(
738 [add-mcast-local ls1 01:11:22:33:44:55 10.0.0.10],
739 [add-mcast-local ls1 01:11:22:33:44:66 vxlan_over_ipv4 10.0.0.11],
740 [add-mcast-local ls1 01:11:22:33:44:55 10.0.0.12],
741 [add-mcast-local ls1 01:11:22:33:44:55 10.0.0.13])
742 ], [0], [], [], [VTEP_CTL_CLEANUP])
743 AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0],
747 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
748 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12
749 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.13
750 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11
752 ], [], [VTEP_CTL_CLEANUP])
753 AT_CHECK([RUN_VTEP_CTL(
754 [del-mcast-local ls1 01:11:22:33:44:55 10.0.0.12])
755 ], [0], [], [], [VTEP_CTL_CLEANUP])
756 AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0],
760 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
761 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.13
762 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11
764 ], [], [VTEP_CTL_CLEANUP])
768 AT_SETUP([add-mcast-remote ls1])
769 AT_KEYWORDS([vtep-ctl])
771 AT_CHECK([RUN_VTEP_CTL(
772 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
773 CHECK_LSWITCHES([ls1])
774 AT_CHECK([RUN_VTEP_CTL(
775 [add-mcast-remote ls1 01:11:22:33:44:55 10.0.0.10],
776 [add-mcast-remote ls1 01:11:22:33:44:66 vxlan_over_ipv4 10.0.0.11],
777 [add-mcast-remote ls1 01:11:22:33:44:55 10.0.0.12])
778 ], [0], [], [], [VTEP_CTL_CLEANUP])
779 AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0],
783 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
784 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12
785 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11
787 ], [], [VTEP_CTL_CLEANUP])
788 AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0],
793 ], [], [VTEP_CTL_CLEANUP])
797 AT_SETUP([add-mcast-remote ls1, del-mcast-remote ls1])
798 AT_KEYWORDS([vtep-ctl])
800 AT_CHECK([RUN_VTEP_CTL(
801 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
802 CHECK_LSWITCHES([ls1])
803 AT_CHECK([RUN_VTEP_CTL(
804 [add-mcast-remote ls1 01:11:22:33:44:55 10.0.0.10],
805 [add-mcast-remote ls1 01:11:22:33:44:66 vxlan_over_ipv4 10.0.0.11],
806 [add-mcast-remote ls1 01:11:22:33:44:55 10.0.0.12],
807 [add-mcast-remote ls1 01:11:22:33:44:55 10.0.0.13])
808 ], [0], [], [], [VTEP_CTL_CLEANUP])
809 AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0],
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:55 -> vxlan_over_ipv4/10.0.0.13
816 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11
818 ], [], [VTEP_CTL_CLEANUP])
819 AT_CHECK([RUN_VTEP_CTL(
820 [del-mcast-remote ls1 01:11:22:33:44:55 10.0.0.12])
821 ], [0], [], [], [VTEP_CTL_CLEANUP])
822 AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0],
826 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
827 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.13
828 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11
830 ], [], [VTEP_CTL_CLEANUP])
834 AT_SETUP([add-mcast-local ls1, add-mcast-remote ls1])
835 AT_KEYWORDS([vtep-ctl])
837 AT_CHECK([RUN_VTEP_CTL(
838 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
839 CHECK_LSWITCHES([ls1])
840 AT_CHECK([RUN_VTEP_CTL(
841 [add-mcast-local ls1 01:11:22:33:44:55 10.0.0.10],
842 [add-mcast-local ls1 01:11:22:33:44:66 10.0.0.11],
843 [add-mcast-local ls1 01:11:22:33:44:55 10.0.0.12],
844 [add-mcast-remote ls1 03:11:22:33:44:55 10.0.0.10],
845 [add-mcast-remote ls1 03:11:22:33:44:66 vxlan_over_ipv4 10.0.0.11],
846 [add-mcast-remote ls1 03:11:22:33:44:55 10.0.0.12])
847 ], [0], [], [], [VTEP_CTL_CLEANUP])
848 AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0],
852 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
853 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12
854 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11
856 ], [], [VTEP_CTL_CLEANUP])
857 AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0],
861 03:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
862 03:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12
863 03:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11
865 ], [], [VTEP_CTL_CLEANUP])
869 AT_SETUP([add local and remote macs, clear-local-macs])
870 AT_KEYWORDS([vtep-ctl])
872 AT_CHECK([RUN_VTEP_CTL(
873 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
874 CHECK_LSWITCHES([ls1])
875 AT_CHECK([RUN_VTEP_CTL(
876 [add-ucast-local ls1 00:11:22:33:44:55 10.0.0.10],
877 [add-mcast-local ls1 01:11:22:33:44:55 10.0.0.10],
878 [add-mcast-local ls1 01:11:22:33:44:66 vxlan_over_ipv4 10.0.0.11],
879 [add-mcast-local ls1 01:11:22:33:44:55 10.0.0.12],
880 [add-ucast-remote ls1 00:11:22:33:44:55 10.0.0.10],
881 [add-mcast-remote ls1 01:11:22:33:44:55 10.0.0.10],
882 [add-mcast-remote ls1 01:11:22:33:44:66 vxlan_over_ipv4 10.0.0.11],
883 [add-mcast-remote ls1 01:11:22:33:44:55 10.0.0.12])
884 ], [0], [], [], [VTEP_CTL_CLEANUP])
885 AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0],
887 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
890 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
891 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12
892 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11
894 ], [], [VTEP_CTL_CLEANUP])
895 AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0],
897 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
900 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
901 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12
902 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11
904 ], [], [VTEP_CTL_CLEANUP])
905 AT_CHECK([RUN_VTEP_CTL(
906 [clear-local-macs ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
907 AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0],
912 ], [], [VTEP_CTL_CLEANUP])
913 AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0],
915 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
918 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
919 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12
920 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11
922 ], [], [VTEP_CTL_CLEANUP])
926 AT_SETUP([add local and remote macs, clear-remote-macs])
927 AT_KEYWORDS([vtep-ctl])
929 AT_CHECK([RUN_VTEP_CTL(
930 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
931 CHECK_LSWITCHES([ls1])
932 AT_CHECK([RUN_VTEP_CTL(
933 [add-ucast-local ls1 00:11:22:33:44:55 10.0.0.10],
934 [add-mcast-local ls1 01:11:22:33:44:55 10.0.0.10],
935 [add-mcast-local ls1 01:11:22:33:44:66 vxlan_over_ipv4 10.0.0.11],
936 [add-mcast-local ls1 01:11:22:33:44:55 10.0.0.12],
937 [add-ucast-remote ls1 00:11:22:33:44:55 10.0.0.10],
938 [add-mcast-remote ls1 01:11:22:33:44:55 10.0.0.10],
939 [add-mcast-remote ls1 01:11:22:33:44:66 vxlan_over_ipv4 10.0.0.11],
940 [add-mcast-remote ls1 01:11:22:33:44:55 10.0.0.12])
941 ], [0], [], [], [VTEP_CTL_CLEANUP])
942 AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0],
944 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
947 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
948 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12
949 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11
951 ], [], [VTEP_CTL_CLEANUP])
952 AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0],
954 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
957 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
958 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12
959 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11
961 ], [], [VTEP_CTL_CLEANUP])
962 AT_CHECK([RUN_VTEP_CTL(
963 [clear-remote-macs ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
964 AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0],
966 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
969 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10
970 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12
971 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11
973 ], [], [VTEP_CTL_CLEANUP])
974 AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0],
979 ], [], [VTEP_CTL_CLEANUP])
983 dnl ----------------------------------------------------------------------
984 AT_BANNER([vtep-ctl unit tests -- manager commands])
987 AT_KEYWORDS([manager vtep-ctl])
989 AT_CHECK([RUN_VTEP_CTL_TOGETHER(
992 [set-manager tcp:4.5.6.7],
994 [set-manager tcp:8.9.10.11 tcp:5.4.3.2],
996 [--inactivity-probe=30000 set-manager tcp:1.2.3.4],
999 [get-manager])], [0], [
1004 tcp:5.4.3.2\ntcp:8.9.10.11
1009 ], [], [VTEP_CTL_CLEANUP])
1013 AT_SETUP([show command])
1014 AT_KEYWORDS([vtep-ctl show])
1016 AT_CHECK([RUN_VTEP_CTL(
1017 [set-manager tcp:4.5.6.7],
1021 [bind-ls a a1 100 ls1],
1022 [set Physical_Switch a management_ips=[[4.3.2.1]] tunnel_ips=[[1.2.3.4]]])], [0], [ignore], [], [VTEP_CTL_CLEANUP])
1024 AT_CHECK([vtep-ctl -vreconnect:emer --db=unix:socket show | tail -n+2 | sed 's/=[[a-f0-9-]][[a-f0-9-]]*}/=<ls>}/' ], [0], [dnl
1025 Manager "tcp:4.5.6.7"
1027 management_ips: [["4.3.2.1"]]
1028 tunnel_ips: [["1.2.3.4"]]
1032 ], [], [VTEP_CTL_CLEANUP])