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 9C19DA0579; Wed, 18 Mar 2020 09:36:23 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 66E332B9E; Wed, 18 Mar 2020 09:36:23 +0100 (CET) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id CA77F3B5 for ; Wed, 18 Mar 2020 09:36:20 +0100 (CET) IronPort-SDR: BNSnNAO4eAji7rar1bPtWbIY+iQUfvAYKnutg1aRDlxbwTIqlQBf/2cLb/wNHKEG6BwBR7WF03 fJzpBYagKi/w== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2020 01:36:19 -0700 IronPort-SDR: HXYKw/ALk1TxNLeRHQ1Ztchvk07fHL15VINsvonKibcWiMD+ZxiM03tq89+twgJOJ3cUt8NfFN 7nvq3MeSB+lA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,566,1574150400"; d="scan'208";a="324099885" Received: from unknown (HELO dpdk-xiaoqimai-dut.sh.intel.com) ([10.240.183.52]) by orsmga001.jf.intel.com with ESMTP; 18 Mar 2020 01:36:17 -0700 From: Xiao Qimai To: dts@dpdk.org Cc: Xiao Qimai Date: Wed, 18 Mar 2020 16:31:23 +0800 Message-Id: <1584520284-299370-1-git-send-email-qimaix.xiao@intel.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dts] [PATCH V1 1/2]tests/TestSuite_cvl_fdir: update script according to testplan 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" *. update cvl_fdir according to testplan Signed-off-by: Xiao Qimai --- tests/TestSuite_cvl_fdir.py | 754 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 628 insertions(+), 126 deletions(-) diff --git a/tests/TestSuite_cvl_fdir.py b/tests/TestSuite_cvl_fdir.py index a8e3ef8..a790f08 100644 --- a/tests/TestSuite_cvl_fdir.py +++ b/tests/TestSuite_cvl_fdir.py @@ -57,10 +57,17 @@ 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)'], + '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)'], "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.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)' ] } @@ -109,7 +116,7 @@ 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)'], + '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(id=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)', @@ -121,10 +128,15 @@ MAC_IPV6_PAY = { 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)'], + "unmatch": ['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 = { @@ -230,18 +242,45 @@ 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: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)'], + '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)', + '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: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()/IPv6ExtHdrFragment(id=1000)/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()/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)/IPv6()/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)/IPv6()/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=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: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: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)/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)/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)/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)/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)/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)/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)/IP()/ICMP()/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)/IPv6()/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)/IPv6()/IPv6ExtHdrFragment(id=1000)/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)/IPv6()/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)/IPv6()/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)/IPv6()/ICMP()/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)'], + "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)/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)/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=0x12345678)/IPv6()/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)/IP()/Raw("x"*20)'] } tv_mac_ipv4_pay_queue_index = { @@ -252,14 +291,6 @@ tv_mac_ipv4_pay_queue_index = { "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_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", @@ -292,14 +323,6 @@ tv_mac_ipv6_pay_queue_index = { "check_param": {"port_id": 0, "queue": 1} } -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} -} - 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", @@ -643,37 +666,357 @@ tv_mac_ipv4_tun_mac_ipv4_sctp_queue_group = { "check_param": {"port_id": 0, "queue": [1, 2]} } -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, +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_drop, + "check_param": {"port_id": 0} +} + +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 / end", + "scapy_str": MAC_IPV4_GTPU, "check_func": rfc.check_queue, - "check_param": {"port_id": 0, "queue": 1} + "check_param": {"port_id": 0, "queue": [0, 1]} +} + +tv_mac_ipv4_gtpu_eh_mark_count_query = { + "name": "test_mac_ipv4_gtpu_eh_mark_count_query", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / gtp_psc qfi is 0x34 / end actions queue index 2 / mark id 2 / count / end", + "scapy_str": MAC_IPV4_GTPU_EH, + "check_func": rfc.check_mark, + "check_param": {"port_id": 0, "queue": 2, "mark_id": 2, + "count": {"hits_set": 1, "hits": 10}, "mark": True} +} + +tv_mac_ipv4_pay_passthru_count = { + "name": "test_mac_ipv4_pay_passthru_count", + "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 / count / end", + "scapy_str": MAC_IPV4_PAY, + "check_func": rfc.check_passthru, + "check_param": {"port_id": 0, "count": {"hits_set": 1, "hits": 2}, "mark": True, "mark_id": "NOT_SHOW"} +} + +tv_mac_ipv4_pay_passthru_mark = { + "name": "test_mac_ipv4_pay_passthru_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 passthru / mark / end", + "scapy_str": MAC_IPV4_PAY, + "check_func": rfc.check_passthru, + "check_param": {"port_id": 0, "mark": True} +} + +tv_mac_ipv4_udp_passthru_mark = { + "name": "test_mac_ipv4_udp_passthru_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 passthru / end", + "scapy_str": MAC_IPV4_UDP, + "check_func": rfc.check_passthru, + "check_param": {"port_id": 0, "mark": True, "mark_id": "NOT_SHOW"} +} + +tv_mac_ipv4_tcp_passthru_mark = { + "name": "test_mac_ipv4_tcp_passthru_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 passthru / mark / end", + "scapy_str": MAC_IPV4_TCP, + "check_func": rfc.check_passthru, + "check_param": {"port_id": 0, "mark": True} +} + +tv_mac_ipv4_sctp_passthru_mark = { + "name": "test_mac_ipv4_sctp_passthru_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 passthru / mark / end", + "scapy_str": MAC_IPV4_SCTP, + "check_func": rfc.check_passthru, + "check_param": {"port_id": 0, "mark": True} +} + +tv_mac_ipv6_pay_passthru_mark = { + "name": "test_mac_ipv6_pay_passthru_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 passthru / mark / end", + "scapy_str": MAC_IPV6_PAY, + "check_func": rfc.check_passthru, + "check_param": {"port_id": 0, "mark": True} +} + +tv_mac_ipv6_udp_passthru_mark = { + "name": "test_mac_ipv6_udp_passthru_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 passthru / mark / end", + "scapy_str": MAC_IPV6_UDP, + "check_func": rfc.check_passthru, + "check_param": {"port_id": 0, "mark": True} +} + +tv_mac_ipv6_tcp_passthru_mark = { + "name": "test_mac_ipv6_tcp_passthru_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 passthru / mark / end", + "scapy_str": MAC_IPV6_TCP, + "check_func": rfc.check_passthru, + "check_param": {"port_id": 0, "mark": True} +} + +tv_mac_ipv6_sctp_passthru_mark = { + "name": "test_mac_ipv6_sctp_passthru_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 passthru / mark / end", + "scapy_str": MAC_IPV6_SCTP, + "check_func": rfc.check_passthru, + "check_param": {"port_id": 0, "mark": True} +} + +tv_mac_ipv4_tun_ipv4_pay_passthru_mark = { + "name": "test_mac_ipv4_tun_ipv4_pay_passthru_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 passthru / mark / end", + "scapy_str": MAC_IPV4_TUN_IPV4_PAY_MAC_IPV4_TUN_MAC_IPV4_PAY, + "check_func": rfc.check_passthru, + "check_param": {"port_id": 0, "mark": True} +} + +tv_mac_ipv4_tun_ipv4_udp_passthru_mark = { + "name": "test_mac_ipv4_tun_ipv4_udp_passthru_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 passthru / mark / end", + "scapy_str": MAC_IPV4_TUN_IPV4_UDP_MAC_IPV4_TUN_MAC_IPV4_UDP, + "check_func": rfc.check_passthru, + "check_param": {"port_id": 0, "mark": True} +} + +tv_mac_ipv4_tun_ipv4_tcp_passthru_mark = { + "name": "test_mac_ipv4_tun_ipv4_tcp_passthru_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 passthru / mark / end", + "scapy_str": MAC_IPV4_TUN_IPV4_TCP_MAC_IPV4_TUN_MAC_IPV4_TCP, + "check_func": rfc.check_passthru, + "check_param": {"port_id": 0, "mark": True} +} + +tv_mac_ipv4_tun_ipv4_sctp_passthru_mark = { + "name": "test_mac_ipv4_tun_ipv4_sctp_passthru_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 passthru / mark / end", + "scapy_str": MAC_IPV4_TUN_IPV4_SCTP_MAC_IPV4_TUN_MAC_IPV4_SCTP, + "check_func": rfc.check_passthru, + "check_param": {"port_id": 0, "mark": True} +} + +tv_mac_ipv4_tun_mac_ipv4_pay_passthru_mark = { + "name": "mac_ipv4_tun_mac_ipv4_pay_passthru_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 passthru / mark / end", + "scapy_str": MAC_IPV4_TUN_IPV4_PAY_MAC_IPV4_TUN_MAC_IPV4_PAY, + "check_func": rfc.check_passthru, + "check_param": {"port_id": 0, "mark": 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, +tv_mac_ipv4_tun_mac_ipv4_udp_passthru_mark = { + "name": "test_mac_ipv4_tun_mac_ipv4_udp_passthru_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 passthru / mark / end", + "scapy_str": MAC_IPV4_TUN_IPV4_UDP_MAC_IPV4_TUN_MAC_IPV4_UDP, + "check_func": rfc.check_passthru, + "check_param": {"port_id": 0, "mark": True} +} + +tv_mac_ipv4_tun_mac_ipv4_tcp_passthru_mark = { + "name": "test_mac_ipv4_tun_mac_ipv4_tcp_passthru_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 passthru / mark / end", + "scapy_str": MAC_IPV4_TUN_IPV4_TCP_MAC_IPV4_TUN_MAC_IPV4_TCP, + "check_func": rfc.check_passthru, + "check_param": {"port_id": 0, "mark": True} +} + +tv_mac_ipv4_tun_mac_ipv4_sctp_passthru_mark = { + "name": "test_mac_ipv4_tun_mac_ipv4_sctp_passthru_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 passthru / mark / end", + "scapy_str": MAC_IPV4_TUN_IPV4_SCTP_MAC_IPV4_TUN_MAC_IPV4_SCTP, + "check_func": rfc.check_passthru, + "check_param": {"port_id": 0, "mark": True} +} + +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 id 1 / rss / end", + "scapy_str": MAC_IPV4_PAY, + "check_func": rfc.check_passthru, + "check_param": {"port_id": 0, "mark": True, "mark_id": 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 / rss / end", + "scapy_str": MAC_IPV4_UDP, + "check_func": rfc.check_passthru, + "check_param": {"port_id": 0, "mark": True, "mark_id": 0} +} + +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 1 / rss / end", + "scapy_str": MAC_IPV4_TCP, + "check_func": rfc.check_passthru, + "check_param": {"port_id": 0, "mark": True, "mark_id": 1} +} + +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 tag is 1 / end actions mark id 1 / rss / end", + "scapy_str": MAC_IPV4_SCTP, + "check_func": rfc.check_passthru, + "check_param": {"port_id": 0, "mark": True, "mark_id": 1} +} + +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 1 hop is 2 tc is 1 / end actions mark id 1 / rss / end", + "scapy_str": MAC_IPV6_PAY, + "check_func": rfc.check_passthru, + "check_param": {"port_id": 0, "mark": True, "mark_id": 1} +} + +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 id 1 / rss / end", + "scapy_str": MAC_IPV6_UDP, + "check_func": rfc.check_passthru, + "check_param": {"port_id": 0, "mark": True, "mark_id": 1} +} + +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 id 1 / rss / end", + "scapy_str": MAC_IPV6_TCP, + "check_func": rfc.check_passthru, + "check_param": {"port_id": 0, "mark": True, "mark_id": 1} +} + +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 id 1 / rss / end", + "scapy_str": MAC_IPV6_SCTP, + "check_func": rfc.check_passthru, + "check_param": {"port_id": 0, "mark": True, "mark_id": 1} +} + +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_passthru, + "check_param": {"port_id": 0, "mark": True, "mark_id": 0} +} + +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_passthru, + "check_param": {"port_id": 0, "mark": True, "mark_id": 1} +} + +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_passthru, + "check_param": {"port_id": 0, "mark": True, "mark_id": 1} +} + +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_passthru, + "check_param": {"port_id": 0, "mark": True, "mark_id": 1} +} + +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 id 1 / rss / end", + "scapy_str": MAC_IPV4_TUN_IPV4_PAY_MAC_IPV4_TUN_MAC_IPV4_PAY, + "check_func": rfc.check_passthru, + "check_param": {"port_id": 0, "mark": True, "mark_id": 1} +} + +tv_mac_ipv4_tun_mac_ipv4_udp_mark_rss = { + "name": "test_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 mark id 1 / rss / end", + "scapy_str": MAC_IPV4_TUN_IPV4_UDP_MAC_IPV4_TUN_MAC_IPV4_UDP, + "check_func": rfc.check_passthru, + "check_param": {"port_id": 0, "mark": True, "mark_id": 1} +} + +tv_mac_ipv4_tun_mac_ipv4_tcp_mark_rss = { + "name": "test_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 mark id 1 / rss / end", + "scapy_str": MAC_IPV4_TUN_IPV4_TCP_MAC_IPV4_TUN_MAC_IPV4_TCP, + "check_func": rfc.check_passthru, + "check_param": {"port_id": 0, "mark": True, "mark_id": 1} +} + +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 mark id 1 / rss / end", + "scapy_str": MAC_IPV4_TUN_IPV4_SCTP_MAC_IPV4_TUN_MAC_IPV4_SCTP, + "check_func": rfc.check_passthru, + "check_param": {"port_id": 0, "mark": True, "mark_id": 1} +} + +tv_mac_ipv4_gtpu_eh_passthru_mark = { + "name": "test_mac_ipv4_gtpu_eh_passthru_mark", + "rule": "flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / gtp_psc qfi is 0x34 / end actions passthru / mark / end", + "scapy_str": MAC_IPV4_GTPU_EH, + "check_func": rfc.check_passthru, + "check_param": {"port_id": 0, "mark": True} +} + +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_passthru, + "check_param": {"port_id": 0, "mark": True, "mark_id": 1} +} + +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_drop, "check_param": {"port_id": 0} } -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, +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 end / end", + "scapy_str": MAC_IPV4_GTPU_EH, "check_func": rfc.check_queue, "check_param": {"port_id": 0, "queue": [0, 1]} } -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, - "check_func": rfc.check_mark, - "check_param": {"port_id": 0, "queue": 2, "mark_id": 2, - "count": {"hits_set": 1, "hits": 5}, "mark": True} +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 / end", + "scapy_str": MAC_IPV4_GTPU_EH, + "check_func": rfc.check_queue, + "check_param": {"port_id": 0, "queue": 1} +} + +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 / end", + "scapy_str": MAC_IPV4_GTPU, + "check_func": rfc.check_queue, + "check_param": {"port_id": 0, "queue": 1} +} + +tv_mac_ipv4_gtpu_passthru_mark = { + "name": "test_mac_ipv4_gtpu_passthru_mark", + "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_passthru, + "check_param": {"port_id": 0, "mark": True} +} + +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 id 1 / rss / end", + "scapy_str": MAC_IPV4_GTPU, + "check_func": rfc.check_passthru, + "check_param": {"port_id": 0, "mark": True, "mark_id": 1} } tv_mac_ipv4_pay_queue_index_mark = { @@ -700,8 +1043,8 @@ tv_mac_ipv4_tcp_queue_index_mark = { "check_param": {"port_id": 0, "queue": 1, "mark_id": 4294967294, "mark": True} } -tv_mac_ipv4_sctp_queue_drop_mark = { - "name": "test_mac_ipv4_sctp_queue_drop_mark", +tv_mac_ipv4_sctp_drop_mark = { + "name": "test_mac_ipv4_sctp_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, "check_func": rfc.check_mark, @@ -804,50 +1147,62 @@ tv_mac_ipv4_tun_mac_ipv4_sctp_queue_index_mark = { "check_param": {"port_id": 0, "queue": 1, "mark_id": 1, "mark": 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_pay = [tv_mac_ipv4_pay_queue_index, tv_mac_ipv4_pay_drop, tv_mac_ipv4_pay_queue_group, + tv_mac_ipv4_pay_queue_index_mark, + tv_mac_ipv4_pay_passthru_count, tv_mac_ipv4_pay_passthru_mark, tv_mac_ipv4_pay_mark_rss] 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] + tv_mac_ipv4_udp_queue_index, tv_mac_ipv4_udp_passthru_mark, tv_mac_ipv4_udp_mark_rss] 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] + tv_mac_ipv4_tcp_queue_index_mark, tv_mac_ipv4_tcp_passthru_mark, tv_mac_ipv4_tcp_mark_rss] -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_ipv4_sctp = [tv_mac_ipv4_sctp_drop_mark, tv_mac_ipv4_sctp_queue_group, tv_mac_ipv4_sctp_drop, + tv_mac_ipv4_sctp_queue_index, tv_mac_ipv4_sctp_passthru_mark, tv_mac_ipv4_tun_ipv4_sctp_mark_rss] 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] + tv_mac_ipv6_pay_queue_index_mark, + tv_mac_ipv6_pay_passthru_mark, tv_mac_ipv6_pay_mark_rss] 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] + tv_mac_ipv6_udp_queue_index_mark, tv_mac_ipv6_udp_passthru_mark, tv_mac_ipv6_udp_mark_rss] 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] + tv_mac_ipv6_tcp_queue_index_mark, tv_mac_ipv6_tcp_passthru_mark, tv_mac_ipv6_tcp_mark_rss] 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] + tv_mac_ipv6_sctp_queue_index, tv_mac_ipv6_sctp_passthru_mark, tv_mac_ipv6_sctp_mark_rss] 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_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_tun_ipv4_pay_passthru_mark, tv_mac_ipv4_tun_ipv4_udp_passthru_mark, + tv_mac_ipv4_tun_ipv4_tcp_passthru_mark, tv_mac_ipv4_tun_ipv4_sctp_passthru_mark, + tv_mac_ipv4_tun_ipv4_pay_mark_rss, tv_mac_ipv4_tun_ipv4_udp_mark_rss, + tv_mac_ipv4_tun_ipv4_tcp_mark_rss, tv_mac_ipv4_tun_ipv4_sctp_mark_rss] 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] - -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] + 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_tun_mac_ipv4_pay_passthru_mark, tv_mac_ipv4_tun_mac_ipv4_udp_passthru_mark, + tv_mac_ipv4_tun_mac_ipv4_tcp_passthru_mark, tv_mac_ipv4_tun_mac_ipv4_sctp_passthru_mark, + tv_mac_ipv4_tun_mac_ipv4_pay_mark_rss, tv_mac_ipv4_tun_mac_ipv4_udp_mark_rss, + tv_mac_ipv4_tun_mac_ipv4_tcp_mark_rss, tv_mac_ipv4_tun_mac_ipv4_sctp_mark_rss] + +vectors_gtpu_ipv4 = [tv_mac_ipv4_gtpu_drop, tv_mac_ipv4_gtpu_eh_drop, tv_mac_ipv4_gtpu_eh_mark_count_query, + tv_mac_ipv4_gtpu_eh_mark_rss, tv_mac_ipv4_gtpu_eh_passthru_mark, tv_mac_ipv4_gtpu_eh_queue_group, + tv_mac_ipv4_gtpu_eh_queue_index, tv_mac_ipv4_gtpu_mark_rss, tv_mac_ipv4_gtpu_passthru_mark, + tv_mac_ipv4_gtpu_queue_group, tv_mac_ipv4_gtpu_queue_index] class TestCVLFdir(TestCase): @@ -895,7 +1250,7 @@ class TestCVLFdir(TestCase): test_results = {} for tv in vectors: try: - count = 1 if not tv["check_param"].get("count") else tv["check_param"]["count"] + count = 1 port_id = tv["check_param"]["port_id"] mark = tv["check_param"].get("mark") # create rule @@ -903,7 +1258,8 @@ class TestCVLFdir(TestCase): # 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"]) + matched_queue = 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) @@ -914,20 +1270,28 @@ class TestCVLFdir(TestCase): 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.check_fdir_rule(port_id=tv["check_param"]["port_id"], rule_list=rule_li) self.destroy_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) + matched_queue2 = tv["check_func"](out3, pkt_num=len(tv["scapy_str"]["match"]), + check_param=tv["check_param"], + stats=False) + if tv["check_func"].__name__ == "check_passthru": + self.verify(matched_queue == matched_queue2, + "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))) + if rule_li: + 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()): @@ -977,8 +1341,10 @@ class TestCVLFdir(TestCase): self.verify(res is True, 'there have port link is down') def launch_testpmd_with_mark(self): + self.rxq, self.txq = 64, 64 self.pmd_output.start_testpmd(cores="1S/4C/1T", - param="--portmask=%s --rxq=64 --txq=64 --port-topology=loop" % self.portMask, + param="--portmask=%s --rxq=%d --txq=%d --port-topology=loop" % ( + self.portMask, self.rxq, self.txq), eal_param="-w %s,flow-mark-support=1 -w %s,flow-mark-support=1" % ( self.pci0, self.pci1), socket=self.ports_socket) self.config_testpmd() @@ -1030,8 +1396,9 @@ class TestCVLFdir(TestCase): 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) 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,7 +1407,7 @@ 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: @@ -1057,6 +1424,98 @@ class TestCVLFdir(TestCase): m = p.search(out) self.verify(m, "flow rule %s delete failed" % rule_id) + def test_mac_ipv4_pay_selected_inputset_queue_index(self): + rules = [ + 'flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.21 proto is 1 / end actions queue index 1 / end', + 'flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.21 proto is 17 / end actions queue index 2 / end'] + rule_li = self.create_fdir_rule(rules, check_stats=True) + out = self.send_pkts_getouput(pkts=MAC_IPV4_PAY_SELECTED['match'][0:2]) + p = re.compile( + r"Forward Stats for RX Port= 0/Queue=(\s?\d+)\s.*\n.*RX-packets:(\s?\d+)\s+TX-packets") + res = p.findall(out) + res_queue = [int(i[0]) for i in res] + pkt_li = [int(i[1]) for i in res] + res_num = sum(pkt_li) + self.verify(res_num == 2, + "fail: got wrong number of packets, expect pakcet number %s, got %s." % (2, res_num)) + self.verify(all([i == 1 for i in res_queue]), "incorrect queue number") + + out = self.send_pkts_getouput(pkts=MAC_IPV4_PAY_SELECTED['match'][2:]) + res = p.findall(out) + res_queue = [int(i[0]) for i in res] + pkt_li = [int(i[1]) for i in res] + res_num = sum(pkt_li) + self.verify(res_num == 4, + "fail: got wrong number of packets, expect pakcet number %s, got %s." % (4, res_num)) + self.verify(all([i == 2 for i in res_queue]), "incorrect queue number") + + out = self.send_pkts_getouput(pkts=MAC_IPV4_PAY_SELECTED['unmatch']) + res = p.findall(out) + res_queue = [int(i[0]) for i in res] + pkt_li = [int(i[1]) for i in res] + res_num = sum(pkt_li) + self.verify(res_num == 4, + "fail: got wrong number of packets, expect pakcet number %s, got %s." % (4, res_num)) + self.verify(all([i not in [1, 2] for i in res_queue]), "incorrect queue number") + self.check_fdir_rule(port_id=0, stats=True, rule_list=rule_li) + self.dut.send_command("flow flush 0", timeout=2) + + out = self.send_pkts_getouput(pkts=MAC_IPV4_PAY_SELECTED['match']) + res = p.findall(out) + res_queue = [int(i[0]) for i in res] + pkt_li = [int(i[1]) for i in res] + res_num = sum(pkt_li) + self.verify(res_num == 6, + "fail: got wrong number of packets, expect pakcet number %s, got %s." % (6, res_num)) + self.verify(all([i not in [1, 2] for i in res_queue]), "should not distributed to queue 1 or 2") + self.check_fdir_rule(port_id=0, stats=False) + + def test_mac_ipv6_pay_selected_inputset_queue_index(self): + rules = [ + 'flow create 0 ingress pattern eth / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 proto is 44 / end actions queue index 1 / end', + 'flow create 0 ingress pattern eth / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 proto is 6 / end actions queue index 2 / end'] + rule_li = self.create_fdir_rule(rules, check_stats=True) + out = self.send_pkts_getouput(pkts=MAC_IPV6_PAY_SELECTED['match'][0:4]) + p = re.compile( + r"Forward Stats for RX Port= 0/Queue=(\s?\d+)\s.*\n.*RX-packets:(\s?\d+)\s+TX-packets") + res = p.findall(out) + res_queue = [int(i[0]) for i in res] + pkt_li = [int(i[1]) for i in res] + res_num = sum(pkt_li) + self.verify(res_num == 4, + "fail: got wrong number of packets, expect pakcet number %s, got %s." % (4, res_num)) + self.verify(all([i == 1 for i in res_queue]), "incorrect queue number") + + out = self.send_pkts_getouput(pkts=MAC_IPV6_PAY_SELECTED['match'][4:]) + res = p.findall(out) + res_queue = [int(i[0]) for i in res] + pkt_li = [int(i[1]) for i in res] + res_num = sum(pkt_li) + self.verify(res_num == 2, + "fail: got wrong number of packets, expect pakcet number %s, got %s." % (2, res_num)) + self.verify(all([i == 2 for i in res_queue]), "incorrect queue number") + + out = self.send_pkts_getouput(pkts=MAC_IPV6_PAY_SELECTED['unmatch']) + res = p.findall(out) + res_queue = [int(i[0]) for i in res] + pkt_li = [int(i[1]) for i in res] + res_num = sum(pkt_li) + self.verify(res_num == 3, + "fail: got wrong number of packets, expect pakcet number %s, got %s." % (3, res_num)) + self.verify(all([i not in [1, 2] for i in res_queue]), "incorrect queue number") + self.check_fdir_rule(port_id=0, stats=True, rule_list=rule_li) + self.dut.send_command("flow flush 0", timeout=2) + + out = self.send_pkts_getouput(pkts=MAC_IPV6_PAY_SELECTED['match']) + res = p.findall(out) + res_queue = [int(i[0]) for i in res] + pkt_li = [int(i[1]) for i in res] + res_num = sum(pkt_li) + self.verify(res_num == 6, + "fail: got wrong number of packets, expect pakcet number %s, got %s." % (6, res_num)) + self.verify(all([i not in [1, 2] for i in res_queue]), "should not distributed to queue 1 or 2") + self.check_fdir_rule(port_id=0, stats=False) + def test_mac_ipv4_pay(self): self._rte_flow_validate(vectors_ipv4_pay) @@ -1087,6 +1546,9 @@ class TestCVLFdir(TestCase): def test_mac_ipv4_tun_mac(self): self._rte_flow_validate(vectors_ipv4_tun_mac) + def test_mac_gtpu(self): + self._rte_flow_validate(vectors_gtpu_ipv4) + 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) @@ -1122,9 +1584,11 @@ class TestCVLFdir(TestCase): 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))}) + 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))}) + rfc.check_queue(out, pkt_num=len(MAC_IPV4_PAY["unmatch"]), + check_param={"port_id": 0, "queue": list(range(64))}) except Exception as e: result = False print((RED("failed:" + str(e)))) @@ -1133,22 +1597,23 @@ class TestCVLFdir(TestCase): self.config_testpmd() self.verify(result, "check failed") - 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" + def test_mac_ipv4_gtpu_mark_count_query(self): + rule = "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" 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)' + 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)/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=0x1234567)/IP()/Raw("x"*20)' # create fdir rule rule_li = self.create_fdir_rule(rule, check_stats=True) - out = self.send_pkts_getouput(pkts=p_gtpu1, port_id=1, mark=True) + out = self.send_pkts_getouput(pkts=[p_gtpu1, p_gtpu2], 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) + rfc.check_mark(out, pkt_num=2, check_param=check_param) - out = self.send_pkts_getouput(pkts=p_gtpu2, port_id=1, mark=True) + out = self.send_pkts_getouput(pkts=p_gtpu3, 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.query_count(1, 2, 1, 0) self.check_fdir_rule(port_id=1, stats=True) self.destroy_fdir_rule(port_id=1, rule_id=rule_li[0]) @@ -1159,13 +1624,13 @@ class TestCVLFdir(TestCase): self.verify(not res, "FDIR should not in %s" % out[0]) self.check_fdir_rule(port_id=1, stats=False) - 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)' + def test_mac_ipv4_gtpu_eh_qfi_mark_count_query(self): + rule = "flow create 1 ingress pattern eth / ipv4 / udp / gtpu / gtp_psc qfi is 0x34 / 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)/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)/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} + check_param = {"port_id": 1, "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) @@ -1180,16 +1645,37 @@ class TestCVLFdir(TestCase): 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_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" + def test_mac_ipv4_gtpu_eh_without_qfi_mark_count_query(self): + rule = "flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / gtp_psc / end actions queue index 15 / 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)/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=0x1234567)/GTP_PDUSession_ExtensionHeader(pdu_type=0)/IP()/TCP()/Raw("x"*20)' + # create fdir rule + res = self.create_fdir_rule(rule, check_stats=True) + check_param = {"port_id": 0, "queue": 15, "mark_id": 3} + # send matched packet + out = self.send_pkts_getouput(pkts=p_gtpu1, port_id=0, 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=0, mark=True) + rfc.check_mark(out1, pkt_num=1, check_param=check_param, stats=False) + self.query_count(1, 1, 0, 0) + self.check_fdir_rule(port_id=0, stats=True, rule_list=res) + self.destroy_fdir_rule(port_id=0, rule_id=res) + # send matched packets + out = self.send_pkts_getouput(p_gtpu1, port_id=0, mark=True) + rfc.check_mark(out, pkt_num=1, check_param=check_param, stats=False) + self.check_fdir_rule(port_id=0, stats=False) + + def test_mac_ipv4_gtpu_eh_multirules(self): + rule1 = "flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / gtp_psc qfi is 0x34 / end actions queue index 1 / end" + rule2 = "flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / gtp_psc qfi is 0x35 / end actions queue index 2 / end" + rule3 = "flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x1234567 / gtp_psc qfi is 0x35 / 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" + rule4 = "flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x1234567 / gtp_psc qfi is 0x35 / end actions queue index 3 / end" + rule5 = "flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x1234567 / gtp_psc qfi is 0x35 / end actions queue index 4 / end" + rule6 = "flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x1234567 / gtp_psc qfi is 0x75 / 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" + rule7 = "flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x1234567 / gtp_psc qfi is 0x34 / 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)' @@ -1218,17 +1704,17 @@ class TestCVLFdir(TestCase): 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' + def test_mac_ipv4_gtpu_eh_two_ports(self): + rule1 = 'flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / gtp_psc qfi is 0x34 / end actions queue index 1 / end' + rule2 = 'flow create 1 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / gtp_psc qfi is 0x34 / end actions queue index 1 / end' + rule3 = 'flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / gtp_psc qfi is 0x35 / end actions queue index 2 / end' + rule4 = 'flow create 1 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / gtp_psc qfi is 0x35 / end actions queue index 3 / end' + rule5 = 'flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / gtp_psc qfi is 0x34 / end actions queue index 1 / end' + rule6 = 'flow create 1 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / 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)' + 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=0x34)/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}) @@ -1244,11 +1730,17 @@ class TestCVLFdir(TestCase): self.dut.send_command("flow flush 0", timeout=1) self.dut.send_command("flow flush 1", timeout=1) - res3 = self.create_fdir_rule([rule5, rule6]) - self.verify(all(res3), "rules should be create seccess, result is %s" % res3) + res3 = self.create_fdir_rule([rule5, rule6], check_stats=True) + self.verify(all(res3), "rules should be create success, result is %s" % res3) + # out1 = self.send_pkts_getouput([p_gtpu2, p_gtpu3]) + out1 = self.send_pkts_getouput(p_gtpu2) + out2 = self.send_pkts_getouput(p_gtpu2, port_id=1) + rfc.check_queue(out1, pkt_num=1, check_param={"port_id": 0, "queue": 2}, stats=False) + rfc.check_queue(out2, pkt_num=1, check_param={"port_id": 1, "queue": 2}, stats=True) + 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(out1, pkt_num=1, check_param={"port_id": 0, "queue": 1}, stats=True) rfc.check_queue(out2, pkt_num=1, check_param={"port_id": 1, "queue": 2}, stats=True) self.check_fdir_rule(port_id=0, rule_list=res3[0]) @@ -1257,20 +1749,25 @@ class TestCVLFdir(TestCase): self.destroy_fdir_rule(0, 0) self.destroy_fdir_rule(1, 0) - out1 = self.send_pkts_getouput([p_gtpu1, p_gtpu2]) + out1 = self.send_pkts_getouput([p_gtpu2, p_gtpu3]) 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) + out2 = self.send_pkts_getouput([p_gtpu2, p_gtpu3], port_id=1) + rfc.check_queue(out2, pkt_num=2, check_param={"port_id": 1, "queue": [1, 2]}, stats=False) self.check_fdir_rule(0, stats=False) self.check_fdir_rule(1, stats=False) - 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' + def test_mac_ipv4_gtpu_eh_wrong_parameters(self): + rule1 = 'flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x12345678 / gtp_psc qfi is 0x100 / end actions queue index 1 / end' + rule2 = 'flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x100000000 / gtp_psc qfi is 0x5 / end actions queue index 2 / end' self.create_fdir_rule([rule1, rule2], check_stats=False) self.check_fdir_rule(0, stats=False) + def test_mac_ipv4_gtpu_wrong_parameters(self): + rule1 = 'flow create 0 ingress pattern eth / ipv4 / udp / gtpu teid is 0x100000000 / end actions queue index 1 / end' + self.create_fdir_rule(rule1, check_stats=False) + self.check_fdir_rule(0, stats=False) + 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' @@ -1538,6 +2035,11 @@ class TestCVLFdir(TestCase): self.dut.send_command("quit", timeout=2) self.launch_testpmd_with_mark() +# def test_mark_rss_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 dst is 192.168.0.21 ttl is 2 tos is 4 / udp src is 22 dst is 23 / end actions rss / end" +# self.create_fdir_rule(rule, check_stats=False) +# self.check_fdir_rule(port_id=0, stats=False) + def tear_down(self): # destroy all flow rule on port 0 self.dut.send_command("flow flush 0", timeout=1) -- 1.8.3.1