diff mbox series

[V1] tests/ice_dcf_switch_filter:implement VXLAN related cases

Message ID 20220921091137.54010-1-hongbox.li@intel.com (mailing list archive)
State Changes Requested
Headers show
Series [V1] tests/ice_dcf_switch_filter:implement VXLAN related cases | expand

Checks

Context Check Description
ci/Intel-dts-suite-test fail Testing issues
ci/Intel-dts-pylama-test success Testing OK
ci/Intel-dts-format-test success Testing OK
ci/Intel-dts-doc-test success Testing OK

Commit Message

Li, HongboX Sept. 21, 2022, 9:11 a.m. UTC
There are vxlan related cases not implemented in the test plan.
This patch implements 8 vxlan cases.

Signed-off-by: Hongbo Li <hongbox.li@intel.com>
---
 .../ice_dcf_switch_filter_test_plan.rst       |   4 +
 tests/TestSuite_ice_dcf_switch_filter.py      | 266 +++++++++++++++++-
 2 files changed, 266 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/test_plans/ice_dcf_switch_filter_test_plan.rst b/test_plans/ice_dcf_switch_filter_test_plan.rst
index 0d38c218..f1804473 100644
--- a/test_plans/ice_dcf_switch_filter_test_plan.rst
+++ b/test_plans/ice_dcf_switch_filter_test_plan.rst
@@ -213,6 +213,10 @@  Prerequisites
 
    check the VF0 driver is net_ice_dcf.
 
+   If set VXLAN flow rule::
+
+      testpmd> rx_vxlan_port add 4789 0
+
 10. on tester side, copy the layer python file to /root::
 
       cp pfcp.py to /root
diff --git a/tests/TestSuite_ice_dcf_switch_filter.py b/tests/TestSuite_ice_dcf_switch_filter.py
index 3c647be6..39bd8255 100644
--- a/tests/TestSuite_ice_dcf_switch_filter.py
+++ b/tests/TestSuite_ice_dcf_switch_filter.py
@@ -1644,6 +1644,230 @@  sv_mac_test_drop_action = [
     tv_mac_blend_pkg_drop,
 ]
 
