Hi Brandon,

 

This case is already in dts, test_plans/shutdown_api_test_plan.rst  and tests/TestSuite_shutdown_api.py

 

And I think the current case is more strict, because it will check the stream when link is up.

 

From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Brandon Lo
Sent: Thursday, April 23, 2020 9:32 PM
To: dts@dpdk.org
Subject: [dts] [PATCH] Add link status check test

 

This is a simple test meant to check whether or not the
link status changes when we set the link down/up.

Signed-off-by: Brandon Lo <blo@iol.unh.edu>
---
 test_plans/link_status_test_plan.rst | 48 +++++++++++++++++++++
 tests/TestSuite_link_status.py       | 63 ++++++++++++++++++++++++++++
 2 files changed, 111 insertions(+)
 create mode 100644 test_plans/link_status_test_plan.rst
 create mode 100644 tests/TestSuite_link_status.py

diff --git a/test_plans/link_status_test_plan.rst b/test_plans/link_status_test_plan.rst
new file mode 100644
index 0000000..2d92a68
--- /dev/null
+++ b/test_plans/link_status_test_plan.rst
@@ -0,0 +1,48 @@
+=============================================
+Link Status Check
+=============================================
+
+This check will use testpmd to test whether or not a link can be set as
+down/up and appear as the set status.
+
+
+Prerequisites
+=============
+
+Compile DPDK and testpmd. Be able to have the testpmd run.
+
+Test Case: set links as down
+==========================================
+
+Run testpmd in interactive mode ::
+
+  $ ./dpdk-testpmd -- -i
+
+This can be run with other arguments as well, depending on your setup.
+
+Run this command in testpmd ::
+
+  testpmd> set link-down port 0
+
+Verify the output matches with the port being down ::

+  testpmd> show port summary 0
+
+
+Test Case: set links as up
+===========================================
+
+Run testpmd in interactive mode ::
+
+  $ ./dpdk-testpmd -- -i
+
+This can be run with other arguments as well, depending on your setup.
+
+Run this command in testpmd ::
+
+  testpmd> set link-up port 0
+
+Verify the output matches with the port being up ::

+  testpmd> show port summary 0
+
diff --git a/tests/TestSuite_link_status.py b/tests/TestSuite_link_status.py
new file mode 100644
index 0000000..0172000
--- /dev/null
+++ b/tests/TestSuite_link_status.py
@@ -0,0 +1,63 @@
+"""
+DPDK Test suite.
+Testing link status in testpmd
+"""
+
+import utils
+import time
+from test_case import TestCase
+from pmd_output import PmdOutput
+
+class TestLinkStatus(TestCase):
+
+    def set_up_all(self):
+        """
+        Run at the start of each test suite.
+        """
+        self.dut.build_install_dpdk(self.target)
+        self.pmdout = PmdOutput(self.dut)
+        self.pmdout.start_testpmd()
+        self.dut_ports = self.dut.get_ports()
+
+    def set_up(self):
+        """
+        Run before each test case.
+        Nothing to do.
+        """
+        pass
+
+    def test_link_down(self):
+        """
+        Run set link-down on ports and check if they are down in summary.
+        """
+        for port in self.dut_ports:
+            self.dut.send_command('set link-down port {}'.format(port))
+            time.sleep(5)
+            self.dut.send_command('show port summary {}'.format(port))
+            self.verify('down' in self.dut.session.history[-1]['output'],
+                    'Link down for port {}'.format(port))
+
+    def test_link_up(self):
+        """
+        Run set link-up on ports and check if they are up in summary.
+        """
+        for port in self.dut_ports:
+            self.dut.send_command('set link-up port {}'.format(port))
+            time.sleep(5)
+            self.dut.send_command('show port summary {}'.format(port))
+            self.verify('up' in self.dut.session.history[-1]['output'],
+                    'Link up for port {}'.format(port))
+
+    def tear_down(self):
+        """
+        Run after each test case.
+        Nothing to do.
+        """
+        pass
+
+    def tear_down_all(self):
+        """
+        Quit out of testpmd
+        """
+        self.dut.send_expect("quit", "# ", 30)
+
--
2.17.1