test suite reviews and discussions
 help / color / mirror / Atom feed
From: xiewei <weix.xie@intel.com>
To: dts@dpdk.org
Cc: xiewei <weix.xie@intel.com>
Subject: [dts] [PATCH V1] tests/cvl_vf_support_multicast_address: add vlan packet check
Date: Thu, 11 Mar 2021 23:38:05 +0800
Message-ID: <20210311153805.1297-1-weix.xie@intel.com> (raw)

a) add vlan packet check when set allmulti on
b) add a new test case: add vlan filter check when set allmulti off and configured multicast address

Signed-off-by: xiewei <weix.xie@intel.com>
---
 ...tSuite_cvl_vf_support_multicast_address.py | 75 ++++++++++++++++---
 1 file changed, 63 insertions(+), 12 deletions(-)

diff --git a/tests/TestSuite_cvl_vf_support_multicast_address.py b/tests/TestSuite_cvl_vf_support_multicast_address.py
index 1b148c6c..dd241a82 100644
--- a/tests/TestSuite_cvl_vf_support_multicast_address.py
+++ b/tests/TestSuite_cvl_vf_support_multicast_address.py
@@ -393,21 +393,23 @@ class TestCvlVfSupportMulticastAdress(TestCase):
 
         # send 5 packets
         pkt1 = 'Ether(dst="%s")/IP(src="224.0.0.1")/UDP(sport=22,dport=23)/("X"*480)' % mul_mac_0
-        pkt2 = 'Ether(dst="%s")/IP(src="224.192.16.1")/UDP(sport=22,dport=23)/("X"*480)' % mul_mac_1
-        pkt3 = 'Ether(dst="%s")/IP(src="192.168.0.1")/UDP(sport=22,dport=23)/("X"*480)' % vf0_mac
-        pkt4 = 'Ether(dst="%s")/IP(src="192.168.0.1")/UDP(sport=22,dport=23)/("X"*480)' % vf1_mac
-        pkt5 = 'Ether(dst="%s")/IP(src="192.168.0.1")/UDP(sport=22,dport=23)/("X"*480)' % vf0_wrong_mac
-        pkts = [pkt1, pkt2, pkt3, pkt4, pkt5]
+        pkt2 = 'Ether(dst="%s")/Dot1Q(vlan=1)/IP(src="224.0.0.1")/UDP(sport=22,dport=23)/("X"*480)' % mul_mac_0
+        pkt3 = 'Ether(dst="%s")/IP(src="224.192.16.1")/UDP(sport=22,dport=23)/("X"*480)' % mul_mac_1
+        pkt4 = 'Ether(dst="%s")/Dot1Q(vlan=2)/IP(src="224.192.16.1")/UDP(sport=22,dport=23)/("X"*480)' % mul_mac_1
+        pkt5 = 'Ether(dst="%s")/IP(src="192.168.0.1")/UDP(sport=22,dport=23)/("X"*480)' % vf0_mac
+        pkt6 = 'Ether(dst="%s")/IP(src="192.168.0.1")/UDP(sport=22,dport=23)/("X"*480)' % vf1_mac
+        pkt7 = 'Ether(dst="%s")/IP(src="192.168.0.1")/UDP(sport=22,dport=23)/("X"*480)' % vf0_wrong_mac
+        pkts = [pkt1, pkt2, pkt3, pkt4, pkt5, pkt6, pkt7]
         p = Packet()
         for i in pkts:
             p.append_pkt(i)
         p.send_pkt(self.tester, tx_port=self.tester_itf)
         output_1 = self.check_pkts_received()
-        self.verify(len(output_1) == 6, "Wrong number of pkts received")
-        self.verify(('0', vf0_mac) in output_1, "pkt3 can't be received by port 0")
-        self.verify(('1', vf1_mac) in output_1, "pkt4 can't be received by port 1")
-        self.verify(('0', mul_mac_0) in output_1 and ('0', mul_mac_1) in output_1, "pkt1-2 can't be received by port 0")
-        self.verify(('1', mul_mac_0) in output_1 and ('1', mul_mac_1) in output_1, "pkt1-2 can't be received by port 1")
+        self.verify(len(output_1) == 10, "Wrong number of pkts received")
+        self.verify(('0', vf0_mac) in output_1, "pkt5 can't be received by port 0")
+        self.verify(('1', vf1_mac) in output_1, "pkt6 can't be received by port 1")
+        self.verify(('0', mul_mac_0) in output_1 and ('0', mul_mac_1) in output_1, "pkt1-4 can't be received by port 0")
+        self.verify(('1', mul_mac_0) in output_1 and ('1', mul_mac_1) in output_1, "pkt1-4 can't be received by port 1")
 
         # set allmulti off and promisc on
         self.pmd_output.execute_cmd("set promisc all on")
