diff mbox

[ovs-dev] system-traffic: Add mac addr setting in ADD_NATIVE_TUNNEL.

Message ID 1471062735-31020-1-git-send-email-u9012063@gmail.com
State Superseded
Headers show

Commit Message

William Tu Aug. 13, 2016, 4:32 a.m. UTC
Ubuntu 14.04 with kernel 3.13 fails to set a GRE tunnel's mac address after
device state is up.  The patch adds mac address setting in ADD_NATIVE_TUNNEL
as an optional configuration parameter so that we can set the mac address,
then bring up the device.

Signed-off-by: William Tu <u9012063@gmail.com>
---
 tests/system-common-macros.at | 8 ++++++--
 tests/system-traffic.at       | 3 +--
 2 files changed, 7 insertions(+), 4 deletions(-)
diff mbox

Patch

diff --git a/tests/system-common-macros.at b/tests/system-common-macros.at
index 4ffc382..f7a7275 100644
--- a/tests/system-common-macros.at
+++ b/tests/system-common-macros.at
@@ -118,7 +118,7 @@  m4_define([ADD_OVS_TUNNEL],
 )
 
 # ADD_NATIVE_TUNNEL([type], [port], [namespace], [remote-addr], [overlay-addr],
-#                   [link-args])
+#                   [link-args], [mac_addr])
 #
 # 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
@@ -127,11 +127,15 @@  m4_define([ADD_OVS_TUNNEL],
 #
 # '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.
+# for instance to configure the vxlan destination port. Optionally, 'mac_addr'
+# could be set to the 'port'
 #
 m4_define([ADD_NATIVE_TUNNEL],
    [NS_CHECK_EXEC([$3], [ip link add dev $2 type $1 remote $4 $6])
     NS_CHECK_EXEC([$3], [ip addr add dev $2 $5])
+    if test -n "$7"; then
+      NS_CHECK_EXEC([$3], [ip link set dev $2 address $7])
+    fi
     NS_CHECK_EXEC([$3], [ip link set dev $2 up])
     NS_CHECK_EXEC([$3], [ip link set dev $2 mtu 1450])
    ]
diff --git a/tests/system-traffic.at b/tests/system-traffic.at
index 2f42efa..27a5600 100644
--- a/tests/system-traffic.at
+++ b/tests/system-traffic.at
@@ -384,9 +384,8 @@  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])
+ADD_NATIVE_TUNNEL([gretap], [ns_gre0], [at_ns0], [172.31.1.100], [10.1.1.1/24], [], [e6:66:c1:11:11:11])
 AT_CHECK([ovs-vsctl -- set interface at_gre0 ofport_request=1])
-NS_CHECK_EXEC([at_ns0], [ip link set dev ns_gre0 address e6:66:c1:11:11:11])
 NS_CHECK_EXEC([at_ns0], [arp -s 10.1.1.2 e6:66:c1:22:22:22])
 
 dnl Set up (p1 and ovs-p1) at br0