[V1] tests/cvl_dcf_switch_filter: add drop action test case

Message ID 20201211023317.13817-1-box.c.chen@intel.com (mailing list archive)
State Accepted
Headers
Series [V1] tests/cvl_dcf_switch_filter: add drop action test case |

Commit Message

Chen, BoX C Dec. 11, 2020, 2:33 a.m. UTC
  Add test cases to test the drop action function of DCF.

Signed-off-by: ChenBo <box.c.chen@intel.com>
---
 tests/TestSuite_cvl_dcf_switch_filter.py | 176 +++++++++++++++++++++++
 1 file changed, 176 insertions(+)
  

Comments

Chen, BoX C Dec. 11, 2020, 2:38 a.m. UTC | #1
Tested-by: Chen, BoX C <box.c.chen@intel.com>

Regards,
Chen Bo

> -----Original Message-----
> From: ChenBo <box.c.chen@intel.com>
> Sent: December 11, 2020 10:33
> To: dts@dpdk.org
> Cc: Chen, BoX C <box.c.chen@intel.com>
> Subject: [PATCH V1] tests/cvl_dcf_switch_filter: add drop action test case
  
Lin, Xueqin Dec. 14, 2020, 5:30 a.m. UTC | #2
Acked-by: Xueqin Lin <Xueqin.lin@intel.com>

