From patchwork Thu Jul 14 18:47:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jiale, SongX" X-Patchwork-Id: 113971 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 7FCB4A00C5; Thu, 14 Jul 2022 12:26:03 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 78ED842B7E; Thu, 14 Jul 2022 12:26:03 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 7B24742B6D for ; Thu, 14 Jul 2022 12:26:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657794361; x=1689330361; h=from:to:cc:subject:date:message-id; bh=2drTNGhcXxtcaTETG6VXEVxR1cHUuUpSGgVBcyCCWDk=; b=cHxfZU9UB0rkVHwslyGVtkTuDi1QBgbH5z84LRQ1qMZoG8jHk/Rl6qmu GoYIAjvChjngpWSiZmEHoqOnL/7BCWvvIzpitNRFBYt70xRdFuEbP+DH4 KOJnL8qK+Z7yP03dy5SsqgQKbOUtvSDpriHWtVDNmf3yaL416+txZpvCI pDyfEH+OxQvMS7+1WA+/GPzTkjH8Q3eZLcrfhclmhAzRfAvPWuhRgtd21 BZSjNdvQN4O1Zi9A0UKFktXFa2hUscDzfzQZLOH4rp/dkuU7bpg+yOR5L QnxRt1noUyyKjM9+Dsh80s4cRixNEGPrFQkJF+2x7eU+lnVratTZjjCjh A==; X-IronPort-AV: E=McAfee;i="6400,9594,10407"; a="311125398" X-IronPort-AV: E=Sophos;i="5.92,269,1650956400"; d="scan'208";a="311125398" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2022 03:26:00 -0700 X-IronPort-AV: E=Sophos;i="5.92,269,1650956400"; d="scan'208";a="653820603" Received: from unknown (HELO localhost.localdomain) ([10.239.252.94]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2022 03:25:59 -0700 From: Jiale Song To: dts@dpdk.org Cc: Jiale Song Subject: [dts] [PATCH V1 1/2] test_plans/ice_switch_filter: add 2 case Date: Thu, 14 Jul 2022 18:47:42 +0000 Message-Id: <20220714184743.14720-1-songx.jiale@intel.com> X-Mailer: git-send-email 2.17.1 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 to test the rule of l2 mask and l3 mask. Signed-off-by: Jiale Song --- test_plans/ice_switch_filter_test_plan.rst | 237 ++++++++++++++++++++- 1 file changed, 234 insertions(+), 3 deletions(-) diff --git a/test_plans/ice_switch_filter_test_plan.rst b/test_plans/ice_switch_filter_test_plan.rst index 599174ba..001c6be2 100644 --- a/test_plans/ice_switch_filter_test_plan.rst +++ b/test_plans/ice_switch_filter_test_plan.rst @@ -96,6 +96,10 @@ Pattern and input set +---------------------+-------------------------------+-------------------------------------------+-------------------------------------------+ | ethertype filter | ethertype filter_PPPOED | [Ether type] | [Ether type] | +---------------------+-------------------------------+-------------------------------------------+-------------------------------------------+ + | | L3 multicast | [Dest IPv4], [Source IPv6] | N/A | + | multicast +-------------------------------+-------------------------------------------+-------------------------------------------+ + | | L2 multicast | [Dest MAC], [Source MAC] | N/A | + +---------------------+-------------------------------+-------------------------------------------+-------------------------------------------+ .. note:: @@ -5596,6 +5600,8 @@ Pattern Any Test Case Test case 1: check rule is programmed to switch ----------------------------------------------- +Test Steps +.......... 1. launch testpmd with --log-level="ice,7" create a rule:: testpmd> flow create 0 ingress pattern any / end actions drop / end @@ -5614,6 +5620,9 @@ Test case 1: check rule is programmed to switch Test case 2: drop any rule -------------------------- + +Test Steps +.......... 1. create a rule:: testpmd> flow create 0 ingress pattern any / end actions drop / end @@ -5656,6 +5665,9 @@ Test case 2: drop any rule Test case 3: any to queue rule ------------------------------ + +Test Steps +.......... 1. create a rule:: testpmd> flow create 0 ingress pattern any / end actions queue index 4 / end @@ -5677,8 +5689,10 @@ Test case 4: pattern any priority check --------------------------------------- subcase 1: non-pipeline mode -............................ +---------------------------- +Test Steps +.......... 1. create drop any rule with priority 0, to queue rule with priority 1:: testpmd> flow create 0 priority 0 ingress pattern any / end actions drop / end @@ -5703,8 +5717,10 @@ subcase 1: non-pipeline mode 5. change the rule priority, repeat step 2-4, check the result is same. subcase 2: non-pipeline mode with other rule -............................................ +-------------------------------------------- +Test Steps +.......... 1. create 2 rules:: testpmd> flow create 0 priority 1 ingress pattern any / end actions drop / end @@ -5732,8 +5748,10 @@ subcase 2: non-pipeline mode with other rule testpmd> flow destroy 0 rule 1 subcase 3: pipeline mode -........................ +------------------------ +Test Steps +.......... 1. launch testpmd with pipeline mode, create rule, check the rule can be created:: testpmd> flow create 0 priority 0 ingress pattern any / end actions drop / end @@ -5761,3 +5779,216 @@ subcase 3: pipeline mode 7. create rule, check the rule can not be created:: testpmd> flow create 0 priority 1 ingress pattern any / end actions queue index 4 / end + +Test case: L3 multicast +======================= + +subcase 1: ipv4 dst + mask + queue action +----------------------------------------- + +Test Steps +.......... +1. validate a rule:: + + testpmd> flow validate 0 ingress pattern eth / ipv4 dst spec 224.0.0.0 dst mask 240.0.0.0 / end actions queue index 12 / end + + get the message:: + + Flow rule validated + + check the flow list:: + + testpmd> flow list 0 + + check the rule not exists in the list. + +2. create a rule:: + + testpmd> 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 + testpmd> flow list 0 + + check the rule exists in the list. + +3. send matched packets:: + + sendp(Ether()/IP(dst="224.0.0.0")/Raw("x"*80), iface="enp27s0f0", count=1), + sendp(Ether()/IP(dst="224.0.0.255")/Raw("x"*80), iface="enp27s0f0", count=1), + sendp(Ether()/IP(src="192.168.0.1", dst="224.0.255.0")/Raw("x"*80), iface="enp27s0f0", count=1), + sendp(Ether()/IP(src="192.168.0.1", dst="224.255.0.0")/TCP()/Raw("x"*80), iface="enp27s0f0", count=1), + sendp(Ether()/IP(src="192.168.0.1", dst="239.0.0.0")/UDP()/Raw("x"*80), iface="enp27s0f0", count=1), + + check all the packets received by queue 12. + send mismatched packets:: + + sendp(Ether()/IP(src="192.168.0.1", dst="223.0.0.0")/TCP()/Raw("x"*80), iface="enp27s0f0", count=1) + sendp(Ether()/IP(src="192.168.0.1", dst="240.0.0.0")/UDP()/Raw("x"*80), iface="enp27s0f0", count=1) + sendp(Ether()/IP(src="192.168.0.1", dst="128.0.0.0")/Raw("x"*80)], iface="enp27s0f0", count=1) + + check all the packets can't received by queue 12. + +4. verify rules can be destroyed:: + + testpmd> flow destroy 0 rule 0 + testpmd> flow list 0 + + check the rule not exists in the list. + send matched packets, check all the packets can't received by queue 12. + +subcase 2: ipv6 src + mask + drop action +---------------------------------------- + +Test Steps +.......... +1. validate a rule:: + + testpmd> flow validate 0 ingress pattern eth / ipv6 src spec CDCD:910A:2222:5498:8475:1111:3900:2023 src mask fff0:0:0:0:0:0:0:0 / end actions drop / end + + get the message:: + + Flow rule validated + + check the flow list:: + + testpmd> flow list 0 + + check the rule not exists in the list. + +2. create a rule:: + + testpmd> flow create 0 ingress pattern eth / ipv6 src spec CDCD:910A:2222:5498:8475:1111:3900:2023 src mask fff0:0:0:0:0:0:0:0 / end actions drop / end + testpmd> flow list 0 + + check the rule exists in the list. + +3. send matched packets:: + + sendp(Ether()/IPv6(src="CDCD:910A:2222:5498:8475:1111:3900:2023")/("X"*480), iface="enp27s0f0", count=1), + sendp(Ether()/IPv6(src="CDCf:0:0:0:0:0:0:0")/("X"*480), iface="enp27s0f0", count=1), + sendp(Ether()/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:1515", src="CDC0:0:0:0:0:0:0:ffff")/("X"*480), iface="enp27s0f0", count=1), + sendp(Ether()/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:1515", src="CDC0:0:0:0:0:0:ffff:0")/("X"*480), iface="enp27s0f0", count=1), + sendp(Ether()/IPv6(src="CDC0:0:0:0:0:ffff:0:0")/UDP()/("X"*480), iface="enp27s0f0", count=1), + sendp(Ether()/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:1515", src="CDC0:0:0:0:ffff:0:0:0")/UDP()/("X"*480), iface="enp27s0f0", count=1), + sendp(Ether()/IPv6(src="CDC0:0:ffff:0:0:0:0:0")/TCP()/("X"*480), iface="enp27s0f0", count=1), + sendp(Ether()/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:1515", src="CDC0:ffff:0:0:0:0:0:0")/TCP()/("X"*480), iface="enp27s0f0", count=1), + + check all the packets are dropped. + send mismatched packets:: + + sendp(Ether()/IPv6(src="CDDD:910A:2222:5498:8475:1111:3900:2023")/("X"*480), iface="enp27s0f0", count=1) + sendp(Ether()/IPv6(src="CFCD:910A:2222:5498:8475:1111:3900:2023")/UDP()/("X"*480), iface="enp27s0f0", count=1) + sendp(Ether()/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:1515", src="FDCD:0:0:0:0:0:0:ffff")/TCP()/("X"*480), iface="enp27s0f0", count=1) + + check all the packets are not dropped. + +4. verify rules can be destroyed:: + + testpmd> flow destroy 0 rule 0 + testpmd> flow list 0 + + check the rule not exists in the list. + send matched packets, check all the packets are not dropped. + +Test case: L2 multicast +======================= + +subcase 1: mac dst + mask + queue action +---------------------------------------- + +Test Steps +.......... +1. validate a rule:: + + testpmd> flow validate 0 ingress pattern eth dst spec 01:00:5e:00:00:00 dst mask ff:ff:ff:80:00:00 / end actions queue index 12 / end + + get the message:: + + Flow rule validated + + check the flow list:: + + testpmd> flow list 0 + + check the rule not exists in the list. + +2. create a rule:: + + testpmd> flow create 0 ingress pattern eth dst spec 01:00:5e:00:00:00 dst mask ff:ff:ff:80:00:00 / end actions queue index 12 / end + testpmd> flow list 0 + + check the rule exists in the list. + +3. send matched packets:: + + sendp(Ether(dst="01:00:5e:00:00:00")/Raw("x"*80), iface="enp27s0f0", count=1) + sendp(Ether(dst="01:00:5e:7f:00:00")/IP()/Raw("x"*80), iface="enp27s0f0", count=1) + sendp(Ether(dst="01:00:5e:00:ff:00")/IP()/TCP()/Raw("x"*80), iface="enp27s0f0", count=1) + sendp(Ether(src="01:00:5e:00:00:01", dst="01:00:5e:00:00:ff")/IP()/UDP()/Raw("x"*80), iface="enp27s0f0", count=1) + + check all the packets received by queue 12. + send mismatched packets:: + + sendp(Ether(dst="01:00:5e:80:00:00")/Raw("x"*80), iface="enp27s0f0", count=1) + sendp(Ether(dst="01:00:ff:00:00:00")/IP()/Raw("x"*80), iface="enp27s0f0", count=1) + sendp(Ether(dst="01:ff:5e:00:ff:00")/IP()/TCP()/Raw("x"*80), iface="enp27s0f0", count=1) + sendp(Ether(dst="ff:00:5e:00:00:ff")/IP()/UDP()/Raw("x"*80), iface="enp27s0f0", count=1) + + check all the packets can't receive by queue 12. + +4. verify rules can be destroyed:: + + testpmd> flow destroy 0 rule 0 + testpmd> flow list 0 + + check the rule not exists in the list. + send matched packets, check all the packets can't receive by queue 12. + +subcase 2: mac src + mask + drop action +--------------------------------------- + +Test Steps +.......... +1. validate a rule:: + + testpmd> flow validate 0 ingress pattern eth src spec 01:00:5e:00:00:00 src mask ff:ff:ff:80:00:00 / end actions drop / end + + get the message:: + + Flow rule validated + + check the flow list:: + + testpmd> flow list 0 + + check the rule not exists in the list. + +2. create a rule:: + + testpmd> flow create 0 ingress pattern eth src spec 01:00:5e:00:00:00 src mask ff:ff:ff:80:00:00 / end actions drop / end + testpmd> flow list 0 + + check the rule exists in the list. + +3. send matched packets:: + + sendp(Ether(src="01:00:5e:00:00:00")/Raw("x"*80), iface="enp27s0f0", count=1) + sendp(Ether(src="01:00:5e:7f:00:00")/IP()/Raw("x"*80), iface="enp27s0f0", count=1) + sendp(Ether(src="01:00:5e:00:ff:00")/IP()/TCP()/Raw("x"*80), iface="enp27s0f0", count=1) + sendp(Ether(dst="01:00:5e:00:00:01", src="01:00:5e:00:00:ff")/IP()/UDP()/Raw("x"*80), iface="enp27s0f0", count=1) + + check all the packets are dropped. + send mismatched packets:: + + sendp(Ether(src="01:00:5e:80:00:00")/Raw("x"*80), iface="enp27s0f0", count=1) + sendp(Ether(src="01:00:ff:00:00:00")/IP()/Raw("x"*80), iface="enp27s0f0", count=1) + sendp(Ether(src="01:ff:5e:00:ff:00")/IP()/TCP()/Raw("x"*80), iface="enp27s0f0", count=1) + sendp(Ether(src="ff:00:5e:00:00:ff")/IP()/UDP()/Raw("x"*80), iface="enp27s0f0", count=1) + + check all the packets are not dropped. + +4. verify rules can be destroyed:: + + testpmd> flow destroy 0 rule 0 + testpmd> flow list 0 + + check the rule not exists in the list. + send matched packets, check all the packets are not dropped. \ No newline at end of file From patchwork Thu Jul 14 18:47:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jiale, SongX" X-Patchwork-Id: 113972 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 9A76CA034C; Thu, 14 Jul 2022 12:26:04 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 94EB342B73; Thu, 14 Jul 2022 12:26:04 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id DF82242B6D for ; Thu, 14 Jul 2022 12:26:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657794363; x=1689330363; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=kc0QAuXVbDjeIQAtJQUgkslqCRLpx+ngQRBkWcqXwOk=; b=SzLF3Lg7vXsRcn6LlcXkFS+AZYW/iCGkpM9QGfeSQuCHSGW+kdXxFMV+ zTVnYUdeNpzeoEJqxANsFRd8jq1uW9XFJkwvPjRd9TFEDJHjgdI8BpT/E s68SilIffeHgIORO9R2xMm30Yr/gTvMP+Y+iDo72ovXMQ9QnTY1pL9Qhf vGRfjukTa8YqVqk58570L+Mf9PKmJZ8Lj4W8ND1HDMWp5jq/YDghC/Mtk Iun34wJkzN1QVZLcgS3p2i2eBNFiFf8yG/G6zjsywmgoyFYG/yf+sxlRD 4WRYx3YC3s6/Nkm4nPVaJmLiMOMhxyLzin7qCY4qf18wMy8p3o6zHw1Wy A==; X-IronPort-AV: E=McAfee;i="6400,9594,10407"; a="311125400" X-IronPort-AV: E=Sophos;i="5.92,269,1650956400"; d="scan'208";a="311125400" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2022 03:26:02 -0700 X-IronPort-AV: E=Sophos;i="5.92,269,1650956400"; d="scan'208";a="653820623" Received: from unknown (HELO localhost.localdomain) ([10.239.252.94]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2022 03:26:00 -0700 From: Jiale Song To: dts@dpdk.org Cc: Jiale Song Subject: [dts] [PATCH V1 2/2] tests/ice_switch_filter: add 2 case Date: Thu, 14 Jul 2022 18:47:43 +0000 Message-Id: <20220714184743.14720-2-songx.jiale@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220714184743.14720-1-songx.jiale@intel.com> References: <20220714184743.14720-1-songx.jiale@intel.com> 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_multicast and test_l3_multicast. Signed-off-by: Jiale Song Tested-by: Zhimin Huang --- tests/TestSuite_ice_switch_filter.py | 175 ++++++++++++++++++++++++++- 1 file changed, 174 insertions(+), 1 deletion(-) diff --git a/tests/TestSuite_ice_switch_filter.py b/tests/TestSuite_ice_switch_filter.py index 76bd630f..39e25ef7 100644 --- a/tests/TestSuite_ice_switch_filter.py +++ b/tests/TestSuite_ice_switch_filter.py @@ -4230,6 +4230,167 @@ 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(dst="224.0.0.0")/Raw("x"*80)', + 'Ether()/IP(dst="224.0.0.255")/Raw("x"*80)', + 'Ether()/IP(src="192.168.0.1", dst="224.0.255.0")/Raw("x"*80)', + 'Ether()/IP(src="192.168.0.1", dst="224.255.0.0")/TCP()/Raw("x"*80)', + 'Ether()/IP(src="192.168.0.1", dst="239.0.0.0")/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": 5}, + }, + "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": 3}, + }, +} + +IPv6_MASK = { + "matched": [ + 'Ether()/IPv6(src="CDCD:910A:2222:5498:8475:1111:3900:2023")/("X"*480)', + 'Ether()/IPv6(src="CDCf:0:0:0:0:0:0:0")/("X"*480)', + 'Ether()/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:1515", src="CDC0:0:0:0:0:0:0:ffff")/("X"*480)', + 'Ether()/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:1515", src="CDC0:0:0:0:0:0:ffff:0")/("X"*480)', + 'Ether()/IPv6(src="CDC0:0:0:0:0:ffff:0:0")/UDP()/("X"*480)', + 'Ether()/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:1515", src="CDC0:0:0:0:ffff:0:0:0")/UDP()/("X"*480)', + 'Ether()/IPv6(src="CDC0:0:ffff:0:0:0:0:0")/TCP()/("X"*480)', + 'Ether()/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:1515", src="CDC0:ffff:0:0:0:0:0:0")/TCP()/("X"*480)', + ], + "mismatched": [ + 'Ether()/IPv6(src="CDDD:910A:2222:5498:8475:1111:3900:2023")/("X"*480)', + 'Ether()/IPv6(src="CFCD:910A:2222:5498:8475:1111:3900:2023")/UDP()/("X"*480)', + 'Ether()/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:1515", src="FDCD:0:0:0:0:0:0:ffff")/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 fff0:0:0:0: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": 8}, + }, + "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": 3}, + }, +} + +tvs_L3_multicast_non_pipeline_mode = [ + tv_ip_dst_mask_quest, + tv_ipv6_src_mask_drop, +] + +L2_DST_MASK = { + "matched": [ + 'Ether(dst="01:00:5e:00:00:00")/Raw("x"*80)', + 'Ether(dst="01:00:5e:7f:00:00")/IP()/Raw("x"*80)', + 'Ether(dst="01:00:5e:00:ff:00")/IP()/TCP()/Raw("x"*80)', + 'Ether(src="01:00:5e:00:00:01", dst="01:00:5e:00:00:ff")/IP()/UDP()/Raw("x"*80)', + ], + "mismatched": [ + 'Ether(dst="01:00:5e:80:00:00")/Raw("x"*80)', + 'Ether(dst="01:00:ff:00:00:00")/IP()/Raw("x"*80)', + 'Ether(dst="01:ff:5e:00:ff:00")/IP()/TCP()/Raw("x"*80)', + 'Ether(dst="ff:00:5e:00:00:ff")/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 01: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": 4}, + }, + "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": 4}, + }, +} + +L2_SRC_MASK = { + "matched": [ + 'Ether(src="01:00:5e:00:00:00")/Raw("x"*80)', + 'Ether(src="01:00:5e:7f:00:00")/IP()/Raw("x"*80)', + 'Ether(src="01:00:5e:00:ff:00")/IP()/TCP()/Raw("x"*80)', + 'Ether(dst="01:00:5e:00:00:01", src="01:00:5e:00:00:ff")/IP()/UDP()/Raw("x"*80)', + ], + "mismatched": [ + 'Ether(src="01:00:5e:80:00:00")/Raw("x"*80)', + 'Ether(src="01:00:ff:00:00:00")/IP()/Raw("x"*80)', + 'Ether(src="01:ff:5e:00:ff:00")/IP()/TCP()/Raw("x"*80)', + 'Ether(src="ff:00:5e:00:00:ff")/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 01: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": 4}, + }, + "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": 4}, + }, +} + +tvs_L2_multicast_non_pipeline_mode = [ + tv_eth_dst_mask_quest, + tv_eth_src_mask_drop, +] + test_results = OrderedDict() @@ -4273,7 +4434,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) @@ -5397,6 +5558,18 @@ class ICESwitchFilterTest(TestCase): not all(rule6), "all rules should create failed, result {}".format(rule6) ) + def test_l3_multicast(self): + """ + Test case: IP multicast + """ + self._rte_flow_validate_pattern(tvs_L3_multicast_non_pipeline_mode) + + def test_l2_multicast(self): + """ + Test case: L2 multicast + """ + self._rte_flow_validate_pattern(tvs_L2_multicast_non_pipeline_mode) + def tear_down(self): """ Run after each test case.