diff mbox

[ovs-dev,1/2] system-traffic: Add basic gre tunnel sanity test.

Message ID 1461193672-47049-1-git-send-email-joe@ovn.org
State Accepted
Headers show

Commit Message

Joe Stringer April 20, 2016, 11:07 p.m. UTC
Signed-off-by: Joe Stringer <joe@ovn.org>
---
 tests/system-common-macros.at |  4 ++++
 tests/system-traffic.at       | 41 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+)

Comments

Joe Stringer April 21, 2016, 8:29 p.m. UTC | #1
On 20 April 2016 at 16:07, Joe Stringer <joe@ovn.org> wrote:
> Signed-off-by: Joe Stringer <joe@ovn.org>
> ---
<snip>

> +dnl Set up tunnel endpoints on OVS outside the namespace and with a native
> +dnl linux device inside the namespace.
> +ADD_OVS_TUNNEL([gre], [br0], [at_gre0], [172.31.1.1], [10.1.1.100/24])
> +ADD_NATIVE_TUNNEL([gretap], [ns_gre0], [at_ns0], [172.31.1.100], [10.1.1.1/24],
> +                  [local 172.31.1.1])

The "local" option is optional, I'll probably drop it since it's not necessary.
Daniele Di Proietto April 22, 2016, 12:10 a.m. UTC | #2
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>


On 21/04/2016 13:29, "Joe Stringer" <joe@ovn.org> wrote:

>On 20 April 2016 at 16:07, Joe Stringer <joe@ovn.org> wrote:
>> Signed-off-by: Joe Stringer <joe@ovn.org>
>> ---
><snip>
>
>> +dnl Set up tunnel endpoints on OVS outside the namespace and with a
>>native
>> +dnl linux device inside the namespace.
>> +ADD_OVS_TUNNEL([gre], [br0], [at_gre0], [172.31.1.1], [10.1.1.100/24])
>> +ADD_NATIVE_TUNNEL([gretap], [ns_gre0], [at_ns0], [172.31.1.100],
>>[10.1.1.1/24],
>> +                  [local 172.31.1.1])
>
>The "local" option is optional, I'll probably drop it since it's not
>necessary.

I tested with and without it and it appears to work
Joe Stringer April 22, 2016, 10:47 p.m. UTC | #3
On 21 April 2016 at 17:10, Daniele Di Proietto <diproiettod@vmware.com> wrote:
> Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
>
>
> On 21/04/2016 13:29, "Joe Stringer" <joe@ovn.org> wrote:
>
>>On 20 April 2016 at 16:07, Joe Stringer <joe@ovn.org> wrote:
>>> Signed-off-by: Joe Stringer <joe@ovn.org>
>>> ---
>><snip>
>>
>>> +dnl Set up tunnel endpoints on OVS outside the namespace and with a
>>>native
>>> +dnl linux device inside the namespace.
>>> +ADD_OVS_TUNNEL([gre], [br0], [at_gre0], [172.31.1.1], [10.1.1.100/24])
>>> +ADD_NATIVE_TUNNEL([gretap], [ns_gre0], [at_ns0], [172.31.1.100],
>>>[10.1.1.1/24],
>>> +                  [local 172.31.1.1])
>>
>>The "local" option is optional, I'll probably drop it since it's not
>>necessary.
>
> I tested with and without it and it appears to work

Thanks, applied to master.
diff mbox

Patch

diff --git a/tests/system-common-macros.at b/tests/system-common-macros.at
index 92569f9c4fcf..1b9b5c1e9f15 100644
--- a/tests/system-common-macros.at
+++ b/tests/system-common-macros.at
@@ -155,3 +155,7 @@  m4_define([NETNS_DAEMONIZE],
 # Do basic check for vxlan functionality, skip the test if it's not there.
 m4_define([OVS_CHECK_VXLAN],
     [AT_SKIP_IF([! ip link add foo type vxlan help 2>&1 | grep dstport >/dev/null])])
+
+# OVS_CHECK_GRE()
+m4_define([OVS_CHECK_GRE],
+    [AT_SKIP_IF([! ip link add foo type gretap help 2>&1 | grep gre >/dev/null])])
diff --git a/tests/system-traffic.at b/tests/system-traffic.at
index dceae150d148..8684a5f06c68 100644
--- a/tests/system-traffic.at
+++ b/tests/system-traffic.at
@@ -147,6 +147,47 @@  NS_CHECK_EXEC([at_ns0], [ping -s 3200 -q -c 3 -i 0.3 -w 2 10.1.1.100 | FORMAT_PI
 OVS_TRAFFIC_VSWITCHD_STOP
 AT_CLEANUP
 
+AT_SETUP([datapath - ping over gre tunnel])
+OVS_CHECK_GRE()
+
+OVS_TRAFFIC_VSWITCHD_START()
+ADD_BR([br-underlay])
+
+AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"])
+AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"])
+
+ADD_NAMESPACES(at_ns0)
+
+dnl Set up underlay link from host into the namespace using veth pair.
+ADD_VETH(p0, at_ns0, br-underlay, "172.31.1.1/24")
+AT_CHECK([ip addr add dev br-underlay "172.31.1.100/24"])
+AT_CHECK([ip link set dev br-underlay up])
+
+dnl Set up tunnel endpoints on OVS outside the namespace and with a native
+dnl linux device inside the namespace.
+ADD_OVS_TUNNEL([gre], [br0], [at_gre0], [172.31.1.1], [10.1.1.100/24])
+ADD_NATIVE_TUNNEL([gretap], [ns_gre0], [at_ns0], [172.31.1.100], [10.1.1.1/24],
+                  [local 172.31.1.1])
+
+dnl First, check the underlay
+NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 172.31.1.100 | FORMAT_PING], [0], [dnl
+3 packets transmitted, 3 received, 0% packet loss, time 0ms
+])
+
+dnl Okay, now check the overlay with different packet sizes
+NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.1.1.100 | 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.100 | 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.100 | FORMAT_PING], [0], [dnl
+3 packets transmitted, 3 received, 0% packet loss, time 0ms
+])
+
+OVS_TRAFFIC_VSWITCHD_STOP
+AT_CLEANUP
+
 AT_SETUP([conntrack - controller])
 CHECK_CONNTRACK()
 OVS_TRAFFIC_VSWITCHD_START()