> -----Original Message-----
> From: dts <dts-bounces@dpdk.org> On Behalf Of ChenBo
> Sent: Friday, December 11, 2020 10:33 AM
> To: dts@dpdk.org
> Cc: Chen, BoX C <box.c.chen@intel.com>
> Subject: [dts] [PATCH V1] tests/cvl_dcf_switch_filter: add drop action test
> case
> 
> Add test cases to test the drop action function of DCF.
> 
> Signed-off-by: ChenBo <box.c.chen@intel.com>
> ---
>  tests/TestSuite_cvl_dcf_switch_filter.py | 176 +++++++++++++++++++++++
>  1 file changed, 176 insertions(+)
> 
> diff --git a/tests/TestSuite_cvl_dcf_switch_filter.py
> b/tests/TestSuite_cvl_dcf_switch_filter.py
> index a65b73a3..be2e6cd6 100644
> --- a/tests/TestSuite_cvl_dcf_switch_filter.py
> +++ b/tests/TestSuite_cvl_dcf_switch_filter.py
> @@ -1216,6 +1216,156 @@ tv_mac_vlan_pppoe_ipcp_pay = {
>                    "expect_results":{"expect_pkts":0}}
>  }
> 
> +tv_mac_ipv4_drop = {
> +    "name": "tv_mac_ipv4_drop",
> +    "rte_flow_pattern": "flow create 0 priority 0 ingress pattern eth / ipv4 src
> is 192.168.0.1 / end actions drop / end",
> +    "matched": {"scapy_str":
> ['Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.1")/Raw("x"*80)'],
> +               "check_func": {"func": rfc.check_vf_rx_packets_number,
> +                             "param": {"expect_port": 1, "expect_queues": "null"}},
> +               "expect_results": {"expect_pkts": 0}},
> +    "mismatched": {"scapy_str":
> ['Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.2")/Raw("x"*80)'],
> +                "check_func": {"func": rfc.check_vf_rx_packets_number,
> +                             "param": {"expect_port": 1, "expect_queues": "null"}},
> +               "expect_results": {"expect_pkts": 1}} }
> +
> +tv_mac_ipv4_mask_drop = {
> +    "name": "tv_mac_ipv4_drop",
> +    "rte_flow_pattern": "flow create 0 ingress pattern eth / ipv4 dst spec
> 224.0.0.0 dst mask 240.0.0.0 / end actions drop / end",
> +    "matched": {"scapy_str":
> ['Ether(dst="00:11:22:33:44:55")/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": 0}},
> +    "mismatched": {"scapy_str":
> ['Ether(dst="00:11:22:33:44:55")/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": 1}} }
> +
> +tv_mac_nvgre_drop = {
> +    "name": "tv_mac_nvgre_drop",
> +    "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 drop / end",
> +    "matched": {"scapy_str":
> ['Ether(dst="00:11:22:33:44:55")/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": 0}},
> +    "mismatched": {"scapy_str":
> ['Ether(dst="00:11:22:33:44:55")/IP(dst="192.168.0.1")/NVGRE(TNI=1)/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": 1}} }
> +
> +tv_mac_ppoes_drop = {
> +    "name": "tv_mac_ppoes_drop",
> +    "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 drop / end",
> +    "matched": {"scapy_str":
> ['Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(vlan=1,type=0x8864)/
> PPPoE(sessionid=3)/PPP(b"\\x00\\x21")/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}},
> +    "mismatched": {"scapy_str":
> ['Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(vlan=1,type=0x8864)/
> PPPoE(sessionid=2)/PPP(b"\\x00\\x21")/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}} }
> +
> +tv_mac_pfcp_drop = {
> +    "name": "tv_mac_pfcp_drop",
> +    "rte_flow_pattern": "flow create 0 ingress pattern eth / ipv4 / udp / pfcp
> s_field is 0 / end actions drop / end",
> +    "matched": {"scapy_str":
> ['Ether(dst="00:11:22:33:44:55")/IP()/UDP(dport=8805)/PFCP(S=0)'],
> +               "check_func": {"func": rfc.check_vf_rx_packets_number,
> +                             "param": {"expect_port": 1, "expect_queues": "null"}},
> +               "expect_results": {"expect_pkts": 0}},
> +    "mismatched": {"scapy_str":
> ['Ether(dst="00:11:22:33:44:55")/IP()/UDP(dport=8805)/PFCP(S=1)'],
> +               "check_func": {"func": rfc.check_vf_rx_packets_number,
> +                             "param": {"expect_port": 1, "expect_queues": "null"}},
> +               "expect_results": {"expect_pkts": 1}} }
> +
> +tv_mac_vlan_drop = {
> +    "name": "tv_mac_vlan_drop",
> +    "rte_flow_pattern": "flow create 0 ingress pattern eth dst is
> 00:11:22:33:44:55 / vlan tci is 1 / end actions drop / end",
> +    "matched": {"scapy_str":
> ['Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(vlan=1)/IP(src="192.16
> 8.0.1",dst="192.168.0.2",tos=4,ttl=2)/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}},
> +    "mismatched": {"scapy_str":
> ['Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(vlan=2)/IP(src="192.16
> 8.0.1",dst="192.168.0.2",tos=4,ttl=2)/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}} }
> +
> +tv_mac_l2tp_drop = {
> +    "name": "tv_mac_l2tp_drop",
> +    "rte_flow_pattern": "flow create 0 priority 0 ingress pattern eth / ipv4 src
> is 192.168.0.2 / l2tpv3oip session_id is 1 / end actions drop / end",
> +    "matched": {"scapy_str":
> ["Ether(dst='00:11:22:33:44:55')/IP(src='192.168.0.2',
> proto=115)/L2TP(b'\\x00\\x00\\x00\\x01')/('X'*480)"],
> +               "check_func": {"func": rfc.check_vf_rx_packets_number,
> +                             "param": {"expect_port": 1, "expect_queues": "null"}},
> +               "expect_results": {"expect_pkts": 0}},
> +    "mismatched": {"scapy_str":
> ["Ether(dst='00:11:22:33:44:55')/IP(src='192.168.0.2',
> proto=115)/L2TP(b'\\x00\\x00\\x00\\x02')/('X'*480)"],
> +               "check_func": {"func": rfc.check_vf_rx_packets_number,
> +                             "param": {"expect_port": 1, "expect_queues": "null"}},
> +               "expect_results": {"expect_pkts": 1}} }
> +
> +tv_mac_esp_drop = {
> +    "name": "tv_mac_l2tp_drop",
> +    "rte_flow_pattern": "flow create 0 priority 0 ingress pattern eth / ipv4 src
> is 192.168.0.2 / esp spi is 1 / end actions drop / end",
> +    "matched": {"scapy_str":
> ['Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.2",
> proto=50)/ESP(spi=1)/("X"*480)'],
> +               "check_func": {"func": rfc.check_vf_rx_packets_number,
> +                             "param": {"expect_port": 1, "expect_queues": "null"}},
> +               "expect_results": {"expect_pkts": 0}},
> +    "mismatched": {"scapy_str":
> ['Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.2",
> proto=50)/ESP(spi=2)/("X"*480)'],
> +               "check_func": {"func": rfc.check_vf_rx_packets_number,
> +                             "param": {"expect_port": 1, "expect_queues": "null"}},
> +               "expect_results": {"expect_pkts": 1}} }
> +
> +tv_mac_blend_pkg_drop = {
> +    "name": "tv_mac_blend_pkg_drop",
> +    "rte_flow_pattern": ["flow create 0 priority 0 ingress pattern eth / ipv4
> src is 192.168.0.1 / end actions drop / end",
> +                         "flow create 0 ingress pattern eth / ipv4 dst spec 224.0.0.0 dst
> mask 240.0.0.0 / end actions drop / end",
> +                         "flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.3 /
> nvgre tni is 2 / eth / ipv4 src is 192.168.1.2 dst is 192.168.1.3 / end actions
> drop / end",
> +                         "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 drop /
> end",
> +                         "flow create 0 ingress pattern eth / ipv4 / udp / pfcp s_field is
> 0 / end actions drop / end",
> +                         "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 /
> vlan tci is 1 / end actions drop / end",
> +                         "flow create 0 priority 0 ingress pattern eth / ipv4 src is
> 192.168.0.4 / l2tpv3oip session_id is 1 / end actions drop / end",
> +                         "flow create 0 priority 0 ingress pattern eth / ipv4 src is
> 192.168.0.5 / esp spi is 1 / end actions drop / end"],
> +    "matched": {"scapy_str":
> ['Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.1")/Raw("x"*80)',
> +
> 'Ether(dst="00:11:22:33:44:55")/IP(dst="239.0.0.0")/TCP()/Raw("x"*80)',
> +
> 'Ether(dst="00:11:22:33:44:55")/IP(dst="192.168.0.3")/NVGRE(TNI=2)/Ether()
> /IP(src="192.168.1.2", dst="192.168.1.3")/Raw("x"*80)',
> +
> 'Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(vlan=1,type=0x8864)/P
> PPoE(sessionid=3)/PPP(b"\\x00\\x21")/IP()/Raw("X" * 80)',
> +
> 'Ether(dst="00:11:22:33:44:55")/IP()/UDP(dport=8805)/PFCP(S=0)',
> +
> 'Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(vlan=1)/IP(src="192.16
> 8.0.1",dst="192.168.0.2",tos=4,ttl=2)/TCP()/Raw("X"*80)',
> +                              'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.4",
> proto=115)/L2TP(b"\\x00\\x00\\x00\\x01")/("X"*480)',
> +                              'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.5",
> proto=50)/ESP(spi=1)/("X"*80)'],
> +               "check_func": {"func": rfc.check_vf_rx_packets_number,
> +                             "param": {"expect_port": 1, "expect_queues": "null"}},
> +               "expect_results": {"expect_pkts": 0}},
> +    "mismatched": {"scapy_str":
> ['Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.6")/Raw("x"*80)',
> +
> 'Ether(dst="00:11:22:33:44:55")/IP(dst="128.0.0.0")/TCP()/Raw("x"*80)',
> +
> 'Ether(dst="00:11:22:33:44:55")/IP(dst="192.168.0.8")/NVGRE(TNI=1)/Ether()
> /IP(src="192.168.1.2", dst="192.168.1.3")/Raw("x"*80)',
> +
> 'Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(vlan=1,type=0x8864)/P
> PPoE(sessionid=2)/PPP(b"\\x00\\x21")/IP()/Raw("x" * 80)',
> +
> 'Ether(dst="00:11:22:33:44:55")/IP()/UDP(dport=8805)/PFCP(S=1)',
> +
> 'Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(vlan=2)/IP(src="192.16
> 8.0.9",dst="192.168.0.2",tos=4,ttl=2)/TCP()/Raw("X"*80)',
> +                                 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.10",
> proto=115)/L2TP(b"\\x00\\x00\\x00\\x02")/("X"*480)',
> +                                 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.11",
> proto=50)/ESP(spi=2)/("X"*80)'],
> +               "check_func": {"func": rfc.check_vf_rx_packets_number,
> +                             "param": {"expect_port": 1, "expect_queues": "null"}},
> +               "expect_results": {"expect_pkts": 8}} }
> +
> +sv_mac_test_drop_action = [
> +    tv_mac_ipv4_drop,
> +    tv_mac_ipv4_mask_drop,
> +    tv_mac_nvgre_drop,
> +    tv_mac_ppoes_drop,
> +    tv_mac_pfcp_drop,
> +    tv_mac_vlan_drop,
> +    tv_mac_l2tp_drop,
> +    tv_mac_esp_drop,
> +    tv_mac_blend_pkg_drop
> +]
> +
>  class CVLDCFSwitchFilterTest(TestCase):
> 
>      def bind_nics_driver(self, ports, driver=""):
> @@ -2175,6 +2325,32 @@ class CVLDCFSwitchFilterTest(TestCase):
>          self.setup_1pf_vfs_env()
>          self._rte_flow_validate_pattern(tv_mac_vlan_pppoe_ipcp_pay)
> 
> +    def test_mac_drop_action(self):
> +        self.setup_1pf_vfs_env()
> +        self.dut.send_expect('ip link set %s vf 1 mac "00:11:22:33:44:55"' %
> self.pf0_intf, '# ')
> +        self.launch_testpmd()
> +        for pattern in sv_mac_test_drop_action:
> +            # validate a rule
> +            self.validate_switch_filter_rule(pattern["rte_flow_pattern"])
> +            # create a rule
> +            rule_list = self.create_switch_filter_rule(pattern["rte_flow_pattern"])
> # create a rule
> +            self.check_switch_filter_rule_list(0, rule_list)
> +            # send matched packets and check
> +            matched_dic = pattern["matched"]
> +            self.send_and_check_packets(matched_dic)
> +            # send mismatched packets and check
> +            mismatched_dic = pattern["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)
> +            destroy_dict["expect_results"]["expect_pkts"] =
> len(pattern["matched"]["scapy_str"])
> +            self.send_and_check_packets(destroy_dict)
> +            self.dut.send_expect("flow flush 0", "testpmd> ", 15)
> +            self.dut.send_expect("clear port stats all", "testpmd> ",
> + 15)
> +
>      def tear_down(self):
>          """
>          Run after each test case.
> --
> 2.17.1
  
Tu, Lijuan Dec. 21, 2020, 7:14 a.m. UTC | #3
> Add test cases to test the drop action function of DCF.
> 
> Signed-off-by: ChenBo <box.c.chen@intel.com>

Applied
  

Patch

diff --git a/tests/TestSuite_cvl_dcf_switch_filter.py b/tests/TestSuite_cvl_dcf_switch_filter.py
index a65b73a3..be2e6cd6 100644
--- a/tests/TestSuite_cvl_dcf_switch_filter.py
+++ b/tests/TestSuite_cvl_dcf_switch_filter.py
@@ -1216,6 +1216,156 @@  tv_mac_vlan_pppoe_ipcp_pay = {
                   "expect_results":{"expect_pkts":0}}
 }
 
+tv_mac_ipv4_drop = {
+    "name": "tv_mac_ipv4_drop",
+    "rte_flow_pattern": "flow create 0 priority 0 ingress pattern eth / ipv4 src is 192.168.0.1 / end actions drop / end",
+    "matched": {"scapy_str": ['Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.1")/Raw("x"*80)'],
+               "check_func": {"func": rfc.check_vf_rx_packets_number,
+                             "param": {"expect_port": 1, "expect_queues": "null"}},
+               "expect_results": {"expect_pkts": 0}},
+    "mismatched": {"scapy_str": ['Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.2")/Raw("x"*80)'],
+                "check_func": {"func": rfc.check_vf_rx_packets_number,
+                             "param": {"expect_port": 1, "expect_queues": "null"}},
+               "expect_results": {"expect_pkts": 1}}
+}
+
+tv_mac_ipv4_mask_drop = {
+    "name": "tv_mac_ipv4_drop",
+    "rte_flow_pattern": "flow create 0 ingress pattern eth / ipv4 dst spec 224.0.0.0 dst mask 240.0.0.0 / end actions drop / end",
+    "matched": {"scapy_str": ['Ether(dst="00:11:22:33:44:55")/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": 0}},
+    "mismatched": {"scapy_str": ['Ether(dst="00:11:22:33:44:55")/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": 1}}
+}
+
+tv_mac_nvgre_drop = {
+    "name": "tv_mac_nvgre_drop",
+    "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 drop / end",
+    "matched": {"scapy_str": ['Ether(dst="00:11:22:33:44:55")/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": 0}},
+    "mismatched": {"scapy_str": ['Ether(dst="00:11:22:33:44:55")/IP(dst="192.168.0.1")/NVGRE(TNI=1)/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": 1}}
+}
+
+tv_mac_ppoes_drop = {
+    "name": "tv_mac_ppoes_drop",
+    "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 drop / end",
+    "matched": {"scapy_str": ['Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(vlan=1,type=0x8864)/PPPoE(sessionid=3)/PPP(b"\\x00\\x21")/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}},
+    "mismatched": {"scapy_str": ['Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(vlan=1,type=0x8864)/PPPoE(sessionid=2)/PPP(b"\\x00\\x21")/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}}
+}
+
+tv_mac_pfcp_drop = {
+    "name": "tv_mac_pfcp_drop",
+    "rte_flow_pattern": "flow create 0 ingress pattern eth / ipv4 / udp / pfcp s_field is 0 / end actions drop / end",
+    "matched": {"scapy_str": ['Ether(dst="00:11:22:33:44:55")/IP()/UDP(dport=8805)/PFCP(S=0)'],
+               "check_func": {"func": rfc.check_vf_rx_packets_number,
+                             "param": {"expect_port": 1, "expect_queues": "null"}},
+               "expect_results": {"expect_pkts": 0}},
+    "mismatched": {"scapy_str": ['Ether(dst="00:11:22:33:44:55")/IP()/UDP(dport=8805)/PFCP(S=1)'],
+               "check_func": {"func": rfc.check_vf_rx_packets_number,
+                             "param": {"expect_port": 1, "expect_queues": "null"}},
+               "expect_results": {"expect_pkts": 1}}
+}
+
+tv_mac_vlan_drop = {
+    "name": "tv_mac_vlan_drop",
+    "rte_flow_pattern": "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / vlan tci is 1 / end actions drop / 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"*80)'],
+               "check_func": {"func": rfc.check_vf_rx_packets_number,
+                             "param": {"expect_port": 1, "expect_queues": "null"}},
+               "expect_results": {"expect_pkts": 0}},
+    "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"*80)'],
+               "check_func": {"func": rfc.check_vf_rx_packets_number,
+                             "param": {"expect_port": 1, "expect_queues": "null"}},
+               "expect_results": {"expect_pkts": 1}}
+}
+
+tv_mac_l2tp_drop = {
+    "name": "tv_mac_l2tp_drop",
+    "rte_flow_pattern": "flow create 0 priority 0 ingress pattern eth / ipv4 src is 192.168.0.2 / l2tpv3oip session_id is 1 / end actions drop / end",
+    "matched": {"scapy_str": ["Ether(dst='00:11:22:33:44:55')/IP(src='192.168.0.2', proto=115)/L2TP(b'\\x00\\x00\\x00\\x01')/('X'*480)"],
+               "check_func": {"func": rfc.check_vf_rx_packets_number,
+                             "param": {"expect_port": 1, "expect_queues": "null"}},
+               "expect_results": {"expect_pkts": 0}},
+    "mismatched": {"scapy_str": ["Ether(dst='00:11:22:33:44:55')/IP(src='192.168.0.2', proto=115)/L2TP(b'\\x00\\x00\\x00\\x02')/('X'*480)"],
+               "check_func": {"func": rfc.check_vf_rx_packets_number,
+                             "param": {"expect_port": 1, "expect_queues": "null"}},
+               "expect_results": {"expect_pkts": 1}}
+}
+
+tv_mac_esp_drop = {
+    "name": "tv_mac_l2tp_drop",
+    "rte_flow_pattern": "flow create 0 priority 0 ingress pattern eth / ipv4 src is 192.168.0.2 / esp spi is 1 / end actions drop / end",
+    "matched": {"scapy_str": ['Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.2", proto=50)/ESP(spi=1)/("X"*480)'],
+               "check_func": {"func": rfc.check_vf_rx_packets_number,
+                             "param": {"expect_port": 1, "expect_queues": "null"}},
+               "expect_results": {"expect_pkts": 0}},
+    "mismatched": {"scapy_str": ['Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.2", proto=50)/ESP(spi=2)/("X"*480)'],
+               "check_func": {"func": rfc.check_vf_rx_packets_number,
+                             "param": {"expect_port": 1, "expect_queues": "null"}},
+               "expect_results": {"expect_pkts": 1}}
+}
+
+tv_mac_blend_pkg_drop = {
+    "name": "tv_mac_blend_pkg_drop",
+    "rte_flow_pattern": ["flow create 0 priority 0 ingress pattern eth / ipv4 src is 192.168.0.1 / end actions drop / end",
+                         "flow create 0 ingress pattern eth / ipv4 dst spec 224.0.0.0 dst mask 240.0.0.0 / end actions drop / end",
+                         "flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.3 / nvgre tni is 2 / eth / ipv4 src is 192.168.1.2 dst is 192.168.1.3 / end actions drop / end",
+                         "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 drop / end",
+                         "flow create 0 ingress pattern eth / ipv4 / udp / pfcp s_field is 0 / end actions drop / end",
+                         "flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / vlan tci is 1 / end actions drop / end",
+                         "flow create 0 priority 0 ingress pattern eth / ipv4 src is 192.168.0.4 / l2tpv3oip session_id is 1 / end actions drop / end",
+                         "flow create 0 priority 0 ingress pattern eth / ipv4 src is 192.168.0.5 / esp spi is 1 / end actions drop / end"],
+    "matched": {"scapy_str": ['Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.1")/Raw("x"*80)',
+                              'Ether(dst="00:11:22:33:44:55")/IP(dst="239.0.0.0")/TCP()/Raw("x"*80)',
+                              'Ether(dst="00:11:22:33:44:55")/IP(dst="192.168.0.3")/NVGRE(TNI=2)/Ether()/IP(src="192.168.1.2", dst="192.168.1.3")/Raw("x"*80)',
+                              'Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(vlan=1,type=0x8864)/PPPoE(sessionid=3)/PPP(b"\\x00\\x21")/IP()/Raw("X" * 80)',
+                              'Ether(dst="00:11:22:33:44:55")/IP()/UDP(dport=8805)/PFCP(S=0)',
+                              '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"*80)',
+                              'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.4", proto=115)/L2TP(b"\\x00\\x00\\x00\\x01")/("X"*480)',
+                              'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.5", proto=50)/ESP(spi=1)/("X"*80)'],
+               "check_func": {"func": rfc.check_vf_rx_packets_number,
+                             "param": {"expect_port": 1, "expect_queues": "null"}},
+               "expect_results": {"expect_pkts": 0}},
+    "mismatched": {"scapy_str": ['Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.6")/Raw("x"*80)',
+                                 'Ether(dst="00:11:22:33:44:55")/IP(dst="128.0.0.0")/TCP()/Raw("x"*80)',
+                                 'Ether(dst="00:11:22:33:44:55")/IP(dst="192.168.0.8")/NVGRE(TNI=1)/Ether()/IP(src="192.168.1.2", dst="192.168.1.3")/Raw("x"*80)',
+                                 'Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(vlan=1,type=0x8864)/PPPoE(sessionid=2)/PPP(b"\\x00\\x21")/IP()/Raw("x" * 80)',
+                                 'Ether(dst="00:11:22:33:44:55")/IP()/UDP(dport=8805)/PFCP(S=1)',
+                                 'Ether(dst="00:11:22:33:44:55",type=0x8100)/Dot1Q(vlan=2)/IP(src="192.168.0.9",dst="192.168.0.2",tos=4,ttl=2)/TCP()/Raw("X"*80)',
+                                 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.10", proto=115)/L2TP(b"\\x00\\x00\\x00\\x02")/("X"*480)',
+                                 'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.11", proto=50)/ESP(spi=2)/("X"*80)'],
+               "check_func": {"func": rfc.check_vf_rx_packets_number,
+                             "param": {"expect_port": 1, "expect_queues": "null"}},
+               "expect_results": {"expect_pkts": 8}}
+}
+
+sv_mac_test_drop_action = [
+    tv_mac_ipv4_drop,
+    tv_mac_ipv4_mask_drop,
+    tv_mac_nvgre_drop,
+    tv_mac_ppoes_drop,
+    tv_mac_pfcp_drop,
+    tv_mac_vlan_drop,
+    tv_mac_l2tp_drop,
+    tv_mac_esp_drop,
+    tv_mac_blend_pkg_drop
+]
+
 class CVLDCFSwitchFilterTest(TestCase):
 
     def bind_nics_driver(self, ports, driver=""):
@@ -2175,6 +2325,32 @@  class CVLDCFSwitchFilterTest(TestCase):
         self.setup_1pf_vfs_env()
         self._rte_flow_validate_pattern(tv_mac_vlan_pppoe_ipcp_pay)
 
+    def test_mac_drop_action(self):
+        self.setup_1pf_vfs_env()
+        self.dut.send_expect('ip link set %s vf 1 mac "00:11:22:33:44:55"' % self.pf0_intf, '# ')
+        self.launch_testpmd()
+        for pattern in sv_mac_test_drop_action:
+            # validate a rule
+            self.validate_switch_filter_rule(pattern["rte_flow_pattern"])
+            # create a rule
+            rule_list = self.create_switch_filter_rule(pattern["rte_flow_pattern"])  # create a rule
+            self.check_switch_filter_rule_list(0, rule_list)
+            # send matched packets and check
+            matched_dic = pattern["matched"]
+            self.send_and_check_packets(matched_dic)
+            # send mismatched packets and check
+            mismatched_dic = pattern["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)
+            destroy_dict["expect_results"]["expect_pkts"] = len(pattern["matched"]["scapy_str"])
+            self.send_and_check_packets(destroy_dict)
+            self.dut.send_expect("flow flush 0", "testpmd> ", 15)
+            self.dut.send_expect("clear port stats all", "testpmd> ", 15)
+
     def tear_down(self):
         """
         Run after each test case.