diff mbox series

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

Message ID 1512494583-29613-1-git-send-email-ashishvarma.ovs@gmail.com
State Superseded
Headers show
Series [ovs-dev] tests: add-del-add sequence for interface | expand

Commit Message

Ashish Varma Dec. 5, 2017, 5:23 p.m. UTC
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 <ashishvarma.ovs@gmail.com>
---
 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

Comments

Yi-Hung Wei Dec. 8, 2017, 5:52 p.m. UTC | #1
On Tue, Dec 5, 2017 at 9:23 AM, Ashish Varma <ashishvarma.ovs@gmail.com> wrote:
> 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 <ashishvarma.ovs@gmail.com>

Thanks for working on this patch.

> 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
^^^^^^^ Seems like we usually do not expand a tab into space in the automake.mk


> 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])
When I run make check-kmod against this test, I may intermittently
having the following errors. Are they expected?

+2017-12-08T01:03:31.065Z|00026|ofproto|WARN|br0: cannot get STP
status on nonexistent port 1
+2017-12-08T01:03:31.065Z|00027|ofproto|WARN|br0: cannot get RSTP
status on nonexistent port 1
+2017-12-08T01:03:31.071Z|00028|netdev_linux|WARN|ethtool command
ETHTOOL_GDRVINFO on network device ovs-tap0 failed: No such device
+2017-12-08T01:03:31.074Z|00029|netdev_linux|WARN|ethtool command
ETHTOOL_GSET on network device ovs-tap0 failed: No such device


> 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])
> --
Should we add this test to system-userspace as well?

Something like,

==================================================================

diff --git a/tests/system-userspace-testsuite.at
b/tests/system-userspace-testsuite.at
index a89536f1d381..c0aaa606d05d 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])

==================================================================


Thanks,

-Yi-Hung
diff mbox series

Patch

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])