Hi David,

 

I found you just check the command “port config mtu (mtu_size)”, and no any stream to verify whether the function works. Is this your purpose?

If you just want to check the testpmd configuration, and not care about the functionality, the case is ok, but as a validation member, I prefer to consider the true functionality, we should check the whether it can transmit packet as expected. For example, packet size less than mtu should be transmitted successfully, and the grater one should failed. In my point, we should cover both positive and negative cases.

 

There is test suite very similar as mtu, test_plans/jumboframes_test_plan.rst, I think they are testing the same functionality, but using different testpmd command.

 

 

From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of David Liu
Sent: Thursday, April 23, 2020 10:04 PM
To: dts@dpdk.org
Cc: David Liu <dliu@iol.unh.edu>
Subject: [dts] [PATCH] Add MTU Check

 

Signed-off-by: David Liu <dliu@iol.unh.edu>
---
 test_plans/MTU_test_plan.rst | 35 ++++++++++++++++++++++++
 tests/TestSuite_MTU.py       | 53 ++++++++++++++++++++++++++++++++++++
 2 files changed, 88 insertions(+)
 create mode 100644 test_plans/MTU_test_plan.rst
 create mode 100644 tests/TestSuite_MTU.py

diff --git a/test_plans/MTU_test_plan.rst b/test_plans/MTU_test_plan.rst
new file mode 100644
index 0000000..c343748
--- /dev/null
+++ b/test_plans/MTU_test_plan.rst
@@ -0,0 +1,35 @@
+=============================================
+MTU Check
+=============================================
+
+This check will use testpmmd to check if MTU is set to 1500/2400/4800/9000
+as required and appear in the set status.
+
+Prerequisites
+=============
+
+Compile DPDK and testpmd. Be able to have the testpmd run.
+
+Test Case: set MTU size
+==========================================
+
+Run testpmd in interactive mode ::
+
+  $ ./dpdk-testpmd -- -i
+
+This can be run with other arguments as well, depending on your setup.
+
+(port_id) - the id for the port you are working on.
+The port has to be stopped before setting MTU size.
+Run this command in testpmd ::
+
+  testpmd> port stop (port_id)
+
+(mtu_size) - the size for MTU you want to set.
+Run this command in testpmd ::
+  testpmd> port config mtu (mtu_size)
+
+(port_id) - the id for the port you are working on.
+Verify the output from matches with the correct size::
+  testpmd> show port info (port_id)
+
diff --git a/tests/TestSuite_MTU.py b/tests/TestSuite_MTU.py
new file mode 100644
index 0000000..e84e23c
--- /dev/null
+++ b/tests/TestSuite_MTU.py
@@ -0,0 +1,53 @@
+"""
+DPDK Test suite.
+Testing MTU with different szie in testpmd
+"""
+
+import utils
+import time
+from test_case import TestCase
+from pmd_output import PmdOutput
+
+class TestMTU(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 set_MTU_size(self):
+        """
+        Run port config mtu $port $size to set size and check if they have the right value
+        """
+        MTU_sizes = [1500, 2400, 4800, 9000]
+        for size in MTU_sizes:
+            for port in self.dut_ports:
+                self.dut.send_command('port stop {}'.format(port))
+                self.dut.send_command('port config mtu {} {}'.format(port, size))
+                port_info = self.dut.send_command('show port {} {}'.format('info', port))
+                self.verify(str(size) in port_info, 'MTU size set {}'.format(size))
+
+    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