test suite reviews and discussions
 help / color / mirror / Atom feed
From: Xueqin Lin <xueqin.lin@intel.com>
To: dts@dpdk.org
Cc: Xueqin Lin <xueqin.lin@intel.com>
Subject: [dts] [PATCH v2] add vlan filter test script in vf daemon suite
Date: Thu, 20 Apr 2017 21:06:59 -0400	[thread overview]
Message-ID: <1492736819-8166-1-git-send-email-xueqin.lin@intel.com> (raw)

---
 tests/TestSuite_vf_daemon.py | 57 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)

diff --git a/tests/TestSuite_vf_daemon.py b/tests/TestSuite_vf_daemon.py
index 62532af..c9c09cf 100644
--- a/tests/TestSuite_vf_daemon.py
+++ b/tests/TestSuite_vf_daemon.py
@@ -634,6 +634,63 @@ class Testvf_daemon(TestCase):
 
         self.vm0_testpmd.quit()
         self.dut_testpmd.quit()
+    
+    
+    def test_vlan_filter(self):
+        """
+        Add/Remove vlan filter for a VF from PF
+        """
+        self.dut_testpmd.start_testpmd("Default", "--port-topology=chained")
+        self.vm0_testpmd.start_testpmd(VM_CORES_MASK, '--port-topology=chained')
+
+        self.vm0_testpmd.execute_cmd('set fwd rxonly')
+        self.vm0_testpmd.execute_cmd('set verbose 1')
+        self.vm0_testpmd.execute_cmd('start')
+
+        wrong_mac = '9E:AC:72:49:43:11'
+        out = self.send_and_pmdout(wrong_mac)
+        self.verify("dst=%s" % wrong_mac in out,
+            "Failed to receive untagged packet!!!")
+        random_vlan = random.randint(1, MAX_VLAN)
+        out = self.send_and_pmdout(wrong_mac, random_vlan)
+        self.verify("dst=%s" % wrong_mac in out,
+            "Failed to receive packet with vlan id!!!")
+        self.verify("VLAN tci=%s" % hex(random_vlan) in out,
+            "Failed to receive packet with vlan id!!!")
+        random_vlan = random.randint(2, MAX_VLAN - 1)
+        rx_vlans = [1, random_vlan, MAX_VLAN]
+        for rx_vlan in rx_vlans:
+            self.dut_testpmd.execute_cmd('rx_vlan add %s port 0 vf 1'% rx_vlan)
+            time.sleep(1)
+            out = self.send_and_pmdout(wrong_mac, rx_vlan)
+            self.verify("dst=%s" % wrong_mac in out,
+                "Failed to enable vlan filter!!!")
+            self.verify("VLAN tci=%s" % hex(rx_vlan) in out,
+                "Failed to receive packet with vlan id!!!")
+            wrong_rx_vlan = (rx_vlan + 1) % 4096
+            #Packet for vlan id 0 is equal to untagged packet for this case
+            if wrong_rx_vlan == 0:
+                wrong_rx_vlan = random.randint(1, MAX_VLAN - 1)
+            out = self.send_and_pmdout(wrong_mac, wrong_rx_vlan)
+            self.verify("dst=%s" % wrong_mac not in out,
+                "Failed to enable vlan filter!!!")
+            self.dut_testpmd.execute_cmd('rx_vlan rm %s port 0 vf 1'% rx_vlan)
+            out = self.send_and_pmdout(wrong_mac, rx_vlan)
+            self.verify("dst=%s" % wrong_mac in out,
+                "Failed to disable vlan filter!!!")
+            self.verify("VLAN tci=%s" % hex(rx_vlan) in out,
+                "Failed to receive packet with vlan id!!!")
+            out = self.send_and_pmdout(wrong_mac, wrong_rx_vlan)
+            self.verify("dst=%s" % wrong_mac in out,
+                "Failed to disable vlan filter!!!")
+            self.verify("VLAN tci=%s" % hex(wrong_rx_vlan) in out,
+                "Failed to receive packet with vlan id!!!")
+        out = self.send_and_pmdout(wrong_mac)
+        self.verify("dst=%s" % wrong_mac in out,
+            "Failed to receive untagged packet!!!")
+
+        self.vm0_testpmd.quit()
+        self.dut_testpmd.quit()
 
 
     def tear_down(self):
-- 
2.5.5

             reply	other threads:[~2017-04-21  7:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-21  1:06 Xueqin Lin [this message]
2017-04-21  7:08 ` Liu, Yong

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=1492736819-8166-1-git-send-email-xueqin.lin@intel.com \
    --to=xueqin.lin@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).