* [dts] [PATCH V1 1/2]tests/TestSuite_cvl_fdir: update script according to testplan
@ 2020-03-18 8:31 Xiao Qimai
2020-03-18 8:31 ` [dts] [PATCH V1 2/2]tests/rte_flow_common: add new methods for passthru Xiao Qimai
0 siblings, 1 reply; 3+ messages in thread
From: Xiao Qimai @ 2020-03-18 8:31 UTC (permalink / raw)
To: dts; +Cc: Xiao Qimai
*. update cvl_fdir according to testplan
Signed-off-by: Xiao Qimai <qimaix.xiao@intel.com>
---
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* [dts] [PATCH V1 2/2]tests/rte_flow_common: add new methods for passthru
2020-03-18 8:31 [dts] [PATCH V1 1/2]tests/TestSuite_cvl_fdir: update script according to testplan Xiao Qimai
@ 2020-03-18 8:31 ` Xiao Qimai
2020-03-18 8:39 ` Xiao, QimaiX
0 siblings, 1 reply; 3+ messages in thread
From: Xiao Qimai @ 2020-03-18 8:31 UTC (permalink / raw)
To: dts; +Cc: Xiao Qimai
*. add new methods for cvl_fdir update
Signed-off-by: Xiao Qimai <qimaix.xiao@intel.com>
---
tests/rte_flow_common.py | 170 ++++++++++++++++++++++++++++++++---------------
1 file changed, 118 insertions(+), 52 deletions(-)
diff --git a/tests/rte_flow_common.py b/tests/rte_flow_common.py
index 7592114..873d4c0 100644
--- a/tests/rte_flow_common.py
+++ b/tests/rte_flow_common.py
@@ -34,61 +34,66 @@ import time
import re
from utils import GREEN, RED
+
# switch filter common functions
-def get_packet_number(out,match_string):
+def get_packet_number(out, match_string):
"""
get the rx packets number.
"""
- out_lines=out.splitlines()
- pkt_num =0
+ out_lines = out.splitlines()
+ pkt_num = 0
for i in range(len(out_lines)):
- if match_string in out_lines[i]:
+ if match_string in out_lines[i]:
result_scanner = r'RX-packets:\s?(\d+)'
scanner = re.compile(result_scanner, re.DOTALL)
- m = scanner.search(out_lines[i+1])
+ m = scanner.search(out_lines[i + 1])
pkt_num = int(m.group(1))
break
return pkt_num
-def get_port_rx_packets_number(out,port_num):
+
+def get_port_rx_packets_number(out, port_num):
"""
get the port rx packets number.
"""
- match_string="---------------------- Forward statistics for port %d" % port_num
- pkt_num = get_packet_number(out,match_string)
+ match_string = "---------------------- Forward statistics for port %d" % port_num
+ pkt_num = get_packet_number(out, match_string)
return pkt_num
+
def get_queue_rx_packets_number(out, port_num, queue_id):
"""
get the queue rx packets number.
"""
- match_string="------- Forward Stats for RX Port= %d/Queue= %d" % (port_num, queue_id)
- pkt_num = get_packet_number(out,match_string)
+ match_string = "------- Forward Stats for RX Port= %d/Queue= %d" % (port_num, queue_id)
+ pkt_num = get_packet_number(out, match_string)
return pkt_num
+
def check_output_log_in_queue(out, func_param, expect_results):
"""
check if the expect queue received the expected number packets.
"""
- #parse input parameters
+ # parse input parameters
expect_port = func_param["expect_port"]
expect_queue = func_param["expect_queues"]
expect_pkts = expect_results["expect_pkts"]
- pkt_num = get_queue_rx_packets_number(out,expect_port,expect_queue)
+ pkt_num = get_queue_rx_packets_number(out, expect_port, expect_queue)
log_msg = ""
- #check the result
+ # check the result
if pkt_num == expect_pkts:
return True, log_msg
else:
log_msg = "Port= %d/Queue= %d receive %d packets" % (expect_port, expect_queue, pkt_num)
return False, log_msg
+
def check_output_log_queue_region(out, func_param, expect_results):
"""
Check if the expect queues received the expected number packets.
"""
- #parse input parameters
+ # parse input parameters
expect_port = func_param["expect_port"]
expect_queues = func_param["expect_queues"]
expect_pkts = expect_results["expect_pkts"]
@@ -98,7 +103,7 @@ def check_output_log_queue_region(out, func_param, expect_results):
pkt_num = get_queue_rx_packets_number(out, expect_port, queue_id)
packet_sumnum += pkt_num
- #check the result
+ # check the result
log_msg = ""
if packet_sumnum == expect_pkts:
return True, log_msg
@@ -106,24 +111,26 @@ def check_output_log_queue_region(out, func_param, expect_results):
log_msg = "queue region: Not all packets are received in expect_queues"
return False, log_msg
+
def check_output_log_queue_region_mismatched(out, func_param, expect_results):
"""
when the action is queue region, check the expect port received the expect
number packets, while the corresponding queues not receive any packets.
"""
- #parse input parameters
+ # parse input parameters
expect_port = func_param["expect_port"]
expect_queues = func_param["expect_queues"]
expect_pkts = expect_results["expect_pkts"]
log_msg = ""
- #check expect_port received expect number packets
+ # check expect_port received expect number packets
pkt_num = get_port_rx_packets_number(out, expect_port)
if pkt_num != expect_pkts:
- log_msg = "queue region mismatched: port %d receive %d packets, not receive %d packet" % (expect_port, pkt_num, expect_pkts)
+ log_msg = "queue region mismatched: port %d receive %d packets, not receive %d packet" % (
+ expect_port, pkt_num, expect_pkts)
return False, log_msg
else:
- #check expect queues not received packets
+ # check expect queues not received packets
packet_sumnum = 0
for queue_id in expect_queues:
pkt_num = get_queue_rx_packets_number(out, expect_port, queue_id)
@@ -136,39 +143,42 @@ def check_output_log_queue_region_mismatched(out, func_param, expect_results):
log_msg = "queue region mismatched: expect queues should receive 0 packets, but it received %d packets" % packet_sumnum
return False, log_msg
+
def check_output_log_in_queue_mismatched(out, func_param, expect_results):
"""
when the action is to queue, check the expect port received the expect
number packets, while the corresponding queue not receive any packets.
"""
- #parse input parameters
+ # parse input parameters
expect_port = func_param["expect_port"]
expect_queue = func_param["expect_queues"]
expect_pkts = expect_results["expect_pkts"]
log_msg = ""
- #check expect_port received expect number packets
+ # check expect_port received expect number packets
pkt_num = get_port_rx_packets_number(out, expect_port)
if pkt_num != expect_pkts:
log_msg = "mismatched: port %d receive %d packets, not receive %d packet" % (expect_port, pkt_num, expect_pkts)
return False, log_msg
else:
- #check expect queue not received packets
+ # check expect queue not received packets
pkt_num = get_queue_rx_packets_number(out, expect_port, expect_queue)
log_msg = ""
if pkt_num == 0:
return True, log_msg
else:
- log_msg = "mismatched: expect queue Port= %d/Queue= %d should receive 0 packets, but it received %d packets" % (expect_port, expect_queue, pkt_num)
+ log_msg = "mismatched: expect queue Port= %d/Queue= %d should receive 0 packets, but it received %d packets" % (
+ expect_port, expect_queue, pkt_num)
return False, log_msg
+
def check_output_log_drop(out, func_param, expect_results):
"""
check the expect port not receive any packets.
"""
- #parse input parameters
+ # parse input parameters
expect_port = func_param["expect_port"]
- #check expect_port not received the packets
+ # check expect_port not received the packets
pkt_num = get_port_rx_packets_number(out, expect_port)
log_msg = ""
@@ -178,33 +188,36 @@ def check_output_log_drop(out, func_param, expect_results):
log_msg = "Port %d packets not dropped, received %d packets" % (expect_port, pkt_num)
return False, log_msg
+
def check_output_log_drop_mismatched(out, func_param, expect_results):
"""
check the expect port received the mismatched packets.
"""
- #parse input parameters
+ # parse input parameters
expect_port = func_param["expect_port"]
expect_pkts = expect_results["expect_pkts"]
log_msg = ""
- #check expect_port received expect number packets
+ # check expect_port received expect number packets
pkt_num = get_port_rx_packets_number(out, expect_port)
if pkt_num == expect_pkts:
return True, log_msg
else:
- log_msg = "drop mismatched: port %d receive %d packets, should receive %d packet" % (expect_port, pkt_num, expect_pkts)
+ log_msg = "drop mismatched: port %d receive %d packets, should receive %d packet" % (
+ expect_port, pkt_num, expect_pkts)
return False, log_msg
+
def check_rule_in_list_by_id(out, rule_num, only_last=True):
"""
check if the rule with ID "rule_num" is in list, after
executing the command "flow list 0".
"""
- out_lines=out.splitlines()
+ out_lines = out.splitlines()
if len(out_lines) == 1:
return False
if only_last:
- last_rule = out_lines[len(out_lines)-1]
+ last_rule = out_lines[len(out_lines) - 1]
last_rule_list = last_rule.split('\t')
rule_id = int(last_rule_list[0])
if rule_id == rule_num:
@@ -212,10 +225,10 @@ def check_rule_in_list_by_id(out, rule_num, only_last=True):
else:
return False
else:
- #check the list for the rule
+ # check the list for the rule
for i in range(len(out_lines)):
if "ID" in out_lines[i]:
- rules_list = out_lines[i+1:]
+ rules_list = out_lines[i + 1:]
break
for per_rule in rules_list:
per_rule_list = per_rule.split('\t')
@@ -230,6 +243,7 @@ def verify(passed, description):
if not passed:
raise AssertionError(description)
+
def check_queue(out, pkt_num, check_param, stats=True):
port_id = check_param["port_id"] if check_param.get("port_id") is not None else 0
queue = check_param["queue"]
@@ -240,22 +254,27 @@ def check_queue(out, pkt_num, check_param, stats=True):
res_queue = [int(i[0]) for i in res]
pkt_li = [int(i[1]) for i in res]
res_num = sum(pkt_li)
- verify(res_num == pkt_num, "fail: got wrong number of packets, expect pakcet number %s, got %s." % (pkt_num, res_num))
+ verify(res_num == pkt_num,
+ "fail: got wrong number of packets, expect pakcet number %s, got %s." % (pkt_num, res_num))
if stats:
if isinstance(queue, int):
- verify(all(q == queue for q in res_queue), "fail: queue id not matched, expect queue %s, got %s" % (queue, res_queue))
+ verify(all(q == queue for q in res_queue),
+ "fail: queue id not matched, expect queue %s, got %s" % (queue, res_queue))
print((GREEN("pass: queue id %s matched" % res_queue)))
elif isinstance(queue, list):
- verify(all(q in queue for q in res_queue), "fail: queue id not matched, expect queue %s, got %s" % (queue, res_queue))
+ verify(all(q in queue for q in res_queue),
+ "fail: queue id not matched, expect queue %s, got %s" % (queue, res_queue))
print((GREEN("pass: queue id %s matched" % res_queue)))
else:
raise Exception("wrong queue value, expect int or list")
else:
if isinstance(queue, int):
- verify(not any(q == queue for q in res_queue), "fail: queue id should not matched, expect queue %s, got %s" % (queue, res_queue))
+ verify(not any(q == queue for q in res_queue),
+ "fail: queue id should not matched, expect queue %s, got %s" % (queue, res_queue))
print((GREEN("pass: queue id %s not matched" % res_queue)))
elif isinstance(queue, list):
- verify(not any(q in queue for q in res_queue), "fail: each queue in %s should not in queue %s" % (res_queue, queue))
+ verify(not any(q in queue for q in res_queue),
+ "fail: each queue in %s should not in queue %s" % (res_queue, queue))
print((GREEN("pass: queue id %s not matched" % res_queue)))
else:
raise Exception("wrong action value, expect queue_index or queue_group")
@@ -271,11 +290,13 @@ def check_drop(out, pkt_num, check_param, stats=True):
pkt_li = p.findall(out)
if pkt_li:
res = {k: v for k, v in zip(title_li, list(map(int, list(pkt_li[0]))))}
- verify(pkt_num == res["rx-total"], "failed: get wrong amount of packet %d, expected %d" % (res["rx-total"], pkt_num))
+ verify(pkt_num == res["rx-total"],
+ "failed: get wrong amount of packet %d, expected %d" % (res["rx-total"], pkt_num))
if stats:
verify(res["rx-dropped"] == pkt_num, "failed: dropped packets number %s not match" % res["rx-dropped"])
else:
- verify(res["rx-dropped"] == 0 and res["rx-packets"] == pkt_num, "failed: dropped packets number should be 0")
+ verify(res["rx-dropped"] == 0 and res["rx-packets"] == pkt_num,
+ "failed: dropped packets number should be 0")
else:
raise Exception("got wrong output, not match pattern %s" % p.pattern)
@@ -289,7 +310,7 @@ def check_mark(out, pkt_num, check_param, stats=True):
mark_list = [i[0] for i in res]
verify(len(res) == pkt_num, "get wrong number of packet with mark_id")
verify(all([int(i, 16) == check_param["mark_id"] for i in res]),
- "failed: some packet mark id of %s not match" % mark_list)
+ "failed: some packet mark id of %s not match" % mark_list)
else:
check_drop(out[1], pkt_num, check_param, stats)
verify(not res, "should has no mark_id in %s" % res)
@@ -300,6 +321,45 @@ def check_mark(out, pkt_num, check_param, stats=True):
check_drop(out[1], pkt_num, check_param, stats)
verify(not res, "should has no mark_id in %s" % res)
+
+def verify_directed_by_rss(out, rxq=64, stats=True):
+ p = re.compile('RSS\shash=(\w+)\s-\sRSS\squeue=(\w+)')
+ pkt_info = p.findall(out)
+ if stats:
+ verify(all([int(i[0], 16) % rxq == int(i[1], 16) for i in pkt_info]), 'some pkt not directed by rss.')
+ else:
+ verify(not any([int(i[0], 16) % rxq == int(i[1], 16) for i in pkt_info]), 'some pkt directed by rss')
+
+
+def check_passthru(out, pkt_num, check_param, stats=True):
+ port_id = check_param["port_id"] if check_param.get("port_id") is not None else 0
+ rxq = check_param['rxq'] if check_param.get("rxq") is not None else 64
+ fdir_scanner = re.compile("FDIR matched ID=(0x\w+)")
+ fdir_flag = fdir_scanner.search(out[0])
+ p = re.compile(
+ r"Forward Stats for RX Port= %s/Queue=(\s?\d+)\s.*\n.*RX-packets:(\s?\d+)\s+TX-packets" % port_id)
+ res = p.findall(out[1])
+ if res:
+ pkt_li = [int(i[1]) for i in res]
+ pkt_queue = [int(i[0]) for i in res]
+ res_num = sum(pkt_li)
+ verify(res_num == pkt_num,
+ "fail: got wrong number of packets, expect pakcet number %s, got %s." % (pkt_num, res_num))
+ else:
+ raise Exception("got wrong output, not match pattern %s" % p.pattern)
+ if stats:
+ if check_param.get("mark_id") == "NOT_SHOW":
+ verify(not fdir_flag, 'FDIR exists')
+ elif "mark_id" in check_param:
+ verify(int(fdir_flag.group(1), 16) == check_param["mark_id"], "FDIR ID not matched")
+ else:
+ verify(fdir_flag, 'FDIR not exists')
+ else:
+ verify(not fdir_flag, 'FDIR exists')
+ verify_directed_by_rss(out[0], rxq=rxq, stats=True)
+ return pkt_queue
+
+
# rss common functions
def check_packets_of_each_queue(out):
"""
@@ -309,15 +369,15 @@ def check_packets_of_each_queue(out):
queueid_rxpackets_list = []
log_msg = ""
for q in queue_result:
- queue_id =get_queue_id(q[0])
- rx_packets=get_rxpackets(q[1])
+ queue_id = get_queue_id(q[0])
+ rx_packets = get_rxpackets(q[1])
if (queue_id != -1):
queueid_rxpackets_list.append([queue_id, rx_packets])
if (len(queueid_rxpackets_list) == 10):
if (queueid_rxpackets_list > 0):
return True, log_msg
- else :
+ else:
log_msg = "The queue is rx-packets" % id
return False, log_msg
@@ -331,6 +391,7 @@ def check_packets_of_each_queue(out):
else:
return False, "queue %s out of range %s" % (queue_set, verify_set)
+
def check_symmetric_queue(out):
"""
check each packets in which queue
@@ -340,10 +401,11 @@ def check_symmetric_queue(out):
log_msg = ""
for i in range(m - 1):
if queue_list[i] == queue_list[i + 1]:
- return True, log_msg
+ return True, log_msg
else:
- log_msg = "packets not in same queue and cause to fail"
- return False, log_msg
+ log_msg = "packets not in same queue and cause to fail"
+ return False, log_msg
+
def check_simplexor_queue(out):
"""
@@ -354,17 +416,19 @@ def check_simplexor_queue(out):
log_msg = ""
for i in range(m - 1):
if queue_list[i] == queue_list[i + 1]:
- return True, log_msg
+ return True, log_msg
else:
- log_msg = "packets not in same queue and cause to fail"
- return False, log_msg
+ log_msg = "packets not in same queue and cause to fail"
+ return False, log_msg
+
def check_rx_tx_packets_match(out, count):
rx_stats = int(re.findall('RX-total:\s+(\d*)', out)[0])
- if rx_stats == count :
- return True, "The Rx packets has matched to the Tx packets"
+ if rx_stats == count:
+ return True, "The Rx packets has matched to the Tx packets"
else:
- return False, "rx and tx packets error!"
+ return False, "rx and tx packets error!"
+
def get_queue_id(line1):
try:
@@ -373,6 +437,7 @@ def get_queue_id(line1):
except:
return -1
+
def get_rxpackets(line2):
try:
result = re.search(r"RX-packets:\s*(\d*)", line2)
@@ -380,6 +445,7 @@ def get_rxpackets(line2):
except:
return -1
+
def find_queueid_rxpackets_list(id, q_rx_list):
for item in q_rx_list:
if (int(item[0]) == id):
--
1.8.3.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dts] [PATCH V1 2/2]tests/rte_flow_common: add new methods for passthru
2020-03-18 8:31 ` [dts] [PATCH V1 2/2]tests/rte_flow_common: add new methods for passthru Xiao Qimai
@ 2020-03-18 8:39 ` Xiao, QimaiX
0 siblings, 0 replies; 3+ messages in thread
From: Xiao, QimaiX @ 2020-03-18 8:39 UTC (permalink / raw)
To: dts
[-- Attachment #1: Type: text/plain, Size: 19874 bytes --]
Tested-by: Xiao, QimaiX <qimaix.xiao@intel.com>
Regards,
Xiao Qimai
> -----Original Message-----
> From: Xiao, QimaiX
> Sent: Wednesday, March 18, 2020 4:31 PM
> To: dts@dpdk.org
> Cc: Xiao, QimaiX <qimaix.xiao@intel.com>
> Subject: [dts][PATCH V1 2/2]tests/rte_flow_common: add new methods for
> passthru
>
> *. add new methods for cvl_fdir update
>
> Signed-off-by: Xiao Qimai <qimaix.xiao@intel.com>
> ---
> tests/rte_flow_common.py | 170
> ++++++++++++++++++++++++++++++++---------------
> 1 file changed, 118 insertions(+), 52 deletions(-)
>
> diff --git a/tests/rte_flow_common.py b/tests/rte_flow_common.py index
> 7592114..873d4c0 100644
> --- a/tests/rte_flow_common.py
> +++ b/tests/rte_flow_common.py
> @@ -34,61 +34,66 @@ import time
> import re
> from utils import GREEN, RED
>
> +
> # switch filter common functions
> -def get_packet_number(out,match_string):
> +def get_packet_number(out, match_string):
> """
> get the rx packets number.
> """
> - out_lines=out.splitlines()
> - pkt_num =0
> + out_lines = out.splitlines()
> + pkt_num = 0
> for i in range(len(out_lines)):
> - if match_string in out_lines[i]:
> + if match_string in out_lines[i]:
> result_scanner = r'RX-packets:\s?(\d+)'
> scanner = re.compile(result_scanner, re.DOTALL)
> - m = scanner.search(out_lines[i+1])
> + m = scanner.search(out_lines[i + 1])
> pkt_num = int(m.group(1))
> break
> return pkt_num
>
> -def get_port_rx_packets_number(out,port_num):
> +
> +def get_port_rx_packets_number(out, port_num):
> """
> get the port rx packets number.
> """
> - match_string="---------------------- Forward statistics for port %d" %
> port_num
> - pkt_num = get_packet_number(out,match_string)
> + match_string = "---------------------- Forward statistics for port %d" %
> port_num
> + pkt_num = get_packet_number(out, match_string)
> return pkt_num
>
> +
> def get_queue_rx_packets_number(out, port_num, queue_id):
> """
> get the queue rx packets number.
> """
> - match_string="------- Forward Stats for RX Port= %d/Queue= %d" %
> (port_num, queue_id)
> - pkt_num = get_packet_number(out,match_string)
> + match_string = "------- Forward Stats for RX Port= %d/Queue= %d" %
> (port_num, queue_id)
> + pkt_num = get_packet_number(out, match_string)
> return pkt_num
>
> +
> def check_output_log_in_queue(out, func_param, expect_results):
> """
> check if the expect queue received the expected number packets.
> """
> - #parse input parameters
> + # parse input parameters
> expect_port = func_param["expect_port"]
> expect_queue = func_param["expect_queues"]
> expect_pkts = expect_results["expect_pkts"]
>
> - pkt_num =
> get_queue_rx_packets_number(out,expect_port,expect_queue)
> + pkt_num = get_queue_rx_packets_number(out, expect_port,
> + expect_queue)
> log_msg = ""
> - #check the result
> + # check the result
> if pkt_num == expect_pkts:
> return True, log_msg
> else:
> log_msg = "Port= %d/Queue= %d receive %d packets" % (expect_port,
> expect_queue, pkt_num)
> return False, log_msg
>
> +
> def check_output_log_queue_region(out, func_param, expect_results):
> """
> Check if the expect queues received the expected number packets.
> """
> - #parse input parameters
> + # parse input parameters
> expect_port = func_param["expect_port"]
> expect_queues = func_param["expect_queues"]
> expect_pkts = expect_results["expect_pkts"] @@ -98,7 +103,7 @@ def
> check_output_log_queue_region(out, func_param, expect_results):
> pkt_num = get_queue_rx_packets_number(out, expect_port,
> queue_id)
> packet_sumnum += pkt_num
>
> - #check the result
> + # check the result
> log_msg = ""
> if packet_sumnum == expect_pkts:
> return True, log_msg
> @@ -106,24 +111,26 @@ def check_output_log_queue_region(out,
> func_param, expect_results):
> log_msg = "queue region: Not all packets are received in
> expect_queues"
> return False, log_msg
>
> +
> def check_output_log_queue_region_mismatched(out, func_param,
> expect_results):
> """
> when the action is queue region, check the expect port received the
> expect
> number packets, while the corresponding queues not receive any packets.
> """
> - #parse input parameters
> + # parse input parameters
> expect_port = func_param["expect_port"]
> expect_queues = func_param["expect_queues"]
> expect_pkts = expect_results["expect_pkts"]
>
> log_msg = ""
> - #check expect_port received expect number packets
> + # check expect_port received expect number packets
> pkt_num = get_port_rx_packets_number(out, expect_port)
> if pkt_num != expect_pkts:
> - log_msg = "queue region mismatched: port %d receive %d packets, not
> receive %d packet" % (expect_port, pkt_num, expect_pkts)
> + log_msg = "queue region mismatched: port %d receive %d packets, not
> receive %d packet" % (
> + expect_port, pkt_num, expect_pkts)
> return False, log_msg
> else:
> - #check expect queues not received packets
> + # check expect queues not received packets
> packet_sumnum = 0
> for queue_id in expect_queues:
> pkt_num = get_queue_rx_packets_number(out, expect_port,
> queue_id) @@ -136,39 +143,42 @@ def
> check_output_log_queue_region_mismatched(out, func_param,
> expect_results):
> log_msg = "queue region mismatched: expect queues should receive 0
> packets, but it received %d packets" % packet_sumnum
> return False, log_msg
>
> +
> def check_output_log_in_queue_mismatched(out, func_param,
> expect_results):
> """
> when the action is to queue, check the expect port received the expect
> number packets, while the corresponding queue not receive any packets.
> """
> - #parse input parameters
> + # parse input parameters
> expect_port = func_param["expect_port"]
> expect_queue = func_param["expect_queues"]
> expect_pkts = expect_results["expect_pkts"]
>
> log_msg = ""
> - #check expect_port received expect number packets
> + # check expect_port received expect number packets
> pkt_num = get_port_rx_packets_number(out, expect_port)
> if pkt_num != expect_pkts:
> log_msg = "mismatched: port %d receive %d packets, not receive %d
> packet" % (expect_port, pkt_num, expect_pkts)
> return False, log_msg
> else:
> - #check expect queue not received packets
> + # check expect queue not received packets
> pkt_num = get_queue_rx_packets_number(out, expect_port,
> expect_queue)
> log_msg = ""
> if pkt_num == 0:
> return True, log_msg
> else:
> - log_msg = "mismatched: expect queue Port= %d/Queue= %d should
> receive 0 packets, but it received %d packets" % (expect_port,
> expect_queue, pkt_num)
> + log_msg = "mismatched: expect queue Port= %d/Queue= %d should
> receive 0 packets, but it received %d packets" % (
> + expect_port, expect_queue, pkt_num)
> return False, log_msg
>
> +
> def check_output_log_drop(out, func_param, expect_results):
> """
> check the expect port not receive any packets.
> """
> - #parse input parameters
> + # parse input parameters
> expect_port = func_param["expect_port"]
> - #check expect_port not received the packets
> + # check expect_port not received the packets
> pkt_num = get_port_rx_packets_number(out, expect_port)
>
> log_msg = ""
> @@ -178,33 +188,36 @@ def check_output_log_drop(out, func_param,
> expect_results):
> log_msg = "Port %d packets not dropped, received %d packets" %
> (expect_port, pkt_num)
> return False, log_msg
>
> +
> def check_output_log_drop_mismatched(out, func_param, expect_results):
> """
> check the expect port received the mismatched packets.
> """
> - #parse input parameters
> + # parse input parameters
> expect_port = func_param["expect_port"]
> expect_pkts = expect_results["expect_pkts"]
>
> log_msg = ""
> - #check expect_port received expect number packets
> + # check expect_port received expect number packets
> pkt_num = get_port_rx_packets_number(out, expect_port)
> if pkt_num == expect_pkts:
> return True, log_msg
> else:
> - log_msg = "drop mismatched: port %d receive %d packets, should
> receive %d packet" % (expect_port, pkt_num, expect_pkts)
> + log_msg = "drop mismatched: port %d receive %d packets, should
> receive %d packet" % (
> + expect_port, pkt_num, expect_pkts)
> return False, log_msg
>
> +
> def check_rule_in_list_by_id(out, rule_num, only_last=True):
> """
> check if the rule with ID "rule_num" is in list, after
> executing the command "flow list 0".
> """
> - out_lines=out.splitlines()
> + out_lines = out.splitlines()
> if len(out_lines) == 1:
> return False
> if only_last:
> - last_rule = out_lines[len(out_lines)-1]
> + last_rule = out_lines[len(out_lines) - 1]
> last_rule_list = last_rule.split('\t')
> rule_id = int(last_rule_list[0])
> if rule_id == rule_num:
> @@ -212,10 +225,10 @@ def check_rule_in_list_by_id(out, rule_num,
> only_last=True):
> else:
> return False
> else:
> - #check the list for the rule
> + # check the list for the rule
> for i in range(len(out_lines)):
> if "ID" in out_lines[i]:
> - rules_list = out_lines[i+1:]
> + rules_list = out_lines[i + 1:]
> break
> for per_rule in rules_list:
> per_rule_list = per_rule.split('\t') @@ -230,6 +243,7 @@ def
> verify(passed, description):
> if not passed:
> raise AssertionError(description)
>
> +
> def check_queue(out, pkt_num, check_param, stats=True):
> port_id = check_param["port_id"] if check_param.get("port_id") is not
> None else 0
> queue = check_param["queue"]
> @@ -240,22 +254,27 @@ def check_queue(out, pkt_num, check_param,
> stats=True):
> res_queue = [int(i[0]) for i in res]
> pkt_li = [int(i[1]) for i in res]
> res_num = sum(pkt_li)
> - verify(res_num == pkt_num, "fail: got wrong number of packets, expect
> pakcet number %s, got %s." % (pkt_num, res_num))
> + verify(res_num == pkt_num,
> + "fail: got wrong number of packets, expect pakcet number
> + %s, got %s." % (pkt_num, res_num))
> if stats:
> if isinstance(queue, int):
> - verify(all(q == queue for q in res_queue), "fail: queue id not
> matched, expect queue %s, got %s" % (queue, res_queue))
> + verify(all(q == queue for q in res_queue),
> + "fail: queue id not matched, expect queue %s,
> + got %s" % (queue, res_queue))
> print((GREEN("pass: queue id %s matched" % res_queue)))
> elif isinstance(queue, list):
> - verify(all(q in queue for q in res_queue), "fail: queue id not matched,
> expect queue %s, got %s" % (queue, res_queue))
> + verify(all(q in queue for q in res_queue),
> + "fail: queue id not matched, expect queue %s,
> + got %s" % (queue, res_queue))
> print((GREEN("pass: queue id %s matched" % res_queue)))
> else:
> raise Exception("wrong queue value, expect int or list")
> else:
> if isinstance(queue, int):
> - verify(not any(q == queue for q in res_queue), "fail: queue id
> should not matched, expect queue %s, got %s" % (queue, res_queue))
> + verify(not any(q == queue for q in res_queue),
> + "fail: queue id should not matched, expect queue
> + %s, got %s" % (queue, res_queue))
> print((GREEN("pass: queue id %s not matched" % res_queue)))
> elif isinstance(queue, list):
> - verify(not any(q in queue for q in res_queue), "fail: each queue
> in %s should not in queue %s" % (res_queue, queue))
> + verify(not any(q in queue for q in res_queue),
> + "fail: each queue in %s should not in queue %s"
> + % (res_queue, queue))
> print((GREEN("pass: queue id %s not matched" % res_queue)))
> else:
> raise Exception("wrong action value, expect queue_index or
> queue_group") @@ -271,11 +290,13 @@ def check_drop(out, pkt_num,
> check_param, stats=True):
> pkt_li = p.findall(out)
> if pkt_li:
> res = {k: v for k, v in zip(title_li, list(map(int, list(pkt_li[0]))))}
> - verify(pkt_num == res["rx-total"], "failed: get wrong amount of
> packet %d, expected %d" % (res["rx-total"], pkt_num))
> + verify(pkt_num == res["rx-total"],
> + "failed: get wrong amount of packet %d, expected %d" %
> + (res["rx-total"], pkt_num))
> if stats:
> verify(res["rx-dropped"] == pkt_num, "failed: dropped packets
> number %s not match" % res["rx-dropped"])
> else:
> - verify(res["rx-dropped"] == 0 and res["rx-packets"] == pkt_num,
> "failed: dropped packets number should be 0")
> + verify(res["rx-dropped"] == 0 and res["rx-packets"] == pkt_num,
> + "failed: dropped packets number should be 0")
> else:
> raise Exception("got wrong output, not match pattern %s" % p.pattern)
>
> @@ -289,7 +310,7 @@ def check_mark(out, pkt_num, check_param,
> stats=True):
> mark_list = [i[0] for i in res]
> verify(len(res) == pkt_num, "get wrong number of packet with
> mark_id")
> verify(all([int(i, 16) == check_param["mark_id"] for i in res]),
> - "failed: some packet mark id of %s not match" % mark_list)
> + "failed: some packet mark id of %s not match" %
> + mark_list)
> else:
> check_drop(out[1], pkt_num, check_param, stats)
> verify(not res, "should has no mark_id in %s" % res) @@ -300,6
> +321,45 @@ def check_mark(out, pkt_num, check_param, stats=True):
> check_drop(out[1], pkt_num, check_param, stats)
> verify(not res, "should has no mark_id in %s" % res)
>
> +
> +def verify_directed_by_rss(out, rxq=64, stats=True):
> + p = re.compile('RSS\shash=(\w+)\s-\sRSS\squeue=(\w+)')
> + pkt_info = p.findall(out)
> + if stats:
> + verify(all([int(i[0], 16) % rxq == int(i[1], 16) for i in pkt_info]), 'some pkt
> not directed by rss.')
> + else:
> + verify(not any([int(i[0], 16) % rxq == int(i[1], 16) for i in
> +pkt_info]), 'some pkt directed by rss')
> +
> +
> +def check_passthru(out, pkt_num, check_param, stats=True):
> + port_id = check_param["port_id"] if check_param.get("port_id") is not
> None else 0
> + rxq = check_param['rxq'] if check_param.get("rxq") is not None else 64
> + fdir_scanner = re.compile("FDIR matched ID=(0x\w+)")
> + fdir_flag = fdir_scanner.search(out[0])
> + p = re.compile(
> + r"Forward Stats for RX Port= %s/Queue=(\s?\d+)\s.*\n.*RX-
> packets:(\s?\d+)\s+TX-packets" % port_id)
> + res = p.findall(out[1])
> + if res:
> + pkt_li = [int(i[1]) for i in res]
> + pkt_queue = [int(i[0]) for i in res]
> + res_num = sum(pkt_li)
> + verify(res_num == pkt_num,
> + "fail: got wrong number of packets, expect pakcet number %s,
> got %s." % (pkt_num, res_num))
> + else:
> + raise Exception("got wrong output, not match pattern %s" % p.pattern)
> + if stats:
> + if check_param.get("mark_id") == "NOT_SHOW":
> + verify(not fdir_flag, 'FDIR exists')
> + elif "mark_id" in check_param:
> + verify(int(fdir_flag.group(1), 16) == check_param["mark_id"], "FDIR
> ID not matched")
> + else:
> + verify(fdir_flag, 'FDIR not exists')
> + else:
> + verify(not fdir_flag, 'FDIR exists')
> + verify_directed_by_rss(out[0], rxq=rxq, stats=True)
> + return pkt_queue
> +
> +
> # rss common functions
> def check_packets_of_each_queue(out):
> """
> @@ -309,15 +369,15 @@ def check_packets_of_each_queue(out):
> queueid_rxpackets_list = []
> log_msg = ""
> for q in queue_result:
> - queue_id =get_queue_id(q[0])
> - rx_packets=get_rxpackets(q[1])
> + queue_id = get_queue_id(q[0])
> + rx_packets = get_rxpackets(q[1])
> if (queue_id != -1):
> queueid_rxpackets_list.append([queue_id, rx_packets])
>
> if (len(queueid_rxpackets_list) == 10):
> if (queueid_rxpackets_list > 0):
> return True, log_msg
> - else :
> + else:
> log_msg = "The queue is rx-packets" % id
> return False, log_msg
>
> @@ -331,6 +391,7 @@ def check_packets_of_each_queue(out):
> else:
> return False, "queue %s out of range %s" % (queue_set, verify_set)
>
> +
> def check_symmetric_queue(out):
> """
> check each packets in which queue
> @@ -340,10 +401,11 @@ def check_symmetric_queue(out):
> log_msg = ""
> for i in range(m - 1):
> if queue_list[i] == queue_list[i + 1]:
> - return True, log_msg
> + return True, log_msg
> else:
> - log_msg = "packets not in same queue and cause to fail"
> - return False, log_msg
> + log_msg = "packets not in same queue and cause to fail"
> + return False, log_msg
> +
>
> def check_simplexor_queue(out):
> """
> @@ -354,17 +416,19 @@ def check_simplexor_queue(out):
> log_msg = ""
> for i in range(m - 1):
> if queue_list[i] == queue_list[i + 1]:
> - return True, log_msg
> + return True, log_msg
> else:
> - log_msg = "packets not in same queue and cause to fail"
> - return False, log_msg
> + log_msg = "packets not in same queue and cause to fail"
> + return False, log_msg
> +
>
> def check_rx_tx_packets_match(out, count):
> rx_stats = int(re.findall('RX-total:\s+(\d*)', out)[0])
> - if rx_stats == count :
> - return True, "The Rx packets has matched to the Tx packets"
> + if rx_stats == count:
> + return True, "The Rx packets has matched to the Tx packets"
> else:
> - return False, "rx and tx packets error!"
> + return False, "rx and tx packets error!"
> +
>
> def get_queue_id(line1):
> try:
> @@ -373,6 +437,7 @@ def get_queue_id(line1):
> except:
> return -1
>
> +
> def get_rxpackets(line2):
> try:
> result = re.search(r"RX-packets:\s*(\d*)", line2) @@ -380,6 +445,7 @@
> def get_rxpackets(line2):
> except:
> return -1
>
> +
> def find_queueid_rxpackets_list(id, q_rx_list):
> for item in q_rx_list:
> if (int(item[0]) == id):
> --
> 1.8.3.1
[-- Attachment #2: TestCVLFdir.log --]
[-- Type: application/octet-stream, Size: 7442564 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-03-18 8:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-18 8:31 [dts] [PATCH V1 1/2]tests/TestSuite_cvl_fdir: update script according to testplan Xiao Qimai
2020-03-18 8:31 ` [dts] [PATCH V1 2/2]tests/rte_flow_common: add new methods for passthru Xiao Qimai
2020-03-18 8:39 ` Xiao, QimaiX
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).