From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5AFF6A04EF; Mon, 1 Jun 2020 10:59:06 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0F8841C1E5; Mon, 1 Jun 2020 10:59:06 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id B11A41C10B for ; Mon, 1 Jun 2020 10:59:03 +0200 (CEST) IronPort-SDR: w9yHTp9+6cEGxvWrmrGifdIjr0MjTPyKvy12r/yNcYzxqpKymGF6G2x0vAIG5h8dE5+eR8UQqb t0SmOJIK/8EQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jun 2020 01:59:03 -0700 IronPort-SDR: dj3XvU26abvbDerggAU+cXFrfWoMwWD57Xr/8u2M0KBv2L6J3A0romsY7/swLsCIPMnm8JTZ8/ 7cD51QSIHxZg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,460,1583222400"; d="scan'208";a="346972044" Received: from unknown (HELO xqm-virtio_tester.sh.intel.com) ([10.240.183.52]) by orsmga001.jf.intel.com with ESMTP; 01 Jun 2020 01:59:00 -0700 From: Xiao Qimai To: dts@dpdk.org Cc: Xiao Qimai Date: Mon, 1 Jun 2020 16:51:08 +0800 Message-Id: <1591001469-51901-3-git-send-email-qimaix.xiao@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1591001469-51901-1-git-send-email-qimaix.xiao@intel.com> References: <1591001469-51901-1-git-send-email-qimaix.xiao@intel.com> Subject: [dts] [PATCH V1 2/3]tests/TestSuite_cvl_fdir: update cvl fdir script X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 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" Signed-off-by: Xiao Qimai --- tests/TestSuite_cvl_fdir.py | 2466 ++++++++++++++++++++++++++++--------------- 1 file changed, 1588 insertions(+), 878 deletions(-) diff --git a/tests/TestSuite_cvl_fdir.py b/tests/TestSuite_cvl_fdir.py index a8e3ef8..5047231 100644 --- a/tests/TestSuite_cvl_fdir.py +++ b/tests/TestSuite_cvl_fdir.py @@ -32,6 +32,8 @@ import re import time +import copy +import os from packet import Packet from pmd_output import PmdOutput @@ -45,7 +47,7 @@ MAC_IPV4_PAY = { "match": [ 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.20",dst="192.168.0.21", proto=255, ttl=2, tos=4) / Raw("x" * 80)', 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.20",dst="192.168.0.21", frag=1, proto=255, ttl=2, tos=4)/Raw("x" * 80)'], - "unmatch": [ + "unmatched": [ 'Ether(dst="00:11:22:33:44:56")/IP(src="192.168.0.20",dst="192.168.0.22", proto=255, ttl=2, tos=4) / Raw("x" * 80)', 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.22",dst="192.168.0.21", proto=255, ttl=2, tos=4) / Raw("x" * 80)', 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.20",dst="192.168.1.21", proto=255, ttl=2, tos=4) / Raw("x" * 80)', @@ -57,17 +59,24 @@ MAC_IPV4_PAY = { MAC_IPV4_PAY_SELECTED = { "match": [ - 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.20",dst="192.168.0.21", proto=1) / Raw("x" * 80)', - 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.20",dst="192.168.0.21", ttl=2, tos=4) /UDP(sport=22,dport=23)/Raw("x" * 80)'], - "unmatch": [ - 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.20",dst="192.168.0.22") / Raw("x" * 80)' + 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.20",dst="192.168.0.21", proto=1)/Raw("x" * 80)', + 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.20",dst="192.168.0.21", frag=1, proto=1)/Raw("x" * 80)', + 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.20",dst="192.168.0.21", ttl=2, tos=4)/UDP(sport=22,dport=23)/Raw("x" * 80)', + 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.20",dst="192.168.0.21", frag=1, ttl=2, tos=4)/UDP(sport=22,dport=23)/Raw("x" * 80)', + 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.20",dst="192.168.0.21", proto=17, ttl=2, tos=4)/Raw("x" * 80)', + 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.20",dst="192.168.0.21", frag=1, proto=17, ttl=2, tos=4)/Raw("x" * 80)'], + "unmatched": [ + 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.20",dst="192.168.0.22", proto=1)/Raw("x" * 80)', + 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.20",dst="192.168.0.21", proto=6)/Raw("x" * 80)', + 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.20",dst="192.168.0.21")/TCP(sport=22,dport=23)/Raw("x" * 80)', + 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.20",dst="192.168.0.21", frag=1)/TCP(sport=22,dport=23)/Raw("x" * 80)' ] } MAC_IPV4_UDP = { "match": [ 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.20",dst="192.168.0.21", ttl=2, tos=4) /UDP(sport=22,dport=23)/Raw("x" * 80)'], - "unmatch": [ + "unmatched": [ 'Ether(dst="00:11:22:33:44:56")/IP(src="192.168.0.20",dst="192.168.0.21", ttl=2, tos=4) /UDP(sport=22,dport=23)/Raw("x" * 80)', 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.1.19",dst="192.168.0.21", ttl=2, tos=4) /UDP(sport=22,dport=23)/Raw("x" * 80)', 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.20",dst="192.168.0.22", ttl=2, tos=4) /UDP(sport=22,dport=23)/Raw("x" * 80)', @@ -81,7 +90,7 @@ MAC_IPV4_UDP = { MAC_IPV4_TCP = { "match": [ 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.20",dst="192.168.0.21", ttl=2, tos=4) /TCP(sport=22,dport=23)/Raw("x" * 80)'], - "unmatch": [ + "unmatched": [ 'Ether(dst="00:11:22:33:44:56")/IP(src="192.168.0.20",dst="192.168.0.21", ttl=2, tos=4) /TCP(sport=22,dport=23)/Raw("x" * 80)', 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.1.19",dst="192.168.0.21", ttl=2, tos=4) /TCP(sport=22,dport=23)/Raw("x" * 80)', 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.20",dst="192.168.0.22", ttl=2, tos=4) /TCP(sport=22,dport=23)/Raw("x" * 80)', @@ -95,7 +104,7 @@ MAC_IPV4_TCP = { MAC_IPV4_SCTP = { "match": [ 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.20",dst="192.168.0.21", ttl=2, tos=4) /SCTP(sport=22,dport=23)/Raw("x" * 80)'], - "unmatch": [ + "unmatched": [ 'Ether(dst="00:11:22:33:44:56")/IP(src="192.168.0.20",dst="192.168.0.21", ttl=2, tos=4) /SCTP(sport=22,dport=23)/Raw("x" * 80)', 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.1.19",dst="192.168.0.21", ttl=2, tos=4) /SCTP(sport=22,dport=23)/Raw("x" * 80)', 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.20",dst="192.168.0.22", ttl=2, tos=4) /SCTP(sport=22,dport=23)/Raw("x" * 80)', @@ -108,29 +117,33 @@ MAC_IPV4_SCTP = { MAC_IPV6_PAY = { "match": [ - 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", src="2001::2", nh=1, tc=1, hlim=2)/("X"*480)', - 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", src="2001::2", nh=1, tc=1, hlim=2)/IPv6ExtHdrFragment(1000)/("X"*480)'], - "unmatch": [ - 'Ether(dst="00:11:22:33:44:56")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", src="2001::2", nh=1, tc=1, hlim=2)/("X"*480)', - 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2022", src="2001::2", nh=1, tc=1, hlim=2)/("X"*480)', - 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", src="2001::1", nh=1, tc=1, hlim=2)/("X"*480)', + 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", src="2001::2", nh=0, tc=1, hlim=2)/("X"*480)'], + "unmatched": [ + 'Ether(dst="00:11:22:33:44:56")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", src="2001::2", nh=0, tc=1, hlim=2)/("X"*480)', + 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2022", src="2001::2", nh=0, tc=1, hlim=2)/("X"*480)', + 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", src="2001::1", nh=0, tc=1, hlim=2)/("X"*480)', 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", src="2001::2", nh=2, tc=1, hlim=2)/("X"*480)', - 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", src="2001::2", nh=1, tc=2, hlim=2)/("X"*480)', - 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", src="2001::2", nh=1, tc=1, hlim=5)/("X"*480)'] + 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", src="2001::2", nh=0, tc=2, hlim=2)/("X"*480)', + 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", src="2001::2", nh=0, tc=1, hlim=5)/("X"*480)'] } MAC_IPV6_PAY_SELECTED = { "match": [ - 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", src="2001::2", nh=1, tc=1, hlim=2)/("X"*480)', - 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020")/IPv6ExtHdrFragment(1000)/("X"*480)'], - "unmatch": [ - 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2021")/("X"*480)'] + 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", src="2001::2", nh=44, tc=1, hlim=2)/("X"*480)', + 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020")/IPv6ExtHdrFragment(id=1000)/("X"*480)', + 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", nh=44)/TCP(sport=22,dport=23)/("X"*480)', + 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020")/IPv6ExtHdrFragment(id=1000)/TCP(sport=22,dport=23)/("X"*480)', + 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", nh=6)/("X"*480)', + 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020")/TCP(sport=22,dport=23)/("X"*480)'], + "unmatched": ['Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2021", nh=44)/("X"*480)', + 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020")/UDP(sport=22,dport=23)/("X"*480)', + 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", nh=17)/("X"*480)'] } MAC_IPV6_UDP = { "match": [ 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", src="2001::2",tc=1, hlim=2)/UDP(sport=22,dport=23)/("X"*480)'], - "unmatch": [ + "unmatched": [ 'Ether(dst="00:11:22:33:44:56")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", src="2001::2",tc=1, hlim=2)/UDP(sport=22,dport=23)/("X"*480)', 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2021", src="2001::2",tc=1, hlim=2)/UDP(sport=22,dport=23)/("X"*480)', 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", src="2002::2",tc=1, hlim=2)/UDP(sport=22,dport=23)/("X"*480)', @@ -144,7 +157,7 @@ MAC_IPV6_UDP = { MAC_IPV6_TCP = { "match": [ 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", src="2001::2",tc=1, hlim=2)/TCP(sport=22,dport=23)/("X"*480)'], - "unmatch": [ + "unmatched": [ 'Ether(dst="00:11:22:33:44:56")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", src="2001::2",tc=1, hlim=2)/TCP(sport=22,dport=23)/("X"*480)', 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2021", src="2001::2",tc=1, hlim=2)/TCP(sport=22,dport=23)/("X"*480)', 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", src="2002::2",tc=1, hlim=2)/TCP(sport=22,dport=23)/("X"*480)', @@ -158,7 +171,7 @@ MAC_IPV6_TCP = { MAC_IPV6_SCTP = { "match": [ 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", src="2001::2",tc=1, hlim=2)/SCTP(sport=22,dport=23)/("X"*480)'], - "unmatch": [ + "unmatched": [ 'Ether(dst="00:11:22:33:44:56")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", src="2001::2",tc=1, hlim=2)/SCTP(sport=22,dport=23)/("X"*480)', 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2021", src="2001::2",tc=1, hlim=2)/SCTP(sport=22,dport=23)/("X"*480)', 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", src="2002::2",tc=1, hlim=2)/SCTP(sport=22,dport=23)/("X"*480)', @@ -178,7 +191,7 @@ MAC_IPV4_TUN_IPV4_PAY_MAC_IPV4_TUN_MAC_IPV4_PAY = { 'Ether(dst="00:11:22:33:44:55")/IP()/UDP(sport=200, dport=4790)/VXLAN(flags=0xc)/IP(src="192.168.0.20", dst="192.168.0.21", frag=1)', 'Ether(dst="00:11:22:33:44:55")/IP()/UDP()/VXLAN(vni=2)/Ether(dst="00:11:22:33:44:55")/IP(dst="192.168.0.21", src="192.168.0.20")/("X"*480)' ], - "unmatch": [ + "unmatched": [ 'Ether(dst="00:11:22:33:44:55")/IP(dst="192.168.1.15")/UDP(sport=200, dport=4790)/VXLAN(flags=0xc)/IP(src="192.168.0.20", dst="192.168.0.22")', 'Ether(dst="00:11:22:33:44:55")/IP(dst="192.168.1.15")/UDP(sport=200, dport=4790)/VXLAN(flags=0xc)/IP(src="192.168.0.30", dst="192.168.0.21")', 'Ether(dst="00:11:22:33:44:55")/IP()/UDP()/VXLAN()/IP(dst="192.168.0.21", src="192.168.0.20")/("X"*480)'] @@ -190,7 +203,7 @@ MAC_IPV4_TUN_IPV4_UDP_MAC_IPV4_TUN_MAC_IPV4_UDP = { 'Ether(dst="00:11:22:33:44:55")/IP()/UDP(sport=200, dport=4790)/VXLAN(flags=0xc)/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(sport=22,dport=23)/("X"*480)', 'Ether(dst="00:11:22:33:44:55")/IP(dst="192.168.1.15")/UDP(sport=200, dport=4790)/VXLAN(flags=0xc)/Ether()/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(sport=22,dport=23)/("X"*480)', 'Ether(dst="00:11:22:33:44:55")/IP()/UDP()/VXLAN(vni=2)/Ether(dst="00:11:22:33:44:55")/IP(dst="192.168.0.21", src="192.168.0.20")/UDP(sport=22,dport=23)/("X"*480)'], - "unmatch": [ + "unmatched": [ 'Ether(dst="00:11:22:33:44:55")/IP(dst="192.168.1.15")/UDP(sport=200, dport=4790)/VXLAN(flags=0xc)/IP(src="192.168.0.20", dst="192.168.0.22")/UDP(sport=22,dport=23)/("X"*480)', 'Ether(dst="00:11:22:33:44:55")/IP()/UDP()/VXLAN(vni=2)/Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.21", dst="192.168.0.23")/UDP(sport=22,dport=23)/("X"*480)', 'Ether(dst="00:11:22:33:44:55")/IP()/UDP(sport=200, dport=4790)/VXLAN(flags=0xc)/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(sport=21,dport=23)/("X"*480)', @@ -206,7 +219,7 @@ MAC_IPV4_TUN_IPV4_TCP_MAC_IPV4_TUN_MAC_IPV4_TCP = { 'Ether(dst="00:11:22:33:44:55")/IP()/UDP(sport=200, dport=4790)/VXLAN(flags=0xc)/IP(src="192.168.0.20", dst="192.168.0.21")/TCP(sport=22,dport=23)/("X"*480)', 'Ether(dst="00:11:22:33:44:55")/IP(dst="192.168.1.15")/UDP(sport=200, dport=4790)/VXLAN(flags=0xc)/Ether()/IP(src="192.168.0.20", dst="192.168.0.21")/TCP(sport=22,dport=23)/("X"*480)', 'Ether(dst="00:11:22:33:44:55")/IP()/UDP()/VXLAN(vni=2)/Ether(dst="00:11:22:33:44:55")/IP(dst="192.168.0.21", src="192.168.0.20")/TCP(sport=22,dport=23)/("X"*480)'], - "unmatch": [ + "unmatched": [ 'Ether(dst="00:11:22:33:44:55")/IP(dst="192.168.1.15")/UDP(sport=200, dport=4790)/VXLAN(flags=0xc)/IP(src="192.168.0.20", dst="192.168.0.22")/TCP(sport=22,dport=23)/("X"*480)', 'Ether(dst="00:11:22:33:44:55")/IP()/UDP()/VXLAN(vni=2)/Ether(dst="00:11:22:33:44:55")/IP(dst="192.168.0.21", src="192.168.0.23")/TCP(sport=22,dport=23)/("X"*480)', 'Ether(dst="00:11:22:33:44:55")/IP()/UDP(sport=200, dport=4790)/VXLAN(flags=0xc)/IP(src="192.168.0.20", dst="192.168.0.21")/TCP(sport=21,dport=23)/("X"*480)', @@ -221,7 +234,7 @@ MAC_IPV4_TUN_IPV4_SCTP_MAC_IPV4_TUN_MAC_IPV4_SCTP = { 'Ether(dst="00:11:22:33:44:55")/IP()/UDP(sport=200, dport=4790)/VXLAN(flags=0xc)/IP(src="192.168.0.20", dst="192.168.0.21")/SCTP(sport=22,dport=23)/("X"*480)', 'Ether(dst="00:11:22:33:44:55")/IP(dst="192.168.1.15")/UDP(sport=200, dport=4790)/VXLAN(flags=0xc)/Ether()/IP(src="192.168.0.20", dst="192.168.0.21")/SCTP(sport=22,dport=23)/("X"*480)', 'Ether(dst="00:11:22:33:44:55")/IP()/UDP()/VXLAN(vni=2)/Ether(dst="00:11:22:33:44:55")/IP(dst="192.168.0.21", src="192.168.0.20")/SCTP(sport=22,dport=23)/("X"*480)'], - "unmatch": [ + "unmatched": [ 'Ether(dst="00:11:22:33:44:55")/IP(dst="192.168.1.15")/UDP(sport=200, dport=4790)/VXLAN(flags=0xc)/IP(src="192.168.0.20", dst="192.168.0.22")/SCTP(sport=22,dport=23)/("X"*480)', 'Ether(dst="00:11:22:33:44:55")/IP()/UDP()/VXLAN(vni=2)/Ether(dst="00:11:22:33:44:55")/IP(dst="192.168.0.21", src="192.168.0.23")/SCTP(sport=22,dport=23)/("X"*480)', 'Ether(dst="00:11:22:33:44:55")/IP()/UDP(sport=200, dport=4790)/VXLAN(flags=0xc)/IP(src="192.168.0.20", dst="192.168.0.21")/SCTP(sport=21,dport=23)/("X"*480)', @@ -230,657 +243,1006 @@ MAC_IPV4_TUN_IPV4_SCTP_MAC_IPV4_TUN_MAC_IPV4_SCTP = { 'Ether(dst="00:11:22:33:44:55")/IP()/UDP()/VXLAN()/IP(dst="192.168.0.21", src="192.168.0.20")/SCTP(sport=22,dport=23)/("X"*480)'] } -MAC_IPV4_GTPU_IPV4_PAY = { +MAC_IPV4_GTPU_EH = { + "match": [ + 'Ether(src="a4:bf:01:51:27:ca", dst="00:11:22:33:44:55")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/GTP_PDUSession_ExtensionHeader(pdu_type=0, qos_flow=0x34)/IP()/Raw("x"*20)', + 'Ether(src="a4:bf:01:51:27:ca", dst="00:11:22:33:44:55")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/GTP_PDUSession_ExtensionHeader(pdu_type=0, qos_flow=0x34)/IP(frag=1)/Raw("x"*20)', + 'Ether(src="a4:bf:01:51:27:ca", dst="00:11:22:33:44:55")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/GTP_PDUSession_ExtensionHeader(pdu_type=0, qos_flow=0x34)/IP()/UDP()/Raw("x"*20)', + 'Ether(src="a4:bf:01:51:27:ca", dst="00:11:22:33:44:55")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP( dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/GTP_PDUSession_ExtensionHeader(pdu_type=0, qos_flow=0x34)/IP()/TCP(sport=22, dport=23)/Raw("x"*20)', + 'Ether(src="a4:bf:01:51:27:ca", dst="00:11:22:33:44:55")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/GTP_PDUSession_ExtensionHeader(pdu_type=0, qos_flow=0x34)/IP()/ICMP()/Raw("x"*20)', + 'Ether(src="a4:bf:01:51:27:ca", dst="00:11:22:33:44:55")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/GTP_PDUSession_ExtensionHeader(pdu_type=0, qos_flow=0x34)/IPv6()/Raw("x"*20)', + 'Ether(src="a4:bf:01:51:27:ca", dst="00:11:22:33:44:55")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/GTP_PDUSession_ExtensionHeader(pdu_type=0, qos_flow=0x34)/IPv6()/IPv6ExtHdrFragment(id=1000)/Raw("x"*20)', + 'Ether(src="a4:bf:01:51:27:ca", dst="00:11:22:33:44:55")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/GTP_PDUSession_ExtensionHeader(pdu_type=0, qos_flow=0x34)/IPv6()/UDP()/Raw("x"*20)', + 'Ether(src="a4:bf:01:51:27:ca", dst="00:11:22:33:44:55")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP( dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/GTP_PDUSession_ExtensionHeader(pdu_type=0, qos_flow=0x34)/IPv6()/TCP(sport=22, dport=23)/Raw("x"*20)', + 'Ether(src="a4:bf:01:51:27:ca", dst="00:11:22:33:44:55")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/GTP_PDUSession_ExtensionHeader(pdu_type=0, qos_flow=0x34)/IPv6()/ICMP()/Raw("x"*20)'], + "unmatched": [ + 'Ether(src="a4:bf:01:51:27:ca", dst="00:11:22:33:44:55")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/GTP_PDUSession_ExtensionHeader(pdu_type=0, qos_flow=0x34)/IP()/SCTP()/Raw("x"*20)', + 'Ether(src="a4:bf:01:51:27:ca", dst="00:11:22:33:44:55")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/GTP_PDUSession_ExtensionHeader(pdu_type=0, qos_flow=0x34)/IPv6()/SCTP()/Raw("x"*20)', + 'Ether(src="a4:bf:01:51:27:ca", dst="00:11:22:33:44:55")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x1234567)/GTP_PDUSession_ExtensionHeader(pdu_type=0, qos_flow=0x34)/IP()/Raw("x"*20)', + 'Ether(src="a4:bf:01:51:27:ca", dst="00:11:22:33:44:55")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/GTP_PDUSession_ExtensionHeader(pdu_type=0, qos_flow=0x35)/IP()/Raw("x"*20)', + 'Ether(src="a4:bf:01:51:27:ca", dst="00:11:22:33:44:55")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/IP()/Raw("x"*20)', + 'Ether(src="a4:bf:01:51:27:ca", dst="00:11:22:33:44:55")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/GTP_PDUSession_ExtensionHeader(pdu_type=0, qos_flow=0x34)/Raw("x"*20)'] +} + +MAC_IPV4_GTPU = { "match": [ - 'Ether(src="a4:bf:01:51:27:ca", dst="00:00:00:00:01:03")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/GTP_PDUSession_ExtensionHeader(pdu_type=0, qos_flow=0x34)/IP()/Raw("x"*20)', - 'Ether(src="a4:bf:01:51:27:ca", dst="00:00:00:00:01:03")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/GTP_PDUSession_ExtensionHeader(pdu_type=0, qos_flow=0x34)/IP(frag=1)/Raw("x"*20)', - 'Ether(src="a4:bf:01:51:27:ca", dst="00:00:00:00:01:03")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/GTP_PDUSession_ExtensionHeader(pdu_type=0, qos_flow=0x34)/IP()/UDP()/Raw("x"*20)', - 'Ether(src="a4:bf:01:51:27:ca", dst="00:00:00:00:01:03")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP( dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/GTP_PDUSession_ExtensionHeader(pdu_type=0, qos_flow=0x34)/IP()/TCP(sport=22, dport=23)/Raw("x"*20)', - 'Ether(src="a4:bf:01:51:27:ca", dst="00:00:00:00:01:03")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/GTP_PDUSession_ExtensionHeader(pdu_type=0, qos_flow=0x34)/IP()/ICMP()/Raw("x"*20)'], - "unmatch": [ - 'Ether(src="a4:bf:01:51:27:ca", dst="00:00:00:00:01:03")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/GTP_PDUSession_ExtensionHeader(pdu_type=0, qos_flow=0x34)/IP()/SCTP()/Raw("x"*20)', - 'Ether(src="a4:bf:01:51:27:ca", dst="00:00:00:00:01:03")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x1234567)/GTP_PDUSession_ExtensionHeader(pdu_type=0, qos_flow=0x34)/IP()/Raw("x"*20)', - 'Ether(src="a4:bf:01:51:27:ca", dst="00:00:00:00:01:03")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/GTP_PDUSession_ExtensionHeader(pdu_type=0, qos_flow=0x35)/IP()/Raw("x"*20)', - 'Ether(src="a4:bf:01:51:27:ca", dst="00:00:00:00:01:03")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/GTP_PDUSession_ExtensionHeader(pdu_type=0, qos_flow=0x34)/IPv6()/Raw("x"*20)'] + 'Ether(src="a4:bf:01:51:27:ca", dst="00:11:22:33:44:55")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/IP()/Raw("x"*20)', + 'Ether(src="a4:bf:01:51:27:ca", dst="00:11:22:33:44:55")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/IP(frag=1)/Raw("x"*20)', + 'Ether(src="a4:bf:01:51:27:ca", dst="00:11:22:33:44:55")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/IP()/UDP()/Raw("x"*20)', + 'Ether(src="a4:bf:01:51:27:ca", dst="00:11:22:33:44:55")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP( dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/IP()/TCP(sport=22, dport=23)/Raw("x"*20)', + 'Ether(src="a4:bf:01:51:27:ca", dst="00:11:22:33:44:55")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/IP()/ICMP()/Raw("x"*20)', + 'Ether(src="a4:bf:01:51:27:ca", dst="00:11:22:33:44:55")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/IPv6()/Raw("x"*20)', + 'Ether(src="a4:bf:01:51:27:ca", dst="00:11:22:33:44:55")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/IPv6()/IPv6ExtHdrFragment(id=1000)/Raw("x"*20)', + 'Ether(src="a4:bf:01:51:27:ca", dst="00:11:22:33:44:55")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/IPv6()/UDP()/Raw("x"*20)', + 'Ether(src="a4:bf:01:51:27:ca", dst="00:11:22:33:44:55")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP( dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/IPv6()/TCP(sport=22, dport=23)/Raw("x"*20)', + 'Ether(src="a4:bf:01:51:27:ca", dst="00:11:22:33:44:55")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/IPv6()/ICMP()/Raw("x"*20)', + 'Ether(src="a4:bf:01:51:27:ca", dst="00:11:22:33:44:55")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/GTP_PDUSession_ExtensionHeader(pdu_type=0, qos_flow=0x35)/IP()/Raw("x"*20)'], + "unmatched": [ + 'Ether(src="a4:bf:01:51:27:ca", dst="00:11:22:33:44:55")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/Raw("x"*20)', + 'Ether(src="a4:bf:01:51:27:ca", dst="00:11:22:33:44:55")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/IP()/SCTP()/Raw("x"*20)', + 'Ether(src="a4:bf:01:51:27:ca", dst="00:11:22:33:44:55")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/IPv6()/SCTP()/Raw("x"*20)', + 'Ether(src="a4:bf:01:51:27:ca", dst="00:11:22:33:44:55")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x1234567)/IP()/Raw("x"*20)'] } tv_mac_ipv4_pay_queue_index = { "name": "test_mac_ipv4_pay_queue_index", "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 proto is 255 ttl is 2 tos is 4 / end actions queue index 1 / end", "scapy_str": MAC_IPV4_PAY, - "check_func": rfc.check_queue, + "check_func": rfc.check_mark, "check_param": {"port_id": 0, "queue": 1} } -tv_mac_ipv4_pay_selected_inputset_queue_index = { - "name": "test_mac_ipv4_pay_selected_inputset_queue_index", - "rule": "flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.21 / end actions queue index 1 / end", - "scapy_str": MAC_IPV4_PAY_SELECTED, - "check_func": rfc.check_queue, - "check_param": {"port_id": 0, "queue": 1} +tv_mac_ipv4_pay_rss_queues = { + "name": "test_mac_ipv4_pay_rss_queues", + "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 proto is 255 ttl is 2 tos is 4 / end actions rss queues 2 3 end / end", + "scapy_str": MAC_IPV4_PAY, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "queue": [2, 3]} } -tv_mac_ipv4_udp_queue_index = { - "name": "test_mac_ipv4_upd_queue_index", - "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 ttl is 2 tos is 4 / udp src is 22 dst is 23 / end actions queue index 1 / end", - "scapy_str": MAC_IPV4_UDP, - "check_func": rfc.check_queue, - "check_param": {"port_id": 0, "queue": 1} +tv_mac_ipv4_pay_passthru = { + "name": "test_mac_ipv4_pay_passthru", + "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 proto is 255 ttl is 2 tos is 4 / end actions passthru / end", + "scapy_str": MAC_IPV4_PAY, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "rss": True} } -tv_mac_ipv4_tcp_queue_index = { - "name": "test_mac_ipv4_tcp_queue_index", - "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 ttl is 2 tos is 4 / tcp src is 22 dst is 23 / end actions queue index 63 / end", - "scapy_str": MAC_IPV4_TCP, - "check_func": rfc.check_queue, - "check_param": {"port_id": 0, "queue": 63} +tv_mac_ipv4_pay_drop = { + "name": "test_mac_ipv4_pay_drop", + "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 proto is 255 ttl is 2 tos is 4 / end actions drop / end", + "scapy_str": MAC_IPV4_PAY, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "drop": True} } -tv_mac_ipv4_sctp_queue_index = { - "name": "test_mac_ipv4_sctp_queue_index", - "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 ttl is 2 tos is 4 / sctp src is 22 dst is 23 tag is 1 / end actions queue index 2 / end", - "scapy_str": MAC_IPV4_SCTP, - "check_func": rfc.check_queue, - "check_param": {"port_id": 0, "queue": 2} +tv_mac_ipv4_pay_mark_rss = { + "name": "test_mac_ipv4_pay_mark_rss", + "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 proto is 255 ttl is 2 tos is 4 / end actions mark / rss / end", + "scapy_str": MAC_IPV4_PAY, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "mark_id": 0, "rss": True} } -tv_mac_ipv6_pay_queue_index = { - "name": "test_mac_ipv6_pay_queue_index", - "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 proto is 1 hop is 2 tc is 1 / end actions queue index 1 / end", - "scapy_str": MAC_IPV6_PAY, - "check_func": rfc.check_queue, - "check_param": {"port_id": 0, "queue": 1} +tv_mac_ipv4_pay_mark = { + "name": "test_mac_ipv4_pay_mark", + "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 proto is 255 ttl is 2 tos is 4 / end actions mark id 1 / end", + "scapy_str": MAC_IPV4_PAY, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "mark_id": 1, "rss": True} } -tv_mac_ipv6_pay_selected_inputset_queue_index = { - "name": "test_mac_ipv6_pay_selected_inputset_queue_index", - "rule": "flow create 0 ingress pattern eth / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 / end actions queue index 1 / end", - "scapy_str": MAC_IPV6_PAY_SELECTED, - "check_func": rfc.check_queue, - "check_param": {"port_id": 0, "queue": 1} +vectors_ipv4_pay = [tv_mac_ipv4_pay_queue_index, tv_mac_ipv4_pay_rss_queues, tv_mac_ipv4_pay_passthru, + tv_mac_ipv4_pay_drop, tv_mac_ipv4_pay_mark_rss, tv_mac_ipv4_pay_mark] + +tv_mac_ipv4_udp_queue_index = { + "name": "test_mac_ipv4_udp_queue_index", + "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 ttl is 2 tos is 4 / udp src is 22 dst is 23 / end actions queue index 63 / mark id 0 / end", + "scapy_str": MAC_IPV4_UDP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "queue": 63, "mark_id": 0} } -tv_mac_ipv6_udp_queue_index = { - "name": "test_mac_ipv6_udp_queue_index", - "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 hop is 2 tc is 1 / udp src is 22 dst is 23 / end actions queue index 1 / end", - "scapy_str": MAC_IPV6_UDP, - "check_func": rfc.check_queue, - "check_param": {"port_id": 0, "queue": 1} +tv_mac_ipv4_udp_rss_queues = { + "name": "test_mac_ipv4_udp_rss_queues", + "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 ttl is 2 tos is 4 / udp src is 22 dst is 23 / end actions rss queues 0 1 2 3 end / mark id 4294967294 / end", + "scapy_str": MAC_IPV4_UDP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "queue": [0, 1, 2, 3], "mark_id": 4294967294} } -tv_mac_ipv6_tcp_queue_index = { - "name": "test_mac_ipv6_tcp_queue_index", - "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 hop is 2 tc is 1 / tcp src is 22 dst is 23 / end actions queue index 1 / end", - "scapy_str": MAC_IPV6_TCP, - "check_func": rfc.check_queue, - "check_param": {"port_id": 0, "queue": 1} +tv_mac_ipv4_udp_passthru = { + "name": "test_mac_ipv4_udp_passthru", + "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 ttl is 2 tos is 4 / udp src is 22 dst is 23 / end actions passthru / mark id 1 / end", + "scapy_str": MAC_IPV4_UDP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "mark_id": 1, "rss": True} } -tv_mac_ipv6_sctp_queue_index = { - "name": "test_mac_ipv6_sctp_queue_index", - "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 hop is 2 tc is 1 / sctp src is 22 dst is 23 / end actions queue index 1 / end", - "scapy_str": MAC_IPV6_SCTP, - "check_func": rfc.check_queue, - "check_param": {"port_id": 0, "queue": 1} +tv_mac_ipv4_udp_drop = { + "name": "test_mac_ipv4_udp_drop", + "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 ttl is 2 tos is 4 / udp src is 22 dst is 23 / end actions drop / end", + "scapy_str": MAC_IPV4_UDP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "drop": True} } -tv_mac_ipv4_tun_ipv4_pay_queue_index = { - "name": "test_mac_ipv4_tun_ipv4_pay_queue_index", - "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / end actions queue index 1 / end", - "scapy_str": MAC_IPV4_TUN_IPV4_PAY_MAC_IPV4_TUN_MAC_IPV4_PAY, - "check_func": rfc.check_queue, - "check_param": {"port_id": 0, "queue": 1} +tv_mac_ipv4_udp_mark_rss = { + "name": "test_mac_ipv4_udp_mark_rss", + "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 ttl is 2 tos is 4 / udp src is 22 dst is 23 / end actions mark id 2 / rss / end", + "scapy_str": MAC_IPV4_UDP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "mark_id": 2, "rss": True} } -tv_mac_ipv4_tun_ipv4_udp_queue_index = { - "name": "test_mac_ipv4_tun_ipv4_udp_queue_index", - "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / udp src is 22 dst is 23 / end actions queue index 1 / end", - "scapy_str": MAC_IPV4_TUN_IPV4_UDP_MAC_IPV4_TUN_MAC_IPV4_UDP, - "check_func": rfc.check_queue, - "check_param": {"port_id": 0, "queue": 1} +tv_mac_ipv4_udp_mark = { + "name": "test_mac_ipv4_udp_mark", + "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 ttl is 2 tos is 4 / udp src is 22 dst is 23 / end actions mark id 1 / end", + "scapy_str": MAC_IPV4_UDP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "mark_id": 1} } -tv_mac_ipv4_tun_ipv4_tcp_queue_index = { - "name": "test_mac_ipv4_tun_ipv4_tcp_queue_index", - "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / tcp src is 22 dst is 23 / end actions queue index 1 / end", - "scapy_str": MAC_IPV4_TUN_IPV4_TCP_MAC_IPV4_TUN_MAC_IPV4_TCP, - "check_func": rfc.check_queue, - "check_param": {"port_id": 0, "queue": 1} +vectors_ipv4_udp = [tv_mac_ipv4_udp_queue_index, tv_mac_ipv4_udp_rss_queues, tv_mac_ipv4_udp_passthru, + tv_mac_ipv4_udp_drop, tv_mac_ipv4_udp_mark_rss, tv_mac_ipv4_udp_mark] + +tv_mac_ipv4_tcp_queue_index = { + "name": "test_mac_ipv4_tcp_queue_index", + "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 ttl is 2 tos is 4 / tcp src is 22 dst is 23 / end actions queue index 63 / mark id 0 / end", + "scapy_str": MAC_IPV4_TCP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "queue": 63, "mark_id": 0} } -tv_mac_ipv4_tun_ipv4_sctp_queue_index = { - "name": "test_mac_ipv4_tun_ipv4_sctp_queue_index", - "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / sctp src is 22 dst is 23 / end actions queue index 1 / end", - "scapy_str": MAC_IPV4_TUN_IPV4_SCTP_MAC_IPV4_TUN_MAC_IPV4_SCTP, - "check_func": rfc.check_queue, - "check_param": {"port_id": 0, "queue": 1} +tv_mac_ipv4_tcp_rss_queues = { + "name": "test_mac_ipv4_tcp_rss_queues", + "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 ttl is 2 tos is 4 / tcp src is 22 dst is 23 / end actions rss queues 0 1 2 3 end / mark id 4294967294 / end", + "scapy_str": MAC_IPV4_TCP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "queue": [0, 1, 2, 3], "mark_id": 4294967294} } -tv_mac_ipv4_tun_mac_ipv4_pay_queue_index = { - "name": "test_mac_ipv4_tun_mac_ipv4_pay_queue_index", - "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / end actions queue index 1 / end", - "scapy_str": MAC_IPV4_TUN_IPV4_PAY_MAC_IPV4_TUN_MAC_IPV4_PAY, - "check_func": rfc.check_queue, - "check_param": {"port_id": 0, "queue": 1} +tv_mac_ipv4_tcp_passthru = { + "name": "test_mac_ipv4_tcp_passthru", + "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 ttl is 2 tos is 4 / tcp src is 22 dst is 23 / end actions passthru / mark id 1 / end", + "scapy_str": MAC_IPV4_TCP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "mark_id": 1, "rss": True} } -tv_mac_ipv4_tun_mac_ipv4_udp_queue_index = { - "name": "test_mac_ipv4_tun_mac_ipv4_udp_queue_index", - "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / udp src is 22 dst is 23 / end actions queue index 1 / end", - "scapy_str": MAC_IPV4_TUN_IPV4_UDP_MAC_IPV4_TUN_MAC_IPV4_UDP, - "check_func": rfc.check_queue, - "check_param": {"port_id": 0, "queue": 1} +tv_mac_ipv4_tcp_drop = { + "name": "test_mac_ipv4_tcp_drop", + "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 ttl is 2 tos is 4 / tcp src is 22 dst is 23 / end actions drop / end", + "scapy_str": MAC_IPV4_TCP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "drop": True} } -tv_mac_ipv4_tun_mac_ipv4_tcp_queue_index = { - "name": "test_mac_ipv4_tun_mac_ipv4_tcp_queue_index", - "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / tcp src is 22 dst is 23 / end actions queue index 1 / end", - "scapy_str": MAC_IPV4_TUN_IPV4_TCP_MAC_IPV4_TUN_MAC_IPV4_TCP, - "check_func": rfc.check_queue, - "check_param": {"port_id": 0, "queue": 1} +tv_mac_ipv4_tcp_mark_rss = { + "name": "test_mac_ipv4_tcp_mark_rss", + "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 ttl is 2 tos is 4 / tcp src is 22 dst is 23 / end actions mark id 2 / rss / end", + "scapy_str": MAC_IPV4_TCP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "mark_id": 2, "rss": True} } -tv_mac_ipv4_tun_mac_ipv4_sctp_queue_index = { - "name": "test_mac_ipv4_tun_mac_ipv4_sctp_queue_index", - "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / sctp src is 22 dst is 23 / end actions queue index 1 / end", - "scapy_str": MAC_IPV4_TUN_IPV4_SCTP_MAC_IPV4_TUN_MAC_IPV4_SCTP, - "check_func": rfc.check_queue, - "check_param": {"port_id": 0, "queue": 1} +tv_mac_ipv4_tcp_mark = { + "name": "test_mac_ipv4_tcp_mark", + "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 ttl is 2 tos is 4 / tcp src is 22 dst is 23 / end actions mark id 1 / end", + "scapy_str": MAC_IPV4_TCP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "mark_id": 1} } -tv_mac_ipv4_pay_drop = { - "name": "test_mac_ipv4_pay_drop", - "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 proto is 255 ttl is 2 tos is 4 / end actions drop / end", - "scapy_str": MAC_IPV4_PAY, - "check_func": rfc.check_drop, - "check_param": {"port_id": 0} +vectors_ipv4_tcp = [tv_mac_ipv4_tcp_queue_index, tv_mac_ipv4_tcp_rss_queues, tv_mac_ipv4_tcp_passthru, + tv_mac_ipv4_tcp_drop, tv_mac_ipv4_tcp_mark_rss, tv_mac_ipv4_tcp_mark] + +tv_mac_ipv4_sctp_queue_index = { + "name": "test_mac_ipv4_sctp_queue_index", + "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 ttl is 2 tos is 4 / sctp src is 22 dst is 23 / end actions queue index 63 / mark id 0 / end", + "scapy_str": MAC_IPV4_SCTP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "queue": 63, "mark_id": 0} } -tv_mac_ipv4_udp_drop = { - "name": "test_mac_ipv4_udp_drop", - "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 ttl is 2 tos is 4 / udp src is 22 dst is 23 / end actions drop / end", - "scapy_str": MAC_IPV4_UDP, - "check_func": rfc.check_drop, - "check_param": {"port_id": 0} +tv_mac_ipv4_sctp_rss_queues = { + "name": "test_mac_ipv4_sctp_rss_queues", + "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 ttl is 2 tos is 4 / sctp src is 22 dst is 23 / end actions rss queues 0 1 2 3 end / mark id 4294967294 / end", + "scapy_str": MAC_IPV4_SCTP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "queue": [0, 1, 2, 3], "mark_id": 4294967294} } -tv_mac_ipv4_tcp_drop = { - "name": "test_mac_ipv4_tcp_drop", - "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 ttl is 2 tos is 4 / tcp src is 22 dst is 23 / end actions drop / end", - "scapy_str": MAC_IPV4_TCP, - "check_func": rfc.check_drop, - "check_param": {"port_id": 0} +tv_mac_ipv4_sctp_passthru = { + "name": "test_mac_ipv4_sctp_passthru", + "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 ttl is 2 tos is 4 / sctp src is 22 dst is 23 / end actions passthru / mark id 1 / end", + "scapy_str": MAC_IPV4_SCTP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "mark_id": 1, "rss": True} } tv_mac_ipv4_sctp_drop = { "name": "test_mac_ipv4_sctp_drop", "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 ttl is 2 tos is 4 / sctp src is 22 dst is 23 / end actions drop / end", "scapy_str": MAC_IPV4_SCTP, - "check_func": rfc.check_drop, - "check_param": {"port_id": 0} + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "drop": True} +} + +tv_mac_ipv4_sctp_mark_rss = { + "name": "test_mac_ipv4_sctp_mark_rss", + "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 ttl is 2 tos is 4 / sctp src is 22 dst is 23 / end actions mark id 2 / rss / end", + "scapy_str": MAC_IPV4_SCTP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "mark_id": 2, "rss": True} +} + +tv_mac_ipv4_sctp_mark = { + "name": "test_mac_ipv4_sctp_mark", + "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 ttl is 2 tos is 4 / sctp src is 22 dst is 23 / end actions mark id 1 / end", + "scapy_str": MAC_IPV4_SCTP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "mark_id": 1} +} + +vectors_ipv4_sctp = [tv_mac_ipv4_sctp_queue_index, tv_mac_ipv4_sctp_rss_queues, tv_mac_ipv4_sctp_passthru, + tv_mac_ipv4_sctp_drop, tv_mac_ipv4_sctp_mark_rss, tv_mac_ipv4_sctp_mark] + +tv_mac_ipv6_pay_queue_index = { + "name": "test_mac_ipv6_pay_queue_index", + "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 proto is 0 hop is 2 tc is 1 / end actions queue index 1 / mark / end", + "scapy_str": MAC_IPV6_PAY, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "queue": 1, "mark_id": 0} +} + +tv_mac_ipv6_pay_rss_queues = { + "name": "test_mac_ipv6_pay_rss_queues", + "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 proto is 0 hop is 2 tc is 1 / end actions rss queues 56 57 58 59 60 61 62 63 end / mark / end", + "scapy_str": MAC_IPV6_PAY, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "queue": list(range(56, 64)), "mark_id": 0} +} + +tv_mac_ipv6_pay_passthru = { + "name": "test_mac_ipv6_pay_passthru", + "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 proto is 0 hop is 2 tc is 1 / end actions passthru / mark / end", + "scapy_str": MAC_IPV6_PAY, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "rss": True, "mark_id": 0} } tv_mac_ipv6_pay_drop = { "name": "test_mac_ipv6_pay_drop", - "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 proto is 1 hop is 2 tc is 1 / end actions drop / end", + "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 proto is 0 hop is 2 tc is 1 / end actions drop / end", + "scapy_str": MAC_IPV6_PAY, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "drop": True} +} + +tv_mac_ipv6_pay_mark_rss = { + "name": "test_mac_ipv6_pay_mark_rss", + "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 proto is 0 hop is 2 tc is 1 / end actions mark / rss / end", + "scapy_str": MAC_IPV6_PAY, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "mark_id": 0, "rss": True} +} + +tv_mac_ipv6_pay_mark = { + "name": "test_mac_ipv6_pay_mark", + "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 proto is 0 hop is 2 tc is 1 / end actions mark / end", "scapy_str": MAC_IPV6_PAY, - "check_func": rfc.check_drop, - "check_param": {"port_id": 0} + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "mark_id": 0, "rss": True} +} + +vectors_ipv6_pay = [tv_mac_ipv6_pay_queue_index, tv_mac_ipv6_pay_rss_queues, tv_mac_ipv6_pay_passthru, + tv_mac_ipv6_pay_drop, tv_mac_ipv6_pay_mark_rss, tv_mac_ipv6_pay_mark] + +tv_mac_ipv6_udp_queue_index = { + "name": "test_mac_ipv6_udp_queue_index", + "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 hop is 2 tc is 1 / udp src is 22 dst is 23 / end actions queue index 1 / mark / end", + "scapy_str": MAC_IPV6_UDP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "queue": 1, "mark_id": 0} +} + +tv_mac_ipv6_udp_rss_queues = { + "name": "test_mac_ipv6_udp_rss_queues", + "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 hop is 2 tc is 1 / udp src is 22 dst is 23 / end actions rss / end", + "scapy_str": MAC_IPV6_UDP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "rss": True} +} + +tv_mac_ipv6_udp_passthru = { + "name": "test_mac_ipv6_udp_passthru", + "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 hop is 2 tc is 1 / udp src is 22 dst is 23 / end actions passthru / mark / end", + "scapy_str": MAC_IPV6_UDP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "mark_id": 0, "rss": True} } tv_mac_ipv6_udp_drop = { "name": "test_mac_ipv6_udp_drop", "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 hop is 2 tc is 1 / udp src is 22 dst is 23 / end actions drop / end", "scapy_str": MAC_IPV6_UDP, - "check_func": rfc.check_drop, - "check_param": {"port_id": 0} + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "drop": True} +} + +tv_mac_ipv6_udp_mark_rss = { + "name": "test_mac_ipv6_udp_mark_rss", + "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 hop is 2 tc is 1 / udp src is 22 dst is 23 / end actions mark / rss / end", + "scapy_str": MAC_IPV6_UDP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "mark_id": 0, "rss": True} +} + +tv_mac_ipv6_udp_mark = { + "name": "test_mac_ipv6_udp_mark", + "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 hop is 2 tc is 1 / udp src is 22 dst is 23 / end actions mark / end", + "scapy_str": MAC_IPV6_UDP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "mark_id": 0, "rss": True} +} + +vectors_ipv6_udp = [tv_mac_ipv6_udp_queue_index, tv_mac_ipv6_udp_rss_queues, tv_mac_ipv6_udp_passthru, + tv_mac_ipv6_udp_drop, tv_mac_ipv6_udp_mark_rss, tv_mac_ipv6_udp_mark] + +tv_mac_ipv6_tcp_queue_index = { + "name": "test_mac_ipv6_tcp_queue_index", + "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 hop is 2 tc is 1 / tcp src is 22 dst is 23 / end actions queue index 1 / mark / end", + "scapy_str": MAC_IPV6_TCP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "queue": 1, "mark_id": 0} +} + +tv_mac_ipv6_tcp_rss_queues = { + "name": "test_mac_ipv6_tcp_rss_queues", + "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 hop is 2 tc is 1 / tcp src is 22 dst is 23 / end actions rss / end", + "scapy_str": MAC_IPV6_TCP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "rss": True} } + +tv_mac_ipv6_tcp_passthru = { + "name": "test_mac_ipv6_tcp_passthru", + "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 hop is 2 tc is 1 / tcp src is 22 dst is 23 / end actions passthru / mark / end", + "scapy_str": MAC_IPV6_TCP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "mark_id": 0, "rss": True} +} + tv_mac_ipv6_tcp_drop = { "name": "test_mac_ipv6_tcp_drop", "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 hop is 2 tc is 1 / tcp src is 22 dst is 23 / end actions drop / end", "scapy_str": MAC_IPV6_TCP, - "check_func": rfc.check_drop, - "check_param": {"port_id": 0} + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "drop": True} +} + +tv_mac_ipv6_tcp_mark_rss = { + "name": "test_mac_ipv6_tcp_mark_rss", + "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 hop is 2 tc is 1 / tcp src is 22 dst is 23 / end actions mark / rss / end", + "scapy_str": MAC_IPV6_TCP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "mark_id": 0, "rss": True} +} + +tv_mac_ipv6_tcp_mark = { + "name": "test_mac_ipv6_tcp_mark", + "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 hop is 2 tc is 1 / tcp src is 22 dst is 23 / end actions mark / end", + "scapy_str": MAC_IPV6_TCP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "mark_id": 0, "rss": True} +} + +vectors_ipv6_tcp = [tv_mac_ipv6_tcp_queue_index, tv_mac_ipv6_tcp_rss_queues, tv_mac_ipv6_tcp_passthru, + tv_mac_ipv6_tcp_drop, tv_mac_ipv6_tcp_mark_rss, tv_mac_ipv6_tcp_mark] + +tv_mac_ipv6_sctp_queue_index = { + "name": "test_mac_ipv6_sctp_queue_index", + "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 hop is 2 tc is 1 / sctp src is 22 dst is 23 / end actions queue index 1 / mark / end", + "scapy_str": MAC_IPV6_SCTP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "queue": 1, "mark_id": 0} +} + +tv_mac_ipv6_sctp_rss_queues = { + "name": "test_mac_ipv6_sctp_rss_queues", + "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 hop is 2 tc is 1 / sctp src is 22 dst is 23 / end actions rss / end", + "scapy_str": MAC_IPV6_SCTP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "rss": True} +} + +tv_mac_ipv6_sctp_passthru = { + "name": "test_mac_ipv6_sctp_passthru", + "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 hop is 2 tc is 1 / sctp src is 22 dst is 23 / end actions passthru / mark / end", + "scapy_str": MAC_IPV6_SCTP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "mark_id": 0, "rss": True} } tv_mac_ipv6_sctp_drop = { "name": "test_mac_ipv6_sctp_drop", "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 hop is 2 tc is 1 / sctp src is 22 dst is 23 / end actions drop / end", "scapy_str": MAC_IPV6_SCTP, - "check_func": rfc.check_drop, - "check_param": {"port_id": 0} + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "drop": True} +} + +tv_mac_ipv6_sctp_mark_rss = { + "name": "test_mac_ipv6_sctp_mark_rss", + "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 hop is 2 tc is 1 / sctp src is 22 dst is 23 / end actions mark / rss / end", + "scapy_str": MAC_IPV6_SCTP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "mark_id": 0, "rss": True} +} + +tv_mac_ipv6_sctp_mark = { + "name": "test_mac_ipv6_sctp_mark", + "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 hop is 2 tc is 1 / sctp src is 22 dst is 23 / end actions mark / end", + "scapy_str": MAC_IPV6_SCTP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "mark_id": 0, "rss": True} +} + +vectors_ipv6_sctp = [tv_mac_ipv6_sctp_queue_index, tv_mac_ipv6_sctp_rss_queues, tv_mac_ipv6_sctp_passthru, + tv_mac_ipv6_sctp_drop, tv_mac_ipv6_sctp_mark_rss, tv_mac_ipv6_sctp_mark] + +tv_mac_ipv4_tun_ipv4_pay_queue_index = { + "name": "test_mac_ipv4_tun_ipv4_pay_queue_index", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / end actions queue index 1 / end", + "scapy_str": MAC_IPV4_TUN_IPV4_PAY_MAC_IPV4_TUN_MAC_IPV4_PAY, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "queue": 1} +} + +tv_mac_ipv4_tun_ipv4_pay_rss_queues = { + "name": "test_mac_ipv4_tun_ipv4_pay_rss_queues", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / end actions rss queues 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 end / mark / end", + "scapy_str": MAC_IPV4_TUN_IPV4_PAY_MAC_IPV4_TUN_MAC_IPV4_PAY, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "queue": list(range(9, 25)), "mark_id": 0} +} + +tv_mac_ipv4_tun_ipv4_pay_passthru = { + "name": "test_mac_ipv4_tun_ipv4_pay_passthru", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / end actions passthru / mark / end", + "scapy_str": MAC_IPV4_TUN_IPV4_PAY_MAC_IPV4_TUN_MAC_IPV4_PAY, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "mark_id": 0, "rss": True} } tv_mac_ipv4_tun_ipv4_pay_drop = { "name": "test_mac_ipv4_tun_ipv4_pay_drop", "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / end actions drop / end", "scapy_str": MAC_IPV4_TUN_IPV4_PAY_MAC_IPV4_TUN_MAC_IPV4_PAY, - "check_func": rfc.check_drop, - "check_param": {"port_id": 0} + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "drop": True} +} + +tv_mac_ipv4_tun_ipv4_pay_mark_rss = { + "name": "test_mac_ipv4_tun_ipv4_pay_mark_rss", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / end actions mark / rss / end", + "scapy_str": MAC_IPV4_TUN_IPV4_PAY_MAC_IPV4_TUN_MAC_IPV4_PAY, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "mark_id": 0, "rss": True} +} + +tv_mac_ipv4_tun_ipv4_pay_mark = { + "name": "test_mac_ipv4_tun_ipv4_pay_mark", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / end actions mark / end", + "scapy_str": MAC_IPV4_TUN_IPV4_PAY_MAC_IPV4_TUN_MAC_IPV4_PAY, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "mark_id": 0, "rss": True} +} + +vectors_ipv4_tun_ipv4_pay = [tv_mac_ipv4_tun_ipv4_pay_queue_index, tv_mac_ipv4_tun_ipv4_pay_rss_queues, + tv_mac_ipv4_tun_ipv4_pay_passthru, tv_mac_ipv4_tun_ipv4_pay_drop, + tv_mac_ipv4_tun_ipv4_pay_mark_rss, tv_mac_ipv4_tun_ipv4_pay_mark] + +tv_mac_ipv4_tun_ipv4_udp_queue_index = { + "name": "test_mac_ipv4_tun_ipv4_udp_queue_index", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / udp src is 22 dst is 23 / end actions queue index 1 / mark id 1 / end", + "scapy_str": MAC_IPV4_TUN_IPV4_UDP_MAC_IPV4_TUN_MAC_IPV4_UDP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "queue": 1, "mark_id": 1} +} + +tv_mac_ipv4_tun_ipv4_udp_rss_queues = { + "name": "test_mac_ipv4_tun_ipv4_udp_rss_queues", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / udp src is 22 dst is 23 / end actions rss queues 38 39 40 41 end / mark id 1 / end", + "scapy_str": MAC_IPV4_TUN_IPV4_UDP_MAC_IPV4_TUN_MAC_IPV4_UDP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "queue": list(range(38, 42)), "mark_id": 1} +} + +tv_mac_ipv4_tun_ipv4_udp_passthru = { + "name": "test_mac_ipv4_tun_ipv4_udp_passthru", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / udp src is 22 dst is 23 / end actions passthru / mark id 1 / end", + "scapy_str": MAC_IPV4_TUN_IPV4_UDP_MAC_IPV4_TUN_MAC_IPV4_UDP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "mark_id": 1, "rss": True} } tv_mac_ipv4_tun_ipv4_udp_drop = { "name": "test_mac_ipv4_tun_ipv4_udp_drop", "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / udp src is 22 dst is 23 / end actions drop / end", "scapy_str": MAC_IPV4_TUN_IPV4_UDP_MAC_IPV4_TUN_MAC_IPV4_UDP, - "check_func": rfc.check_drop, - "check_param": {"port_id": 0} + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "drop": True} +} + +tv_mac_ipv4_tun_ipv4_udp_mark_rss = { + "name": "test_mac_ipv4_tun_ipv4_udp_mark_rss", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / udp src is 22 dst is 23 / end actions mark id 1 / rss / end", + "scapy_str": MAC_IPV4_TUN_IPV4_UDP_MAC_IPV4_TUN_MAC_IPV4_UDP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "mark_id": 1, "rss": True} +} + +tv_mac_ipv4_tun_ipv4_udp_mark = { + "name": "test_mac_ipv4_tun_ipv4_udp_mark", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / udp src is 22 dst is 23 / end actions mark id 1 / end", + "scapy_str": MAC_IPV4_TUN_IPV4_UDP_MAC_IPV4_TUN_MAC_IPV4_UDP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "mark_id": 1, "rss": True} +} + +vectors_ipv4_tun_ipv4_udp = [tv_mac_ipv4_tun_ipv4_udp_queue_index, tv_mac_ipv4_tun_ipv4_udp_rss_queues, + tv_mac_ipv4_tun_ipv4_udp_passthru, tv_mac_ipv4_tun_ipv4_udp_drop, + tv_mac_ipv4_tun_ipv4_udp_mark_rss, tv_mac_ipv4_tun_ipv4_udp_mark] + +tv_mac_ipv4_tun_ipv4_tcp_queue_index = { + "name": "test_mac_ipv4_tun_ipv4_tcp_queue_index", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / tcp src is 22 dst is 23 / end actions queue index 1 / mark id 1 / end", + "scapy_str": MAC_IPV4_TUN_IPV4_TCP_MAC_IPV4_TUN_MAC_IPV4_TCP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "queue": 1, "mark_id": 1} +} + +tv_mac_ipv4_tun_ipv4_tcp_rss_queues = { + "name": "test_mac_ipv4_tun_ipv4_tcp_rss_queues", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / tcp src is 22 dst is 23 / end actions rss queues 38 39 40 41 end / mark id 1 / end", + "scapy_str": MAC_IPV4_TUN_IPV4_TCP_MAC_IPV4_TUN_MAC_IPV4_TCP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "queue": list(range(38, 42)), "mark_id": 1} +} + +tv_mac_ipv4_tun_ipv4_tcp_passthru = { + "name": "test_mac_ipv4_tun_ipv4_tcp_passthru", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / tcp src is 22 dst is 23 / end actions passthru / mark id 1 / end", + "scapy_str": MAC_IPV4_TUN_IPV4_TCP_MAC_IPV4_TUN_MAC_IPV4_TCP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "mark_id": 1, "rss": True} } tv_mac_ipv4_tun_ipv4_tcp_drop = { "name": "test_mac_ipv4_tun_ipv4_tcp_drop", "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / tcp src is 22 dst is 23 / end actions drop / end", "scapy_str": MAC_IPV4_TUN_IPV4_TCP_MAC_IPV4_TUN_MAC_IPV4_TCP, - "check_func": rfc.check_drop, - "check_param": {"port_id": 0} + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "drop": True} } -tv_mac_ipv4_tun_ipv4_sctp_drop = { - "name": "test_mac_ipv4_tun_ipv4_sctp_drop", - "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / sctp src is 22 dst is 23 / end actions drop / end", - "scapy_str": MAC_IPV4_TUN_IPV4_SCTP_MAC_IPV4_TUN_MAC_IPV4_SCTP, - "check_func": rfc.check_drop, - "check_param": {"port_id": 0} +tv_mac_ipv4_tun_ipv4_tcp_mark_rss = { + "name": "test_mac_ipv4_tun_ipv4_tcp_mark_rss", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / tcp src is 22 dst is 23 / end actions mark id 1 / rss / end", + "scapy_str": MAC_IPV4_TUN_IPV4_TCP_MAC_IPV4_TUN_MAC_IPV4_TCP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "mark_id": 1, "rss": True} } -tv_mac_ipv4_tun_mac_ipv4_pay_drop = { - "name": "test_mac_ipv4_tun_mac_ipv4_pay_drop", - "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / end actions drop / end", - "scapy_str": MAC_IPV4_TUN_IPV4_PAY_MAC_IPV4_TUN_MAC_IPV4_PAY, - "check_func": rfc.check_drop, - "check_param": {"port_id": 0} +tv_mac_ipv4_tun_ipv4_tcp_mark = { + "name": "test_mac_ipv4_tun_ipv4_tcp_mark", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / tcp src is 22 dst is 23 / end actions mark id 1 / end", + "scapy_str": MAC_IPV4_TUN_IPV4_TCP_MAC_IPV4_TUN_MAC_IPV4_TCP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "mark_id": 1, "rss": True} } -tv_mac_ipv4_tun_mac_ipv4_udp_drop = { - "name": "test_mac_ipv4_tun_mac_ipv4_udp_drop", - "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / udp src is 22 dst is 23 / end actions drop / end", - "scapy_str": MAC_IPV4_TUN_IPV4_UDP_MAC_IPV4_TUN_MAC_IPV4_UDP, - "check_func": rfc.check_drop, - "check_param": {"port_id": 0} +vectors_ipv4_tun_ipv4_tcp = [tv_mac_ipv4_tun_ipv4_tcp_queue_index, tv_mac_ipv4_tun_ipv4_tcp_rss_queues, + tv_mac_ipv4_tun_ipv4_tcp_passthru, tv_mac_ipv4_tun_ipv4_tcp_drop, + tv_mac_ipv4_tun_ipv4_tcp_mark_rss, tv_mac_ipv4_tun_ipv4_tcp_mark] + +tv_mac_ipv4_tun_ipv4_sctp_queue_index = { + "name": "test_mac_ipv4_tun_ipv4_sctp_queue_index", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / sctp src is 22 dst is 23 / end actions queue index 1 / mark id 1 / end", + "scapy_str": MAC_IPV4_TUN_IPV4_SCTP_MAC_IPV4_TUN_MAC_IPV4_SCTP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "queue": 1, "mark_id": 1} } -tv_mac_ipv4_tun_mac_ipv4_tcp_drop = { - "name": "test_mac_ipv4_tun_mac_ipv4_tcp_drop", - "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / tcp src is 22 dst is 23 / end actions drop / end", - "scapy_str": MAC_IPV4_TUN_IPV4_TCP_MAC_IPV4_TUN_MAC_IPV4_TCP, - "check_func": rfc.check_drop, - "check_param": {"port_id": 0} +tv_mac_ipv4_tun_ipv4_sctp_rss_queues = { + "name": "test_mac_ipv4_tun_ipv4_sctp_rss_queues", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / sctp src is 22 dst is 23 / end actions rss queues 38 39 40 41 end / mark id 1 / end", + "scapy_str": MAC_IPV4_TUN_IPV4_SCTP_MAC_IPV4_TUN_MAC_IPV4_SCTP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "queue": list(range(38, 42)), "mark_id": 1} } -tv_mac_ipv4_tun_mac_ipv4_sctp_drop = { - "name": "test_mac_ipv4_tun_mac_ipv4_sctp_drop", - "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / sctp src is 22 dst is 23 / end actions drop / end", +tv_mac_ipv4_tun_ipv4_sctp_passthru = { + "name": "test_mac_ipv4_tun_ipv4_sctp_passthru", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / sctp src is 22 dst is 23 / end actions passthru / mark id 1 / end", "scapy_str": MAC_IPV4_TUN_IPV4_SCTP_MAC_IPV4_TUN_MAC_IPV4_SCTP, - "check_func": rfc.check_drop, - "check_param": {"port_id": 0} + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "mark_id": 1, "rss": True} } -tv_mac_ipv4_pay_queue_group = { - "name": "test_mac_ipv4_pay_queue_group", - "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 proto is 255 ttl is 2 tos is 4 / end actions rss queues 0 1 end / end", - "scapy_str": MAC_IPV4_PAY, - "check_func": rfc.check_queue, - "check_param": {"port_id": 0, "queue": [0, 1]} +tv_mac_ipv4_tun_ipv4_sctp_drop = { + "name": "test_mac_ipv4_tun_ipv4_sctp_drop", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / sctp src is 22 dst is 23 / end actions drop / end", + "scapy_str": MAC_IPV4_TUN_IPV4_SCTP_MAC_IPV4_TUN_MAC_IPV4_SCTP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "drop": True} } -tv_mac_ipv4_udp_queue_group = { - "name": "test_mac_ipv4_udp_queue_group", - "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 ttl is 2 tos is 4 / udp src is 22 dst is 23 / end actions rss queues 1 2 3 4 end / end", - "scapy_str": MAC_IPV4_UDP, - "check_func": rfc.check_queue, - "check_param": {"port_id": 0, "queue": [1, 2, 3, 4]} +tv_mac_ipv4_tun_ipv4_sctp_mark_rss = { + "name": "test_mac_ipv4_tun_ipv4_sctp_mark_rss", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / sctp src is 22 dst is 23 / end actions mark id 1 / rss / end", + "scapy_str": MAC_IPV4_TUN_IPV4_SCTP_MAC_IPV4_TUN_MAC_IPV4_SCTP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "mark_id": 1, "rss": True} } -tv_mac_ipv4_tcp_queue_group = { - "name": "test_mac_ipv4_tcp_queue_group", - "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 ttl is 2 tos is 4 / tcp src is 22 dst is 23 / end actions rss queues 56 57 58 59 60 61 62 63 end / end", - "scapy_str": MAC_IPV4_TCP, - "check_func": rfc.check_queue, - "check_param": {"port_id": 0, "queue": list(range(56, 64))} +tv_mac_ipv4_tun_ipv4_sctp_mark = { + "name": "test_mac_ipv4_tun_ipv4_sctp_mark", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / sctp src is 22 dst is 23 / end actions mark id 1 / end", + "scapy_str": MAC_IPV4_TUN_IPV4_SCTP_MAC_IPV4_TUN_MAC_IPV4_SCTP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "mark_id": 1, "rss": True} } -tv_mac_ipv4_sctp_queue_group = { - "name": "test_mac_ipv4_sctp_queue_group", - "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 ttl is 2 tos is 4 / sctp src is 22 dst is 23 tag is 1 / end actions rss queues 0 1 2 3 end / end", - "scapy_str": MAC_IPV4_SCTP, - "check_func": rfc.check_queue, - "check_param": {"port_id": 0, "queue": list(range(4))} +vectors_ipv4_tun_ipv4_sctp = [tv_mac_ipv4_tun_ipv4_sctp_queue_index, tv_mac_ipv4_tun_ipv4_sctp_rss_queues, + tv_mac_ipv4_tun_ipv4_sctp_passthru, tv_mac_ipv4_tun_ipv4_sctp_drop, + tv_mac_ipv4_tun_ipv4_sctp_mark_rss, tv_mac_ipv4_tun_ipv4_sctp_mark] + +tv_mac_ipv4_tun_mac_ipv4_pay_queue_index = { + "name": "test_mac_ipv4_tun_mac_ipv4_pay_queue_index", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / end actions queue index 0 / end", + "scapy_str": MAC_IPV4_TUN_IPV4_PAY_MAC_IPV4_TUN_MAC_IPV4_PAY, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "queue": 0} } -tv_mac_ipv6_pay_queue_group = { - "name": "test_mac_ipv6_pay_queue_group", - "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 proto is 1 hop is 2 tc is 1 / end actions rss queues 1 2 end / end", - "scapy_str": MAC_IPV6_PAY, - "check_func": rfc.check_queue, - "check_param": {"port_id": 0, "queue": [1, 2]} +tv_mac_ipv4_tun_mac_ipv4_pay_rss_queues = { + "name": "test_mac_ipv4_tun_mac_ipv4_pay_rss_queues", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / end actions rss queues 0 1 end / end", + "scapy_str": MAC_IPV4_TUN_IPV4_PAY_MAC_IPV4_TUN_MAC_IPV4_PAY, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "queue": [0, 1]} } -tv_mac_ipv6_udp_queue_group = { - "name": "test_mac_ipv6_udp_queue_group", - "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 hop is 2 tc is 1 / udp src is 22 dst is 23 / end actions rss queues 1 2 end / end", - "scapy_str": MAC_IPV6_UDP, - "check_func": rfc.check_queue, - "check_param": {"port_id": 0, "queue": [1, 2]} +tv_mac_ipv4_tun_mac_ipv4_pay_passthru = { + "name": "test_mac_ipv4_tun_mac_ipv4_pay_passthru", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / end actions passthru / end", + "scapy_str": MAC_IPV4_TUN_IPV4_PAY_MAC_IPV4_TUN_MAC_IPV4_PAY, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "rss": True} } -tv_mac_ipv6_tcp_queue_group = { - "name": "test_mac_ipv6_tcp_queue_group", - "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 hop is 2 tc is 1 / tcp src is 22 dst is 23 / end actions rss queues 1 2 end / end", - "scapy_str": MAC_IPV6_TCP, - "check_func": rfc.check_queue, - "check_param": {"port_id": 0, "queue": [1, 2]} +tv_mac_ipv4_tun_mac_ipv4_pay_drop = { + "name": "test_mac_ipv4_tun_mac_ipv4_pay_drop", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / end actions drop / end", + "scapy_str": MAC_IPV4_TUN_IPV4_PAY_MAC_IPV4_TUN_MAC_IPV4_PAY, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "drop": True} } -tv_mac_ipv6_sctp_queue_group = { - "name": "test_mac_ipv6_sctp_queue_group", - "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 hop is 2 tc is 1 / sctp src is 22 dst is 23 / end actions rss queues 1 2 end / end", - "scapy_str": MAC_IPV6_SCTP, - "check_func": rfc.check_queue, - "check_param": {"port_id": 0, "queue": [1, 2]} +tv_mac_ipv4_tun_mac_ipv4_pay_mark_rss = { + "name": "test_mac_ipv4_tun_mac_ipv4_pay_mark_rss", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / end actions mark / rss / end", + "scapy_str": MAC_IPV4_TUN_IPV4_PAY_MAC_IPV4_TUN_MAC_IPV4_PAY, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "mark_id": 0, "rss": True} } -tv_mac_ipv4_tun_ipv4_pay_queue_group = { - "name": "test_mac_ipv4_tun_ipv4_pay_queue_group", - "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / end actions rss queues 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 end / end", +tv_mac_ipv4_tun_mac_ipv4_pay_mark = { + "name": "test_mac_ipv4_tun_mac_ipv4_pay_mark", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / end actions mark / end", "scapy_str": MAC_IPV4_TUN_IPV4_PAY_MAC_IPV4_TUN_MAC_IPV4_PAY, - "check_func": rfc.check_queue, - "check_param": {"port_id": 0, "queue": list(range(9, 25))} + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "rss": True, "mark_id": 0} +} + +vectors_mac_ipv4_tun_mac_ipv4_pay = [tv_mac_ipv4_tun_mac_ipv4_pay_queue_index, tv_mac_ipv4_tun_mac_ipv4_pay_rss_queues, + tv_mac_ipv4_tun_mac_ipv4_pay_passthru, tv_mac_ipv4_tun_mac_ipv4_pay_drop, + tv_mac_ipv4_tun_mac_ipv4_pay_mark_rss, tv_mac_ipv4_tun_mac_ipv4_pay_mark] + +tv_mac_ipv4_tun_mac_ipv4_udp_queue_index = { + "name": "test_mac_ipv4_tun_mac_ipv4_udp_queue_index", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / udp src is 22 dst is 23 / end actions queue index 15 / mark id 1 / end", + "scapy_str": MAC_IPV4_TUN_IPV4_UDP_MAC_IPV4_TUN_MAC_IPV4_UDP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "queue": 15, "mark_id": 1} } -tv_mac_ipv4_tun_ipv4_udp_queue_group = { - "name": "test_mac_ipv4_tun_ipv4_udp_queue_group", - "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / udp src is 22 dst is 23 / end actions rss queues 38 39 40 41 end / end", +tv_mac_ipv4_tun_mac_ipv4_udp_rss_queues = { + "name": "test_mac_ipv4_tun_mac_ipv4_udp_rss_queues", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / udp src is 22 dst is 23 / end actions rss queues 0 1 2 3 end / mark id 1 / end", "scapy_str": MAC_IPV4_TUN_IPV4_UDP_MAC_IPV4_TUN_MAC_IPV4_UDP, - "check_func": rfc.check_queue, - "check_param": {"port_id": 0, "queue": [38, 39, 40, 41]} + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "queue": [0, 1, 2, 3], "mark_id": 1} } -tv_mac_ipv4_tun_ipv4_tcp_queue_group = { - "name": "test_mac_ipv4_tun_ipv4_tcp_queue_group", - "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / tcp src is 22 dst is 23 / end actions rss queues 1 2 end / end", - "scapy_str": MAC_IPV4_TUN_IPV4_TCP_MAC_IPV4_TUN_MAC_IPV4_TCP, - "check_func": rfc.check_queue, - "check_param": {"port_id": 0, "queue": [1, 2]} +tv_mac_ipv4_tun_mac_ipv4_udp_passthru = { + "name": "test_mac_ipv4_tun_mac_ipv4_udp_passthru", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / udp src is 22 dst is 23 / end actions passthru / mark id 1 / end", + "scapy_str": MAC_IPV4_TUN_IPV4_UDP_MAC_IPV4_TUN_MAC_IPV4_UDP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "mark_id": 1, "rss": True} } -tv_mac_ipv4_tun_ipv4_sctp_queue_group = { - "name": "test_mac_ipv4_tun_ipv4_sctp_queue_group", - "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / sctp src is 22 dst is 23 / end actions rss queues 1 2 end / end", - "scapy_str": MAC_IPV4_TUN_IPV4_SCTP_MAC_IPV4_TUN_MAC_IPV4_SCTP, - "check_func": rfc.check_queue, - "check_param": {"port_id": 0, "queue": [1, 2]} +tv_mac_ipv4_tun_mac_ipv4_udp_drop = { + "name": "test_mac_ipv4_tun_mac_ipv4_udp_drop", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / udp src is 22 dst is 23 / end actions drop / mark id 1 / end", + "scapy_str": MAC_IPV4_TUN_IPV4_UDP_MAC_IPV4_TUN_MAC_IPV4_UDP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "drop": True} } -tv_mac_ipv4_tun_mac_ipv4_pay_queue_group = { - "name": "test_mac_ipv4_tun_mac_ipv4_pay_queue_group", - "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / end actions rss queues 1 2 end / end", - "scapy_str": MAC_IPV4_TUN_IPV4_PAY_MAC_IPV4_TUN_MAC_IPV4_PAY, - "check_func": rfc.check_queue, - "check_param": {"port_id": 0, "queue": [1, 2]} +tv_mac_ipv4_tun_mac_ipv4_udp_mark_rss = { + "name": "tv_mac_ipv4_tun_mac_ipv4_udp_mark_rss", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / udp src is 22 dst is 23 / end actions rss / mark id 1 / end", + "scapy_str": MAC_IPV4_TUN_IPV4_UDP_MAC_IPV4_TUN_MAC_IPV4_UDP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "mark_id": 1, "rss": True} } -tv_mac_ipv4_tun_mac_ipv4_udp_queue_group = { - "name": "test_mac_ipv4_tun_mac_ipv4_udp_queue_group", - "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / udp src is 22 dst is 23 / end actions rss queues 1 2 end / end", +tv_mac_ipv4_tun_mac_ipv4_udp_mark = { + "name": "tv_mac_ipv4_tun_mac_ipv4_udp_mark", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / udp src is 22 dst is 23 / end actions mark id 1 / end", "scapy_str": MAC_IPV4_TUN_IPV4_UDP_MAC_IPV4_TUN_MAC_IPV4_UDP, - "check_func": rfc.check_queue, - "check_param": {"port_id": 0, "queue": [1, 2]} + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "mark_id": 1, "rss": True} } -tv_mac_ipv4_tun_mac_ipv4_tcp_queue_group = { - "name": "test_mac_ipv4_tun_mac_ipv4_tcp_queue_group", - "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / tcp src is 22 dst is 23 / end actions rss queues 1 2 end / end", +vectors_mac_ipv4_tun_mac_ipv4_udp = [tv_mac_ipv4_tun_mac_ipv4_udp_queue_index, tv_mac_ipv4_tun_mac_ipv4_udp_rss_queues, + tv_mac_ipv4_tun_mac_ipv4_udp_passthru, tv_mac_ipv4_tun_mac_ipv4_udp_drop, + tv_mac_ipv4_tun_mac_ipv4_udp_mark_rss, tv_mac_ipv4_tun_mac_ipv4_udp_mark] + +tv_mac_ipv4_tun_mac_ipv4_tcp_queue_index = { + "name": "test_mac_ipv4_tun_mac_ipv4_tcp_queue_index", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / tcp src is 22 dst is 23 / end actions queue index 15 / mark id 1 / end", "scapy_str": MAC_IPV4_TUN_IPV4_TCP_MAC_IPV4_TUN_MAC_IPV4_TCP, - "check_func": rfc.check_queue, - "check_param": {"port_id": 0, "queue": [1, 2]} + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "queue": 15, "mark_id": 1} } -tv_mac_ipv4_tun_mac_ipv4_sctp_queue_group = { - "name": "test_mac_ipv4_tun_mac_ipv4_sctp_queue_group", - "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / sctp src is 22 dst is 23 / end actions rss queues 1 2 end / end", - "scapy_str": MAC_IPV4_TUN_IPV4_SCTP_MAC_IPV4_TUN_MAC_IPV4_SCTP, - "check_func": rfc.check_queue, - "check_param": {"port_id": 0, "queue": [1, 2]} +tv_mac_ipv4_tun_mac_ipv4_tcp_rss_queues = { + "name": "test_mac_ipv4_tun_mac_ipv4_tcp_rss_queues", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / tcp src is 22 dst is 23 / end actions rss queues 0 1 2 3 end / mark id 1 / end", + "scapy_str": MAC_IPV4_TUN_IPV4_TCP_MAC_IPV4_TUN_MAC_IPV4_TCP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "queue": [0, 1, 2, 3], "mark_id": 1} } -tv_mac_ipv4_gtpu_ipv4_pay_queue_index = { - "name": "test_mac_ipv4_gtpu_ipv4_pay_queue_index", - "rule": "flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / gtp_psc qfi is 0x34 / ipv4 / end actions queue index 1 / end", - "scapy_str": MAC_IPV4_GTPU_IPV4_PAY, - "check_func": rfc.check_queue, - "check_param": {"port_id": 0, "queue": 1} +tv_mac_ipv4_tun_mac_ipv4_tcp_passthru = { + "name": "test_mac_ipv4_tun_mac_ipv4_tcp_passthru", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / tcp src is 22 dst is 23 / end actions passthru / mark id 1 / end", + "scapy_str": MAC_IPV4_TUN_IPV4_TCP_MAC_IPV4_TUN_MAC_IPV4_TCP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "mark_id": 1, "rss": True} } -tv_mac_ipv4_gtpu_ipv4_pay_drop = { - "name": "test_mac_ipv4_gtpu_ipv4_pay_drop", - "rule": "flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / gtp_psc qfi is 0x34 / ipv4 / end actions drop / end", - "scapy_str": MAC_IPV4_GTPU_IPV4_PAY, - "check_func": rfc.check_drop, - "check_param": {"port_id": 0} +tv_mac_ipv4_tun_mac_ipv4_tcp_drop = { + "name": "test_mac_ipv4_tun_mac_ipv4_tcp_drop", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / tcp src is 22 dst is 23 / end actions drop / mark id 1 / end", + "scapy_str": MAC_IPV4_TUN_IPV4_TCP_MAC_IPV4_TUN_MAC_IPV4_TCP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "drop": True} } -tv_mac_ipv4_gtpu_ipv4_pay_queue_group = { - "name": "test_mac_ipv4_gtpu_ipv4_pay_queue_group", - "rule": "flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / gtp_psc qfi is 0x34 / ipv4 / end actions rss queues 0 1 end / end", - "scapy_str": MAC_IPV4_GTPU_IPV4_PAY, - "check_func": rfc.check_queue, - "check_param": {"port_id": 0, "queue": [0, 1]} +tv_mac_ipv4_tun_mac_ipv4_tcp_mark_rss = { + "name": "tv_mac_ipv4_tun_mac_ipv4_tcp_mark_rss", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / tcp src is 22 dst is 23 / end actions rss / mark id 1 / end", + "scapy_str": MAC_IPV4_TUN_IPV4_TCP_MAC_IPV4_TUN_MAC_IPV4_TCP, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "mark_id": 1, "rss": True} } -tv_mac_ipv4_gtpu_ipv4_pay_mark_count_query = { - "name": "test_mac_ipv4_gtpu_ipv4_pay_mark_count_query", - "rule": "flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / gtp_psc qfi is 0x34 / ipv4 / end actions queue index 2 / mark id 2 / count / end", - "scapy_str": MAC_IPV4_GTPU_IPV4_PAY, +tv_mac_ipv4_tun_mac_ipv4_tcp_mark = { + "name": "tv_mac_ipv4_tun_mac_ipv4_tcp_mark", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / tcp src is 22 dst is 23 / end actions mark id 1 / end", + "scapy_str": MAC_IPV4_TUN_IPV4_TCP_MAC_IPV4_TUN_MAC_IPV4_TCP, "check_func": rfc.check_mark, - "check_param": {"port_id": 0, "queue": 2, "mark_id": 2, - "count": {"hits_set": 1, "hits": 5}, "mark": True} + "check_param": {"port_id": 0, "mark_id": 1, "rss": True} } -tv_mac_ipv4_pay_queue_index_mark = { - "name": "test_mac_ipv4_pay_queue_index_mark", - "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 proto is 255 ttl is 2 tos is 4 / end actions queue index 1 / mark id 0 / end", - "scapy_str": MAC_IPV4_PAY, +vectors_mac_ipv4_tun_mac_ipv4_tcp = [tv_mac_ipv4_tun_mac_ipv4_tcp_queue_index, tv_mac_ipv4_tun_mac_ipv4_tcp_rss_queues, + tv_mac_ipv4_tun_mac_ipv4_tcp_passthru, tv_mac_ipv4_tun_mac_ipv4_tcp_drop, + tv_mac_ipv4_tun_mac_ipv4_tcp_mark_rss, tv_mac_ipv4_tun_mac_ipv4_tcp_mark] + +tv_mac_ipv4_tun_mac_ipv4_sctp_queue_index = { + "name": "test_mac_ipv4_tun_mac_ipv4_sctp_queue_index", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / sctp src is 22 dst is 23 / end actions queue index 15 / mark id 1 / end", + "scapy_str": MAC_IPV4_TUN_IPV4_SCTP_MAC_IPV4_TUN_MAC_IPV4_SCTP, "check_func": rfc.check_mark, - "check_param": {"port_id": 0, "queue": 1, "mark_id": 0, "mark": True} + "check_param": {"port_id": 0, "queue": 15, "mark_id": 1} } -tv_mac_ipv4_udp_queue_index_mark = { - "name": "test_mac_ipv4_udp_queue_index_mark", - "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 ttl is 2 tos is 4 / udp src is 22 dst is 23 / end actions queue index 0 / mark id 1 / end", - "scapy_str": MAC_IPV4_UDP, +tv_mac_ipv4_tun_mac_ipv4_sctp_rss_queues = { + "name": "test_mac_ipv4_tun_mac_ipv4_sctp_rss_queues", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / sctp src is 22 dst is 23 / end actions rss queues 0 1 2 3 end / mark id 1 / end", + "scapy_str": MAC_IPV4_TUN_IPV4_SCTP_MAC_IPV4_TUN_MAC_IPV4_SCTP, "check_func": rfc.check_mark, - "check_param": {"port_id": 0, "queue": 0, "mark_id": 1, "mark": True} + "check_param": {"port_id": 0, "queue": [0, 1, 2, 3], "mark_id": 1} } -tv_mac_ipv4_tcp_queue_index_mark = { - "name": "test_mac_ipv4_tcp_queue_index_mark", - "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 ttl is 2 tos is 4 / tcp src is 22 dst is 23 / end actions queue index 1 / mark id 4294967294 / end", - "scapy_str": MAC_IPV4_TCP, +tv_mac_ipv4_tun_mac_ipv4_sctp_passthru = { + "name": "test_mac_ipv4_tun_mac_ipv4_sctp_passthru", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / sctp src is 22 dst is 23 / end actions passthru / mark id 1 / end", + "scapy_str": MAC_IPV4_TUN_IPV4_SCTP_MAC_IPV4_TUN_MAC_IPV4_SCTP, "check_func": rfc.check_mark, - "check_param": {"port_id": 0, "queue": 1, "mark_id": 4294967294, "mark": True} + "check_param": {"port_id": 0, "mark_id": 1, "rss": True} } -tv_mac_ipv4_sctp_queue_drop_mark = { - "name": "test_mac_ipv4_sctp_queue_drop_mark", - "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 ttl is 2 tos is 4 / sctp src is 22 dst is 23 tag is 1 / end actions drop / mark id 1 / end", - "scapy_str": MAC_IPV4_SCTP, +tv_mac_ipv4_tun_mac_ipv4_sctp_drop = { + "name": "test_mac_ipv4_tun_mac_ipv4_sctp_drop", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / sctp src is 22 dst is 23 / end actions drop / mark id 1 / end", + "scapy_str": MAC_IPV4_TUN_IPV4_SCTP_MAC_IPV4_TUN_MAC_IPV4_SCTP, "check_func": rfc.check_mark, - "check_param": {"port_id": 0, "mark_id": 1, "mark": True} + "check_param": {"port_id": 0, "drop": True} } -tv_mac_ipv6_pay_queue_index_mark = { - "name": "test_mac_ipv6_pay_queue_index_mark", - "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 proto is 1 hop is 2 tc is 1 / end actions queue index 1 / mark id 1 / end", - "scapy_str": MAC_IPV6_PAY, +tv_mac_ipv4_tun_mac_ipv4_sctp_mark_rss = { + "name": "test_mac_ipv4_tun_mac_ipv4_sctp_mark_rss", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / sctp src is 22 dst is 23 / end actions rss / mark id 1 / end", + "scapy_str": MAC_IPV4_TUN_IPV4_SCTP_MAC_IPV4_TUN_MAC_IPV4_SCTP, "check_func": rfc.check_mark, - "check_param": {"port_id": 0, "queue": 1, "mark_id": 1, "mark": True} + "check_param": {"port_id": 0, "mark_id": 1, "rss": True} } -tv_mac_ipv6_udp_queue_index_mark = { - "name": "test_mac_ipv6_udp_queue_index_mark", - "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 hop is 2 tc is 1 / udp src is 22 dst is 23 / end actions queue index 1 / mark id 1 / end", - "scapy_str": MAC_IPV6_UDP, +tv_mac_ipv4_tun_mac_ipv4_sctp_mark = { + "name": "tv_mac_ipv4_tun_mac_ipv4_sctp_mark", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / sctp src is 22 dst is 23 / end actions mark id 1 / end", + "scapy_str": MAC_IPV4_TUN_IPV4_SCTP_MAC_IPV4_TUN_MAC_IPV4_SCTP, "check_func": rfc.check_mark, - "check_param": {"port_id": 0, "queue": 1, "mark_id": 1, "mark": True} + "check_param": {"port_id": 0, "mark_id": 1, "rss": True} } -tv_mac_ipv6_tcp_queue_index_mark = { - "name": "test_mac_ipv6_tcp_queue_index_mark", - "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 hop is 2 tc is 1 / tcp src is 22 dst is 23 / end actions queue index 1 / mark id 1 / end", - "scapy_str": MAC_IPV6_TCP, +vectors_mac_ipv4_tun_mac_ipv4_sctp = [tv_mac_ipv4_tun_mac_ipv4_sctp_queue_index, + tv_mac_ipv4_tun_mac_ipv4_sctp_rss_queues, + tv_mac_ipv4_tun_mac_ipv4_sctp_passthru, tv_mac_ipv4_tun_mac_ipv4_sctp_drop, + tv_mac_ipv4_tun_mac_ipv4_sctp_mark_rss, tv_mac_ipv4_tun_mac_ipv4_sctp_mark] + +tv_mac_ipv4_gtpu_eh_queue_index = { + "name": "test_mac_ipv4_gtpu_eh_queue_index", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / gtp_psc qfi is 0x34 / end actions queue index 1 / mark id 1 / end", + "scapy_str": MAC_IPV4_GTPU_EH, "check_func": rfc.check_mark, - "check_param": {"port_id": 0, "queue": 1, "mark_id": 1, "mark": True} + "check_param": {"port_id": 0, "mark_id": 1, "queue": 1} } -tv_mac_ipv6_sctp_queue_index_mark = { - "name": "test_mac_ipv6_sctp_queue_index_mark", - "rule": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 hop is 2 tc is 1 / sctp src is 22 dst is 23 / end actions queue index 1 / mark id 1 / end", - "scapy_str": MAC_IPV6_SCTP, +tv_mac_ipv4_gtpu_eh_queue_group = { + "name": "test_mac_ipv4_gtpu_eh_queue_group", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / gtp_psc qfi is 0x34 / end actions rss queues 0 1 2 3 end / mark id 1 / end", + "scapy_str": MAC_IPV4_GTPU_EH, "check_func": rfc.check_mark, - "check_param": {"port_id": 0, "queue": 1, "mark_id": 1, "mark": True} + "check_param": {"port_id": 0, "mark_id": 1, "queue": [0, 1, 2, 3]} } -tv_mac_ipv4_tun_ipv4_pay_queue_index_mark = { - "name": "test_mac_ipv4_tun_ipv4_pay_queue_index_mark", - "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / end actions queue index 1 / mark id 1 / end", - "scapy_str": MAC_IPV4_TUN_IPV4_PAY_MAC_IPV4_TUN_MAC_IPV4_PAY, +tv_mac_ipv4_gtpu_eh_passthru = { + "name": "test_mac_ipv4_gtpu_eh_passthru", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / gtp_psc qfi is 0x34 / end actions passthru / mark id 1 / end", + "scapy_str": MAC_IPV4_GTPU_EH, "check_func": rfc.check_mark, - "check_param": {"port_id": 0, "queue": 1, "mark_id": 1, "mark": True} + "check_param": {"port_id": 0, "mark_id": 1, "rss": True} } -tv_mac_ipv4_tun_ipv4_udp_queue_group_mark = { - "name": "test_mac_ipv4_tun_ipv4_udp_queue_group_mark", - "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / udp src is 22 dst is 23 / end actions rss queues 1 2 end / mark id 1 / end", - "scapy_str": MAC_IPV4_TUN_IPV4_UDP_MAC_IPV4_TUN_MAC_IPV4_UDP, +tv_mac_ipv4_gtpu_eh_drop = { + "name": "test_mac_ipv4_gtpu_eh_drop", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / gtp_psc qfi is 0x34 / end actions drop / end", + "scapy_str": MAC_IPV4_GTPU_EH, "check_func": rfc.check_mark, - "check_param": {"port_id": 0, "queue": [1, 2], "mark_id": 1, "mark": True} + "check_param": {"port_id": 0, "drop": True} } -tv_mac_ipv4_tun_ipv4_tcp_drop_mark = { - "name": "test_mac_ipv4_tun_ipv4_tcp_drop_mark", - "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / tcp src is 22 dst is 23 / end actions drop / mark id 1 / end", - "scapy_str": MAC_IPV4_TUN_IPV4_TCP_MAC_IPV4_TUN_MAC_IPV4_TCP, +tv_mac_ipv4_gtpu_eh_mark_rss = { + "name": "test_mac_ipv4_gtpu_eh_mark_rss", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / gtp_psc qfi is 0x34 / end actions mark id 1 / rss / end", + "scapy_str": MAC_IPV4_GTPU_EH, "check_func": rfc.check_mark, - "check_param": {"port_id": 0, "mark_id": 1, "mark": True} + "check_param": {"port_id": 0, "mark_id": 1, "rss": True} } -tv_mac_ipv4_tun_ipv4_sctp_queue_index_mark = { - "name": "test_mac_ipv4_tun_ipv4_sctp_queue_index_mark", - "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / sctp src is 22 dst is 23 / end actions queue index 1 / mark id 1 / end", - "scapy_str": MAC_IPV4_TUN_IPV4_SCTP_MAC_IPV4_TUN_MAC_IPV4_SCTP, +tv_mac_ipv4_gtpu_eh_mark = { + "name": "tv_mac_ipv4_gtpu_eh_mark", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / gtp_psc qfi is 0x34 / end actions mark id 1 / end", + "scapy_str": MAC_IPV4_GTPU_EH, "check_func": rfc.check_mark, - "check_param": {"port_id": 0, "queue": 1, "mark_id": 1, "mark": True} + "check_param": {"port_id": 0, "mark_id": 1, "rss": True} +} + +tv_mac_ipv4_gtpu_eh_qfi_queue_index_mark = { + "name": "test_mac_ipv4_gtpu_eh_qfi_queue_index_mark", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / gtpu / gtp_psc qfi is 0x34 / end actions queue index 1 / mark id 3 / end", + "scapy_str": {"match": + [ + 'Ether(src="a4:bf:01:51:27:ca", dst="00:11:22:33:44:55")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255)/GTP_PDUSession_ExtensionHeader(pdu_type=0, qos_flow=0x34)/IP()/TCP()/Raw("x"*20)'], + "unmatched": + [ + 'Ether(src="a4:bf:01:51:27:ca", dst="00:11:22:33:44:55")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255)/GTP_PDUSession_ExtensionHeader(pdu_type=0, qos_flow=0x35)/IP()/Raw("x"*20)']}, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "mark_id": 3, "queue": 1} +} + +tv_mac_ipv4_gtpu_eh_qfi_rss_queues_mark = { + "name": "test_mac_ipv4_gtpu_eh_qfi_rss_queues_mark", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / gtp_psc / end actions rss queues 2 3 end / mark id 1 / end", + "scapy_str": {"match": + [ + 'Ether(src="a4:bf:01:51:27:ca", dst="00:11:22:33:44:55")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/GTP_PDUSession_ExtensionHeader(pdu_type=0)/IP()/TCP()/Raw("x"*20)'], + "unmatched": + [ + 'Ether(src="a4:bf:01:51:27:ca", dst="00:11:22:33:44:55")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x1234567)/GTP_PDUSession_ExtensionHeader(pdu_type=0)/IP()/TCP()/Raw("x"*20)']}, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "mark_id": 1, "queue": [2, 3]} } -tv_mac_ipv4_tun_mac_ipv4_pay_queue_index_mark = { - "name": "test_mac_ipv4_tun_mac_ipv4_pay_queue_index_mark", - "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / end actions queue index 1 / mark id 1 / end", - "scapy_str": MAC_IPV4_TUN_IPV4_PAY_MAC_IPV4_TUN_MAC_IPV4_PAY, +vectors_mac_ipv4_gtpu_eh = [tv_mac_ipv4_gtpu_eh_queue_index, tv_mac_ipv4_gtpu_eh_queue_group, + tv_mac_ipv4_gtpu_eh_passthru, tv_mac_ipv4_gtpu_eh_drop, + tv_mac_ipv4_gtpu_eh_mark_rss, tv_mac_ipv4_gtpu_eh_mark, + tv_mac_ipv4_gtpu_eh_qfi_queue_index_mark, tv_mac_ipv4_gtpu_eh_qfi_rss_queues_mark] + +tv_mac_ipv4_gtpu_queue_index = { + "name": "test_mac_ipv4_gtpu_queue_index", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / end actions queue index 1 / mark / end", + "scapy_str": MAC_IPV4_GTPU, "check_func": rfc.check_mark, - "check_param": {"port_id": 0, "queue": 1, "mark_id": 1, "mark": True} + "check_param": {"port_id": 0, "mark_id": 0, "queue": 1} } -tv_mac_ipv4_tun_mac_ipv4_udp_queue_index_mark = { - "name": "test_mac_ipv4_tun_mac_ipv4_udp_queue_index_mark", - "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / udp src is 22 dst is 23 / end actions queue index 1 / mark id 1 / end", - "scapy_str": MAC_IPV4_TUN_IPV4_UDP_MAC_IPV4_TUN_MAC_IPV4_UDP, +tv_mac_ipv4_gtpu_queue_group = { + "name": "test_mac_ipv4_gtpu_queue_group", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / end actions rss queues 0 1 end / mark / end", + "scapy_str": MAC_IPV4_GTPU, "check_func": rfc.check_mark, - "check_param": {"port_id": 0, "queue": 1, "mark_id": 1, "mark": True} + "check_param": {"port_id": 0, "mark_id": 0, "queue": [0, 1]} } -tv_mac_ipv4_tun_mac_ipv4_tcp_queue_index_mark = { - "name": "test_mac_ipv4_tun_mac_ipv4_tcp_queue_index_mark", - "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / tcp src is 22 dst is 23 / end actions queue index 1 / mark id 1 / end", - "scapy_str": MAC_IPV4_TUN_IPV4_TCP_MAC_IPV4_TUN_MAC_IPV4_TCP, +tv_mac_ipv4_gtpu_passthru = { + "name": "test_mac_ipv4_gtpu_passthru", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / end actions passthru / mark / end", + "scapy_str": MAC_IPV4_GTPU, "check_func": rfc.check_mark, - "check_param": {"port_id": 0, "queue": 1, "mark_id": 1, "mark": True} + "check_param": {"port_id": 0, "mark_id": 0, "rss": True} } -tv_mac_ipv4_tun_mac_ipv4_sctp_queue_index_mark = { - "name": "test_mac_ipv4_tun_mac_ipv4_sctp_queue_index_mark", - "rule": "flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / sctp src is 22 dst is 23 / end actions queue index 1 / mark id 1 / end", - "scapy_str": MAC_IPV4_TUN_IPV4_SCTP_MAC_IPV4_TUN_MAC_IPV4_SCTP, +tv_mac_ipv4_gtpu_drop = { + "name": "test_mac_ipv4_gtpu_drop", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / end actions drop / end", + "scapy_str": MAC_IPV4_GTPU, "check_func": rfc.check_mark, - "check_param": {"port_id": 0, "queue": 1, "mark_id": 1, "mark": True} + "check_param": {"port_id": 0, "drop": True} } -vectors_ipv4_pay = [tv_mac_ipv4_pay_queue_index, tv_mac_ipv4_pay_selected_inputset_queue_index, - tv_mac_ipv4_pay_drop, tv_mac_ipv4_pay_queue_group, tv_mac_ipv4_pay_queue_index_mark] - -vectors_ipv4_udp = [tv_mac_ipv4_udp_drop, tv_mac_ipv4_udp_queue_group, tv_mac_ipv4_udp_queue_index_mark, - tv_mac_ipv4_udp_queue_index] - -vectors_ipv4_tcp = [tv_mac_ipv4_tcp_drop, tv_mac_ipv4_tcp_queue_group, tv_mac_ipv4_tcp_queue_index, - tv_mac_ipv4_tcp_queue_index_mark] - -vectors_ipv4_sctp = [tv_mac_ipv4_sctp_queue_drop_mark, tv_mac_ipv4_sctp_queue_group, tv_mac_ipv4_sctp_drop, - tv_mac_ipv4_sctp_queue_index] - -vectors_ipv6_pay = [tv_mac_ipv6_pay_drop, tv_mac_ipv6_pay_queue_group, tv_mac_ipv6_pay_queue_index, - tv_mac_ipv6_pay_queue_index_mark, tv_mac_ipv6_pay_selected_inputset_queue_index] - -vectors_ipv6_udp = [tv_mac_ipv6_udp_drop, tv_mac_ipv6_udp_queue_group, tv_mac_ipv6_udp_queue_index, - tv_mac_ipv6_udp_queue_index_mark] - -vectors_ipv6_tcp = [tv_mac_ipv6_tcp_drop, tv_mac_ipv6_tcp_queue_group, tv_mac_ipv6_tcp_queue_index, - tv_mac_ipv6_tcp_queue_index_mark] - -vectors_ipv6_sctp = [tv_mac_ipv6_sctp_queue_index_mark, tv_mac_ipv6_sctp_drop, tv_mac_ipv6_sctp_queue_group, - tv_mac_ipv6_sctp_queue_index] - -vectors_ipv4_tun_ipv4 = [tv_mac_ipv4_tun_ipv4_pay_drop, tv_mac_ipv4_tun_ipv4_pay_queue_group, - tv_mac_ipv4_tun_ipv4_pay_queue_index, tv_mac_ipv4_tun_ipv4_pay_queue_index_mark, - tv_mac_ipv4_tun_ipv4_sctp_drop, tv_mac_ipv4_tun_ipv4_sctp_queue_group, - tv_mac_ipv4_tun_ipv4_sctp_queue_index, tv_mac_ipv4_tun_ipv4_sctp_queue_index_mark, - tv_mac_ipv4_tun_ipv4_tcp_drop, tv_mac_ipv4_tun_ipv4_tcp_drop_mark, - tv_mac_ipv4_tun_ipv4_tcp_queue_group, tv_mac_ipv4_tun_ipv4_tcp_queue_index, - tv_mac_ipv4_tun_ipv4_udp_drop, tv_mac_ipv4_tun_ipv4_udp_queue_group, - tv_mac_ipv4_tun_ipv4_udp_queue_group_mark, tv_mac_ipv4_tun_ipv4_udp_queue_index] +tv_mac_ipv4_gtpu_mark_rss = { + "name": "test_mac_ipv4_gtpu_mark_rss", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / end actions mark / rss / end", + "scapy_str": MAC_IPV4_GTPU, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "mark_id": 0, "rss": True} +} -vectors_ipv4_tun_mac = [tv_mac_ipv4_tun_mac_ipv4_pay_queue_index_mark, tv_mac_ipv4_tun_mac_ipv4_pay_drop, - tv_mac_ipv4_tun_mac_ipv4_pay_queue_group, tv_mac_ipv4_tun_mac_ipv4_pay_queue_index, - tv_mac_ipv4_tun_mac_ipv4_sctp_drop, tv_mac_ipv4_tun_mac_ipv4_sctp_queue_group, - tv_mac_ipv4_tun_mac_ipv4_sctp_queue_index, tv_mac_ipv4_tun_mac_ipv4_sctp_queue_index_mark, - tv_mac_ipv4_tun_mac_ipv4_tcp_drop, tv_mac_ipv4_tun_mac_ipv4_tcp_queue_group, - tv_mac_ipv4_tun_mac_ipv4_tcp_queue_index, tv_mac_ipv4_tun_mac_ipv4_tcp_queue_index_mark, - tv_mac_ipv4_tun_mac_ipv4_udp_drop, tv_mac_ipv4_tun_mac_ipv4_udp_queue_group, - tv_mac_ipv4_tun_mac_ipv4_udp_queue_index, tv_mac_ipv4_tun_mac_ipv4_udp_queue_index_mark] +tv_mac_ipv4_gtpu_mark = { + "name": "tv_mac_ipv4_gtpu_mark", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / end actions mark / end", + "scapy_str": MAC_IPV4_GTPU, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "mark_id": 0, "rss": True} +} -test_vectors_gtpu_ipv4_pay = [tv_mac_ipv4_gtpu_ipv4_pay_drop, tv_mac_ipv4_gtpu_ipv4_pay_mark_count_query, - tv_mac_ipv4_gtpu_ipv4_pay_queue_group, tv_mac_ipv4_gtpu_ipv4_pay_queue_index] +vectors_mac_ipv4_gtpu = [tv_mac_ipv4_gtpu_queue_index, tv_mac_ipv4_gtpu_queue_group, + tv_mac_ipv4_gtpu_passthru, tv_mac_ipv4_gtpu_drop, + tv_mac_ipv4_gtpu_mark_rss, tv_mac_ipv4_gtpu_mark] class TestCVLFdir(TestCase): - def check_rule(self, port_id=0, stats=True, rule_list=None): - out = self.dut.send_command("flow list %s" % port_id, timeout=2) - p = re.compile(r"ID\s+Group\s+Prio\s+Attr\s+Rule") - m = p.search(out) - if stats: - self.verify(m, "flow rule on port %s is not existed" % port_id) - if rule_list: - p = re.compile("^(\d+)\s") - li = out.splitlines() - res = list(filter(bool, list(map(p.match, li)))) - result = [i.group(1) for i in res] - self.verify(sorted(result) == sorted(rule_list), - "check rule list failed. expect %s, result %s" % (rule_list, result)) - else: - self.verify(not m, "flow rule on port %s is existed" % port_id) - - def destroy_rule(self, rule_id, port_id=0): - if isinstance(rule_id, list): - for i in rule_id: - out = self.dut.send_command("flow destroy %s rule %s" % (port_id, i), timeout=1) - p = re.compile(r"Flow rule #(\d+) destroyed") - m = p.search(out) - self.verify(m, "flow rule %s delete failed" % rule_id) - else: - out = self.dut.send_command("flow destroy %s rule %s" % (port_id, rule_id), timeout=1) - p = re.compile(r"Flow rule #(\d+) destroyed") - m = p.search(out) - self.verify(m, "flow rule %s delete failed" % rule_id) - def query_count(self, hits_set, hits, port_id=0, rule_id=0): out = self.dut.send_command("flow query %s %s count" % (port_id, rule_id), timeout=1) p = re.compile("hits_set:\s(\d+).*hits:\s(\d+)", re.DOTALL) @@ -895,39 +1257,47 @@ class TestCVLFdir(TestCase): test_results = {} for tv in vectors: try: - count = 1 if not tv["check_param"].get("count") else tv["check_param"]["count"] - port_id = tv["check_param"]["port_id"] - mark = tv["check_param"].get("mark") + count = 1 + port_id = tv["check_param"]["port_id"] if tv["check_param"].get("port_id") is not None else 0 + drop = tv["check_param"].get("drop") # create rule rule_li = self.create_fdir_rule(tv["rule"], check_stats=True) # send and check match packets out1 = self.send_pkts_getouput(pkts=tv["scapy_str"]["match"], port_id=port_id, - count=count, mark=mark) - tv["check_func"](out1, pkt_num=len(tv["scapy_str"]["match"]), check_param=tv["check_param"]) - # send and check unmatch packets - out2 = self.send_pkts_getouput(pkts=tv["scapy_str"]["unmatch"], port_id=port_id, - count=count, mark=mark) - tv["check_func"](out2, pkt_num=len(tv["scapy_str"]["unmatch"]), check_param=tv["check_param"], + count=count, drop=drop) + matched_queue = tv["check_func"](out1, pkt_num=len(tv["scapy_str"]["match"]), + check_param=tv["check_param"]) + # send and check unmatched packets + out2 = self.send_pkts_getouput(pkts=tv["scapy_str"]["unmatched"], port_id=port_id, + count=count, drop=drop) + tv["check_func"](out2, pkt_num=len(tv["scapy_str"]["unmatched"]), check_param=tv["check_param"], stats=False) if tv["check_param"].get("count"): self.query_count(tv["check_param"]["count"]["hits_set"], tv["check_param"]["count"]["hits"], port_id=port_id, rule_id=rule_li[0]) # list and destroy rule - self.check_rule(port_id=tv["check_param"]["port_id"], rule_list=rule_li) - self.destroy_rule(rule_id=rule_li, port_id=port_id) + self.check_fdir_rule(port_id=tv["check_param"]["port_id"], rule_list=rule_li) + self.destroy_fdir_rule(rule_id=rule_li, port_id=port_id) # send matched packet out3 = self.send_pkts_getouput(pkts=tv["scapy_str"]["match"], port_id=port_id, - count=count, mark=mark) - tv["check_func"](out3, pkt_num=len(tv["scapy_str"]["match"]), check_param=tv["check_param"], - stats=False) + count=count, drop=drop) + matched_queue2 = tv["check_func"](out3, pkt_num=len(tv["scapy_str"]["match"]), + check_param=tv["check_param"], + stats=False) + if tv["check_param"].get("rss"): + self.verify(matched_queue == matched_queue2 and None not in matched_queue, + "send twice matched packet, received in deferent queues") # check not rule exists - self.check_rule(port_id=port_id, stats=False) + self.check_fdir_rule(port_id=port_id, stats=False) test_results[tv["name"]] = True - print((GREEN("case passed: %s" % tv["name"]))) + self.logger.info((GREEN("case passed: %s" % tv["name"]))) except Exception as e: - print((RED(e))) + self.logger.warning((RED(e))) + self.dut.send_command("flow flush 0", timeout=1) + self.dut.send_command("flow flush 1", timeout=1) test_results[tv["name"]] = False + self.logger.info((GREEN("case failed: %s" % tv["name"]))) continue failed_cases = [] for k, v in list(test_results.items()): @@ -973,13 +1343,16 @@ class TestCVLFdir(TestCase): # specify a fixed rss-hash-key for cvl ether self.pmd_output.execute_cmd( "port config 0 rss-hash-key ipv4 1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd") + self.pmd_output.execute_cmd( + "port config 1 rss-hash-key ipv4 1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd") res = self.pmd_output.wait_link_status_up('all', timeout=15) self.verify(res is True, 'there have port link is down') - def launch_testpmd_with_mark(self): + def launch_testpmd_with_mark(self, rxq=64, txq=64): self.pmd_output.start_testpmd(cores="1S/4C/1T", - param="--portmask=%s --rxq=64 --txq=64 --port-topology=loop" % self.portMask, - eal_param="-w %s,flow-mark-support=1 -w %s,flow-mark-support=1" % ( + param="--portmask=%s --rxq=%d --txq=%d --port-topology=loop" % ( + self.portMask, rxq, txq), + eal_param="-w %s,flow-mark-support=1 -w %s,flow-mark-support=1 --log-level=ice,7" % ( self.pci0, self.pci1), socket=self.ports_socket) self.config_testpmd() @@ -988,32 +1361,44 @@ class TestCVLFdir(TestCase): tx_port = self.tester_iface0 if not tx_port else tx_port self.pkt.send_pkt(crb=self.tester, tx_port=tx_port, count=count) - def send_pkts_getouput(self, pkts, port_id=0, count=1, mark=None): + def send_pkts_getouput(self, pkts, port_id=0, count=1, drop=False): tx_port = self.tester_iface0 if port_id == 0 else self.tester_iface1 - self.send_packets(pkts, tx_port=tx_port, count=count) + time.sleep(1) - if mark: - out = (self.pmd_output.get_output(), self.pmd_output.execute_cmd("stop")) - else: + if drop: + self.pmd_output.execute_cmd("clear port stats all") + time.sleep(0.5) + self.send_packets(pkts, tx_port=tx_port, count=count) out = self.pmd_output.execute_cmd("stop") - self.pmd_output.execute_cmd("start") + self.pmd_output.execute_cmd("start") + else: + self.send_packets(pkts, tx_port=tx_port, count=count) + out = self.pmd_output.get_output() return out - def create_fdir_rule(self, rule, check_stats=None): - # dpdk get a warning message(ice_interrupt_handler), it'll mess up output stream, testpmd> probably not be - # print completely. + def create_fdir_rule(self, rule: (list, str), check_stats=None, msg=None, validate=True): + if validate: + if isinstance(rule, list): + validate_rule = [i.replace('create', 'validate') for i in rule] + else: + validate_rule = rule.replace('create', 'validate') + self.validate_fdir_rule(validate_rule, check_stats=check_stats) p = re.compile(r"Flow rule #(\d+) created") rule_list = [] if isinstance(rule, list): for i in rule: - out = self.dut.send_command(i, timeout=1) + out = self.pmd_output.execute_cmd(i, timeout=1) + if msg: + self.verify(msg in out, "failed: expect %s in %s" % (msg, out)) m = p.search(out) if m: rule_list.append(m.group(1)) else: rule_list.append(False) elif isinstance(rule, str): - out = self.dut.send_command(rule, timeout=1) + out = self.pmd_output.execute_cmd(rule, timeout=1) + if msg: + self.verify(msg in out, "failed: expect %s in %s" % (msg, out)) m = p.search(out) if m: rule_list.append(m.group(1)) @@ -1027,11 +1412,37 @@ class TestCVLFdir(TestCase): self.verify(not any(rule_list), "all rules should create failed, result %s" % rule_list) return rule_list + def validate_fdir_rule(self, rule, check_stats=True, check_msg=None): + flag = 'Flow rule validated' + if isinstance(rule, str): + out = self.pmd_output.execute_cmd(rule, timeout=1) + if check_stats: + self.verify(flag in out.strip(), "rule %s validated failed, result %s" % (rule, out)) + else: + if check_msg: + self.verify(flag not in out.strip() and check_msg in out.strip(), + "rule %s validate should failed with msg: %s, but result %s" % (rule, check_msg, out)) + else: + self.verify(flag not in out.strip(), "rule %s validate should failed, result %s" % (rule, out)) + elif isinstance(rule, list): + for r in rule: + out = self.pmd_output.execute_cmd(r, timeout=1) + if check_stats: + self.verify(flag in out.strip(), "rule %s validated failed, result %s" % (r, out)) + else: + if not check_msg: + self.verify(flag not in out.strip(), "rule %s validate should failed, result %s" % (r, out)) + else: + self.verify(flag not in out.strip() and check_msg in out.strip(), + "rule %s should validate failed with msg: %s, but result %s" % ( + r, check_msg, out)) + def check_fdir_rule(self, port_id=0, stats=True, rule_list=None): - out = self.dut.send_command("flow list %s" % port_id, timeout=2) + out = self.pmd_output.execute_cmd("flow list %s" % port_id) p = re.compile(r"ID\s+Group\s+Prio\s+Attr\s+Rule") + matched = p.search(out) if stats: - self.verify(p.search(out), "flow rule on port %s is not existed" % port_id) + self.verify(matched, "flow rule on port %s is not existed" % port_id) if rule_list: p = re.compile("^(\d+)\s") li = out.splitlines() @@ -1040,10 +1451,10 @@ class TestCVLFdir(TestCase): self.verify(sorted(result) == sorted(rule_list), "check rule list failed. expect %s, result %s" % (rule_list, result)) else: - self.verify(not p.search(out), "flow rule on port %s is existed" % port_id) + self.verify(not matched, "flow rule on port %s is existed" % port_id) def destroy_fdir_rule(self, port_id=0, rule_id=None): - if rule_id == None: + if rule_id is None: rule_id = 0 if isinstance(rule_id, list): for i in rule_id: @@ -1057,228 +1468,368 @@ class TestCVLFdir(TestCase): m = p.search(out) self.verify(m, "flow rule %s delete failed" % rule_id) - def test_mac_ipv4_pay(self): - self._rte_flow_validate(vectors_ipv4_pay) - - def test_mac_ipv4_udp(self): - self._rte_flow_validate(vectors_ipv4_udp) - - def test_mac_ipv4_tcp(self): - self._rte_flow_validate(vectors_ipv4_tcp) - - def test_mac_ipv4_sctp(self): - self._rte_flow_validate((vectors_ipv4_sctp)) - - def test_mac_ipv6_pay(self): - self._rte_flow_validate(vectors_ipv6_pay) - - def test_mac_ipv6_udp(self): - self._rte_flow_validate(vectors_ipv6_udp) - - def test_mac_ipv6_tcp(self): - self._rte_flow_validate(vectors_ipv6_tcp) + def test_flow_validation(self): + rule = "flow validate 0 ingress pattern eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 proto is 255 ttl is 2 tos is 4 / end actions queue index 1 / end" + self.validate_fdir_rule(rule) + rules3 = [ + 'flow validate 0 ingress pattern eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / end actions queue index 1 / mark / count / end', + 'flow validate 0 ingress pattern eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / end actions rss queues 0 1 end / mark id 1 / count identifier 0x1234 shared on / end', + 'flow validate 0 ingress pattern eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / end actions passthru / mark id 2 / count identifier 0x34 shared off / end', + 'flow validate 0 ingress pattern eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / end actions mark id 3 / rss / count shared on / end', + 'flow validate 0 ingress pattern eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / end actions drop / count shared off / end'] + self.validate_fdir_rule(rules3) + self.check_fdir_rule(stats=False) - def test_mac_ipv6_sctp(self): - self._rte_flow_validate(vectors_ipv6_sctp) + def test_negative_validation(self): + # dpdk now supoort only count action + # self.validate_fdir_rule( + # 'flow validate 0 ingress pattern eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 proto is 255 ttl is 2 tos is 4 / end actions count / end', + # check_stats=False, check_msg='Invalid argument') + self.validate_fdir_rule( + 'flow validate 0 ingress pattern eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 proto is 255 ttl is 2 tos is 4 / and actions end', + check_stats=False, check_msg='Bad arguments') + self.validate_fdir_rule( + 'flow validate 0 ingress pattern eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 proto is 255 ttl is 2 tos is 4 / end actions rss queues 2 3 end / rss / end', + check_stats=False, check_msg='Invalid input action number: Invalid argument') + self.validate_fdir_rule( + 'flow validate 0 ingress pattern eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 proto is 255 ttl is 2 tos is 4 / end actions passthru / mark id 4294967296 / end', + check_stats=False, check_msg='Bad arguments') + self.validate_fdir_rule( + 'flow validate 0 ingress pattern eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 proto is 255 ttl is 2 tc is 4 / end actions queue index 1 / end', + check_stats=False, check_msg='Bad arguments') + self.validate_fdir_rule( + 'flow validate 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 proto is 255 ttl is 2 tos is 4 / end actions queue index 64 / end', + check_stats=False, check_msg='Invalid argument') + self.validate_fdir_rule( + 'flow validate 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 proto is 255 ttl is 2 tos is 4 / end actions rss queues 1 2 3 end / end', + check_stats=False, check_msg='Invalid argument') + self.validate_fdir_rule( + 'flow validate 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 proto is 255 ttl is 2 tos is 4 / end actions rss queues 0 end / end', + check_stats=False, check_msg='Invalid argument') + self.validate_fdir_rule( + 'flow validate 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 proto is 255 ttl is 2 tos is 4 / end actions rss queues end / end', + check_stats=False, check_msg='Invalid argument') + self.validate_fdir_rule( + 'flow validate 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 proto is 255 ttl is 2 tos is 4 / end actions rss queues 1 2 3 5 end / end', + check_stats=False, check_msg='Invalid argument') + self.validate_fdir_rule( + 'flow validate 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 proto is 255 ttl is 2 tos is 4 / end actions rss queues 63 64 end / end', + check_stats=False, check_msg='Invalid argument') + self.validate_fdir_rule( + 'flow validate 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / gtp_psc qfi is 0x100 / end actions queue index 1 / end', + check_stats=False, check_msg='Bad arguments') + self.validate_fdir_rule( + 'flow validate 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x100000000 / gtp_psc qfi is 0x5 / end actions queue index 2 / end', + check_stats=False, check_msg='Bad arguments') + self.validate_fdir_rule( + 'flow validate 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x100000000 / end actions queue index 1 / end', + check_stats=False, check_msg='Bad arguments') + # need run for os default pkg + # self.validate_fdir_rule( + # 'flow validate 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / gtp_psc qfi is 0x34 / end actions drop / end', + # check_stats=False, check_msg='Bad arguments') + self.validate_fdir_rule( + 'flow validate 2 ingress pattern eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 proto is 255 ttl is 2 tos is 4 / end actions queue index 1 / end', + check_stats=False, check_msg='No such device') + self.check_fdir_rule(stats=False) - def test_mac_ipv4_tun_ipv4(self): - self._rte_flow_validate(vectors_ipv4_tun_ipv4) + def test_mac_ipv4_pay_protocal(self): + rules = [ + "flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.21 proto is 1 / end actions queue index 1 / mark id 1 / end", + "flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.21 proto is 17 / end actions passthru / mark id 3 / end"] + rule_li = self.create_fdir_rule(rules, check_stats=True) + pkt1 = 'Ether(dst="00:11:22:33:44:55") / IP(src="192.168.0.20", dst="192.168.0.21", proto=1) / Raw("x" * 80)' + pkt2 = 'Ether(dst="00:11:22:33:44:55") / IP(src="192.168.0.20", dst="192.168.0.21", frag=1, proto=1) / Raw("x" * 80)' + pkt3 = 'Ether(dst="00:11:22:33:44:55") / IP(src="192.168.0.20", dst="192.168.0.21", ttl=2, tos=4) / UDP(sport=22, dport=23) / Raw("x" * 80)' + pkt4 = 'Ether(dst="00:11:22:33:44:55") / IP(src="192.168.0.20", dst="192.168.0.21", frag=1, ttl=2, tos=4) / UDP(sport=22, dport=23) / Raw("x" * 80)' + pkt5 = 'Ether(dst="00:11:22:33:44:55") / IP(src="192.168.0.20", dst="192.168.0.21", proto=17, ttl=2, tos=4) / Raw("x" * 80)' + pkt6 = 'Ether(dst="00:11:22:33:44:55") / IP(src="192.168.0.20", dst="192.168.0.21", frag=1, proto=17, ttl=2, tos=4) / Raw("x" * 80)' + + out = self.send_pkts_getouput([pkt1, pkt2]) + port_id = 0 + p = re.compile(r'port\s+%s/queue(.+?):\s+received\s+(\d+)\s+packets.*?FDIR matched ID=(\S+)' % port_id, re.S) + res = p.findall(out) + pkt_num = sum([int(i[1]) for i in res]) + pkt_queue = set([int(i[0]) for i in res]) + pkt_mark_id = set([i[2] for i in res]) + self.verify(pkt_num == 2, "received pkts %s, expect 2" % pkt_num) + self.verify(all([i == 1 for i in pkt_queue]), "wrong received queue %s, expect 1" % pkt_queue) + self.verify(all([i == '0x1' for i in pkt_mark_id]), "wrong received mark id %s, expect 0x1" % pkt_mark_id) + + out2 = self.send_pkts_getouput([pkt3, pkt4, pkt5, pkt6]) + res = p.findall(out2) + pkt_num = sum([int(i[1]) for i in res]) + pkt_mark_id = set([i[2] for i in res]) + self.verify(pkt_num == 4, "received pkts %s, expect 4" % pkt_num) + rfc.verify_directed_by_rss(out2) + self.verify(all([i == '0x3' for i in pkt_mark_id]), "wrong received mark id %s, expect 0x1" % pkt_mark_id) + + pkt7 = 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.20",dst="192.168.0.22", proto=1) / Raw("x" * 80)' + pkt8 = 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.20",dst="192.168.0.21", proto=6) / Raw("x" * 80)' + pkt9 = 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.20",dst="192.168.0.21")/TCP(sport=22,dport=23)/ Raw("x" * 80)' + pkt10 = 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.20",dst="192.168.0.21", frag=1)/TCP(sport=22,dport=23)/ Raw("x" * 80)' + + out3 = self.send_pkts_getouput([pkt7, pkt8, pkt9, pkt10]) + fdir_scanner = re.compile("FDIR matched ID=(0x\w+)") + p2 = re.compile(r"port\s+%s/queue\s+(\d+):\s+received\s+(\d+)\s+packets" % port_id) + res = p2.findall(out3) + pkt_num = sum([int(i[1]) for i in res]) + self.verify(pkt_num == 4, "received pkts %s, expect 4" % pkt_num) + self.verify(not fdir_scanner.search(out3), "should not FDIR matched ID included in output: %s" % out3) + + self.check_fdir_rule(port_id=port_id, rule_list=rule_li) + self.destroy_fdir_rule(rule_id=rule_li) + + out = self.send_pkts_getouput([pkt1, pkt2, pkt3, pkt4, pkt5, pkt6]) + res = p2.findall(out) + pkt_num = sum([int(i[1]) for i in res]) + self.verify(pkt_num == 6, "received pkts %s, expect 6" % pkt_num) + self.verify(not fdir_scanner.search(out3), "should not FDIR matched ID included in output: %s" % out3) + self.check_fdir_rule(stats=False) - def test_mac_ipv4_tun_mac(self): - self._rte_flow_validate(vectors_ipv4_tun_mac) + def test_mac_ipv6_pay_protocal(self): + rules = [ + "flow create 0 ingress pattern eth / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 proto is 44 / end actions rss queues 5 6 end / mark id 1 / end", + "flow create 0 ingress pattern eth / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 proto is 6 / end actions mark id 2 / rss / end"] + rule_li = self.create_fdir_rule(rules, check_stats=True) + pkt1 = 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", src="ABAB:910A:2222:5498:8475:1111:3900:1010", nh=44, tc=1, hlim=2)/("X"*480)' + pkt2 = 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", src="ABAB:910A:2222:5498:8475:1111:3900:1010")/IPv6ExtHdrFragment(b"1000")/("X"*480)' + pkt3 = 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", src="ABAB:910A:2222:5498:8475:1111:3900:1010", nh=44)/TCP(sport=22,dport=23)/("X"*480)' + pkt4 = 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", src="ABAB:910A:2222:5498:8475:1111:3900:1010")/IPv6ExtHdrFragment(b"1000")/TCP(sport=22,dport=23)/("X"*480)' + pkt5 = 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", nh=6)/("X"*480)' + pkt6 = 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020")/TCP(sport=22,dport=23)/("X"*480)' + + out = self.send_pkts_getouput([pkt1, pkt2, pkt3, pkt4]) + port_id = 0 + p = re.compile(r'port\s+%s/queue(.+?):\s+received\s+(\d+)\s+packets.*?FDIR matched ID=(\S+)' % port_id, re.S) + res = p.findall(out) + pkt_num = sum([int(i[1]) for i in res]) + pkt_queue = set([int(i[0]) for i in res]) + pkt_mark_id = set([i[2] for i in res]) + self.verify(pkt_num == 4, "received pkts %s, expect 4" % pkt_num) + self.verify(all([i in [5, 6] for i in pkt_queue]), "wrong received queue %s, expect 5 or 6]" % pkt_queue) + self.verify(all([i == '0x1' for i in pkt_mark_id]), "wrong received mark id %s, expect 0x1" % pkt_mark_id) + + out2 = self.send_pkts_getouput([pkt5, pkt6]) + res = p.findall(out2) + pkt_num = sum([int(i[1]) for i in res]) + pkt_mark_id = set([i[2] for i in res]) + self.verify(pkt_num == 2, "received pkts %s, expect 2" % pkt_num) + rfc.verify_directed_by_rss(out2) + self.verify(all([i == '0x2' for i in pkt_mark_id]), "wrong received mark id %s, expect 0x2" % pkt_mark_id) + + pkt8 = 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020")/UDP(sport=22,dport=23)/("X"*480)' + pkt9 = 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", nh=17)/("X"*480)' + + out3 = self.send_pkts_getouput([pkt8, pkt9]) + fdir_scanner = re.compile("FDIR matched ID=(0x\w+)") + p2 = re.compile(r"port\s+%s/queue\s+(\d+):\s+received\s+(\d+)\s+packets" % port_id) + res = p2.findall(out3) + pkt_num = sum([int(i[1]) for i in res]) + self.verify(pkt_num == 2, "received pkts %s, expect 3" % pkt_num) + self.verify(not fdir_scanner.search(out3), "should not FDIR matched ID included in output: %s" % out3) + + self.check_fdir_rule(port_id=port_id, rule_list=rule_li) + self.destroy_fdir_rule(rule_id=rule_li) + + out = self.send_pkts_getouput([pkt1, pkt2, pkt3, pkt4, pkt5, pkt6]) + res = p2.findall(out) + pkt_num = sum([int(i[1]) for i in res]) + self.verify(pkt_num == 6, "received pkts %s, expect 6" % pkt_num) + self.verify(not fdir_scanner.search(out3), "should not FDIR matched ID included in output: %s" % out3) + self.check_fdir_rule(stats=False) - def test_queue_index_wrong_parameters(self): - rule1 = "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 proto is 255 ttl is 2 tos is 4 / end actions queue index 64 / end" - self.create_fdir_rule(rule1, check_stats=False) - rule2 = [ - "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 proto is 255 ttl is 2 tos is 4 / end actions queue index 1 / end", - "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 proto is 255 ttl is 2 tos is 4 / end actions queue index 2 / end", - "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 proto is 255 ttl is 2 tos is 4 / end actions drop / end"] - res = self.create_fdir_rule(rule2) - self.verify(res[0], "create fdir rule failed, result %s" % res) - self.verify(not any(res[1:]), "created wrong fdir rule %s should fail" % rule2[1:]) - - def test_queue_group_wrong_parameters(self): - rule1 = "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 proto is 255 ttl is 2 tos is 4 / end actions rss queues 0 1 2 end / end" - rule2 = "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 proto is 255 ttl is 2 tos is 4 / end actions rss queues 0 end / end" - rule3 = "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 proto is 255 ttl is 2 tos is 4 / end actions rss queues 1 2 3 5 end / end" - rule4 = "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 proto is 255 ttl is 2 tos is 4 / end actions rss queues 63 64 end / end" - rule5 = "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 ttl is 2 tos is 4 / end actions rss queues 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 end / end" - res = self.create_fdir_rule([rule1, rule2, rule3, rule4], check_stats=False) - self.dut.send_command("stop", timeout=1) - self.dut.send_command("port stop all", timeout=1) - self.dut.send_command("port config all rxq 32", timeout=1) - self.dut.send_command("port config all txq 32", timeout=2) - self.dut.send_command("port start all", timeout=1) - self.pmd_output.execute_cmd("start") - res = self.create_fdir_rule(rule5, check_stats=False) - self.dut.send_command("stop", timeout=1) - self.dut.send_command("port stop all", timeout=1) - self.dut.send_command("port config all rxq 64", timeout=1) - self.dut.send_command("port config all txq 64", timeout=2) - self.dut.send_command("port start all", timeout=1) - self.pmd_output.execute_cmd("start") - result = True + def test_invalid_parameters_of_queue_index(self): + rule = "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 proto is 255 ttl is 2 tos is 4 / end actions queue index 64 / end" + out = self.dut.send_command(rule, timeout=1) + self.verify("Invalid input action: Invalid argument" in out, "failed with output: %s" % out) + self.check_fdir_rule(port_id=0, stats=False) + + def test_invalid_parameters_of_rss_queues(self): + rule1 = [ + "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 proto is 255 ttl is 2 tos is 4 / end actions rss queues 1 2 3 end / end", + "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 proto is 255 ttl is 2 tos is 4 / end actions rss queues 0 end / end", + "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 proto is 255 ttl is 2 tos is 4 / end actions rss queues end / end"] + self.create_fdir_rule(rule=rule1, check_stats=False, msg='Invalid input action: Invalid argument') + rule2 = 'flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 proto is 255 ttl is 2 tos is 4 / end actions rss queues 1 2 3 5 end / end' + self.create_fdir_rule(rule2, check_stats=False, msg='Invalid input action: Invalid argument') + rule3 = 'flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 proto is 255 ttl is 2 tos is 4 / end actions rss queues 63 64 end / end' + self.create_fdir_rule(rule3, check_stats=False, msg='Invalid input action: Invalid argument') try: - self.create_fdir_rule(rule5, check_stats=True) - out = self.send_pkts_getouput(pkts=MAC_IPV4_PAY["match"]) - rfc.check_queue(out, pkt_num=len(MAC_IPV4_PAY["match"]), check_param={"port_id": 0, "queue": list(range(64))}) - out = self.send_pkts_getouput(pkts=MAC_IPV4_PAY["unmatch"]) - rfc.check_queue(out, pkt_num=len(MAC_IPV4_PAY["unmatch"]), check_param={"port_id": 0, "queue": list(range(64))}) + # restart testpmd + self.dut.send_expect("quit", "# ") + self.dut.kill_all() + self.launch_testpmd_with_mark(rxq=7, txq=7) + self.pmd_output.execute_cmd("start") + rule4 = 'flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 ttl is 2 tos is 4 proto is 255 / end actions rss queues 0 1 2 3 4 5 6 7 end / end' + self.create_fdir_rule(rule4, check_stats=False) + self.check_fdir_rule(port_id=0, stats=False) + # restart testpmd + self.dut.send_expect("quit", "# ") + self.dut.kill_all() + self.launch_testpmd_with_mark(rxq=8, txq=8) + self.pmd_output.execute_cmd("start") + self.create_fdir_rule(rule4, check_stats=True) + out = self.send_pkts_getouput(pkts=MAC_IPV4_PAY['match']) + rfc.check_mark(out, pkt_num=len(MAC_IPV4_PAY['match']), check_param={"port_id": 0, "queue": list(range(8))}, + stats=True) + out2 = self.send_pkts_getouput(pkts=MAC_IPV4_PAY['unmatched']) + rfc.check_mark(out2, pkt_num=len(MAC_IPV4_PAY['unmatched']), + check_param={"port_id": 0, "queue": list(range(8))}, stats=True) except Exception as e: - result = False - print((RED("failed:" + str(e)))) + raise Exception(e) finally: - # restore testpmd config to default, then verify results - self.config_testpmd() - self.verify(result, "check failed") + self.dut.kill_all() + self.launch_testpmd_with_mark() + + def test_invalid_parameters_of_input_set(self): + rule = [ + "flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / gtp_psc qfi is 0x100 / end actions queue index 1 / end", + "flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x100000000 / gtp_psc qfi is 0x5 / end actions queue index 2 / end", + "flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x100000000 / end actions queue index 1 / end" + ] + self.create_fdir_rule(rule, check_stats=False, msg="Bad arguments") + self.check_fdir_rule(stats=False) - def test_mac_ipv4_gtpu_ipv4_pay_teid_mark_count_query(self): - rule = "flow create 1 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / gtp_psc / ipv4 / end actions rss queues 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 end / mark id 100 / count / end" - p_gtpu1 = 'Ether(src="a4:bf:01:51:27:ca", dst="00:00:00:00:01:03") / IP(src="192.168.0.20", dst="192.168.0.21") / UDP(dport=2152) / GTP_U_Header(gtp_type=255, teid=0x12345678) / GTP_PDUSession_ExtensionHeader(pdu_type=0, qos_flow=0x35) / IP() / Raw("x" * 20)' - p_gtpu2 = 'Ether(src="a4:bf:01:51:27:ca", dst="00:00:00:00:01:03")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x1234567)/GTP_PDUSession_ExtensionHeader(pdu_type=0, qos_flow=0x34)/IP()/UDP()/Raw("x"*20)' - # create fdir rule + def test_invalid_parameters_of_mark_id(self): + rule = "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 / end actions queue index 1 / mark id 4294967296 / end" + self.create_fdir_rule(rule, check_stats=False, msg="Bad arguments") + self.check_fdir_rule(stats=False) + + def test_duplicated_rules(self): + rule = "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 ttl is 2 tos is 4 / end actions queue index 1 / end" rule_li = self.create_fdir_rule(rule, check_stats=True) - out = self.send_pkts_getouput(pkts=p_gtpu1, port_id=1, mark=True) - check_param = {"port_id": 1, "queue": list(range(64)), "mark_id": 100} - rfc.check_mark(out, pkt_num=1, check_param=check_param) - - out = self.send_pkts_getouput(pkts=p_gtpu2, port_id=1, mark=True) - rfc.check_queue(out[1], pkt_num=1, check_param=check_param) - mark_scanner = "FDIR matched ID=(0x\w+)" - res = re.search(mark_scanner, out[0]) - self.verify(not res, "FDIR should not in %s" % out[0]) - self.query_count(1, 1, 1, 0) - - self.check_fdir_rule(port_id=1, stats=True) - self.destroy_fdir_rule(port_id=1, rule_id=rule_li[0]) - # send matched packets - out = self.send_pkts_getouput(pkts=p_gtpu1, port_id=1, mark=True) - rfc.check_queue(out[1], pkt_num=1, check_param=check_param, stats=True) - res = re.search(mark_scanner, out[0]) - self.verify(not res, "FDIR should not in %s" % out[0]) - self.check_fdir_rule(port_id=1, stats=False) + self.create_fdir_rule(rule, check_stats=False, msg="Rule already exists!: File exists", validate=False) + self.check_fdir_rule(stats=True, rule_list=rule_li) - def test_mac_ipv4_gtpu_ipv4_pay_qfi_mark_count_query(self): - rule = "flow create 1 ingress pattern eth / ipv4 / udp / gtpu / gtp_psc qfi is 0x34 / ipv4 / end actions drop / mark id 3 / count / end" - p_gtpu1 = 'Ether(src="a4:bf:01:51:27:ca", dst="00:00:00:00:01:03")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/GTP_PDUSession_ExtensionHeader(pdu_type=0, qos_flow=0x34)/IP()/TCP()/Raw("x"*20)' - p_gtpu2 = 'Ether(src="a4:bf:01:51:27:ca", dst="00:00:00:00:01:03")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/GTP_PDUSession_ExtensionHeader(pdu_type=0, qos_flow=0x35)/IP()/Raw("x"*20)' - # create fdir rule - res = self.create_fdir_rule(rule, check_stats=True) - check_param = {"port_id": 1, "mark": True, "mark_id": 3} - # send matched packet - out = self.send_pkts_getouput(pkts=p_gtpu1, port_id=1, mark=True) - rfc.check_mark(out, pkt_num=1, check_param=check_param, stats=True) - # send unmatched packet - out1 = self.send_pkts_getouput(pkts=p_gtpu2, port_id=1, mark=True) - rfc.check_mark(out1, pkt_num=1, check_param=check_param, stats=False) - self.query_count(1, 1, 1, 0) - self.check_fdir_rule(port_id=1, stats=True, rule_list=res) - self.destroy_fdir_rule(port_id=1, rule_id=0) - # send matched packets - out = self.send_pkts_getouput(p_gtpu1, port_id=1, mark=True) - rfc.check_mark(out, pkt_num=1, check_param={"port_id": 1}, stats=False) - self.check_fdir_rule(port_id=1, stats=False) + def test_conflicted_rules(self): + rule1 = "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 ttl is 2 tos is 4 / end actions queue index 1 / end" + rule_li = self.create_fdir_rule(rule1, check_stats=True) + rule2 = [ + "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 ttl is 2 tos is 4 / end actions queue index 2 / end", + "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 ttl is 2 tos is 4 / end actions drop / end", + 'flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.21 ttl is 2 tos is 4 / end actions queue index 3 / mark / end', + 'flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 ttl is 2 tos is 4 / udp src is 22 dst is 23 / end actions queue index 3 / mark / end'] + self.create_fdir_rule(rule2[0:2], check_stats=False, msg="Rule already exists!: File exists", validate=False) + self.create_fdir_rule(rule2[2:], check_stats=False, msg="Invalid input action number: Invalid argument", validate=False) + self.check_fdir_rule(stats=True, rule_list=rule_li) + + def test_conflicted_actions(self): + rule1 = "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 ttl is 2 tos is 4 / end actions queue index 1 / rss queues 2 3 end / end" + self.create_fdir_rule(rule1, check_stats=False, msg="Invalid input action number: Invalid argument") + self.check_fdir_rule(stats=False) - def test_mac_ipv4_gtpu_ipv4_pay_multirules(self): - rule1 = "flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / gtp_psc qfi is 0x34 / ipv4 / end actions queue index 1 / end" - rule2 = "flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / gtp_psc qfi is 0x35 / ipv4 / end actions queue index 2 / end" - rule3 = "flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x1234567 / gtp_psc qfi is 0x35 / ipv4 / end actions queue index 3 / end" - res = self.create_fdir_rule(rule=[rule1, rule2, rule3], check_stats=True) - rule4 = "flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x1234567 / gtp_psc qfi is 0x35 / ipv4 / end actions queue index 3 / end" - rule5 = "flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x1234567 / gtp_psc qfi is 0x35 / ipv4 / end actions queue index 4 / end" - rule6 = "flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x1234567 / gtp_psc qfi is 0x75 / ipv4 / end actions queue index 4 / end" - res2 = self.create_fdir_rule(rule=[rule4, rule5, rule6], check_stats=False) - rule7 = "flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x1234567 / gtp_psc qfi is 0x34 / ipv4 / end actions queue index 3 / end" - res3 = self.create_fdir_rule(rule7, check_stats=True) - p_gtpu1 = 'Ether(src="a4:bf:01:51:27:ca", dst="00:00:00:00:01:03")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/GTP_PDUSession_ExtensionHeader(pdu_type=0, qos_flow=0x34)/IP()/Raw("x"*20)' - p_gtpu2 = 'Ether(src="a4:bf:01:51:27:ca", dst="00:00:00:00:01:03")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x1234567)/GTP_PDUSession_ExtensionHeader(pdu_type=0, qos_flow=0x34)/IP()/Raw("x"*20)' - p_gtpu3 = 'Ether(src="a4:bf:01:51:27:ca", dst="00:00:00:00:01:03")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/GTP_PDUSession_ExtensionHeader(pdu_type=0, qos_flow=0x35)/IP()/Raw("x"*20)' - p_gtpu4 = 'Ether(src="a4:bf:01:51:27:ca", dst="00:00:00:00:01:03")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x1234567)/GTP_PDUSession_ExtensionHeader(pdu_type=0, qos_flow=0x35)/IP()/Raw("x"*20)' - p_gtpu5 = 'Ether(src="a4:bf:01:51:27:ca", dst="00:00:00:00:01:03")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x1234567)/GTP_PDUSession_ExtensionHeader(pdu_type=0, qos_flow=0x36)/IP()/Raw("x"*20)' - out1 = self.send_pkts_getouput(p_gtpu1) - rfc.check_queue(out1, pkt_num=1, check_param={"queue": 1}) - out2 = self.send_pkts_getouput(p_gtpu2) - rfc.check_queue(out2, pkt_num=1, check_param={"queue": 3}) - out3 = self.send_pkts_getouput(p_gtpu3) - rfc.check_queue(out3, pkt_num=1, check_param={"queue": 2}) - out4 = self.send_pkts_getouput(p_gtpu4) - rfc.check_queue(out4, pkt_num=1, check_param={"queue": 3}) - out5 = self.send_pkts_getouput(p_gtpu5) - rfc.check_queue(out5, pkt_num=1, check_param={"queue": [1, 2, 3]}, stats=False) - res.extend(res3) - self.check_fdir_rule(port_id=0, stats=True, rule_list=res) - self.dut.send_command("flow flush 0", timeout=1) - out1 = self.send_pkts_getouput(p_gtpu1) - rfc.check_queue(out1, pkt_num=1, check_param={"queue": 1}, stats=False) - out2 = self.send_pkts_getouput(p_gtpu2) - rfc.check_queue(out2, pkt_num=1, check_param={"queue": 3}, stats=False) - out3 = self.send_pkts_getouput(p_gtpu3) - rfc.check_queue(out3, pkt_num=1, check_param={"queue": 2}, stats=False) - out4 = self.send_pkts_getouput(p_gtpu4) - rfc.check_queue(out4, pkt_num=1, check_param={"queue": 3}, stats=False) - - def test_mac_ipv4_gtpu_ipv4_pay_two_ports(self): - rule1 = 'flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / gtp_psc qfi is 0x34 / ipv4 / end actions queue index 1 / end' - rule2 = 'flow create 1 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / gtp_psc qfi is 0x34 / ipv4 / end actions queue index 1 / end' - rule3 = 'flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / gtp_psc qfi is 0x35 / ipv4 / end actions queue index 2 / end' - rule4 = 'flow create 1 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / gtp_psc qfi is 0x35 / ipv4 / end actions queue index 3 / end' - rule5 = 'flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / gtp_psc qfi is 0x34 / ipv4 / end actions queue index 1 / end' - rule6 = 'flow create 1 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / gtp_psc / ipv4 / end actions queue index 2 / end' - - p_gtpu1 = 'Ether(src="a4:bf:01:51:27:ca", dst="00:00:00:00:01:03")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/GTP_PDUSession_ExtensionHeader(pdu_type=0, qos_flow=0x34)/IP()/Raw("x"*20)' - p_gtpu2 = 'Ether(src="a4:bf:01:51:27:ca", dst="00:00:00:00:01:03")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/GTP_PDUSession_ExtensionHeader(pdu_type=0, qos_flow=0x35)/IP()/Raw("x"*20)' - p_gtpu3 = 'Ether(src="a4:bf:01:51:27:ca", dst="00:00:00:00:01:03")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/GTP_PDUSession_ExtensionHeader(pdu_type=0, qos_flow=0x35)/IP()/Raw("x"*20)' - res1 = self.create_fdir_rule([rule1, rule2], check_stats=True) - out1 = self.send_pkts_getouput(p_gtpu1) - rfc.check_queue(out1, pkt_num=1, check_param={"queue": 1}) - out2 = self.send_pkts_getouput(p_gtpu1, port_id=1) - rfc.check_queue(out2, pkt_num=1, check_param={"port_id": 1, "queue": 1}) - - res2 = self.create_fdir_rule([rule3, rule4], check_stats=True) - out1 = self.send_pkts_getouput(p_gtpu2) - rfc.check_queue(out1, pkt_num=1, check_param={"queue": 2}) - out2 = self.send_pkts_getouput(p_gtpu2, port_id=1) - rfc.check_queue(out2, pkt_num=1, check_param={"port_id": 1, "queue": 3}) + def test_void_action(self): + rule = "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 ttl is 2 tos is 4 / end actions end" + self.create_fdir_rule(rule, check_stats=False, msg="Invalid input action: Invalid argument") + self.check_fdir_rule(stats=False) - self.dut.send_command("flow flush 0", timeout=1) - self.dut.send_command("flow flush 1", timeout=1) + def _test_unsupported_action(self): + # now dpdk has already support only count action, so this case need update or abandon + rule = "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 ttl is 2 tos is 4 / end actions count / end" + self.create_fdir_rule(rule, check_stats=False, msg="Invalid input action: Invalid argument") + self.check_fdir_rule(stats=False) - res3 = self.create_fdir_rule([rule5, rule6]) - self.verify(all(res3), "rules should be create seccess, result is %s" % res3) - out1 = self.send_pkts_getouput(p_gtpu3) - rfc.check_queue(out1, pkt_num=1, check_param={"queue": 1}, stats=False) - out2 = self.send_pkts_getouput(p_gtpu3, port_id=1) - rfc.check_queue(out2, pkt_num=1, check_param={"port_id": 1, "queue": 2}, stats=True) + def test_delete_a_nonexistent_rule(self): + self.check_fdir_rule(stats=False) + out = self.pmd_output.execute_cmd("flow destroy 0 rule 0") + self.verify(not "error" in out, "failed, destroy non-existent rule should not raise error") + self.check_fdir_rule(stats=False) + out = self.pmd_output.execute_cmd("flow flush 0") + self.verify(not "error" in out, "failed, flush non-existent rule should not raise error") + self.check_fdir_rule(stats=False) - self.check_fdir_rule(port_id=0, rule_list=res3[0]) - self.check_fdir_rule(port_id=1, rule_list=res3[1]) + def test_unsupported_input_set_field(self): + rule = "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 tc is 2 / end actions queue index 1 / end" + self.create_fdir_rule(rule, check_stats=False, msg="Bad arguments") + self.check_fdir_rule(stats=False) - self.destroy_fdir_rule(0, 0) - self.destroy_fdir_rule(1, 0) + def test_invalid_port(self): + rule = "flow create 2 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / end actions queue index 1 / end" + self.create_fdir_rule(rule, check_stats=False, msg="No such device: No such device") + out = self.pmd_output.execute_cmd("flow list 2") + self.verify("Invalid port 2" in out, "expect Invalid port 2 in %s" % out) - out1 = self.send_pkts_getouput([p_gtpu1, p_gtpu2]) - rfc.check_queue(out1, pkt_num=2, check_param={"port_id": 0, "queue": [1, 2]}, stats=False) - out2 = self.send_pkts_getouput([p_gtpu1, p_gtpu2, p_gtpu3], port_id=1) - rfc.check_queue(out2, pkt_num=3, check_param={"port_id": 1, "queue": [1, 2, 3]}, stats=False) + def _test_unsupported_pattern(self): + # only test with OS default package + rule = "flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / gtp_psc qfi is 0x34 / end actions drop / end" + self.create_fdir_rule(rule, check_stats=False) + self.check_fdir_rule(stats=False) - self.check_fdir_rule(0, stats=False) - self.check_fdir_rule(1, stats=False) + def test_conflict_patterns(self): + fdir_flag = "ice_flow_create(): Succeeded to create (1) flow" + switch_flag = "ice_flow_create(): Succeeded to create (2) flow" + pkts = ['Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.20",dst="192.168.0.21")/Raw("x" * 80)', + 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.20",dst="192.168.0.21") /UDP(sport=22, dport=23)/ Raw("x" * 80)'] + rule1 = 'flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.21 / end actions queue index 1 / end' + out = self.pmd_output.execute_cmd(rule1) + self.verify(fdir_flag in out, "fdir rule should be created") + out = self.send_pkts_getouput(pkts=pkts) + rfc.check_mark(out, pkt_num=2, check_param={"port_id": 0, "queue": 1}, stats=True) - def test_mac_ipv4_gtpu_ipv4_pay_wrong_parameters(self): - rule1 = 'flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / gtp_psc qfi is 0x100 / ipv4 / end actions queue index 1 / end' - rule2 = 'flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x100000000 / gtp_psc qfi is 0x5 / ipv4 / end actions queue index 2 / end' - self.create_fdir_rule([rule1, rule2], check_stats=False) - self.check_fdir_rule(0, stats=False) + rule2 = "flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.21 / udp src is 22 dst is 23 / end actions queue index 2 / end" + out = self.pmd_output.execute_cmd(rule2) + self.verify(switch_flag in out, "switch rule should be created") + out = self.send_pkts_getouput(pkts=pkts[0]) + rfc.check_mark(out, pkt_num=1, check_param={"port_id": 0, "queue": 1}, stats=True) + out = self.send_pkts_getouput(pkts=pkts[1]) + rfc.check_mark(out, pkt_num=1, check_param={"port_id": 0, "queue": 2}, stats=True) + + self.pmd_output.execute_cmd('flow flush 0') + out = self.pmd_output.execute_cmd(rule2) + self.verify(fdir_flag in out, "fdir rule should be created") + out = self.send_pkts_getouput(pkts=pkts[1]) + rfc.check_mark(out, pkt_num=1, check_param={"port_id": 0, "queue": 2}, stats=True) + out = self.pmd_output.execute_cmd(rule1) + self.verify(switch_flag in out, "switch rule should be created") + out = self.send_pkts_getouput(pkts=pkts[1]) + rfc.check_mark(out, pkt_num=1, check_param={"port_id": 0, "queue": 1}, stats=True) + + def test_count_for_1_rule(self): + rule = ["flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 proto is 255 ttl is 2 tos is 4 / end actions queue index 1 / count / end", + "flow create 1 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 proto is 255 ttl is 2 tos is 4 / end actions count / end"] + rule_li = self.create_fdir_rule(rule, check_stats=True) + out = self.send_pkts_getouput(pkts=MAC_IPV4_PAY['match']) + rfc.check_mark(out, pkt_num=len(MAC_IPV4_PAY['match']), check_param={"port_id": 0, "queue": 1}, + stats=True) + out = self.send_pkts_getouput(port_id=1, pkts=MAC_IPV4_PAY['match']) + rfc.check_mark(out, pkt_num=len(MAC_IPV4_PAY['match']), check_param={"port_id": 1, "rss": True}, + stats=True) + + out = self.send_pkts_getouput(pkts=MAC_IPV4_PAY['unmatched']) + rfc.check_mark(out, pkt_num=len(MAC_IPV4_PAY['unmatched']), check_param={"port_id": 0, "rss": True}, + stats=False) + out = self.send_pkts_getouput(port_id=1, pkts=MAC_IPV4_PAY['unmatched']) + rfc.check_mark(out, pkt_num=len(MAC_IPV4_PAY['unmatched']), check_param={"port_id": 1, "rss": True}, + stats=False) + self.query_count(1, 2, 0, 0) + self.query_count(1, 2, 1, 0) + self.check_fdir_rule(port_id=0, stats=True, rule_list=['0']) + self.check_fdir_rule(port_id=1, stats=True, rule_list=['0']) + self.destroy_fdir_rule(0, ['0']) + self.destroy_fdir_rule(1, ['0']) + out = self.send_pkts_getouput(pkts=MAC_IPV4_PAY['match']) + rfc.check_mark(out, pkt_num=len(MAC_IPV4_PAY['match']), check_param={"port_id": 0, "rss": True}, + stats=False) + out = self.send_pkts_getouput(port_id=1, pkts=MAC_IPV4_PAY['match']) + rfc.check_mark(out, pkt_num=len(MAC_IPV4_PAY['match']), check_param={"port_id": 0, "rss": True}, + stats=False) + self.check_fdir_rule(stats=False) + self.check_fdir_rule(port_id=1, stats=False) + out = self.pmd_output.execute_cmd("flow query 0 0 count") + self.verify("Flow rule #0 not found" in out, "query should failed") + out = self.pmd_output.execute_cmd("flow query 1 0 count") + self.verify("Flow rule #0 not found" in out, "query should failed") def test_count_query_identifier_share(self): rule1 = 'flow create 0 ingress pattern eth / ipv4 src is 192.168.0.1 / end actions queue index 1 / count identifier 0x1234 shared on / end' - rule2 = 'flow create 0 ingress pattern eth / ipv4 src is 192.168.0.2 / end actions queue index 2 / count identifier 0x1234 shared on / end' - rule3 = 'flow create 0 ingress pattern eth / ipv4 src is 192.168.0.3 / end actions queue index 3 / count identifier 0x1234 shared off / end' - rule4 = 'flow create 0 ingress pattern eth / ipv4 src is 192.168.0.4 / end actions queue index 4 / count identifier 0x1234 / end' + rule2 = 'flow create 0 ingress pattern eth / ipv4 src is 192.168.0.2 / end actions rss queues 2 3 end / count identifier 0x1234 shared on / end' + rule3 = 'flow create 0 ingress pattern eth / ipv4 src is 192.168.0.3 / end actions passthru / mark / count identifier 0x1234 shared off / end' + rule4 = 'flow create 0 ingress pattern eth / ipv4 src is 192.168.0.4 / end actions mark id 1 / rss / count identifier 0x1234 / end' rule5 = 'flow create 0 ingress pattern eth / ipv4 src is 192.168.0.5 / end actions queue index 5 / count shared on / end' rule6 = 'flow create 0 ingress pattern eth / ipv4 src is 192.168.0.6 / end actions drop / count shared on / end' rule7 = 'flow create 0 ingress pattern eth / ipv4 src is 192.168.0.7 / end actions drop / count identifier 0x1235 shared on / end' + rule8 = 'flow create 0 ingress pattern eth / ipv4 src is 192.168.0.8 / end actions rss / count / end' pkt1 = 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.1",dst="192.168.0.21") / Raw("x" * 80)' pkt2 = 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.2",dst="192.168.0.21") / Raw("x" * 80)' @@ -1287,23 +1838,26 @@ class TestCVLFdir(TestCase): pkt5 = 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.5",dst="192.168.0.21") / Raw("x" * 80)' pkt6 = 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.6",dst="192.168.0.21") / Raw("x" * 80)' pkt7 = 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.7",dst="192.168.0.21") / Raw("x" * 80)' + pkt8 = 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.8",dst="192.168.0.21") / Raw("x" * 80)' - res = self.create_fdir_rule([rule1, rule2, rule3, rule4, rule5, rule6, rule7]) + res = self.create_fdir_rule([rule1, rule2, rule3, rule4, rule5, rule6, rule7, rule8], check_stats=True) self.verify(all(res), "create rules failed, result: %s" % res) out1 = self.send_pkts_getouput(pkt1, count=10) - rfc.check_queue(out1, pkt_num=10, check_param={"queue": 1}, stats=True) + rfc.check_mark(out1, pkt_num=10, check_param={"queue": 1}, stats=True) out2 = self.send_pkts_getouput(pkt2, count=10) - rfc.check_queue(out2, pkt_num=10, check_param={"queue": 2}, stats=True) + rfc.check_mark(out2, pkt_num=10, check_param={"queue": [2, 3]}, stats=True) out3 = self.send_pkts_getouput(pkt3, count=10) - rfc.check_queue(out3, pkt_num=10, check_param={"queue": 3}, stats=True) + rfc.check_mark(out3, pkt_num=10, check_param={"mark_id": 0, "rss": True}, stats=True) out4 = self.send_pkts_getouput(pkt4, count=10) - rfc.check_queue(out4, pkt_num=10, check_param={"queue": 4}, stats=True) + rfc.check_mark(out4, pkt_num=10, check_param={"mark_id": 1, "rss": True}, stats=True) out5 = self.send_pkts_getouput(pkt5, count=10) - rfc.check_queue(out5, pkt_num=10, check_param={"queue": 5}, stats=True) - out6 = self.send_pkts_getouput(pkt6, count=10) + rfc.check_mark(out5, pkt_num=10, check_param={"queue": 5}, stats=True) + out6 = self.send_pkts_getouput(pkt6, count=10, drop=True) rfc.check_drop(out6, pkt_num=10, check_param={"port_id": 0}) - out7 = self.send_pkts_getouput(pkt7, count=10) + out7 = self.send_pkts_getouput(pkt7, count=10, drop=True) rfc.check_drop(out7, pkt_num=10, check_param={"port_id": 0}) + out8 = self.send_pkts_getouput(pkt8, count=10) + rfc.check_mark(out8, pkt_num=10, check_param={"rss": True}, stats=True) self.query_count(1, 20, 0, 0) self.query_count(1, 20, 0, 1) @@ -1312,26 +1866,26 @@ class TestCVLFdir(TestCase): self.query_count(1, 20, 0, 4) self.query_count(1, 20, 0, 5) self.query_count(1, 10, 0, 6) + self.query_count(1, 10, 0, 7) self.check_fdir_rule(0, stats=True, rule_list=res) self.dut.send_command("flow flush 0", timeout=1) - out = self.send_pkts_getouput(pkts=[pkt1, pkt2, pkt3, pkt4, pkt5]) - rfc.check_queue(out, pkt_num=5, check_param={"port_id": 0, "queue": list(range(1, 6))}, stats=False) - out6 = self.send_pkts_getouput(pkt6, count=10) - rfc.check_drop(out6, pkt_num=10, check_param={"port_id": 0}, stats=False) - out7 = self.send_pkts_getouput(pkt7, count=10) - rfc.check_drop(out7, pkt_num=10, check_param={"port_id": 0}, stats=False) - self.check_fdir_rule(stats=False) - def test_multi_patterns_count_query(self): - rule1 = 'flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.21 / tcp src is 22 dst is 23 / end actions queue index 1 / count / end' - rule2 = 'flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.21 / udp src is 22 dst is 23 / end actions drop / count / end' - rule3 = 'flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.21 / sctp src is 22 dst is 23 / end actions rss queues 62 63 end / count / end' - rule4 = 'flow create 0 ingress pattern eth / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 / end actions queue index 1 / count / end' - rule5 = 'flow create 0 ingress pattern eth / ipv4 / udp / vxlan / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / udp src is 22 dst is 23 / end actions queue index 3 / count / end' - rule6 = 'flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 src is 192.168.0.20 / tcp dst is 23 / end actions queue index 4 / count / end' - rule7 = 'flow create 0 ingress pattern eth / ipv4 / udp / vxlan / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / sctp src is 22 dst is 23 / end actions queue index 5 / count / end' + self.send_pkts_getouput(pkts=[pkt1, pkt2, pkt3, pkt4, pkt5, pkt6, pkt7, pkt8]) + out = self.pmd_output.execute_cmd("flow query 0 0 count") + self.verify("Flow rule #0 not found" in out, "query should failed") + + def test_multi_patterns_mark_count_query(self): + rule1 = 'flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.21 / tcp src is 22 dst is 23 / end actions queue index 1 / mark id 0 / count / end' + rule2 = 'flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.21 / udp src is 22 dst is 23 / end actions drop / mark id 1 / count / end' + rule3 = 'flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.21 / sctp src is 22 dst is 23 / end actions rss queues 62 63 end / mark id 2 / count / end' + rule4 = 'flow create 0 ingress pattern eth / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 / end actions queue index 1 / mark id 3 / count / end' + rule5 = 'flow create 0 ingress pattern eth / ipv4 / udp / vxlan / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / udp src is 22 dst is 23 / end actions queue index 3 / mark id 4 / count / end' + rule6 = 'flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 src is 192.168.0.20 / tcp dst is 23 / end actions queue index 4 / count / mark id 5 / end' + rule7 = 'flow create 0 ingress pattern eth / ipv4 / udp / vxlan / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / sctp src is 22 dst is 23 / end actions queue index 5 / mark id 6 / count / end' + rule8 = 'flow create 1 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / end actions rss queues 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 \ + 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 end / mark id 100 / count / end' pkt1 = 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.20",dst="192.168.0.21") /TCP(sport=22, dport=23)/ Raw("x" * 80)' pkt2 = 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.20",dst="192.168.0.21") /UDP(sport=22, dport=23)/ Raw("x" * 80)' @@ -1340,203 +1894,359 @@ class TestCVLFdir(TestCase): pkt5 = 'Ether(dst="00:11:22:33:44:55")/IP()/UDP(dport=4790)/VXLAN(flags=0xc)/IP(dst="192.168.0.21", src="192.168.0.20")/UDP(sport=22,dport=23)/("X"*480)' pkt6 = 'Ether(dst="00:11:22:33:44:55")/IP()/UDP()/VXLAN(vni=2)/Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.20")/TCP(dport=23)/("X"*480)' pkt7 = 'Ether(dst="00:11:22:33:44:55")/IP()/UDP()/VXLAN(vni=2)/Ether()/IP(src="192.168.0.20", dst="192.168.0.21")/SCTP(sport=22,dport=23)/("X"*480)' + pkt8 = 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/IP()/Raw("x"*20)' - res = self.create_fdir_rule(rule=[rule1, rule2, rule3, rule4, rule5, rule6, rule7], check_stats=True) + res = self.create_fdir_rule(rule=[rule1, rule2, rule3, rule4, rule5, rule6, rule7, rule8], check_stats=True) self.verify(all(res), "create rules failed, result %s" % res) out = self.send_pkts_getouput(pkts=pkt1, count=10) - rfc.check_queue(out, pkt_num=10, check_param={"queue": 1}, stats=True) - out = self.send_pkts_getouput(pkts=pkt2, count=10) + rfc.check_mark(out, pkt_num=10, check_param={"queue": 1, "mark_id": 0}, stats=True) + out = self.send_pkts_getouput(pkts=pkt2, count=10, drop=True) rfc.check_drop(out, pkt_num=10, check_param={"port_id": 0}) out = self.send_pkts_getouput(pkts=pkt3, count=10) - rfc.check_queue(out, pkt_num=10, check_param={"queue": [62, 63]}, stats=True) + rfc.check_mark(out, pkt_num=10, check_param={"queue": [62, 63], "mark_id": 2}, stats=True) out = self.send_pkts_getouput(pkts=pkt4, count=10) - rfc.check_queue(out, pkt_num=10, check_param={"queue": 1}, stats=True) + rfc.check_mark(out, pkt_num=10, check_param={"queue": 1, "mark_id": 3}, stats=True) out = self.send_pkts_getouput(pkts=pkt5, count=10) - rfc.check_queue(out, pkt_num=10, check_param={"queue": 3}, stats=True) + rfc.check_mark(out, pkt_num=10, check_param={"queue": 3, "mark_id": 4}, stats=True) out = self.send_pkts_getouput(pkts=pkt6, count=10) - rfc.check_queue(out, pkt_num=10, check_param={"queue": 4}, stats=True) + rfc.check_mark(out, pkt_num=10, check_param={"queue": 4, "mark_id": 5}, stats=True) out = self.send_pkts_getouput(pkts=pkt7, count=10) - rfc.check_queue(out, pkt_num=10, check_param={"queue": 5}, stats=True) + rfc.check_mark(out, pkt_num=10, check_param={"queue": 5, "mark_id": 6}, stats=True) + out = self.send_pkts_getouput(port_id=1, pkts=pkt8, count=10) + rfc.check_mark(out, pkt_num=10, check_param={"port_id": 1, "rss": True, "mark_id": 100}, stats=True) for i in range(7): self.query_count(1, 10, port_id=0, rule_id=i) - self.check_fdir_rule(port_id=0, stats=True, rule_list=res) + self.query_count(1, 10, port_id=1, rule_id=0) + self.check_fdir_rule(port_id=0, stats=True, rule_list=res[:-1]) + self.dut.send_command("flow flush 0", timeout=1) + self.check_fdir_rule(stats=False) + + self.send_pkts_getouput(pkts=[pkt1, pkt2, pkt3, pkt4, pkt5, pkt6, pkt7, pkt8]) + out = self.pmd_output.execute_cmd("flow query 0 0 count") + self.verify("Flow rule #0 not found" in out, "query should failed") + + def test_max_count_number(self): + pattern = "flow create 0 ingress pattern eth / ipv4 src is 192.168.0.{} / end actions drop / count / end" + rules = [pattern.format(i) for i in range(1, 256)] + [ + "flow create 0 ingress pattern eth / ipv4 src is 192.168.1.1 / end actions drop / count / end"] + res = self.create_fdir_rule(rules, check_stats=True) + + rule2 = 'flow create 0 ingress pattern eth / ipv4 src is 192.168.1.2 / end actions drop / count / end' + self.create_fdir_rule(rule2, check_stats=False, msg="No free counter found", validate=False) + pkt = 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.1.1",dst="192.168.0.21") / Raw("x" * 80)' + out = self.send_pkts_getouput(pkt, count=10, drop=True) + rfc.check_drop(out, pkt_num=10, check_param={"port_id": 0}, stats=True) + self.query_count(1, 10, port_id=0, rule_id=255) + self.check_fdir_rule(0, stats=True, rule_list=res) self.dut.send_command("flow flush 0", timeout=1) - out = self.send_pkts_getouput(pkts=pkt1, count=10) - rfc.check_queue(out, pkt_num=10, check_param={"queue": 1}, stats=False) - out = self.send_pkts_getouput(pkts=pkt2, count=10) + out = self.send_pkts_getouput(pkt, count=10, drop=True) rfc.check_drop(out, pkt_num=10, check_param={"port_id": 0}, stats=False) - out = self.send_pkts_getouput(pkts=pkt3, count=1) - rfc.check_queue(out, pkt_num=1, check_param={"queue": [62, 63]}, stats=False) - out = self.send_pkts_getouput(pkts=[pkt4, pkt5, pkt6, pkt7], count=1) - rfc.check_queue(out, pkt_num=4, check_param={"queue": [1, 3, 4, 5]}, stats=False) self.check_fdir_rule(stats=False) + self.dut.send_command("stop", timeout=2) + self.dut.send_command("quit", timeout=2) + self.launch_testpmd_with_mark() + + def test_same_rule_on_two_ports(self): + rule = [ + 'flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / gtp_psc qfi is 0x34 / end actions queue index 1 / mark / end', + 'flow create 1 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / gtp_psc qfi is 0x34 / end actions queue index 1 / mark / end'] + self.create_fdir_rule(rule=rule, check_stats=True) + p_gtpu1 = 'Ether(src="a4:bf:01:51:27:ca", dst="00:11:22:33:44:55")/IP(src="192.168.0.20", dst="192.168.0.21")/UDP(dport=2152)/GTP_U_Header(gtp_type=255, teid=0x12345678)/GTP_PDUSession_ExtensionHeader(pdu_type=0, qos_flow=0x34)/IP()/Raw("x"*20)' + out1 = self.send_pkts_getouput(pkts=p_gtpu1, port_id=0) + rfc.check_mark(out1, pkt_num=1, check_param={"port_id": 0, "queue": 1, "mark_id": 0}, stats=True) + out2 = self.send_pkts_getouput(pkts=p_gtpu1, port_id=1) + rfc.check_mark(out2, pkt_num=1, check_param={"port_id": 1, "queue": 1, "mark_id": 0}, stats=True) + self.check_fdir_rule(port_id=0, stats=True, rule_list=['0']) + self.check_fdir_rule(port_id=1, stats=True, rule_list=['0']) + self.destroy_fdir_rule(port_id=0) + self.check_fdir_rule(port_id=0, stats=False) + self.check_fdir_rule(port_id=1, stats=True, rule_list=['0']) + out1 = self.send_pkts_getouput(pkts=p_gtpu1, port_id=0) + rfc.check_mark(out1, pkt_num=1, check_param={"port_id": 0, "queue": 1, "rss": True}, stats=False) + out2 = self.send_pkts_getouput(pkts=p_gtpu1, port_id=1) + rfc.check_mark(out2, pkt_num=1, check_param={"port_id": 1, "queue": 1, "mark_id": 0}, stats=True) + self.destroy_fdir_rule(port_id=1) + self.check_fdir_rule(port_id=0, stats=False) + self.check_fdir_rule(port_id=1, stats=False) + out1 = self.send_pkts_getouput(pkts=p_gtpu1, port_id=0) + rfc.check_mark(out1, pkt_num=1, check_param={"port_id": 0, "queue": 1, "rss": True}, stats=False) + out2 = self.send_pkts_getouput(pkts=p_gtpu1, port_id=1) + rfc.check_mark(out2, pkt_num=1, check_param={"port_id": 1, "queue": 1, "rss": True}, stats=False) + + def test_same_intput_set_different_actions_on_two_ports(self): + rule = [ + 'flow create 0 ingress pattern eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / tcp src is 22 dst is 23 / end actions queue index 1 / mark id 1 / end', + 'flow create 1 ingress pattern eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / tcp src is 22 dst is 23 / end actions rss queues 2 3 end / mark id 1 / end'] + self.create_fdir_rule(rule=rule, check_stats=True) + pkt = 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.20",dst="192.168.0.21")/TCP(sport=22,dport=23)/Raw("x" * 80)' + out1 = self.send_pkts_getouput(pkts=pkt, port_id=0) + rfc.check_mark(out1, pkt_num=1, check_param={"port_id": 0, "queue": 1, "mark_id": 1}, stats=True) + out2 = self.send_pkts_getouput(pkts=pkt, port_id=1) + rfc.check_mark(out2, pkt_num=1, check_param={"port_id": 1, "queue": [2, 3], "mark_id": 1}, stats=True) + self.pmd_output.execute_cmd('flow flush 0') + self.pmd_output.execute_cmd('flow flush 1') + self.check_fdir_rule(0, False) + self.check_fdir_rule(1, False) + out1 = self.send_pkts_getouput(pkts=pkt, port_id=0) + rfc.check_mark(out1, pkt_num=1, check_param={"port_id": 0, "queue": 1, "rss": True}, stats=False) + out2 = self.send_pkts_getouput(pkts=pkt, port_id=1) + rfc.check_mark(out2, pkt_num=1, check_param={"port_id": 1, "queue": [2, 3], "rss": True}, stats=False) def test_two_ports_multi_patterns_count_query(self): rules = [ - 'flow create 1 ingress pattern eth / ipv4 dst is 192.168.0.21 proto is 255 tos is 4 / end actions queue index 1 / count / end', - 'flow create 1 ingress pattern eth / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 hop is 2 tc is 1 / sctp src is 22 dst is 23 / end actions rss queues 6 7 end / count / end', - 'flow create 1 ingress pattern eth / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 hop is 2 tc is 1 / udp src is 22 dst is 23 / end actions rss queues 6 7 end / count / end', - 'flow create 1 ingress pattern eth / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 hop is 2 tc is 1 / tcp src is 22 dst is 23 / end actions queue index 2 / count / end', + 'flow create 1 ingress pattern eth / ipv4 dst is 192.168.0.21 proto is 255 tos is 4 / end actions queue index 1 / mark id 1 / count identifier 0x1234 shared on / end', + 'flow create 1 ingress pattern eth / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 hop is 2 tc is 1 / sctp src is 22 dst is 23 / end actions rss queues 6 7 end / mark id 2 / count identifier 0x1234 shared on / end', + 'flow create 1 ingress pattern eth / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 hop is 2 tc is 1 / udp src is 22 dst is 23 / end actions rss queues 6 7 end / mark id 1 / count / end', + 'flow create 1 ingress pattern eth / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 hop is 2 tc is 1 / tcp src is 22 dst is 23 / end actions queue index 2 / mark / count / end', 'flow create 1 ingress pattern eth / ipv4 / udp / vxlan / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / end actions drop / count / end', 'flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.21 tos is 4 / tcp src is 22 dst is 23 / end actions drop / count / end', - 'flow create 0 ingress pattern eth / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 / end actions queue index 1 / count / end' - ] + 'flow create 0 ingress pattern eth / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 src is 2001::2 / end actions queue index 1 / mark id 1 / count identifier 0x1234 shared on / end'] pkts = [ 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.20",dst="192.168.0.21", proto=255, ttl=2, tos=4) / Raw("x" * 80)', - 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", src="2001::2",tc=1, hlim=2)/SCTP(sport=22,dport=23)/("X"*480)', - 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", src="2001::2",tc=1, hlim=2)/UDP(sport=22,dport=23)/("X"*480)', - 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", src="2001::2",tc=1, hlim=2)/TCP(sport=22,dport=23)/("X"*480)', + 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", src="2001::2", tc=1, hlim=2)/SCTP(sport=22,dport=23)/("X"*480)', + 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", src="2001::2", tc=1, hlim=2)/UDP(sport=22,dport=23)/("X"*480)', + 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", src="2001::2", tc=1, hlim=2)/TCP(sport=22,dport=23)/("X"*480)', 'Ether(dst="00:11:22:33:44:55")/IP()/UDP()/VXLAN()/Ether()/IP(src="192.168.0.20", dst="192.168.0.21")/("X"*480)', 'Ether(dst="00:11:22:33:44:55")/IP(dst="192.168.0.21", ttl=2, tos=4)/TCP(sport=22,dport=23)/Raw(load="X"*480)', - 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", src="2001::2", nh=1, tc=1, hlim=2)/("X"*480)', - 'Ether(dst="00:11:22:33:44:55")/IP(dst="192.168.0.21", ttl=2, tos=4)/TCP(sport=22,dport=23)/Raw(load="X"*480)' - ] - res = self.create_fdir_rule(rule=rules, check_stats=True) - out = self.send_pkts_getouput(pkts[0], port_id=1, count=10) - rfc.check_queue(out, pkt_num=10, check_param={"port_id": 1, "queue": 1}, stats=True) - out = self.send_pkts_getouput(pkts[1:3], port_id=1, count=10) - rfc.check_queue(out, pkt_num=20, check_param={"port_id": 1, "queue": [6, 7]}, stats=True) - out = self.send_pkts_getouput(pkts[3], port_id=1, count=10) - rfc.check_queue(out, pkt_num=10, check_param={"port_id": 1, "queue": 2}, stats=True) - out = self.send_pkts_getouput(pkts[4], port_id=1, count=10) - rfc.check_drop(out, pkt_num=10, check_param={"port_id": 1}) - out = self.send_pkts_getouput(pkts[5], count=10) - rfc.check_drop(out, pkt_num=10, check_param={"port_id": 0}) - out = self.send_pkts_getouput(pkts[6], count=10) - rfc.check_queue(out, pkt_num=10, check_param={"port_id": 0, "queue": 1}, stats=True) - out = self.send_pkts_getouput(pkts[7], port_id=1, count=10) - rfc.check_drop(out, pkt_num=10, check_param={"port_id": 1}, stats=False) - + 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", src="2001::2", nh=0, tc=1, hlim=2)/("X"*480)', + 'Ether(dst="00:11:22:33:44:55")/IP(dst="192.168.0.21", ttl=2, tos=4)/TCP(sport=22,dport=23)/Raw(load="X"*480)'] + + self.create_fdir_rule(rule=rules, check_stats=True) + + out1 = self.send_pkts_getouput(pkts[0], port_id=1, count=10) + rfc.check_mark(out1, pkt_num=10, check_param={"port_id": 1, "queue": 1, "mark_id": 1}) + out2 = self.send_pkts_getouput(pkts[1], port_id=1, count=10) + rfc.check_mark(out2, pkt_num=10, check_param={"port_id": 1, "queue": [6, 7], "mark_id": 2}) + out3 = self.send_pkts_getouput(pkts[2], port_id=1, count=10) + rfc.check_mark(out3, pkt_num=10, check_param={"port_id": 1, "queue": [6, 7], "mark_id": 1}) + out4 = self.send_pkts_getouput(pkts[3], port_id=1, count=10) + rfc.check_mark(out4, pkt_num=10, check_param={"port_id": 1, "queue": 2, "mark_id": 0}) + out5 = self.send_pkts_getouput(pkts[4], port_id=1, count=10, drop=True) + rfc.check_mark(out5, pkt_num=10, check_param={"port_id": 1, "drop": True}) + out6 = self.send_pkts_getouput(pkts[5], port_id=0, count=10, drop=True) + rfc.check_mark(out6, pkt_num=10, check_param={"port_id": 0, "drop": True}) + out7 = self.send_pkts_getouput(pkts[6], port_id=0, count=10) + rfc.check_mark(out7, pkt_num=10, check_param={"port_id": 0, "queue": 1, "mark_id": 1}) + out8 = self.send_pkts_getouput(pkts[7], port_id=1, count=10) + rfc.check_mark(out8, pkt_num=10, check_param={"port_id": 1, "mark_id": 0}) + self.query_count(1, 20, 1, 0) + self.query_count(1, 20, 1, 1) + self.query_count(1, 10, 1, 2) + self.query_count(1, 10, 1, 3) + self.query_count(1, 10, 1, 4) + self.query_count(1, 10, 0, 0) + self.query_count(1, 10, 0, 1) + self.check_fdir_rule(port_id=1, stats=True, rule_list=list(map(str, range(5)))) + self.check_fdir_rule(port_id=0, stats=True, rule_list=list(map(str, range(2)))) + self.pmd_output.execute_cmd("flow flush 0") + self.pmd_output.execute_cmd("flow flush 1") + out1 = self.send_pkts_getouput(pkts=pkts[:5].append(pkts[7]), port_id=1, count=10) + rfc.check_mark(out1, pkt_num=60, check_param={"port_id": 1}, stats=False) + out2 = self.send_pkts_getouput(pkts=pkts[5:7], port_id=0, count=10) + rfc.check_mark(out2, pkt_num=20, check_param={"port_id": 0}, stats=False) + self.check_fdir_rule(port_id=0, stats=False) + self.check_fdir_rule(port_id=1, stats=False) for i in range(5): - self.query_count(1, 10, 1, i) + out = self.pmd_output.execute_cmd("flow query %s %s count" % (1, i)) + self.verify("Flow rule #%s not found" % i in out, "expect not rule found, result %s" % out) for i in range(2): - self.query_count(1, 10, 0, i) - self.check_fdir_rule(port_id=0, stats=True, rule_list=res[0:2]) - self.check_fdir_rule(port_id=1, stats=True, rule_list=res[2:]) - - self.dut.send_command("flow flush 0", timeout=1) - self.dut.send_command("flow flush 1", timeout=1) - - out = self.send_pkts_getouput(pkts[0], port_id=1, count=10) - rfc.check_queue(out, pkt_num=10, check_param={"port_id": 1, "queue": 1}, stats=False) - out = self.send_pkts_getouput(pkts[1:3], port_id=1, count=10) - rfc.check_queue(out, pkt_num=20, check_param={"port_id": 1, "queue": [6, 7]}, stats=False) - out = self.send_pkts_getouput(pkts[3], port_id=1, count=10) - rfc.check_queue(out, pkt_num=10, check_param={"port_id": 1, "queue": 2}, stats=False) - out = self.send_pkts_getouput(pkts[4], port_id=1, count=10) - rfc.check_drop(out, pkt_num=10, check_param={"port_id": 1}, stats=False) - out = self.send_pkts_getouput(pkts[5], count=10) - rfc.check_drop(out, pkt_num=10, check_param={"port_id": 0}, stats=False) - out = self.send_pkts_getouput(pkts[6], count=10) - rfc.check_queue(out, pkt_num=10, check_param={"port_id": 0, "queue": 1}, stats=False) - out = self.send_pkts_getouput(pkts[7], port_id=0, count=10) - rfc.check_drop(out, pkt_num=10, check_param={"port_id": 0}, stats=False) - self.check_fdir_rule(0, stats=False) - self.check_fdir_rule(1, stats=False) + out = self.pmd_output.execute_cmd("flow query %s %s count" % (0, i)) + self.verify("Flow rule #%s not found" % i in out, "expect not rule found, result %s" % out) + + def test_port_stop_start_reset(self): + rule = "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / end actions queue index 1 / mark / end" + rule_li = self.create_fdir_rule(rule=rule, check_stats=True) + self.check_fdir_rule(port_id=0, stats=True, rule_list=rule_li) + pkt = 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.20",dst="192.168.0.21") / Raw("x" * 80)' + out1 = self.send_pkts_getouput(pkts=pkt, port_id=0, count=1) + rfc.check_mark(out1, pkt_num=1, check_param={"port_id": 0, "queue": 1, "mark_id": 0}, stats=True) + self.pmd_output.execute_cmd("port stop 0") + self.pmd_output.execute_cmd("port start 0") + self.check_fdir_rule(port_id=0, stats=True, rule_list=rule_li) + out2 = self.send_pkts_getouput(pkts=pkt, port_id=0, count=1) + rfc.check_mark(out2, pkt_num=1, check_param={"port_id": 0, "queue": 1, "mark_id": 0}, stats=True) + + def test_add_delete_rules(self): + self.pmd_output.execute_cmd("stop") + self.dut.send_command("quit", timeout=2) + cmd_path = '/tmp/add_delete_rules' + cmds = [ + 'flow create 0 ingress pattern eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / udp src is 22 dst is 23 / end actions queue index 1 / mark / end', + 'flow create 0 ingress pattern eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / tcp src is 22 dst is 23 / end actions rss queues 2 3 end / mark id 1 / end', + 'flow list 0', 'flow flush 0'] * 15360 + cmds_li = map(lambda x: x + os.linesep, cmds) + with open(cmd_path, 'w') as f: + f.writelines(cmds_li) + self.dut.session.copy_file_to(cmd_path, cmd_path) + try: + eal_param = self.dut.create_eal_parameters(cores="1S/4C/1T", ports=[self.pci0 + ",flow-mark-support=1", + self.pci1 + ",flow-mark-support=1"], + socket=self.ports_socket) + param = " -- -i --portmask=%s --rxq=%d --txq=%d --port-topology=loop --cmdline-file=%s" % ( + self.portMask, 64, 64, cmd_path) + command_line = self.dut.target + "/app/testpmd " + eal_param + param + out = self.dut.send_expect(command_line, 'testpmd>', timeout=600) + self.verify('Failed to create file' not in out, "create some rule failed: %s" % out) + self.config_testpmd() + self.pmd_output.execute_cmd('start') + rules = [ + 'flow create 0 ingress pattern eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / udp src is 22 dst is 23 / end actions queue index 1 / mark / end', + 'flow create 0 ingress pattern eth / ipv4 src is 192.168.0.20 dst is 192.168.0.21 / tcp src is 22 dst is 23 / end actions rss queues 2 3 end / mark id 1 / end'] + rule_li = self.create_fdir_rule(rule=rules, check_stats=True) + self.check_fdir_rule(port_id=0, stats=True, rule_list=rule_li) + pkts = [ + 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.20",dst="192.168.0.21")/UDP(sport=22,dport=23)/Raw("x" * 80)', + 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.20",dst="192.168.0.21")/TCP(sport=22,dport=23)/Raw("x" * 80)'] + out1 = self.send_pkts_getouput(pkts=pkts[0], port_id=0, count=1) + rfc.check_mark(out1, pkt_num=1, check_param={"port_id": 0, "queue": 1, "mark_id": 0}, stats=True) + out2 = self.send_pkts_getouput(pkts=pkts[1], port_id=0, count=1) + rfc.check_mark(out2, pkt_num=1, check_param={"port_id": 0, "queue": [2, 3], "mark_id": 1}, stats=True) + except Exception as e: + raise Exception(e) + finally: + self.dut.kill_all() + self.launch_testpmd_with_mark() - def test_multirules_mark(self): + def test_delete_rules(self): rules = [ - "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 ttl is 2 tos is 4 / udp src is 22 dst is 23 / end actions queue index 1 / mark id 1 / end", - "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 ttl is 2 tos is 4 / tcp src is 22 dst is 23 / end actions queue index 2 / mark id 1 / end", - "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 dst is 192.168.0.21 ttl is 2 tos is 4 / sctp src is 22 dst is 23 / end actions queue index 1 / mark id 2 / count / end"] - - pkt1 = 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.20",dst="192.168.0.21", ttl=2, tos=4) /UDP(sport=22,dport=23)/Raw("x" * 80)' - pkt2 = 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.20",dst="192.168.0.21", ttl=2, tos=4) /TCP(sport=22,dport=23)/Raw("x" * 80)' - pkt3 = 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.20",dst="192.168.0.21", ttl=2, tos=4) /SCTP(sport=22,dport=23)/Raw("x" * 80)' - - res = self.create_fdir_rule(rules, check_stats=True) - - out1 = self.send_pkts_getouput(pkt1, mark=True) - rfc.check_mark(out1, pkt_num=1, check_param={"port_id": 0, "mark_id": 1, "queue": 1}, stats=True) - - out2 = self.send_pkts_getouput(pkt2, mark=True) - rfc.check_mark(out2, pkt_num=1, check_param={"port_id": 0, "mark_id": 1, "queue": 2}, stats=True) - - out3 = self.send_pkts_getouput(pkt3, mark=True) - rfc.check_mark(out3, pkt_num=1, check_param={"port_id": 0, "mark_id": 2, "queue": 1}, stats=True) - - self.query_count(1, 1, port_id=0, rule_id=2) - self.check_fdir_rule(0, stats=True, rule_list=res) - self.destroy_fdir_rule(port_id=0, rule_id=0) + 'flow create 0 ingress pattern eth / ipv4 src is 192.168.56.0 dst is 192.1.0.0 tos is 4 / tcp src is 22 dst is 23 / end actions queue index 1 / mark / end', + 'flow create 0 ingress pattern eth / ipv4 src is 192.168.56.0 dst is 192.1.0.0 tos is 4 / tcp src is 22 dst is 24 / end actions queue index 2 / mark / end', + 'flow create 0 ingress pattern eth / ipv4 src is 192.168.56.0 dst is 192.1.0.0 tos is 4 / tcp src is 22 dst is 25 / end actions queue index 3 / mark / end'] + pkts = [ + 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.56.0",dst="192.1.0.0",tos=4)/TCP(sport=22,dport=23)/Raw("x" * 80)', + 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.56.0",dst="192.1.0.0",tos=4)/TCP(sport=22,dport=24)/Raw("x" * 80)', + 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.56.0",dst="192.1.0.0",tos=4)/TCP(sport=22,dport=25)/Raw("x" * 80)'] + queues = [1, 2, 3] + + for i in range(3): + rule_li = self.create_fdir_rule(rule=rules, check_stats=True) + rule_li2 = copy.copy(rule_li) + pkts2 = copy.copy(pkts) + queues2 = copy.copy(queues) + self.check_fdir_rule(rule_list=rule_li) + out1 = self.send_pkts_getouput(pkts=pkts[0], port_id=0, count=1) + rfc.check_mark(out1, pkt_num=1, check_param={"port_id": 0, "queue": 1, "mark_id": 0}, stats=True) + out2 = self.send_pkts_getouput(pkts=pkts[1], port_id=0, count=1) + rfc.check_mark(out2, pkt_num=1, check_param={"port_id": 0, "queue": 2, "mark_id": 0}, stats=True) + out3 = self.send_pkts_getouput(pkts=pkts[2], port_id=0, count=1) + rfc.check_mark(out3, pkt_num=1, check_param={"port_id": 0, "queue": 3, "mark_id": 0}, stats=True) + self.destroy_fdir_rule(port_id=0, rule_id=i) + rule_li2.pop(i) + pkts2.pop(i) + queues2.pop(i) + self.check_fdir_rule(rule_list=rule_li2) + out1 = self.send_pkts_getouput(pkts=pkts[i], port_id=0, count=1) + rfc.check_mark(out1, pkt_num=1, check_param={"port_id": 0, "queue": queues[i], "mark_id": 0}, stats=False) + out2 = self.send_pkts_getouput(pkts=pkts2[0], port_id=0, count=1) + rfc.check_mark(out2, pkt_num=1, check_param={"port_id": 0, "queue": queues2[0], "mark_id": 0}, stats=True) + out3 = self.send_pkts_getouput(pkts=pkts2[1], port_id=0, count=1) + rfc.check_mark(out3, pkt_num=1, check_param={"port_id": 0, "queue": queues2[1], "mark_id": 0}, stats=True) + self.pmd_output.execute_cmd("flow flush 0") + out1 = self.send_pkts_getouput(pkts=pkts[0], port_id=0, count=1) + rfc.check_mark(out1, pkt_num=1, check_param={"port_id": 0, "queue": 1, "mark_id": 0}, stats=False) + out2 = self.send_pkts_getouput(pkts=pkts[1], port_id=0, count=1) + rfc.check_mark(out2, pkt_num=1, check_param={"port_id": 0, "queue": 2, "mark_id": 0}, stats=False) + out3 = self.send_pkts_getouput(pkts=pkts[2], port_id=0, count=1) + rfc.check_mark(out3, pkt_num=1, check_param={"port_id": 0, "queue": 3, "mark_id": 0}, stats=False) + + def test_max_rules(self): + rule_pattern = "flow create 0 ingress pattern eth / ipv4 src is 192.168.100.20 dst is 192.168.%d.%d / end actions queue index 1 / mark / end" + rules = list() + pkt_pattern = 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.100.20",dst="192.168.%d.%d")/Raw("x" * 80)' + pkts2 = list() + for i in range(60): + for j in range(256): + rules.append(rule_pattern % (i, j)) + pkts2.append(pkt_pattern % (i, j)) + cmd_path = '/tmp/test_max_rules' + cmd_li = map(lambda x: x + os.linesep, rules) + with open(cmd_path, 'w') as f: + f.writelines(cmd_li) + self.pmd_output.execute_cmd("stop") + self.dut.send_command("quit", timeout=2) + self.dut.session.copy_file_to(cmd_path, cmd_path) + try: + out = self.pmd_output.start_testpmd(cores="1S/4C/1T", + param="--portmask=%s --rxq=%d --txq=%d --port-topology=loop --cmdline-file=%s" % ( + self.portMask, 64, 64, cmd_path), + eal_param="-w %s,flow-mark-support=1 -w %s,flow-mark-support=1" % ( + self.pci0, self.pci1), socket=self.ports_socket) + self.verify('Failed to create file' not in out, "create some rule failed: %s" % out) + self.config_testpmd() + self.pmd_output.execute_cmd('start') + rule = "flow create 0 ingress pattern eth / ipv4 src is 192.168.100.20 dst is 192.168.60.0 / end actions queue index 1 / mark / end" + self.create_fdir_rule(rule=rule, check_stats=False, msg='Failed to create flow', validate=False) + rule_li = list(map(str, range(15360))) + self.check_fdir_rule(port_id=0, stats=True, rule_list=rule_li) + pkts = ['Ether(dst="00:11:22:33:44:55")/IP(src="192.168.100.20",dst="192.168.0.0")/Raw("x" * 80)', + 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.100.20",dst="192.168.59.255")/Raw("x" * 80)'] + out1 = self.send_pkts_getouput(pkts=pkts, port_id=0, count=1) + rfc.check_mark(out1, pkt_num=2, check_param={"port_id": 0, "queue": 1, "mark_id": 0}, stats=True) + self.pmd_output.execute_cmd("flow flush 0") + self.check_fdir_rule(port_id=0, stats=False) + out = self.send_pkts_getouput(pkts=pkts2, port_id=0, count=1) + rfc.check_mark(out, pkt_num=len(pkts2), check_param={"port_id": 0, "mark_id": 0}, stats=False) + except Exception as e: + raise Exception(e) + finally: + self.dut.kill_all() + self.launch_testpmd_with_mark() - out1 = self.send_pkts_getouput(pkt1, mark=True) - rfc.check_mark(out1, pkt_num=1, check_param={"port_id": 0, "mark_id": 1, "queue": 1}, stats=False) + def test_mac_ipv4_pay(self): + self._rte_flow_validate(vectors_ipv4_pay) - self.check_fdir_rule(0, stats=True, rule_list=res[1:]) - out2 = self.send_pkts_getouput(pkt2, mark=True) - rfc.check_mark(out2, pkt_num=1, check_param={"port_id": 0, "mark_id": 1, "queue": 2}, stats=True) + def test_mac_ipv4_udp(self): + self._rte_flow_validate(vectors_ipv4_udp) - out3 = self.send_pkts_getouput(pkt3, mark=True) - rfc.check_mark(out3, pkt_num=1, check_param={"port_id": 0, "mark_id": 2, "queue": 1}, stats=True) + def test_mac_ipv4_tcp(self): + self._rte_flow_validate(vectors_ipv4_tcp) - self.query_count(1, 2, port_id=0, rule_id=2) - self.dut.send_command("flow flush 0", timeout=1) + def test_mac_ipv4_sctp(self): + self._rte_flow_validate((vectors_ipv4_sctp)) - out1 = self.send_pkts_getouput(pkt1, mark=True) - rfc.check_mark(out1, pkt_num=1, check_param={"port_id": 0, "mark_id": 1, "queue": 1}, stats=False) + def test_mac_ipv6_pay(self): + self._rte_flow_validate(vectors_ipv6_pay) - out2 = self.send_pkts_getouput(pkt2, mark=True) - rfc.check_mark(out2, pkt_num=1, check_param={"port_id": 0, "mark_id": 1, "queue": 2}, stats=False) + def test_mac_ipv6_udp(self): + self._rte_flow_validate(vectors_ipv6_udp) - out3 = self.send_pkts_getouput(pkt3, mark=True) - rfc.check_mark(out3, pkt_num=1, check_param={"port_id": 0, "mark_id": 2, "queue": 1}, stats=False) + def test_mac_ipv6_tcp(self): + self._rte_flow_validate(vectors_ipv6_tcp) - self.check_fdir_rule(stats=False) + def test_mac_ipv6_sctp(self): + self._rte_flow_validate(vectors_ipv6_sctp) - def test_mark_wrong_parameters(self): - rule = "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 src is 192.168.0.20 / end actions queue index 1 / mark id 4294967296 / end" - self.create_fdir_rule(rule=rule, check_stats=False) - self.check_fdir_rule(stats=False) + def test_mac_ipv4_tun_ipv4_pay(self): + self._rte_flow_validate(vectors_ipv4_tun_ipv4_pay) - def test_pattern_conflict_flow(self): - rule1 = "flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.21 / end actions queue index 1 / end" - self.create_fdir_rule(rule=rule1, check_stats=True) - pkt1 = 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.20",dst="192.168.0.21")/Raw("x" * 80)' - pkt2 = 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.20",dst="192.168.0.21") /UDP(sport=22, dport=23)/ Raw("x" * 80)' - out1 = self.send_pkts_getouput(pkts=[pkt1, pkt2]) - rfc.check_queue(out1, pkt_num=2, check_param={"port_id": 0, "queue": 1}, stats=True) + def test_mac_ipv4_tun_ipv4_udp(self): + self._rte_flow_validate(vectors_ipv4_tun_ipv4_udp) - rule2 = "flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.21 / udp src is 22 dst is 23 / end actions queue index 2 / end" - self.create_fdir_rule(rule=rule2, check_stats=True) - out2 = self.send_pkts_getouput(pkt1) - rfc.check_queue(out2, pkt_num=1, check_param={"port_id": 0, "queue": 1}, stats=True) + def test_mac_ipv4_tun_ipv4_tcp(self): + self._rte_flow_validate(vectors_ipv4_tun_ipv4_tcp) - out3 = self.send_pkts_getouput(pkt2) - rfc.check_queue(out3, pkt_num=1, check_param={"port_id": 0, "queue": 2}, stats=True) + def test_mac_ipv4_tun_ipv4_sctp(self): + self._rte_flow_validate(vectors_ipv4_tun_ipv4_sctp) - self.dut.send_command("flow flush 0", timeout=1) + def test_mac_ipv4_tun_mac_ipv4_pay(self): + self._rte_flow_validate(vectors_mac_ipv4_tun_mac_ipv4_pay) - self.create_fdir_rule(rule=rule2, check_stats=True) - out4 = self.send_pkts_getouput(pkt2) - rfc.check_queue(out4, pkt_num=1, check_param={"port_id": 0, "queue": 2}, stats=True) + def test_mac_ipv4_tun_mac_ipv4_udp(self): + self._rte_flow_validate(vectors_mac_ipv4_tun_mac_ipv4_udp) - self.create_fdir_rule(rule=rule1, check_stats=True) - out5 = self.send_pkts_getouput(pkt2) - rfc.check_queue(out5, pkt_num=1, check_param={"port_id": 0, "queue": 1}, stats=True) + def test_mac_ipv4_tun_mac_ipv4_tcp(self): + self._rte_flow_validate(vectors_mac_ipv4_tun_mac_ipv4_tcp) - def test_max_count(self): - pattern = "flow create 0 ingress pattern eth / ipv4 src is 192.168.0.{} / end actions drop / count / end" - rules = [pattern.format(i) for i in range(1, 256)] + [ - "flow create 0 ingress pattern eth / ipv4 src is 192.168.1.1 / end actions drop / count / end"] - res = self.create_fdir_rule(rules, check_stats=True) + def test_mac_ipv4_tun_mac_ipv4_sctp(self): + self._rte_flow_validate(vectors_mac_ipv4_tun_mac_ipv4_sctp) - rule2 = 'flow create 0 ingress pattern eth / ipv4 src is 192.168.1.2 / end actions drop / count / end' - res2 = self.create_fdir_rule(rule2, check_stats=False) + def test_mac_ipv4_gtpu_eh(self): + self._rte_flow_validate(vectors_mac_ipv4_gtpu_eh) - pkt = 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.1.1",dst="192.168.0.21") / Raw("x" * 80)' - out = self.send_pkts_getouput(pkt, count=10) - rfc.check_drop(out, pkt_num=10, check_param={"port_id": 0}, stats=True) - self.query_count(1, 10, port_id=0, rule_id=255) - self.check_fdir_rule(0, stats=True, rule_list=res) - self.dut.send_command("flow flush 0", timeout=1) - out = self.send_pkts_getouput(pkt, count=10) - rfc.check_drop(out, pkt_num=10, check_param={"port_id": 0}, stats=False) - self.check_fdir_rule(stats=False) - self.dut.send_command("stop", timeout=2) - self.dut.send_command("quit", timeout=2) - self.launch_testpmd_with_mark() + def test_mac_ipv4_gtpu(self): + self._rte_flow_validate(vectors_mac_ipv4_gtpu) def tear_down(self): # destroy all flow rule on port 0 -- 1.8.3.1