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

Signed-off-by: Ashish Varma <[email protected]>
---
 tests/automake.mk              |  3 ++-
 tests/system-interface.at      | 22 ++++++++++++++++++++++
 tests/system-kmod-testsuite.at |  1 +
 3 files changed, 25 insertions(+), 1 deletion(-)
 create mode 100644 tests/system-interface.at

diff --git a/tests/automake.mk b/tests/automake.mk
index 7eed106..8c5f1b9 100644
--- a/tests/automake.mk
+++ b/tests/automake.mk
@@ -118,7 +118,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..a71e2aa
--- /dev/null
+++ b/tests/system-interface.at
@@ -0,0 +1,22 @@
+AT_BANNER([system-inteface])
+
+dnl add a tap interface to br0, then delete and re-create
+dnl the tap interface with the same name in the system
+AT_SETUP([interface - add delete add same interface])
+
+OVS_TRAFFIC_VSWITCHD_START()
+
+AT_CHECK([ip tuntap add dev ovs-tap0 mode tap])
+on_exit 'ip tuntap del dev ovs-tap0 mode tap'
+
+AT_CHECK([ovs-vsctl add-port br0 ovs-tap0])
+
+AT_CHECK([ip tuntap del dev ovs-tap0 mode tap])
+AT_CHECK([ip tuntap add dev ovs-tap0 mode tap])
+
+AT_CHECK([ovs-vsctl del-port br0 ovs-tap0])
+
+OVS_TRAFFIC_VSWITCHD_STOP(["/could not open network device ovs-tap0/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])
-- 
2.7.4

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to