test suite reviews and discussions
 help / color / mirror / Atom feed
From: Lunyuan Cui <lunyuanx.cui@intel.com>
To: dts@dpdk.org
Cc: Lunyuan Cui <lunyuanx.cui@intel.com>
Subject: [dts] [PATCH V1 2/2] tests/TestSuite_generic_flow_api: add l2 mac addr fdir filter test case
Date: Tue, 31 Mar 2020 07:08:47 +0000	[thread overview]
Message-ID: <20200331070847.17395-3-lunyuanx.cui@intel.com> (raw)
In-Reply-To: <20200331070847.17395-1-lunyuanx.cui@intel.com>

FVL enable src MAC address and dst MAC address as FDIR's input set
for ipv4-other. Add test case for it.

Signed-off-by: Lunyuan Cui <lunyuanx.cui@intel.com>
---
 tests/TestSuite_generic_flow_api.py | 235 ++++++++++++++++++++++++++++
 1 file changed, 235 insertions(+)

diff --git a/tests/TestSuite_generic_flow_api.py b/tests/TestSuite_generic_flow_api.py
index bb42bf7..2c56ff0 100644
--- a/tests/TestSuite_generic_flow_api.py
+++ b/tests/TestSuite_generic_flow_api.py
@@ -884,6 +884,241 @@ class TestGeneric_flow_api(TestCase):
         rule_num = extrapkt_rulenum['rulenum']
         self.verify_rulenum(rule_num)
 
