2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

system-traffic: Add a bonding test case.

Add a test case to check connectivity over an OVS bond, using a
Linux bond over veth interfaces.

Also added a new macro "ADD_VETH_BOND", modeled after "ADD_VETH",
in anticipation of future additional bonding test cases.

Signed-off-by: Lance Richardson <lrichard@redhat.com>
Signed-off-by: Joe Stringer <joe@ovn.org>
This commit is contained in:
Lance Richardson
2016-08-30 16:45:27 -04:00
committed by Joe Stringer
parent 7c20fb260e
commit ddb5f937ca
2 changed files with 62 additions and 0 deletions

View File

@@ -88,6 +88,43 @@ m4_define([ADD_VETH],
]
)
# ADD_VETH_BOND([ports], [namespace], [ovs-br], [bond], [mode], [ip_addr])
#
# Add a set of veth port pairs. Ports named in the list 'ports' will be added
# to 'namespace', and the corresponding port names, prefixed by 'ovs-' will
# be included in an OVS bond 'bond' which is added to bridge 'ovs-br'.
#
# The 'bond' in 'namespace' will be brought up with static IP address
# with 'ip_addr' in CIDR notation.
#
m4_define([ADD_VETH_BOND],
[
BONDPORTS=""
for port in $1; do
AT_CHECK([ip link add $port type veth peer name ovs-$port])
CONFIGURE_VETH_OFFLOADS([$port])
AT_CHECK([ip link set $port netns $2])
AT_CHECK([ip link set dev ovs-$port up])
BONDPORTS="$BONDPORTS ovs-$port"
on_exit 'ip link del ovs-$port'
done
NS_CHECK_EXEC([$2], [ip link add name $4 type bond])
case "$(echo $5 | sed 's/.*lacp=//' | sed 's/ .*//')" in
active|passive)
NS_CHECK_EXEC([$2], [sh -c "echo 802.3ad > /sys/class/net/$4/bonding/mode"])
NS_CHECK_EXEC([$2], [sh -c "echo 100 > /sys/class/net/$4/bonding/miimon"])
;;
esac
for port in $1; do
NS_CHECK_EXEC([$2], [ip link set dev $port master $4])
done
NS_CHECK_EXEC([$2], [ip addr add $6 dev $4])
NS_CHECK_EXEC([$2], [ip link set dev $4 up])
AT_CHECK([ovs-vsctl add-bond $3 ovs-$4 $BONDPORTS $5])
on_exit 'ip link del ovs-$4'
]
)
# ADD_VLAN([port], [namespace], [vlan-id], [ip-addr])
#
# Add a VLAN device named 'port' within 'namespace'. It will be configured

View File

@@ -128,6 +128,31 @@ NS_CHECK_EXEC([at_ns0], [ping6 -s 3200 -q -c 3 -i 0.3 -w 2 fc00:1::2 | FORMAT_PI
OVS_TRAFFIC_VSWITCHD_STOP
AT_CLEANUP
AT_SETUP([datapath - ping over bond])
OVS_TRAFFIC_VSWITCHD_START()
AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"])
ADD_NAMESPACES(at_ns0, at_ns1)
ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24")
ADD_VETH_BOND(p1 p2, at_ns1, br0, bond0, lacp=active bond_mode=balance-tcp, "10.1.1.2/24")
OVS_WAIT_UNTIL([ip netns exec at_ns0 ping -c 1 10.1.1.2])
NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.1.1.2 | FORMAT_PING], [0], [dnl
3 packets transmitted, 3 received, 0% packet loss, time 0ms
])
NS_CHECK_EXEC([at_ns0], [ping -s 1600 -q -c 3 -i 0.3 -w 2 10.1.1.2 | FORMAT_PING], [0], [dnl
3 packets transmitted, 3 received, 0% packet loss, time 0ms
])
NS_CHECK_EXEC([at_ns0], [ping -s 3200 -q -c 3 -i 0.3 -w 2 10.1.1.2 | FORMAT_PING], [0], [dnl
3 packets transmitted, 3 received, 0% packet loss, time 0ms
])
OVS_TRAFFIC_VSWITCHD_STOP
AT_CLEANUP
AT_SETUP([datapath - ping over vxlan tunnel])
OVS_CHECK_VXLAN()