[ovs-dev] [PATCH v2] tests: add-del-add sequence for interface

Ashish Varma ashishvarma.ovs at gmail.com
Fri Dec 15 15:09:50 UTC 2017


Added a unit test case for testing the condition when a veth interface
is added to br0 and then the veth interface is deleted from the
system and added back with the same name.

Signed-off-by: Ashish Varma <ashishvarma.ovs at gmail.com>
---
v1-v2
Incorporated the comments by Yi-Hung Wei:
 Added system-interface.at test to system-userspace-testsuite.
 Replaced space by tab in automake.mk.
 Added handling for conditions when the veth interface is not detected
 (as expected) by vswitchd, which caused test case failure. 
 (This was happening intermittently)
---
 tests/automake.mk                   |  3 ++-
 tests/system-interface.at           | 27 +++++++++++++++++++++++++++
 tests/system-kmod-testsuite.at      |  1 +
 tests/system-userspace-testsuite.at |  1 +
 4 files changed, 31 insertions(+), 1 deletion(-)
 create mode 100644 tests/system-interface.at

diff --git a/tests/automake.mk b/tests/automake.mk
index c1a2357..5af03d6 100644
--- a/tests/automake.mk
+++ b/tests/automake.mk
@@ -119,7 +119,8 @@ SYSTEM_TESTSUITE_AT = \
 	tests/system-common-macros.at \
 	tests/system-ovn.at \
 	tests/system-layer3-tunnels.at \
-	tests/system-traffic.at
+	tests/system-traffic.at \
+	tests/system-interface.at
 
 SYSTEM_OFFLOADS_TESTSUITE_AT = \
 	tests/system-common-macros.at \
diff --git a/tests/system-interface.at b/tests/system-interface.at
new file mode 100644
index 0000000..db790d5
--- /dev/null
+++ b/tests/system-interface.at
@@ -0,0 +1,27 @@
+AT_BANNER([system-inteface])
+
+dnl add a veth interface to br0, then delete and re-create
+dnl the veth interface with the same name in the system
+AT_SETUP([interface - add delete add same interface])
+
+OVS_TRAFFIC_VSWITCHD_START()
+
+AT_CHECK([ip link add ovs-veth0 type veth peer name ovs-veth1])
+on_exit 'ip link del ovs-veth0'
+
+AT_CHECK([ovs-vsctl add-port br0 ovs-veth0])
+
+AT_CHECK([ip link del ovs-veth0])
+AT_CHECK([ip link add ovs-veth0 type veth peer name ovs-veth1])
+
+AT_CHECK([ovs-vsctl del-port br0 ovs-veth0])
+
+OVS_TRAFFIC_VSWITCHD_STOP(["dnl
+/could not open network device ovs-veth0/d
+/cannot get .*STP status on nonexistent port/d
+/ethtool command .*on network device ovs-veth0 failed/d
+/error receiving .*ovs-veth0/d
+/ovs-veth0: removing policing failed/d"])
+
+AT_CLEANUP
+
diff --git a/tests/system-kmod-testsuite.at b/tests/system-kmod-testsuite.at
index 975b200..bda314a 100644
--- a/tests/system-kmod-testsuite.at
+++ b/tests/system-kmod-testsuite.at
@@ -25,3 +25,4 @@ m4_include([tests/system-kmod-macros.at])
 m4_include([tests/system-traffic.at])
 m4_include([tests/system-layer3-tunnels.at])
 m4_include([tests/system-ovn.at])
+m4_include([tests/system-interface.at])
diff --git a/tests/system-userspace-testsuite.at b/tests/system-userspace-testsuite.at
index a89536f..c0aaa60 100644
--- a/tests/system-userspace-testsuite.at
+++ b/tests/system-userspace-testsuite.at
@@ -25,4 +25,5 @@ m4_include([tests/system-common-macros.at])
 m4_include([tests/system-traffic.at])
 m4_include([tests/system-layer3-tunnels.at])
 m4_include([tests/system-ovn.at])
+m4_include([tests/system-interface.at])
 m4_include([tests/system-userspace-packet-type-aware.at])
-- 
2.7.4



More information about the dev mailing list