From patchwork Wed Aug 25 18:30:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lingli Chen X-Patchwork-Id: 97328 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 2B0C6A0C53; Wed, 25 Aug 2021 12:28:50 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 208E5411E7; Wed, 25 Aug 2021 12:28:50 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 31354411E7 for ; Wed, 25 Aug 2021 12:28:48 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10086"; a="204629123" X-IronPort-AV: E=Sophos;i="5.84,350,1620716400"; d="scan'208";a="204629123" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Aug 2021 03:28:47 -0700 X-IronPort-AV: E=Sophos;i="5.84,350,1620716400"; d="scan'208";a="464736218" Received: from unknown (HELO localhost.localdomain) ([10.240.183.77]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Aug 2021 03:28:46 -0700 From: Lingli Chen To: dts@dpdk.org Cc: Lingli Chen Date: Wed, 25 Aug 2021 18:30:34 +0000 Message-Id: <20210825183034.63754-4-linglix.chen@intel.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210825183034.63754-1-linglix.chen@intel.com> References: <20210825183034.63754-1-linglix.chen@intel.com> MIME-Version: 1.0 Subject: [dts] [PATCH V1 3/3] 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 two test cases Signed-off-by: Lingli Chen Acked-by: Xueqin Lin --- tests/TestSuite_generic_flow_api.py | 48 +++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/tests/TestSuite_generic_flow_api.py b/tests/TestSuite_generic_flow_api.py index e8171589..f64a5be5 100644 --- a/tests/TestSuite_generic_flow_api.py +++ b/tests/TestSuite_generic_flow_api.py @@ -2351,6 +2351,54 @@ class TestGeneric_flow_api(TestCase): rule_num = extrapkt_rulenum['rulenum'] self.verify_rulenum(rule_num) + 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> ", 20) + self.dut.send_expect("set verbose 1", "testpmd> ", 20) + self.dut.send_expect("start", "testpmd> ", 20) + 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) + + 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> ", 20) + self.dut.send_expect("set verbose 1", "testpmd> ", 20) + self.dut.send_expect("start", "testpmd> ", 20) + 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(sport=32)/Raw("x" * 20)' % self.pf_mac) + self.verify_result("pf", expect_rxpkts="1", expect_queue="0", 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="2", verify_mac=self.pf_mac) + def tear_down(self): """ Run after each test case.