[V1] tests/generic_flow_api: add two test cases

Message ID 20210730151031.27163-1-linglix.chen@intel.com (mailing list archive)
State Changes Requested
Headers
Series [V1] tests/generic_flow_api: add two test cases |

Commit Message

Lingli Chen July 30, 2021, 3:10 p.m. UTC
  add new i40e test cases.

Signed-off-by: Lingli Chen <linglix.chen@intel.com>
---
 tests/TestSuite_generic_flow_api.py | 54 +++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)
  

Comments

Lingli Chen July 30, 2021, 6:44 a.m. UTC | #1
> -----Original Message-----
> From: Chen, LingliX <linglix.chen@intel.com>
> Sent: Friday, July 30, 2021 11:11 PM
> To: dts@dpdk.org
> Cc: Chen, LingliX <linglix.chen@intel.com>
> Subject: [dts][PATCH V1] tests/generic_flow_api: add two test cases
> 
Tested-by: Lingli Chen <linglix.chen@intel.com>
  
Lin, Xueqin Aug. 2, 2021, 9:54 a.m. UTC | #2
> -----Original Message-----
> From: dts <dts-bounces@dpdk.org> On Behalf Of Lingli Chen
> Sent: Friday, July 30, 2021 11:11 PM
> To: dts@dpdk.org
> Cc: Chen, LingliX <linglix.chen@intel.com>
> Subject: [dts] [PATCH V1] tests/generic_flow_api: add two test cases
> 
> add new i40e test cases.
> 
> Signed-off-by: Lingli Chen <linglix.chen@intel.com>
Acked-by: Xueqin Lin <Xueqin.lin@intel.com>
> ---
>  tests/TestSuite_generic_flow_api.py | 54 +++++++++++++++++++++++++++++
>  1 file changed, 54 insertions(+)
> 
> diff --git a/tests/TestSuite_generic_flow_api.py
> b/tests/TestSuite_generic_flow_api.py
> index b97b49f2..546e63a7 100644
> --- a/tests/TestSuite_generic_flow_api.py
> +++ b/tests/TestSuite_generic_flow_api.py
> @@ -2487,6 +2487,60 @@ class TestGeneric_flow_api(TestCase):
>              flag = 0
>              self.verify(flag, "The packet index %d and %d hash values are same,
> rss_granularity_config failed!" %(result_rows[3][0],result_rows[4][0]))
> 
> +     def test_create_same_rule_after_destroy(self):
> +
> +         self.pmdout.start_testpmd("%s" % self.cores, "--disable-rss --rxq=%d --
> txq=%d" % (MAX_QUEUE+1, MAX_QUEUE+1))
> +         self.dut.send_expect("set fwd rxonly", "testpmd> ", 120)
> +         self.dut.send_expect("set verbose 1", "testpmd> ", 120)
> +         self.dut.send_expect("start", "testpmd> ", 120)
> +         time.sleep(2)
> +
> +         self.dut.send_expect(
> +             "flow create 0 ingress pattern eth / ipv4 / udp src is 32 / end actions
> queue index 2 / end", "created")
> +
> +         out = self.dut.send_expect("flow destroy 0 rule 0", "testpmd> ")
> +         p = re.compile(r"Flow rule #(\d+) destroyed")
> +         m = p.search(out)
> +         self.verify(m, "flow rule 0 delete failed" )
> +
> +         self.dut.send_expect(
> +             "flow create 0 ingress pattern eth / ipv4 / udp src is 32 / end actions
> queue index 2 / end", "created")
> +
> +         self.sendpkt(pktstr='Ether(dst="%s")/IP()/UDP(sport=32)/Raw("x" * 20)' %
> self.pf_mac)
> +         self.verify_result("pf", expect_rxpkts="1", expect_queue="2",
> verify_mac=self.pf_mac)
> +         self.sendpkt(pktstr='Ether(dst="%s")/IP()/UDP(dport=32)/Raw("x" * 20)' %
> self.pf_mac)
> +         self.verify_result("pf", expect_rxpkts="1", expect_queue="0",
> verify_mac=self.pf_mac)
> +
> +         self.dut.send_expect("quit", "# ")
> +         time.sleep(2)
> +
> +     def test_create_different_rule_after_destroy(self):
> +
> +         self.pmdout.start_testpmd("%s" % self.cores, "--disable-rss --rxq=%d --
> txq=%d" % (MAX_QUEUE+1, MAX_QUEUE+1))
> +         self.dut.send_expect("set fwd rxonly", "testpmd> ", 120)
> +         self.dut.send_expect("set verbose 1", "testpmd> ", 120)
> +         self.dut.send_expect("start", "testpmd> ", 120)
> +         time.sleep(2)
> +
> +         self.dut.send_expect(
> +             "flow create 0 ingress pattern eth / ipv4 / udp src is 32 / end actions
> queue index 2 / end", "created")
> +
> +         out = self.dut.send_expect("flow destroy 0 rule 0", "testpmd> ")
> +         p = re.compile(r"Flow rule #(\d+) destroyed")
> +         m = p.search(out)
> +         self.verify(m, "flow rule 0 delete failed" )
> +
> +         self.dut.send_expect(
> +             "flow create 0 ingress pattern eth / ipv4 / udp dst is 32 / end actions
> queue index 2 / end", "created")
> +
> +         self.sendpkt(pktstr='Ether(dst="%s")/IP()/UDP(dport=32)/Raw("x" * 20)' %
> self.pf_mac)
> +         self.verify_result("pf", expect_rxpkts="1", expect_queue="2",
> verify_mac=self.pf_mac)
> +         self.sendpkt(pktstr='Ether(dst="%s")/IP()/UDP(sport=32)/Raw("x" * 20)' %
> self.pf_mac)
> +         self.verify_result("pf", expect_rxpkts="1", expect_queue="0",
> verify_mac=self.pf_mac)
> +
> +         self.dut.send_expect("quit", "# ")
> +         time.sleep(2)
> +
>      def tear_down(self):
>          """
>          Run after each test case.
> --
> 2.17.1
  
Tu, Lijuan Aug. 10, 2021, 6:30 a.m. UTC | #3
> -----Original Message-----
> From: dts <dts-bounces@dpdk.org> On Behalf Of Lingli Chen
> Sent: 2021年7月30日 23:11
> To: dts@dpdk.org
> Cc: Chen, LingliX <linglix.chen@intel.com>
> Subject: [dts] [PATCH V1] tests/generic_flow_api: add two test cases
> 
> add new i40e test cases.

1, the 2 cases are i40e specific, but I do not see any verification based on NIC type, furthermore, checklist should be updated too.
2, no any exception management. If exception happened, testpmd didn't quit as expected, it absolutely will impact other cases.
3, test plan and test cases should be coupled in the same series.

> 
> Signed-off-by: Lingli Chen <linglix.chen@intel.com>
> ---
>  tests/TestSuite_generic_flow_api.py | 54 +++++++++++++++++++++++++++++
>  1 file changed, 54 insertions(+)
> 
> diff --git a/tests/TestSuite_generic_flow_api.py
> b/tests/TestSuite_generic_flow_api.py
> index b97b49f2..546e63a7 100644
> --- a/tests/TestSuite_generic_flow_api.py
> +++ b/tests/TestSuite_generic_flow_api.py
> @@ -2487,6 +2487,60 @@ class TestGeneric_flow_api(TestCase):
>              flag = 0
>              self.verify(flag, "The packet index %d and %d hash values are same,
> rss_granularity_config failed!" %(result_rows[3][0],result_rows[4][0]))
> 
> +     def test_create_same_rule_after_destroy(self):
> +
> +         self.pmdout.start_testpmd("%s" % self.cores, "--disable-rss --rxq=%d --
> txq=%d" % (MAX_QUEUE+1, MAX_QUEUE+1))
> +         self.dut.send_expect("set fwd rxonly", "testpmd> ", 120)
> +         self.dut.send_expect("set verbose 1", "testpmd> ", 120)
> +         self.dut.send_expect("start", "testpmd> ", 120)
> +         time.sleep(2)
> +
> +         self.dut.send_expect(
> +             "flow create 0 ingress pattern eth / ipv4 / udp src is 32 / end actions
> queue index 2 / end", "created")
> +
> +         out = self.dut.send_expect("flow destroy 0 rule 0", "testpmd> ")
> +         p = re.compile(r"Flow rule #(\d+) destroyed")
> +         m = p.search(out)
> +         self.verify(m, "flow rule 0 delete failed" )
> +
> +         self.dut.send_expect(
> +             "flow create 0 ingress pattern eth / ipv4 / udp src is 32 / end actions
> queue index 2 / end", "created")
> +
> +         self.sendpkt(pktstr='Ether(dst="%s")/IP()/UDP(sport=32)/Raw("x" * 20)' %
> self.pf_mac)
> +         self.verify_result("pf", expect_rxpkts="1", expect_queue="2",
> verify_mac=self.pf_mac)
> +         self.sendpkt(pktstr='Ether(dst="%s")/IP()/UDP(dport=32)/Raw("x" * 20)' %
> self.pf_mac)
> +         self.verify_result("pf", expect_rxpkts="1", expect_queue="0",
> verify_mac=self.pf_mac)
> +
> +         self.dut.send_expect("quit", "# ")
> +         time.sleep(2)
> +
> +     def test_create_different_rule_after_destroy(self):
> +
> +         self.pmdout.start_testpmd("%s" % self.cores, "--disable-rss --rxq=%d --
> txq=%d" % (MAX_QUEUE+1, MAX_QUEUE+1))
> +         self.dut.send_expect("set fwd rxonly", "testpmd> ", 120)
> +         self.dut.send_expect("set verbose 1", "testpmd> ", 120)
> +         self.dut.send_expect("start", "testpmd> ", 120)
> +         time.sleep(2)
> +
> +         self.dut.send_expect(
> +             "flow create 0 ingress pattern eth / ipv4 / udp src is 32 / end actions
> queue index 2 / end", "created")
> +
> +         out = self.dut.send_expect("flow destroy 0 rule 0", "testpmd> ")
> +         p = re.compile(r"Flow rule #(\d+) destroyed")
> +         m = p.search(out)
> +         self.verify(m, "flow rule 0 delete failed" )
> +
> +         self.dut.send_expect(
> +             "flow create 0 ingress pattern eth / ipv4 / udp dst is 32 / end actions
> queue index 2 / end", "created")
> +
> +         self.sendpkt(pktstr='Ether(dst="%s")/IP()/UDP(dport=32)/Raw("x" * 20)' %
> self.pf_mac)
> +         self.verify_result("pf", expect_rxpkts="1", expect_queue="2",
> verify_mac=self.pf_mac)
> +         self.sendpkt(pktstr='Ether(dst="%s")/IP()/UDP(sport=32)/Raw("x" * 20)' %
> self.pf_mac)
> +         self.verify_result("pf", expect_rxpkts="1", expect_queue="0",
> verify_mac=self.pf_mac)
> +
> +         self.dut.send_expect("quit", "# ")
> +         time.sleep(2)
> +
>      def tear_down(self):
>          """
>          Run after each test case.
> --
> 2.17.1
  

Patch

diff --git a/tests/TestSuite_generic_flow_api.py b/tests/TestSuite_generic_flow_api.py
index b97b49f2..546e63a7 100644
--- a/tests/TestSuite_generic_flow_api.py
+++ b/tests/TestSuite_generic_flow_api.py
@@ -2487,6 +2487,60 @@  class TestGeneric_flow_api(TestCase):
             flag = 0
             self.verify(flag, "The packet index %d and %d hash values are same, rss_granularity_config failed!" %(result_rows[3][0],result_rows[4][0]))
 
+     def test_create_same_rule_after_destroy(self):
+
+         self.pmdout.start_testpmd("%s" % self.cores, "--disable-rss --rxq=%d --txq=%d" % (MAX_QUEUE+1, MAX_QUEUE+1))
+         self.dut.send_expect("set fwd rxonly", "testpmd> ", 120)
+         self.dut.send_expect("set verbose 1", "testpmd> ", 120)
+         self.dut.send_expect("start", "testpmd> ", 120)
+         time.sleep(2)
+
+         self.dut.send_expect(
+             "flow create 0 ingress pattern eth / ipv4 / udp src is 32 / end actions queue index 2 / end", "created")
+
+         out = self.dut.send_expect("flow destroy 0 rule 0", "testpmd> ")
+         p = re.compile(r"Flow rule #(\d+) destroyed")
+         m = p.search(out)
+         self.verify(m, "flow rule 0 delete failed" )
+
+         self.dut.send_expect(
+             "flow create 0 ingress pattern eth / ipv4 / udp src is 32 / end actions queue index 2 / end", "created")
+
+         self.sendpkt(pktstr='Ether(dst="%s")/IP()/UDP(sport=32)/Raw("x" * 20)' % self.pf_mac)
+         self.verify_result("pf", expect_rxpkts="1", expect_queue="2", verify_mac=self.pf_mac)
+         self.sendpkt(pktstr='Ether(dst="%s")/IP()/UDP(dport=32)/Raw("x" * 20)' % self.pf_mac)
+         self.verify_result("pf", expect_rxpkts="1", expect_queue="0", verify_mac=self.pf_mac)
+
+         self.dut.send_expect("quit", "# ")
+         time.sleep(2)
+
+     def test_create_different_rule_after_destroy(self):
+
+         self.pmdout.start_testpmd("%s" % self.cores, "--disable-rss --rxq=%d --txq=%d" % (MAX_QUEUE+1, MAX_QUEUE+1))
+         self.dut.send_expect("set fwd rxonly", "testpmd> ", 120)
+         self.dut.send_expect("set verbose 1", "testpmd> ", 120)
+         self.dut.send_expect("start", "testpmd> ", 120)
+         time.sleep(2)
+
+         self.dut.send_expect(
+             "flow create 0 ingress pattern eth / ipv4 / udp src is 32 / end actions queue index 2 / end", "created")
+
+         out = self.dut.send_expect("flow destroy 0 rule 0", "testpmd> ")
+         p = re.compile(r"Flow rule #(\d+) destroyed")
+         m = p.search(out)
+         self.verify(m, "flow rule 0 delete failed" )
+
+         self.dut.send_expect(
+             "flow create 0 ingress pattern eth / ipv4 / udp dst is 32 / end actions queue index 2 / end", "created")
+
+         self.sendpkt(pktstr='Ether(dst="%s")/IP()/UDP(dport=32)/Raw("x" * 20)' % self.pf_mac)
+         self.verify_result("pf", expect_rxpkts="1", expect_queue="2", verify_mac=self.pf_mac)
+         self.sendpkt(pktstr='Ether(dst="%s")/IP()/UDP(sport=32)/Raw("x" * 20)' % self.pf_mac)
+         self.verify_result("pf", expect_rxpkts="1", expect_queue="0", verify_mac=self.pf_mac)
+
+         self.dut.send_expect("quit", "# ")
+         time.sleep(2)
+
     def tear_down(self):
         """
         Run after each test case.