[V1] tests/TestSuite_macsec_for_ixgbe:adapt to different CPUs

Message ID 20220812155152.17733-1-hongbox.li@intel.com (mailing list archive)
State Accepted
Headers
Series [V1] tests/TestSuite_macsec_for_ixgbe:adapt to different CPUs |

Checks

Context Check Description
ci/Intel-dts-format-test success Testing OK
ci/Intel-dts-pylama-test success Testing OK
ci/Intel-dts-doc-test success Testing OK
ci/Intel-dts-suite-test warning SKIPPED

Commit Message

Li, HongboX Aug. 12, 2022, 3:51 p.m. UTC
  According to the explanation of the DPDK developer, setting the same PN value on different CPUs will have different behaviors.
This patch is used to help case adapt different CPUs.

Signed-off-by: Hongbo Li <hongbox.li@intel.com>
---
 test_plans/macsec_for_ixgbe_test_plan.rst |  8 ++++--
 tests/TestSuite_macsec_for_ixgbe.py       | 32 ++++++++++++++++-------
 2 files changed, 29 insertions(+), 11 deletions(-)
  

Comments

Tu, Lijuan Sept. 8, 2022, 4:50 a.m. UTC | #1
On Fri, 12 Aug 2022 15:51:52 +0000, Hongbo Li <hongbox.li@intel.com> wrote:
> According to the explanation of the DPDK developer, setting the same PN value on different CPUs will have different behaviors.
> This patch is used to help case adapt different CPUs.
> 
> Signed-off-by: Hongbo Li <hongbox.li@intel.com>

Acked-by: Lijuan Tu <lijuan.tu@intel.com>
Applied, thanks
  

Patch

diff --git a/test_plans/macsec_for_ixgbe_test_plan.rst b/test_plans/macsec_for_ixgbe_test_plan.rst
index 22218bb8..b2c8ecda 100644
--- a/test_plans/macsec_for_ixgbe_test_plan.rst
+++ b/test_plans/macsec_for_ixgbe_test_plan.rst
@@ -223,10 +223,14 @@  Test Case 3: MACsec send and receive with different parameters
    It can't be set successfully.
 
 3. Set "pn" to 0xffffffec on both rx and tx sides.
-   Rx port can receive four packets.
+   Rx port can receive four packets.But the expected number
+   of packets is 3/4/5 While the explanation that DPDK developers
+   gave is that it's hardware's behavior.
 
    Set "pn" to 0xffffffed on both rx and tx sides.
-   Rx port can receive three packets.
+   Rx port can receive three packets.But the expected number
+   of packets is 3/4. While the explanation that DPDK developers
+   gave is that it's hardware's behavior.
 
    Set "pn" to 0xffffffee/0xffffffef on both rx and tx sides.
    Rx port can receive three packets too. But the expected number
diff --git a/tests/TestSuite_macsec_for_ixgbe.py b/tests/TestSuite_macsec_for_ixgbe.py
index 643b3dee..ade31e0b 100644
--- a/tests/TestSuite_macsec_for_ixgbe.py
+++ b/tests/TestSuite_macsec_for_ixgbe.py
@@ -236,6 +236,26 @@  class TestMacsecForIxgbe(TestCase):
             "MACsec pkts receive failed",
         )
 
+    def check_pn_boundary_value(self, i, pkt_num):
+        if i == "0xffffffec":
+            try:
+                self.verify(int(pkt_num) == 4, "Rx port can't receive 4 pkts")
+            except:
+                self.verify(
+                    int(pkt_num) in [3, 4, 5], "Rx port can't receive the expected pkts"
+                )
+                msg = (
+                    str(pkt_num)
+                    + " packages received, the hardware behavior is different on each series of CPUs"
+                )
+                self.logger.warning(msg)
+            finally:
+                self.clear_port_xstats()
+        else:
+            self.verify(
+                int(pkt_num) in [1, 2, 3, 4], "Rx port can't receive the expected pkts"
+            )
+
     def test_MACsec_pkts_tx_and_rx(self):
         """
         MACsec packets send and receive
@@ -364,15 +384,9 @@  class TestMacsecForIxgbe(TestCase):
                     0, 0, 0, i, "00112200000000000000000000000000"
                 )
                 pkt_num = self.packets_receive_num()
-                if i == "0xffffffec":
-                    self.verify(int(pkt_num[0]) == 4, "Rx port can't receive four pkts")
-                    self.clear_port_xstats()
-                else:
-                    self.verify(
-                        int(pkt_num[0]) == 3, "Rx port can't receive three pkts"
-                    )
-                    self.session_sec.send_expect("quit", "#")
-                    self.dut.send_expect("quit", "#")
+                self.check_pn_boundary_value(i, int(pkt_num[0]))
+                self.session_sec.send_expect("quit", "#")
+                self.dut.send_expect("quit", "#")
 
         # subcase4:set various key on rx and tx port
         for i in [