[ovs-dev] [PATCH 3/3] tests: Add basic vxlan tunnel sanity test.

Joe Stringer joestringer at nicira.com
Fri Jul 31 00:31:04 UTC 2015


On 30 July 2015 at 12:02, Andy Zhou <azhou at nicira.com> wrote:
> On Wed, Jul 29, 2015 at 4:52 PM, Joe Stringer <joestringer at nicira.com> wrote:
>> Signed-off-by: Joe Stringer <joestringer at nicira.com>
>> ---
>>  tests/kmod-macros.at  | 20 ++++++++++++++++++++
>>  tests/kmod-traffic.at | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
>>  2 files changed, 69 insertions(+)
>>
>> diff --git a/tests/kmod-macros.at b/tests/kmod-macros.at
>> index 3487c67..be3c123 100644
>> --- a/tests/kmod-macros.at
>> +++ b/tests/kmod-macros.at
>> @@ -87,3 +87,23 @@ m4_define([ADD_VLAN],
>>        AT_CHECK([ip netns exec $2 ip addr add dev $1.$3 $4])
>>      ]
>>  )
>> +
>> +# ADD_NATIVE_TUNNEL([type], [port], [namespace], [local-addr], [remote-addr],
>> +#                   [overlay-addr], [link-args])
>> +#
>> +# Add a native tunnel device within 'namespace', with name 'port' and type
>> +# 'type'. The tunnel device will be configured as point-to-point with the
>> +# 'local-addr' address configured as the underlay address within 'namespace',
>> +# and 'remote-addr' as the underlay address of the remote destination (as
>> +# viewed from the perspective of that namespace).
>> +#
>> +# 'port' will be configured with the address 'overlay-addr'. 'link-args' is
>> +# made available so that additional arguments can be passed to "ip link",
>> +# for instance to configure the vxlan destination port.
>> +m4_define([ADD_NATIVE_TUNNEL],
>> +    [ AT_CHECK([ip netns exec $3 ip link add dev $2 type $1 local $4 remote $5 $7])
>> +      AT_CHECK([ip netns exec $3 ip addr add dev $2 $6])
>> +      AT_CHECK([ip netns exec $3 ip link set dev $2 up])
>> +      AT_CHECK([ip netns exec $3 ip link set dev $2 mtu 1450])
>> +    ]
>> +)
>> diff --git a/tests/kmod-traffic.at b/tests/kmod-traffic.at
>> index 9df8b62..169078d 100644
>> --- a/tests/kmod-traffic.at
>> +++ b/tests/kmod-traffic.at
>> @@ -105,3 +105,52 @@ AT_CHECK([cat ping.output | grep "transmitted" | sed 's/time.*ms$/time 0ms/'], [
>>
>>  OVS_KMOD_VSWITCHD_STOP
>>  AT_CLEANUP
>> +
>> +AT_SETUP([kmod - ping over vxlan tunnel])
>> +AT_SKIP_IF([! ip link help 2>&1 | grep vxlan >/dev/null])
>> +
>> +OVS_KMOD_VSWITCHD_START(
>> +   [set-fail-mode br0 standalone --])
>> +dnl Ensure that vport_* can be removed on exit.
>> +ON_EXIT([modprobe -r vport_vxlan])
>> +ON_EXIT([ovs-dpctl del-dp ovs-system])
>> +
>> +ADD_NAMESPACES(at_ns0)
>> +
>> +dnl Set up underlay link from host into the namespace using veth pair.
>> +AT_CHECK([ip link add p0 type veth peer name host-p0])
>> +AT_CHECK([ip addr add dev host-p0 "172.31.1.100/24"])
>> +AT_CHECK([ip link set dev host-p0 up])
>> +AT_CHECK([ip link set p0 netns at_ns0])
>> +AT_CHECK([ip netns exec at_ns0 ip addr add dev p0 "172.31.1.1/24"])
>> +AT_CHECK([ip netns exec at_ns0 ip link set dev p0 up])
>> +
>> +dnl Set up remote end of tunnel inside the namespace.
>> +ADD_NATIVE_TUNNEL([vxlan], [at_vxlan1], [at_ns0], [172.31.1.1], [172.31.1.100],
>> +    [10.1.1.1/24], [id 0 dstport 4789])
>> +
>> +dnl Set up local end of tunnel in default namespace.
>> +AT_CHECK([ovs-vsctl add-port br0 vxlan0 -- \
>> +    set int vxlan0 type=vxlan options:remote_ip=172.31.1.1])
>> +AT_CHECK([ip addr add dev br0 10.1.1.100/24])
>> +AT_CHECK([ip link set dev br0 up])
>> +AT_CHECK([ip link set dev br0 mtu 1450])
>> +
>> +AT_CAPTURE_FILE([ping.output])
>> +dnl First, check the underlay
>> +AT_CHECK([ip netns exec at_ns0 bash -c "ping -q -c 3 -i 0.3 -w 2 172.31.1.100 > ping.output"])
>> +
>> +dnl Okay, now check the overlay with different packet sizes
>> +AT_CHECK([ip netns exec at_ns0 bash -c "ping -q -c 3 -i 0.3 -w 2 10.1.1.100 >> ping.output"])
>> +AT_CHECK([ip netns exec at_ns0 bash -c "ping -s 1600 -q -c 3 -i 0.3 -w 2 10.1.1.100 >> ping.output"])
>> +AT_CHECK([ip netns exec at_ns0 bash -c "ping -s 3200 -q -c 3 -i 0.3 -w 2 10.1.1.100 >> ping.output"])
>> +
> May be it is better to check ping results after each ping test?

Sure, the output from failed tests would be more clear if I do this.
I'll roll this into the other patches too.



More information about the dev mailing list