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