+tv_mac_ipv4_vxlan_ipv4_frag = {
+    "name": "tv_mac_ipv4_vxlan_ipv4_frag",
+    "rte_flow_pattern": "flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.1 / udp / vxlan vni is 2 / eth / ipv4 src is 192.168.0.2 dst is 192.168.0.3 / 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)',
+            '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)/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")/UDP()/VXLAN(vni=2)/Ether()/IP(src="192.168.0.2", dst="192.168.0.3",frag=5)/Raw("x"*80)',
+            'Ether()/IP(dst="192.168.0.1")/UDP()/VXLAN(vni=3)/Ether()/IP(src="192.168.0.2", dst="192.168.0.3",frag=5)/Raw("x"*80)',
+            'Ether()/IP(dst="192.168.0.1")/UDP()/VXLAN(vni=2)/Ether()/IP(src="192.168.0.4", dst="192.168.0.3",frag=5)/Raw("x"*80)',
+            'Ether()/IP(dst="192.168.0.1")/UDP()/VXLAN(vni=2)/Ether()/IP(src="192.168.0.2", dst="192.168.0.5",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": 0},
+    },
+}
+
+tv_mac_ipv4_vxlan_ipv4_pay = {
+    "name": "tv_mac_ipv4_vxlan_ipv4_pay",
+    "rte_flow_pattern": "flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.1 / udp / vxlan vni is 2 / eth / ipv4 src is 192.168.0.2 dst is 192.168.0.3 / 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")/TCP()/Raw("x"*80)',
+            'Ether()/IP(dst="192.168.0.1")/UDP()/VXLAN(vni=2)/Ether()/IP(src="192.168.0.2", dst="192.168.0.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(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()/IP(dst="192.168.0.2")/UDP()/VXLAN(vni=2)/Ether()/IP(src="192.168.0.2", dst="192.168.0.3")/TCP()/Raw("x"*80)',
+            'Ether()/IP(dst="192.168.0.1")/UDP()/VXLAN(vni=3)/Ether()/IP(src="192.168.0.2", dst="192.168.0.3")/TCP()/Raw("x"*80)',
+            'Ether()/IP(dst="192.168.0.1")/UDP()/VXLAN(vni=2)/Ether()/IP(src="192.168.0.4", dst="192.168.0.3")/TCP()/Raw("x"*80)',
+            'Ether()/IP(dst="192.168.0.1")/UDP()/VXLAN(vni=2)/Ether()/IP(src="192.168.0.2", dst="192.168.0.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_vxlan_ipv4_udp_pay = {
+    "name": "tv_mac_ipv4_vxlan_ipv4_udp_pay",
+    "rte_flow_pattern": "flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.1 / udp / vxlan vni is 2 / 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")/UDP()/VXLAN(vni=2)/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")/UDP()/VXLAN(vni=2)/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")/UDP()/VXLAN(vni=2)/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_vxlan_ipv4_tcp = {
+    "name": "tv_mac_ipv4_vxlan_ipv4_tcp",
+    "rte_flow_pattern": "flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.1 / udp / vxlan vni is 2 / eth / ipv4 src is 192.168.0.2 dst is 192.168.0.3 / tcp src is 50 dst is 23 / 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")/TCP(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")/UDP()/VXLAN(vni=2)/Ether()/IP(src="192.168.0.2", dst="192.168.0.3")/TCP(sport=29,dport=23)/Raw("x"*80)',
+            'Ether()/IP(dst="192.168.0.1")/UDP()/VXLAN(vni=2)/Ether()/IP(src="192.168.0.2", dst="192.168.0.3")/TCP(sport=50,dport=100)/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_vxlan_mac_ipv4_frag = {
+    "name": "tv_mac_ipv4_vxlan_mac_ipv4_frag",
+    "rte_flow_pattern": "flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.1 / udp / vxlan vni is 2 / eth dst is 68:05:ca:8d:ed:a8 / ipv4 src is 192.168.0.2 dst is 192.168.0.3 / end actions vf id 1 / end",
+    "matched": {
+        "scapy_str": [
+            'Ether()/IP(dst="192.168.0.1")/UDP()/VXLAN(vni=2)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.2", dst="192.168.0.3" ,frag=5)/TCP()/Raw("x"*80)',
+            'Ether()/IP(dst="192.168.0.1")/UDP()/VXLAN(vni=2)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.2", dst="192.168.0.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.1")/UDP()/VXLAN(vni=2)/Ether()/IP(src="192.168.0.2", dst="192.168.0.3")/TCP(sport=29,dport=23)/Raw("x"*80)',
+            'Ether()/IP(dst="192.168.0.1")/UDP()/VXLAN(vni=2)/Ether()/IP(src="192.168.0.2", dst="192.168.0.3")/TCP(sport=50,dport=100)/Raw("x"*80)',
+            'Ether()/IP(dst="192.168.0.2")/UDP()/VXLAN(vni=2)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.2", dst="192.168.0.3" ,frag=5)/TCP()/Raw("x"*80)',
+            'Ether()/IP(dst="192.168.0.1")/UDP()/VXLAN(vni=3)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.2", dst="192.168.0.3" ,frag=5)/TCP()/Raw("x"*80)',
+            'Ether()/IP(dst="192.168.0.1")/UDP()/VXLAN(vni=2)/Ether(dst="68:05:ca:8d:ed:a9")/IP(src="192.168.0.2", dst="192.168.0.3" ,frag=5)/TCP()/Raw("x"*80)',
+            'Ether()/IP(dst="192.168.0.1")/UDP()/VXLAN(vni=2)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.4", dst="192.168.0.3" ,frag=5)/TCP()/Raw("x"*80)',
+            'Ether()/IP(dst="192.168.0.1")/UDP()/VXLAN(vni=2)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.2", dst="192.168.0.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_vxlan_mac_ipv4_pay = {
+    "name": "tv_mac_ipv4_vxlan_mac_ipv4_pay",
+    "rte_flow_pattern": "flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.1 / udp / vxlan vni is 2 / eth dst is 68:05:ca:8d:ed:a8  / ipv4 src is 192.168.0.2 dst is 192.168.0.3 / end actions vf id 1 / end",
+    "matched": {
+        "scapy_str": [
+            'Ether()/IP(dst="192.168.0.1")/UDP()/VXLAN(vni=2)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.2", dst="192.168.0.3") /TCP()/Raw("x" * 80)',
+            'Ether()/IP(dst="192.168.0.1")/UDP()/VXLAN(vni=2)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.2", dst="192.168.0.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")/UDP()/VXLAN(vni=2)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.2", dst="192.168.0.3") /TCP()/Raw("x" * 80)',
+            'Ether()/IP(dst="192.168.0.1")/UDP()/VXLAN(vni=3)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.2", dst="192.168.0.3") /TCP()/Raw("x" * 80)',
+            'Ether()/IP(dst="192.168.0.1")/UDP()/VXLAN(vni=2)/Ether(dst="68:05:ca:8d:ed:a9")/IP(src="192.168.0.2", dst="192.168.0.3") /TCP()/Raw("x" * 80)',
+            'Ether()/IP(dst="192.168.0.1")/UDP()/VXLAN(vni=2)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.4", dst="192.168.0.3") /TCP()/Raw("x" * 80)',
+            'Ether()/IP(dst="192.168.0.1")/UDP()/VXLAN(vni=2)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.2", dst="192.168.0.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_vxlan_mac_ipv4_udp_pay = {
+    "name": "tv_mac_ipv4_vxlan_mac_ipv4_udp_pay",
+    "rte_flow_pattern": "flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.1 / udp / vxlan vni is 2 / eth dst is 68:05:ca:8d:ed:a8  / 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")/UDP()/VXLAN(vni=2)/Ether(dst="68:05:ca:8d:ed:a8")/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")/UDP()/VXLAN(vni=2)/Ether(dst="68:05:ca:8d:ed:a8")/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")/UDP()/VXLAN(vni=2)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.2", dst="192.168.0.3")/UDP(sport=50,dport=29)/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_vxlan_mac_ipv4_tcp = {
+    "name": "tv_mac_ipv4_vxlan_mac_ipv4_tcp",
+    "rte_flow_pattern": "flow create 0 ingress pattern eth / ipv4 dst is 192.168.0.1 / udp / vxlan vni is 2 / eth dst is 68:05:ca:8d:ed:a8  / ipv4 src is 192.168.0.2 dst is 192.168.0.3 / tcp src is 25 dst is 23 / end actions vf id 1 / end",
+    "matched": {
+        "scapy_str": [
+            'Ether()/IP(dst="192.168.0.1")/UDP()/VXLAN(vni=2)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.2", dst="192.168.0.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")/UDP()/VXLAN(vni=2)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.2", dst="192.168.0.3")/TCP(sport=20,dport=23)/Raw("x" * 80)',
+            'Ether()/IP(dst="192.168.0.1")/UDP()/VXLAN(vni=2)/Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.2", dst="192.168.0.3")/TCP(sport=25,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},
+    },
+}
 
 class ICEDCFSwitchFilterTest(TestCase):
     supported_nic = ["ICE_100G-E810C_QSFP", "ICE_25G-E810C_SFP", "ICE_25G-E810_XXV_SFP"]
@@ -1743,7 +1967,7 @@  class ICEDCFSwitchFilterTest(TestCase):
         command = self.path + all_eal_param + " -- -i"
         return command
 
-    def launch_testpmd(self):
+    def launch_testpmd(self,is_vxlan=False):
         """
         launch testpmd with the command
         """
@@ -1753,7 +1977,9 @@  class ICEDCFSwitchFilterTest(TestCase):
         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)
-
+        if is_vxlan:
+            self.dut.send_expect("rx_vxlan_port add 4789 0", "testpmd> ", 15)
+            
     def send_packets(self, dic, session_name="", tx_iface=""):
         """
         send packets.
@@ -1967,10 +2193,10 @@  class ICEDCFSwitchFilterTest(TestCase):
         return out_vfs
 
     def _rte_flow_validate_pattern(self, test_vector, launch_testpmd=True):
-
+        vxlan = True if "vxlan" in test_vector['name'] else False
         if launch_testpmd:
             # launch testpmd
-            self.launch_testpmd()
+            self.launch_testpmd(is_vxlan=vxlan)
         # validate a rule
         self.validate_switch_filter_rule(test_vector["rte_flow_pattern"])
         # create a rule
@@ -2666,6 +2892,38 @@  class ICEDCFSwitchFilterTest(TestCase):
             self.dut.send_expect("flow flush 0", "testpmd> ", 15)
             self.dut.send_expect("clear port stats all", "testpmd> ", 15)
 
+    def test_mac_ipv4_vxlan_ipv4_frag(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv4_vxlan_ipv4_frag,)
+
+    def test_mac_ipv4_vxlan_ipv4_pay(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv4_vxlan_ipv4_pay)
+
+    def test_mac_ipv4_vxlan_ipv4_udp_pay(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv4_vxlan_ipv4_udp_pay)
+
+    def test_mac_ipv4_vxlan_ipv4_tcp(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv4_vxlan_ipv4_tcp)
+
+    def test_mac_ipv4_vxlan_mac_ipv4_frag(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv4_vxlan_mac_ipv4_frag)
+
+    def test_mac_ipv4_vxlan_mac_ipv4_pay(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv4_vxlan_mac_ipv4_pay)
+
+    def test_mac_ipv4_vxlan_mac_ipv4_udp_pay(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv4_vxlan_mac_ipv4_udp_pay)
+
+    def test_mac_ipv4_vxlan_mac_ipv4_tcp(self):
+        self.setup_1pf_vfs_env()
+        self._rte_flow_validate_pattern(tv_mac_ipv4_vxlan_mac_ipv4_tcp)
+
     def tear_down(self):
         """
         Run after each test case.