3 dnl Creates an empty database in the current directory and then starts
4 dnl an ovsdb-server on it for ovs-vsctl to connect to.
5 m4_define([OVS_VSCTL_SETUP],
7 AT_CHECK([ovsdb-server --detach --no-chdir --pidfile="`pwd`"/pid --remote=punix:socket --unixctl="`pwd`"/unixctl db >/dev/null 2>&1], [0], [ignore], [ignore])])
11 dnl Kills off the database server.
12 m4_define([OVS_VSCTL_CLEANUP], [OVSDB_SERVER_SHUTDOWN])
14 dnl RUN_OVS_VSCTL(COMMAND, ...)
16 dnl Executes each ovs-vsctl COMMAND.
17 m4_define([RUN_OVS_VSCTL],
18 [m4_foreach([command], [$@], [ovs-vsctl --no-wait -vreconnect:emer --db=unix:socket command
20 m4_define([RUN_OVS_VSCTL_ONELINE],
21 [m4_foreach([command], [$@], [ovs-vsctl --no-wait -vreconnect:emer --db=unix:socket --oneline -- command
24 dnl RUN_OVS_VSCTL_TOGETHER(COMMAND, ...)
26 dnl Executes each ovs-vsctl COMMAND in a single run of ovs-vsctl.
27 m4_define([RUN_OVS_VSCTL_TOGETHER],
28 [ovs-vsctl --no-wait -vreconnect:emer --db=unix:socket --oneline dnl
29 m4_foreach([command], [$@], [ -- command])])
31 dnl CHECK_BRIDGES([BRIDGE, PARENT, VLAN], ...)
33 dnl Verifies that "ovs-vsctl list-br" prints the specified list of bridges,
34 dnl which must be in alphabetical order. Also checks that each BRIDGE has the
35 dnl specified PARENT and is on the given VLAN.
36 m4_define([_CHECK_BRIDGE],
37 [AT_CHECK([RUN_OVS_VSCTL([br-to-parent $1])], [0], [$2
38 ], [], [OVS_VSCTL_CLEANUP])
40 # Check br-to-vlan, without --oneline.
41 AT_CHECK([RUN_OVS_VSCTL([br-to-vlan $1])], [0], [$3
42 ], [], [OVS_VSCTL_CLEANUP])
43 # Check br-to-vlan, with --oneline.
44 # (This particular test is interesting with --oneline because it returns
45 # an integer instead of a string and that can cause type mismatches inside
46 # python if not done carefully.)
47 AT_CHECK([RUN_OVS_VSCTL_ONELINE([br-to-vlan $1])], [0], [$3
48 ], [], [OVS_VSCTL_CLEANUP])
50 # Check multiple queries in a single run.
51 AT_CHECK([RUN_OVS_VSCTL_TOGETHER([br-to-parent $1], [br-to-vlan $1])], [0],
54 ], [], [OVS_VSCTL_CLEANUP])])
55 m4_define([CHECK_BRIDGES],
56 [dnl Check that the bridges appear on list-br, without --oneline.
58 [RUN_OVS_VSCTL([list-br])],
60 [m4_foreach([brinfo], [$@], [m4_car(brinfo)
65 dnl Check that the bridges appear on list-br, with --oneline.
67 [RUN_OVS_VSCTL_ONELINE([list-br])],
69 [m4_join([\n], m4_foreach([brinfo], [$@], [m4_car(brinfo),]))
74 dnl Check that each bridge exists according to br-exists and that
75 dnl a bridge that should not exist does not.
76 m4_foreach([brinfo], [$@],
77 [AT_CHECK([RUN_OVS_VSCTL([br-exists m4_car(brinfo)])], [0], [],
78 [], [OVS_VSCTL_CLEANUP])])
79 AT_CHECK([RUN_OVS_VSCTL([br-exists nonexistent])], [2], [], [],
82 dnl Check that each bridge has the expected parent and VLAN.
83 m4_map([_CHECK_BRIDGE], [$@])])
85 dnl CHECK_PORTS(BRIDGE, PORT[, PORT...])
87 dnl Verifies that "ovs-vsctl list-ports BRIDGE" prints the specified
88 dnl list of ports, which must be in alphabetical order. Also checks
89 dnl that "ovs-vsctl port-to-br" reports that each port is
91 m4_define([CHECK_PORTS],
92 [dnl Check ports without --oneline.
94 [RUN_OVS_VSCTL([list-ports $1])],
96 [m4_foreach([port], m4_cdr($@), [port
101 dnl Check ports with --oneline.
103 [RUN_OVS_VSCTL_ONELINE([list-ports $1])],
105 [m4_join([\n], m4_shift($@))
109 AT_CHECK([RUN_OVS_VSCTL([port-to-br $1])], [1], [],
110 [ovs-vsctl: no port named $1
115 [AT_CHECK([RUN_OVS_VSCTL([[port-to-br] port])], [0], [$1
116 ], [], [OVS_VSCTL_CLEANUP])])])
118 dnl CHECK_IFACES(BRIDGE, IFACE[, IFACE...])
120 dnl Verifies that "ovs-vsctl list-ifaces BRIDGE" prints the specified
121 dnl list of ifaces, which must be in alphabetical order. Also checks
122 dnl that "ovs-vsctl iface-to-br" reports that each interface is
124 m4_define([CHECK_IFACES],
126 [RUN_OVS_VSCTL([list-ifaces $1])],
128 [m4_foreach([iface], m4_cdr($@), [iface
132 AT_CHECK([RUN_OVS_VSCTL([iface-to-br $1])], [1], [],
133 [ovs-vsctl: no interface named $1
138 [AT_CHECK([RUN_OVS_VSCTL([[iface-to-br] iface])], [0], [$1
140 [], [OVS_VSCTL_CLEANUP])])])
142 dnl ----------------------------------------------------------------------
143 AT_BANNER([ovs-vsctl unit tests])
145 AT_SETUP([ovs-vsctl connection retry])
146 OVS_RUNDIR=$PWD; export OVS_RUNDIR
148 dnl Without --retry, there should be no retry for active connections.
149 AT_CHECK([ovs-vsctl --db=unix:foo --timeout=10 -vreconnect:emer -- init],
151 AT_CHECK([[sed 's/([^()]*)/(...reason...)/' stderr]], [0],
152 [ovs-vsctl: unix:foo: database connection failed (...reason...)
155 dnl With --retry, we should retry for active connections.
157 [ovs-vsctl --db=unix:foo --timeout=1 --retry -vreconnect:emer -vPATTERN:console:'%c|%p|%m' -- init
160 AT_CHECK([grep -c 'terminating with signal' stderr], [0], [1
162 AT_CHECK([kill -l `cat status`], [0], [ALRM
165 dnl Without --retry, we should retry for passive connections.
167 [ovs-vsctl --db=punix:foo --timeout=1 -vreconnect:emer -vPATTERN:console:'%c|%p|%m' -- init
170 AT_CHECK([grep -c 'terminating with signal' stderr], [0], [1
172 AT_CHECK([kill -l `cat status`], [0], [ALRM
176 dnl ----------------------------------------------------------------------
177 AT_BANNER([ovs-vsctl unit tests -- real bridges])
180 AT_KEYWORDS([ovs-vsctl])
182 AT_CHECK([RUN_OVS_VSCTL([add-br a])], [0], [], [], [OVS_VSCTL_CLEANUP])
183 CHECK_BRIDGES([a, a, 0])
189 AT_SETUP([add-br a, add-br a])
190 AT_KEYWORDS([ovs-vsctl])
192 AT_CHECK([RUN_OVS_VSCTL([add-br a])], [0], [], [], [OVS_VSCTL_CLEANUP])
193 AT_CHECK([RUN_OVS_VSCTL([add-br a])], [1], [],
194 [ovs-vsctl: cannot create a bridge named a because a bridge named a already exists
195 ], [OVS_VSCTL_CLEANUP])
199 AT_SETUP([add-br a, add-br b])
200 AT_KEYWORDS([ovs-vsctl])
202 AT_CHECK([RUN_OVS_VSCTL([add-br a], [add-br b])], [0], [], [],
204 AT_CHECK([RUN_OVS_VSCTL([--may-exist add-br a b 9])], [1], [],
205 [ovs-vsctl: "--may-exist add-br a b 9" but a is not a VLAN bridge
208 CHECK_BRIDGES([a, a, 0], [b, b, 0])
216 AT_SETUP([add-br a, add-br b, del-br a])
217 AT_KEYWORDS([ovs-vsctl])
219 AT_CHECK([RUN_OVS_VSCTL([add-br a], [add-br b], [del-br a])], [0], [], [],
221 CHECK_BRIDGES([b, b, 0])
227 AT_SETUP([add-br a, del-br a, add-br a])
228 AT_KEYWORDS([ovs-vsctl])
230 AT_CHECK([RUN_OVS_VSCTL_TOGETHER(
234 [set Interface a other_config:key=value],
235 [get Interface a other_config:key])], [0], [
240 ], [], [OVS_VSCTL_CLEANUP])
241 CHECK_BRIDGES([a, a, 0])
247 AT_SETUP([add-br a, add-port a a1, add-port a a2])
248 AT_KEYWORDS([ovs-vsctl])
250 AT_CHECK([RUN_OVS_VSCTL(
252 [--if-exists del-br b],
254 [add-port a a2])], [0], [], [], [OVS_VSCTL_CLEANUP])
255 CHECK_BRIDGES([a, a, 0])
256 CHECK_PORTS([a], [a1], [a2])
257 CHECK_IFACES([a], [a1], [a2])
261 AT_SETUP([add-br a, add-port a a1, add-port a a1])
262 AT_KEYWORDS([ovs-vsctl])
264 AT_CHECK([RUN_OVS_VSCTL(
266 [add-port a a1])], [0], [], [], [OVS_VSCTL_CLEANUP])
267 AT_CHECK([RUN_OVS_VSCTL([add-port a a1])], [1], [],
268 [ovs-vsctl: cannot create a port named a1 because a port named a1 already exists on bridge a
269 ], [OVS_VSCTL_CLEANUP])
273 AT_SETUP([add-br a b, add-port a a1, add-port b b1, del-br a])
274 AT_KEYWORDS([ovs-vsctl])
276 AT_CHECK([RUN_OVS_VSCTL_TOGETHER(
281 [--if-exists del-port b b2],
288 ], [], [OVS_VSCTL_CLEANUP])
289 CHECK_BRIDGES([b, b, 0])
290 CHECK_PORTS([b], [b1])
291 CHECK_IFACES([b], [b1])
295 AT_SETUP([add-br a, add-bond a bond0 a1 a2 a3])
296 AT_KEYWORDS([ovs-vsctl])
298 AT_CHECK([RUN_OVS_VSCTL(
300 [add-bond a bond0 a1 a2 a3])], [0], [], [], [OVS_VSCTL_CLEANUP])
301 AT_CHECK([RUN_OVS_VSCTL([--may-exist add-bond a bond0 a3 a1 a2])], [0], [], [],
303 AT_CHECK([RUN_OVS_VSCTL([--may-exist add-bond a bond0 a2 a1])], [1], [],
304 [ovs-vsctl: "--may-exist add-bond a bond0 a2 a1" but bond0 actually has interface(s) a1, a2, a3
307 CHECK_BRIDGES([a, a, 0])
308 CHECK_PORTS([a], [bond0])
309 CHECK_IFACES([a], [a1], [a2], [a3])
313 AT_SETUP([add-br a b, add-port a a1, add-port b b1, del-port a a1])
314 AT_KEYWORDS([ovs-vsctl])
316 AT_CHECK([RUN_OVS_VSCTL(
319 [add-port a a1 tag=9],
321 [--may-exist add-port b b1],
322 [del-port a a1])], [0], [9
323 ], [], [OVS_VSCTL_CLEANUP])
324 AT_CHECK([RUN_OVS_VSCTL([--may-exist add-port b b1])], [0], [], [],
326 AT_CHECK([RUN_OVS_VSCTL([del-port a])], [1], [],
327 [ovs-vsctl: cannot delete port a because it is the local port for bridge a (deleting this port requires deleting the entire bridge)
330 AT_CHECK([RUN_OVS_VSCTL([--if-exists del-port a])], [0], [], [],
332 AT_CHECK([RUN_OVS_VSCTL([--may-exist add-port a b1])], [1], [],
333 [ovs-vsctl: "--may-exist add-port a b1" but b1 is actually attached to bridge b
336 CHECK_BRIDGES([a, a, 0], [b, b, 0])
339 CHECK_PORTS([b], [b1])
340 CHECK_IFACES([b], [b1])
344 AT_SETUP([add-br a, add-bond a bond0 a1 a2 a3, del-port bond0])
345 AT_KEYWORDS([ovs-vsctl])
347 AT_CHECK([RUN_OVS_VSCTL_TOGETHER(
349 [add-bond a bond0 a1 a2 a3 tag=9],
350 [get Port bond0 tag],
351 [del-port bond0])], [0], [
355 ], [], [OVS_VSCTL_CLEANUP])
356 CHECK_BRIDGES([a, a, 0])
361 AT_SETUP([external IDs])
362 AT_KEYWORDS([ovs-vsctl])
364 AT_CHECK([RUN_OVS_VSCTL_ONELINE(
367 [add-bond a bond0 a2 a3],
368 [br-set-external-id a key0 value0],
369 [set port a1 external-ids:key1=value1],
370 [set interface a2 external-ids:key2=value2],
371 [set interface a2 external-ids:key3=value3],
372 [set interface a3 external-ids:key4=value4],
373 [br-get-external-id a],
374 [br-get-external-id a key0],
375 [br-get-external-id a key1],
376 [br-set-external-id a key0 othervalue],
377 [br-get-external-id a],
378 [br-set-external-id a key0],
379 [br-get-external-id a],
380 [get port a1 external-ids],
381 [get interface a2 external-ids],
382 [get interface a3 external-ids])], [0], [
398 {"key2"="value2", "key3"="value3"}
400 ], [], [OVS_VSCTL_CLEANUP])
401 AT_CHECK([RUN_OVS_VSCTL_TOGETHER(
402 [br-get-external-id a],
403 [get port a1 external-ids],
404 [get interface a2 external-ids],
405 [get interface a3 external-ids])], [0],
408 {"key2"="value2", "key3"="value3"}
410 ], [], [OVS_VSCTL_CLEANUP])
411 CHECK_BRIDGES([a, a, 0])
412 CHECK_PORTS([a], [a1], [bond0])
413 CHECK_IFACES([a], [a1], [a2], [a3])
417 AT_SETUP([controllers])
418 AT_KEYWORDS([controller ovs-vsctl])
420 AT_CHECK([RUN_OVS_VSCTL_TOGETHER(
423 [get-controller br0],
424 [set-controller br0 tcp:4.5.6.7],
425 [get-controller br0],
427 [del-controller br0],
428 [get-controller br0],
430 [set-controller br0 tcp:8.9.10.11 tcp:5.4.3.2],
431 [get-controller br0])], [0], [
438 tcp:5.4.3.2\ntcp:8.9.10.11
439 ], [], [OVS_VSCTL_CLEANUP])
443 dnl ----------------------------------------------------------------------
444 dnl OVS_VSCTL_SETUP_SIMPLE_FAKE_CONF([VLAN])
445 m4_define([OVS_VSCTL_SETUP_SIMPLE_FAKE_CONF],
449 [--may-exist add-br xenbr0],
450 [add-port xenbr0 eth0],
451 [--may-exist add-port xenbr0 eth0],
452 [add-br xapi1 xenbr0 $1],
453 [--may-exist add-br xapi1 xenbr0 $1],
454 [add-port xapi1 eth0.$1])],
455 [0], [], [], [OVS_VSCTL_CLEANUP])])
457 dnl OVS_VSCTL_FAKE_BRIDGE_TESTS([VLAN])
458 m4_define([OVS_VSCTL_FAKE_BRIDGE_TESTS], [
459 AT_BANNER([ovs-vsctl unit tests -- fake bridges (VLAN $1)])
461 AT_SETUP([simple fake bridge (VLAN $1)])
462 AT_KEYWORDS([ovs-vsctl fake-bridge])
464 OVS_VSCTL_SETUP_SIMPLE_FAKE_CONF([$1])
465 AT_CHECK([RUN_OVS_VSCTL([--may-exist add-br xapi1])], [1], [],
466 [ovs-vsctl: "--may-exist add-br xapi1" but xapi1 is a VLAN bridge for VLAN $1
467 ], [OVS_VSCTL_CLEANUP])
468 AT_CHECK([RUN_OVS_VSCTL([--may-exist add-br xapi1 xxx $1])], [1], [],
469 [ovs-vsctl: "--may-exist add-br xapi1 xxx $1" but xapi1 has the wrong parent xenbr0
470 ], [OVS_VSCTL_CLEANUP])
471 AT_CHECK([RUN_OVS_VSCTL([--may-exist add-br xapi1 xenbr0 10])], [1], [],
472 [ovs-vsctl: "--may-exist add-br xapi1 xenbr0 10" but xapi1 is a VLAN bridge for the wrong VLAN $1
473 ], [OVS_VSCTL_CLEANUP])
474 CHECK_BRIDGES([xapi1, xenbr0, $1], [xenbr0, xenbr0, 0])
475 CHECK_PORTS([xenbr0], [eth0])
476 CHECK_IFACES([xenbr0], [eth0])
477 CHECK_PORTS([xapi1], [eth0.$1])
478 CHECK_IFACES([xapi1], [eth0.$1])
482 AT_SETUP([list bridges -- real and fake (VLAN $1)])
483 AT_KEYWORDS([ovs-vsctl fake-bridge])
485 OVS_VSCTL_SETUP_SIMPLE_FAKE_CONF([$1])
486 AT_CHECK([RUN_OVS_VSCTL_ONELINE([-- list-br])], [0],
488 ], [], [OVS_VSCTL_CLEANUP])
489 AT_CHECK([RUN_OVS_VSCTL_ONELINE([-- --real list-br])], [0],
491 ], [], [OVS_VSCTL_CLEANUP])
492 AT_CHECK([RUN_OVS_VSCTL_ONELINE([-- --fake list-br])], [0],
494 ], [], [OVS_VSCTL_CLEANUP])
498 AT_SETUP([simple fake bridge + del-br fake bridge (VLAN $1)])
499 AT_KEYWORDS([ovs-vsctl fake-bridge])
501 OVS_VSCTL_SETUP_SIMPLE_FAKE_CONF([$1])
502 AT_CHECK([RUN_OVS_VSCTL([del-br xapi1])], [0], [], [], [OVS_VSCTL_CLEANUP])
503 CHECK_BRIDGES([xenbr0, xenbr0, 0])
504 CHECK_PORTS([xenbr0], [eth0])
505 CHECK_IFACES([xenbr0], [eth0])
509 AT_SETUP([simple fake bridge + del-br real bridge (VLAN $1)])
510 AT_KEYWORDS([ovs-vsctl fake-bridge])
512 OVS_VSCTL_SETUP_SIMPLE_FAKE_CONF([$1])
513 AT_CHECK([RUN_OVS_VSCTL([del-br xenbr0])], [0], [], [], [OVS_VSCTL_CLEANUP])
518 AT_SETUP([simple fake bridge + external IDs (VLAN $1)])
519 AT_KEYWORDS([ovs-vsctl fake-bridge])
521 OVS_VSCTL_SETUP_SIMPLE_FAKE_CONF([$1])
522 AT_CHECK([RUN_OVS_VSCTL_TOGETHER(
523 [br-set-external-id xenbr0 key0 value0],
524 [br-set-external-id xapi1 key1 value1],
525 [br-get-external-id xenbr0],
526 [br-get-external-id xenbr0 key0],
527 [br-get-external-id xapi1],
528 [br-get-external-id xapi1 key1])], [0], [
534 ], [], [OVS_VSCTL_CLEANUP])
535 CHECK_BRIDGES([xapi1, xenbr0, $1], [xenbr0, xenbr0, 0])
536 CHECK_PORTS([xenbr0], [eth0])
537 CHECK_IFACES([xenbr0], [eth0])
538 CHECK_PORTS([xapi1], [eth0.$1])
539 CHECK_IFACES([xapi1], [eth0.$1])
542 ]) # OVS_VSCTL_FAKE_BRIDGE_TESTS
544 OVS_VSCTL_FAKE_BRIDGE_TESTS([9])
545 OVS_VSCTL_FAKE_BRIDGE_TESTS([0])
547 dnl OVS_VSCTL_SETUP_BOND_FAKE_CONF([VLAN])
548 m4_define([OVS_VSCTL_SETUP_BOND_FAKE_CONF],
552 [add-bond xapi1 bond0 eth0 eth1],
553 [add-br xapi2 xapi1 $1],
554 [add-port xapi2 bond0.$1])],
555 [0], [], [], [OVS_VSCTL_CLEANUP])])
557 AT_SETUP([fake bridge on bond])
558 AT_KEYWORDS([ovs-vsctl fake-bridge])
560 OVS_VSCTL_SETUP_BOND_FAKE_CONF([11])
561 CHECK_BRIDGES([xapi1, xapi1, 0], [xapi2, xapi1, 11])
562 CHECK_PORTS([xapi1], [bond0])
563 CHECK_IFACES([xapi1], [eth0], [eth1])
564 CHECK_PORTS([xapi2], [bond0.11])
565 CHECK_IFACES([xapi2], [bond0.11])
569 AT_SETUP([fake bridge on bond + del-br fake bridge])
570 AT_KEYWORDS([ovs-vsctl fake-bridge])
572 OVS_VSCTL_SETUP_BOND_FAKE_CONF([11])
573 AT_CHECK([RUN_OVS_VSCTL_ONELINE([del-br xapi2])], [0], [
574 ], [], [OVS_VSCTL_CLEANUP])
575 CHECK_BRIDGES([xapi1, xapi1, 0])
576 CHECK_PORTS([xapi1], [bond0])
577 CHECK_IFACES([xapi1], [eth0], [eth1])
581 AT_SETUP([fake bridge on bond + del-br real bridge])
582 AT_KEYWORDS([ovs-vsctl fake-bridge])
584 OVS_VSCTL_SETUP_BOND_FAKE_CONF([11])
585 AT_CHECK([RUN_OVS_VSCTL([del-br xapi1])])
590 dnl ----------------------------------------------------------------------
591 AT_BANNER([ovs-vsctl unit tests -- manager commands])
594 AT_KEYWORDS([manager ovs-vsctl])
596 AT_CHECK([RUN_OVS_VSCTL_TOGETHER(
599 [set-manager tcp:4.5.6.7],
601 [set-manager tcp:8.9.10.11 tcp:5.4.3.2],
604 [get-manager])], [0], [
609 tcp:5.4.3.2\ntcp:8.9.10.11
612 ], [], [OVS_VSCTL_CLEANUP])
616 dnl ----------------------------------------------------------------------
617 AT_BANNER([ovs-vsctl unit tests -- database commands])
619 AT_SETUP([database commands -- positive checks])
620 AT_KEYWORDS([ovs-vsctl])
623 [RUN_OVS_VSCTL_TOGETHER([--id=@br0 create bridge name=br0],
624 [set o . bridges=@br0])],
625 [0], [stdout], [], [OVS_VSCTL_CLEANUP])
627 AT_CHECK([RUN_OVS_VSCTL([list bridge], [get bridge br0 _uuid])],
628 [0], [stdout], [], [OVS_VSCTL_CLEANUP])
630 AT_CHECK([${PERL} $srcdir/uuidfilt.pl out1 out2], [0],
652 ]], [ignore], [test ! -e pid || kill `cat pid`])
654 [RUN_OVS_VSCTL([--columns=fail_mode,name,datapath_type list bridge])],
659 ]], [ignore], [test ! -e pid || kill `cat pid`])
661 [RUN_OVS_VSCTL([--columns=fail_mode,name,datapath_type find bridge])],
666 ]], [ignore], [test ! -e pid || kill `cat pid`])
668 RUN_OVS_VSCTL_TOGETHER([--id=@br1 create bridge name=br1 datapath_type="foo"],
669 [--id=@br2 create bridge name=br2 external-ids:bar=quux],
670 [add o . bridges @br1 @br2])],
671 [0], [stdout], [], [OVS_VSCTL_CLEANUP])
673 [RUN_OVS_VSCTL([--columns=name find bridge datapath_type!=foo])], [0], [stdout],
674 [ignore], [test ! -e pid || kill `cat pid`])
675 AT_CHECK([sed -n '/./p' stdout | sort], [0],
682 'other_config:datapath_id="0123456789ab"' \
683 'other_config:hwaddr="00:11:22:33:44:55"' \
684 'external-ids={"uuids"="9c45f225-a7cf-439d-976d-83db6271fda1"}' -- \
685 add bridge br0 external_ids '"roles"="local; remote; cloud"'])],
686 [0], [], [], [OVS_VSCTL_CLEANUP])
687 AT_CHECK([RUN_OVS_VSCTL_ONELINE([get bridge br0 other_config external-ids])],
688 [0], [{datapath_id="0123456789ab", hwaddr="00:11:22:33:44:55"}\n{roles="local; remote; cloud", uuids="9c45f225-a7cf-439d-976d-83db6271fda1"}
689 ], [], [OVS_VSCTL_CLEANUP])
690 AT_CHECK([RUN_OVS_VSCTL([get bridge br0 other_config:hwaddr -- --if-exists get bridge br0 other-config:nonexistent])],
691 [0], ["00:11:22:33:44:55"
693 ], [], [OVS_VSCTL_CLEANUP])
694 AT_CHECK([RUN_OVS_VSCTL([remove bridge br0 other_config hwaddr 'datapath_id=""' -- get bridge br0 other_config])],
695 [0], [{datapath_id="0123456789ab"}
696 ], [], [OVS_VSCTL_CLEANUP])
697 AT_CHECK([RUN_OVS_VSCTL([remove bridge br0 other_config 'datapath_id="0123456789ab"' -- get bridge br0 other_config])],
699 ], [], [OVS_VSCTL_CLEANUP])
700 AT_CHECK([RUN_OVS_VSCTL([clear bridge br0 external-ids -- get bridge br0 external_ids])],
702 ], [], [OVS_VSCTL_CLEANUP])
703 AT_CHECK([RUN_OVS_VSCTL_TOGETHER([destroy bridge br0],
704 [destroy bridge br1],
705 [destroy bridge br2],
706 [clear o . bridges])],
707 [0], [stdout], [], [OVS_VSCTL_CLEANUP])
708 AT_CHECK([RUN_OVS_VSCTL([list bridge])],
709 [0], [], [], [OVS_VSCTL_CLEANUP])
710 AT_CHECK([RUN_OVS_VSCTL([--if-exists get bridge x datapath_id])],
711 [0], [], [], [OVS_VSCTL_CLEANUP])
712 AT_CHECK([RUN_OVS_VSCTL([--if-exists list bridge x])],
713 [0], [], [], [OVS_VSCTL_CLEANUP])
714 AT_CHECK([RUN_OVS_VSCTL([--if-exists set controller x connection_mode=standalone])],
715 [0], [], [], [OVS_VSCTL_CLEANUP])
717 [RUN_OVS_VSCTL([--if-exists remove netflow x targets '"1.2.3.4:567"'])],
718 [0], [], [], [OVS_VSCTL_CLEANUP])
720 [RUN_OVS_VSCTL([--if-exists clear netflow x targets])],
721 [0], [], [], [OVS_VSCTL_CLEANUP])
725 AT_SETUP([database commands -- negative checks])
726 AT_KEYWORDS([ovs-vsctl])
729 AT_CHECK([ovs-vsctl --may-exist],
730 [1], [ignore], [ovs-vsctl: missing command name (use --help for help)
731 ], [OVS_VSCTL_CLEANUP])
732 AT_CHECK([ovs-vsctl --may-exist --],
733 [1], [ignore], [ovs-vsctl: missing command name (use --help for help)
734 ], [OVS_VSCTL_CLEANUP])
735 AT_CHECK([ovs-vsctl -- --may-exist],
736 [1], [ignore], [ovs-vsctl: missing command name (use --help for help)
737 ], [OVS_VSCTL_CLEANUP])
739 AT_CHECK([RUN_OVS_VSCTL([add-br br0])],
740 [0], [ignore], [], [OVS_VSCTL_CLEANUP])
741 AT_CHECK([RUN_OVS_VSCTL([add-br br1])],
742 [0], [ignore], [], [OVS_VSCTL_CLEANUP])
743 AT_CHECK([RUN_OVS_VSCTL([set-controller br1 tcp:127.0.0.1])],
744 [0], [ignore], [], [OVS_VSCTL_CLEANUP])
746 RUN_OVS_VSCTL_TOGETHER([--id=@n create netflow targets='"1.2.3.4:567"'],
747 [set bridge br0 netflow=@n])],
748 [0], [stdout], [], [OVS_VSCTL_CLEANUP])
749 cp stdout netflow-uuid
750 AT_CHECK([RUN_OVS_VSCTL([list netflow `cat netflow-uuid`])],
751 [0], [stdout], [], [OVS_VSCTL_CLEANUP])
752 AT_CHECK([${PERL} $srcdir/uuidfilt.pl netflow-uuid stdout], [0],
757 add_id_to_interface : false
761 targets : ["1.2.3.4:567"]
762 ]], [ignore], [test ! -e pid || kill `cat pid`])
763 AT_CHECK([RUN_OVS_VSCTL([list interx x])],
764 [1], [], [ovs-vsctl: unknown table "interx"
765 ], [OVS_VSCTL_CLEANUP])
766 AT_CHECK([RUN_OVS_VSCTL([list bridge x])],
767 [1], [], [ovs-vsctl: no row "x" in table Bridge
768 ], [OVS_VSCTL_CLEANUP])
769 AT_CHECK([RUN_OVS_VSCTL([get bridge x datapath_id])],
770 [1], [], [ovs-vsctl: no row "x" in table Bridge
771 ], [OVS_VSCTL_CLEANUP])
772 AT_CHECK([RUN_OVS_VSCTL([get bridge br0 d])],
773 [1], [], [ovs-vsctl: Bridge contains more than one column whose name matches "d"
774 ], [OVS_VSCTL_CLEANUP])
775 AT_CHECK([RUN_OVS_VSCTL([get bridge br0 x])],
776 [1], [], [ovs-vsctl: Bridge does not contain a column whose name matches "x"
777 ], [OVS_VSCTL_CLEANUP])
778 AT_CHECK([RUN_OVS_VSCTL([get bridge br0 :y=z])],
779 [1], [], [ovs-vsctl: :y=z: missing column name
780 ], [OVS_VSCTL_CLEANUP])
781 AT_CHECK([RUN_OVS_VSCTL([get bridge br0 datapath_id:y=z])],
782 [1], [], [ovs-vsctl: datapath_id:y=z: trailing garbage "=z" in argument
783 ], [OVS_VSCTL_CLEANUP])
784 AT_CHECK([RUN_OVS_VSCTL([set bridge br0 'datapath_id:y>=z'])],
785 [1], [], [ovs-vsctl: datapath_id:y>=z: argument does not end in "=" followed by a value.
786 ], [OVS_VSCTL_CLEANUP])
787 AT_CHECK([RUN_OVS_VSCTL([set controller x connection_mode=standalone])],
788 [1], [], [ovs-vsctl: no row "x" in table Controller
789 ], [OVS_VSCTL_CLEANUP])
790 AT_CHECK([RUN_OVS_VSCTL([wait-until bridge br0 datapath_id:y,z])],
791 [1], [], [ovs-vsctl: datapath_id:y,z: argument does not end in "=", "!=", "<", ">", "<=", ">=", "{=}", "{!=}", "{<}", "{>}", "{<=}", or "{>=}" followed by a value.
792 ], [OVS_VSCTL_CLEANUP])
793 AT_CHECK([RUN_OVS_VSCTL([get bridge br0 datapath_id::])],
794 [1], [], [ovs-vsctl: datapath_id::: trailing garbage ":" in argument
795 ], [OVS_VSCTL_CLEANUP])
796 AT_CHECK([RUN_OVS_VSCTL([get bridge br0 datapath_id:x])],
797 [1], [], [ovs-vsctl: cannot specify key to get for non-map column datapath_id
798 ], [OVS_VSCTL_CLEANUP])
799 AT_CHECK([RUN_OVS_VSCTL([get bridge br0 external_ids:x])],
800 [1], [], [ovs-vsctl: no key "x" in Bridge record "br0" column external_ids
801 ], [OVS_VSCTL_CLEANUP])
802 AT_CHECK([RUN_OVS_VSCTL([set bridge br0 flood_vlans=-1])],
803 [1], [], [ovs-vsctl: constraint violation: -1 is not in the valid range 0 to 4095 (inclusive)
804 ], [OVS_VSCTL_CLEANUP])
805 AT_CHECK([RUN_OVS_VSCTL([set bridge br0 flood_vlans=4096])],
806 [1], [], [ovs-vsctl: constraint violation: 4096 is not in the valid range 0 to 4095 (inclusive)
807 ], [OVS_VSCTL_CLEANUP])
808 AT_CHECK([RUN_OVS_VSCTL([set c br1 'connection-mode=xyz'])],
809 [1], [], [[ovs-vsctl: constraint violation: xyz is not one of the allowed values ([in-band, out-of-band])
810 ]], [OVS_VSCTL_CLEANUP])
811 AT_CHECK([RUN_OVS_VSCTL([set c br1 connection-mode:x=y])],
812 [1], [], [ovs-vsctl: cannot specify key to set for non-map column connection_mode
813 ], [OVS_VSCTL_CLEANUP])
814 AT_CHECK([RUN_OVS_VSCTL([add bridge br1 datapath_id x y])],
815 [1], [], [ovs-vsctl: "add" operation would put 2 values in column datapath_id of table Bridge but the maximum number is 1
816 ], [OVS_VSCTL_CLEANUP])
817 AT_CHECK([RUN_OVS_VSCTL([remove netflow `cat netflow-uuid` targets '"1.2.3.4:567"'])],
818 [1], [], [ovs-vsctl: "remove" operation would put 0 values in column targets of table NetFlow but the minimum number is 1
819 ], [OVS_VSCTL_CLEANUP])
820 AT_CHECK([RUN_OVS_VSCTL([remove netflow x targets '"1.2.3.4:567"'])],
821 [1], [], [ovs-vsctl: no row "x" in table NetFlow
822 ], [OVS_VSCTL_CLEANUP])
823 AT_CHECK([RUN_OVS_VSCTL([clear netflow x targets])],
824 [1], [], [ovs-vsctl: no row "x" in table NetFlow
825 ], [OVS_VSCTL_CLEANUP])
826 AT_CHECK([RUN_OVS_VSCTL([clear netflow `cat netflow-uuid` targets])],
827 [1], [], [ovs-vsctl: "clear" operation cannot be applied to column targets of table NetFlow, which is not allowed to be empty
828 ], [OVS_VSCTL_CLEANUP])
829 AT_CHECK([RUN_OVS_VSCTL([destroy bridge br2])],
830 [1], [], [ovs-vsctl: no row "br2" in table Bridge
831 ], [OVS_VSCTL_CLEANUP])
832 AT_CHECK([RUN_OVS_VSCTL([add in br1 name x])],
833 [1], [], [ovs-vsctl: cannot modify read-only column name in table Interface
834 ], [OVS_VSCTL_CLEANUP])
835 AT_CHECK([RUN_OVS_VSCTL([set port br1 name br2])],
836 [1], [], [ovs-vsctl: cannot modify read-only column name in table Port
837 ], [OVS_VSCTL_CLEANUP])
838 AT_CHECK([RUN_OVS_VSCTL([remove bridge br1 name br1])],
839 [1], [], [ovs-vsctl: cannot modify read-only column name in table Bridge
840 ], [OVS_VSCTL_CLEANUP])
841 AT_CHECK([RUN_OVS_VSCTL([clear bridge br1 name])],
842 [1], [], [ovs-vsctl: cannot modify read-only column name in table Bridge
843 ], [OVS_VSCTL_CLEANUP])
847 AT_SETUP([database commands -- conditions])
848 AT_KEYWORDS([ovs-vsctl])
849 ON_EXIT([kill `cat pid`])
852 [RUN_OVS_VSCTL_TOGETHER(
854 [add-br br1], [set bridge br1 flood_vlans=0 other-config:x='""'],
855 [add-br br2], [set bridge br2 flood_vlans=1 other-config:x=y],
856 [add-br br3], [set bridge br3 flood_vlans=0,1 other-config:x=z],
857 [add-br br4], [set bridge br4 flood_vlans=2],
858 [add-br br5], [set bridge br5 flood_vlans=0,2],
859 [add-br br6], [set bridge br6 flood_vlans=1,2],
860 [add-br br7], [set bridge br7 flood_vlans=0,1,2])], [0], [
876 m4_define([VSCTL_CHECK_FIND],
877 [AT_CHECK([echo `ovs-vsctl --bare --no-wait -vreconnect:emer --db=unix:socket -- --columns=name find bridge '$1' | sort`], [0], [$2
880 # Arithmetic relational operators without keys.
881 VSCTL_CHECK_FIND([flood_vlans=0], [br1])
882 VSCTL_CHECK_FIND([flood_vlans=1], [br2])
883 VSCTL_CHECK_FIND([flood_vlans=0,2], [br5])
884 VSCTL_CHECK_FIND([flood_vlans=0,1,2], [br7])
885 VSCTL_CHECK_FIND([flood_vlans=3], [])
887 VSCTL_CHECK_FIND([flood_vlans!=0], [br0 br2 br3 br4 br5 br6 br7])
888 VSCTL_CHECK_FIND([flood_vlans!=1], [br0 br1 br3 br4 br5 br6 br7])
889 VSCTL_CHECK_FIND([flood_vlans!=0,2], [br0 br1 br2 br3 br4 br6 br7])
890 VSCTL_CHECK_FIND([flood_vlans!=0,1,2], [br0 br1 br2 br3 br4 br5 br6])
891 VSCTL_CHECK_FIND([flood_vlans!=3], [br0 br1 br2 br3 br4 br5 br6 br7])
893 VSCTL_CHECK_FIND([flood_vlans<2], [br0 br1 br2])
894 VSCTL_CHECK_FIND([flood_vlans<0,2], [br0 br1 br2 br3 br4])
895 VSCTL_CHECK_FIND([flood_vlans>1], [br3 br4 br5 br6 br7])
896 VSCTL_CHECK_FIND([flood_vlans>0,1], [br5 br6 br7])
897 VSCTL_CHECK_FIND([flood_vlans<=2], [br0 br1 br2 br4])
898 VSCTL_CHECK_FIND([flood_vlans<=0,2], [br0 br1 br2 br3 br4 br5])
899 VSCTL_CHECK_FIND([flood_vlans>=1], [br2 br3 br4 br5 br6 br7])
900 VSCTL_CHECK_FIND([flood_vlans>=0,1], [br3 br5 br6 br7])
902 # Set relational operators without keys.
903 VSCTL_CHECK_FIND([flood_vlans{=}0], [br1])
904 VSCTL_CHECK_FIND([flood_vlans{=}1], [br2])
905 VSCTL_CHECK_FIND([flood_vlans{=}0,2], [br5])
906 VSCTL_CHECK_FIND([flood_vlans{=}0,1,2], [br7])
907 VSCTL_CHECK_FIND([flood_vlans{=}3], [])
909 VSCTL_CHECK_FIND([flood_vlans{!=}0], [br0 br2 br3 br4 br5 br6 br7])
910 VSCTL_CHECK_FIND([flood_vlans{!=}1], [br0 br1 br3 br4 br5 br6 br7])
911 VSCTL_CHECK_FIND([flood_vlans{!=}0,2], [br0 br1 br2 br3 br4 br6 br7])
912 VSCTL_CHECK_FIND([flood_vlans{!=}0,1,2], [br0 br1 br2 br3 br4 br5 br6])
913 VSCTL_CHECK_FIND([flood_vlans{!=}3], [br0 br1 br2 br3 br4 br5 br6 br7])
915 VSCTL_CHECK_FIND([flood_vlans{<}[[]]], [])
916 VSCTL_CHECK_FIND([flood_vlans{<=}[[]]], [br0])
917 VSCTL_CHECK_FIND([flood_vlans{<}0], [br0])
918 VSCTL_CHECK_FIND([flood_vlans{<=}0], [br0 br1])
919 VSCTL_CHECK_FIND([flood_vlans{<}1,2], [br0 br2 br4])
920 VSCTL_CHECK_FIND([flood_vlans{<=}1,2], [br0 br2 br4 br6])
922 VSCTL_CHECK_FIND([flood_vlans{>}[[]]], [br1 br2 br3 br4 br5 br6 br7])
923 VSCTL_CHECK_FIND([flood_vlans{>=}[[]]], [br0 br1 br2 br3 br4 br5 br6 br7])
924 VSCTL_CHECK_FIND([flood_vlans{>}0], [br3 br5 br7])
925 VSCTL_CHECK_FIND([flood_vlans{>=}0], [br1 br3 br5 br7])
926 VSCTL_CHECK_FIND([flood_vlans{>}0,2], [br7])
927 VSCTL_CHECK_FIND([flood_vlans{>=}1,2], [br6 br7])
928 VSCTL_CHECK_FIND([flood_vlans{>=}0,2], [br5 br7])
930 # Arithmetic relational operators with keys.
931 VSCTL_CHECK_FIND([other-config:x=""], [br1])
932 VSCTL_CHECK_FIND([other-config:x=y], [br2])
933 VSCTL_CHECK_FIND([other-config:x=z], [br3])
935 VSCTL_CHECK_FIND([other-config:x!=""], [br2 br3])
936 VSCTL_CHECK_FIND([other-config:x!=y], [br1 br3])
937 VSCTL_CHECK_FIND([other-config:x!=z], [br1 br2])
939 VSCTL_CHECK_FIND([other-config:x>y], [br3])
940 VSCTL_CHECK_FIND([other-config:x>=y], [br2 br3])
941 VSCTL_CHECK_FIND([other-config:x<y], [br1])
942 VSCTL_CHECK_FIND([other-config:x<=y], [br1 br2])
944 # Set relational operators with keys.
945 VSCTL_CHECK_FIND([other-config:x{=}[[]]], [br0 br4 br5 br6 br7])
946 VSCTL_CHECK_FIND([other-config:x{=}""], [br1])
947 VSCTL_CHECK_FIND([other-config:x{=}y], [br2])
948 VSCTL_CHECK_FIND([other-config:x{=}z], [br3])
950 VSCTL_CHECK_FIND([other-config:x{!=}[[]]], [br1 br2 br3])
951 VSCTL_CHECK_FIND([other-config:x{!=}""], [br0 br2 br3 br4 br5 br6 br7])
952 VSCTL_CHECK_FIND([other-config:x{!=}y], [br0 br1 br3 br4 br5 br6 br7])
953 VSCTL_CHECK_FIND([other-config:x{!=}z], [br0 br1 br2 br4 br5 br6 br7])
955 VSCTL_CHECK_FIND([other-config:x{<=}[[]]], [br0 br4 br5 br6 br7])
956 VSCTL_CHECK_FIND([other-config:x{<=}x], [br0 br4 br5 br6 br7])
957 VSCTL_CHECK_FIND([other-config:x{<=}""], [br0 br1 br4 br5 br6 br7])
958 VSCTL_CHECK_FIND([other-config:x{<=}y], [br0 br2 br4 br5 br6 br7])
959 VSCTL_CHECK_FIND([other-config:x{<=}z], [br0 br3 br4 br5 br6 br7])
960 VSCTL_CHECK_FIND([other-config:x{<=}x,y,z], [br0 br2 br3 br4 br5 br6 br7])
962 VSCTL_CHECK_FIND([other-config:x{<}[[]]], [])
963 VSCTL_CHECK_FIND([other-config:x{<}x], [br0 br4 br5 br6 br7])
964 VSCTL_CHECK_FIND([other-config:x{<}""], [br0 br4 br5 br6 br7])
965 VSCTL_CHECK_FIND([other-config:x{<}y], [br0 br4 br5 br6 br7])
966 VSCTL_CHECK_FIND([other-config:x{<}z], [br0 br4 br5 br6 br7])
968 VSCTL_CHECK_FIND([other-config:x{>=}[[]]], [br0 br1 br2 br3 br4 br5 br6 br7])
969 VSCTL_CHECK_FIND([other-config:x{>=}x], [])
970 VSCTL_CHECK_FIND([other-config:x{>=}""], [br1])
971 VSCTL_CHECK_FIND([other-config:x{>=}y], [br2])
972 VSCTL_CHECK_FIND([other-config:x{>=}z], [br3])
974 VSCTL_CHECK_FIND([other-config:x{>}[[]]], [br1 br2 br3])
975 VSCTL_CHECK_FIND([other-config:x{>}x], [])
976 VSCTL_CHECK_FIND([other-config:x{>}""], [])
977 VSCTL_CHECK_FIND([other-config:x{>}y], [])
978 VSCTL_CHECK_FIND([other-config:x{>}z], [])
982 AT_SETUP([database commands -- wait-until immediately true])
983 AT_KEYWORDS([ovs-vsctl])
985 AT_CHECK([RUN_OVS_VSCTL(
987 [add-bond br0 bond0 eth0 eth1],
988 [set port bond0 bond_updelay=500 other-config:abc=def])],
989 [0], [], [], [OVS_VSCTL_CLEANUP])
990 AT_CHECK([RUN_OVS_VSCTL([[wait-until Open_vSwitch . manager_options=[]]])],
991 [0], [], [], [OVS_VSCTL_CLEANUP])
992 AT_CHECK([RUN_OVS_VSCTL([[wait-until Open_vSwitch . bridges!=[]]])],
993 [0], [], [], [OVS_VSCTL_CLEANUP])
994 AT_CHECK([RUN_OVS_VSCTL([[wait-until Port bond0 other-config:abc=def]])],
995 [0], [], [], [OVS_VSCTL_CLEANUP])
996 AT_CHECK([RUN_OVS_VSCTL([[wait-until port bond0 'bond_updelay>50' 'other-config:abc>d' 'other-config:abc<e']])],
997 [0], [], [], [OVS_VSCTL_CLEANUP])
1001 AT_SETUP([database commands -- wait-until must wait])
1002 AT_KEYWORDS([ovs-vsctl])
1006 # Start ovs-vsctls in background.
1007 (RUN_OVS_VSCTL([[wait-until o . bridges!=[] -- get bridge br10 other-config:abc]])) > stdout1 &
1008 (RUN_OVS_VSCTL([[wait-until bridge br1 -- get bridge br1 other-config:abc]])) > stdout2 &
1009 (RUN_OVS_VSCTL([[wait-until bridge br1 other-config={abc=def} -- get bridge br1 other-config]])) > stdout3 &
1010 (RUN_OVS_VSCTL([[wait-until port bond0 'bond_updelay>50' -- get port bond0 bond-updelay]])) > stdout4 &
1012 # Give the ovs-vsctls a chance to read the database
1015 AT_CHECK([RUN_OVS_VSCTL([add-br br10 -- set bridge br10 other-config:abc=quux])
1016 RUN_OVS_VSCTL([add-br br1 -- set bridge br1 other-config:abc=def -- add-bond br1 bond0 eth0 eth1 -- set port bond0 bond_updelay=500])],
1017 [0], [], [], [OVS_VSCTL_CLEANUP])
1019 # Wait for the ovs-vsctls to finish.
1023 AT_CHECK([cat stdout1], [0], [quux
1024 ], [], [OVS_VSCTL_CLEANUP])
1025 AT_CHECK([cat stdout2], [0], [def
1026 ], [], [OVS_VSCTL_CLEANUP])
1027 AT_CHECK([cat stdout3], [0], [{abc=def}
1028 ], [], [OVS_VSCTL_CLEANUP])
1029 AT_CHECK([cat stdout4], [0], [500
1030 ], [], [OVS_VSCTL_CLEANUP])
1035 AT_SETUP([--id option on create, get commands])
1036 AT_KEYWORDS([ovs-vsctl])
1038 AT_CHECK([RUN_OVS_VSCTL([add-br br0],
1039 [add-port br0 eth0],
1040 [add-port br0 eth1])])
1042 [RUN_OVS_VSCTL_TOGETHER(
1043 [set bridge br0 mirrors=@m],
1044 [--id=@eth0 get port eth0],
1045 [--id=@eth1 get port eth1],
1046 [--id=@m create mirror name=mymirror select-dst-port=@eth0 select-src-port=@eth0 output-port=@eth1])],
1047 [0], [stdout], [], [OVS_VSCTL_CLEANUP])
1049 [${PERL} $srcdir/uuidfilt.pl stdout], [0], [dnl
1055 [], [OVS_VSCTL_CLEANUP])
1058 [list port eth0 eth1],
1060 [list bridge br0])],
1061 [0], [stdout], [], [OVS_VSCTL_CLEANUP])
1063 [sed -n -e '/uuid/p' -e '/name/p' -e '/mirrors/p' -e '/select/p' -e '/output/p' < stdout | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl
1073 select_dst_port : [<0>]
1074 select_src_port : [<0>]
1080 [], [OVS_VSCTL_CLEANUP])
1084 AT_SETUP([unreferenced record warnings])
1085 AT_KEYWORDS([ovs-vsctl])
1088 [ovs-vsctl -vPATTERN:console:'%c|%p|%m' --no-wait -vreconnect:emer --db=unix:socket \
1089 -- create Bridge name=br0 | ${PERL} $srcdir/uuidfilt.pl],
1091 ], [vsctl|WARN|applying "create" command to table Bridge without --id option will have no effect
1092 ], [OVS_VSCTL_CLEANUP])
1094 [ovs-vsctl -vPATTERN:console:'%c|%p|%m' --no-wait -vreconnect:emer --db=unix:socket \
1095 -- --id=@br0 create Bridge name=br0 | ${PERL} $srcdir/uuidfilt.pl],
1097 ], [vsctl|WARN|row id "@br0" was created but no reference to it was inserted, so it will not actually appear in the database
1098 ], [OVS_VSCTL_CLEANUP])
1100 [ovs-vsctl -vPATTERN:console:'%c|%p|%m' --no-wait -vreconnect:emer --db=unix:socket \
1101 -- --id=@eth0_iface create Interface name=eth0 \
1102 -- --id=@eth0 create Port name=eth0 interfaces=@eth0_iface \
1103 -- --id=@m0 create Mirror name=m0 output_port=@eth0 \
1104 -- --id=@br0 create Bridge name=br0 mirrors=@m0 \
1105 -- set Open_vSwitch . bridges=@br0 | ${PERL} $srcdir/uuidfilt.pl],
1110 ], [vsctl|WARN|row id "@eth0" was created but only a weak reference to it was inserted, so it will not actually appear in the database
1111 ], [OVS_VSCTL_CLEANUP])
1115 dnl This test really shows a bug -- "create" followed by "list" in
1116 dnl the same execution shows the wrong UUID on the "list" command.
1117 dnl The bug is documented in ovs-vsctl.8.
1118 AT_SETUP([created row UUID is wrong in same execution])
1119 AT_KEYWORDS([ovs-vsctl])
1121 AT_CHECK([RUN_OVS_VSCTL([--id=@br0 create Bridge name=br0 -- add Open_vSwitch . bridges @br0 -- list bridge])],
1122 [0], [stdout], [], [OVS_VSCTL_CLEANUP])
1123 AT_CHECK([${PERL} $srcdir/uuidfilt.pl stdout], [0],
1143 ]], [ignore], [test ! -e pid || kill `cat pid`])
1147 dnl This test will create a linux-htb QoS record that
1148 dnl points to a few queues and use it on a1 and a2 port.
1149 dnl It also destroys all records from Qos and Queue table.
1150 AT_SETUP([--all option on destroy command])
1151 AT_KEYWORDS([ovs-vsctl])
1153 AT_CHECK([RUN_OVS_VSCTL(
1156 [add-port a a2])], [0], [], [], [OVS_VSCTL_CLEANUP])
1157 CHECK_BRIDGES([a, a, 0])
1158 CHECK_PORTS([a], [a1], [a2])
1159 CHECK_IFACES([a], [a1], [a2])
1160 AT_CHECK([RUN_OVS_VSCTL_TOGETHER(
1161 [set Port a1 qos=@newqos],
1162 [set Port a2 qos=@newqos],
1163 [--id=@newqos create QoS type=linux-htb other-config:max-rate=1000000000 queues=0=@q0,1=@q1],
1164 [--id=@q0 create Queue other-config:min-rate=100000000 other-config:max-rate=100000000],
1165 [--id=@q1 create Queue other-config:min-rate=500000000])], [0], [ignore], [], [OVS_VSCTL_CLEANUP])
1166 AT_CHECK([RUN_OVS_VSCTL(
1167 [--columns=other_config,type list Qos])], [0],
1168 [other_config : {max-rate="1000000000"}
1170 ], [], [OVS_VSCTL_CLEANUP])
1171 AT_CHECK([RUN_OVS_VSCTL(
1172 [--columns=other_config list Queue | sort | xargs echo])], [0],
1173 [other_config : {max-rate=100000000, min-rate=100000000} other_config : {min-rate=500000000}
1174 ], [], [OVS_VSCTL_CLEANUP])
1175 AT_CHECK([RUN_OVS_VSCTL(
1176 [clear Port a1 qos],
1177 [clear Port a2 qos])], [0], [], [], [OVS_VSCTL_CLEANUP])
1178 AT_CHECK([RUN_OVS_VSCTL(
1179 [--columns=qos list Port a1 a2])], [0],
1183 ]], [], [OVS_VSCTL_CLEANUP])
1184 AT_CHECK([RUN_OVS_VSCTL(
1185 [--all destroy Qos])], [0], [], [], [OVS_VSCTL_CLEANUP])
1186 AT_CHECK([RUN_OVS_VSCTL(
1187 [-- list Qos])], [0], [], [], [OVS_VSCTL_CLEANUP])
1188 AT_CHECK([RUN_OVS_VSCTL(
1189 [--all destroy Queue])], [0], [], [], [OVS_VSCTL_CLEANUP])
1190 AT_CHECK([RUN_OVS_VSCTL(
1191 [-- list Queue])], [0], [], [], [OVS_VSCTL_CLEANUP])
1195 dnl ----------------------------------------------------------------------
1196 AT_BANNER([ovs-vsctl add-port -- reserved port names])
1198 AT_SETUP([add-port -- reserved names 1])
1201 # Test creating all reserved port names
1211 # Try creating the port
1212 AT_CHECK([ovs-vsctl add-port br0 reserved_name], [0], [], [])
1213 # Detect the warning log message
1214 AT_CHECK([sed -n "s/^.*\(|bridge|WARN|.*\)$/\1/p" ovs-vswitchd.log], [0], [dnl
1215 |bridge|WARN|could not create interface reserved_name, name is reserved
1217 # Delete the warning log message
1218 AT_CHECK([sed "/|bridge|WARN|/d" ovs-vswitchd.log > ovs-vswitchd.log], [0], [], [])
1220 AT_CHECK([ovs-vsctl del-port br0 reserved_name], [0], [], [])])
1224 AT_SETUP([add-port -- reserved names 2])
1225 # Creates all type of tunnel ports
1226 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
1227 options:remote_ip=1.1.1.1 ofport_request=1\
1228 -- add-port br0 p2 -- set Interface p2 type=gre64 \
1229 options:local_ip=2.2.2.2 options:remote_ip=1.1.1.1 \
1231 -- add-port br0 p3 -- set Interface p3 type=lisp \
1232 options:remote_ip=2.2.2.2 ofport_request=3 \
1233 -- add-port br0 p4 -- set Interface p4 type=vxlan \
1234 options:remote_ip=2.2.2.2 ofport_request=4])
1236 # Test creating all reserved tunnel port names
1244 # Try creating the port
1245 AT_CHECK([ovs-vsctl add-port br0 reserved_name], [0], [], [])
1246 # Detect the warning log message
1247 AT_CHECK([sed -n "s/^.*\(|bridge|WARN|.*\)$/\1/p" ovs-vswitchd.log], [0], [dnl
1248 |bridge|WARN|could not create interface reserved_name, name is reserved
1250 # Delete the warning log message
1251 AT_CHECK([sed "/|bridge|WARN|/d" ovs-vswitchd.log > ovs-vswitchd.log], [0], [], [])
1253 AT_CHECK([ovs-vsctl del-port br0 reserved_name], [0], [], [])])