@@ -416,8 +418,8 @@ class TestCvlVfSupportMulticastAdress(TestCase):
         p.send_pkt(self.tester, tx_port=self.tester_itf)
         output_2 = self.check_pkts_received()
         self.verify(len(output_2) == 6, "Wrong number of pkts received")
-        self.verify(('0', vf0_mac) in output_2 and ('0', vf1_mac) in output_2 and ('0', vf0_wrong_mac) in output_2, "pkt3-5 can't be received by port 0")
-        self.verify(('1', vf0_mac) in output_2 and ('1', vf1_mac) in output_2 and ('1', vf0_wrong_mac) in output_2, "pkt3-5 can't be received by port 1")
+        self.verify(('0', vf0_mac) in output_2 and ('0', vf1_mac) in output_2 and ('0', vf0_wrong_mac) in output_2, "pkt5-7 can't be received by port 0")
+        self.verify(('1', vf0_mac) in output_2 and ('1', vf1_mac) in output_2 and ('1', vf0_wrong_mac) in output_2, "pkt5-7 can't be received by port 1")
 
     def test_negative_case(self):
         # send one packet
@@ -469,6 +471,55 @@ class TestCvlVfSupportMulticastAdress(TestCase):
         output_6 = self.check_pkts_received()
         self.verify(len(output_6) == 0, "Wrong number of pkts received")
 
+    def test_set_vlan_filter_on(self):
+        # send 4 packets
+        pkt1 = 'Ether(dst="%s")/IP(src="224.0.0.1")/UDP(sport=22,dport=23)/("X"*480)' % mul_mac_0
+        pkt2 = 'Ether(dst="%s")/Dot1Q(vlan=1)/IP(src="224.0.0.1")/UDP(sport=22,dport=23)/("X"*480)' % mul_mac_0
+        pkt3 = 'Ether(dst="%s")/IP(src="224.192.16.1")/UDP(sport=22,dport=23)/("X"*480)' % mul_mac_1
+        pkt4 = 'Ether(dst="%s")/Dot1Q(vlan=1)/IP(src="224.192.16.1")/UDP(sport=22,dport=23)/("X"*480)' % mul_mac_1
+        pkts = [pkt1, pkt2, pkt3, pkt4]
+        p = Packet()
+        for i in pkts:
+            p.append_pkt(i)
+        p.send_pkt(self.tester, tx_port=self.tester_itf)
+        out_1 = self.check_pkts_received()
+        self.verify(len(out_1) == 0, "pkt1-4 can be received by any port")
+
+        # configure multicast address
+        self.pmd_output.execute_cmd("mcast_addr add 0 %s" % mul_mac_0)
+        self.check_ports_multicast_address_number(1, 0)
+        # send 4 packets
+        p.send_pkt(self.tester, tx_port=self.tester_itf)
+        out_2 = self.check_pkts_received()
+        self.verify(len(out_2) == 1, "Wrong number of pkts received")
+        self.verify(('0', mul_mac_0) in out_2, "pkt1 can't be received by port 0")
+
+        # set vlan filter on
+        self.pmd_output.execute_cmd("vlan set filter on 0")
+        self.pmd_output.execute_cmd("rx_vlan add 1 0")
+        # send 4 packets
+        p.send_pkt(self.tester, tx_port=self.tester_itf)
+        out_3 = self.check_pkts_received()
+        self.verify(len(out_3) == 2, "Wrong number of pkts received")
+        self.verify(('0', mul_mac_0) in out_3, "pkt1-2 can't be received by port 0")
+        self.verify(('0', mul_mac_1) not in out_3, "other pkt can be received by port 0")
+
+        # remove the vlan filter
+        self.pmd_output.execute_cmd("rx_vlan rm 1 0")
+        # send 4 packets
+        p.send_pkt(self.tester, tx_port=self.tester_itf)
+        out_4 = self.check_pkts_received()
+        self.verify(len(out_4) == 1, "Wrong number of pkts received")
+        self.verify(('0', mul_mac_0) in out_4, "pkt1 can't be received by port 0")
+
+        # remove the multicast address configuration
+        self.pmd_output.execute_cmd("mcast_addr remove 0 %s" % mul_mac_0)
+        self.check_ports_multicast_address_number(0, 0)
+        # send 4 packets
+        p.send_pkt(self.tester, tx_port=self.tester_itf)
+        out_5 = self.check_pkts_received()
+        self.verify(len(out_5) == 0, "pkt1-4 can be received by any port")
+
     def tear_down(self):
         """
         Run after each test case.
-- 
2.17.1


             reply	other threads:[~2021-03-11  7:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-11 15:38 xiewei [this message]
2021-03-11  7:14 ` Xie, WeiX
2021-03-12  8:46 ` Peng, Yuan
2021-03-15  7:15 ` Tu, Lijuan

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=20210311153805.1297-1-weix.xie@intel.com \
    --to=weix.xie@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

test suite reviews and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://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/ https://inbox.dpdk.org/dts \
		dts@dpdk.org
	public-inbox-index dts

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dts


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