+    def sendpkt_check_result(self, src_mac, dst_mac, mark, mark_id, rss):
+
+        mark_info = "FDIR matched ID=0x%d" % mark_id
+
+        # packet type:I40E_FILTER_PCTYPE_NONF_IPV4_OTHER
+        self.sendpkt(pktstr='Ether(src="%s",dst="%s")/IP()' % (src_mac, dst_mac))
+        out_pf = self.dut.get_session_output(timeout=2)
+        if mark == 1:
+            self.verify(mark_info in out_pf, "the packet not mark the expect index.")
+        else:
+            if mark_info in out_pf:
+                raise Exception("the packet should not mark the expect index.")
+        if rss == 1:
+            self.verify("RSS queue=" in out_pf, "the packet not rss.")
+
+    def test_fdir_L2_mac_filter_basic(self):
+        """
+        only supported by i40e
+        """
+        self.verify(self.nic in ["fortville_eagle", "fortville_spirit",
+                                 "fortville_spirit_single", "fortpark_TLV"], "%s nic not support fdir vlan filter" % self.nic)
+
+        self.pmdout.start_testpmd("%s" % self.cores, "--rxq=%d --txq=%d" % (MAX_QUEUE+1, MAX_QUEUE+1), "-w %s --file-prefix=test1" % self.pf_pci)
+        self.dut.send_expect("port config all rss all", "testpmd> ", 120)
+        self.dut.send_expect("set fwd rxonly", "testpmd> ", 120)
+        self.dut.send_expect("set verbose 1", "testpmd> ", 120)
+        self.dut.send_expect("start", "testpmd> ", 120)
+        time.sleep(2)
+
+        # only dst mac
+        # validate
+        self.dut.send_expect(
+            "flow validate 0 ingress pattern eth dst is 11:11:11:11:11:11 / ipv4 / end actions mark id 1 / rss / end",
+            "validated")
+
+        # create
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth dst is 11:11:11:11:11:11 / ipv4 / end actions mark id 1 / rss / end",
+            "created")
+
+        self.sendpkt_check_result('99:99:99:99:99:99', '11:11:11:11:11:11', 1, 1, 1)
+        self.sendpkt_check_result('99:99:99:99:99:99', '22:22:22:22:22:22', 0, 1, 0)
+
+        # list
+        self.compare_memory_rules(1)
+
+        # destroy
+        self.dut.send_expect("flow destroy 0 rule 0", "testpmd> ", 120)
+
+        self.sendpkt_check_result('99:99:99:99:99:99', '11:11:11:11:11:11', 0, 1, 0)
+
+        self.compare_memory_rules(0)
+        self.dut.send_expect("flow flush 0", "testpmd> ")
+
+        # only src mac
+        # validate
+        self.dut.send_expect(
+            "flow validate 0 ingress pattern eth src is 99:99:99:99:99:99 / ipv4 / end actions mark id 1 / rss / end",
+            "validated")
+
+        # create
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth src is 99:99:99:99:99:99 / ipv4 / end actions mark id 1 / rss / end",
+            "created")
+
+        self.sendpkt_check_result('99:99:99:99:99:99', '11:11:11:11:11:11', 1, 1, 1)
+        self.sendpkt_check_result('88:88:88:88:88:88', '11:11:11:11:11:11', 0, 1, 0)
+
+        # list
+        self.compare_memory_rules(1)
+
+        # destroy
+        self.dut.send_expect("flow destroy 0 rule 0", "testpmd> ", 120)
+
+        self.sendpkt_check_result('99:99:99:99:99:99', '11:11:11:11:11:11', 0, 1, 0)
+
+        self.compare_memory_rules(0)
+        self.dut.send_expect("flow flush 0", "testpmd> ")
+
+        # dst mac and src mac
+        # validate
+        self.dut.send_expect(
+            "flow validate 0 ingress pattern eth src is 99:99:99:99:99:99 dst is 11:11:11:11:11:11 / ipv4 / end actions mark id 1 / rss / end",
+            "validated")
+
+        # create
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth src is 99:99:99:99:99:99 dst is 11:11:11:11:11:11 / ipv4 / end actions mark id 1 / rss / end",
+            "created")
+
+        self.sendpkt_check_result('99:99:99:99:99:99', '11:11:11:11:11:11', 1, 1, 1)
+        self.sendpkt_check_result('88:88:88:88:88:88', '11:11:11:11:11:11', 0, 1, 0)
+        self.sendpkt_check_result('99:99:99:99:99:99', '22:22:22:22:22:22', 0, 1, 0)
+        self.sendpkt_check_result('88:88:88:88:88:88', '22:22:22:22:22:22', 0, 1, 0)
+
+        # list
+        self.compare_memory_rules(1)
+
+        # destroy
+        self.dut.send_expect("flow destroy 0 rule 0", "testpmd> ", 120)
+
+        self.sendpkt_check_result('99:99:99:99:99:99', '11:11:11:11:11:11', 0, 1, 0)
+
+        self.compare_memory_rules(0)
+
+    def test_fdir_L2_mac_filter_complex(self):
+        """
+        only supported by i40e
+        """
+        self.verify(self.nic in ["fortville_eagle", "fortville_spirit",
+                                 "fortville_spirit_single", "fortpark_TLV"], "%s nic not support fdir vlan filter" % self.nic)
+
+        self.pmdout.start_testpmd("%s" % self.cores, "--rxq=%d --txq=%d" % (MAX_QUEUE+1, MAX_QUEUE+1), "-w %s --file-prefix=test1" % self.pf_pci)
+        self.dut.send_expect("port config all rss all", "testpmd> ", 120)
+        self.dut.send_expect("set fwd rxonly", "testpmd> ", 120)
+        self.dut.send_expect("set verbose 1", "testpmd> ", 120)
+        self.dut.send_expect("start", "testpmd> ", 120)
+        time.sleep(2)
+
+        # delete the first rule of three rules
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth dst is 11:11:11:11:11:11 / ipv4 / end actions mark id 1 / rss / end",
+            "created")
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth dst is 22:22:22:22:22:22 / ipv4 / end actions mark id 2 / rss / end",
+            "created")
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth dst is 33:33:33:33:33:33 / ipv4 / end actions mark id 3 / rss / end",
+            "created")
+
+        self.compare_memory_rules(3)
+
+        self.sendpkt_check_result('99:99:99:99:99:99', '11:11:11:11:11:11', 1, 1, 1)
+        self.sendpkt_check_result('99:99:99:99:99:99', '22:22:22:22:22:22', 1, 2, 1)
+        self.sendpkt_check_result('99:99:99:99:99:99', '33:33:33:33:33:33', 1, 3, 1)
+
+        self.dut.send_expect("flow destroy 0 rule 0", "testpmd> ", 120)
+
+        self.compare_memory_rules(2)
+
+        self.sendpkt_check_result('99:99:99:99:99:99', '11:11:11:11:11:11', 0, 1, 0)
+        self.sendpkt_check_result('99:99:99:99:99:99', '22:22:22:22:22:22', 1, 2, 1)
+        self.sendpkt_check_result('99:99:99:99:99:99', '33:33:33:33:33:33', 1, 3, 1)
+
+        self.dut.send_expect("flow flush 0", "testpmd> ")
+
+        self.sendpkt_check_result('99:99:99:99:99:99', '11:11:11:11:11:11', 0, 1, 0)
+        self.sendpkt_check_result('99:99:99:99:99:99', '22:22:22:22:22:22', 0, 2, 0)
+        self.sendpkt_check_result('99:99:99:99:99:99', '33:33:33:33:33:33', 0, 3, 0)
+
+        # delete the second rule of three rules
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth dst is 11:11:11:11:11:11 / ipv4 / end actions mark id 1 / rss / end",
+            "created")
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth dst is 22:22:22:22:22:22 / ipv4 / end actions mark id 2 / rss / end",
+            "created")
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth dst is 33:33:33:33:33:33 / ipv4 / end actions mark id 3 / rss / end",
+            "created")
+
+        self.dut.send_expect("flow destroy 0 rule 1", "testpmd> ", 120)
+
+        self.compare_memory_rules(2)
+
+        self.sendpkt_check_result('99:99:99:99:99:99', '11:11:11:11:11:11', 1, 1, 1)
+        self.sendpkt_check_result('99:99:99:99:99:99', '22:22:22:22:22:22', 0, 2, 0)
+        self.sendpkt_check_result('99:99:99:99:99:99', '33:33:33:33:33:33', 1, 3, 1)
+
+        self.dut.send_expect("flow flush 0", "testpmd> ")
+
+        # delete the third rule of three rules
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth dst is 11:11:11:11:11:11 / ipv4 / end actions mark id 1 / rss / end",
+            "created")
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth dst is 22:22:22:22:22:22 / ipv4 / end actions mark id 2 / rss / end",
+            "created")
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth dst is 33:33:33:33:33:33 / ipv4 / end actions mark id 3 / rss / end",
+            "created")
+
+        self.dut.send_expect("flow destroy 0 rule 2", "testpmd> ", 120)
+
+        self.compare_memory_rules(2)
+
+        self.sendpkt_check_result('99:99:99:99:99:99', '11:11:11:11:11:11', 1, 1, 1)
+        self.sendpkt_check_result('99:99:99:99:99:99', '22:22:22:22:22:22', 1, 2, 1)
+        self.sendpkt_check_result('99:99:99:99:99:99', '33:33:33:33:33:33', 0, 3, 0)
+
+        self.dut.send_expect("flow flush 0", "testpmd> ")
+
+    def test_fdir_L2_mac_filter_negative(self):
+        """
+        only supported by i40e
+        """
+        self.verify(self.nic in ["fortville_eagle", "fortville_spirit",
+                                 "fortville_spirit_single", "fortpark_TLV"], "%s nic not support fdir vlan filter" % self.nic)
+
+        self.pmdout.start_testpmd("%s" % self.cores, "--rxq=%d --txq=%d" % (MAX_QUEUE+1, MAX_QUEUE+1), "-w %s --file-prefix=test1" % self.pf_pci)
+        self.dut.send_expect("set fwd rxonly", "testpmd> ", 120)
+        self.dut.send_expect("set verbose 1", "testpmd> ", 120)
+        self.dut.send_expect("start", "testpmd> ", 120)
+        time.sleep(2)
+
+        # ip in command
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth dst is 11:11:11:11:11:11 / ipv4 dst is 1.1.1.1 / end actions mark id 2 / rss / end",
+            "error")
+
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth dst is 11:11:11:11:11:11 / ipv4 / end actions mark id 3 / rss / end",
+            "created")
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth src is 99:99:99:99:99:99 / ipv4 / end actions mark id 1 / rss / end",
+            "Invalid")
+
+        self.dut.send_expect("flow flush 0", "testpmd> ", 120)
+
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth src is 99:99:99:99:99:99 / ipv4 / end actions mark id 1 / rss / end",
+            "created")
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth src is 99:99:99:99:99:99 dst is 11:11:11:11:11:11 / ipv4 / end actions mark id 1 / rss / end",
+            "Invalid")
+
+        self.dut.send_expect("flow flush 0", "testpmd> ", 120)
+
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth src is 99:99:99:99:99:99 dst is 11:11:11:11:11:11 / ipv4 / end actions mark id 1 / rss / end",
+            "created")
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth dst is 11:11:11:11:11:11 / ipv4 / end actions mark id 3 / rss / end",
+            "Invalid")
+
     def test_fdir_for_vlan(self):
         """
         only supported by i40e
-- 
2.17.1


      parent reply	other threads:[~2020-03-31  7:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-31  7:08 [dts] [PATCH V1 0/2] add l2 mac addr fdir filter test Lunyuan Cui
2020-03-31  7:08 ` [dts] [PATCH V1 1/2] test_plans/generic_flow_api: add l2 mac addr fdir filter test plan Lunyuan Cui
2020-03-31  7:08 ` Lunyuan Cui [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200331070847.17395-3-lunyuanx.cui@intel.com \
    --to=lunyuanx.cui@intel.com \
    --cc=dts@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).