From patchwork Mon Sep 5 18:51:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jiale, SongX" X-Patchwork-Id: 115887 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 63340A054F; Mon, 5 Sep 2022 12:51:28 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E0C4140E5A; Mon, 5 Sep 2022 12:51:27 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id C237E400D6 for ; Mon, 5 Sep 2022 12:51:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662375086; x=1693911086; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XD3nd6jh0zngvbEqR57yunLOl+X7tC/2Tl3fXy2JS28=; b=bb3uwixgyuyizAB457GlJyAxEyfFWRPj+pxAaSmQBnHKxTiH6DWI8TQ7 BtNAxeNfccJ446AmOYskime3UX+9JJbkg1L6EqRZX/C8yhLb/+m3WGD8L t6lHYqTbq+yaR2abQ2S3qo5Iloj5CM6YFhuG/BAtw4m5wLnC+DAHq/4Lg 5lnNWxN7lrT+IldRSoRgHustseseNNtcm68IjlMt3RAiiEBxw39LSPJF6 CpGlvmTacxrqXv6jM95/6Tvr2yLarcp7oXdrIUM0y4Gh0VAlggkfx+zWQ QKsgPNyuOyVAmiOv9adWDjJ/hXHWB4AqjNJCEBOryk53yMjtLgjJzJIgT g==; X-IronPort-AV: E=McAfee;i="6500,9779,10460"; a="293947093" X-IronPort-AV: E=Sophos;i="5.93,291,1654585200"; d="scan'208";a="293947093" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Sep 2022 03:51:24 -0700 X-IronPort-AV: E=Sophos;i="5.93,291,1654585200"; d="scan'208";a="609643482" Received: from unknown (HELO localhost.localdomain) ([10.239.252.20]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Sep 2022 03:51:22 -0700 From: Jiale Song To: dts@dpdk.org Cc: Jiale Song Subject: [dts] [PATCH V2 2/2] tests/ice_switch_filter: add 2 case Date: Mon, 5 Sep 2022 18:51:09 +0000 Message-Id: <20220905185109.3717549-2-songx.jiale@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220905185109.3717549-1-songx.jiale@intel.com> References: <20220905185109.3717549-1-songx.jiale@intel.com> MIME-Version: 1.0 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 add case test_l2_mask and test_l3_mask. Signed-off-by: Jiale Song Acked-by: Peng, Yuan Signed-off-by: Jiale Song --- tests/TestSuite_ice_switch_filter.py | 159 ++++++++++++++++++++++++++- 1 file changed, 158 insertions(+), 1 deletion(-) diff --git a/tests/TestSuite_ice_switch_filter.py b/tests/TestSuite_ice_switch_filter.py index c9c5b17f..78418568 100644 --- a/tests/TestSuite_ice_switch_filter.py +++ b/tests/TestSuite_ice_switch_filter.py @@ -4169,6 +4169,151 @@ drop_any_pkt_list = [ "Ether(dst='68:05:CA:BB:26:E0')/IP()/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x123456)/GTPPDUSessionContainer(type=0, P=1, QFI=0x34)/IP(dst='192.168.0.1', src='192.168.0.2')/UDP(sport=22, dport=33)/('X'*480)", ] +IP_MASK = { + "matched": [ + 'Ether()/IP(src="192.168.0.1", dst="239.255.255.255")/UDP()/Raw("x"*80)', + ], + "mismatched": [ + 'Ether()/IP(src="192.168.0.1", dst="223.0.0.0")/TCP()/Raw("x"*80)', + 'Ether()/IP(src="192.168.0.1", dst="240.0.0.0")/UDP()/Raw("x"*80)', + 'Ether()/IP(src="192.168.0.1", dst="128.0.0.0")/Raw("x"*80)', + ], +} + +tv_ip_dst_mask_quest = { + "name": "tv_ip_dst_mask", + "rte_flow_pattern": "flow create 0 ingress pattern eth / ipv4 dst spec 224.0.0.0 dst mask 240.0.0.0 / end actions queue index 12 / end", + "configuration": {"is_non_pipeline": True, "is_need_rss_rule": False}, + "matched": { + "scapy_str": IP_MASK["matched"], + "check_func": { + "func": rfc.check_output_log_in_queue, + "param": {"expect_port": 0, "expect_queues": 12}, + }, + "expect_results": {"expect_pkts": len(IP_MASK["matched"])}, + }, + "mismatched": { + "scapy_str": IP_MASK["mismatched"], + "check_func": { + "func": rfc.check_output_log_in_queue_mismatched, + "param": {"expect_port": 0, "expect_queues": 12}, + }, + "expect_results": {"expect_pkts": len(IP_MASK["mismatched"])}, + }, +} + +IPv6_MASK = { + "matched": [ + 'Ether(dst="00:00:5e:00:00:01")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:1515", src="CDCD:910A:2222:5498:ffff:ffff:ffff:ffff")/TCP()/("X"*480)', + ], + "mismatched": [ + 'Ether(dst="00:00:5e:00:00:01")/IPv6(src="CDCD:910A:2222:ffff:8475:1111:3900:2023")/("X"*480)', + 'Ether(dst="00:00:5e:00:00:01")/IPv6(src="CFCD:910A:ffff:5498:8475:1111:3900:2023")/UDP()/("X"*480)', + 'Ether(dst="00:00:5e:00:00:01")/IPv6(src="CDCD:ffff:2222:5498:8475:1111:3900:1515")/TCP()/("X"*480)', + 'Ether(dst="00:00:5e:00:00:01")/IPv6(src="ffff:910A:2222:5498:8475:1111:3900:1515")/TCP()/("X"*480)', + ], +} + +tv_ipv6_src_mask_drop = { + "name": "tv_ipv6_src_mask", + "rte_flow_pattern": "flow create 0 ingress pattern eth / ipv6 src spec CDCD:910A:2222:5498:8475:1111:3900:2023 src mask ffff:ffff:ffff:ffff:0:0:0:0 / end actions drop / end", + "configuration": {"is_non_pipeline": True, "is_need_rss_rule": False}, + "matched": { + "scapy_str": IPv6_MASK["matched"], + "check_func": { + "func": rfc.check_output_log_drop, + "param": {"expect_port": 0, "expect_queues": "null"}, + }, + "expect_results": {"expect_pkts": len(IPv6_MASK["matched"])}, + }, + "mismatched": { + "scapy_str": IPv6_MASK["mismatched"], + "check_func": { + "func": rfc.check_output_log_drop_mismatched, + "param": {"expect_port": 0, "expect_queues": "null"}, + }, + "expect_results": {"expect_pkts": len(IPv6_MASK["mismatched"])}, + }, +} + +tvs_L3_mask_non_pipeline_mode = [ + tv_ip_dst_mask_quest, + tv_ipv6_src_mask_drop, +] + +L2_DST_MASK = { + "matched": [ + 'Ether(src="00:00:5e:00:00:01", dst="00:00:5e:7f:ff:ff")/IP()/UDP()/Raw("x"*80)', + ], + "mismatched": [ + 'Ether(dst="00:00:5e:80:00:00")/Raw("x"*80)', + 'Ether(dst="00:00:ff:00:00:00")/IP()/Raw("x"*80)', + 'Ether(dst="00:ff:5e:00:00:00")/IP()/TCP()/Raw("x"*80)', + 'Ether(dst="ff:00:5e:00:00:00")/IP()/UDP()/Raw("x"*80)', + ], +} + +tv_eth_dst_mask_quest = { + "name": "tv_eth_dst_mask_quest", + "rte_flow_pattern": "flow create 0 ingress pattern eth dst spec 00:00:5e:00:00:00 dst mask ff:ff:ff:80:00:00 / end actions queue index 12 / end", + "configuration": {"is_non_pipeline": True, "is_need_rss_rule": False}, + "matched": { + "scapy_str": L2_DST_MASK["matched"], + "check_func": { + "func": rfc.check_output_log_in_queue, + "param": {"expect_port": 0, "expect_queues": 12}, + }, + "expect_results": {"expect_pkts": len(L2_DST_MASK["matched"])}, + }, + "mismatched": { + "scapy_str": L2_DST_MASK["mismatched"], + "check_func": { + "func": rfc.check_output_log_in_queue_mismatched, + "param": {"expect_port": 0, "expect_queues": 12}, + }, + "expect_results": {"expect_pkts": len(L2_DST_MASK["mismatched"])}, + }, +} + +L2_SRC_MASK = { + "matched": [ + 'Ether(dst="00:00:5e:00:00:01", src="00:00:5e:7f:ff:ff")/IP()/UDP()/Raw("x"*80)', + ], + "mismatched": [ + 'Ether(src="00:00:5e:80:00:00")/Raw("x"*80)', + 'Ether(src="00:00:ff:00:00:00")/IP()/Raw("x"*80)', + 'Ether(src="00:ff:5e:00:00:00")/IP()/TCP()/Raw("x"*80)', + 'Ether(src="ff:00:5e:00:00:00")/IP()/UDP()/Raw("x"*80)', + ], +} + +tv_eth_src_mask_drop = { + "name": "tv_eth_src_mask_drop", + "rte_flow_pattern": "flow create 0 ingress pattern eth src spec 00:00:5e:00:00:00 src mask ff:ff:ff:80:00:00 / end actions drop / end", + "configuration": {"is_non_pipeline": True, "is_need_rss_rule": False}, + "matched": { + "scapy_str": L2_SRC_MASK["matched"], + "check_func": { + "func": rfc.check_output_log_drop, + "param": {"expect_port": 0, "expect_queues": "null"}, + }, + "expect_results": {"expect_pkts": len(L2_SRC_MASK["matched"])}, + }, + "mismatched": { + "scapy_str": L2_SRC_MASK["mismatched"], + "check_func": { + "func": rfc.check_output_log_drop_mismatched, + "param": {"expect_port": 0, "expect_queues": "null"}, + }, + "expect_results": {"expect_pkts": len(L2_SRC_MASK["mismatched"])}, + }, +} + +tvs_L2_mask_non_pipeline_mode = [ + tv_eth_dst_mask_quest, + tv_eth_src_mask_drop, +] + test_results = OrderedDict() @@ -4212,7 +4357,7 @@ class ICESwitchFilterTest(TestCase): self.verify(len(self.dut_ports) >= 1, "Insufficient ports") localPort = self.tester.get_local_port(self.dut_ports[0]) self.__tx_iface = self.tester.get_interface(localPort) - self.dut.send_expect("ifconfig %s up" % self.__tx_iface, "# ") + self.tester.send_expect("ifconfig %s up" % self.__tx_iface, "# ") self.pkt = Packet() self.pmd = PmdOutput(self.dut) @@ -5319,6 +5464,18 @@ class ICESwitchFilterTest(TestCase): not all(rule6), "all rules should create failed, result {}".format(rule6) ) + def test_l3_mask(self): + """ + Test case: L3 mask + """ + self._rte_flow_validate_pattern(tvs_L3_mask_non_pipeline_mode) + + def test_l2_mask(self): + """ + Test case: L2 mask + """ + self._rte_flow_validate_pattern(tvs_L2_mask_non_pipeline_mode) + def tear_down(self): """ Run after each test case.