From patchwork Fri Jul 30 15:10:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lingli Chen X-Patchwork-Id: 96441 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2D70DA0C46; Fri, 30 Jul 2021 08:39:33 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2499F40042; Fri, 30 Jul 2021 08:39:33 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 74A9140040 for ; Fri, 30 Jul 2021 08:39:31 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10060"; a="213073073" X-IronPort-AV: E=Sophos;i="5.84,281,1620716400"; d="scan'208";a="213073073" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jul 2021 23:39:29 -0700 X-IronPort-AV: E=Sophos;i="5.84,281,1620716400"; d="scan'208";a="518827049" Received: from unknown (HELO DPDK-CVL-tetser102.icx.intel.com) ([10.240.183.102]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jul 2021 23:39:27 -0700 From: Lingli Chen To: dts@dpdk.org Cc: Lingli Chen Date: Fri, 30 Jul 2021 15:10:31 +0000 Message-Id: <20210730151031.27163-1-linglix.chen@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dts] [PATCH V1] tests/generic_flow_api: add two test cases X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org Sender: "dts" add new i40e test cases. Signed-off-by: Lingli Chen Tested-by: Lingli Chen Acked-by: Xueqin Lin --- 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.