]> git.proxmox.com Git - ovs.git/blame - tests/vtep-ctl.at
System-tests: Improve reliability of an icmp test.
[ovs.git] / tests / vtep-ctl.at
CommitLineData
ffc759c6
JP
1dnl VTEP_OVSDB_INIT([$1])
2dnl
3dnl Creates an empty database named $1.
4m4_define([VTEP_OVSDB_INIT],
6132b241 5 [AT_CHECK(
ffc759c6
JP
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
16dnl VTEP_CTL_SETUP
17dnl
18dnl Creates an empty database in the current directory and then starts
19dnl an ovsdb-server on it for vtep-ctl to connect to.
20m4_define([VTEP_CTL_SETUP],
21 [VTEP_OVSDB_INIT([db])
56120500 22 AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket db >/dev/null 2>&1], [0], [ignore], [ignore])])
ffc759c6
JP
23
24dnl VTEP_CTL_CLEANUP
25dnl
26dnl Kills off the database server.
27m4_define([VTEP_CTL_CLEANUP], [OVSDB_SERVER_SHUTDOWN])
28
29dnl RUN_VTEP_CTL(COMMAND, ...)
30dnl
31dnl Executes each vtep-ctl COMMAND.
32m4_define([RUN_VTEP_CTL],
33 [m4_foreach([command], [$@], [vtep-ctl --timeout=5 -vreconnect:emer --db=unix:socket command
34])])
35m4_define([RUN_VTEP_CTL_ONELINE],
36 [m4_foreach([command], [$@], [vtep-ctl --timeout=5 -vreconnect:emer --db=unix:socket --oneline -- command
37])])
38
39dnl RUN_VTEP_CTL_TOGETHER(COMMAND, ...)
40dnl
41dnl Executes each vtep-ctl COMMAND in a single run of vtep-ctl.
42m4_define([RUN_VTEP_CTL_TOGETHER],
43 [vtep-ctl --timeout=5 -vreconnect:emer --db=unix:socket --oneline dnl
44m4_foreach([command], [$@], [ -- command])])
45
46dnl CHECK_PSWITCHES([PSWITCH], ...)
47dnl
48dnl Verifies that "vtep-ctl list-ps" prints the specified list of
49dnl physical switches, which must be in alphabetical order.
50m4_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
77dnl CHECK_PORTS(PSWITCH, PORT[, PORT...])
78dnl
79dnl Verifies that "vtep-ctl list-ports PSWITCH" prints the specified
80dnl list of ports, which must be in alphabetical order.
81m4_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
101dnl CHECK_LSWITCHES([LSWITCH], ...)
102dnl
103dnl Verifies that "vtep-ctl list-ls" prints the specified list of
104dnl logical switches, which must be in alphabetical order.
105m4_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
132dnl ----------------------------------------------------------------------
133AT_BANNER([vtep-ctl unit tests -- physical switch tests])
134
135AT_SETUP([add-ps a])
136AT_KEYWORDS([vtep-ctl])
137VTEP_CTL_SETUP
138AT_CHECK([RUN_VTEP_CTL([add-ps a])], [0], [], [], [VTEP_CTL_CLEANUP])
139CHECK_PSWITCHES([a])
140VTEP_CTL_CLEANUP
141AT_CLEANUP
142
143AT_SETUP([add-ps a, add-ps a])
144AT_KEYWORDS([vtep-ctl])
145VTEP_CTL_SETUP
146AT_CHECK([RUN_VTEP_CTL([add-ps a])], [0], [], [], [VTEP_CTL_CLEANUP])
147AT_CHECK([RUN_VTEP_CTL([add-ps a])], [1], [],
148 [vtep-ctl: cannot create physical switch a because it already exists
149], [VTEP_CTL_CLEANUP])
150VTEP_CTL_CLEANUP
151AT_CLEANUP
152
153AT_SETUP([add-ps a, add-ps b])
154AT_KEYWORDS([vtep-ctl])
155VTEP_CTL_SETUP
156AT_CHECK([RUN_VTEP_CTL([add-ps a], [add-ps b])], [0], [], [],
157 [VTEP_CTL_CLEANUP])
158CHECK_PSWITCHES([a], [b])
159VTEP_CTL_CLEANUP
160AT_CLEANUP
161
162AT_SETUP([add-ps a, add-ps b, del-ps a])
163AT_KEYWORDS([vtep-ctl])
164VTEP_CTL_SETUP
165AT_CHECK([RUN_VTEP_CTL([add-ps a], [add-ps b], [del-ps a])], [0], [], [],
166 [VTEP_CTL_CLEANUP])
167CHECK_PSWITCHES([b])
168VTEP_CTL_CLEANUP
169AT_CLEANUP
170
171AT_SETUP([add-ps a, del-ps a, add-ps a])
172AT_KEYWORDS([vtep-ctl])
173VTEP_CTL_SETUP
174AT_CHECK([RUN_VTEP_CTL_TOGETHER(
175 [add-ps a],
176 [del-ps a],
177 [add-ps a])], [0], [
178
179
180], [], [VTEP_CTL_CLEANUP])
181CHECK_PSWITCHES([a])
182VTEP_CTL_CLEANUP
183AT_CLEANUP
184
185AT_SETUP([add-ps a, add-port a a1, add-port a a2])
186AT_KEYWORDS([vtep-ctl])
187VTEP_CTL_SETUP
188AT_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])
193CHECK_PSWITCHES([a])
194CHECK_PORTS([a], [a1], [a2])
195VTEP_CTL_CLEANUP
196AT_CLEANUP
197
198AT_SETUP([add-ps a, add-port a a1, add-port a a1])
199AT_KEYWORDS([vtep-ctl])
200VTEP_CTL_SETUP
201AT_CHECK([RUN_VTEP_CTL(
202 [add-ps a],
203 [add-port a a1])], [0], [], [], [VTEP_CTL_CLEANUP])
204AT_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])
207VTEP_CTL_CLEANUP
208AT_CLEANUP
209
210AT_SETUP([add-ps a b, add-port a a1, add-port b b1, del-ps a])
211AT_KEYWORDS([vtep-ctl])
212VTEP_CTL_SETUP
213AT_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])
226CHECK_PSWITCHES([b])
227CHECK_PORTS([b], [b1])
228VTEP_CTL_CLEANUP
229AT_CLEANUP
230
231AT_SETUP([add-ps a b, add-port a a1, add-port b b1, del-port a a1])
232AT_KEYWORDS([vtep-ctl])
233VTEP_CTL_SETUP
234AT_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])
240AT_CHECK([RUN_VTEP_CTL([--may-exist add-port b b1])], [0], [], [],
241 [VTEP_CTL_CLEANUP])
242CHECK_PSWITCHES([a], [b])
243CHECK_PORTS([a])
244CHECK_PORTS([b], [b1])
245VTEP_CTL_CLEANUP
246AT_CLEANUP
247
248AT_SETUP([add-ps a b, add-port a p1, add-port b p1, del-port a p1])
249AT_KEYWORDS([vtep-ctl])
250VTEP_CTL_SETUP
251AT_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])
256CHECK_PSWITCHES([a], [b])
257CHECK_PORTS([a], [p1])
258CHECK_PORTS([b], [p1])
259AT_CHECK([RUN_VTEP_CTL([del-port a p1])], [0], [], [],
260 [VTEP_CTL_CLEANUP])
261CHECK_PSWITCHES([a], [b])
262CHECK_PORTS([a])
263CHECK_PORTS([b], [p1])
264VTEP_CTL_CLEANUP
265AT_CLEANUP
266
267
268dnl ----------------------------------------------------------------------
269AT_BANNER([vtep-ctl unit tests -- logical switch tests])
270
271AT_SETUP([add-ls a])
272AT_KEYWORDS([vtep-ctl])
273VTEP_CTL_SETUP
274AT_CHECK([RUN_VTEP_CTL([add-ls a])], [0], [], [], [VTEP_CTL_CLEANUP])
275CHECK_LSWITCHES([a])
276VTEP_CTL_CLEANUP
277AT_CLEANUP
278
279AT_SETUP([add-ls a, add-ls a])
280AT_KEYWORDS([vtep-ctl])
281VTEP_CTL_SETUP
282AT_CHECK([RUN_VTEP_CTL([add-ls a])], [0], [], [], [VTEP_CTL_CLEANUP])
283AT_CHECK([RUN_VTEP_CTL([add-ls a])], [1], [],
284 [vtep-ctl: cannot create logical switch a because it already exists
285], [VTEP_CTL_CLEANUP])
286VTEP_CTL_CLEANUP
287AT_CLEANUP
288
289AT_SETUP([add-ls a, add-ls b])
290AT_KEYWORDS([vtep-ctl])
291VTEP_CTL_SETUP
292AT_CHECK([RUN_VTEP_CTL([add-ls a], [add-ls b])], [0], [], [],
293 [VTEP_CTL_CLEANUP])
294CHECK_LSWITCHES([a], [b])
295VTEP_CTL_CLEANUP
296AT_CLEANUP
297
298AT_SETUP([add-ls a, add-ls b, del-ls a])
299AT_KEYWORDS([vtep-ctl])
300VTEP_CTL_SETUP
301AT_CHECK([RUN_VTEP_CTL([add-ls a], [add-ls b], [del-ls a])], [0], [], [],
302 [VTEP_CTL_CLEANUP])
303CHECK_LSWITCHES([b])
304VTEP_CTL_CLEANUP
305AT_CLEANUP
306
307AT_SETUP([add-ls a, del-ls a, add-ls a])
308AT_KEYWORDS([vtep-ctl])
309VTEP_CTL_SETUP
310AT_CHECK([RUN_VTEP_CTL_TOGETHER(
311 [add-ls a],
312 [del-ls a],
313 [add-ls a])], [0], [
314
315
316], [], [VTEP_CTL_CLEANUP])
317CHECK_LSWITCHES([a])
318VTEP_CTL_CLEANUP
319AT_CLEANUP
320
b351ac0c
DB
321AT_SETUP([add-ls a, get-replication-mode a])
322AT_KEYWORDS([vtep-ctl])
323VTEP_CTL_SETUP
324AT_CHECK([RUN_VTEP_CTL(
325 [add-ls a],
326 [get-replication-mode a])],
327 [0], [[(null)]
328], [], [VTEP_CTL_CLEANUP])
329VTEP_CTL_CLEANUP
330AT_CLEANUP
331
332AT_SETUP([add-ls a, set-replication-mode a source_node])
333AT_KEYWORDS([vtep-ctl])
334VTEP_CTL_SETUP
335AT_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])
340VTEP_CTL_CLEANUP
341AT_CLEANUP
342
343AT_SETUP([add-ls a, set-replication-mode a service_node])
344AT_KEYWORDS([vtep-ctl])
345VTEP_CTL_SETUP
346AT_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])
351VTEP_CTL_CLEANUP
352AT_CLEANUP
ffc759c6
JP
353
354dnl ----------------------------------------------------------------------
355AT_BANNER([vtep-ctl unit tests -- logical binding tests])
356
357AT_SETUP([bind-ls ps1 pp1 300 ls1])
358AT_KEYWORDS([vtep-ctl])
359VTEP_CTL_SETUP
360AT_CHECK([RUN_VTEP_CTL(
361 [add-ps ps1],
362 [add-port ps1 pp1],
363 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
364CHECK_PSWITCHES([ps1])
365CHECK_PORTS([ps1], [pp1])
366CHECK_LSWITCHES([ls1])
367AT_CHECK([RUN_VTEP_CTL(
368 [bind-ls ps1 pp1 300 ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
369AT_CHECK([RUN_VTEP_CTL([list-bindings ps1 pp1])], [0],
370 [0300 ls1
371], [], [VTEP_CTL_CLEANUP])
372VTEP_CTL_CLEANUP
373AT_CLEANUP
374
375AT_SETUP([bind-ls ps1 pp1 300 ls1, bind-ls ps1 pp1 400 ls2])
376AT_KEYWORDS([vtep-ctl])
377VTEP_CTL_SETUP
378AT_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])
383CHECK_PSWITCHES([ps1])
384CHECK_PORTS([ps1], [pp1])
385CHECK_LSWITCHES([ls1], [ls2])
386AT_CHECK([RUN_VTEP_CTL(
387 [bind-ls ps1 pp1 300 ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
388AT_CHECK([RUN_VTEP_CTL(
389 [bind-ls ps1 pp1 400 ls2])], [0], [], [], [VTEP_CTL_CLEANUP])
390AT_CHECK([RUN_VTEP_CTL([list-bindings ps1 pp1])], [0],
391 [0300 ls1
3920400 ls2
393], [], [VTEP_CTL_CLEANUP])
394VTEP_CTL_CLEANUP
395AT_CLEANUP
396
397AT_SETUP([bind-ls ps1 pp1 300, bind-ls ps2 pp2 300 ls2])
398AT_KEYWORDS([vtep-ctl])
399VTEP_CTL_SETUP
400AT_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])
407CHECK_PSWITCHES([ps1], [ps2])
408CHECK_PORTS([ps1], [pp1])
409CHECK_PORTS([ps2], [pp2])
410CHECK_LSWITCHES([ls1], [ls2])
411AT_CHECK([RUN_VTEP_CTL(
412 [bind-ls ps1 pp1 300 ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
413AT_CHECK([RUN_VTEP_CTL(
414 [bind-ls ps2 pp2 300 ls2])], [0], [], [], [VTEP_CTL_CLEANUP])
415AT_CHECK([RUN_VTEP_CTL([list-bindings ps1 pp1])], [0],
416 [0300 ls1
417], [], [VTEP_CTL_CLEANUP])
418AT_CHECK([RUN_VTEP_CTL([list-bindings ps2 pp2])], [0],
419 [0300 ls2
420], [], [VTEP_CTL_CLEANUP])
421VTEP_CTL_CLEANUP
422AT_CLEANUP
423
424
425dnl ----------------------------------------------------------------------
426AT_BANNER([vtep-ctl unit tests -- MAC binding tests])
427
428AT_SETUP([add-ucast-local ls1])
429AT_KEYWORDS([vtep-ctl])
430VTEP_CTL_SETUP
431AT_CHECK([RUN_VTEP_CTL(
432 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
433CHECK_LSWITCHES([ls1])
434AT_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])
438AT_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
443mcast-mac-local
444
445], [], [VTEP_CTL_CLEANUP])
446AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0],
447 [ucast-mac-remote
448
449mcast-mac-remote
450
451], [], [VTEP_CTL_CLEANUP])
452VTEP_CTL_CLEANUP
453AT_CLEANUP
454
455AT_SETUP([add-ucast-local ls1, overwrite])
456AT_KEYWORDS([vtep-ctl])
457VTEP_CTL_SETUP
458AT_CHECK([RUN_VTEP_CTL(
459 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
460CHECK_LSWITCHES([ls1])
461AT_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])
465AT_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
469mcast-mac-local
470
471], [], [VTEP_CTL_CLEANUP])
472VTEP_CTL_CLEANUP
473AT_CLEANUP
474
475AT_SETUP([add-ucast-local ls1, del-ucast-local ls1])
476AT_KEYWORDS([vtep-ctl])
477VTEP_CTL_SETUP
478AT_CHECK([RUN_VTEP_CTL(
479 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
480CHECK_LSWITCHES([ls1])
481AT_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])
485AT_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
490mcast-mac-local
491
492], [], [VTEP_CTL_CLEANUP])
493AT_CHECK([RUN_VTEP_CTL(
494 [del-ucast-local ls1 00:11:22:33:44:55])
495], [0], [], [], [VTEP_CTL_CLEANUP])
496AT_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
500mcast-mac-local
501
502], [], [VTEP_CTL_CLEANUP])
503VTEP_CTL_CLEANUP
504AT_CLEANUP
505
506AT_SETUP([add-ucast-remote ls1])
507AT_KEYWORDS([vtep-ctl])
508VTEP_CTL_SETUP
509AT_CHECK([RUN_VTEP_CTL(
510 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
511CHECK_LSWITCHES([ls1])
512AT_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])
516AT_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
521mcast-mac-remote
522
523], [], [VTEP_CTL_CLEANUP])
524AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0],
525 [ucast-mac-local
526
527mcast-mac-local
528
529], [], [VTEP_CTL_CLEANUP])
530VTEP_CTL_CLEANUP
531AT_CLEANUP
532
533AT_SETUP([add-ucast-remote ls1, overwrite])
534AT_KEYWORDS([vtep-ctl])
535VTEP_CTL_SETUP
536AT_CHECK([RUN_VTEP_CTL(
537 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
538CHECK_LSWITCHES([ls1])
539AT_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])
543AT_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
547mcast-mac-remote
548
549], [], [VTEP_CTL_CLEANUP])
550VTEP_CTL_CLEANUP
551AT_CLEANUP
552
553AT_SETUP([add-ucast-remote ls1, del-ucast-remote ls1])
554AT_KEYWORDS([vtep-ctl])
555VTEP_CTL_SETUP
556AT_CHECK([RUN_VTEP_CTL(
557 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
558CHECK_LSWITCHES([ls1])
559AT_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])
563AT_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
568mcast-mac-remote
569
570], [], [VTEP_CTL_CLEANUP])
571AT_CHECK([RUN_VTEP_CTL(
572 [del-ucast-remote ls1 00:11:22:33:44:55])
573], [0], [], [], [VTEP_CTL_CLEANUP])
574AT_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
578mcast-mac-remote
579
580], [], [VTEP_CTL_CLEANUP])
581VTEP_CTL_CLEANUP
582AT_CLEANUP
583
584AT_SETUP([add-ucast-local ls1, add-ucast-remote ls1])
585AT_KEYWORDS([vtep-ctl])
586VTEP_CTL_SETUP
587AT_CHECK([RUN_VTEP_CTL(
588 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
589CHECK_LSWITCHES([ls1])
590AT_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])
596AT_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
601mcast-mac-local
602
603], [], [VTEP_CTL_CLEANUP])
604AT_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
609mcast-mac-remote
610
611], [], [VTEP_CTL_CLEANUP])
612VTEP_CTL_CLEANUP
613AT_CLEANUP
614
615AT_SETUP([add-mcast-local ls1])
616AT_KEYWORDS([vtep-ctl])
617VTEP_CTL_SETUP
618AT_CHECK([RUN_VTEP_CTL(
619 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
620CHECK_LSWITCHES([ls1])
621AT_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])
626AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0],
627 [ucast-mac-local
628
629mcast-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])
635AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0],
636 [ucast-mac-remote
637
638mcast-mac-remote
639
640], [], [VTEP_CTL_CLEANUP])
641VTEP_CTL_CLEANUP
642AT_CLEANUP
643
644AT_SETUP([add-mcast-local ls1, del-mcast-local ls1])
645AT_KEYWORDS([vtep-ctl])
646VTEP_CTL_SETUP
647AT_CHECK([RUN_VTEP_CTL(
648 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
649CHECK_LSWITCHES([ls1])
650AT_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])
656AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0],
657 [ucast-mac-local
658
659mcast-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])
666AT_CHECK([RUN_VTEP_CTL(
667 [del-mcast-local ls1 01:11:22:33:44:55 10.0.0.12])
668], [0], [], [], [VTEP_CTL_CLEANUP])
669AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0],
670 [ucast-mac-local
671
672mcast-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])
678VTEP_CTL_CLEANUP
679AT_CLEANUP
680
681AT_SETUP([add-mcast-remote ls1])
682AT_KEYWORDS([vtep-ctl])
683VTEP_CTL_SETUP
684AT_CHECK([RUN_VTEP_CTL(
685 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
686CHECK_LSWITCHES([ls1])
687AT_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])
692AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0],
693 [ucast-mac-remote
694
695mcast-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])
701AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0],
702 [ucast-mac-local
703
704mcast-mac-local
705
706], [], [VTEP_CTL_CLEANUP])
707VTEP_CTL_CLEANUP
708AT_CLEANUP
709
710AT_SETUP([add-mcast-remote ls1, del-mcast-remote ls1])
711AT_KEYWORDS([vtep-ctl])
712VTEP_CTL_SETUP
713AT_CHECK([RUN_VTEP_CTL(
714 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
715CHECK_LSWITCHES([ls1])
716AT_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])
722AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0],
723 [ucast-mac-remote
724
725mcast-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])
732AT_CHECK([RUN_VTEP_CTL(
733 [del-mcast-remote ls1 01:11:22:33:44:55 10.0.0.12])
734], [0], [], [], [VTEP_CTL_CLEANUP])
735AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0],
736 [ucast-mac-remote
737
738mcast-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])
744VTEP_CTL_CLEANUP
745AT_CLEANUP
746
747AT_SETUP([add-mcast-local ls1, add-mcast-remote ls1])
748AT_KEYWORDS([vtep-ctl])
749VTEP_CTL_SETUP
750AT_CHECK([RUN_VTEP_CTL(
751 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
752CHECK_LSWITCHES([ls1])
753AT_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])
761AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0],
762 [ucast-mac-local
763
764mcast-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])
770AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0],
771 [ucast-mac-remote
772
773mcast-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])
779VTEP_CTL_CLEANUP
780AT_CLEANUP
781
782AT_SETUP([add local and remote macs, clear-local-macs])
783AT_KEYWORDS([vtep-ctl])
784VTEP_CTL_SETUP
785AT_CHECK([RUN_VTEP_CTL(
786 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
787CHECK_LSWITCHES([ls1])
788AT_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])
798AT_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
802mcast-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])
808AT_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
812mcast-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])
818AT_CHECK([RUN_VTEP_CTL(
819 [clear-local-macs ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
820AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0],
821 [ucast-mac-local
822
823mcast-mac-local
824
825], [], [VTEP_CTL_CLEANUP])
826AT_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
830mcast-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])
836VTEP_CTL_CLEANUP
837AT_CLEANUP
838
839AT_SETUP([add local and remote macs, clear-remote-macs])
840AT_KEYWORDS([vtep-ctl])
841VTEP_CTL_SETUP
842AT_CHECK([RUN_VTEP_CTL(
843 [add-ls ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
844CHECK_LSWITCHES([ls1])
845AT_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])
855AT_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
859mcast-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])
865AT_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
869mcast-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])
875AT_CHECK([RUN_VTEP_CTL(
876 [clear-remote-macs ls1])], [0], [], [], [VTEP_CTL_CLEANUP])
877AT_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
881mcast-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])
887AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0],
888 [ucast-mac-remote
889
890mcast-mac-remote
891
892], [], [VTEP_CTL_CLEANUP])
893VTEP_CTL_CLEANUP
894AT_CLEANUP
895
896dnl ----------------------------------------------------------------------
897AT_BANNER([vtep-ctl unit tests -- manager commands])
898
899AT_SETUP([managers])
900AT_KEYWORDS([manager vtep-ctl])
901VTEP_CTL_SETUP
902AT_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
913tcp:4.5.6.7
914
915tcp:5.4.3.2\ntcp:8.9.10.11
916
917
918], [], [VTEP_CTL_CLEANUP])
919VTEP_CTL_CLEANUP
920AT_CLEANUP
3935f67d
AW
921
922AT_SETUP([show command])
923AT_KEYWORDS([vtep-ctl show])
924VTEP_CTL_SETUP
925AT_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],
31d2b7c0 931 [set Physical_Switch a management_ips=[[4.3.2.1]] tunnel_ips=[[1.2.3.4]]])], [0], [ignore], [], [VTEP_CTL_CLEANUP])
3935f67d 932
e0b68d0e 933AT_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
3935f67d
AW
934 Manager "tcp:4.5.6.7"
935 Physical_Switch a
31d2b7c0 936 management_ips: [["4.3.2.1"]]
3935f67d
AW
937 tunnel_ips: [["1.2.3.4"]]
938 Physical_Port "a1"
31d2b7c0
AW
939 vlan_bindings:
940 100="ls1"
3935f67d
AW
941], [], [VTEP_CTL_CLEANUP])
942
943VTEP_CTL_CLEANUP
944AT_CLEANUP