dnl OVS_VSCTL_SETUP dnl dnl Creates an empty database in the current directory and then starts dnl an ovsdb-server on it for ovs-vsctl to connect to. m4_define([OVS_VSCTL_SETUP], [OVSDB_INIT([db]) AT_CHECK([ovsdb-server --detach --no-chdir --pidfile="`pwd`"/pid --remote=punix:socket --unixctl="`pwd`"/unixctl db >/dev/null 2>&1], [0], [ignore], [ignore])]) dnl OVS_VSCTL_CLEANUP dnl dnl Kills off the database server. m4_define([OVS_VSCTL_CLEANUP], [OVSDB_SERVER_SHUTDOWN]) dnl RUN_OVS_VSCTL(COMMAND, ...) dnl dnl Executes each ovs-vsctl COMMAND. m4_define([RUN_OVS_VSCTL], [m4_foreach([command], [$@], [ovs-vsctl --timeout=5 --no-wait -vreconnect:emer --db=unix:socket command ])]) m4_define([RUN_OVS_VSCTL_ONELINE], [m4_foreach([command], [$@], [ovs-vsctl --timeout=5 --no-wait -vreconnect:emer --db=unix:socket --oneline -- command ])]) dnl RUN_OVS_VSCTL_TOGETHER(COMMAND, ...) dnl dnl Executes each ovs-vsctl COMMAND in a single run of ovs-vsctl. m4_define([RUN_OVS_VSCTL_TOGETHER], [ovs-vsctl --timeout=5 --no-wait -vreconnect:emer --db=unix:socket --oneline dnl m4_foreach([command], [$@], [ -- command])]) dnl CHECK_BRIDGES([BRIDGE, PARENT, VLAN], ...) dnl dnl Verifies that "ovs-vsctl list-br" prints the specified list of bridges, dnl which must be in alphabetical order. Also checks that each BRIDGE has the dnl specified PARENT and is on the given VLAN. m4_define([_CHECK_BRIDGE], [AT_CHECK([RUN_OVS_VSCTL([br-to-parent $1])], [0], [$2 ], [], [OVS_VSCTL_CLEANUP]) # Check br-to-vlan, without --oneline. AT_CHECK([RUN_OVS_VSCTL([br-to-vlan $1])], [0], [$3 ], [], [OVS_VSCTL_CLEANUP]) # Check br-to-vlan, with --oneline. # (This particular test is interesting with --oneline because it returns # an integer instead of a string and that can cause type mismatches inside # python if not done carefully.) AT_CHECK([RUN_OVS_VSCTL_ONELINE([br-to-vlan $1])], [0], [$3 ], [], [OVS_VSCTL_CLEANUP]) # Check multiple queries in a single run. AT_CHECK([RUN_OVS_VSCTL_TOGETHER([br-to-parent $1], [br-to-vlan $1])], [0], [$2 $3 ], [], [OVS_VSCTL_CLEANUP])]) m4_define([CHECK_BRIDGES], [dnl Check that the bridges appear on list-br, without --oneline. AT_CHECK( [RUN_OVS_VSCTL([list-br])], [0], [m4_foreach([brinfo], [$@], [m4_car(brinfo) ])], [], [OVS_VSCTL_CLEANUP]) dnl Check that the bridges appear on list-br, with --oneline. AT_CHECK( [RUN_OVS_VSCTL_ONELINE([list-br])], [0], [m4_join([\n], m4_foreach([brinfo], [$@], [m4_car(brinfo),])) ], [], [OVS_VSCTL_CLEANUP]) dnl Check that each bridge exists according to br-exists and that dnl a bridge that should not exist does not. m4_foreach([brinfo], [$@], [AT_CHECK([RUN_OVS_VSCTL([br-exists m4_car(brinfo)])], [0], [], [], [OVS_VSCTL_CLEANUP])]) AT_CHECK([RUN_OVS_VSCTL([br-exists nonexistent])], [2], [], [], [OVS_VSCTL_CLEANUP]) dnl Check that each bridge has the expected parent and VLAN. m4_map([_CHECK_BRIDGE], [$@])]) dnl CHECK_PORTS(BRIDGE, PORT[, PORT...]) dnl dnl Verifies that "ovs-vsctl list-ports BRIDGE" prints the specified dnl list of ports, which must be in alphabetical order. Also checks dnl that "ovs-vsctl port-to-br" reports that each port is dnl in BRIDGE. m4_define([CHECK_PORTS], [dnl Check ports without --oneline. AT_CHECK( [RUN_OVS_VSCTL([list-ports $1])], [0], [m4_foreach([port], m4_cdr($@), [port ])], [], [OVS_VSCTL_CLEANUP]) dnl Check ports with --oneline. AT_CHECK( [RUN_OVS_VSCTL_ONELINE([list-ports $1])], [0], [m4_join([\n], m4_shift($@)) ], [], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([port-to-br $1])], [1], [], [ovs-vsctl: no port named $1 ], [OVS_VSCTL_CLEANUP]) m4_foreach( [port], m4_cdr($@), [AT_CHECK([RUN_OVS_VSCTL([[port-to-br] port])], [0], [$1 ], [], [OVS_VSCTL_CLEANUP])])]) dnl CHECK_IFACES(BRIDGE, IFACE[, IFACE...]) dnl dnl Verifies that "ovs-vsctl list-ifaces BRIDGE" prints the specified dnl list of ifaces, which must be in alphabetical order. Also checks dnl that "ovs-vsctl iface-to-br" reports that each interface is dnl in BRIDGE. m4_define([CHECK_IFACES], [AT_CHECK( [RUN_OVS_VSCTL([list-ifaces $1])], [0], [m4_foreach([iface], m4_cdr($@), [iface ])], [], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([iface-to-br $1])], [1], [], [ovs-vsctl: no interface named $1 ], [OVS_VSCTL_CLEANUP]) m4_foreach( [iface], m4_cdr($@), [AT_CHECK([RUN_OVS_VSCTL([[iface-to-br] iface])], [0], [$1 ], [], [OVS_VSCTL_CLEANUP])])]) dnl ---------------------------------------------------------------------- AT_BANNER([ovs-vsctl unit tests -- real bridges]) AT_SETUP([add-br a]) AT_KEYWORDS([ovs-vsctl]) OVS_VSCTL_SETUP AT_CHECK([RUN_OVS_VSCTL([add-br a])], [0], [], [], [OVS_VSCTL_CLEANUP]) CHECK_BRIDGES([a, a, 0]) CHECK_PORTS([a]) CHECK_IFACES([a]) OVS_VSCTL_CLEANUP AT_CLEANUP AT_SETUP([add-br a, add-br a]) AT_KEYWORDS([ovs-vsctl]) OVS_VSCTL_SETUP AT_CHECK([RUN_OVS_VSCTL([add-br a])], [0], [], [], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([add-br a])], [1], [], [ovs-vsctl: cannot create a bridge named a because a bridge named a already exists ], [OVS_VSCTL_CLEANUP]) OVS_VSCTL_CLEANUP AT_CLEANUP AT_SETUP([add-br a, add-br b]) AT_KEYWORDS([ovs-vsctl]) OVS_VSCTL_SETUP AT_CHECK([RUN_OVS_VSCTL([add-br a], [add-br b])], [0], [], [], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([--may-exist add-br a b 9])], [1], [], [ovs-vsctl: "--may-exist add-br a b 9" but a is not a VLAN bridge ], [OVS_VSCTL_CLEANUP]) CHECK_BRIDGES([a, a, 0], [b, b, 0]) CHECK_PORTS([a]) CHECK_IFACES([a]) CHECK_PORTS([b]) CHECK_IFACES([b]) OVS_VSCTL_CLEANUP AT_CLEANUP AT_SETUP([add-br a, add-br b, del-br a]) AT_KEYWORDS([ovs-vsctl]) OVS_VSCTL_SETUP AT_CHECK([RUN_OVS_VSCTL([add-br a], [add-br b], [del-br a])], [0], [], [], [OVS_VSCTL_CLEANUP]) CHECK_BRIDGES([b, b, 0]) CHECK_PORTS([b]) CHECK_IFACES([b]) OVS_VSCTL_CLEANUP AT_CLEANUP AT_SETUP([add-br a, del-br a, add-br a]) AT_KEYWORDS([ovs-vsctl]) OVS_VSCTL_SETUP AT_CHECK([RUN_OVS_VSCTL_TOGETHER( [add-br a], [del-br a], [add-br a], [set Interface a other_config:key=value], [get Interface a other_config:key])], [0], [ value ], [], [OVS_VSCTL_CLEANUP]) CHECK_BRIDGES([a, a, 0]) CHECK_PORTS([a]) CHECK_IFACES([a]) OVS_VSCTL_CLEANUP AT_CLEANUP AT_SETUP([add-br a, add-port a a1, add-port a a2]) AT_KEYWORDS([ovs-vsctl]) OVS_VSCTL_SETUP AT_CHECK([RUN_OVS_VSCTL( [add-br a], [--if-exists del-br b], [add-port a a1], [add-port a a2])], [0], [], [], [OVS_VSCTL_CLEANUP]) CHECK_BRIDGES([a, a, 0]) CHECK_PORTS([a], [a1], [a2]) CHECK_IFACES([a], [a1], [a2]) OVS_VSCTL_CLEANUP AT_CLEANUP AT_SETUP([add-br a, add-port a a1, add-port a a1]) AT_KEYWORDS([ovs-vsctl]) OVS_VSCTL_SETUP AT_CHECK([RUN_OVS_VSCTL( [add-br a], [add-port a a1])], [0], [], [], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([add-port a a1])], [1], [], [ovs-vsctl: cannot create a port named a1 because a port named a1 already exists on bridge a ], [OVS_VSCTL_CLEANUP]) OVS_VSCTL_CLEANUP AT_CLEANUP AT_SETUP([add-br a b, add-port a a1, add-port b b1, del-br a]) AT_KEYWORDS([ovs-vsctl]) OVS_VSCTL_SETUP AT_CHECK([RUN_OVS_VSCTL_TOGETHER( [add-br a], [add-br b], [add-port a a1], [add-port b b1], [--if-exists del-port b b2], [del-br a])], [0], [ ], [], [OVS_VSCTL_CLEANUP]) CHECK_BRIDGES([b, b, 0]) CHECK_PORTS([b], [b1]) CHECK_IFACES([b], [b1]) OVS_VSCTL_CLEANUP AT_CLEANUP AT_SETUP([add-br a, add-bond a bond0 a1 a2 a3]) AT_KEYWORDS([ovs-vsctl]) OVS_VSCTL_SETUP AT_CHECK([RUN_OVS_VSCTL( [add-br a], [add-bond a bond0 a1 a2 a3])], [0], [], [], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([--may-exist add-bond a bond0 a3 a1 a2])], [0], [], [], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([--may-exist add-bond a bond0 a2 a1])], [1], [], [ovs-vsctl: "--may-exist add-bond a bond0 a2 a1" but bond0 actually has interface(s) a1, a2, a3 ], [OVS_VSCTL_CLEANUP]) CHECK_BRIDGES([a, a, 0]) CHECK_PORTS([a], [bond0]) CHECK_IFACES([a], [a1], [a2], [a3]) OVS_VSCTL_CLEANUP AT_CLEANUP AT_SETUP([add-br a b, add-port a a1, add-port b b1, del-port a a1]) AT_KEYWORDS([ovs-vsctl]) OVS_VSCTL_SETUP AT_CHECK([RUN_OVS_VSCTL( [add-br a], [add-br b], [add-port a a1 tag=9], [get port a1 tag], [--may-exist add-port b b1], [del-port a a1])], [0], [9 ], [], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([--may-exist add-port b b1])], [0], [], [], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([--may-exist add-port a b1])], [1], [], [ovs-vsctl: "--may-exist add-port a b1" but b1 is actually attached to bridge b ], [OVS_VSCTL_CLEANUP]) CHECK_BRIDGES([a, a, 0], [b, b, 0]) CHECK_PORTS([a]) CHECK_IFACES([a]) CHECK_PORTS([b], [b1]) CHECK_IFACES([b], [b1]) OVS_VSCTL_CLEANUP AT_CLEANUP AT_SETUP([add-br a, add-bond a bond0 a1 a2 a3, del-port bond0]) AT_KEYWORDS([ovs-vsctl]) OVS_VSCTL_SETUP AT_CHECK([RUN_OVS_VSCTL_TOGETHER( [add-br a], [add-bond a bond0 a1 a2 a3 tag=9], [get Port bond0 tag], [del-port bond0])], [0], [ 9 ], [], [OVS_VSCTL_CLEANUP]) CHECK_BRIDGES([a, a, 0]) CHECK_PORTS([a]) OVS_VSCTL_CLEANUP AT_CLEANUP AT_SETUP([external IDs]) AT_KEYWORDS([ovs-vsctl]) OVS_VSCTL_SETUP AT_CHECK([RUN_OVS_VSCTL_ONELINE( [add-br a], [add-port a a1], [add-bond a bond0 a2 a3], [br-set-external-id a key0 value0], [set port a1 external-ids:key1=value1], [set interface a2 external-ids:key2=value2], [set interface a2 external-ids:key3=value3], [set interface a3 external-ids:key4=value4], [br-get-external-id a], [br-get-external-id a key0], [br-get-external-id a key1], [br-set-external-id a key0 othervalue], [br-get-external-id a], [br-set-external-id a key0], [br-get-external-id a], [get port a1 external-ids], [get interface a2 external-ids], [get interface a3 external-ids])], [0], [ key0=value0 value0 key0=othervalue {"key1"="value1"} {"key2"="value2", "key3"="value3"} {"key4"="value4"} ], [], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL_TOGETHER( [br-get-external-id a], [get port a1 external-ids], [get interface a2 external-ids], [get interface a3 external-ids])], [0], [ {"key1"="value1"} {"key2"="value2", "key3"="value3"} {"key4"="value4"} ], [], [OVS_VSCTL_CLEANUP]) CHECK_BRIDGES([a, a, 0]) CHECK_PORTS([a], [a1], [bond0]) CHECK_IFACES([a], [a1], [a2], [a3]) OVS_VSCTL_CLEANUP AT_CLEANUP AT_SETUP([controllers]) AT_KEYWORDS([controller ovs-vsctl]) OVS_VSCTL_SETUP AT_CHECK([RUN_OVS_VSCTL_TOGETHER( [add-br br0], [get-controller br0], [set-controller br0 tcp:4.5.6.7], [get-controller br0], [del-controller br0], [get-controller br0], [set-controller br0 tcp:8.9.10.11 tcp:5.4.3.2], [get-controller br0])], [0], [ tcp:4.5.6.7 tcp:5.4.3.2\ntcp:8.9.10.11 ], [], [OVS_VSCTL_CLEANUP]) OVS_VSCTL_CLEANUP AT_CLEANUP dnl ---------------------------------------------------------------------- dnl OVS_VSCTL_SETUP_SIMPLE_FAKE_CONF([VLAN]) m4_define([OVS_VSCTL_SETUP_SIMPLE_FAKE_CONF], [AT_CHECK( [RUN_OVS_VSCTL( [add-br xenbr0], [--may-exist add-br xenbr0], [add-port xenbr0 eth0], [--may-exist add-port xenbr0 eth0], [add-br xapi1 xenbr0 $1], [--may-exist add-br xapi1 xenbr0 $1], [add-port xapi1 eth0.$1])], [0], [], [], [OVS_VSCTL_CLEANUP])]) dnl OVS_VSCTL_FAKE_BRIDGE_TESTS([VLAN]) m4_define([OVS_VSCTL_FAKE_BRIDGE_TESTS], [ AT_BANNER([ovs-vsctl unit tests -- fake bridges (VLAN $1)]) AT_SETUP([simple fake bridge (VLAN $1)]) AT_KEYWORDS([ovs-vsctl fake-bridge]) OVS_VSCTL_SETUP OVS_VSCTL_SETUP_SIMPLE_FAKE_CONF([$1]) AT_CHECK([RUN_OVS_VSCTL([--may-exist add-br xapi1])], [1], [], [ovs-vsctl: "--may-exist add-br xapi1" but xapi1 is a VLAN bridge for VLAN $1 ], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([--may-exist add-br xapi1 xxx $1])], [1], [], [ovs-vsctl: "--may-exist add-br xapi1 xxx $1" but xapi1 has the wrong parent xenbr0 ], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([--may-exist add-br xapi1 xenbr0 10])], [1], [], [ovs-vsctl: "--may-exist add-br xapi1 xenbr0 10" but xapi1 is a VLAN bridge for the wrong VLAN $1 ], [OVS_VSCTL_CLEANUP]) CHECK_BRIDGES([xapi1, xenbr0, $1], [xenbr0, xenbr0, 0]) CHECK_PORTS([xenbr0], [eth0]) CHECK_IFACES([xenbr0], [eth0]) CHECK_PORTS([xapi1], [eth0.$1]) CHECK_IFACES([xapi1], [eth0.$1]) OVS_VSCTL_CLEANUP AT_CLEANUP AT_SETUP([list bridges -- real and fake (VLAN $1)]) AT_KEYWORDS([ovs-vsctl fake-bridge]) OVS_VSCTL_SETUP OVS_VSCTL_SETUP_SIMPLE_FAKE_CONF([$1]) AT_CHECK([RUN_OVS_VSCTL_ONELINE([-- list-br])], [0], [xapi1\nxenbr0 ], [], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL_ONELINE([-- --real list-br])], [0], [xenbr0 ], [], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL_ONELINE([-- --fake list-br])], [0], [xapi1 ], [], [OVS_VSCTL_CLEANUP]) OVS_VSCTL_CLEANUP AT_CLEANUP AT_SETUP([simple fake bridge + del-br fake bridge (VLAN $1)]) AT_KEYWORDS([ovs-vsctl fake-bridge]) OVS_VSCTL_SETUP OVS_VSCTL_SETUP_SIMPLE_FAKE_CONF([$1]) AT_CHECK([RUN_OVS_VSCTL([del-br xapi1])], [0], [], [], [OVS_VSCTL_CLEANUP]) CHECK_BRIDGES([xenbr0, xenbr0, 0]) CHECK_PORTS([xenbr0], [eth0]) CHECK_IFACES([xenbr0], [eth0]) OVS_VSCTL_CLEANUP AT_CLEANUP AT_SETUP([simple fake bridge + del-br real bridge (VLAN $1)]) AT_KEYWORDS([ovs-vsctl fake-bridge]) OVS_VSCTL_SETUP OVS_VSCTL_SETUP_SIMPLE_FAKE_CONF([$1]) AT_CHECK([RUN_OVS_VSCTL([del-br xenbr0])], [0], [], [], [OVS_VSCTL_CLEANUP]) CHECK_BRIDGES OVS_VSCTL_CLEANUP AT_CLEANUP AT_SETUP([simple fake bridge + external IDs (VLAN $1)]) AT_KEYWORDS([ovs-vsctl fake-bridge]) OVS_VSCTL_SETUP OVS_VSCTL_SETUP_SIMPLE_FAKE_CONF([$1]) AT_CHECK([RUN_OVS_VSCTL_TOGETHER( [br-set-external-id xenbr0 key0 value0], [br-set-external-id xapi1 key1 value1], [br-get-external-id xenbr0], [br-get-external-id xenbr0 key0], [br-get-external-id xapi1], [br-get-external-id xapi1 key1])], [0], [ key0=value0 value0 key1=value1 value1 ], [], [OVS_VSCTL_CLEANUP]) CHECK_BRIDGES([xapi1, xenbr0, $1], [xenbr0, xenbr0, 0]) CHECK_PORTS([xenbr0], [eth0]) CHECK_IFACES([xenbr0], [eth0]) CHECK_PORTS([xapi1], [eth0.$1]) CHECK_IFACES([xapi1], [eth0.$1]) OVS_VSCTL_CLEANUP AT_CLEANUP ]) # OVS_VSCTL_FAKE_BRIDGE_TESTS OVS_VSCTL_FAKE_BRIDGE_TESTS([9]) OVS_VSCTL_FAKE_BRIDGE_TESTS([0]) dnl OVS_VSCTL_SETUP_BOND_FAKE_CONF([VLAN]) m4_define([OVS_VSCTL_SETUP_BOND_FAKE_CONF], [AT_CHECK( [RUN_OVS_VSCTL( [add-br xapi1], [add-bond xapi1 bond0 eth0 eth1], [add-br xapi2 xapi1 $1], [add-port xapi2 bond0.$1])], [0], [], [], [OVS_VSCTL_CLEANUP])]) AT_SETUP([fake bridge on bond]) AT_KEYWORDS([ovs-vsctl fake-bridge]) OVS_VSCTL_SETUP OVS_VSCTL_SETUP_BOND_FAKE_CONF([11]) CHECK_BRIDGES([xapi1, xapi1, 0], [xapi2, xapi1, 11]) CHECK_PORTS([xapi1], [bond0]) CHECK_IFACES([xapi1], [eth0], [eth1]) CHECK_PORTS([xapi2], [bond0.11]) CHECK_IFACES([xapi2], [bond0.11]) OVS_VSCTL_CLEANUP AT_CLEANUP AT_SETUP([fake bridge on bond + del-br fake bridge]) AT_KEYWORDS([ovs-vsctl fake-bridge]) OVS_VSCTL_SETUP OVS_VSCTL_SETUP_BOND_FAKE_CONF([11]) AT_CHECK([RUN_OVS_VSCTL_ONELINE([del-br xapi2])], [0], [ ], [], [OVS_VSCTL_CLEANUP]) CHECK_BRIDGES([xapi1, xapi1, 0]) CHECK_PORTS([xapi1], [bond0]) CHECK_IFACES([xapi1], [eth0], [eth1]) OVS_VSCTL_CLEANUP AT_CLEANUP AT_SETUP([fake bridge on bond + del-br real bridge]) AT_KEYWORDS([ovs-vsctl fake-bridge]) OVS_VSCTL_SETUP OVS_VSCTL_SETUP_BOND_FAKE_CONF([11]) AT_CHECK([RUN_OVS_VSCTL([del-br xapi1])]) CHECK_BRIDGES OVS_VSCTL_CLEANUP AT_CLEANUP dnl ---------------------------------------------------------------------- AT_BANNER([ovs-vsctl unit tests -- manager commands]) AT_SETUP([managers]) AT_KEYWORDS([manager ovs-vsctl]) OVS_VSCTL_SETUP AT_CHECK([RUN_OVS_VSCTL_TOGETHER( [del-manager], [get-manager], [set-manager tcp:4.5.6.7], [get-manager], [set-manager tcp:8.9.10.11 tcp:5.4.3.2], [get-manager], [del-manager], [get-manager])], [0], [ tcp:4.5.6.7 tcp:5.4.3.2\ntcp:8.9.10.11 ], [], [OVS_VSCTL_CLEANUP]) OVS_VSCTL_CLEANUP AT_CLEANUP dnl ---------------------------------------------------------------------- AT_BANNER([ovs-vsctl unit tests -- database commands]) AT_SETUP([database commands -- positive checks]) AT_KEYWORDS([ovs-vsctl]) OVS_VSCTL_SETUP AT_CHECK( [RUN_OVS_VSCTL_TOGETHER([--id=@br0 create b name=br0], [set o . bridges=@br0])], [0], [stdout], [], [OVS_VSCTL_CLEANUP]) cp stdout out1 AT_CHECK([RUN_OVS_VSCTL([list b], [get b br0 _uuid])], [0], [stdout], [], [OVS_VSCTL_CLEANUP]) cp stdout out2 AT_CHECK([perl $srcdir/uuidfilt.pl out1 out2], [0], [[<0> _uuid : <0> controller : [] datapath_id : [] datapath_type : "" external_ids : {} fail_mode : [] flood_vlans : [] flow_tables : {} mirrors : [] name : "br0" netflow : [] other_config : {} ports : [] protocols : [] sflow : [] status : {} stp_enable : false <0> ]], [ignore], [test ! -e pid || kill `cat pid`]) AT_CHECK( [RUN_OVS_VSCTL([--columns=fail_mode,name,datapath_type list b])], [0], [[fail_mode : [] name : "br0" datapath_type : "" ]], [ignore], [test ! -e pid || kill `cat pid`]) AT_CHECK( [RUN_OVS_VSCTL([--columns=fail_mode,name,datapath_type find b])], [0], [[fail_mode : [] name : "br0" datapath_type : "" ]], [ignore], [test ! -e pid || kill `cat pid`]) AT_CHECK([ RUN_OVS_VSCTL_TOGETHER([--id=@br1 create b name=br1 datapath_type="foo"], [--id=@br2 create b name=br2 external-ids:bar=quux], [add o . bridges @br1 @br2])], [0], [stdout], [], [OVS_VSCTL_CLEANUP]) AT_CHECK( [RUN_OVS_VSCTL([--columns=name find b datapath_type!=foo])], [0], [stdout], [ignore], [test ! -e pid || kill `cat pid`]) AT_CHECK([sed -n '/./p' stdout | sort], [0], [[name : "br0" name : "br2" ]]) AT_CHECK( [RUN_OVS_VSCTL( [set bridge br0 \ 'other_config:datapath_id="0123456789ab"' \ 'other_config:hwaddr="00:11:22:33:44:55"' \ 'external-ids={"uuids"="9c45f225-a7cf-439d-976d-83db6271fda1"}' -- \ add bridge br0 external_ids '"roles"="local; remote; cloud"'])], [0], [], [], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL_ONELINE([get bridge br0 other_config external-ids])], [0], [{datapath_id="0123456789ab", hwaddr="00:11:22:33:44:55"}\n{roles="local; remote; cloud", uuids="9c45f225-a7cf-439d-976d-83db6271fda1"} ], [], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([get bridge br0 other_config:hwaddr -- --if-exists get bridge br0 other-config:nonexistent])], [0], ["00:11:22:33:44:55" ], [], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([remove br br0 other_config hwaddr 'datapath_id=""' -- get br br0 other_config])], [0], [{datapath_id="0123456789ab"} ], [], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([remove br br0 other_config 'datapath_id="0123456789ab"' -- get br br0 other_config])], [0], [{} ], [], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([clear br br0 external-ids -- get br br0 external_ids])], [0], [{} ], [], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL_TOGETHER([destroy b br0], [destroy b br1], [destroy b br2], [clear o . bridges])], [0], [stdout], [], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([list b])], [0], [], [], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([--if-exists get b x datapath_id])], [0], [], [], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([--if-exists list b x])], [0], [], [], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([--if-exists set controller x connection_mode=standalone])], [0], [], [], [OVS_VSCTL_CLEANUP]) AT_CHECK( [RUN_OVS_VSCTL([--if-exists remove netflow x targets '"1.2.3.4:567"'])], [0], [], [], [OVS_VSCTL_CLEANUP]) AT_CHECK( [RUN_OVS_VSCTL([--if-exists clear netflow x targets])], [0], [], [], [OVS_VSCTL_CLEANUP]) OVS_VSCTL_CLEANUP AT_CLEANUP AT_SETUP([database commands -- negative checks]) AT_KEYWORDS([ovs-vsctl]) OVS_VSCTL_SETUP AT_CHECK([ovs-vsctl --may-exist], [1], [ignore], [ovs-vsctl: missing command name (use --help for help) ], [OVS_VSCTL_CLEANUP]) AT_CHECK([ovs-vsctl --may-exist --], [1], [ignore], [ovs-vsctl: missing command name (use --help for help) ], [OVS_VSCTL_CLEANUP]) AT_CHECK([ovs-vsctl -- --may-exist], [1], [ignore], [ovs-vsctl: missing command name (use --help for help) ], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([add-br br0])], [0], [ignore], [], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([add-br br1])], [0], [ignore], [], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([set-controller br1 tcp:127.0.0.1])], [0], [ignore], [], [OVS_VSCTL_CLEANUP]) AT_CHECK([ RUN_OVS_VSCTL_TOGETHER([--id=@n create netflow targets='"1.2.3.4:567"'], [set bridge br0 netflow=@n])], [0], [stdout], [], [OVS_VSCTL_CLEANUP]) cp stdout netflow-uuid AT_CHECK([RUN_OVS_VSCTL([list netflow `cat netflow-uuid`])], [0], [stdout], [], [OVS_VSCTL_CLEANUP]) AT_CHECK([perl $srcdir/uuidfilt.pl netflow-uuid stdout], [0], [[<0> _uuid : <0> active_timeout : 0 add_id_to_interface : false engine_id : [] engine_type : [] external_ids : {} targets : ["1.2.3.4:567"] ]], [ignore], [test ! -e pid || kill `cat pid`]) AT_CHECK([RUN_OVS_VSCTL([list interx x])], [1], [], [ovs-vsctl: unknown table "interx" ], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([list b x])], [1], [], [ovs-vsctl: no row "x" in table Bridge ], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([get b x datapath_id])], [1], [], [ovs-vsctl: no row "x" in table Bridge ], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([get b br0 d])], [1], [], [ovs-vsctl: Bridge contains more than one column whose name matches "d" ], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([get b br0 x])], [1], [], [ovs-vsctl: Bridge does not contain a column whose name matches "x" ], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([get b br0 :y=z])], [1], [], [ovs-vsctl: :y=z: missing column name ], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([get b br0 datapath_id:y=z])], [1], [], [ovs-vsctl: datapath_id:y=z: trailing garbage "=z" in argument ], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([set b br0 'datapath_id:y>=z'])], [1], [], [ovs-vsctl: datapath_id:y>=z: argument does not end in "=" followed by a value. ], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([set controller x connection_mode=standalone])], [1], [], [ovs-vsctl: no row "x" in table Controller ], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([wait-until b br0 datapath_id:y,z])], [1], [], [ovs-vsctl: datapath_id:y,z: argument does not end in "=", "!=", "<", ">", "<=", ">=", "{=}", "{!=}", "{<}", "{>}", "{<=}", or "{>=}" followed by a value. ], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([get b br0 datapath_id::])], [1], [], [ovs-vsctl: datapath_id::: trailing garbage ":" in argument ], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([get b br0 datapath_id:x])], [1], [], [ovs-vsctl: cannot specify key to get for non-map column datapath_id ], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([get b br0 external_ids:x])], [1], [], [ovs-vsctl: no key "x" in Bridge record "br0" column external_ids ], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([set b br0 flood_vlans=-1])], [1], [], [ovs-vsctl: constraint violation: -1 is not in the valid range 0 to 4095 (inclusive) ], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([set b br0 flood_vlans=4096])], [1], [], [ovs-vsctl: constraint violation: 4096 is not in the valid range 0 to 4095 (inclusive) ], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([set c br1 'connection-mode=xyz'])], [1], [], [[ovs-vsctl: constraint violation: xyz is not one of the allowed values ([in-band, out-of-band]) ]], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([set c br1 connection-mode:x=y])], [1], [], [ovs-vsctl: cannot specify key to set for non-map column connection_mode ], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([add b br1 datapath_id x y])], [1], [], [ovs-vsctl: "add" operation would put 2 values in column datapath_id of table Bridge but the maximum number is 1 ], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([remove netflow `cat netflow-uuid` targets '"1.2.3.4:567"'])], [1], [], [ovs-vsctl: "remove" operation would put 0 values in column targets of table NetFlow but the minimum number is 1 ], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([remove netflow x targets '"1.2.3.4:567"'])], [1], [], [ovs-vsctl: no row "x" in table NetFlow ], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([clear netflow x targets])], [1], [], [ovs-vsctl: no row "x" in table NetFlow ], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([clear netflow `cat netflow-uuid` targets])], [1], [], [ovs-vsctl: "clear" operation cannot be applied to column targets of table NetFlow, which is not allowed to be empty ], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([destroy b br2])], [1], [], [ovs-vsctl: no row "br2" in table Bridge ], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([add i br1 name x])], [1], [], [ovs-vsctl: cannot modify read-only column name in table Interface ], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([set port br1 name br2])], [1], [], [ovs-vsctl: cannot modify read-only column name in table Port ], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([remove b br1 name br1])], [1], [], [ovs-vsctl: cannot modify read-only column name in table Bridge ], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([clear b br1 name])], [1], [], [ovs-vsctl: cannot modify read-only column name in table Bridge ], [OVS_VSCTL_CLEANUP]) OVS_VSCTL_CLEANUP AT_CLEANUP AT_SETUP([database commands -- conditions]) AT_KEYWORDS([ovs-vsctl]) ON_EXIT([kill `cat pid`]) OVS_VSCTL_SETUP AT_CHECK( [RUN_OVS_VSCTL_TOGETHER( [add-br br0], [add-br br1], [set bridge br1 flood_vlans=0 other-config:x='""'], [add-br br2], [set bridge br2 flood_vlans=1 other-config:x=y], [add-br br3], [set bridge br3 flood_vlans=0,1 other-config:x=z], [add-br br4], [set bridge br4 flood_vlans=2], [add-br br5], [set bridge br5 flood_vlans=0,2], [add-br br6], [set bridge br6 flood_vlans=1,2], [add-br br7], [set bridge br7 flood_vlans=0,1,2])], [0], [ ]) m4_define([VSCTL_CHECK_FIND], [AT_CHECK([echo `ovs-vsctl --bare --timeout=5 --no-wait -vreconnect:emer --db=unix:socket -- --columns=name find bridge '$1' | sort`], [0], [$2 ])]) # Arithmetic relational operators without keys. VSCTL_CHECK_FIND([flood_vlans=0], [br1]) VSCTL_CHECK_FIND([flood_vlans=1], [br2]) VSCTL_CHECK_FIND([flood_vlans=0,2], [br5]) VSCTL_CHECK_FIND([flood_vlans=0,1,2], [br7]) VSCTL_CHECK_FIND([flood_vlans=3], []) VSCTL_CHECK_FIND([flood_vlans!=0], [br0 br2 br3 br4 br5 br6 br7]) VSCTL_CHECK_FIND([flood_vlans!=1], [br0 br1 br3 br4 br5 br6 br7]) VSCTL_CHECK_FIND([flood_vlans!=0,2], [br0 br1 br2 br3 br4 br6 br7]) VSCTL_CHECK_FIND([flood_vlans!=0,1,2], [br0 br1 br2 br3 br4 br5 br6]) VSCTL_CHECK_FIND([flood_vlans!=3], [br0 br1 br2 br3 br4 br5 br6 br7]) VSCTL_CHECK_FIND([flood_vlans<2], [br0 br1 br2]) VSCTL_CHECK_FIND([flood_vlans<0,2], [br0 br1 br2 br3 br4]) VSCTL_CHECK_FIND([flood_vlans>1], [br3 br4 br5 br6 br7]) VSCTL_CHECK_FIND([flood_vlans>0,1], [br5 br6 br7]) VSCTL_CHECK_FIND([flood_vlans<=2], [br0 br1 br2 br4]) VSCTL_CHECK_FIND([flood_vlans<=0,2], [br0 br1 br2 br3 br4 br5]) VSCTL_CHECK_FIND([flood_vlans>=1], [br2 br3 br4 br5 br6 br7]) VSCTL_CHECK_FIND([flood_vlans>=0,1], [br3 br5 br6 br7]) # Set relational operators without keys. VSCTL_CHECK_FIND([flood_vlans{=}0], [br1]) VSCTL_CHECK_FIND([flood_vlans{=}1], [br2]) VSCTL_CHECK_FIND([flood_vlans{=}0,2], [br5]) VSCTL_CHECK_FIND([flood_vlans{=}0,1,2], [br7]) VSCTL_CHECK_FIND([flood_vlans{=}3], []) VSCTL_CHECK_FIND([flood_vlans{!=}0], [br0 br2 br3 br4 br5 br6 br7]) VSCTL_CHECK_FIND([flood_vlans{!=}1], [br0 br1 br3 br4 br5 br6 br7]) VSCTL_CHECK_FIND([flood_vlans{!=}0,2], [br0 br1 br2 br3 br4 br6 br7]) VSCTL_CHECK_FIND([flood_vlans{!=}0,1,2], [br0 br1 br2 br3 br4 br5 br6]) VSCTL_CHECK_FIND([flood_vlans{!=}3], [br0 br1 br2 br3 br4 br5 br6 br7]) VSCTL_CHECK_FIND([flood_vlans{<}[[]]], []) VSCTL_CHECK_FIND([flood_vlans{<=}[[]]], [br0]) VSCTL_CHECK_FIND([flood_vlans{<}0], [br0]) VSCTL_CHECK_FIND([flood_vlans{<=}0], [br0 br1]) VSCTL_CHECK_FIND([flood_vlans{<}1,2], [br0 br2 br4]) VSCTL_CHECK_FIND([flood_vlans{<=}1,2], [br0 br2 br4 br6]) VSCTL_CHECK_FIND([flood_vlans{>}[[]]], [br1 br2 br3 br4 br5 br6 br7]) VSCTL_CHECK_FIND([flood_vlans{>=}[[]]], [br0 br1 br2 br3 br4 br5 br6 br7]) VSCTL_CHECK_FIND([flood_vlans{>}0], [br3 br5 br7]) VSCTL_CHECK_FIND([flood_vlans{>=}0], [br1 br3 br5 br7]) VSCTL_CHECK_FIND([flood_vlans{>}0,2], [br7]) VSCTL_CHECK_FIND([flood_vlans{>=}1,2], [br6 br7]) VSCTL_CHECK_FIND([flood_vlans{>=}0,2], [br5 br7]) # Arithmetic relational operators with keys. VSCTL_CHECK_FIND([other-config:x=""], [br1]) VSCTL_CHECK_FIND([other-config:x=y], [br2]) VSCTL_CHECK_FIND([other-config:x=z], [br3]) VSCTL_CHECK_FIND([other-config:x!=""], [br2 br3]) VSCTL_CHECK_FIND([other-config:x!=y], [br1 br3]) VSCTL_CHECK_FIND([other-config:x!=z], [br1 br2]) VSCTL_CHECK_FIND([other-config:x>y], [br3]) VSCTL_CHECK_FIND([other-config:x>=y], [br2 br3]) VSCTL_CHECK_FIND([other-config:x=}[[]]], [br0 br1 br2 br3 br4 br5 br6 br7]) VSCTL_CHECK_FIND([other-config:x{>=}x], []) VSCTL_CHECK_FIND([other-config:x{>=}""], [br1]) VSCTL_CHECK_FIND([other-config:x{>=}y], [br2]) VSCTL_CHECK_FIND([other-config:x{>=}z], [br3]) VSCTL_CHECK_FIND([other-config:x{>}[[]]], [br1 br2 br3]) VSCTL_CHECK_FIND([other-config:x{>}x], []) VSCTL_CHECK_FIND([other-config:x{>}""], []) VSCTL_CHECK_FIND([other-config:x{>}y], []) VSCTL_CHECK_FIND([other-config:x{>}z], []) OVS_VSCTL_CLEANUP AT_CLEANUP AT_SETUP([database commands -- wait-until immediately true]) AT_KEYWORDS([ovs-vsctl]) OVS_VSCTL_SETUP AT_CHECK([RUN_OVS_VSCTL( [add-br br0], [add-bond br0 bond0 eth0 eth1], [set port bond0 bond_updelay=500 other-config:abc=def])], [0], [], [], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([[wait-until Open_vSwitch . manager_options=[]]])], [0], [], [], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([[wait-until Open_vSwitch . bridges!=[]]])], [0], [], [], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([[wait-until Port bond0 other-config:abc=def]])], [0], [], [], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([[wait-until port bond0 'bond_updelay>50' 'other-config:abc>d' 'other-config:abc stdout1 & (RUN_OVS_VSCTL([[wait-until bridge br1 -- get bridge br1 other-config:abc]])) > stdout2 & (RUN_OVS_VSCTL([[wait-until b br1 other-config={abc=def} -- get bridge br1 other-config]])) > stdout3 & (RUN_OVS_VSCTL([[wait-until port bond0 'bond_updelay>50' -- get port bond0 bond-updelay]])) > stdout4 & # Give the ovs-vsctls a chance to read the database sleep 1 AT_CHECK([RUN_OVS_VSCTL([add-br br10 -- set bridge br10 other-config:abc=quux]) 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])], [0], [], [], [OVS_VSCTL_CLEANUP]) # Wait for the ovs-vsctls to finish. wait # Check output AT_CHECK([cat stdout1], [0], [quux ], [], [OVS_VSCTL_CLEANUP]) AT_CHECK([cat stdout2], [0], [def ], [], [OVS_VSCTL_CLEANUP]) AT_CHECK([cat stdout3], [0], [{abc=def} ], [], [OVS_VSCTL_CLEANUP]) AT_CHECK([cat stdout4], [0], [500 ], [], [OVS_VSCTL_CLEANUP]) OVS_VSCTL_CLEANUP AT_CLEANUP AT_SETUP([--id option on create, get commands]) AT_KEYWORDS([ovs-vsctl]) OVS_VSCTL_SETUP AT_CHECK([RUN_OVS_VSCTL([add-br br0], [add-port br0 eth0], [add-port br0 eth1])]) AT_CHECK( [RUN_OVS_VSCTL_TOGETHER( [set bridge br0 mirrors=@m], [--id=@eth0 get port eth0], [--id=@eth1 get port eth1], [--id=@m create mirror name=mymirror select-dst-port=@eth0 select-src-port=@eth0 output-port=@eth1])], [0], [stdout], [], [OVS_VSCTL_CLEANUP]) AT_CHECK( [perl $srcdir/uuidfilt.pl stdout], [0], [dnl <0> ], [], [OVS_VSCTL_CLEANUP]) AT_CHECK( [RUN_OVS_VSCTL( [list port eth0 eth1], [list mirror], [list bridge br0])], [0], [stdout], [], [OVS_VSCTL_CLEANUP]) AT_CHECK( [sed -n -e '/uuid/p' -e '/name/p' -e '/mirrors/p' -e '/select/p' -e '/output/p' < stdout | $srcdir/uuidfilt.pl], [0], [dnl [_uuid : <0> name : "eth0" _uuid : <1> name : "eth1" _uuid : <2> name : mymirror output_port : <1> output_vlan : [] select_all : false select_dst_port : [<0>] select_src_port : [<0>] select_vlan : [] _uuid : <3> mirrors : [<2>] name : "br0" ]], [], [OVS_VSCTL_CLEANUP]) OVS_VSCTL_CLEANUP AT_CLEANUP AT_SETUP([unreferenced record warnings]) AT_KEYWORDS([ovs-vsctl]) OVS_VSCTL_SETUP AT_CHECK( [ovs-vsctl -vPATTERN:console:'%c|%p|%m' --timeout=5 --no-wait -vreconnect:emer --db=unix:socket \ -- create Bridge name=br0 | $srcdir/uuidfilt.pl], [0], [<0> ], [vsctl|WARN|applying "create" command to table Bridge without --id option will have no effect ], [OVS_VSCTL_CLEANUP]) AT_CHECK( [ovs-vsctl -vPATTERN:console:'%c|%p|%m' --timeout=5 --no-wait -vreconnect:emer --db=unix:socket \ -- --id=@br0 create Bridge name=br0 | $srcdir/uuidfilt.pl], [0], [<0> ], [vsctl|WARN|row id "@br0" was created but no reference to it was inserted, so it will not actually appear in the database ], [OVS_VSCTL_CLEANUP]) AT_CHECK( [ovs-vsctl -vPATTERN:console:'%c|%p|%m' --timeout=5 --no-wait -vreconnect:emer --db=unix:socket \ -- --id=@eth0_iface create Interface name=eth0 \ -- --id=@eth0 create Port name=eth0 interfaces=@eth0_iface \ -- --id=@m0 create Mirror name=m0 output_port=@eth0 \ -- --id=@br0 create Bridge name=br0 mirrors=@m0 \ -- set Open_vSwitch . bridges=@br0 | $srcdir/uuidfilt.pl], [0], [<0> <1> <2> <3> ], [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 ], [OVS_VSCTL_CLEANUP]) OVS_VSCTL_CLEANUP AT_CLEANUP dnl This test really shows a bug -- "create" followed by "list" in dnl the same execution shows the wrong UUID on the "list" command. dnl The bug is documented in ovs-vsctl.8. AT_SETUP([created row UUID is wrong in same execution]) AT_KEYWORDS([ovs-vsctl]) OVS_VSCTL_SETUP AT_CHECK([RUN_OVS_VSCTL([--id=@br0 create Bridge name=br0 -- add Open_vSwitch . bridges @br0 -- list b])], [0], [stdout], [], [OVS_VSCTL_CLEANUP]) AT_CHECK([perl $srcdir/uuidfilt.pl stdout], [0], [[<0> _uuid : <1> controller : [] datapath_id : [] datapath_type : "" external_ids : {} fail_mode : [] flood_vlans : [] flow_tables : {} mirrors : [] name : "br0" netflow : [] other_config : {} ports : [] protocols : [] sflow : [] status : {} stp_enable : false ]], [ignore], [test ! -e pid || kill `cat pid`]) OVS_VSCTL_CLEANUP AT_CLEANUP dnl This test will create a linux-htb QoS record that dnl points to a few queues and use it on a1 and a2 port. dnl It also destroys all records from Qos and Queue table. AT_SETUP([--all option on destroy command]) AT_KEYWORDS([ovs-vsctl]) OVS_VSCTL_SETUP AT_CHECK([RUN_OVS_VSCTL( [add-br a], [add-port a a1], [add-port a a2])], [0], [], [], [OVS_VSCTL_CLEANUP]) CHECK_BRIDGES([a, a, 0]) CHECK_PORTS([a], [a1], [a2]) CHECK_IFACES([a], [a1], [a2]) AT_CHECK([RUN_OVS_VSCTL_TOGETHER( [set Port a1 qos=@newqos], [set Port a2 qos=@newqos], [--id=@newqos create QoS type=linux-htb other-config:max-rate=1000000000 queues=0=@q0,1=@q1], [--id=@q0 create Queue other-config:min-rate=100000000 other-config:max-rate=100000000], [--id=@q1 create Queue other-config:min-rate=500000000])], [0], [ignore], [], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL( [--columns=other_config,type list Qos])], [0], [other_config : {max-rate="1000000000"} type : linux-htb ], [], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL( [--columns=other_config list Queue | sort | xargs echo])], [0], [other_config : {max-rate=100000000, min-rate=100000000} other_config : {min-rate=500000000} ], [], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL( [clear Port a1 qos], [clear Port a2 qos])], [0], [], [], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL( [--columns=qos list Port a1 a2])], [0], [[qos : [] qos : [] ]], [], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL( [--all destroy Qos])], [0], [], [], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL( [-- list Qos])], [0], [], [], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL( [--all destroy Queue])], [0], [], [], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL( [-- list Queue])], [0], [], [], [OVS_VSCTL_CLEANUP]) OVS_VSCTL_CLEANUP AT_CLEANUP