test suite reviews and discussions
 help / color / Atom feed
* Re: [dts] [PATCH V1 5/5] tests: add TestSuite_cvl_dcf_switch_filter.py to tests
  2020-05-25 18:10 ` [dts] [PATCH V1 5/5] tests: add TestSuite_cvl_dcf_switch_filter.py to tests Nannan Lu
@ 2020-05-25 11:12   ` Lu, Nannan
  0 siblings, 0 replies; 7+ messages in thread
From: Lu, Nannan @ 2020-05-25 11:12 UTC (permalink / raw)
  To: dts; +Cc: Lu, Nannan

[-- Attachment #1: Type: text/plain, Size: 105733 bytes --]

Tested-by: Lu, Nannan <nannan.lu@intel.com>

-----Original Message-----
From: Lu, Nannan 
Sent: Tuesday, May 26, 2020 2:10 AM
To: dts@dpdk.org
Cc: Lu, Nannan <nannan.lu@intel.com>
Subject: [dts][PATCH V1 5/5] tests: add TestSuite_cvl_dcf_switch_filter.py to tests

Add TestSuite_cvl_dcf_switch_filter.py to tests.

Signed-off-by: Nannan Lu <nannan.lu@intel.com>
---
 tests/TestSuite_cvl_dcf_switch_filter.py | 1666 ++++++++++++++++++++++
 1 file changed, 1666 insertions(+)
 create mode 100644 tests/TestSuite_cvl_dcf_switch_filter.py

diff --git a/tests/TestSuite_cvl_dcf_switch_filter.py b/tests/TestSuite_cvl_dcf_switch_filter.py
new file mode 100644
index 0000000..e8136d2
--- /dev/null
+++ b/tests/TestSuite_cvl_dcf_switch_filter.py
@@ -0,0 +1,1666 @@
+# BSD LICENSE
+#
+# Copyright(c) 2020 Intel Corporation. All rights reserved.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+#   * Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+#   * Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in
+#     the documentation and/or other materials provided with the
+#     distribution.
+#   * Neither the name of Intel Corporation nor the names of its
+#     contributors may be used to endorse or promote products derived
+#     from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import json
+import time
+import re
+import copy
+
+from test_case import TestCase
+from pmd_output import PmdOutput
+from packet import Packet
+from utils import BLUE, RED, GREEN
+import rte_flow_common as rfc
+
+import os
+
+tv_mac_pay = {
+    "name":"tv_mac_pay",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth src is 00:00:00:00:00:01 dst is 00:11:22:33:44:55 type is 0x0800 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(src="00:00:00:00:00:01",dst="00:11:22:33:44:55")/IP()/Raw("x" *80)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(src="00:00:00:00:00:02",dst="00:11:22:33:44:55")/IP()/Raw("x" *80)',
+                               'Ether(src="00:00:00:00:00:01",dst="00:11:22:33:44:54")/IP()/Raw("x" *80)',
+                               'Ether(src="00:00:00:00:00:01",dst="00:11:22:33:44:55")/IPv6()/Raw("x" *80)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv4_frag = {
+    "name":"tv_mac_ipv4_frag",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth dst is 68:05:ca:8d:ed:a8 / ipv4 src is 192.168.0.1 dst is 192.168.0.2 tos is 4 ttl is 2 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.1",dst="192.168.0.2",tos=4,ttl=2,frag=5)/("X"*480)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a3")/IP(src="192.168.0.1",dst="192.168.0.2",tos=4,ttl=2,frag=5)/("X"*480)',
+                               'Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.4",dst="192.168.0.2",tos=4,ttl=2,frag=5)/("X"*480)',
+                               'Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.1",dst="192.168.0.5",tos=4,ttl=2,frag=5)/("X"*480)',
+                               'Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.1",dst="192.168.0.2",tos=5,ttl=2,frag=5)/("X"*480)',
+                               'Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.1",dst="192.168.0.2",tos=4,ttl=3,frag=5)/("X"*480)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv4_pay = {
+    "name":"tv_mac_ipv4_pay",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth dst is 68:05:ca:8d:ed:a8 / ipv4 src is 192.168.0.1 dst is 192.168.0.2 proto is 6 tos is 4 ttl is 2 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.1",dst="192.168.0.2",tos=4,ttl=2)/TCP()/("X"*480)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a3")/IP(src="192.168.0.1",dst="192.168.0.2",tos=4,ttl=2)/TCP()/("X"*480)',
+                               'Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.4",dst="192.168.0.2",tos=4,ttl=2)/TCP()/("X"*480)',
+                               'Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.1",dst="192.168.0.5",tos=4,ttl=2)/TCP()/("X"*480)',
+                               'Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.1",dst="192.168.0.2",tos=5,ttl=2)/TCP()/("X"*480)',
+                               'Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.1",dst="192.168.0.2",tos=4,ttl=3)/TCP()/("X"*480)',
+                               'Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.1",dst="192.168.0.2",tos=4,ttl=2)/UDP()/("X"*480)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv4_udp_pay = {
+    "name":"tv_mac_ipv4_udp_pay",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth dst is 68:05:ca:8d:ed:a8 / ipv4 src is 192.168.0.1 dst is 192.168.0.2 tos is 4 ttl is 3 / udp src is 25 dst is 23 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.1",dst="192.168.0.2",tos=4,ttl=3)/UDP(sport=25,dport=23)/("X"*480)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.1",dst="192.168.0.2",tos=4,ttl=3)/UDP(sport=30,dport=23)/("X"*480)',
+                               'Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.1",dst="192.168.0.2",tos=4,ttl=3)/UDP(sport=25,dport=19)/("X"*480)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv4_tcp_pay = {
+    "name":"tv_mac_ipv4_tcp_pay",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth dst is 68:05:ca:8d:ed:a8 / ipv4 src is 192.168.0.1 dst is 192.168.0.2 tos is 4 ttl is 3 / tcp src is 25 dst is 23 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.1",dst="192.168.0.2",tos=4,ttl=3)/TCP(sport=25,dport=23)/("X"*480)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.1",dst="192.168.0.2",tos=4,ttl=3)/TCP(sport=30,dport=23)/("X"*480)',
+                               'Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.1",dst="192.168.0.2",tos=4,ttl=3)/TCP(sport=25,dport=19)/("X"*480)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv4_igmp = {
+    "name":"tv_mac_ipv4_igmp",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv4 proto is 0x02 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="00:11:22:33:44:55")/IP()/IGMP()/Raw("X"*480)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="00:11:22:33:44:55")/IP()/TCP()/Raw("X"*480)',
+                               'Ether(dst="00:11:22:33:44:55")/IP()/UDP()/Raw("X"*480)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv6_frag_srcip_dstip = {
+    "name":"tv_mac_ipv6_frag_srcip_dstip",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv6 src is CDCD:910A:2222:5498:8475:1111:3900:1536 dst is CDCD:910A:2222:5498:8475:1111:3900:2022 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="00:11:22:33:44:55")/IPv6(src="CDCD:910A:2222:5498:8475:1111:3900:1536", dst="CDCD:910A:2222:5498:8475:1111:3900:2022")/IPv6ExtHdrFragment()/("X"*480)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="00:11:22:33:44:55")/IPv6(src="CDCD:910A:2222:5498:8475:1111:3900:1537", dst="CDCD:910A:2222:5498:8475:1111:3900:2022")/IPv6ExtHdrFragment()/("X"*480)',
+                               'Ether(dst="00:11:22:33:44:55")/IPv6(src="CDCD:910A:2222:5498:8475:1111:3900:1536", dst="CDCD:910A:2222:5498:8475:1111:3900:2023")/IPv6ExtHdrFragment()/("X"*480)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv6_frag_dstip_tc = {
+    "name":"tv_mac_ipv6_frag_dstip_tc",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth dst is 68:05:ca:8d:ed:a8 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 tc is 3 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a8")/IPv6(src="CDCD:910A:2222:5498:8475:1111:3900:1518", dst="CDCD:910A:2222:5498:8475:1111:3900:2020",tc=3)/IPv6ExtHdrFragment()/("X"*480)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a3")/IPv6(src="CDCD:910A:2222:5498:8475:1111:3900:1518", dst="CDCD:910A:2222:5498:8475:1111:3900:2020",tc=3)/IPv6ExtHdrFragment()/("X"*480)',
+                               'Ether(dst="68:05:ca:8d:ed:a8")/IPv6(src="CDCD:910A:2222:5498:8475:1111:3900:1518", dst="CDCD:910A:2222:5498:8475:1111:3900:2023",tc=3)/IPv6ExtHdrFragment()/("X"*480)',
+                               'Ether(dst="68:05:ca:8d:ed:a8")/IPv6(src="CDCD:910A:2222:5498:8475:1111:3900:1518", dst="CDCD:910A:2222:5498:8475:1111:3900:2020",tc=4)/IPv6ExtHdrFragment()/("X"*480)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv6_pay_srcip_dstip = {
+    "name":"tv_mac_ipv6_pay_srcip_dstip",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv6 src is CDCD:910A:2222:5498:8475:1111:3900:1536 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="00:11:22:33:44:55")/IPv6(src="CDCD:910A:2222:5498:8475:1111:3900:1536", dst="CDCD:910A:2222:5498:8475:1111:3900:2020")/("X"*480)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="00:11:22:33:44:55")/IPv6(src="CDCD:910A:2222:5498:8475:1111:3900:1537", dst="CDCD:910A:2222:5498:8475:1111:3900:2020")/("X"*480)',
+                               'Ether(dst="00:11:22:33:44:55")/IPv6(src="CDCD:910A:2222:5498:8475:1111:3900:1536", dst="CDCD:910A:2222:5498:8475:1111:3900:2023")/("X"*480)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv6_pay_dstip_tc = {
+    "name":"tv_mac_ipv6_pay_dstip_tc",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth dst is 68:05:ca:8d:ed:a8 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 tc is 3 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a8")/IPv6(src="CDCD:910A:2222:5498:8475:1111:3900:1518", dst="CDCD:910A:2222:5498:8475:1111:3900:2020",tc=3)/("X"*480)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a3")/IPv6(src="CDCD:910A:2222:5498:8475:1111:3900:1518", dst="CDCD:910A:2222:5498:8475:1111:3900:2020",tc=3)/("X"*480)',
+                               'Ether(dst="68:05:ca:8d:ed:a8")/IPv6(src="CDCD:910A:2222:5498:8475:1111:3900:1518", dst="CDCD:910A:2222:5498:8475:1111:3900:2023",tc=3)/("X"*480)',
+                               'Ether(dst="68:05:ca:8d:ed:a8")/IPv6(src="CDCD:910A:2222:5498:8475:1111:3900:1518", dst="CDCD:910A:2222:5498:8475:1111:3900:2020",tc=4)/("X"*480)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv6_udp_pay = {
+    "name":"tv_mac_ipv6_udp_pay",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth dst is 68:05:ca:8d:ed:a8 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 tc is 3 / udp src is 25 dst is 23 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a8")/IPv6(src="CDCD:910A:2222:5498:8475:1111:3900:1518", dst="CDCD:910A:2222:5498:8475:1111:3900:2020",tc=3)/UDP(sport=25,dport=23)/("X"*480)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a8")/IPv6(src="CDCD:910A:2222:5498:8475:1111:3900:1518", dst="CDCD:910A:2222:5498:8475:1111:3900:2020",tc=3)/UDP(sport=30,dport=23)/("X"*480)',
+                               'Ether(dst="68:05:ca:8d:ed:a8")/IPv6(src="CDCD:910A:2222:5498:8475:1111:3900:1518", dst="CDCD:910A:2222:5498:8475:1111:3900:2020",tc=3)/UDP(sport=25,dport=19)/("X"*480)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv6_tcp = {
+    "name":"tv_mac_ipv6_tcp",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth dst is 68:05:ca:8d:ed:a8 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 tc is 3 / tcp src is 25 dst is 23 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a8")/IPv6(src="CDCD:910A:2222:5498:8475:1111:3900:1518", dst="CDCD:910A:2222:5498:8475:1111:3900:2020",tc=3)/TCP(sport=25,dport=23)/("X"*480)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a8")/IPv6(src="CDCD:910A:2222:5498:8475:1111:3900:1518", dst="CDCD:910A:2222:5498:8475:1111:3900:2020",tc=3)/TCP(sport=30,dport=23)/("X"*480)',
+                               'Ether(dst="68:05:ca:8d:ed:a8")/IPv6(src="CDCD:910A:2222:5498:8475:1111:3900:1518", dst="CDCD:910A:2222:5498:8475:1111:3900:2020",tc=3)/TCP(sport=25,dport=19)/("X"*480)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv4_nvgre_ipv4_frag = {
+    "name":"tv_mac_ipv4_nvgre_ipv4_frag",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.1 / nvgre tni is 2 / eth / ipv4 src is 192.168.1.2 dst is 192.168.1.3 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether()/IP(src="192.168.1.2", dst="192.168.1.3" ,frag=5)/TCP()/Raw("x"*80)',
+                            'Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether()/IP(src="192.168.1.2", dst="192.168.1.3" ,frag=5)/Raw("x"*80)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":2}},
+    "mismatched":{"scapy_str":['Ether()/IP(dst="192.168.0.2")/NVGRE(TNI=2)/Ether()/IP(src="192.168.1.2", dst="192.168.1.3" ,frag=5)/TCP()/Raw("x"*80)',
+                               'Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=3)/Ether()/IP(src="192.168.1.2", dst="192.168.1.3" ,frag=5)/TCP()/Raw("x"*80)',
+                               'Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether()/IP(src="192.168.1.4", dst="192.168.1.3" ,frag=5)/TCP()/Raw("x"*80)',
+                               'Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether()/IP(src="192.168.1.2", dst="192.168.1.5" ,frag=5)/TCP()/Raw("x"*80)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv4_nvgre_ipv4_pay = {
+    "name":"tv_mac_ipv4_nvgre_ipv4_pay",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.1 / nvgre tni is 2 / eth / ipv4 src is 192.168.1.2 dst is 192.168.1.3 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether()/IP(src="192.168.1.2", dst="192.168.1.3")/TCP()/Raw("x"*80)',
+                            'Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether()/IP(src="192.168.1.2", dst="192.168.1.3")/Raw("x"*80)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":2}},
+    "mismatched":{"scapy_str":['Ether()/IP(dst="192.168.0.2")/NVGRE(TNI=2)/Ether()/IP(src="192.168.1.2", dst="192.168.1.3")/Raw("x"*80)',
+                               'Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=3)/Ether()/IP(src="192.168.1.2", dst="192.168.1.3")/Raw("x"*80)',
+                               'Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether()/IP(src="192.168.1.4", dst="192.168.1.3")/Raw("x"*80)',
+                               'Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether()/IP(src="192.168.1.2", dst="192.168.1.5")/Raw("x"*80)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv4_nvgre_ipv4_udp_pay = {
+    "name":"tv_mac_ipv4_nvgre_ipv4_udp_pay",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.1 / nvgre tni is 0x8 / eth / ipv4 src is 192.168.0.2 dst is 192.168.0.3 / udp src is 50 dst is 23 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=0x8)/Ether()/IP(src="192.168.0.2", dst="192.168.0.3")/UDP(sport=50,dport=23)/Raw("x"*80)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=0x8)/Ether()/IP(src="192.168.0.2", dst="192.168.0.3")/UDP(sport=20,dport=23)/Raw("x"*80)',
+                               'Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=0x8)/Ether()/IP(src="192.168.0.2", dst="192.168.0.3")/UDP(sport=50,dport=19)/Raw("x"*80)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv4_nvgre_ipv4_tcp = {
+    "name":"tv_mac_ipv4_nvgre_ipv4_tcp",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.1 / nvgre tni is 2 / eth / ipv4 src is 192.168.1.2 dst is 192.168.1.3 / tcp src is 25 dst is 23 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether()/IP(src="192.168.1.2", dst="192.168.1.3")/TCP(sport=25,dport=23)/Raw("x"*80)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether()/IP(src="192.168.1.2", dst="192.168.1.3")/TCP(sport=20,dport=23)/Raw("x"*80)',
+                               'Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether()/IP(src="192.168.1.2", dst="192.168.1.3")/TCP(sport=25,dport=39)/Raw("x"*80)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv4_nvgre_mac_ipv4_frag = {
+    "name":"tv_mac_ipv4_nvgre_mac_ipv4_frag",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.1 / nvgre tni is 2 / eth dst is 68:05:ca:8d:ed:a8 / ipv4 src is 192.168.1.2 dst is 192.168.1.3 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.1.2", dst="192.168.1.3" ,frag=5)/TCP()/Raw("x"*80)',
+                            'Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.1.2", dst="192.168.1.3" ,frag=5)/Raw("x"*80)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":2}},
+    "mismatched":{"scapy_str":['Ether()/IP(dst="192.168.0.2")/NVGRE(TNI=2)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.1.2", dst="192.168.1.3" ,frag=5)/TCP()/Raw("x"*80)',
+                               'Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=3)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.1.2", dst="192.168.1.3" ,frag=5)/TCP()/Raw("x"*80)',
+                               'Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether(dst="68:05:ca:8d:ed:a9")/IP(src="192.168.1.2", dst="192.168.1.3" ,frag=5)/TCP()/Raw("x"*80)',
+                               'Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.1.4", dst="192.168.1.3" ,frag=5)/TCP()/Raw("x"*80)',
+                               'Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.1.2", dst="192.168.1.5" ,frag=5)/TCP()/Raw("x"*80)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv4_nvgre_mac_ipv4_pay = {
+    "name":"tv_mac_ipv4_nvgre_mac_ipv4_pay",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.1 / nvgre tni is 2 / eth dst is 68:05:ca:8d:ed:a8  / ipv4 src is 192.168.1.2 dst is 192.168.1.3 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.1.2", dst="192.168.1.3")/TCP()/Raw("x"*80)',
+                            'Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.1.2", dst="192.168.1.3")/Raw("x"*80)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":2}},
+    "mismatched":{"scapy_str":['Ether()/IP(dst="192.168.0.2")/NVGRE(TNI=2)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.1.2", dst="192.168.1.3")/Raw("x"*80)',
+                               'Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=3)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.1.2", dst="192.168.1.3")/Raw("x"*80)',
+                               'Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether(dst="68:05:ca:8d:ed:a9")/IP(src="192.168.1.2", dst="192.168.1.3")/Raw("x"*80)',
+                               'Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.1.4", dst="192.168.1.3")/Raw("x"*80)',
+                               'Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.1.2", dst="192.168.1.5")/Raw("x"*80)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv4_nvgre_mac_ipv4_udp_pay = {
+    "name":"tv_mac_ipv4_nvgre_mac_ipv4_udp_pay",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.1 / nvgre tni is 0x8 /  eth dst is 68:05:ca:8d:ed:a8  / ipv4 src is 192.168.1.2 dst is 192.168.1.3 / udp src is 25 dst is 23 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=0x8)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.1.2", dst="192.168.1.3")/UDP(sport=25,dport=23)/Raw("x"*80)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=0x8)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.1.2", dst="192.168.1.3")/UDP(sport=2,dport=23)/Raw("x"*80)',
+                               'Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=0x8)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.1.2", dst="192.168.1.3")/UDP(sport=25,dport=20)/Raw("x"*80)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv4_nvgre_mac_ipv4_tcp = {
+    "name":"tv_mac_ipv4_nvgre_mac_ipv4_tcp",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.1 / nvgre tni is 2 / eth dst is 68:05:ca:8d:ed:a8  / ipv4 src is 192.168.1.2 dst is 192.168.1.3 / tcp src is 25 dst is 23 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.1.2", dst="192.168.1.3")/TCP(sport=25,dport=23)/Raw("x"*80)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.1.2", dst="192.168.1.3")/TCP(sport=1,dport=23)/Raw("x"*80)',
+                               'Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.1.2", dst="192.168.1.3")/TCP(sport=25,dport=20)/Raw("x"*80)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_vlan_pppoe_ipv4_pay = {
+    "name":"tv_mac_vlan_pppoe_ipv4_pay",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / vlan tci is 1 / pppoes seid is 3 / pppoe_proto_id is 0x0021 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(vlan=1,type=0x8864)/PPPoE(sessionid=3)/PPP(proto=0x0021)/IP()/Raw("x" * 80)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="00:11:22:33:44:54",type=0x8100)/Dot1Q(vlan=1,type=0x8864)/PPPoE(sessionid=3)/PPP(proto=0x0021)/IP()/Raw("x" * 80)',
+                               'Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(vlan=2,type=0x8864)/PPPoE(sessionid=3)/PPP(proto=0x0021)/IP()/Raw("x" * 80)',
+                               'Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(vlan=1,type=0x8864)/PPPoE(sessionid=4)/PPP(proto=0x0021)/IP()/Raw("x" * 80)',
+                               'Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(vlan=1,type=0x8864)/PPPoE(sessionid=3)/PPP(proto=0x0057)/IPv6()/Raw("x" * 80)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_vlan_pppoe_ipv6_pay = {
+    "name":"tv_mac_vlan_pppoe_ipv6_pay",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / vlan tci is 1 / pppoes seid is 3 / pppoe_proto_id is 0x0057 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(vlan=1,type=0x8864)/PPPoE(sessionid=3)/PPP(proto=0x0057)/IPv6()/Raw("x" * 80)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="00:11:22:33:44:54",type=0x8100)/Dot1Q(vlan=1,type=0x8864)/PPPoE(sessionid=3)/PPP(proto=0x0057)/IPv6()/Raw("x" * 80)',
+                               'Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(vlan=2,type=0x8864)/PPPoE(sessionid=3)/PPP(proto=0x0057)/IPv6()/Raw("x" * 80)',
+                               'Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(vlan=1,type=0x8864)/PPPoE(sessionid=4)/PPP(proto=0x0057)/IPv6()/Raw("x" * 80)',
+                               'Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(vlan=1,type=0x8864)/PPPoE(sessionid=3)/PPP(proto=0x0021)/IP()/Raw("x" * 80)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_pppoe_ipv4_pay = {
+    "name":"tv_mac_pppoe_ipv4_pay",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / pppoes seid is 3 / pppoe_proto_id is 0x0021 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="00:11:22:33:44:55",type=0x8864)/PPPoE(sessionid=3)/PPP(proto=0x0021)/IP()/Raw("x" * 80)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="00:11:22:33:44:54",type=0x8864)/PPPoE(sessionid=3)/PPP(proto=0x0021)/IP()/Raw("x" * 80)',
+                               'Ether(dst="00:11:22:33:44:55",type=0x8864)/PPPoE(sessionid=4)/PPP(proto=0x0021)/IP()/Raw("x" * 80)',
+                               'Ether(dst="00:11:22:33:44:55",type=0x8864)/PPPoE(sessionid=3)/PPP(proto=0x0057)/IPv6()/Raw("x" * 80)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_pppoe_ipv6_pay = {
+    "name":"tv_mac_pppoe_ipv6_pay",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / pppoes seid is 3 / pppoe_proto_id is 0x0057 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="00:11:22:33:44:55",type=0x8864)/PPPoE(sessionid=3)/PPP(proto=0x0057)/IPv6()/Raw("x" * 80)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="00:11:22:33:44:54",type=0x8864)/PPPoE(sessionid=3)/PPP(proto=0x0057)/IPv6()/Raw("x" * 80)',
+                               'Ether(dst="00:11:22:33:44:55",type=0x8864)/PPPoE(sessionid=4)/PPP(proto=0x0057)/IPv6()/Raw("x" * 80)',
+                               'Ether(dst="00:11:22:33:44:55",type=0x8864)/PPPoE(sessionid=3)/PPP(proto=0x0021)/IP()/Raw("x" * 80)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_qinq = {
+    "name":"tv_qinq",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / vlan tci is 1 / vlan tci is 2 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(type=0x8100,vlan=1)/Dot1Q(type=0x0800,vlan=2)/IP(src="192.168.0.1",dst="192.168.0.2")/Raw("X"*480)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(type=0x8100,vlan=3)/Dot1Q(type=0x0800, vlan=2)/IP(src="192.168.0.1",dst="192.168.0.2")/Raw("X"*480)',
+                               'Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(type=0x8100,vlan=1)/Dot1Q(type=0x0800, vlan=5)/IP(src="192.168.0.1",dst="192.168.0.2")/Raw("X"*480)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_ip_multicast = {
+    "name":"tv_ip_multicast",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv4 dst spec 224.0.0.0 dst mask 240.0.0.0 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether()/IP(dst="239.0.0.0")/TCP()/Raw("x"*80)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether()/IP(dst="128.0.0.0")/TCP()/Raw("x"*80)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_l2_multicast = {
+    "name":"tv_l2_multicast",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth dst spec 01:00:5e:00:00:00 dst mask ff:ff:ff:80:00:00 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="01:00:5e:7f:00:00")/IP()/TCP()/Raw("x"*80)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="01:00:5e:ff:00:00")/IP()/TCP()/Raw("x"*80)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_ethertype_filter_pppod = {
+    "name":"tv_ethertype_filter_pppod",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth type is 0x8863 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="00:11:22:33:44:55")/PPPoED()/PPP()/IP()/Raw("x" *80)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="00:11:22:33:44:55")/PPPoE()/PPP()/IP()/Raw("x" *80)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_ethertype_filter_pppoe = {
+    "name":"tv_ethertype_filter_pppoe",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth type is 0x8864 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="00:11:22:33:44:55")/PPPoE()/PPP()/IP()/Raw("x"*80)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="00:11:22:33:44:55")/PPPoED()/PPP()/IP()/Raw("x"*80)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_ethertype_filter_ipv6 = {
+    "name":"tv_ethertype_filter_ipv6",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth type is 0x86dd / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", tc=3)/TCP(dport=23)/("X"*480)',
+                            'Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(vlan=1,type=0x86dd)/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", tc=3)/TCP(dport=23)/("X"*480)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":2}},
+    "mismatched":{"scapy_str":['Ether(dst="00:11:22:33:44:55")/IP()/TCP(dport=23)/("X"*480)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_udp_port_filter_dhcp_discovery = {
+    "name":"tv_udp_port_filter_dhcp_discovery",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv4 / udp src is 68 dst is 67 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="00:11:22:33:44:55")/IP()/UDP(sport=68,dport=67)/BOOTP(chaddr="3c:fd:fe:b2:43:90")/DHCP(options=[("message-type","discover"),"end"])/Raw("X"*480)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="00:11:22:33:44:55")/IP()/UDP(sport=63,dport=67)/BOOTP(chaddr="3c:fd:fe:b2:43:90")/DHCP(options=[("message-type","discover"),"end"])/Raw("X"*480)',
+                               'Ether(dst="00:11:22:33:44:55")/IP()/UDP(sport=68,dport=69)/BOOTP(chaddr="3c:fd:fe:b2:43:90")/DHCP(options=[("message-type","discover"),"end"])/Raw("X"*480)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_udp_port_filter_dhcp_offer = {
+    "name":"tv_udp_port_filter_dhcp_offer",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv4 / udp src is 67 dst is 68 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="00:11:22:33:44:55")/IP()/UDP(sport=67,dport=68)/BOOTP(chaddr="3c:fd:fe:b2:43:90",yiaddr="192.168.1.0")/DHCP(options=[("message-type","offer"),"end"])/Raw("X"*480)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="00:11:22:33:44:55")/IP()/UDP(sport=63,dport=68)/BOOTP(chaddr="3c:fd:fe:b2:43:90",yiaddr="192.168.1.0")/DHCP(options=[("message-type","offer"),"end"])/Raw("X"*480)',
+                               'Ether(dst="00:11:22:33:44:55")/IP()/UDP(sport=67,dport=63)/BOOTP(chaddr="3c:fd:fe:b2:43:90",yiaddr="192.168.1.0")/DHCP(options=[("message-type","offer"),"end"])/Raw("X"*480)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_udp_port_filter_vxlan = {
+    "name":"tv_udp_port_filter_vxlan",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv4 / udp dst is 4789 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether()/IP(dst="192.168.0.1")/UDP()/VXLAN(vni=2)/Ether()/IP(src="192.168.0.2", dst="192.168.0.3",frag=5)/TCP()/Raw("x"*80)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether()/IP(src="192.168.1.2", dst="192.168.1.3")/TCP()/Raw("x"*80)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_vlan_filter = {
+    "name":"tv_mac_vlan_filter",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / vlan tci is 1 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(vlan=1)/IP(src="192.168.0.1",dst="192.168.0.2",tos=4,ttl=2)/TCP()/Raw("X"*480)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="00:11:22:33:44:54",type=0x8100)/Dot1Q(vlan=1)/IP(src="192.168.0.1",dst="192.168.0.2",tos=4,ttl=2)/TCP()/Raw("X"*480)',
+                               'Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(vlan=2)/IP(src="192.168.0.1",dst="192.168.0.2",tos=4,ttl=2)/TCP()/Raw("X"*480)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_vlan_filter = {
+    "name":"tv_vlan_filter",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / vlan tci is 1 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(vlan=1)/IP(src="192.168.0.1",dst="192.168.0.2",tos=4,ttl=2)/TCP()/Raw("X"*480)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(vlan=2)/IP(src="192.168.0.1",dst="192.168.0.2",tos=4,ttl=2)/TCP()/Raw("X"*480)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_actions_vf_id_0 = {
+    "name":"tv_actions_vf_id_0",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth dst is 68:05:ca:8d:ed:a8 / ipv4 src is 192.168.0.1 dst is 192.168.0.2 tos is 4 ttl is 3 / tcp src is 25 dst is 23 / end actions vf id 0 / end",
+    "matched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.1",dst="192.168.0.2",tos=4,ttl=3)/TCP(sport=25,dport=23)/("X"*480)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":0, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":0}},
+    "mismatched":{}
+}
+
+
+tv_add_existing_rules_but_with_different_vfs = {
+    "name":"tv_add_existing_rules_but_with_different_vfs",
+    "rte_flow_pattern":["flow create 0 ingress pattern eth dst is 68:05:ca:8d:ed:a8 / ipv4 src is 192.168.0.1 dst is 192.168.0.2 tos is 4 ttl is 3 / udp src is 25 dst is 23 / end actions vf id 1 / end",
+                        "flow create 0 ingress pattern eth dst is 68:05:ca:8d:ed:a8 / ipv4 src is 192.168.0.1 dst is 192.168.0.2 tos is 4 ttl is 3 / udp src is 25 dst is 23 / end actions vf id 2 / end"],
+    "matched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.1",dst="192.168.0.2",tos=4,ttl=3)/UDP(sport=25,dport=23)/("X"*480)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":[1, 2], "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":[1, 1]}},
+    "mismatched":{}
+}
+
+tv_add_two_rules_with_one_rule_input_set_included_in_the_other = {
+    "name":"tv_add_two_rules_with_one_rule_input_set_included_in_the_other",
+    "rte_flow_pattern":["flow create 0 ingress pattern eth dst is 68:05:ca:8d:ed:a8 / ipv4 src is 192.168.0.1 / end actions vf id 1 / end",
+                        "flow create 0 ingress pattern eth dst is 68:05:ca:8d:ed:a8 / ipv4 src is 192.168.0.1 dst is 192.168.0.2 / end actions vf id 2 / end"],
+    "matched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.1",dst="192.168.0.2")/("X"*480)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":[1, 2], "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":[1, 1]}},
+    "mismatched":{}
+}
+
+tv_test_fwd_with_single_vf = {
+    "name":"tv_test_fwd_with_single_vf",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv4 src is 192.168.0.1 dst is 192.168.0.2 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.1",dst="192.168.0.2")/("X"*480)'],
+               "check_func":{"func":rfc.check_vf_rx_tx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{}
+}
+
+tv_test_fwd_with_multi_vfs = {
+    "name":"tv_test_fwd_with_multi_vfs",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv4 src is 192.168.0.1 dst is 192.168.0.2 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.1",dst="192.168.0.2")/("X"*480)'],
+               "check_func":{"func":rfc.check_vf_rx_tx_packets_number,
+                             "param":{"expect_port":[1, 2], "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":[1, 0]}},
+    "mismatched":{}
+}
+
+#max vfs case: rte_flow_pattern and matched packets will be generated by code.
+tv_max_vfs = {
+    "name":"tv_max_vfs",
+    "rte_flow_pattern":[],
+    "matched":{"scapy_str":[],
+               "check_func":{"func":rfc.check_kernel_vf_rx_packets_number,
+                             "param":{"expect_port":list(range(1, 64)), "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":[1]*63}},
+    "mismatched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.64")/TCP()/Raw("X"*480)'],
+                  "check_func":{"func":rfc.check_kernel_vf_rx_packets_number,
+                                "param":{"expect_port":list(range(1, 64)), "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":[1]*63}}
+}
+
+tv_max_field_vectors = {
+    "name":"tv_max_field_vectors",
+    "rte_flow_pattern":["flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.1 / nvgre tni is 0x8 / eth / ipv4 src is 192.168.0.2 dst is 192.168.0.3 / udp src is 50 dst is 23 / end actions vf id 1 / end",
+                        "flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.2 / nvgre tni is 0x8 / eth / ipv4 src is 192.168.0.2 dst is 192.168.0.3 / udp src is 50 / end actions vf id 1 / end",
+                        "flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.3 / nvgre tni is 0x8 / eth / ipv4 src is 192.168.0.2 dst is 192.168.0.3 / udp dst is 23 / end actions vf id 1 / end"],
+    "matched":{"scapy_str":['Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=0x8)/Ether()/IP(src="192.168.0.2", dst="192.168.0.3")/UDP(sport=50,dport=23)/Raw("x"*80)',
+                            'Ether()/IP(dst="192.168.0.2")/NVGRE(TNI=0x8)/Ether()/IP(src="192.168.0.2", dst="192.168.0.3")/UDP(sport=50,dport=23)/Raw("x"*80)',
+                            'Ether()/IP(dst="192.168.0.3")/NVGRE(TNI=0x8)/Ether()/IP(src="192.168.0.2", dst="192.168.0.3")/UDP(sport=50,dport=23)/Raw("x"*80)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":3}},
+    "mismatched":{"scapy_str":['Ether()/IP(dst="192.168.0.5")/NVGRE(TNI=0x8)/Ether()/IP(src="192.168.0.2", dst="192.168.0.3")/UDP(sport=50,dport=23)/Raw("x"*80)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+#max rule number case: rte_flow_pattern and matched packets will be generated by code, and rte_flow_pattern will be writed to file.
+tv_max_rule_number = {
+    "name":"tv_max_rule_number",
+    "rte_flow_pattern":[],
+    "matched":{"scapy_str":[],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1}},
+               "expect_results":{"expect_pkts":32563}},
+    "mismatched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.167.0.1")/TCP(sport=25,dport=23)/("X"*480)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv4_pfcp_node = {
+    "name":"tv_mac_ipv4_pfcp_node",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv4 / udp / pfcp s_field is 0 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="00:11:22:33:44:11")/IP()/UDP(dport=8805)/PFCP(Sfield=0)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="00:11:22:33:44:11")/IP()/UDP(dport=8805)/PFCP(Sfield=1)',
+                               'Ether(dst="00:11:22:33:44:11")/IPv6()/UDP(dport=8805)/PFCP(Sfield=0)',
+                               'Ether(dst="00:11:22:33:44:11")/IPv6()/UDP(dport=8805)/PFCP(Sfield=1)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv4_pfcp_session = {
+    "name":"tv_mac_ipv4_pfcp_session",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv4 / udp / pfcp s_field is 1 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="00:11:22:33:44:11")/IP()/UDP(dport=8805)/PFCP(Sfield=1)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="00:11:22:33:44:11")/IP()/UDP(dport=8805)/PFCP(Sfield=0)',
+                               'Ether(dst="00:11:22:33:44:11")/IPv6()/UDP(dport=8805)/PFCP(Sfield=0)',
+                               'Ether(dst="00:11:22:33:44:11")/IPv6()/UDP(dport=8805)/PFCP(Sfield=1)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv6_pfcp_node = {
+    "name":"tv_mac_ipv6_pfcp_node",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv6 / udp / pfcp s_field is 0 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="00:11:22:33:44:11")/IPv6()/UDP(dport=8805)/PFCP(Sfield=0)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="00:11:22:33:44:11")/IP()/UDP(dport=8805)/PFCP(Sfield=0)',
+                               'Ether(dst="00:11:22:33:44:11")/IP()/UDP(dport=8805)/PFCP(Sfield=1)',
+                               'Ether(dst="00:11:22:33:44:11")/IPv6()/UDP(dport=8805)/PFCP(Sfield=1)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv6_pfcp_session = {
+    "name":"tv_mac_ipv6_pfcp_session",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv6 / udp / pfcp s_field is 1 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="00:11:22:33:44:11")/IPv6()/UDP(dport=8805)/PFCP(Sfield=1)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="00:11:22:33:44:11")/IP()/UDP(dport=8805)/PFCP(Sfield=0)',
+                               'Ether(dst="00:11:22:33:44:11")/IP()/UDP(dport=8805)/PFCP(Sfield=1)',
+                               'Ether(dst="00:11:22:33:44:11")/IPv6()/UDP(dport=8805)/PFCP(Sfield=0)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_add_two_rules_with_different_input_set_same_vf_id = {
+    "name":"tv_add_two_rules_with_different_input_set_same_vf_id",
+    "rte_flow_pattern":["flow create 0 ingress pattern eth / ipv4 / udp / pfcp s_field is 0 / end actions vf id 1 / end",
+                        "flow create 0 ingress pattern eth / ipv4 / udp / pfcp s_field is 1 / end actions vf id 1 / end"],
+    "matched":{"scapy_str":['Ether(dst="00:11:22:33:44:11")/IP()/UDP(dport=8805)/PFCP(Sfield=0)',
+                            'Ether(dst="00:11:22:33:44:11")/IP()/UDP(dport=8805)/PFCP(Sfield=1)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":2}},
+    "mismatched":{"scapy_str":['Ether(dst="00:11:22:33:44:11")/IPv6()/UDP(dport=8805)/PFCP(Sfield=0)',
+                               'Ether(dst="00:11:22:33:44:11")/IPv6()/UDP(dport=8805)/PFCP(Sfield=1)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_add_two_rules_with_different_input_set_different_vf_id = {
+    "name":"tv_add_two_rules_with_different_input_set_different_vf_id",
+    "rte_flow_pattern":["flow create 0 ingress pattern eth / ipv4 / udp / pfcp s_field is 0 / end actions vf id 1 / end",
+                        "flow create 0 ingress pattern eth / ipv4 / udp / pfcp s_field is 1 / end actions vf id 2 / end"],
+    "matched":{"scapy_str":['Ether(dst="00:11:22:33:44:11")/IP()/UDP(dport=8805)/PFCP(Sfield=0)',
+                            'Ether(dst="00:11:22:33:44:11")/IP()/UDP(dport=8805)/PFCP(Sfield=1)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":[1, 2], "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":[1, 1]}},
+    "mismatched":{"scapy_str":['Ether(dst="00:11:22:33:44:11")/IPv6()/UDP(dport=8805)/PFCP(Sfield=0)',
+                               'Ether(dst="00:11:22:33:44:11")/IPv6()/UDP(dport=8805)/PFCP(Sfield=1)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":[1, 2], "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":[0, 0]}}
+}
+
+class SwitchFilterTest(TestCase):
+
+    def bind_nics_driver(self, ports, driver=""):
+        # modprobe vfio driver
+        if driver == "vfio-pci":
+            for port in ports:
+                netdev = self.dut.ports_info[port]['port']
+                driver = netdev.get_nic_driver()
+                if driver != 'vfio-pci':
+                    netdev.bind_driver(driver='vfio-pci')
+
+        elif driver == "igb_uio":
+            # igb_uio should insmod as default, no need to check
+            for port in ports:
+                netdev = self.dut.ports_info[port]['port']
+                driver = netdev.get_nic_driver()
+                if driver != 'igb_uio':
+                    netdev.bind_driver(driver='igb_uio')
+        else:
+            for port in ports:
+                netdev = self.dut.ports_info[port]['port']
+                driver_now = netdev.get_nic_driver()
+                if driver == "":
+                    driver = netdev.default_driver
+                if driver != driver_now:
+                    netdev.bind_driver(driver=driver)
+
+    def set_up_all(self):
+        """
+        Run at the start of each test suite.
+        """
+        self.verify(self.nic in ["columbiaville_25g","columbiaville_100g"], "nic is not CVL")
+        self.dut_ports = self.dut.get_ports(self.nic)
+        # Verify that enough ports are available
+        self.verify(len(self.dut_ports) >= 1, "Insufficient ports")
+        localPort = self.tester.get_local_port(self.dut_ports[0])
+        self.__tx_iface = self.tester.get_interface(localPort)
+        self.dut.send_expect("ifconfig %s up" % self.__tx_iface, "# ")
+        self.pkt = Packet()
+        self.testpmd_status = "close"
+        self.suite_config = rfc.get_suite_config(self)
+        self.pkg_file = "/lib/firmware/updates/intel/ice/ddp/ice.pkg"
+        #bind pf to kernel
+        self.bind_nics_driver(self.dut_ports, driver="ice")
+        #set vf driver
+        self.vf_driver = 'vfio-pci'
+        self.dut.send_expect('modprobe vfio-pci', '#')
+
+    def setup_1pf_vfs_env(self, pf_port=0, driver='default'):
+
+        self.used_dut_port_0 = self.dut_ports[pf_port]
+        #get PF interface name
+        self.pf0_intf = self.dut.ports_info[self.used_dut_port_0]['intf']
+        out = self.dut.send_expect('ethtool -i %s' % self.pf0_intf, '#')
+        #generate 4 VFs on PF
+        self.dut.generate_sriov_vfs_by_port(self.used_dut_port_0, 4, driver=driver)
+        self.sriov_vfs_port_0 = self.dut.ports_info[self.used_dut_port_0]['vfs_port']
+        #set VF0 as trust
+        self.dut.send_expect('ip link set %s vf 0 trust on' % self.pf0_intf, '#')
+        #bind VFs to dpdk driver
+        for port in self.sriov_vfs_port_0:
+            port.bind_driver(self.vf_driver)
+        time.sleep(5)
+
+    def re_load_ice_driver(self):
+        """
+        remove and reload the ice driver
+        """
+        if self.running_case == "test_unsupported_pattern_in_os_default_but_supported_in_comms":
+            #save comms pkg to /tmp
+            self.tmp_dir = "/tmp/ice.pkg"
+            self.dut.send_expect("cp %s %s" % (self.pkg_file, self.tmp_dir), "# ")
+            #use os default package to test the case
+            os_default_package_file_location = self.suite_config["os_default_package_file_location"]
+            self.dut.send_expect("cp %s %s" % (os_default_package_file_location, self.pkg_file), "# ")
+        ice_driver_file_location = self.suite_config["ice_driver_file_location"]
+        self.dut.send_expect("rmmod ice", "# ", 15)
+        self.dut.send_expect("insmod %s" % ice_driver_file_location, "# ", 60)
+        time.sleep(5)
+
+    def set_up(self):
+        """
+        Run before each test case.
+        """
+        self.re_load_ice_driver()
+
+    def create_testpmd_command(self):
+        """
+        Create testpmd command
+        """
+        #Prepare testpmd EAL and parameters
+        vf0_pci = self.sriov_vfs_port_0[0].pci
+        vf1_pci = self.sriov_vfs_port_0[1].pci
+        all_eal_param = self.dut.create_eal_parameters(cores='1S/4C/1T',ports=[vf0_pci, vf1_pci], port_options={vf0_pci:"cap=dcf"})
+        command = "./%s/app/testpmd %s -- -i" % (self.dut.target, all_eal_param)
+        return command
+
+    def launch_testpmd(self):
+        """
+        launch testpmd with the command
+        """
+        command = self.create_testpmd_command()
+        out = self.dut.send_expect(command, "testpmd> ", 15)
+        self.testpmd_status = "running"
+        self.dut.send_expect("set portlist 1", "testpmd> ", 15)
+        self.dut.send_expect("set fwd rxonly", "testpmd> ", 15)
+        self.dut.send_expect("set verbose 1", "testpmd> ", 15)
+
+    def send_packets(self, dic, session_name="", tx_iface=""):
+        """
+        send packets.
+        """
+        if session_name == "":
+            session_name = self.dut
+        if tx_iface == "":
+            tx_iface = self.__tx_iface
+        session_name.send_expect("start", "testpmd> ", 15)
+        time.sleep(2)
+        #send packets
+        self.pkt.update_pkt(dic["scapy_str"])
+        self.pkt.send_pkt(self.tester, tx_port=tx_iface, count=1, timeout=370)
+        time.sleep(3)
+        out = session_name.send_expect("stop", "testpmd> ")
+        return out
+
+    def send_and_check_packets(self, dic, session_name="", tx_iface=""):
+        """
+        general packets processing workflow.
+        """
+        if session_name == "":
+            session_name = self.dut
+        if tx_iface == "":
+            tx_iface = self.__tx_iface
+        session_name.send_expect("start", "testpmd> ", 15)
+        time.sleep(2)
+        #send packets
+        self.pkt.update_pkt(dic["scapy_str"])
+        self.pkt.send_pkt(self.tester, tx_port=tx_iface, count=1, timeout=370)
+        time.sleep(3)
+        out = session_name.send_expect("stop", "testpmd> ", 15)
+        dic["check_func"]["func"](out, dic["check_func"]["param"], dic["expect_results"])
+
+    def send_and_get_packets_bg(self, dic, session_name="", tx_iface=""):
+        """
+        general packets processing workflow.
+        """
+        if session_name == "":
+            session_name = self.dut
+        if tx_iface == "":
+            tx_iface = self.__tx_iface
+        session_name.send_expect("start", "testpmd> ", 15)
+        time.sleep(2)
+        #send packets
+        pkt = Packet()
+        pkt.update_pkt(dic["scapy_str"])
+        pkt.send_pkt_bg(self.tester, tx_port=tx_iface, count=1, loop=0, timeout=370)
+        time.sleep(3)
+        out = session_name.send_expect("stop", "testpmd> ", 15)
+        results = dic["check_func"]["func"](out, dic["check_func"]["param"], dic["expect_results"], False)
+        return results
+
+    def create_switch_filter_rule(self, rte_flow_pattern, session_name="", need_verify=True):
+        """
+        create switch filter rules
+        """
+        if session_name == "":
+            session_name = self.dut
+        p = re.compile(r"Flow rule #(\d+) created")
+        rule_list = []
+        if isinstance(rte_flow_pattern, list):
+            for rule in rte_flow_pattern:
+                out = session_name.send_expect(rule, "testpmd> ")  #create a rule
+                m = p.search(out)
+                if m:
+                    rule_list.append(m.group(1))
+                else:
+                    rule_list.append(False)
+        else:
+            out = session_name.send_expect(rte_flow_pattern, "testpmd> ")  #create a rule
+            m = p.search(out)
+            if m:
+                rule_list.append(m.group(1))
+            else:
+                rule_list.append(False)
+        if need_verify:
+            self.verify(all(rule_list), "some rules not created successfully, result %s, rule %s" % (rule_list, rte_flow_pattern))
+        return rule_list
+
+    def check_switch_filter_rule_list(self, port_id, rule_list, session_name="", need_verify=True):
+        """
+        check the rules in list identical to ones in rule_list
+        """
+        if session_name == "":
+            session_name = self.dut
+        out = session_name.send_expect("flow list %d" % port_id, "testpmd> ", 15)
+        p = re.compile(r"ID\s+Group\s+Prio\s+Attr\s+Rule")
+        m = p.search(out)
+        if not m:
+            result = []
+        else:
+            p_spec = re.compile("^(\d+)\s")
+            out_lines = out.splitlines()
+            res = filter(bool, map(p_spec.match, out_lines))
+            result = [i.group(1) for i in res]
+        if need_verify:
+            self.verify(sorted(result) == sorted(rule_list),
+                    "the rule list is not the same. expect %s, result %s" % (rule_list, result))
+        else:
+            return sorted(result)
+
+    def destroy_switch_filter_rule(self, port_id, rule_list, session_name="", need_verify=True):
+        if session_name == "":
+            session_name = self.dut
+        p = re.compile(r"Flow rule #(\d+) destroyed")
+        destroy_list = []
+        if isinstance(rule_list, list):
+            for i in rule_list:
+                out = session_name.send_expect("flow destroy %s rule %s" % (port_id, i), "testpmd> ", 15)
+                m = p.search(out)
+                if m:
+                    destroy_list.append(m.group(1))
+                else:
+                    destroy_list.append(False)
+        else:
+            out = session_name.send_expect("flow destroy %s rule %s" % (port_id, rule_list), "testpmd> ", 15)
+            m = p.search(out)
+            if m:
+                destroy_list.append(m.group(1))
+            else:
+                destroy_list.append(False)
+            rule_list = [rule_list]
+        if need_verify:
+            self.verify(destroy_list == rule_list, "flow rule destroy failed, expect %s result %s" % (rule_list, destroy_list))
+        else:
+            return destroy_list
+
+    def get_kernel_vf_log(self, vf_intfs, session_name):
+        """
+        get the log of each kernel vf in list vf_intfs
+        """
+        out_vfs = []
+        for intf in vf_intfs:
+            out = session_name.send_expect('ifconfig %s' % intf, '#')
+            out_vfs.append(out)
+        return out_vfs
+
+    def _rte_flow_validate_pattern(self, test_vector, launch_testpmd=True):
+
+        if launch_testpmd:
+            #launch testpmd
+            self.launch_testpmd()
+        #create a rule
+        rule_list = self.create_switch_filter_rule(test_vector["rte_flow_pattern"])   #create a rule
+        self.check_switch_filter_rule_list(0, rule_list)
+        #send matched packets and check
+        matched_dic = test_vector["matched"]
+        self.send_and_check_packets(matched_dic)
+        #send mismatched packets and check
+        mismatched_dic = test_vector["mismatched"]
+        self.send_and_check_packets(mismatched_dic)
+        #destroy rule and send matched packets
+        self.destroy_switch_filter_rule(0, rule_list)
+        self.check_switch_filter_rule_list(0, [])
+        #send matched packets and check
+        destroy_dict = copy.deepcopy(matched_dic)
+        if isinstance(destroy_dict["expect_results"]["expect_pkts"], list):
+            destroy_dict["expect_results"]["expect_pkts"] = [0]*len(destroy_dict["expect_results"]["expect_pkts"])
+        else:
+            destroy_dict["expect_results"]["expect_pkts"] = 0
+        self.send_and_check_packets(destroy_dict)
+
+    def test_mac_pay(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_pay)
+
+    def test_mac_ipv4_frag(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv4_frag)
+
+    def test_mac_ipv4_pay(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv4_pay)
+
+    def test_mac_ipv4_udp_pay(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv4_udp_pay)
+
+    def test_mac_ipv4_tcp_pay(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv4_tcp_pay)
+
+    def test_mac_ipv4_igmp(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv4_igmp)
+
+    def test_mac_ipv6_frag_srcip_dstip(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv6_frag_srcip_dstip)
+
+    def test_mac_ipv6_frag_dstip_tc(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv6_frag_dstip_tc)
+
+    def test_mac_ipv6_pay_srcip_dstip(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv6_pay_srcip_dstip)
+
+    def test_mac_ipv6_pay_dstip_tc(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv6_pay_dstip_tc)
+
+    def test_mac_ipv6_udp_pay(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv6_udp_pay)
+
+    def test_mac_ipv6_tcp(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv6_tcp)
+
+    def test_mac_ipv4_nvgre_ipv4_frag(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv4_nvgre_ipv4_frag)
+
+    def test_mac_ipv4_nvgre_ipv4_pay(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv4_nvgre_ipv4_pay)
+
+    def test_mac_ipv4_nvgre_ipv4_udp_pay(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv4_nvgre_ipv4_udp_pay)
+
+    def test_mac_ipv4_nvgre_ipv4_tcp(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv4_nvgre_ipv4_tcp)
+
+    def test_mac_ipv4_nvgre_mac_ipv4_frag(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv4_nvgre_mac_ipv4_frag)
+
+    def test_mac_ipv4_nvgre_mac_ipv4_pay(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv4_nvgre_mac_ipv4_pay)
+
+    def test_mac_ipv4_nvgre_mac_ipv4_udp_pay(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv4_nvgre_mac_ipv4_udp_pay)
+
+    def test_mac_ipv4_nvgre_mac_ipv4_tcp(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv4_nvgre_mac_ipv4_tcp)
+
+    def test_mac_vlan_pppoe_ipv4_pay(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_vlan_pppoe_ipv4_pay)
+
+    def test_mac_vlan_pppoe_ipv6_pay(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_vlan_pppoe_ipv6_pay)
+
+    def test_mac_pppoe_ipv4_pay(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_pppoe_ipv4_pay)
+
+    def test_mac_pppoe_ipv6_pay(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_pppoe_ipv6_pay)
+
+    def _test_qinq(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_qinq)
+
+    def test_ip_multicast(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_ip_multicast)
+
+    def test_l2_multicast(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_l2_multicast)
+
+    def test_ethertype_filter_pppod(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_ethertype_filter_pppod)
+
+    def test_ethertype_filter_pppoe(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_ethertype_filter_pppoe)
+
+    def test_ethertype_filter_ipv6(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_ethertype_filter_ipv6)
+
+    def test_udp_port_filter_dhcp_discovery(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_udp_port_filter_dhcp_discovery)
+
+    def test_udp_port_filter_dhcp_offer(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_udp_port_filter_dhcp_offer)
+
+    def test_udp_port_filter_vxlan(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_udp_port_filter_vxlan)
+
+    def test_mac_vlan_filter(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_vlan_filter)
+
+    def test_vlan_filter(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_vlan_filter)
+
+    def test_actions_vf_id_0(self):
+        #set up 4 vfs on 1 pf environment
+        self.setup_1pf_vfs_env()
+        #launch testpmd
+        command = self.create_testpmd_command()
+        out = self.dut.send_expect(command, "testpmd> ", 15)
+        self.testpmd_status = "running"
+        self.dut.send_expect("set fwd rxonly", "testpmd> ", 15)
+        self.dut.send_expect("set verbose 1", "testpmd> ", 15)
+        #create a rule
+        rule_list = self.create_switch_filter_rule(tv_actions_vf_id_0["rte_flow_pattern"])   #create a rule
+        self.check_switch_filter_rule_list(0, rule_list)
+        #send matched packets and check
+        matched_dic = tv_actions_vf_id_0["matched"]
+        self.send_and_check_packets(matched_dic)
+
+    def test_cannot_create_rule_on_vf_1(self):
+        #set up 4 vfs on 1 pf environment
+        self.setup_1pf_vfs_env()
+        #launch testpmd
+        self.launch_testpmd()
+        #create a rule on vf 1
+        rule = "flow create 1 ingress pattern eth dst is 68:05:ca:8d:ed:a8 / ipv4 src is 192.168.0.1 dst is 192.168.0.2 tos is 4 ttl is 3 / udp src is 25 dst is 23 / end actions vf id 1 / end"
+        out = self.dut.send_expect(rule, "testpmd> ", timeout=2)  #create a rule
+        self.verify("Failed to create flow" in out, "Log not provide a friendly output to indicate that the rule failed to create.")
+        #check the rule list
+        self.check_switch_filter_rule_list(1, [])
+
+    def test_unsupported_pattern_in_comms(self):
+        #set up 4 vfs on 1 pf environment
+        self.setup_1pf_vfs_env()
+        #launch testpmd
+        self.launch_testpmd()
+        #create an SCTP rule which is not supported in comms
+        rule = "flow create 0 ingress pattern eth / ipv4 src is 192.168.0.2 dst is 192.168.0.3  / sctp src is 25 dst is 23 / end actions vf id 1 / end"
+        out = self.dut.send_expect(rule, "testpmd> ", timeout=2)  #create a rule
+        self.verify("Failed to create flow" in out and "Invalid input pattern" in out, "Log not provide a friendly output to indicate that the SCTP rule failed to create.")
+        #check the rule list
+        self.check_switch_filter_rule_list(0, [])
+
+    def test_unsupported_pattern_in_os_default_but_supported_in_comms(self):
+        """
+        test with os default package
+        """
+        #set up 4 vfs on 1 pf environment
+        self.setup_1pf_vfs_env()
+        #launch testpmd
+        self.launch_testpmd()
+        #create a PPPOE rule which is not supported in os default
+        rule = "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / pppoes seid is 3 / pppoe_proto_id is 0x0021 / end actions vf id 1 / end"
+        out = self.dut.send_expect(rule, "testpmd> ", timeout=2)  #create a rule
+        self.verify("Failed to create flow" in out and "Invalid input pattern" in out, "Log not provide a friendly output to indicate that the PPPOE rule failed to create.")
+        #check the rule list
+        self.check_switch_filter_rule_list(0, [])
+        #create a MAC_IPV4_PFCP_NODE rule
+        rule = "flow create 0 ingress pattern eth / ipv4 / udp / pfcp s_field is 0 / end actions vf id 1 / end"
+        out = self.dut.send_expect(rule, "testpmd> ", timeout=2)  #create a rule
+        self.verify("Failed to create flow" in out and "Invalid input pattern" in out, "Log not provide a friendly output to indicate that the mac_ipv4_pfcp_node rule failed to create.")
+        #check the rule list
+        self.check_switch_filter_rule_list(0, [])
+
+    def test_unsupported_input_set(self):
+        #set up 4 vfs on 1 pf environment
+        self.setup_1pf_vfs_env()
+        #launch testpmd
+        self.launch_testpmd()
+        #create a rule with input set [inner tos]
+        rule = "flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.1 / nvgre tni is 2 / eth dst is 68:05:ca:8d:ed:a8 / ipv4 src is 192.168.1.2 dst is 192.168.1.3 tos is 4 / end actions vf id 1 / end"
+        out = self.dut.send_expect(rule, "testpmd> ", timeout=2)  #create a rule
+        self.verify("Failed to create flow" in out and "Invalid input set" in out, "Log not provide a friendly output to indicate that the input set is not supported.")
+        #check the rule list
+        self.check_switch_filter_rule_list(0, [])
+
+    def test_invalid_vf_id(self):
+        #set up 4 vfs on 1 pf environment
+        self.setup_1pf_vfs_env()
+        #launch testpmd
+        self.launch_testpmd()
+        #create a rule with invalid vf id 5
+        rule = "flow create 0 ingress pattern eth dst is 68:05:ca:8d:ed:a8 / ipv4 src is 192.168.0.1 dst is 192.168.0.2 tos is 4 ttl is 3 / tcp src is 25 dst is 23 / end actions vf id 5 / end"
+        out = self.dut.send_expect(rule, "testpmd> ", timeout=2)
+        self.verify("Failed to create flow" in out, "Log not provide a friendly output to indicate that the rule failed to create.")
+        #check the rule list
+        self.check_switch_filter_rule_list(0, [])
+
+    def test_delete_non_existing_rule(self):
+        #set up 4 vfs on 1 pf environment
+        self.setup_1pf_vfs_env()
+        #launch testpmd
+        self.launch_testpmd()
+        #check no rule in the list
+        self.check_switch_filter_rule_list(0, [])
+        #destroy rule 0
+        out = self.dut.send_expect("flow destroy 0 rule 0", "testpmd> ", timeout=15)
+        self.verify("Fail" not in out, "Destroy failed.")
+        #flush rules
+        out = self.dut.send_expect("flow flush 0", "testpmd> ", timeout=15)
+        self.verify("Fail" not in out, "Destroy failed.")
+
+    def _test_add_existing_rules_but_with_different_vfs(self):
+        #set up 4 vfs on 1 pf environment
+        self.setup_1pf_vfs_env()
+        #launch testpmd
+        vf0_pci = self.sriov_vfs_port_0[0].pci
+        vf1_pci = self.sriov_vfs_port_0[1].pci
+        vf2_pci = self.sriov_vfs_port_0[2].pci
+        all_eal_param = self.dut.create_eal_parameters(cores="1S/4C/1T", ports=[vf0_pci, vf1_pci, vf2_pci], port_options={vf0_pci:"cap=dcf"})
+        command = "./%s/app/testpmd %s -- -i" % (self.dut.target, all_eal_param)
+        out = self.dut.send_expect(command, "testpmd> ", 15)
+        self.testpmd_status = "running"
+        self.dut.send_expect("set portlist 1,2", "testpmd> ", 15)
+        self.dut.send_expect("set fwd rxonly", "testpmd> ", 15)
+        self.dut.send_expect("set verbose 1", "testpmd> ", 15)
+        #create rules with same pattern but to different vfs
+        rule_list = self.create_switch_filter_rule(tv_add_existing_rules_but_with_different_vfs["rte_flow_pattern"])
+        self.check_switch_filter_rule_list(0, rule_list)
+        #send matched packets and check
+        matched_dic = tv_add_existing_rules_but_with_different_vfs["matched"]
+        self.send_and_check_packets(matched_dic)
+        #destroy rule 0 and send matched packets
+        self.destroy_switch_filter_rule(0, rule_list[0])
+        rule_list.pop(0)
+        #check only rule 1 exists in the list
+        self.check_switch_filter_rule_list(0, rule_list)
+        #send matched packets and check
+        destroy_dict = copy.deepcopy(matched_dic)
+        destroy_dict["expect_results"]["expect_pkts"][0] = 0
+        self.send_and_check_packets(destroy_dict)
+        #destroy rule 1 and send matched packets
+        self.destroy_switch_filter_rule(0, rule_list[0])
+        rule_list.pop(0)
+        #check no rule exists in the list
+        self.check_switch_filter_rule_list(0, rule_list)
+        #send matched packets and check
+        destroy_dict["expect_results"]["expect_pkts"][1] = 0
+        self.send_and_check_packets(destroy_dict)
+
+    def test_add_existing_rules_with_the_same_vfs(self):
+        #set up 4 vfs on 1 pf environment
+        self.setup_1pf_vfs_env()
+        #launch testpmd
+        self.launch_testpmd()
+        #create a rule
+        rule = "flow create 0 ingress pattern eth dst is 68:05:ca:8d:ed:a8 / ipv4 src is 192.168.0.1 dst is 192.168.0.2 tos is 4 ttl is 3 / udp src is 25 dst is 23 / end actions vf id 1 / end"
+        rule_list = self.create_switch_filter_rule(rule)   #create a rule
+        self.check_switch_filter_rule_list(0, rule_list)
+        #create the same rule
+        out = self.dut.send_expect(rule, "testpmd> ", timeout=2)  #create a rule
+        self.verify("Failed to create flow" in out, "Log not provide a friendly output to indicate that the rule is failed to create.")
+        self.check_switch_filter_rule_list(0, rule_list)
+
+    def test_add_two_rules_with_one_rule_input_set_included_in_the_other(self):
+        #set up 4 vfs on 1 pf environment
+        self.setup_1pf_vfs_env()
+        #launch testpmd
+        vf0_pci = self.sriov_vfs_port_0[0].pci
+        vf1_pci = self.sriov_vfs_port_0[1].pci
+        vf2_pci = self.sriov_vfs_port_0[2].pci
+        all_eal_param = self.dut.create_eal_parameters(cores="1S/4C/1T", ports=[vf0_pci, vf1_pci, vf2_pci], port_options={vf0_pci:"cap=dcf"})
+        command = "./%s/app/testpmd %s -- -i" % (self.dut.target, all_eal_param)
+        out = self.dut.send_expect(command, "testpmd> ", 15)
+        self.testpmd_status = "running"
+        self.dut.send_expect("set portlist 1,2", "testpmd> ", 15)
+        self.dut.send_expect("set fwd rxonly", "testpmd> ", 15)
+        self.dut.send_expect("set verbose 1", "testpmd> ", 15)
+        #create rules with one rule's input set included in the other
+        rule_list = self.create_switch_filter_rule(tv_add_two_rules_with_one_rule_input_set_included_in_the_other["rte_flow_pattern"])
+        self.check_switch_filter_rule_list(0, rule_list)
+        #send matched packets and check
+        matched_dic = tv_add_two_rules_with_one_rule_input_set_included_in_the_other["matched"]
+        self.send_and_check_packets(matched_dic)
+        #send packet that only matches rule 0 but not rule 1
+        matched_dic_1 = copy.deepcopy(matched_dic)
+        matched_dic_1["scapy_str"].clear()
+        matched_dic_1["scapy_str"].append('Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.1",dst="192.168.0.3")/("X"*480)')
+        matched_dic_1["expect_results"]["expect_pkts"][1] = 0
+        self.send_and_check_packets(matched_dic_1)
+        #destroy rule 0 and send matched packets
+        self.destroy_switch_filter_rule(0, rule_list[0])
+        rule_list.pop(0)
+        #check only rule 1 exists in the list
+        self.check_switch_filter_rule_list(0, rule_list)
+        #send matched packets and check
+        destroy_dict = copy.deepcopy(matched_dic)
+        destroy_dict["expect_results"]["expect_pkts"][0] = 0
+        self.send_and_check_packets(destroy_dict)
+        #destroy rule 1 and send matched packets
+        self.destroy_switch_filter_rule(0, rule_list[0])
+        rule_list.pop(0)
+        #check no rule exists in the list
+        self.check_switch_filter_rule_list(0, rule_list)
+        #send matched packets and check
+        destroy_dict["expect_results"]["expect_pkts"][1] = 0
+        self.send_and_check_packets(destroy_dict)
+
+    def test_add_long_switch_rule(self):
+        #set up 4 vfs on 1 pf environment
+        self.setup_1pf_vfs_env()
+        #launch testpmd
+        self.launch_testpmd()
+        rule = "flow create 0 ingress pattern eth / ipv6 src is CDCD:910A:2222:5498:8475:1111:3900:1536 dst is CDCD:910A:2222:5498:8475:1111:3900:2022 tc is 3 / end actions vf id 1 / end"
+        out = self.dut.send_expect(rule, "testpmd> ", timeout=15)
+        self.verify("Failed to create flow" in out, "Log not provide a friendly output to indicate that the rule failed to create.")
+        #check the rule list
+        self.check_switch_filter_rule_list(0, [])
+        #create MAC_IPV6_UDP_PAY rule, and check the rule will not be affected by the long rule failure
+        self._rte_flow_validate_pattern(tv_mac_ipv6_udp_pay, launch_testpmd=False)
+
+    def test_fwd_with_single_vf(self):
+        #set up 4 vfs on 1 pf environment
+        self.setup_1pf_vfs_env()
+        #launch testpmd
+        command = self.create_testpmd_command()
+        out = self.dut.send_expect(command, "testpmd> ", 15)
+        self.testpmd_status = "running"
+        self.dut.send_expect("set portlist 1", "testpmd> ", 15)
+        self.dut.send_expect("set fwd mac", "testpmd> ", 15)
+        self.dut.send_expect("set verbose 1", "testpmd> ", 15)
+        #create a rule
+        rule_list = self.create_switch_filter_rule(tv_test_fwd_with_single_vf["rte_flow_pattern"])   #create a rule
+        self.check_switch_filter_rule_list(0, rule_list)
+        #send matched packets and check the vf received the packet and forwarded it
+        matched_dic = tv_test_fwd_with_single_vf["matched"]
+        #one vf, the rx packets are equal to tx packets
+        tx_dic = copy.deepcopy(matched_dic)
+        out = self.send_packets(matched_dic)
+        matched_dic["check_func"]["func"](out, matched_dic["check_func"]["param"], matched_dic["expect_results"], tx_dic["check_func"]["param"], tx_dic["expect_results"])
+
+    def test_fwd_with_multi_vfs(self):
+        #set up 4 vfs on 1 pf environment
+        self.setup_1pf_vfs_env()
+        #launch testpmd
+        vf0_pci = self.sriov_vfs_port_0[0].pci
+        vf1_pci = self.sriov_vfs_port_0[1].pci
+        vf2_pci = self.sriov_vfs_port_0[2].pci
+        all_eal_param = self.dut.create_eal_parameters(cores="1S/4C/1T", ports=[vf0_pci, vf1_pci, vf2_pci], port_options={vf0_pci:"cap=dcf"})
+        command = "./%s/app/testpmd %s -- -i" % (self.dut.target, all_eal_param)
+        out = self.dut.send_expect(command, "testpmd> ", 15)
+        self.testpmd_status = "running"
+        self.dut.send_expect("set portlist 1,2", "testpmd> ", 15)
+        self.dut.send_expect("set fwd mac", "testpmd> ", 15)
+        self.dut.send_expect("set verbose 1", "testpmd> ", 15)
+        #create a rule
+        rule_list = self.create_switch_filter_rule(tv_test_fwd_with_multi_vfs["rte_flow_pattern"])
+        self.check_switch_filter_rule_list(0, rule_list)
+        #send matched packets and check vf1 received the packet and forwarded to vf2
+        matched_dic = tv_test_fwd_with_multi_vfs["matched"]
+        #tx packets number on vf2
+        tx_dic = copy.deepcopy(matched_dic)
+        tx_dic["expect_results"]["expect_pkts"][0] = matched_dic["expect_results"]["expect_pkts"][1]
+        tx_dic["expect_results"]["expect_pkts"][1] = matched_dic["expect_results"]["expect_pkts"][0]
+        out = self.send_packets(matched_dic)
+        matched_dic["check_func"]["func"](out, matched_dic["check_func"]["param"], matched_dic["expect_results"], tx_dic["check_func"]["param"], tx_dic["expect_results"])
+
+    def test_max_vfs(self):
+        #set up 64 vfs on 1 pf environment
+        self.used_dut_port_0 = self.dut_ports[0]
+        self.pf0_intf = self.dut.ports_info[self.used_dut_port_0]['intf']
+        out = self.dut.send_expect('ethtool -i %s' % self.pf0_intf, '#')
+        #generate 64 VFs on PF0
+        self.dut.generate_sriov_vfs_by_port(self.used_dut_port_0, 64, driver='default')
+        self.sriov_vfs_port = self.dut.ports_info[self.used_dut_port_0]['vfs_port']
+        #sort the vf interfaces and pcis by pcis
+        vfs = {}
+        for vf_port in self.sriov_vfs_port:
+            vfs[vf_port.pci] = vf_port.intf_name
+        vfs_sort = sorted(vfs.items(), key=lambda item:item[0])
+        vf_pci = [key for key,value in vfs_sort]
+        vf_intf = [value for key,value in vfs_sort]
+        #start the 64 VFs in the kernel
+        for intf in vf_intf:
+            self.dut.send_expect('ifconfig %s up' % intf, '#')
+
+        self.dut.send_expect('ip link set %s vf 0 trust on' % self.pf0_intf, '#')
+        self.dut.send_expect('./usertools/dpdk-devbind.py -b %s %s' % (self.vf_driver, vf_pci[0]), '# ')
+        time.sleep(5)
+        vf_intf.pop(0)
+        #launch testpmd
+        vf0_pci = vf_pci[0]
+        all_eal_param = self.dut.create_eal_parameters(cores="1S/4C/1T", ports=[vf0_pci], port_options={vf0_pci:"cap=dcf"})
+        command = "./%s/app/testpmd %s -- -i" % (self.dut.target, all_eal_param)
+        out = self.dut.send_expect(command, "testpmd> ", 15)
+        self.testpmd_status = "running"
+        #generate 63 rules to each vf and matched packets
+        for i in range(1,64):
+            rte_flow_pattern = "flow create 0 ingress pattern eth / ipv4 src is 192.168.0.%d / tcp / end actions vf id %d / end" % (i, i)
+            tv_max_vfs["rte_flow_pattern"].append(rte_flow_pattern)
+            matched_scapy_str = 'Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.%d")/TCP()/Raw("X"*480)' % i
+            tv_max_vfs["matched"]["scapy_str"].append(matched_scapy_str)
+        out = self.dut.send_expect("show port info all", "testpmd> ", 15)
+        #create 63 rules
+        rule_list = self.create_switch_filter_rule(tv_max_vfs["rte_flow_pattern"])
+        self.check_switch_filter_rule_list(0, rule_list)
+        #send matched packets and check
+        matched_dic = tv_max_vfs["matched"]
+        out = self.send_packets(matched_dic)
+        #check the 63 packets received by each vf
+        self.session_secondary = self.dut.new_session(suite="session_secondary")
+        #get the log of each kernel vf
+        out_vfs = self.get_kernel_vf_log(vf_intf, self.session_secondary)
+        matched_dic["check_func"]["func"](out_vfs, matched_dic["expect_results"]["expect_pkts"])
+        #send mismatched packets and check
+        mismatched_dic = tv_max_vfs["mismatched"]
+        out = self.send_packets(mismatched_dic)
+        #get the log of each kernel vf
+        out_vfs = self.get_kernel_vf_log(vf_intf, self.session_secondary)
+        # kernel vf will not clear the statistics automatically, the rx packets number is the same
+        mismatched_dic["check_func"]["func"](out_vfs, mismatched_dic["expect_results"]["expect_pkts"])
+        #destroy rules and send matched packets
+        self.destroy_switch_filter_rule(0, rule_list)
+        self.check_switch_filter_rule_list(0, [])
+        #send matched packets and check
+        destroy_dict = copy.deepcopy(matched_dic)
+        out = self.send_packets(destroy_dict)
+        # check the packets are not to any vf, and the statistics in each kernel vf are still the same.
+        out_vfs = self.get_kernel_vf_log(vf_intf, self.session_secondary)
+        #the kernel vf will not clear the statistics automatically, the rx packets number is still the same
+        destroy_dict["check_func"]["func"](out_vfs, destroy_dict["expect_results"]["expect_pkts"])
+
+    def test_max_field_vectors(self):
+        #set up 4 vfs on 1 pf environment
+        self.setup_1pf_vfs_env()
+        #launch testpmd
+        self.launch_testpmd()
+        #create 3 nvgre rules, which have run out of field vectors
+        rule_list = self.create_switch_filter_rule(tv_max_field_vectors["rte_flow_pattern"])   #create a rule
+        self.check_switch_filter_rule_list(0, rule_list)
+        #create a rule, check the rule can not be created successfully
+        rule = "flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.10 / nvgre tni is 0x8 /  eth dst is 68:05:ca:8d:ed:a1  / ipv4 src is 192.168.1.2 dst is 192.168.1.3 / udp src is 25 dst is 23 / end actions vf id 1 / end"
+        out = self.dut.send_expect(rule, "testpmd> ", timeout=2)  #create a rule
+        self.verify("Failed to create flow" in out, "Log not provide a friendly output to indicate that the rule failed to create.")
+        #check the rule list
+        self.check_switch_filter_rule_list(0, rule_list)
+        #send matched packets and check
+        matched_dic = tv_max_field_vectors["matched"]
+        self.send_and_check_packets(matched_dic)
+        #send mismatched packets and check
+        mismatched_dic = tv_max_field_vectors["mismatched"]
+        self.send_and_check_packets(mismatched_dic)
+        #destroy rules and send matched packets
+        self.destroy_switch_filter_rule(0, rule_list)
+        self.check_switch_filter_rule_list(0, [])
+        #send matched packets and check
+        destroy_dict = copy.deepcopy(matched_dic)
+        destroy_dict["expect_results"]["expect_pkts"] = 0
+        self.send_and_check_packets(destroy_dict)
+
+    def test_max_rule_number(self):
+        #set up 4 vfs on 1 pf environment
+        self.setup_1pf_vfs_env()
+        #create 32563 rules with the same pattern, but different input set to file
+        src_file = 'dep/testpmd_cmds_32k_switch_rules'
+        flows = open(src_file, mode='w')
+        rule_count = 1
+        for i in range(0,255):
+            for j in range(0,255):
+                if not rule_count > 32563:
+                    flows.write('flow create 0 ingress pattern eth / ipv4 src is 192.168.%d.%d / end actions vf id 1 / end \n' % (i, j))
+                    matched_scapy_str = 'Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.%d.%d")/TCP(sport=25,dport=23)/Raw("X"*480)' % (i, j)
+                    tv_max_rule_number["matched"]["scapy_str"].append(matched_scapy_str)
+                    rule_count += 1
+                else:
+                    break
+            if rule_count > 32563:
+                break
+        flows.close()
+        self.dut_file_dir = '/tmp'
+        self.dut.session.copy_file_to(src_file, self.dut_file_dir)
+        #launch testpmd with 32563 rules
+        vf0_pci = self.sriov_vfs_port_0[0].pci
+        vf1_pci = self.sriov_vfs_port_0[1].pci
+        all_eal_param = self.dut.create_eal_parameters(cores="1S/4C/1T", ports=[vf0_pci, vf1_pci], port_options={vf0_pci:"cap=dcf"})
+        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target, all_eal_param, "--cmdline-file=/tmp/testpmd_cmds_32k_switch_rules")
+        out = self.dut.send_expect(command, "testpmd> ", 360)
+        self.testpmd_status = "running"
+        self.dut.send_expect("set portlist 1", "testpmd> ", 15)
+        self.dut.send_expect("set fwd rxonly", "testpmd> ", 15)
+        #check the rule list with 32563 rules
+        rule_list_num = list(range(0, 32563))
+        rule_list = [str(x) for x in rule_list_num]
+        self.check_switch_filter_rule_list(0, rule_list)
+        #create the 32564th rule
+        rule = "flow create 0 ingress pattern eth / ipv4 src is 192.168.127.178 / end actions vf id 1 / end"
+        out = self.dut.send_expect(rule, "testpmd> ", timeout=2)
+        self.verify("Failed to create flow" in out, "Log not provide a friendly output to indicate that the rule failed to create.")
+        #check the rule list
+        self.check_switch_filter_rule_list(0, rule_list)
+        #send matched packets and check
+        matched_dic = tv_max_rule_number["matched"]
+        self.send_and_check_packets(matched_dic)
+        #send mismatched packets and check
+        mismatched_dic = tv_max_rule_number["mismatched"]
+        self.send_and_check_packets(mismatched_dic)
+        #destroy rules and send matched packets
+        self.dut.send_expect("flow flush 0", "testpmd> ", 300)
+        self.check_switch_filter_rule_list(0, [])
+        #send matched packets and check
+        destroy_dict = copy.deepcopy(matched_dic)
+        destroy_dict["expect_results"]["expect_pkts"] = 0
+        self.send_and_check_packets(destroy_dict)
+
+    def test_flow_validation(self):
+        #set up 4 vfs on 1 pf environment
+        self.setup_1pf_vfs_env()
+        #launch testpmd
+        self.launch_testpmd()
+        #validate MAC_IPV4_UDP_PAY
+        rule = "flow validate 0 ingress pattern eth dst is 68:05:ca:8d:ed:a8 / ipv4 src is 192.168.0.1 dst is 192.168.0.2 tos is 4 ttl is 3 / udp src is 25 dst is 23 / end actions vf id 1 / end"
+        out = self.dut.send_expect(rule, "testpmd> ", timeout=2)
+        self.verify("Flow rule validated" in out, "validate failed. rule: %s " % rule)
+        #validate MAC_IPV4_PFCP_NODE
+        rule = "flow validate 0 ingress pattern eth / ipv4 / udp / pfcp s_field is 0 / end actions vf id 1 / end"
+        out = self.dut.send_expect(rule, "testpmd> ", timeout=2)
+        self.verify("Flow rule validated" in out, "validate failed. rule: %s " % rule)
+        #validate MAC_IPV4_SCTP_PAY
+        rule = "flow validate 0 ingress pattern eth / ipv4 src is 192.168.0.2 dst is 192.168.0.3 / sctp src is 25 dst is 23 / end actions vf id 1 / end"
+        out = self.dut.send_expect(rule, "testpmd> ", timeout=2)
+        self.verify("error" in out and "Invalid input pattern: Invalid argument" in out, "validate failed. rule: %s " % rule)
+        #check the rule list
+        self.check_switch_filter_rule_list(0, [])
+        #validate a rule on invalid vf
+        rule = "flow validate 1 ingress pattern eth / ipv6 / udp / pfcp s_field is 1 / end actions vf id 1 / end"
+        out = self.dut.send_expect(rule, "testpmd> ", timeout=2)
+        self.verify("error" in out and "Failed" in out, "validate failed. rule: %s " % rule)
+        #check the rule list
+        self.check_switch_filter_rule_list(1, [])
+
+    def test_dcf_stop_start(self):
+        #set up 4 vfs on 1 pf environment
+        self.setup_1pf_vfs_env()
+        #launch testpmd
+        self.launch_testpmd()
+        #create MAC_IPV4_UDP_PAY rule
+        rule_list = self.create_switch_filter_rule(tv_mac_ipv4_udp_pay["rte_flow_pattern"])   #create a rule
+        self.check_switch_filter_rule_list(0, rule_list)
+        #send matched packets and check
+        matched_dic = tv_mac_ipv4_udp_pay["matched"]
+        self.send_and_check_packets(matched_dic)
+        #stop the DCF, then start the DCF
+        self.dut.send_expect("port stop 0", "testpmd> ")
+        self.dut.send_expect("port start 0", "testpmd> ")
+        self.check_switch_filter_rule_list(0, rule_list)
+        #send matched packets, port 1 can still receive the packets.
+        self.send_and_check_packets(matched_dic)
+
+    def test_mac_ipv4_pfcp_node(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv4_pfcp_node)
+
+    def test_mac_ipv4_pfcp_session(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv4_pfcp_session)
+
+    def test_mac_ipv6_pfcp_node(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv6_pfcp_node)
+
+    def test_mac_ipv6_pfcp_session(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv6_pfcp_session)
+
+    def test_add_two_rules_with_different_input_set_same_vf_id(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_add_two_rules_with_different_input_set_same_vf_id)
+
+    def test_add_two_rules_with_different_input_set_different_vf_id(self):
+        #set up 4 vfs on 1 pf environment
+        self.setup_1pf_vfs_env()
+        #launch testpmd
+        vf0_pci = self.sriov_vfs_port_0[0].pci
+        vf1_pci = self.sriov_vfs_port_0[1].pci
+        vf2_pci = self.sriov_vfs_port_0[2].pci
+        all_eal_param = self.dut.create_eal_parameters(cores="1S/4C/1T", ports=[vf0_pci, vf1_pci, vf2_pci], port_options={vf0_pci:"cap=dcf"})
+        command = "./%s/app/testpmd %s -- -i" % (self.dut.target, all_eal_param)
+        out = self.dut.send_expect(command, "testpmd> ", 15)
+        self.testpmd_status = "running"
+        self.dut.send_expect("set portlist 1,2", "testpmd> ", 15)
+        self.dut.send_expect("set fwd rxonly", "testpmd> ", 15)
+        self.dut.send_expect("set verbose 1", "testpmd> ", 15)
+        self._rte_flow_validate_pattern(tv_add_two_rules_with_different_input_set_different_vf_id, False)
+
+    def tear_down(self):
+        """
+        Run after each test case.
+        """
+        if self.testpmd_status != "close":
+            # destroy all flow rules on DCF
+            self.dut.send_expect("flow flush 0", "testpmd> ", 15)
+            self.dut.send_expect("clear port stats all", "testpmd> ", 15)
+            self.dut.send_expect("quit", "#", 15)
+        self.testpmd_status = "close"
+        #kill all DPDK application
+        self.dut.kill_all()
+        # destroy vfs
+        for port_id in self.dut_ports:
+            self.dut.destroy_sriov_vfs_by_port(port_id)
+        if self.running_case == "test_unsupported_pattern_in_os_default_but_supported_in_comms":
+            #Restore the pkg file
+            self.dut.send_expect("cp %s %s" % (self.tmp_dir, self.pkg_file), "# ")
+        if getattr(self, 'session_secondary', None):
+            self.dut.close_session(self.session_secondary)
+
+    def tear_down_all(self):
+        """
+        Run after each test suite.
+        """
+        self.dut.kill_all()
-- 
2.17.1


[-- Attachment #2: SwitchFilterTest.log --]
[-- Type: application/octet-stream, Size: 1018780 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [dts] [PATCH V1 1/5] dep: add igmp.py to dep
@ 2020-05-25 18:09 Nannan Lu
  2020-05-25 18:10 ` [dts] [PATCH V1 2/5] packet.py: add igmp import Nannan Lu
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Nannan Lu @ 2020-05-25 18:09 UTC (permalink / raw)
  To: dts; +Cc: Nannan Lu

Add igmp.py to dep so that dts supports
sending igmp packets.

Signed-off-by: Nannan Lu <nannan.lu@intel.com>
---
 dep/igmp.py | 164 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 164 insertions(+)
 create mode 100644 dep/igmp.py

diff --git a/dep/igmp.py b/dep/igmp.py
new file mode 100644
index 0000000..5cbf9c0
--- /dev/null
+++ b/dep/igmp.py
@@ -0,0 +1,164 @@
+#! /usr/bin/env python
+
+# This file is part of Scapy
+# Scapy is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# any later version.
+#
+# Scapy is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Scapy. If not, see <http://www.gnu.org/licenses/>.
+
+# flake8: noqa: E501
+
+# scapy.contrib.description = Internet Group Management Protocol v1/v2 (IGMP/IGMPv2)
+# scapy.contrib.status = loads
+
+from __future__ import print_function
+from scapy.compat import chb, orb
+from scapy.error import warning
+from scapy.fields import ByteEnumField, ByteField, IPField, XShortField
+from scapy.layers.inet import IP, IPOption_Router_Alert
+from scapy.layers.l2 import Ether, getmacbyip
+from scapy.packet import bind_layers, Packet
+from scapy.utils import atol, checksum
+
+
+def isValidMCAddr(ip):
+    """convert dotted quad string to long and check the first octet"""
+    FirstOct = atol(ip) >> 24 & 0xFF
+    return (FirstOct >= 224) and (FirstOct <= 239)
+
+
+class IGMP(Packet):
+    """IGMP Message Class for v1 and v2.
+
+This class is derived from class Packet. You  need call "igmpize()"
+so the packet is transformed according the RFC when sent.
+a=Ether(src="00:01:02:03:04:05")
+b=IP(src="1.2.3.4")
+c=IGMP(type=0x12, gaddr="224.2.3.4")
+x = a/b/c
+x[IGMP].igmpize()
+sendp(a/b/c, iface="en0")
+
+    Parameters:
+      type    IGMP type field, 0x11, 0x12, 0x16 or 0x17
+      mrcode  Maximum Response time (zero for v1)
+      gaddr   Multicast Group Address 224.x.x.x/4
+
+See RFC2236, Section 2. Introduction for definitions of proper
+IGMPv2 message format   http://www.faqs.org/rfcs/rfc2236.html
+
+  """
+    name = "IGMP"
+
+    igmptypes = {0x11: "Group Membership Query",
+                 0x12: "Version 1 - Membership Report",
+                 0x16: "Version 2 - Membership Report",
+                 0x17: "Leave Group"}
+
+    fields_desc = [ByteEnumField("type", 0x11, igmptypes),
+                   ByteField("mrcode", 20),
+                   XShortField("chksum", None),
+                   IPField("gaddr", "0.0.0.0")]
+
+    def post_build(self, p, pay):
+        """Called implicitly before a packet is sent to compute and place IGMP checksum.
+
+        Parameters:
+          self    The instantiation of an IGMP class
+          p       The IGMP message in hex in network byte order
+          pay     Additional payload for the IGMP message
+        """
+        p += pay
+        if self.chksum is None:
+            ck = checksum(p)
+            p = p[:2] + chb(ck >> 8) + chb(ck & 0xff) + p[4:]
+        return p
+
+    @classmethod
+    def dispatch_hook(cls, _pkt=None, *args, **kargs):
+        if _pkt and len(_pkt) >= 4:
+            from scapy.contrib.igmpv3 import IGMPv3
+            if orb(_pkt[0]) in [0x22, 0x30, 0x31, 0x32]:
+                return IGMPv3
+            if orb(_pkt[0]) == 0x11 and len(_pkt) >= 12:
+                return IGMPv3
+        return IGMP
+
+    def igmpize(self):
+        """Called to explicitly fixup the packet according to the IGMP RFC
+
+        The rules are:
+        General:
+            1.  the Max Response time is meaningful only in Membership Queries and should be zero
+        IP:
+            1. Send General Group Query to 224.0.0.1 (all systems)
+            2. Send Leave Group to 224.0.0.2 (all routers)
+            3a.Otherwise send the packet to the group address
+            3b.Send reports/joins to the group address
+            4. ttl = 1 (RFC 2236, section 2)
+            5. send the packet with the router alert IP option (RFC 2236, section 2)
+        Ether:
+            1. Recalculate destination
+
+        Returns:
+            True    The tuple ether/ip/self passed all check and represents
+                    a proper IGMP packet.
+            False   One of more validation checks failed and no fields
+                    were adjusted.
+
+        The function will examine the IGMP message to assure proper format.
+        Corrections will be attempted if possible. The IP header is then properly
+        adjusted to ensure correct formatting and assignment. The Ethernet header
+        is then adjusted to the proper IGMP packet format.
+        """
+        gaddr = self.gaddr if hasattr(self, "gaddr") and self.gaddr else "0.0.0.0"  # noqa: E501
+        underlayer = self.underlayer
+        if self.type not in [0x11, 0x30]:                               # General Rule 1  # noqa: E501
+            self.mrcode = 0
+        if isinstance(underlayer, IP):
+            if (self.type == 0x11):
+                if (gaddr == "0.0.0.0"):
+                    underlayer.dst = "224.0.0.1"                        # IP rule 1  # noqa: E501
+                elif isValidMCAddr(gaddr):
+                    underlayer.dst = gaddr                              # IP rule 3a  # noqa: E501
+                else:
+                    warning("Invalid IGMP Group Address detected !")
+                    return False
+            elif ((self.type == 0x17) and isValidMCAddr(gaddr)):
+                underlayer.dst = "224.0.0.2"                           # IP rule 2  # noqa: E501
+            elif ((self.type == 0x12) or (self.type == 0x16)) and (isValidMCAddr(gaddr)):  # noqa: E501
+                underlayer.dst = gaddr                                 # IP rule 3b  # noqa: E501
+            else:
+                warning("Invalid IGMP Type detected !")
+                return False
+            if not any(isinstance(x, IPOption_Router_Alert) for x in underlayer.options):  # noqa: E501
+                underlayer.options.append(IPOption_Router_Alert())
+            underlayer.ttl = 1                                         # IP rule 4
+            _root = self.firstlayer()
+            if _root.haslayer(Ether):
+                # Force recalculate Ether dst
+                _root[Ether].dst = getmacbyip(underlayer.dst)          # Ether rule 1  # noqa: E501
+        from scapy.contrib.igmpv3 import IGMPv3
+        if isinstance(self, IGMPv3):
+            self.encode_maxrespcode()
+        return True
+
+    def mysummary(self):
+        """Display a summary of the IGMP object."""
+        if isinstance(self.underlayer, IP):
+            return self.underlayer.sprintf("IGMP: %IP.src% > %IP.dst% %IGMP.type% %IGMP.gaddr%")  # noqa: E501
+        else:
+            return self.sprintf("IGMP %IGMP.type% %IGMP.gaddr%")
+
+
+bind_layers(IP, IGMP, frag=0,
+            proto=2,
+            ttl=1)
-- 
2.17.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [dts] [PATCH V1 2/5] packet.py: add igmp import
  2020-05-25 18:09 [dts] [PATCH V1 1/5] dep: add igmp.py to dep Nannan Lu
@ 2020-05-25 18:10 ` Nannan Lu
  2020-05-25 18:10 ` [dts] [PATCH V1 3/5] conf: add cvl_dcf_switch_filter.cfg to conf Nannan Lu
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Nannan Lu @ 2020-05-25 18:10 UTC (permalink / raw)
  To: dts; +Cc: Nannan Lu

Import IGMP from igmp in packets.py
to make dts support sending igmp packets.

Signed-off-by: Nannan Lu <nannan.lu@intel.com>
---
 framework/packet.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/framework/packet.py b/framework/packet.py
index 381490e..42982cd 100644
--- a/framework/packet.py
+++ b/framework/packet.py
@@ -55,6 +55,7 @@ from lldp import LLDP, LLDPManagementAddress
 from Dot1BR import Dot1BR
 from nsh import NSH
 from mpls import MPLS
+from igmp import IGMP
 
 from utils import convert_ip2int
 from utils import convert_int2ip
-- 
2.17.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [dts] [PATCH V1 3/5] conf: add cvl_dcf_switch_filter.cfg to conf
  2020-05-25 18:09 [dts] [PATCH V1 1/5] dep: add igmp.py to dep Nannan Lu
  2020-05-25 18:10 ` [dts] [PATCH V1 2/5] packet.py: add igmp import Nannan Lu
@ 2020-05-25 18:10 ` Nannan Lu
  2020-05-25 18:10 ` [dts] [PATCH V1 4/5] tests/rte_flow_common.py: add dcf check functions to tests/rte_flow_common.py Nannan Lu
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Nannan Lu @ 2020-05-25 18:10 UTC (permalink / raw)
  To: dts; +Cc: Nannan Lu

Add "ice_driver_file_location" and
"os_default_package_file_location" configuration in
cvl_dcf_switch_filter.cfg to support rmmod/insmod ice
and change package in TestSuite_cvl_dcf_switch_filter.py.

Signed-off-by: Nannan Lu <nannan.lu@intel.com>
---
 conf/cvl_dcf_switch_filter.cfg | 5 +++++
 1 file changed, 5 insertions(+)
 create mode 100644 conf/cvl_dcf_switch_filter.cfg

diff --git a/conf/cvl_dcf_switch_filter.cfg b/conf/cvl_dcf_switch_filter.cfg
new file mode 100644
index 0000000..b7b7179
--- /dev/null
+++ b/conf/cvl_dcf_switch_filter.cfg
@@ -0,0 +1,5 @@
+[suite]
+# cvl_dcf_switch_filter common options ice driver file location
+ice_driver_file_location="/lib/modules/4.15.0-101-generic/kernel/drivers/net/ethernet/intel/ice/ice.ko"
+# os default package file location
+os_default_package_file_location="/lib/firmware/updates/intel/ice/ddp/ice-1.3.11.0.pkg"
-- 
2.17.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [dts] [PATCH V1 4/5] tests/rte_flow_common.py: add dcf check functions to tests/rte_flow_common.py
  2020-05-25 18:09 [dts] [PATCH V1 1/5] dep: add igmp.py to dep Nannan Lu
  2020-05-25 18:10 ` [dts] [PATCH V1 2/5] packet.py: add igmp import Nannan Lu
  2020-05-25 18:10 ` [dts] [PATCH V1 3/5] conf: add cvl_dcf_switch_filter.cfg to conf Nannan Lu
@ 2020-05-25 18:10 ` Nannan Lu
  2020-05-25 18:10 ` [dts] [PATCH V1 5/5] tests: add TestSuite_cvl_dcf_switch_filter.py to tests Nannan Lu
  2020-06-01  3:13 ` [dts] [PATCH V1 1/5] dep: add igmp.py to dep Tu, Lijuan
  4 siblings, 0 replies; 7+ messages in thread
From: Nannan Lu @ 2020-05-25 18:10 UTC (permalink / raw)
  To: dts; +Cc: Nannan Lu

Add dcf check functions to tests/rte_flow_common.py.

Signed-off-by: Nannan Lu <nannan.lu@intel.com>
---
 tests/rte_flow_common.py | 98 ++++++++++++++++++++++++++++++++++++++--
 1 file changed, 93 insertions(+), 5 deletions(-)

diff --git a/tests/rte_flow_common.py b/tests/rte_flow_common.py
index 7592114..be0e434 100644
--- a/tests/rte_flow_common.py
+++ b/tests/rte_flow_common.py
@@ -35,7 +35,20 @@ import re
 from utils import GREEN, RED
 
 # switch filter common functions
-def get_packet_number(out,match_string):
+def get_suite_config(test_case):
+    """
+    get the suite config from conf/cvl_dcf_switch_filter.cfg.
+    """
+    suite_config = {}
+    if "ice_driver_file_location" in test_case.get_suite_cfg():
+        ice_driver_file_location = test_case.get_suite_cfg()["ice_driver_file_location"]
+        suite_config["ice_driver_file_location"] = ice_driver_file_location
+    if "os_default_package_file_location" in test_case.get_suite_cfg():
+        os_default_package_file_location = test_case.get_suite_cfg()["os_default_package_file_location"]
+        suite_config["os_default_package_file_location"] = os_default_package_file_location
+    return suite_config
+
+def get_rx_packet_number(out,match_string):
     """
     get the rx packets number.
     """
@@ -55,7 +68,7 @@ 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)
+    pkt_num = get_rx_packet_number(out,match_string)
     return pkt_num
 
 def get_queue_rx_packets_number(out, port_num, queue_id):
@@ -63,7 +76,7 @@ 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)
+    pkt_num = get_rx_packet_number(out,match_string)
     return pkt_num
 
 def check_output_log_in_queue(out, func_param, expect_results):
@@ -195,14 +208,89 @@ def check_output_log_drop_mismatched(out, func_param, expect_results):
         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_vf_rx_packets_number(out, func_param, expect_results, need_verify=True):
+    """
+    check the vf receives the correct number packets
+    """
+    expect_port = func_param["expect_port"]
+    expect_pkts = expect_results["expect_pkts"]
+
+    if isinstance(expect_port, list):
+        results = []
+        for i in range(0,len(expect_port)):
+            pkt_num = get_port_rx_packets_number(out, expect_port[i])
+            results.append(pkt_num)
+        if need_verify:
+            verify(results == expect_pkts, "failed: packets number not correct. expect %s, result %s" % (expect_pkts, results))
+        else:
+            return results
+    else:
+        pkt_num = get_port_rx_packets_number(out, expect_port)
+        if need_verify:
+            verify(pkt_num == expect_pkts, "failed: packets number not correct. expect %s, result %s" % (expect_pkts, pkt_num))
+        else:
+            return pkt_num
+
+def check_vf_rx_tx_packets_number(out, rx_func_param, rx_expect_results, tx_func_param, tx_expect_results):
+    """
+    check the vf receives and forwards the correct number packets
+    """
+    rx_expect_port = rx_func_param["expect_port"]
+    rx_expect_pkts = rx_expect_results["expect_pkts"]
+    tx_expect_port = tx_func_param["expect_port"]
+    tx_expect_pkts = tx_expect_results["expect_pkts"]
+
+    #check port receives and forwards the correct number packets
+    if isinstance(rx_expect_port, list):
+        results_rx_packets = []
+        results_tx_packets = []
+        for i in range(0,len(rx_expect_port)):
+            p = re.compile(
+                'Forward\sstatistics\s+for\s+port\s+%d\s+.*\n.*RX-packets:\s(\d+)\s+RX-dropped:\s\d+\s+RX-total:\s\d+\s+.*\n.*TX-packets:\s(\d+)\s+TX-dropped:\s\d+\s+' % rx_expect_port[i])
+            pkt_li = p.findall(out)
+            results = list(map(int, list(pkt_li[0])))
+            results_rx_packets.append(results[0])
+            results_tx_packets.append(results[1])
+        verify(results_rx_packets == rx_expect_pkts and results_tx_packets == tx_expect_pkts, "failed: packets number not correct. expect_rx %s, result_rx %s, expect_tx %s, results_tx %s" % (rx_expect_pkts, results_rx_packets, tx_expect_pkts, results_tx_packets))
+    else:
+        p = re.compile(
+                'Forward\sstatistics\s+for\s+port\s+%d\s+.*\n.*RX-packets:\s(\d+)\s+RX-dropped:\s\d+\s+RX-total:\s\d+\s+.*\n.*TX-packets:\s(\d+)\s+TX-dropped:\s\d+\s+' % rx_expect_port)
+        pkt_li = p.findall(out)
+        results = list(map(int, list(pkt_li[0])))
+        verify(results[0] == rx_expect_pkts and results[1] == tx_expect_pkts, "failed: packets number not correct. expect_rx %s, result_rx %s, expect_tx %s, result_tx %s" % (rx_expect_pkts, results[0], tx_expect_pkts, results[1]))
+
+    #check no packets are dropped for all ports
+    p = re.compile(
+                'Accumulated\sforward\sstatistics\s+for\s+all\s+ports.*\n.*RX-packets:\s\d+\s+RX-dropped:\s\d+\s+RX-total:\s\d+\s+.*\n.*TX-packets:\s\d+\s+TX-dropped:\s(\d+)\s+')
+    pkt_li = p.findall(out)
+    results_dropped = int(pkt_li[0])
+    verify(results_dropped == 0, "failed: dropped packets should be 0.")
+
+def check_kernel_vf_rx_packets_number(out_vfs, expect_results):
+    """
+    check the kernel vf receives the correct number packets by command ifconfig
+    """
+    p = re.compile(r"RX\s+packets\s?(\d+)")
+    results = []
+    for out in out_vfs:
+        m = p.search(out)
+        if m:
+            pkt_num = int(m.group(1))
+            results.append(pkt_num)
+        else:
+            results.append(False)
+    verify(results == expect_results, "failed: packets number not correct. expect %s, result %s" % (expect_results, results))
+
 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()
-    if len(out_lines) == 1:
+    p = re.compile(r"ID\s+Group\s+Prio\s+Attr\s+Rule")
+    m = p.search(out)
+    if not m:
         return False
+    out_lines=out.splitlines()
     if only_last:
         last_rule = out_lines[len(out_lines)-1]
         last_rule_list = last_rule.split('\t')
-- 
2.17.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [dts] [PATCH V1 5/5] tests: add TestSuite_cvl_dcf_switch_filter.py to tests
  2020-05-25 18:09 [dts] [PATCH V1 1/5] dep: add igmp.py to dep Nannan Lu
                   ` (2 preceding siblings ...)
  2020-05-25 18:10 ` [dts] [PATCH V1 4/5] tests/rte_flow_common.py: add dcf check functions to tests/rte_flow_common.py Nannan Lu
@ 2020-05-25 18:10 ` Nannan Lu
  2020-05-25 11:12   ` Lu, Nannan
  2020-06-01  3:13 ` [dts] [PATCH V1 1/5] dep: add igmp.py to dep Tu, Lijuan
  4 siblings, 1 reply; 7+ messages in thread
From: Nannan Lu @ 2020-05-25 18:10 UTC (permalink / raw)
  To: dts; +Cc: Nannan Lu

Add TestSuite_cvl_dcf_switch_filter.py to tests.

Signed-off-by: Nannan Lu <nannan.lu@intel.com>
---
 tests/TestSuite_cvl_dcf_switch_filter.py | 1666 ++++++++++++++++++++++
 1 file changed, 1666 insertions(+)
 create mode 100644 tests/TestSuite_cvl_dcf_switch_filter.py

diff --git a/tests/TestSuite_cvl_dcf_switch_filter.py b/tests/TestSuite_cvl_dcf_switch_filter.py
new file mode 100644
index 0000000..e8136d2
--- /dev/null
+++ b/tests/TestSuite_cvl_dcf_switch_filter.py
@@ -0,0 +1,1666 @@
+# BSD LICENSE
+#
+# Copyright(c) 2020 Intel Corporation. All rights reserved.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+#   * Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+#   * Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in
+#     the documentation and/or other materials provided with the
+#     distribution.
+#   * Neither the name of Intel Corporation nor the names of its
+#     contributors may be used to endorse or promote products derived
+#     from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import json
+import time
+import re
+import copy
+
+from test_case import TestCase
+from pmd_output import PmdOutput
+from packet import Packet
+from utils import BLUE, RED, GREEN
+import rte_flow_common as rfc
+
+import os
+
+tv_mac_pay = {
+    "name":"tv_mac_pay",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth src is 00:00:00:00:00:01 dst is 00:11:22:33:44:55 type is 0x0800 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(src="00:00:00:00:00:01",dst="00:11:22:33:44:55")/IP()/Raw("x" *80)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(src="00:00:00:00:00:02",dst="00:11:22:33:44:55")/IP()/Raw("x" *80)',
+                               'Ether(src="00:00:00:00:00:01",dst="00:11:22:33:44:54")/IP()/Raw("x" *80)',
+                               'Ether(src="00:00:00:00:00:01",dst="00:11:22:33:44:55")/IPv6()/Raw("x" *80)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv4_frag = {
+    "name":"tv_mac_ipv4_frag",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth dst is 68:05:ca:8d:ed:a8 / ipv4 src is 192.168.0.1 dst is 192.168.0.2 tos is 4 ttl is 2 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.1",dst="192.168.0.2",tos=4,ttl=2,frag=5)/("X"*480)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a3")/IP(src="192.168.0.1",dst="192.168.0.2",tos=4,ttl=2,frag=5)/("X"*480)',
+                               'Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.4",dst="192.168.0.2",tos=4,ttl=2,frag=5)/("X"*480)',
+                               'Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.1",dst="192.168.0.5",tos=4,ttl=2,frag=5)/("X"*480)',
+                               'Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.1",dst="192.168.0.2",tos=5,ttl=2,frag=5)/("X"*480)',
+                               'Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.1",dst="192.168.0.2",tos=4,ttl=3,frag=5)/("X"*480)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv4_pay = {
+    "name":"tv_mac_ipv4_pay",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth dst is 68:05:ca:8d:ed:a8 / ipv4 src is 192.168.0.1 dst is 192.168.0.2 proto is 6 tos is 4 ttl is 2 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.1",dst="192.168.0.2",tos=4,ttl=2)/TCP()/("X"*480)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a3")/IP(src="192.168.0.1",dst="192.168.0.2",tos=4,ttl=2)/TCP()/("X"*480)',
+                               'Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.4",dst="192.168.0.2",tos=4,ttl=2)/TCP()/("X"*480)',
+                               'Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.1",dst="192.168.0.5",tos=4,ttl=2)/TCP()/("X"*480)',
+                               'Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.1",dst="192.168.0.2",tos=5,ttl=2)/TCP()/("X"*480)',
+                               'Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.1",dst="192.168.0.2",tos=4,ttl=3)/TCP()/("X"*480)',
+                               'Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.1",dst="192.168.0.2",tos=4,ttl=2)/UDP()/("X"*480)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv4_udp_pay = {
+    "name":"tv_mac_ipv4_udp_pay",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth dst is 68:05:ca:8d:ed:a8 / ipv4 src is 192.168.0.1 dst is 192.168.0.2 tos is 4 ttl is 3 / udp src is 25 dst is 23 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.1",dst="192.168.0.2",tos=4,ttl=3)/UDP(sport=25,dport=23)/("X"*480)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.1",dst="192.168.0.2",tos=4,ttl=3)/UDP(sport=30,dport=23)/("X"*480)',
+                               'Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.1",dst="192.168.0.2",tos=4,ttl=3)/UDP(sport=25,dport=19)/("X"*480)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv4_tcp_pay = {
+    "name":"tv_mac_ipv4_tcp_pay",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth dst is 68:05:ca:8d:ed:a8 / ipv4 src is 192.168.0.1 dst is 192.168.0.2 tos is 4 ttl is 3 / tcp src is 25 dst is 23 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.1",dst="192.168.0.2",tos=4,ttl=3)/TCP(sport=25,dport=23)/("X"*480)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.1",dst="192.168.0.2",tos=4,ttl=3)/TCP(sport=30,dport=23)/("X"*480)',
+                               'Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.1",dst="192.168.0.2",tos=4,ttl=3)/TCP(sport=25,dport=19)/("X"*480)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv4_igmp = {
+    "name":"tv_mac_ipv4_igmp",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv4 proto is 0x02 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="00:11:22:33:44:55")/IP()/IGMP()/Raw("X"*480)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="00:11:22:33:44:55")/IP()/TCP()/Raw("X"*480)',
+                               'Ether(dst="00:11:22:33:44:55")/IP()/UDP()/Raw("X"*480)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv6_frag_srcip_dstip = {
+    "name":"tv_mac_ipv6_frag_srcip_dstip",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv6 src is CDCD:910A:2222:5498:8475:1111:3900:1536 dst is CDCD:910A:2222:5498:8475:1111:3900:2022 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="00:11:22:33:44:55")/IPv6(src="CDCD:910A:2222:5498:8475:1111:3900:1536", dst="CDCD:910A:2222:5498:8475:1111:3900:2022")/IPv6ExtHdrFragment()/("X"*480)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="00:11:22:33:44:55")/IPv6(src="CDCD:910A:2222:5498:8475:1111:3900:1537", dst="CDCD:910A:2222:5498:8475:1111:3900:2022")/IPv6ExtHdrFragment()/("X"*480)',
+                               'Ether(dst="00:11:22:33:44:55")/IPv6(src="CDCD:910A:2222:5498:8475:1111:3900:1536", dst="CDCD:910A:2222:5498:8475:1111:3900:2023")/IPv6ExtHdrFragment()/("X"*480)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv6_frag_dstip_tc = {
+    "name":"tv_mac_ipv6_frag_dstip_tc",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth dst is 68:05:ca:8d:ed:a8 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 tc is 3 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a8")/IPv6(src="CDCD:910A:2222:5498:8475:1111:3900:1518", dst="CDCD:910A:2222:5498:8475:1111:3900:2020",tc=3)/IPv6ExtHdrFragment()/("X"*480)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a3")/IPv6(src="CDCD:910A:2222:5498:8475:1111:3900:1518", dst="CDCD:910A:2222:5498:8475:1111:3900:2020",tc=3)/IPv6ExtHdrFragment()/("X"*480)',
+                               'Ether(dst="68:05:ca:8d:ed:a8")/IPv6(src="CDCD:910A:2222:5498:8475:1111:3900:1518", dst="CDCD:910A:2222:5498:8475:1111:3900:2023",tc=3)/IPv6ExtHdrFragment()/("X"*480)',
+                               'Ether(dst="68:05:ca:8d:ed:a8")/IPv6(src="CDCD:910A:2222:5498:8475:1111:3900:1518", dst="CDCD:910A:2222:5498:8475:1111:3900:2020",tc=4)/IPv6ExtHdrFragment()/("X"*480)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv6_pay_srcip_dstip = {
+    "name":"tv_mac_ipv6_pay_srcip_dstip",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv6 src is CDCD:910A:2222:5498:8475:1111:3900:1536 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="00:11:22:33:44:55")/IPv6(src="CDCD:910A:2222:5498:8475:1111:3900:1536", dst="CDCD:910A:2222:5498:8475:1111:3900:2020")/("X"*480)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="00:11:22:33:44:55")/IPv6(src="CDCD:910A:2222:5498:8475:1111:3900:1537", dst="CDCD:910A:2222:5498:8475:1111:3900:2020")/("X"*480)',
+                               'Ether(dst="00:11:22:33:44:55")/IPv6(src="CDCD:910A:2222:5498:8475:1111:3900:1536", dst="CDCD:910A:2222:5498:8475:1111:3900:2023")/("X"*480)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv6_pay_dstip_tc = {
+    "name":"tv_mac_ipv6_pay_dstip_tc",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth dst is 68:05:ca:8d:ed:a8 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 tc is 3 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a8")/IPv6(src="CDCD:910A:2222:5498:8475:1111:3900:1518", dst="CDCD:910A:2222:5498:8475:1111:3900:2020",tc=3)/("X"*480)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a3")/IPv6(src="CDCD:910A:2222:5498:8475:1111:3900:1518", dst="CDCD:910A:2222:5498:8475:1111:3900:2020",tc=3)/("X"*480)',
+                               'Ether(dst="68:05:ca:8d:ed:a8")/IPv6(src="CDCD:910A:2222:5498:8475:1111:3900:1518", dst="CDCD:910A:2222:5498:8475:1111:3900:2023",tc=3)/("X"*480)',
+                               'Ether(dst="68:05:ca:8d:ed:a8")/IPv6(src="CDCD:910A:2222:5498:8475:1111:3900:1518", dst="CDCD:910A:2222:5498:8475:1111:3900:2020",tc=4)/("X"*480)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv6_udp_pay = {
+    "name":"tv_mac_ipv6_udp_pay",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth dst is 68:05:ca:8d:ed:a8 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 tc is 3 / udp src is 25 dst is 23 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a8")/IPv6(src="CDCD:910A:2222:5498:8475:1111:3900:1518", dst="CDCD:910A:2222:5498:8475:1111:3900:2020",tc=3)/UDP(sport=25,dport=23)/("X"*480)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a8")/IPv6(src="CDCD:910A:2222:5498:8475:1111:3900:1518", dst="CDCD:910A:2222:5498:8475:1111:3900:2020",tc=3)/UDP(sport=30,dport=23)/("X"*480)',
+                               'Ether(dst="68:05:ca:8d:ed:a8")/IPv6(src="CDCD:910A:2222:5498:8475:1111:3900:1518", dst="CDCD:910A:2222:5498:8475:1111:3900:2020",tc=3)/UDP(sport=25,dport=19)/("X"*480)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv6_tcp = {
+    "name":"tv_mac_ipv6_tcp",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth dst is 68:05:ca:8d:ed:a8 / ipv6 dst is CDCD:910A:2222:5498:8475:1111:3900:2020 tc is 3 / tcp src is 25 dst is 23 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a8")/IPv6(src="CDCD:910A:2222:5498:8475:1111:3900:1518", dst="CDCD:910A:2222:5498:8475:1111:3900:2020",tc=3)/TCP(sport=25,dport=23)/("X"*480)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a8")/IPv6(src="CDCD:910A:2222:5498:8475:1111:3900:1518", dst="CDCD:910A:2222:5498:8475:1111:3900:2020",tc=3)/TCP(sport=30,dport=23)/("X"*480)',
+                               'Ether(dst="68:05:ca:8d:ed:a8")/IPv6(src="CDCD:910A:2222:5498:8475:1111:3900:1518", dst="CDCD:910A:2222:5498:8475:1111:3900:2020",tc=3)/TCP(sport=25,dport=19)/("X"*480)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv4_nvgre_ipv4_frag = {
+    "name":"tv_mac_ipv4_nvgre_ipv4_frag",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.1 / nvgre tni is 2 / eth / ipv4 src is 192.168.1.2 dst is 192.168.1.3 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether()/IP(src="192.168.1.2", dst="192.168.1.3" ,frag=5)/TCP()/Raw("x"*80)',
+                            'Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether()/IP(src="192.168.1.2", dst="192.168.1.3" ,frag=5)/Raw("x"*80)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":2}},
+    "mismatched":{"scapy_str":['Ether()/IP(dst="192.168.0.2")/NVGRE(TNI=2)/Ether()/IP(src="192.168.1.2", dst="192.168.1.3" ,frag=5)/TCP()/Raw("x"*80)',
+                               'Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=3)/Ether()/IP(src="192.168.1.2", dst="192.168.1.3" ,frag=5)/TCP()/Raw("x"*80)',
+                               'Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether()/IP(src="192.168.1.4", dst="192.168.1.3" ,frag=5)/TCP()/Raw("x"*80)',
+                               'Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether()/IP(src="192.168.1.2", dst="192.168.1.5" ,frag=5)/TCP()/Raw("x"*80)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv4_nvgre_ipv4_pay = {
+    "name":"tv_mac_ipv4_nvgre_ipv4_pay",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.1 / nvgre tni is 2 / eth / ipv4 src is 192.168.1.2 dst is 192.168.1.3 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether()/IP(src="192.168.1.2", dst="192.168.1.3")/TCP()/Raw("x"*80)',
+                            'Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether()/IP(src="192.168.1.2", dst="192.168.1.3")/Raw("x"*80)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":2}},
+    "mismatched":{"scapy_str":['Ether()/IP(dst="192.168.0.2")/NVGRE(TNI=2)/Ether()/IP(src="192.168.1.2", dst="192.168.1.3")/Raw("x"*80)',
+                               'Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=3)/Ether()/IP(src="192.168.1.2", dst="192.168.1.3")/Raw("x"*80)',
+                               'Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether()/IP(src="192.168.1.4", dst="192.168.1.3")/Raw("x"*80)',
+                               'Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether()/IP(src="192.168.1.2", dst="192.168.1.5")/Raw("x"*80)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv4_nvgre_ipv4_udp_pay = {
+    "name":"tv_mac_ipv4_nvgre_ipv4_udp_pay",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.1 / nvgre tni is 0x8 / eth / ipv4 src is 192.168.0.2 dst is 192.168.0.3 / udp src is 50 dst is 23 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=0x8)/Ether()/IP(src="192.168.0.2", dst="192.168.0.3")/UDP(sport=50,dport=23)/Raw("x"*80)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=0x8)/Ether()/IP(src="192.168.0.2", dst="192.168.0.3")/UDP(sport=20,dport=23)/Raw("x"*80)',
+                               'Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=0x8)/Ether()/IP(src="192.168.0.2", dst="192.168.0.3")/UDP(sport=50,dport=19)/Raw("x"*80)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv4_nvgre_ipv4_tcp = {
+    "name":"tv_mac_ipv4_nvgre_ipv4_tcp",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.1 / nvgre tni is 2 / eth / ipv4 src is 192.168.1.2 dst is 192.168.1.3 / tcp src is 25 dst is 23 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether()/IP(src="192.168.1.2", dst="192.168.1.3")/TCP(sport=25,dport=23)/Raw("x"*80)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether()/IP(src="192.168.1.2", dst="192.168.1.3")/TCP(sport=20,dport=23)/Raw("x"*80)',
+                               'Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether()/IP(src="192.168.1.2", dst="192.168.1.3")/TCP(sport=25,dport=39)/Raw("x"*80)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv4_nvgre_mac_ipv4_frag = {
+    "name":"tv_mac_ipv4_nvgre_mac_ipv4_frag",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.1 / nvgre tni is 2 / eth dst is 68:05:ca:8d:ed:a8 / ipv4 src is 192.168.1.2 dst is 192.168.1.3 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.1.2", dst="192.168.1.3" ,frag=5)/TCP()/Raw("x"*80)',
+                            'Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.1.2", dst="192.168.1.3" ,frag=5)/Raw("x"*80)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":2}},
+    "mismatched":{"scapy_str":['Ether()/IP(dst="192.168.0.2")/NVGRE(TNI=2)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.1.2", dst="192.168.1.3" ,frag=5)/TCP()/Raw("x"*80)',
+                               'Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=3)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.1.2", dst="192.168.1.3" ,frag=5)/TCP()/Raw("x"*80)',
+                               'Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether(dst="68:05:ca:8d:ed:a9")/IP(src="192.168.1.2", dst="192.168.1.3" ,frag=5)/TCP()/Raw("x"*80)',
+                               'Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.1.4", dst="192.168.1.3" ,frag=5)/TCP()/Raw("x"*80)',
+                               'Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.1.2", dst="192.168.1.5" ,frag=5)/TCP()/Raw("x"*80)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv4_nvgre_mac_ipv4_pay = {
+    "name":"tv_mac_ipv4_nvgre_mac_ipv4_pay",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.1 / nvgre tni is 2 / eth dst is 68:05:ca:8d:ed:a8  / ipv4 src is 192.168.1.2 dst is 192.168.1.3 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.1.2", dst="192.168.1.3")/TCP()/Raw("x"*80)',
+                            'Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.1.2", dst="192.168.1.3")/Raw("x"*80)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":2}},
+    "mismatched":{"scapy_str":['Ether()/IP(dst="192.168.0.2")/NVGRE(TNI=2)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.1.2", dst="192.168.1.3")/Raw("x"*80)',
+                               'Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=3)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.1.2", dst="192.168.1.3")/Raw("x"*80)',
+                               'Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether(dst="68:05:ca:8d:ed:a9")/IP(src="192.168.1.2", dst="192.168.1.3")/Raw("x"*80)',
+                               'Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.1.4", dst="192.168.1.3")/Raw("x"*80)',
+                               'Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.1.2", dst="192.168.1.5")/Raw("x"*80)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv4_nvgre_mac_ipv4_udp_pay = {
+    "name":"tv_mac_ipv4_nvgre_mac_ipv4_udp_pay",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.1 / nvgre tni is 0x8 /  eth dst is 68:05:ca:8d:ed:a8  / ipv4 src is 192.168.1.2 dst is 192.168.1.3 / udp src is 25 dst is 23 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=0x8)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.1.2", dst="192.168.1.3")/UDP(sport=25,dport=23)/Raw("x"*80)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=0x8)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.1.2", dst="192.168.1.3")/UDP(sport=2,dport=23)/Raw("x"*80)',
+                               'Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=0x8)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.1.2", dst="192.168.1.3")/UDP(sport=25,dport=20)/Raw("x"*80)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv4_nvgre_mac_ipv4_tcp = {
+    "name":"tv_mac_ipv4_nvgre_mac_ipv4_tcp",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.1 / nvgre tni is 2 / eth dst is 68:05:ca:8d:ed:a8  / ipv4 src is 192.168.1.2 dst is 192.168.1.3 / tcp src is 25 dst is 23 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.1.2", dst="192.168.1.3")/TCP(sport=25,dport=23)/Raw("x"*80)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.1.2", dst="192.168.1.3")/TCP(sport=1,dport=23)/Raw("x"*80)',
+                               'Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.1.2", dst="192.168.1.3")/TCP(sport=25,dport=20)/Raw("x"*80)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_vlan_pppoe_ipv4_pay = {
+    "name":"tv_mac_vlan_pppoe_ipv4_pay",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / vlan tci is 1 / pppoes seid is 3 / pppoe_proto_id is 0x0021 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(vlan=1,type=0x8864)/PPPoE(sessionid=3)/PPP(proto=0x0021)/IP()/Raw("x" * 80)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="00:11:22:33:44:54",type=0x8100)/Dot1Q(vlan=1,type=0x8864)/PPPoE(sessionid=3)/PPP(proto=0x0021)/IP()/Raw("x" * 80)',
+                               'Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(vlan=2,type=0x8864)/PPPoE(sessionid=3)/PPP(proto=0x0021)/IP()/Raw("x" * 80)',
+                               'Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(vlan=1,type=0x8864)/PPPoE(sessionid=4)/PPP(proto=0x0021)/IP()/Raw("x" * 80)',
+                               'Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(vlan=1,type=0x8864)/PPPoE(sessionid=3)/PPP(proto=0x0057)/IPv6()/Raw("x" * 80)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_vlan_pppoe_ipv6_pay = {
+    "name":"tv_mac_vlan_pppoe_ipv6_pay",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / vlan tci is 1 / pppoes seid is 3 / pppoe_proto_id is 0x0057 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(vlan=1,type=0x8864)/PPPoE(sessionid=3)/PPP(proto=0x0057)/IPv6()/Raw("x" * 80)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="00:11:22:33:44:54",type=0x8100)/Dot1Q(vlan=1,type=0x8864)/PPPoE(sessionid=3)/PPP(proto=0x0057)/IPv6()/Raw("x" * 80)',
+                               'Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(vlan=2,type=0x8864)/PPPoE(sessionid=3)/PPP(proto=0x0057)/IPv6()/Raw("x" * 80)',
+                               'Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(vlan=1,type=0x8864)/PPPoE(sessionid=4)/PPP(proto=0x0057)/IPv6()/Raw("x" * 80)',
+                               'Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(vlan=1,type=0x8864)/PPPoE(sessionid=3)/PPP(proto=0x0021)/IP()/Raw("x" * 80)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_pppoe_ipv4_pay = {
+    "name":"tv_mac_pppoe_ipv4_pay",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / pppoes seid is 3 / pppoe_proto_id is 0x0021 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="00:11:22:33:44:55",type=0x8864)/PPPoE(sessionid=3)/PPP(proto=0x0021)/IP()/Raw("x" * 80)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="00:11:22:33:44:54",type=0x8864)/PPPoE(sessionid=3)/PPP(proto=0x0021)/IP()/Raw("x" * 80)',
+                               'Ether(dst="00:11:22:33:44:55",type=0x8864)/PPPoE(sessionid=4)/PPP(proto=0x0021)/IP()/Raw("x" * 80)',
+                               'Ether(dst="00:11:22:33:44:55",type=0x8864)/PPPoE(sessionid=3)/PPP(proto=0x0057)/IPv6()/Raw("x" * 80)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_pppoe_ipv6_pay = {
+    "name":"tv_mac_pppoe_ipv6_pay",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / pppoes seid is 3 / pppoe_proto_id is 0x0057 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="00:11:22:33:44:55",type=0x8864)/PPPoE(sessionid=3)/PPP(proto=0x0057)/IPv6()/Raw("x" * 80)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="00:11:22:33:44:54",type=0x8864)/PPPoE(sessionid=3)/PPP(proto=0x0057)/IPv6()/Raw("x" * 80)',
+                               'Ether(dst="00:11:22:33:44:55",type=0x8864)/PPPoE(sessionid=4)/PPP(proto=0x0057)/IPv6()/Raw("x" * 80)',
+                               'Ether(dst="00:11:22:33:44:55",type=0x8864)/PPPoE(sessionid=3)/PPP(proto=0x0021)/IP()/Raw("x" * 80)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_qinq = {
+    "name":"tv_qinq",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / vlan tci is 1 / vlan tci is 2 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(type=0x8100,vlan=1)/Dot1Q(type=0x0800,vlan=2)/IP(src="192.168.0.1",dst="192.168.0.2")/Raw("X"*480)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(type=0x8100,vlan=3)/Dot1Q(type=0x0800, vlan=2)/IP(src="192.168.0.1",dst="192.168.0.2")/Raw("X"*480)',
+                               'Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(type=0x8100,vlan=1)/Dot1Q(type=0x0800, vlan=5)/IP(src="192.168.0.1",dst="192.168.0.2")/Raw("X"*480)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_ip_multicast = {
+    "name":"tv_ip_multicast",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv4 dst spec 224.0.0.0 dst mask 240.0.0.0 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether()/IP(dst="239.0.0.0")/TCP()/Raw("x"*80)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether()/IP(dst="128.0.0.0")/TCP()/Raw("x"*80)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_l2_multicast = {
+    "name":"tv_l2_multicast",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth dst spec 01:00:5e:00:00:00 dst mask ff:ff:ff:80:00:00 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="01:00:5e:7f:00:00")/IP()/TCP()/Raw("x"*80)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="01:00:5e:ff:00:00")/IP()/TCP()/Raw("x"*80)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_ethertype_filter_pppod = {
+    "name":"tv_ethertype_filter_pppod",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth type is 0x8863 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="00:11:22:33:44:55")/PPPoED()/PPP()/IP()/Raw("x" *80)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="00:11:22:33:44:55")/PPPoE()/PPP()/IP()/Raw("x" *80)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_ethertype_filter_pppoe = {
+    "name":"tv_ethertype_filter_pppoe",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth type is 0x8864 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="00:11:22:33:44:55")/PPPoE()/PPP()/IP()/Raw("x"*80)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="00:11:22:33:44:55")/PPPoED()/PPP()/IP()/Raw("x"*80)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_ethertype_filter_ipv6 = {
+    "name":"tv_ethertype_filter_ipv6",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth type is 0x86dd / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", tc=3)/TCP(dport=23)/("X"*480)',
+                            'Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(vlan=1,type=0x86dd)/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", tc=3)/TCP(dport=23)/("X"*480)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":2}},
+    "mismatched":{"scapy_str":['Ether(dst="00:11:22:33:44:55")/IP()/TCP(dport=23)/("X"*480)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_udp_port_filter_dhcp_discovery = {
+    "name":"tv_udp_port_filter_dhcp_discovery",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv4 / udp src is 68 dst is 67 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="00:11:22:33:44:55")/IP()/UDP(sport=68,dport=67)/BOOTP(chaddr="3c:fd:fe:b2:43:90")/DHCP(options=[("message-type","discover"),"end"])/Raw("X"*480)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="00:11:22:33:44:55")/IP()/UDP(sport=63,dport=67)/BOOTP(chaddr="3c:fd:fe:b2:43:90")/DHCP(options=[("message-type","discover"),"end"])/Raw("X"*480)',
+                               'Ether(dst="00:11:22:33:44:55")/IP()/UDP(sport=68,dport=69)/BOOTP(chaddr="3c:fd:fe:b2:43:90")/DHCP(options=[("message-type","discover"),"end"])/Raw("X"*480)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_udp_port_filter_dhcp_offer = {
+    "name":"tv_udp_port_filter_dhcp_offer",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv4 / udp src is 67 dst is 68 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="00:11:22:33:44:55")/IP()/UDP(sport=67,dport=68)/BOOTP(chaddr="3c:fd:fe:b2:43:90",yiaddr="192.168.1.0")/DHCP(options=[("message-type","offer"),"end"])/Raw("X"*480)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="00:11:22:33:44:55")/IP()/UDP(sport=63,dport=68)/BOOTP(chaddr="3c:fd:fe:b2:43:90",yiaddr="192.168.1.0")/DHCP(options=[("message-type","offer"),"end"])/Raw("X"*480)',
+                               'Ether(dst="00:11:22:33:44:55")/IP()/UDP(sport=67,dport=63)/BOOTP(chaddr="3c:fd:fe:b2:43:90",yiaddr="192.168.1.0")/DHCP(options=[("message-type","offer"),"end"])/Raw("X"*480)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_udp_port_filter_vxlan = {
+    "name":"tv_udp_port_filter_vxlan",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv4 / udp dst is 4789 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether()/IP(dst="192.168.0.1")/UDP()/VXLAN(vni=2)/Ether()/IP(src="192.168.0.2", dst="192.168.0.3",frag=5)/TCP()/Raw("x"*80)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=2)/Ether()/IP(src="192.168.1.2", dst="192.168.1.3")/TCP()/Raw("x"*80)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_vlan_filter = {
+    "name":"tv_mac_vlan_filter",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / vlan tci is 1 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(vlan=1)/IP(src="192.168.0.1",dst="192.168.0.2",tos=4,ttl=2)/TCP()/Raw("X"*480)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="00:11:22:33:44:54",type=0x8100)/Dot1Q(vlan=1)/IP(src="192.168.0.1",dst="192.168.0.2",tos=4,ttl=2)/TCP()/Raw("X"*480)',
+                               'Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(vlan=2)/IP(src="192.168.0.1",dst="192.168.0.2",tos=4,ttl=2)/TCP()/Raw("X"*480)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_vlan_filter = {
+    "name":"tv_vlan_filter",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / vlan tci is 1 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(vlan=1)/IP(src="192.168.0.1",dst="192.168.0.2",tos=4,ttl=2)/TCP()/Raw("X"*480)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(vlan=2)/IP(src="192.168.0.1",dst="192.168.0.2",tos=4,ttl=2)/TCP()/Raw("X"*480)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_actions_vf_id_0 = {
+    "name":"tv_actions_vf_id_0",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth dst is 68:05:ca:8d:ed:a8 / ipv4 src is 192.168.0.1 dst is 192.168.0.2 tos is 4 ttl is 3 / tcp src is 25 dst is 23 / end actions vf id 0 / end",
+    "matched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.1",dst="192.168.0.2",tos=4,ttl=3)/TCP(sport=25,dport=23)/("X"*480)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":0, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":0}},
+    "mismatched":{}
+}
+
+
+tv_add_existing_rules_but_with_different_vfs = {
+    "name":"tv_add_existing_rules_but_with_different_vfs",
+    "rte_flow_pattern":["flow create 0 ingress pattern eth dst is 68:05:ca:8d:ed:a8 / ipv4 src is 192.168.0.1 dst is 192.168.0.2 tos is 4 ttl is 3 / udp src is 25 dst is 23 / end actions vf id 1 / end",
+                        "flow create 0 ingress pattern eth dst is 68:05:ca:8d:ed:a8 / ipv4 src is 192.168.0.1 dst is 192.168.0.2 tos is 4 ttl is 3 / udp src is 25 dst is 23 / end actions vf id 2 / end"],
+    "matched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.1",dst="192.168.0.2",tos=4,ttl=3)/UDP(sport=25,dport=23)/("X"*480)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":[1, 2], "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":[1, 1]}},
+    "mismatched":{}
+}
+
+tv_add_two_rules_with_one_rule_input_set_included_in_the_other = {
+    "name":"tv_add_two_rules_with_one_rule_input_set_included_in_the_other",
+    "rte_flow_pattern":["flow create 0 ingress pattern eth dst is 68:05:ca:8d:ed:a8 / ipv4 src is 192.168.0.1 / end actions vf id 1 / end",
+                        "flow create 0 ingress pattern eth dst is 68:05:ca:8d:ed:a8 / ipv4 src is 192.168.0.1 dst is 192.168.0.2 / end actions vf id 2 / end"],
+    "matched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.1",dst="192.168.0.2")/("X"*480)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":[1, 2], "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":[1, 1]}},
+    "mismatched":{}
+}
+
+tv_test_fwd_with_single_vf = {
+    "name":"tv_test_fwd_with_single_vf",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv4 src is 192.168.0.1 dst is 192.168.0.2 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.1",dst="192.168.0.2")/("X"*480)'],
+               "check_func":{"func":rfc.check_vf_rx_tx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{}
+}
+
+tv_test_fwd_with_multi_vfs = {
+    "name":"tv_test_fwd_with_multi_vfs",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv4 src is 192.168.0.1 dst is 192.168.0.2 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.1",dst="192.168.0.2")/("X"*480)'],
+               "check_func":{"func":rfc.check_vf_rx_tx_packets_number,
+                             "param":{"expect_port":[1, 2], "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":[1, 0]}},
+    "mismatched":{}
+}
+
+#max vfs case: rte_flow_pattern and matched packets will be generated by code.
+tv_max_vfs = {
+    "name":"tv_max_vfs",
+    "rte_flow_pattern":[],
+    "matched":{"scapy_str":[],
+               "check_func":{"func":rfc.check_kernel_vf_rx_packets_number,
+                             "param":{"expect_port":list(range(1, 64)), "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":[1]*63}},
+    "mismatched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.64")/TCP()/Raw("X"*480)'],
+                  "check_func":{"func":rfc.check_kernel_vf_rx_packets_number,
+                                "param":{"expect_port":list(range(1, 64)), "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":[1]*63}}
+}
+
+tv_max_field_vectors = {
+    "name":"tv_max_field_vectors",
+    "rte_flow_pattern":["flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.1 / nvgre tni is 0x8 / eth / ipv4 src is 192.168.0.2 dst is 192.168.0.3 / udp src is 50 dst is 23 / end actions vf id 1 / end",
+                        "flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.2 / nvgre tni is 0x8 / eth / ipv4 src is 192.168.0.2 dst is 192.168.0.3 / udp src is 50 / end actions vf id 1 / end",
+                        "flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.3 / nvgre tni is 0x8 / eth / ipv4 src is 192.168.0.2 dst is 192.168.0.3 / udp dst is 23 / end actions vf id 1 / end"],
+    "matched":{"scapy_str":['Ether()/IP(dst="192.168.0.1")/NVGRE(TNI=0x8)/Ether()/IP(src="192.168.0.2", dst="192.168.0.3")/UDP(sport=50,dport=23)/Raw("x"*80)',
+                            'Ether()/IP(dst="192.168.0.2")/NVGRE(TNI=0x8)/Ether()/IP(src="192.168.0.2", dst="192.168.0.3")/UDP(sport=50,dport=23)/Raw("x"*80)',
+                            'Ether()/IP(dst="192.168.0.3")/NVGRE(TNI=0x8)/Ether()/IP(src="192.168.0.2", dst="192.168.0.3")/UDP(sport=50,dport=23)/Raw("x"*80)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":3}},
+    "mismatched":{"scapy_str":['Ether()/IP(dst="192.168.0.5")/NVGRE(TNI=0x8)/Ether()/IP(src="192.168.0.2", dst="192.168.0.3")/UDP(sport=50,dport=23)/Raw("x"*80)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+#max rule number case: rte_flow_pattern and matched packets will be generated by code, and rte_flow_pattern will be writed to file.
+tv_max_rule_number = {
+    "name":"tv_max_rule_number",
+    "rte_flow_pattern":[],
+    "matched":{"scapy_str":[],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1}},
+               "expect_results":{"expect_pkts":32563}},
+    "mismatched":{"scapy_str":['Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.167.0.1")/TCP(sport=25,dport=23)/("X"*480)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv4_pfcp_node = {
+    "name":"tv_mac_ipv4_pfcp_node",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv4 / udp / pfcp s_field is 0 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="00:11:22:33:44:11")/IP()/UDP(dport=8805)/PFCP(Sfield=0)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="00:11:22:33:44:11")/IP()/UDP(dport=8805)/PFCP(Sfield=1)',
+                               'Ether(dst="00:11:22:33:44:11")/IPv6()/UDP(dport=8805)/PFCP(Sfield=0)',
+                               'Ether(dst="00:11:22:33:44:11")/IPv6()/UDP(dport=8805)/PFCP(Sfield=1)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv4_pfcp_session = {
+    "name":"tv_mac_ipv4_pfcp_session",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv4 / udp / pfcp s_field is 1 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="00:11:22:33:44:11")/IP()/UDP(dport=8805)/PFCP(Sfield=1)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="00:11:22:33:44:11")/IP()/UDP(dport=8805)/PFCP(Sfield=0)',
+                               'Ether(dst="00:11:22:33:44:11")/IPv6()/UDP(dport=8805)/PFCP(Sfield=0)',
+                               'Ether(dst="00:11:22:33:44:11")/IPv6()/UDP(dport=8805)/PFCP(Sfield=1)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv6_pfcp_node = {
+    "name":"tv_mac_ipv6_pfcp_node",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv6 / udp / pfcp s_field is 0 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="00:11:22:33:44:11")/IPv6()/UDP(dport=8805)/PFCP(Sfield=0)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="00:11:22:33:44:11")/IP()/UDP(dport=8805)/PFCP(Sfield=0)',
+                               'Ether(dst="00:11:22:33:44:11")/IP()/UDP(dport=8805)/PFCP(Sfield=1)',
+                               'Ether(dst="00:11:22:33:44:11")/IPv6()/UDP(dport=8805)/PFCP(Sfield=1)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_mac_ipv6_pfcp_session = {
+    "name":"tv_mac_ipv6_pfcp_session",
+    "rte_flow_pattern":"flow create 0 ingress pattern eth / ipv6 / udp / pfcp s_field is 1 / end actions vf id 1 / end",
+    "matched":{"scapy_str":['Ether(dst="00:11:22:33:44:11")/IPv6()/UDP(dport=8805)/PFCP(Sfield=1)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":1}},
+    "mismatched":{"scapy_str":['Ether(dst="00:11:22:33:44:11")/IP()/UDP(dport=8805)/PFCP(Sfield=0)',
+                               'Ether(dst="00:11:22:33:44:11")/IP()/UDP(dport=8805)/PFCP(Sfield=1)',
+                               'Ether(dst="00:11:22:33:44:11")/IPv6()/UDP(dport=8805)/PFCP(Sfield=0)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_add_two_rules_with_different_input_set_same_vf_id = {
+    "name":"tv_add_two_rules_with_different_input_set_same_vf_id",
+    "rte_flow_pattern":["flow create 0 ingress pattern eth / ipv4 / udp / pfcp s_field is 0 / end actions vf id 1 / end",
+                        "flow create 0 ingress pattern eth / ipv4 / udp / pfcp s_field is 1 / end actions vf id 1 / end"],
+    "matched":{"scapy_str":['Ether(dst="00:11:22:33:44:11")/IP()/UDP(dport=8805)/PFCP(Sfield=0)',
+                            'Ether(dst="00:11:22:33:44:11")/IP()/UDP(dport=8805)/PFCP(Sfield=1)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":1, "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":2}},
+    "mismatched":{"scapy_str":['Ether(dst="00:11:22:33:44:11")/IPv6()/UDP(dport=8805)/PFCP(Sfield=0)',
+                               'Ether(dst="00:11:22:33:44:11")/IPv6()/UDP(dport=8805)/PFCP(Sfield=1)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":1, "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":0}}
+}
+
+tv_add_two_rules_with_different_input_set_different_vf_id = {
+    "name":"tv_add_two_rules_with_different_input_set_different_vf_id",
+    "rte_flow_pattern":["flow create 0 ingress pattern eth / ipv4 / udp / pfcp s_field is 0 / end actions vf id 1 / end",
+                        "flow create 0 ingress pattern eth / ipv4 / udp / pfcp s_field is 1 / end actions vf id 2 / end"],
+    "matched":{"scapy_str":['Ether(dst="00:11:22:33:44:11")/IP()/UDP(dport=8805)/PFCP(Sfield=0)',
+                            'Ether(dst="00:11:22:33:44:11")/IP()/UDP(dport=8805)/PFCP(Sfield=1)'],
+               "check_func":{"func":rfc.check_vf_rx_packets_number,
+                             "param":{"expect_port":[1, 2], "expect_queues":"null"}},
+               "expect_results":{"expect_pkts":[1, 1]}},
+    "mismatched":{"scapy_str":['Ether(dst="00:11:22:33:44:11")/IPv6()/UDP(dport=8805)/PFCP(Sfield=0)',
+                               'Ether(dst="00:11:22:33:44:11")/IPv6()/UDP(dport=8805)/PFCP(Sfield=1)'],
+                  "check_func":{"func":rfc.check_vf_rx_packets_number,
+                                "param":{"expect_port":[1, 2], "expect_queues":"null"}},
+                  "expect_results":{"expect_pkts":[0, 0]}}
+}
+
+class SwitchFilterTest(TestCase):
+
+    def bind_nics_driver(self, ports, driver=""):
+        # modprobe vfio driver
+        if driver == "vfio-pci":
+            for port in ports:
+                netdev = self.dut.ports_info[port]['port']
+                driver = netdev.get_nic_driver()
+                if driver != 'vfio-pci':
+                    netdev.bind_driver(driver='vfio-pci')
+
+        elif driver == "igb_uio":
+            # igb_uio should insmod as default, no need to check
+            for port in ports:
+                netdev = self.dut.ports_info[port]['port']
+                driver = netdev.get_nic_driver()
+                if driver != 'igb_uio':
+                    netdev.bind_driver(driver='igb_uio')
+        else:
+            for port in ports:
+                netdev = self.dut.ports_info[port]['port']
+                driver_now = netdev.get_nic_driver()
+                if driver == "":
+                    driver = netdev.default_driver
+                if driver != driver_now:
+                    netdev.bind_driver(driver=driver)
+
+    def set_up_all(self):
+        """
+        Run at the start of each test suite.
+        """
+        self.verify(self.nic in ["columbiaville_25g","columbiaville_100g"], "nic is not CVL")
+        self.dut_ports = self.dut.get_ports(self.nic)
+        # Verify that enough ports are available
+        self.verify(len(self.dut_ports) >= 1, "Insufficient ports")
+        localPort = self.tester.get_local_port(self.dut_ports[0])
+        self.__tx_iface = self.tester.get_interface(localPort)
+        self.dut.send_expect("ifconfig %s up" % self.__tx_iface, "# ")
+        self.pkt = Packet()
+        self.testpmd_status = "close"
+        self.suite_config = rfc.get_suite_config(self)
+        self.pkg_file = "/lib/firmware/updates/intel/ice/ddp/ice.pkg"
+        #bind pf to kernel
+        self.bind_nics_driver(self.dut_ports, driver="ice")
+        #set vf driver
+        self.vf_driver = 'vfio-pci'
+        self.dut.send_expect('modprobe vfio-pci', '#')
+
+    def setup_1pf_vfs_env(self, pf_port=0, driver='default'):
+
+        self.used_dut_port_0 = self.dut_ports[pf_port]
+        #get PF interface name
+        self.pf0_intf = self.dut.ports_info[self.used_dut_port_0]['intf']
+        out = self.dut.send_expect('ethtool -i %s' % self.pf0_intf, '#')
+        #generate 4 VFs on PF
+        self.dut.generate_sriov_vfs_by_port(self.used_dut_port_0, 4, driver=driver)
+        self.sriov_vfs_port_0 = self.dut.ports_info[self.used_dut_port_0]['vfs_port']
+        #set VF0 as trust
+        self.dut.send_expect('ip link set %s vf 0 trust on' % self.pf0_intf, '#')
+        #bind VFs to dpdk driver
+        for port in self.sriov_vfs_port_0:
+            port.bind_driver(self.vf_driver)
+        time.sleep(5)
+
+    def re_load_ice_driver(self):
+        """
+        remove and reload the ice driver
+        """
+        if self.running_case == "test_unsupported_pattern_in_os_default_but_supported_in_comms":
+            #save comms pkg to /tmp
+            self.tmp_dir = "/tmp/ice.pkg"
+            self.dut.send_expect("cp %s %s" % (self.pkg_file, self.tmp_dir), "# ")
+            #use os default package to test the case
+            os_default_package_file_location = self.suite_config["os_default_package_file_location"]
+            self.dut.send_expect("cp %s %s" % (os_default_package_file_location, self.pkg_file), "# ")
+        ice_driver_file_location = self.suite_config["ice_driver_file_location"]
+        self.dut.send_expect("rmmod ice", "# ", 15)
+        self.dut.send_expect("insmod %s" % ice_driver_file_location, "# ", 60)
+        time.sleep(5)
+
+    def set_up(self):
+        """
+        Run before each test case.
+        """
+        self.re_load_ice_driver()
+
+    def create_testpmd_command(self):
+        """
+        Create testpmd command
+        """
+        #Prepare testpmd EAL and parameters
+        vf0_pci = self.sriov_vfs_port_0[0].pci
+        vf1_pci = self.sriov_vfs_port_0[1].pci
+        all_eal_param = self.dut.create_eal_parameters(cores='1S/4C/1T',ports=[vf0_pci, vf1_pci], port_options={vf0_pci:"cap=dcf"})
+        command = "./%s/app/testpmd %s -- -i" % (self.dut.target, all_eal_param)
+        return command
+
+    def launch_testpmd(self):
+        """
+        launch testpmd with the command
+        """
+        command = self.create_testpmd_command()
+        out = self.dut.send_expect(command, "testpmd> ", 15)
+        self.testpmd_status = "running"
+        self.dut.send_expect("set portlist 1", "testpmd> ", 15)
+        self.dut.send_expect("set fwd rxonly", "testpmd> ", 15)
+        self.dut.send_expect("set verbose 1", "testpmd> ", 15)
+
+    def send_packets(self, dic, session_name="", tx_iface=""):
+        """
+        send packets.
+        """
+        if session_name == "":
+            session_name = self.dut
+        if tx_iface == "":
+            tx_iface = self.__tx_iface
+        session_name.send_expect("start", "testpmd> ", 15)
+        time.sleep(2)
+        #send packets
+        self.pkt.update_pkt(dic["scapy_str"])
+        self.pkt.send_pkt(self.tester, tx_port=tx_iface, count=1, timeout=370)
+        time.sleep(3)
+        out = session_name.send_expect("stop", "testpmd> ")
+        return out
+
+    def send_and_check_packets(self, dic, session_name="", tx_iface=""):
+        """
+        general packets processing workflow.
+        """
+        if session_name == "":
+            session_name = self.dut
+        if tx_iface == "":
+            tx_iface = self.__tx_iface
+        session_name.send_expect("start", "testpmd> ", 15)
+        time.sleep(2)
+        #send packets
+        self.pkt.update_pkt(dic["scapy_str"])
+        self.pkt.send_pkt(self.tester, tx_port=tx_iface, count=1, timeout=370)
+        time.sleep(3)
+        out = session_name.send_expect("stop", "testpmd> ", 15)
+        dic["check_func"]["func"](out, dic["check_func"]["param"], dic["expect_results"])
+
+    def send_and_get_packets_bg(self, dic, session_name="", tx_iface=""):
+        """
+        general packets processing workflow.
+        """
+        if session_name == "":
+            session_name = self.dut
+        if tx_iface == "":
+            tx_iface = self.__tx_iface
+        session_name.send_expect("start", "testpmd> ", 15)
+        time.sleep(2)
+        #send packets
+        pkt = Packet()
+        pkt.update_pkt(dic["scapy_str"])
+        pkt.send_pkt_bg(self.tester, tx_port=tx_iface, count=1, loop=0, timeout=370)
+        time.sleep(3)
+        out = session_name.send_expect("stop", "testpmd> ", 15)
+        results = dic["check_func"]["func"](out, dic["check_func"]["param"], dic["expect_results"], False)
+        return results
+
+    def create_switch_filter_rule(self, rte_flow_pattern, session_name="", need_verify=True):
+        """
+        create switch filter rules
+        """
+        if session_name == "":
+            session_name = self.dut
+        p = re.compile(r"Flow rule #(\d+) created")
+        rule_list = []
+        if isinstance(rte_flow_pattern, list):
+            for rule in rte_flow_pattern:
+                out = session_name.send_expect(rule, "testpmd> ")  #create a rule
+                m = p.search(out)
+                if m:
+                    rule_list.append(m.group(1))
+                else:
+                    rule_list.append(False)
+        else:
+            out = session_name.send_expect(rte_flow_pattern, "testpmd> ")  #create a rule
+            m = p.search(out)
+            if m:
+                rule_list.append(m.group(1))
+            else:
+                rule_list.append(False)
+        if need_verify:
+            self.verify(all(rule_list), "some rules not created successfully, result %s, rule %s" % (rule_list, rte_flow_pattern))
+        return rule_list
+
+    def check_switch_filter_rule_list(self, port_id, rule_list, session_name="", need_verify=True):
+        """
+        check the rules in list identical to ones in rule_list
+        """
+        if session_name == "":
+            session_name = self.dut
+        out = session_name.send_expect("flow list %d" % port_id, "testpmd> ", 15)
+        p = re.compile(r"ID\s+Group\s+Prio\s+Attr\s+Rule")
+        m = p.search(out)
+        if not m:
+            result = []
+        else:
+            p_spec = re.compile("^(\d+)\s")
+            out_lines = out.splitlines()
+            res = filter(bool, map(p_spec.match, out_lines))
+            result = [i.group(1) for i in res]
+        if need_verify:
+            self.verify(sorted(result) == sorted(rule_list),
+                    "the rule list is not the same. expect %s, result %s" % (rule_list, result))
+        else:
+            return sorted(result)
+
+    def destroy_switch_filter_rule(self, port_id, rule_list, session_name="", need_verify=True):
+        if session_name == "":
+            session_name = self.dut
+        p = re.compile(r"Flow rule #(\d+) destroyed")
+        destroy_list = []
+        if isinstance(rule_list, list):
+            for i in rule_list:
+                out = session_name.send_expect("flow destroy %s rule %s" % (port_id, i), "testpmd> ", 15)
+                m = p.search(out)
+                if m:
+                    destroy_list.append(m.group(1))
+                else:
+                    destroy_list.append(False)
+        else:
+            out = session_name.send_expect("flow destroy %s rule %s" % (port_id, rule_list), "testpmd> ", 15)
+            m = p.search(out)
+            if m:
+                destroy_list.append(m.group(1))
+            else:
+                destroy_list.append(False)
+            rule_list = [rule_list]
+        if need_verify:
+            self.verify(destroy_list == rule_list, "flow rule destroy failed, expect %s result %s" % (rule_list, destroy_list))
+        else:
+            return destroy_list
+
+    def get_kernel_vf_log(self, vf_intfs, session_name):
+        """
+        get the log of each kernel vf in list vf_intfs
+        """
+        out_vfs = []
+        for intf in vf_intfs:
+            out = session_name.send_expect('ifconfig %s' % intf, '#')
+            out_vfs.append(out)
+        return out_vfs
+
+    def _rte_flow_validate_pattern(self, test_vector, launch_testpmd=True):
+
+        if launch_testpmd:
+            #launch testpmd
+            self.launch_testpmd()
+        #create a rule
+        rule_list = self.create_switch_filter_rule(test_vector["rte_flow_pattern"])   #create a rule
+        self.check_switch_filter_rule_list(0, rule_list)
+        #send matched packets and check
+        matched_dic = test_vector["matched"]
+        self.send_and_check_packets(matched_dic)
+        #send mismatched packets and check
+        mismatched_dic = test_vector["mismatched"]
+        self.send_and_check_packets(mismatched_dic)
+        #destroy rule and send matched packets
+        self.destroy_switch_filter_rule(0, rule_list)
+        self.check_switch_filter_rule_list(0, [])
+        #send matched packets and check
+        destroy_dict = copy.deepcopy(matched_dic)
+        if isinstance(destroy_dict["expect_results"]["expect_pkts"], list):
+            destroy_dict["expect_results"]["expect_pkts"] = [0]*len(destroy_dict["expect_results"]["expect_pkts"])
+        else:
+            destroy_dict["expect_results"]["expect_pkts"] = 0
+        self.send_and_check_packets(destroy_dict)
+
+    def test_mac_pay(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_pay)
+
+    def test_mac_ipv4_frag(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv4_frag)
+
+    def test_mac_ipv4_pay(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv4_pay)
+
+    def test_mac_ipv4_udp_pay(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv4_udp_pay)
+
+    def test_mac_ipv4_tcp_pay(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv4_tcp_pay)
+
+    def test_mac_ipv4_igmp(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv4_igmp)
+
+    def test_mac_ipv6_frag_srcip_dstip(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv6_frag_srcip_dstip)
+
+    def test_mac_ipv6_frag_dstip_tc(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv6_frag_dstip_tc)
+
+    def test_mac_ipv6_pay_srcip_dstip(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv6_pay_srcip_dstip)
+
+    def test_mac_ipv6_pay_dstip_tc(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv6_pay_dstip_tc)
+
+    def test_mac_ipv6_udp_pay(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv6_udp_pay)
+
+    def test_mac_ipv6_tcp(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv6_tcp)
+
+    def test_mac_ipv4_nvgre_ipv4_frag(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv4_nvgre_ipv4_frag)
+
+    def test_mac_ipv4_nvgre_ipv4_pay(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv4_nvgre_ipv4_pay)
+
+    def test_mac_ipv4_nvgre_ipv4_udp_pay(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv4_nvgre_ipv4_udp_pay)
+
+    def test_mac_ipv4_nvgre_ipv4_tcp(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv4_nvgre_ipv4_tcp)
+
+    def test_mac_ipv4_nvgre_mac_ipv4_frag(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv4_nvgre_mac_ipv4_frag)
+
+    def test_mac_ipv4_nvgre_mac_ipv4_pay(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv4_nvgre_mac_ipv4_pay)
+
+    def test_mac_ipv4_nvgre_mac_ipv4_udp_pay(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv4_nvgre_mac_ipv4_udp_pay)
+
+    def test_mac_ipv4_nvgre_mac_ipv4_tcp(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv4_nvgre_mac_ipv4_tcp)
+
+    def test_mac_vlan_pppoe_ipv4_pay(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_vlan_pppoe_ipv4_pay)
+
+    def test_mac_vlan_pppoe_ipv6_pay(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_vlan_pppoe_ipv6_pay)
+
+    def test_mac_pppoe_ipv4_pay(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_pppoe_ipv4_pay)
+
+    def test_mac_pppoe_ipv6_pay(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_pppoe_ipv6_pay)
+
+    def _test_qinq(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_qinq)
+
+    def test_ip_multicast(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_ip_multicast)
+
+    def test_l2_multicast(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_l2_multicast)
+
+    def test_ethertype_filter_pppod(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_ethertype_filter_pppod)
+
+    def test_ethertype_filter_pppoe(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_ethertype_filter_pppoe)
+
+    def test_ethertype_filter_ipv6(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_ethertype_filter_ipv6)
+
+    def test_udp_port_filter_dhcp_discovery(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_udp_port_filter_dhcp_discovery)
+
+    def test_udp_port_filter_dhcp_offer(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_udp_port_filter_dhcp_offer)
+
+    def test_udp_port_filter_vxlan(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_udp_port_filter_vxlan)
+
+    def test_mac_vlan_filter(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_vlan_filter)
+
+    def test_vlan_filter(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_vlan_filter)
+
+    def test_actions_vf_id_0(self):
+        #set up 4 vfs on 1 pf environment
+        self.setup_1pf_vfs_env()
+        #launch testpmd
+        command = self.create_testpmd_command()
+        out = self.dut.send_expect(command, "testpmd> ", 15)
+        self.testpmd_status = "running"
+        self.dut.send_expect("set fwd rxonly", "testpmd> ", 15)
+        self.dut.send_expect("set verbose 1", "testpmd> ", 15)
+        #create a rule
+        rule_list = self.create_switch_filter_rule(tv_actions_vf_id_0["rte_flow_pattern"])   #create a rule
+        self.check_switch_filter_rule_list(0, rule_list)
+        #send matched packets and check
+        matched_dic = tv_actions_vf_id_0["matched"]
+        self.send_and_check_packets(matched_dic)
+
+    def test_cannot_create_rule_on_vf_1(self):
+        #set up 4 vfs on 1 pf environment
+        self.setup_1pf_vfs_env()
+        #launch testpmd
+        self.launch_testpmd()
+        #create a rule on vf 1
+        rule = "flow create 1 ingress pattern eth dst is 68:05:ca:8d:ed:a8 / ipv4 src is 192.168.0.1 dst is 192.168.0.2 tos is 4 ttl is 3 / udp src is 25 dst is 23 / end actions vf id 1 / end"
+        out = self.dut.send_expect(rule, "testpmd> ", timeout=2)  #create a rule
+        self.verify("Failed to create flow" in out, "Log not provide a friendly output to indicate that the rule failed to create.")
+        #check the rule list
+        self.check_switch_filter_rule_list(1, [])
+
+    def test_unsupported_pattern_in_comms(self):
+        #set up 4 vfs on 1 pf environment
+        self.setup_1pf_vfs_env()
+        #launch testpmd
+        self.launch_testpmd()
+        #create an SCTP rule which is not supported in comms
+        rule = "flow create 0 ingress pattern eth / ipv4 src is 192.168.0.2 dst is 192.168.0.3  / sctp src is 25 dst is 23 / end actions vf id 1 / end"
+        out = self.dut.send_expect(rule, "testpmd> ", timeout=2)  #create a rule
+        self.verify("Failed to create flow" in out and "Invalid input pattern" in out, "Log not provide a friendly output to indicate that the SCTP rule failed to create.")
+        #check the rule list
+        self.check_switch_filter_rule_list(0, [])
+
+    def test_unsupported_pattern_in_os_default_but_supported_in_comms(self):
+        """
+        test with os default package
+        """
+        #set up 4 vfs on 1 pf environment
+        self.setup_1pf_vfs_env()
+        #launch testpmd
+        self.launch_testpmd()
+        #create a PPPOE rule which is not supported in os default
+        rule = "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / pppoes seid is 3 / pppoe_proto_id is 0x0021 / end actions vf id 1 / end"
+        out = self.dut.send_expect(rule, "testpmd> ", timeout=2)  #create a rule
+        self.verify("Failed to create flow" in out and "Invalid input pattern" in out, "Log not provide a friendly output to indicate that the PPPOE rule failed to create.")
+        #check the rule list
+        self.check_switch_filter_rule_list(0, [])
+        #create a MAC_IPV4_PFCP_NODE rule
+        rule = "flow create 0 ingress pattern eth / ipv4 / udp / pfcp s_field is 0 / end actions vf id 1 / end"
+        out = self.dut.send_expect(rule, "testpmd> ", timeout=2)  #create a rule
+        self.verify("Failed to create flow" in out and "Invalid input pattern" in out, "Log not provide a friendly output to indicate that the mac_ipv4_pfcp_node rule failed to create.")
+        #check the rule list
+        self.check_switch_filter_rule_list(0, [])
+
+    def test_unsupported_input_set(self):
+        #set up 4 vfs on 1 pf environment
+        self.setup_1pf_vfs_env()
+        #launch testpmd
+        self.launch_testpmd()
+        #create a rule with input set [inner tos]
+        rule = "flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.1 / nvgre tni is 2 / eth dst is 68:05:ca:8d:ed:a8 / ipv4 src is 192.168.1.2 dst is 192.168.1.3 tos is 4 / end actions vf id 1 / end"
+        out = self.dut.send_expect(rule, "testpmd> ", timeout=2)  #create a rule
+        self.verify("Failed to create flow" in out and "Invalid input set" in out, "Log not provide a friendly output to indicate that the input set is not supported.")
+        #check the rule list
+        self.check_switch_filter_rule_list(0, [])
+
+    def test_invalid_vf_id(self):
+        #set up 4 vfs on 1 pf environment
+        self.setup_1pf_vfs_env()
+        #launch testpmd
+        self.launch_testpmd()
+        #create a rule with invalid vf id 5
+        rule = "flow create 0 ingress pattern eth dst is 68:05:ca:8d:ed:a8 / ipv4 src is 192.168.0.1 dst is 192.168.0.2 tos is 4 ttl is 3 / tcp src is 25 dst is 23 / end actions vf id 5 / end"
+        out = self.dut.send_expect(rule, "testpmd> ", timeout=2)
+        self.verify("Failed to create flow" in out, "Log not provide a friendly output to indicate that the rule failed to create.")
+        #check the rule list
+        self.check_switch_filter_rule_list(0, [])
+
+    def test_delete_non_existing_rule(self):
+        #set up 4 vfs on 1 pf environment
+        self.setup_1pf_vfs_env()
+        #launch testpmd
+        self.launch_testpmd()
+        #check no rule in the list
+        self.check_switch_filter_rule_list(0, [])
+        #destroy rule 0
+        out = self.dut.send_expect("flow destroy 0 rule 0", "testpmd> ", timeout=15)
+        self.verify("Fail" not in out, "Destroy failed.")
+        #flush rules
+        out = self.dut.send_expect("flow flush 0", "testpmd> ", timeout=15)
+        self.verify("Fail" not in out, "Destroy failed.")
+
+    def _test_add_existing_rules_but_with_different_vfs(self):
+        #set up 4 vfs on 1 pf environment
+        self.setup_1pf_vfs_env()
+        #launch testpmd
+        vf0_pci = self.sriov_vfs_port_0[0].pci
+        vf1_pci = self.sriov_vfs_port_0[1].pci
+        vf2_pci = self.sriov_vfs_port_0[2].pci
+        all_eal_param = self.dut.create_eal_parameters(cores="1S/4C/1T", ports=[vf0_pci, vf1_pci, vf2_pci], port_options={vf0_pci:"cap=dcf"})
+        command = "./%s/app/testpmd %s -- -i" % (self.dut.target, all_eal_param)
+        out = self.dut.send_expect(command, "testpmd> ", 15)
+        self.testpmd_status = "running"
+        self.dut.send_expect("set portlist 1,2", "testpmd> ", 15)
+        self.dut.send_expect("set fwd rxonly", "testpmd> ", 15)
+        self.dut.send_expect("set verbose 1", "testpmd> ", 15)
+        #create rules with same pattern but to different vfs
+        rule_list = self.create_switch_filter_rule(tv_add_existing_rules_but_with_different_vfs["rte_flow_pattern"])
+        self.check_switch_filter_rule_list(0, rule_list)
+        #send matched packets and check
+        matched_dic = tv_add_existing_rules_but_with_different_vfs["matched"]
+        self.send_and_check_packets(matched_dic)
+        #destroy rule 0 and send matched packets
+        self.destroy_switch_filter_rule(0, rule_list[0])
+        rule_list.pop(0)
+        #check only rule 1 exists in the list
+        self.check_switch_filter_rule_list(0, rule_list)
+        #send matched packets and check
+        destroy_dict = copy.deepcopy(matched_dic)
+        destroy_dict["expect_results"]["expect_pkts"][0] = 0
+        self.send_and_check_packets(destroy_dict)
+        #destroy rule 1 and send matched packets
+        self.destroy_switch_filter_rule(0, rule_list[0])
+        rule_list.pop(0)
+        #check no rule exists in the list
+        self.check_switch_filter_rule_list(0, rule_list)
+        #send matched packets and check
+        destroy_dict["expect_results"]["expect_pkts"][1] = 0
+        self.send_and_check_packets(destroy_dict)
+
+    def test_add_existing_rules_with_the_same_vfs(self):
+        #set up 4 vfs on 1 pf environment
+        self.setup_1pf_vfs_env()
+        #launch testpmd
+        self.launch_testpmd()
+        #create a rule
+        rule = "flow create 0 ingress pattern eth dst is 68:05:ca:8d:ed:a8 / ipv4 src is 192.168.0.1 dst is 192.168.0.2 tos is 4 ttl is 3 / udp src is 25 dst is 23 / end actions vf id 1 / end"
+        rule_list = self.create_switch_filter_rule(rule)   #create a rule
+        self.check_switch_filter_rule_list(0, rule_list)
+        #create the same rule
+        out = self.dut.send_expect(rule, "testpmd> ", timeout=2)  #create a rule
+        self.verify("Failed to create flow" in out, "Log not provide a friendly output to indicate that the rule is failed to create.")
+        self.check_switch_filter_rule_list(0, rule_list)
+
+    def test_add_two_rules_with_one_rule_input_set_included_in_the_other(self):
+        #set up 4 vfs on 1 pf environment
+        self.setup_1pf_vfs_env()
+        #launch testpmd
+        vf0_pci = self.sriov_vfs_port_0[0].pci
+        vf1_pci = self.sriov_vfs_port_0[1].pci
+        vf2_pci = self.sriov_vfs_port_0[2].pci
+        all_eal_param = self.dut.create_eal_parameters(cores="1S/4C/1T", ports=[vf0_pci, vf1_pci, vf2_pci], port_options={vf0_pci:"cap=dcf"})
+        command = "./%s/app/testpmd %s -- -i" % (self.dut.target, all_eal_param)
+        out = self.dut.send_expect(command, "testpmd> ", 15)
+        self.testpmd_status = "running"
+        self.dut.send_expect("set portlist 1,2", "testpmd> ", 15)
+        self.dut.send_expect("set fwd rxonly", "testpmd> ", 15)
+        self.dut.send_expect("set verbose 1", "testpmd> ", 15)
+        #create rules with one rule's input set included in the other
+        rule_list = self.create_switch_filter_rule(tv_add_two_rules_with_one_rule_input_set_included_in_the_other["rte_flow_pattern"])
+        self.check_switch_filter_rule_list(0, rule_list)
+        #send matched packets and check
+        matched_dic = tv_add_two_rules_with_one_rule_input_set_included_in_the_other["matched"]
+        self.send_and_check_packets(matched_dic)
+        #send packet that only matches rule 0 but not rule 1
+        matched_dic_1 = copy.deepcopy(matched_dic)
+        matched_dic_1["scapy_str"].clear()
+        matched_dic_1["scapy_str"].append('Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.1",dst="192.168.0.3")/("X"*480)')
+        matched_dic_1["expect_results"]["expect_pkts"][1] = 0
+        self.send_and_check_packets(matched_dic_1)
+        #destroy rule 0 and send matched packets
+        self.destroy_switch_filter_rule(0, rule_list[0])
+        rule_list.pop(0)
+        #check only rule 1 exists in the list
+        self.check_switch_filter_rule_list(0, rule_list)
+        #send matched packets and check
+        destroy_dict = copy.deepcopy(matched_dic)
+        destroy_dict["expect_results"]["expect_pkts"][0] = 0
+        self.send_and_check_packets(destroy_dict)
+        #destroy rule 1 and send matched packets
+        self.destroy_switch_filter_rule(0, rule_list[0])
+        rule_list.pop(0)
+        #check no rule exists in the list
+        self.check_switch_filter_rule_list(0, rule_list)
+        #send matched packets and check
+        destroy_dict["expect_results"]["expect_pkts"][1] = 0
+        self.send_and_check_packets(destroy_dict)
+
+    def test_add_long_switch_rule(self):
+        #set up 4 vfs on 1 pf environment
+        self.setup_1pf_vfs_env()
+        #launch testpmd
+        self.launch_testpmd()
+        rule = "flow create 0 ingress pattern eth / ipv6 src is CDCD:910A:2222:5498:8475:1111:3900:1536 dst is CDCD:910A:2222:5498:8475:1111:3900:2022 tc is 3 / end actions vf id 1 / end"
+        out = self.dut.send_expect(rule, "testpmd> ", timeout=15)
+        self.verify("Failed to create flow" in out, "Log not provide a friendly output to indicate that the rule failed to create.")
+        #check the rule list
+        self.check_switch_filter_rule_list(0, [])
+        #create MAC_IPV6_UDP_PAY rule, and check the rule will not be affected by the long rule failure
+        self._rte_flow_validate_pattern(tv_mac_ipv6_udp_pay, launch_testpmd=False)
+
+    def test_fwd_with_single_vf(self):
+        #set up 4 vfs on 1 pf environment
+        self.setup_1pf_vfs_env()
+        #launch testpmd
+        command = self.create_testpmd_command()
+        out = self.dut.send_expect(command, "testpmd> ", 15)
+        self.testpmd_status = "running"
+        self.dut.send_expect("set portlist 1", "testpmd> ", 15)
+        self.dut.send_expect("set fwd mac", "testpmd> ", 15)
+        self.dut.send_expect("set verbose 1", "testpmd> ", 15)
+        #create a rule
+        rule_list = self.create_switch_filter_rule(tv_test_fwd_with_single_vf["rte_flow_pattern"])   #create a rule
+        self.check_switch_filter_rule_list(0, rule_list)
+        #send matched packets and check the vf received the packet and forwarded it
+        matched_dic = tv_test_fwd_with_single_vf["matched"]
+        #one vf, the rx packets are equal to tx packets
+        tx_dic = copy.deepcopy(matched_dic)
+        out = self.send_packets(matched_dic)
+        matched_dic["check_func"]["func"](out, matched_dic["check_func"]["param"], matched_dic["expect_results"], tx_dic["check_func"]["param"], tx_dic["expect_results"])
+
+    def test_fwd_with_multi_vfs(self):
+        #set up 4 vfs on 1 pf environment
+        self.setup_1pf_vfs_env()
+        #launch testpmd
+        vf0_pci = self.sriov_vfs_port_0[0].pci
+        vf1_pci = self.sriov_vfs_port_0[1].pci
+        vf2_pci = self.sriov_vfs_port_0[2].pci
+        all_eal_param = self.dut.create_eal_parameters(cores="1S/4C/1T", ports=[vf0_pci, vf1_pci, vf2_pci], port_options={vf0_pci:"cap=dcf"})
+        command = "./%s/app/testpmd %s -- -i" % (self.dut.target, all_eal_param)
+        out = self.dut.send_expect(command, "testpmd> ", 15)
+        self.testpmd_status = "running"
+        self.dut.send_expect("set portlist 1,2", "testpmd> ", 15)
+        self.dut.send_expect("set fwd mac", "testpmd> ", 15)
+        self.dut.send_expect("set verbose 1", "testpmd> ", 15)
+        #create a rule
+        rule_list = self.create_switch_filter_rule(tv_test_fwd_with_multi_vfs["rte_flow_pattern"])
+        self.check_switch_filter_rule_list(0, rule_list)
+        #send matched packets and check vf1 received the packet and forwarded to vf2
+        matched_dic = tv_test_fwd_with_multi_vfs["matched"]
+        #tx packets number on vf2
+        tx_dic = copy.deepcopy(matched_dic)
+        tx_dic["expect_results"]["expect_pkts"][0] = matched_dic["expect_results"]["expect_pkts"][1]
+        tx_dic["expect_results"]["expect_pkts"][1] = matched_dic["expect_results"]["expect_pkts"][0]
+        out = self.send_packets(matched_dic)
+        matched_dic["check_func"]["func"](out, matched_dic["check_func"]["param"], matched_dic["expect_results"], tx_dic["check_func"]["param"], tx_dic["expect_results"])
+
+    def test_max_vfs(self):
+        #set up 64 vfs on 1 pf environment
+        self.used_dut_port_0 = self.dut_ports[0]
+        self.pf0_intf = self.dut.ports_info[self.used_dut_port_0]['intf']
+        out = self.dut.send_expect('ethtool -i %s' % self.pf0_intf, '#')
+        #generate 64 VFs on PF0
+        self.dut.generate_sriov_vfs_by_port(self.used_dut_port_0, 64, driver='default')
+        self.sriov_vfs_port = self.dut.ports_info[self.used_dut_port_0]['vfs_port']
+        #sort the vf interfaces and pcis by pcis
+        vfs = {}
+        for vf_port in self.sriov_vfs_port:
+            vfs[vf_port.pci] = vf_port.intf_name
+        vfs_sort = sorted(vfs.items(), key=lambda item:item[0])
+        vf_pci = [key for key,value in vfs_sort]
+        vf_intf = [value for key,value in vfs_sort]
+        #start the 64 VFs in the kernel
+        for intf in vf_intf:
+            self.dut.send_expect('ifconfig %s up' % intf, '#')
+
+        self.dut.send_expect('ip link set %s vf 0 trust on' % self.pf0_intf, '#')
+        self.dut.send_expect('./usertools/dpdk-devbind.py -b %s %s' % (self.vf_driver, vf_pci[0]), '# ')
+        time.sleep(5)
+        vf_intf.pop(0)
+        #launch testpmd
+        vf0_pci = vf_pci[0]
+        all_eal_param = self.dut.create_eal_parameters(cores="1S/4C/1T", ports=[vf0_pci], port_options={vf0_pci:"cap=dcf"})
+        command = "./%s/app/testpmd %s -- -i" % (self.dut.target, all_eal_param)
+        out = self.dut.send_expect(command, "testpmd> ", 15)
+        self.testpmd_status = "running"
+        #generate 63 rules to each vf and matched packets
+        for i in range(1,64):
+            rte_flow_pattern = "flow create 0 ingress pattern eth / ipv4 src is 192.168.0.%d / tcp / end actions vf id %d / end" % (i, i)
+            tv_max_vfs["rte_flow_pattern"].append(rte_flow_pattern)
+            matched_scapy_str = 'Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.%d")/TCP()/Raw("X"*480)' % i
+            tv_max_vfs["matched"]["scapy_str"].append(matched_scapy_str)
+        out = self.dut.send_expect("show port info all", "testpmd> ", 15)
+        #create 63 rules
+        rule_list = self.create_switch_filter_rule(tv_max_vfs["rte_flow_pattern"])
+        self.check_switch_filter_rule_list(0, rule_list)
+        #send matched packets and check
+        matched_dic = tv_max_vfs["matched"]
+        out = self.send_packets(matched_dic)
+        #check the 63 packets received by each vf
+        self.session_secondary = self.dut.new_session(suite="session_secondary")
+        #get the log of each kernel vf
+        out_vfs = self.get_kernel_vf_log(vf_intf, self.session_secondary)
+        matched_dic["check_func"]["func"](out_vfs, matched_dic["expect_results"]["expect_pkts"])
+        #send mismatched packets and check
+        mismatched_dic = tv_max_vfs["mismatched"]
+        out = self.send_packets(mismatched_dic)
+        #get the log of each kernel vf
+        out_vfs = self.get_kernel_vf_log(vf_intf, self.session_secondary)
+        # kernel vf will not clear the statistics automatically, the rx packets number is the same
+        mismatched_dic["check_func"]["func"](out_vfs, mismatched_dic["expect_results"]["expect_pkts"])
+        #destroy rules and send matched packets
+        self.destroy_switch_filter_rule(0, rule_list)
+        self.check_switch_filter_rule_list(0, [])
+        #send matched packets and check
+        destroy_dict = copy.deepcopy(matched_dic)
+        out = self.send_packets(destroy_dict)
+        # check the packets are not to any vf, and the statistics in each kernel vf are still the same.
+        out_vfs = self.get_kernel_vf_log(vf_intf, self.session_secondary)
+        #the kernel vf will not clear the statistics automatically, the rx packets number is still the same
+        destroy_dict["check_func"]["func"](out_vfs, destroy_dict["expect_results"]["expect_pkts"])
+
+    def test_max_field_vectors(self):
+        #set up 4 vfs on 1 pf environment
+        self.setup_1pf_vfs_env()
+        #launch testpmd
+        self.launch_testpmd()
+        #create 3 nvgre rules, which have run out of field vectors
+        rule_list = self.create_switch_filter_rule(tv_max_field_vectors["rte_flow_pattern"])   #create a rule
+        self.check_switch_filter_rule_list(0, rule_list)
+        #create a rule, check the rule can not be created successfully
+        rule = "flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.10 / nvgre tni is 0x8 /  eth dst is 68:05:ca:8d:ed:a1  / ipv4 src is 192.168.1.2 dst is 192.168.1.3 / udp src is 25 dst is 23 / end actions vf id 1 / end"
+        out = self.dut.send_expect(rule, "testpmd> ", timeout=2)  #create a rule
+        self.verify("Failed to create flow" in out, "Log not provide a friendly output to indicate that the rule failed to create.")
+        #check the rule list
+        self.check_switch_filter_rule_list(0, rule_list)
+        #send matched packets and check
+        matched_dic = tv_max_field_vectors["matched"]
+        self.send_and_check_packets(matched_dic)
+        #send mismatched packets and check
+        mismatched_dic = tv_max_field_vectors["mismatched"]
+        self.send_and_check_packets(mismatched_dic)
+        #destroy rules and send matched packets
+        self.destroy_switch_filter_rule(0, rule_list)
+        self.check_switch_filter_rule_list(0, [])
+        #send matched packets and check
+        destroy_dict = copy.deepcopy(matched_dic)
+        destroy_dict["expect_results"]["expect_pkts"] = 0
+        self.send_and_check_packets(destroy_dict)
+
+    def test_max_rule_number(self):
+        #set up 4 vfs on 1 pf environment
+        self.setup_1pf_vfs_env()
+        #create 32563 rules with the same pattern, but different input set to file
+        src_file = 'dep/testpmd_cmds_32k_switch_rules'
+        flows = open(src_file, mode='w')
+        rule_count = 1
+        for i in range(0,255):
+            for j in range(0,255):
+                if not rule_count > 32563:
+                    flows.write('flow create 0 ingress pattern eth / ipv4 src is 192.168.%d.%d / end actions vf id 1 / end \n' % (i, j))
+                    matched_scapy_str = 'Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.%d.%d")/TCP(sport=25,dport=23)/Raw("X"*480)' % (i, j)
+                    tv_max_rule_number["matched"]["scapy_str"].append(matched_scapy_str)
+                    rule_count += 1
+                else:
+                    break
+            if rule_count > 32563:
+                break
+        flows.close()
+        self.dut_file_dir = '/tmp'
+        self.dut.session.copy_file_to(src_file, self.dut_file_dir)
+        #launch testpmd with 32563 rules
+        vf0_pci = self.sriov_vfs_port_0[0].pci
+        vf1_pci = self.sriov_vfs_port_0[1].pci
+        all_eal_param = self.dut.create_eal_parameters(cores="1S/4C/1T", ports=[vf0_pci, vf1_pci], port_options={vf0_pci:"cap=dcf"})
+        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target, all_eal_param, "--cmdline-file=/tmp/testpmd_cmds_32k_switch_rules")
+        out = self.dut.send_expect(command, "testpmd> ", 360)
+        self.testpmd_status = "running"
+        self.dut.send_expect("set portlist 1", "testpmd> ", 15)
+        self.dut.send_expect("set fwd rxonly", "testpmd> ", 15)
+        #check the rule list with 32563 rules
+        rule_list_num = list(range(0, 32563))
+        rule_list = [str(x) for x in rule_list_num]
+        self.check_switch_filter_rule_list(0, rule_list)
+        #create the 32564th rule
+        rule = "flow create 0 ingress pattern eth / ipv4 src is 192.168.127.178 / end actions vf id 1 / end"
+        out = self.dut.send_expect(rule, "testpmd> ", timeout=2)
+        self.verify("Failed to create flow" in out, "Log not provide a friendly output to indicate that the rule failed to create.")
+        #check the rule list
+        self.check_switch_filter_rule_list(0, rule_list)
+        #send matched packets and check
+        matched_dic = tv_max_rule_number["matched"]
+        self.send_and_check_packets(matched_dic)
+        #send mismatched packets and check
+        mismatched_dic = tv_max_rule_number["mismatched"]
+        self.send_and_check_packets(mismatched_dic)
+        #destroy rules and send matched packets
+        self.dut.send_expect("flow flush 0", "testpmd> ", 300)
+        self.check_switch_filter_rule_list(0, [])
+        #send matched packets and check
+        destroy_dict = copy.deepcopy(matched_dic)
+        destroy_dict["expect_results"]["expect_pkts"] = 0
+        self.send_and_check_packets(destroy_dict)
+
+    def test_flow_validation(self):
+        #set up 4 vfs on 1 pf environment
+        self.setup_1pf_vfs_env()
+        #launch testpmd
+        self.launch_testpmd()
+        #validate MAC_IPV4_UDP_PAY
+        rule = "flow validate 0 ingress pattern eth dst is 68:05:ca:8d:ed:a8 / ipv4 src is 192.168.0.1 dst is 192.168.0.2 tos is 4 ttl is 3 / udp src is 25 dst is 23 / end actions vf id 1 / end"
+        out = self.dut.send_expect(rule, "testpmd> ", timeout=2)
+        self.verify("Flow rule validated" in out, "validate failed. rule: %s " % rule)
+        #validate MAC_IPV4_PFCP_NODE
+        rule = "flow validate 0 ingress pattern eth / ipv4 / udp / pfcp s_field is 0 / end actions vf id 1 / end"
+        out = self.dut.send_expect(rule, "testpmd> ", timeout=2)
+        self.verify("Flow rule validated" in out, "validate failed. rule: %s " % rule)
+        #validate MAC_IPV4_SCTP_PAY
+        rule = "flow validate 0 ingress pattern eth / ipv4 src is 192.168.0.2 dst is 192.168.0.3 / sctp src is 25 dst is 23 / end actions vf id 1 / end"
+        out = self.dut.send_expect(rule, "testpmd> ", timeout=2)
+        self.verify("error" in out and "Invalid input pattern: Invalid argument" in out, "validate failed. rule: %s " % rule)
+        #check the rule list
+        self.check_switch_filter_rule_list(0, [])
+        #validate a rule on invalid vf
+        rule = "flow validate 1 ingress pattern eth / ipv6 / udp / pfcp s_field is 1 / end actions vf id 1 / end"
+        out = self.dut.send_expect(rule, "testpmd> ", timeout=2)
+        self.verify("error" in out and "Failed" in out, "validate failed. rule: %s " % rule)
+        #check the rule list
+        self.check_switch_filter_rule_list(1, [])
+
+    def test_dcf_stop_start(self):
+        #set up 4 vfs on 1 pf environment
+        self.setup_1pf_vfs_env()
+        #launch testpmd
+        self.launch_testpmd()
+        #create MAC_IPV4_UDP_PAY rule
+        rule_list = self.create_switch_filter_rule(tv_mac_ipv4_udp_pay["rte_flow_pattern"])   #create a rule
+        self.check_switch_filter_rule_list(0, rule_list)
+        #send matched packets and check
+        matched_dic = tv_mac_ipv4_udp_pay["matched"]
+        self.send_and_check_packets(matched_dic)
+        #stop the DCF, then start the DCF
+        self.dut.send_expect("port stop 0", "testpmd> ")
+        self.dut.send_expect("port start 0", "testpmd> ")
+        self.check_switch_filter_rule_list(0, rule_list)
+        #send matched packets, port 1 can still receive the packets.
+        self.send_and_check_packets(matched_dic)
+
+    def test_mac_ipv4_pfcp_node(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv4_pfcp_node)
+
+    def test_mac_ipv4_pfcp_session(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv4_pfcp_session)
+
+    def test_mac_ipv6_pfcp_node(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv6_pfcp_node)
+
+    def test_mac_ipv6_pfcp_session(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv6_pfcp_session)
+
+    def test_add_two_rules_with_different_input_set_same_vf_id(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_add_two_rules_with_different_input_set_same_vf_id)
+
+    def test_add_two_rules_with_different_input_set_different_vf_id(self):
+        #set up 4 vfs on 1 pf environment
+        self.setup_1pf_vfs_env()
+        #launch testpmd
+        vf0_pci = self.sriov_vfs_port_0[0].pci
+        vf1_pci = self.sriov_vfs_port_0[1].pci
+        vf2_pci = self.sriov_vfs_port_0[2].pci
+        all_eal_param = self.dut.create_eal_parameters(cores="1S/4C/1T", ports=[vf0_pci, vf1_pci, vf2_pci], port_options={vf0_pci:"cap=dcf"})
+        command = "./%s/app/testpmd %s -- -i" % (self.dut.target, all_eal_param)
+        out = self.dut.send_expect(command, "testpmd> ", 15)
+        self.testpmd_status = "running"
+        self.dut.send_expect("set portlist 1,2", "testpmd> ", 15)
+        self.dut.send_expect("set fwd rxonly", "testpmd> ", 15)
+        self.dut.send_expect("set verbose 1", "testpmd> ", 15)
+        self._rte_flow_validate_pattern(tv_add_two_rules_with_different_input_set_different_vf_id, False)
+
+    def tear_down(self):
+        """
+        Run after each test case.
+        """
+        if self.testpmd_status != "close":
+            # destroy all flow rules on DCF
+            self.dut.send_expect("flow flush 0", "testpmd> ", 15)
+            self.dut.send_expect("clear port stats all", "testpmd> ", 15)
+            self.dut.send_expect("quit", "#", 15)
+        self.testpmd_status = "close"
+        #kill all DPDK application
+        self.dut.kill_all()
+        # destroy vfs
+        for port_id in self.dut_ports:
+            self.dut.destroy_sriov_vfs_by_port(port_id)
+        if self.running_case == "test_unsupported_pattern_in_os_default_but_supported_in_comms":
+            #Restore the pkg file
+            self.dut.send_expect("cp %s %s" % (self.tmp_dir, self.pkg_file), "# ")
+        if getattr(self, 'session_secondary', None):
+            self.dut.close_session(self.session_secondary)
+
+    def tear_down_all(self):
+        """
+        Run after each test suite.
+        """
+        self.dut.kill_all()
-- 
2.17.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dts] [PATCH V1 1/5] dep: add igmp.py to dep
  2020-05-25 18:09 [dts] [PATCH V1 1/5] dep: add igmp.py to dep Nannan Lu
                   ` (3 preceding siblings ...)
  2020-05-25 18:10 ` [dts] [PATCH V1 5/5] tests: add TestSuite_cvl_dcf_switch_filter.py to tests Nannan Lu
@ 2020-06-01  3:13 ` Tu, Lijuan
  4 siblings, 0 replies; 7+ messages in thread
From: Tu, Lijuan @ 2020-06-01  3:13 UTC (permalink / raw)
  To: Lu, Nannan, dts; +Cc: Lu, Nannan

Applied the series, thanks

> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Nannan Lu
> Sent: Tuesday, May 26, 2020 2:10 AM
> To: dts@dpdk.org
> Cc: Lu, Nannan <nannan.lu@intel.com>
> Subject: [dts] [PATCH V1 1/5] dep: add igmp.py to dep
> 
> Add igmp.py to dep so that dts supports
> sending igmp packets.
> 
> Signed-off-by: Nannan Lu <nannan.lu@intel.com>
> ---
>  dep/igmp.py | 164
> ++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 164 insertions(+)
>  create mode 100644 dep/igmp.py
> 
> diff --git a/dep/igmp.py b/dep/igmp.py
> new file mode 100644
> index 0000000..5cbf9c0
> --- /dev/null
> +++ b/dep/igmp.py
> @@ -0,0 +1,164 @@
> +#! /usr/bin/env python
> +
> +# This file is part of Scapy
> +# Scapy is free software: you can redistribute it and/or modify # it
> +under the terms of the GNU General Public License as published by # the
> +Free Software Foundation, either version 2 of the License, or # any
> +later version.
> +#
> +# Scapy is distributed in the hope that it will be useful, # but
> +WITHOUT ANY WARRANTY; without even the implied warranty of #
> +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU
> +General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License #
> +along with Scapy. If not, see <http://www.gnu.org/licenses/>.
> +
> +# flake8: noqa: E501
> +
> +# scapy.contrib.description = Internet Group Management Protocol v1/v2
> +(IGMP/IGMPv2) # scapy.contrib.status = loads
> +
> +from __future__ import print_function
> +from scapy.compat import chb, orb
> +from scapy.error import warning
> +from scapy.fields import ByteEnumField, ByteField, IPField, XShortField
> +from scapy.layers.inet import IP, IPOption_Router_Alert from
> +scapy.layers.l2 import Ether, getmacbyip from scapy.packet import
> +bind_layers, Packet from scapy.utils import atol, checksum
> +
> +
> +def isValidMCAddr(ip):
> +    """convert dotted quad string to long and check the first octet"""
> +    FirstOct = atol(ip) >> 24 & 0xFF
> +    return (FirstOct >= 224) and (FirstOct <= 239)
> +
> +
> +class IGMP(Packet):
> +    """IGMP Message Class for v1 and v2.
> +
> +This class is derived from class Packet. You  need call "igmpize()"
> +so the packet is transformed according the RFC when sent.
> +a=Ether(src="00:01:02:03:04:05")
> +b=IP(src="1.2.3.4")
> +c=IGMP(type=0x12, gaddr="224.2.3.4")
> +x = a/b/c
> +x[IGMP].igmpize()
> +sendp(a/b/c, iface="en0")
> +
> +    Parameters:
> +      type    IGMP type field, 0x11, 0x12, 0x16 or 0x17
> +      mrcode  Maximum Response time (zero for v1)
> +      gaddr   Multicast Group Address 224.x.x.x/4
> +
> +See RFC2236, Section 2. Introduction for definitions of proper
> +IGMPv2 message format   http://www.faqs.org/rfcs/rfc2236.html
> +
> +  """
> +    name = "IGMP"
> +
> +    igmptypes = {0x11: "Group Membership Query",
> +                 0x12: "Version 1 - Membership Report",
> +                 0x16: "Version 2 - Membership Report",
> +                 0x17: "Leave Group"}
> +
> +    fields_desc = [ByteEnumField("type", 0x11, igmptypes),
> +                   ByteField("mrcode", 20),
> +                   XShortField("chksum", None),
> +                   IPField("gaddr", "0.0.0.0")]
> +
> +    def post_build(self, p, pay):
> +        """Called implicitly before a packet is sent to compute and place IGMP
> checksum.
> +
> +        Parameters:
> +          self    The instantiation of an IGMP class
> +          p       The IGMP message in hex in network byte order
> +          pay     Additional payload for the IGMP message
> +        """
> +        p += pay
> +        if self.chksum is None:
> +            ck = checksum(p)
> +            p = p[:2] + chb(ck >> 8) + chb(ck & 0xff) + p[4:]
> +        return p
> +
> +    @classmethod
> +    def dispatch_hook(cls, _pkt=None, *args, **kargs):
> +        if _pkt and len(_pkt) >= 4:
> +            from scapy.contrib.igmpv3 import IGMPv3
> +            if orb(_pkt[0]) in [0x22, 0x30, 0x31, 0x32]:
> +                return IGMPv3
> +            if orb(_pkt[0]) == 0x11 and len(_pkt) >= 12:
> +                return IGMPv3
> +        return IGMP
> +
> +    def igmpize(self):
> +        """Called to explicitly fixup the packet according to the IGMP
> + RFC
> +
> +        The rules are:
> +        General:
> +            1.  the Max Response time is meaningful only in Membership Queries
> and should be zero
> +        IP:
> +            1. Send General Group Query to 224.0.0.1 (all systems)
> +            2. Send Leave Group to 224.0.0.2 (all routers)
> +            3a.Otherwise send the packet to the group address
> +            3b.Send reports/joins to the group address
> +            4. ttl = 1 (RFC 2236, section 2)
> +            5. send the packet with the router alert IP option (RFC 2236, section 2)
> +        Ether:
> +            1. Recalculate destination
> +
> +        Returns:
> +            True    The tuple ether/ip/self passed all check and represents
> +                    a proper IGMP packet.
> +            False   One of more validation checks failed and no fields
> +                    were adjusted.
> +
> +        The function will examine the IGMP message to assure proper format.
> +        Corrections will be attempted if possible. The IP header is then properly
> +        adjusted to ensure correct formatting and assignment. The Ethernet
> header
> +        is then adjusted to the proper IGMP packet format.
> +        """
> +        gaddr = self.gaddr if hasattr(self, "gaddr") and self.gaddr else "0.0.0.0"
> # noqa: E501
> +        underlayer = self.underlayer
> +        if self.type not in [0x11, 0x30]:                               # General Rule 1  # noqa:
> E501
> +            self.mrcode = 0
> +        if isinstance(underlayer, IP):
> +            if (self.type == 0x11):
> +                if (gaddr == "0.0.0.0"):
> +                    underlayer.dst = "224.0.0.1"                        # IP rule 1  # noqa:
> E501
> +                elif isValidMCAddr(gaddr):
> +                    underlayer.dst = gaddr                              # IP rule 3a  # noqa: E501
> +                else:
> +                    warning("Invalid IGMP Group Address detected !")
> +                    return False
> +            elif ((self.type == 0x17) and isValidMCAddr(gaddr)):
> +                underlayer.dst = "224.0.0.2"                           # IP rule 2  # noqa: E501
> +            elif ((self.type == 0x12) or (self.type == 0x16)) and
> (isValidMCAddr(gaddr)):  # noqa: E501
> +                underlayer.dst = gaddr                                 # IP rule 3b  # noqa: E501
> +            else:
> +                warning("Invalid IGMP Type detected !")
> +                return False
> +            if not any(isinstance(x, IPOption_Router_Alert) for x in
> underlayer.options):  # noqa: E501
> +                underlayer.options.append(IPOption_Router_Alert())
> +            underlayer.ttl = 1                                         # IP rule 4
> +            _root = self.firstlayer()
> +            if _root.haslayer(Ether):
> +                # Force recalculate Ether dst
> +                _root[Ether].dst = getmacbyip(underlayer.dst)          # Ether rule 1  #
> noqa: E501
> +        from scapy.contrib.igmpv3 import IGMPv3
> +        if isinstance(self, IGMPv3):
> +            self.encode_maxrespcode()
> +        return True
> +
> +    def mysummary(self):
> +        """Display a summary of the IGMP object."""
> +        if isinstance(self.underlayer, IP):
> +            return
> self.underlayer.sprintf("IGMP: %IP.src% > %IP.dst% %IGMP.type% %IGMP.ga
> ddr%")  # noqa: E501
> +        else:
> +            return self.sprintf("IGMP %IGMP.type% %IGMP.gaddr%")
> +
> +
> +bind_layers(IP, IGMP, frag=0,
> +            proto=2,
> +            ttl=1)
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, back to index

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-25 18:09 [dts] [PATCH V1 1/5] dep: add igmp.py to dep Nannan Lu
2020-05-25 18:10 ` [dts] [PATCH V1 2/5] packet.py: add igmp import Nannan Lu
2020-05-25 18:10 ` [dts] [PATCH V1 3/5] conf: add cvl_dcf_switch_filter.cfg to conf Nannan Lu
2020-05-25 18:10 ` [dts] [PATCH V1 4/5] tests/rte_flow_common.py: add dcf check functions to tests/rte_flow_common.py Nannan Lu
2020-05-25 18:10 ` [dts] [PATCH V1 5/5] tests: add TestSuite_cvl_dcf_switch_filter.py to tests Nannan Lu
2020-05-25 11:12   ` Lu, Nannan
2020-06-01  3:13 ` [dts] [PATCH V1 1/5] dep: add igmp.py to dep Tu, Lijuan

test suite reviews and discussions

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/dts/0 dts/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dts dts/ http://inbox.dpdk.org/dts \
		dts@dpdk.org
	public-inbox-index dts


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dts


AGPL code for this site: git clone https://public-inbox.org/ public-inbox