test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH V2] tests/port_representor:new automation of port_representor
@ 2019-11-18  2:53 Xie Wei
  2019-11-18  3:03 ` Zeng, XiaoxiaoX
  2019-11-27  9:01 ` Tu, Lijuan
  0 siblings, 2 replies; 4+ messages in thread
From: Xie Wei @ 2019-11-18  2:53 UTC (permalink / raw)
  To: dts; +Cc: Xie Wei

new automation of port_representor

Signed-off-by: Xie Wei <weix.xie@intel.com>
---
 tests/TestSuite_port_representor.py | 270 ++++++++++++++++++++++++++++
 1 file changed, 270 insertions(+)
 create mode 100644 tests/TestSuite_port_representor.py

diff --git a/tests/TestSuite_port_representor.py b/tests/TestSuite_port_representor.py
new file mode 100644
index 0000000..04f7838
--- /dev/null
+++ b/tests/TestSuite_port_representor.py
@@ -0,0 +1,270 @@
+# BSD LICENSE
+#
+# Copyright(c) <2019> Intel Corporation. All rights reserved.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+#   * Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+#   * Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in
+#     the documentation and/or other materials provided with the
+#     distribution.
+#   * Neither the name of Intel Corporation nor the names of its
+#     contributors may be used to endorse or promote products derived
+#     from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Use two representor ports as the control plane to manage the two VFs,
+the control plane could change VFs behavior such as change promiscous
+mode, stats reset, etc. our statistical data information is
+independent on the control plane and data plane.
+"""
+
+import time
+import re
+
+from test_case import TestCase
+from dut import Dut
+from packet import Packet
+from pmd_output import PmdOutput
+
+
+class TestPortRepresentor(TestCase):
+    def set_up_all(self):
+        """
+        Prerequisite steps for each test suite.
+        """
+        self.verify(self.nic in ["fortville_eagle", "fortville_spirit",
+                                 "fortville_spirit_single", "fortville_25g"], "NIC Unsupported: " + str(self.nic))
+        self.dut_ports = self.dut.get_ports(self.nic)
+        self.verify(len(self.dut_ports) >= 1, "Insufficient ports")
+
+        self.session_secondary = self.dut.new_session()
+        self.session_third = self.dut.new_session()
+        self.pmdout_pf = PmdOutput(self.dut)
+        self.pmdout_vf0 = PmdOutput(self.dut, self.session_secondary)
+        self.pmdout_vf1 = PmdOutput(self.dut, self.session_third)
+
+        localPort = self.tester.get_local_port(self.dut_ports[0])
+        self.tester_itf = self.tester.get_interface(localPort)
+        self.tester_mac = self.tester.get_mac(localPort)
+        self.pf_mac = self.dut.get_mac_address(0)
+        self.pf_pci = self.dut.ports_info[self.dut_ports[0]]['pci']
+
+        self.unicast_mac = "00:11:22:33:44:55"
+
+        # This is to set up 1pf and 2vfs environment
+        # PF is bound to igb_uio, while VF is bound to vfio-pci.
+        self.dut.generate_sriov_vfs_by_port(self.dut_ports[0], 2, "igb_uio")
+        self.two_vfs_port = self.dut.ports_info[self.dut_ports[0]]["vfs_port"]
+        self.dut.send_expect("modprobe vfio-pci", "#", 3)
+        try:
+            for port in self.two_vfs_port:
+                port.bind_driver(driver="vfio-pci")
+        except Exception as e:
+            self.destroy_env()
+            raise Exception(e)
+        self.vfs_pci = self.dut.ports_info[self.dut_ports[0]]['sriov_vfs_pci']
+
+    def set_up(self):
+        """
+        Run before each test case.
+        """
+        self.vf_flag = 1
+
+    def destroy_env(self):
+        """
+        This is to stop testpmd and destroy 1pf and 2vfs environment.
+        """
+        if self.vf_flag == 1:
+            self.pmdout_vf1.execute_cmd("quit", "#")
+            time.sleep(3)
+            self.pmdout_vf0.execute_cmd("quit", "#")
+            time.sleep(3)
+            self.pmdout_pf.execute_cmd("quit", "#")
+            time.sleep(3)
+        else:
+            self.pmdout_pf.execute_cmd("quit", "#")
+        self.vf_flag = 0
+
+    def testpmd_pf(self):
+        self.pmdout_pf.start_testpmd("Default", eal_param="-w %s,representor=0-1" % self.pf_pci, param="--port-topology=chained")
+
+    def testpmd_vf0(self):
+        self.out_vf0 = self.pmdout_vf0.start_testpmd("Default", eal_param="-w %s --file-prefix testpmd-vf0" % self.vfs_pci[0])
+        self.vf0_mac = self.pmdout_vf0.get_port_mac(0)
+
+    def testpmd_vf1(self):
+        self.out_vf1 = self.pmdout_vf1.start_testpmd("Default", eal_param="-w %s --file-prefix testpmd-vf1" % self.vfs_pci[1])
+        self.vf1_mac = self.pmdout_vf1.get_port_mac(0)
+
+    def check_port_stats(self):
+        """
+        show and check port stats
+        """
+        out = self.pmdout_pf.execute_cmd("show port stats all", "testpmd>")
+        self.logger.info(out)
+        result = re.compile('RX-packets:\s+(.*?)\s+?').findall(out, re.S)
+        return result
+
+    def clear_port_stats(self):
+        """
+        clear port stats in control testpmd
+        """
+        self.pmdout_pf.execute_cmd("clear vf stats 0 0", "testpmd>", 2)
+        self.pmdout_pf.execute_cmd("clear vf stats 0 1", "testpmd>", 2)
+        self.pmdout_pf.execute_cmd("clear port stats all", "testpmd>", 2)
+
+    def test_port_representor_vf_stats_show_and_clear(self):
+        """
+        use control testpmd to get and clear dataplane testpmd ports Stats
+        """
+        self.testpmd_pf()
+        self.pmdout_pf.execute_cmd("set promisc 0 off", "testpmd>")
+        self.pmdout_pf.execute_cmd("start", "testpmd>", 2)
+        self.testpmd_vf0()
+        self.pmdout_vf0.execute_cmd("set promisc 0 off", "testpmd>")
+        self.pmdout_vf0.execute_cmd("start", "testpmd>", 2)
+        self.testpmd_vf1()
+        self.pmdout_vf1.execute_cmd("set promisc 0 off", "testpmd>")
+        self.pmdout_vf1.execute_cmd("start", "testpmd>", 2)
+        # send 30 packets
+        pkt1 = 'Ether(src="%s",dst="%s")/IP()' % (self.tester_mac, self.pf_mac)
+        pkt2 = 'Ether(src="%s",dst="%s")/IP()' % (self.tester_mac, self.vf0_mac)
+        pkt3 = 'Ether(src="%s",dst="%s")/IP()' % (self.tester_mac, self.vf1_mac)
+        pkts = [pkt1, pkt2, pkt3]
+        p = Packet()
+        for i in pkts:
+            p.append_pkt(i)
+        p.send_pkt(self.tester, tx_port=self.tester_itf, count=10)
+        # check port stats in control testpmd
+        result_before = self.check_port_stats()
+        self.verify(int(result_before[1]) == 10 and int(result_before[2]) == 10, "VF Stats show error")
+        self.clear_port_stats()
+        result_after = self.check_port_stats()
+        self.verify(int(result_after[1]) == 0 and int(result_after[2]) == 0, "VF Stats clear error")
+
+    def test_port_representor_vf_promiscous(self):
+        """
+        use control testpmd to enable/disable dataplane testpmd ports promiscous mode
+        """
+        self.testpmd_pf()
+        self.pmdout_pf.execute_cmd("set promisc 0 off", "testpmd>")
+        self.pmdout_pf.execute_cmd("start", "testpmd>", 2)
+        self.testpmd_vf0()
+        self.pmdout_vf0.execute_cmd("start", "testpmd>", 2)
+        self.testpmd_vf1()
+        self.pmdout_vf1.execute_cmd("start", "testpmd>", 2)
+
+        # set vf promisc enable and send 40 packets
+        self.pmdout_pf.execute_cmd("set promisc 1 on", "testpmd>")
+        pkt1 = 'Ether(src="%s",dst="%s")/IP()' % (self.tester_mac, self.pf_mac)
+        pkt2 = 'Ether(src="%s",dst="%s")/IP()' % (self.tester_mac, self.vf0_mac)
+        pkt3 = 'Ether(src="%s",dst="%s")/IP()' % (self.tester_mac, self.vf1_mac)
+        pkt4 = 'Ether(src="%s",dst="%s")/IP()' % (self.tester_mac, self.unicast_mac)
+        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, count=10)
+        # check port stats in control testpmd
+        result_enable = self.check_port_stats()
+        self.verify(int(result_enable[1]) == 20 and int(result_enable[2]) == 20, "VFs receive packets error")
+        self.clear_port_stats()
+        # set vf promisc disable and send 40 packets
+        self.pmdout_pf.execute_cmd("set promisc 1 off", "testpmd>")
+        p = Packet()
+        for i in pkts:
+            p.append_pkt(i)
+        p.send_pkt(self.tester, tx_port=self.tester_itf, count=10)
+        # check port stats in control testpmd
+        result_disable = self.check_port_stats()
+        self.verify(int(result_disable[1]) == 10 and int(result_disable[2]) == 20, "VFs receive packets error")
+
+    def test_port_representor_vf_mac_addr(self):
+        """
+        use control testpmd to set vf mac address
+        """
+        self.testpmd_pf()
+        self.pmdout_pf.execute_cmd("mac_addr set 1 aa:11:22:33:44:55", "testpmd>")
+        self.pmdout_pf.execute_cmd("mac_addr set 2 aa:22:33:44:55:66", "testpmd>")
+        self.pmdout_pf.execute_cmd("set promisc 0 off", "testpmd>")
+        self.pmdout_pf.execute_cmd("start", "testpmd>", 2)
+        self.testpmd_vf0()
+        self.pmdout_vf0.execute_cmd("set promisc 0 off", "testpmd>")
+        self.pmdout_vf0.execute_cmd("start", "testpmd>", 2)
+        self.testpmd_vf1()
+        self.pmdout_vf1.execute_cmd("set promisc 0 off", "testpmd>")
+        self.pmdout_vf1.execute_cmd("start", "testpmd>", 2)
+        # send 40 packets
+        pkt1 = 'Ether(src="%s",dst="%s")/IP()' % (self.tester_mac, self.pf_mac)
+        pkt2 = 'Ether(src="%s",dst="%s")/IP()' % (self.tester_mac, self.vf0_mac)
+        pkt3 = 'Ether(src="%s",dst="%s")/IP()' % (self.tester_mac, self.vf1_mac)
+        pkt4 = 'Ether(src="%s",dst="%s")/IP()' % (self.tester_mac, self.unicast_mac)
+        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, count=10)
+        # check port stats in control testpmd
+        result = self.check_port_stats()
+        self.verify(int(result[1]) == 10 and int(result[2]) == 10, "VFs receive packets error")
+
+    def test_port_representor_vlan_filter(self):
+        """
+        use control testpmd to set vlan
+        """
+        self.testpmd_pf()
+        self.pmdout_pf.execute_cmd("set promisc 1 off", "testpmd>")
+        self.pmdout_pf.execute_cmd("vlan set filter on 1", "testpmd>")
+        self.pmdout_pf.execute_cmd("rx_vlan add 3 1", "testpmd>")
+        self.pmdout_pf.execute_cmd("set promisc 2 off", "testpmd>")
+        self.pmdout_pf.execute_cmd("vlan set filter on 2", "testpmd>")
+        self.pmdout_pf.execute_cmd("rx_vlan add 4 2", "testpmd>")
+        self.pmdout_pf.execute_cmd("start", "testpmd>", 2)
+        self.testpmd_vf0()
+        self.pmdout_vf0.execute_cmd("start", "testpmd>", 2)
+        self.testpmd_vf1()
+        self.pmdout_vf1.execute_cmd("start", "testpmd>", 2)
+        # send 20 packets
+        pkt1 = 'Ether(src="%s",dst="%s")/Dot1Q(vlan=3)/IP()' % (self.tester_mac, self.vf0_mac)
+        pkt2 = 'Ether(src="%s",dst="%s")/Dot1Q(vlan=4)/IP()' % (self.tester_mac, self.vf1_mac)
+        pkts = [pkt1, pkt2]
+        p = Packet()
+        for i in pkts:
+            p.append_pkt(i)
+        p.send_pkt(self.tester, tx_port=self.tester_itf, count=10)
+        # check port stats in control testpmd
+        result = self.check_port_stats()
+        self.verify(int(result[1]) == 10 and int(result[2]) == 10, "VFs receive packets error")
+
+    def tear_down(self):
+        """
+        Run after each test case.
+        """
+        self.destroy_env()
+
+    def tear_down_all(self):
+        """
+        Run after each test suite.
+        """
+        self.dut.kill_all()
+        self.dut.destroy_sriov_vfs_by_port(self.dut_ports[0])
+        self.dut.close_session(self.session_secondary)
+        self.dut.close_session(self.session_third)
-- 
2.17.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dts] [PATCH V2] tests/port_representor:new automation of port_representor
  2019-11-18  2:53 [dts] [PATCH V2] tests/port_representor:new automation of port_representor Xie Wei
@ 2019-11-18  3:03 ` Zeng, XiaoxiaoX
  2019-11-25  1:15   ` Zhang, Yuwei1
  2019-11-27  9:01 ` Tu, Lijuan
  1 sibling, 1 reply; 4+ messages in thread
From: Zeng, XiaoxiaoX @ 2019-11-18  3:03 UTC (permalink / raw)
  To: Xie, WeiX, dts; +Cc: Xie, WeiX

[-- Attachment #1: Type: text/plain, Size: 13341 bytes --]

Tested-by:  Zeng,XiaoxiaoX< xiaoxiaox.zeng@intel.com>

-----Original Message-----
From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Xie Wei
Sent: Monday, November 18, 2019 10:54 AM
To: dts@dpdk.org
Cc: Xie, WeiX <weix.xie@intel.com>
Subject: [dts] [PATCH V2] tests/port_representor:new automation of port_representor

new automation of port_representor

Signed-off-by: Xie Wei <weix.xie@intel.com>
---
 tests/TestSuite_port_representor.py | 270 ++++++++++++++++++++++++++++
 1 file changed, 270 insertions(+)
 create mode 100644 tests/TestSuite_port_representor.py

diff --git a/tests/TestSuite_port_representor.py b/tests/TestSuite_port_representor.py
new file mode 100644
index 0000000..04f7838
--- /dev/null
+++ b/tests/TestSuite_port_representor.py
@@ -0,0 +1,270 @@
+# BSD LICENSE
+#
+# Copyright(c) <2019> Intel Corporation. All rights reserved.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without # 
+modification, are permitted provided that the following conditions # 
+are met:
+#
+#   * Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+#   * Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in
+#     the documentation and/or other materials provided with the
+#     distribution.
+#   * Neither the name of Intel Corporation nor the names of its
+#     contributors may be used to endorse or promote products derived
+#     from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # 
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # 
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # 
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # 
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # 
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # 
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # 
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # 
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # 
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # 
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Use two representor ports as the control plane to manage the two VFs, 
+the control plane could change VFs behavior such as change promiscous 
+mode, stats reset, etc. our statistical data information is independent 
+on the control plane and data plane.
+"""
+
+import time
+import re
+
+from test_case import TestCase
+from dut import Dut
+from packet import Packet
+from pmd_output import PmdOutput
+
+
+class TestPortRepresentor(TestCase):
+    def set_up_all(self):
+        """
+        Prerequisite steps for each test suite.
+        """
+        self.verify(self.nic in ["fortville_eagle", "fortville_spirit",
+                                 "fortville_spirit_single", "fortville_25g"], "NIC Unsupported: " + str(self.nic))
+        self.dut_ports = self.dut.get_ports(self.nic)
+        self.verify(len(self.dut_ports) >= 1, "Insufficient ports")
+
+        self.session_secondary = self.dut.new_session()
+        self.session_third = self.dut.new_session()
+        self.pmdout_pf = PmdOutput(self.dut)
+        self.pmdout_vf0 = PmdOutput(self.dut, self.session_secondary)
+        self.pmdout_vf1 = PmdOutput(self.dut, self.session_third)
+
+        localPort = self.tester.get_local_port(self.dut_ports[0])
+        self.tester_itf = self.tester.get_interface(localPort)
+        self.tester_mac = self.tester.get_mac(localPort)
+        self.pf_mac = self.dut.get_mac_address(0)
+        self.pf_pci = self.dut.ports_info[self.dut_ports[0]]['pci']
+
+        self.unicast_mac = "00:11:22:33:44:55"
+
+        # This is to set up 1pf and 2vfs environment
+        # PF is bound to igb_uio, while VF is bound to vfio-pci.
+        self.dut.generate_sriov_vfs_by_port(self.dut_ports[0], 2, "igb_uio")
+        self.two_vfs_port = self.dut.ports_info[self.dut_ports[0]]["vfs_port"]
+        self.dut.send_expect("modprobe vfio-pci", "#", 3)
+        try:
+            for port in self.two_vfs_port:
+                port.bind_driver(driver="vfio-pci")
+        except Exception as e:
+            self.destroy_env()
+            raise Exception(e)
+        self.vfs_pci = 
+ self.dut.ports_info[self.dut_ports[0]]['sriov_vfs_pci']
+
+    def set_up(self):
+        """
+        Run before each test case.
+        """
+        self.vf_flag = 1
+
+    def destroy_env(self):
+        """
+        This is to stop testpmd and destroy 1pf and 2vfs environment.
+        """
+        if self.vf_flag == 1:
+            self.pmdout_vf1.execute_cmd("quit", "#")
+            time.sleep(3)
+            self.pmdout_vf0.execute_cmd("quit", "#")
+            time.sleep(3)
+            self.pmdout_pf.execute_cmd("quit", "#")
+            time.sleep(3)
+        else:
+            self.pmdout_pf.execute_cmd("quit", "#")
+        self.vf_flag = 0
+
+    def testpmd_pf(self):
+        self.pmdout_pf.start_testpmd("Default", eal_param="-w 
+ %s,representor=0-1" % self.pf_pci, param="--port-topology=chained")
+
+    def testpmd_vf0(self):
+        self.out_vf0 = self.pmdout_vf0.start_testpmd("Default", eal_param="-w %s --file-prefix testpmd-vf0" % self.vfs_pci[0])
+        self.vf0_mac = self.pmdout_vf0.get_port_mac(0)
+
+    def testpmd_vf1(self):
+        self.out_vf1 = self.pmdout_vf1.start_testpmd("Default", eal_param="-w %s --file-prefix testpmd-vf1" % self.vfs_pci[1])
+        self.vf1_mac = self.pmdout_vf1.get_port_mac(0)
+
+    def check_port_stats(self):
+        """
+        show and check port stats
+        """
+        out = self.pmdout_pf.execute_cmd("show port stats all", "testpmd>")
+        self.logger.info(out)
+        result = re.compile('RX-packets:\s+(.*?)\s+?').findall(out, re.S)
+        return result
+
+    def clear_port_stats(self):
+        """
+        clear port stats in control testpmd
+        """
+        self.pmdout_pf.execute_cmd("clear vf stats 0 0", "testpmd>", 2)
+        self.pmdout_pf.execute_cmd("clear vf stats 0 1", "testpmd>", 2)
+        self.pmdout_pf.execute_cmd("clear port stats all", "testpmd>", 
+ 2)
+
+    def test_port_representor_vf_stats_show_and_clear(self):
+        """
+        use control testpmd to get and clear dataplane testpmd ports Stats
+        """
+        self.testpmd_pf()
+        self.pmdout_pf.execute_cmd("set promisc 0 off", "testpmd>")
+        self.pmdout_pf.execute_cmd("start", "testpmd>", 2)
+        self.testpmd_vf0()
+        self.pmdout_vf0.execute_cmd("set promisc 0 off", "testpmd>")
+        self.pmdout_vf0.execute_cmd("start", "testpmd>", 2)
+        self.testpmd_vf1()
+        self.pmdout_vf1.execute_cmd("set promisc 0 off", "testpmd>")
+        self.pmdout_vf1.execute_cmd("start", "testpmd>", 2)
+        # send 30 packets
+        pkt1 = 'Ether(src="%s",dst="%s")/IP()' % (self.tester_mac, self.pf_mac)
+        pkt2 = 'Ether(src="%s",dst="%s")/IP()' % (self.tester_mac, self.vf0_mac)
+        pkt3 = 'Ether(src="%s",dst="%s")/IP()' % (self.tester_mac, self.vf1_mac)
+        pkts = [pkt1, pkt2, pkt3]
+        p = Packet()
+        for i in pkts:
+            p.append_pkt(i)
+        p.send_pkt(self.tester, tx_port=self.tester_itf, count=10)
+        # check port stats in control testpmd
+        result_before = self.check_port_stats()
+        self.verify(int(result_before[1]) == 10 and int(result_before[2]) == 10, "VF Stats show error")
+        self.clear_port_stats()
+        result_after = self.check_port_stats()
+        self.verify(int(result_after[1]) == 0 and int(result_after[2]) 
+ == 0, "VF Stats clear error")
+
+    def test_port_representor_vf_promiscous(self):
+        """
+        use control testpmd to enable/disable dataplane testpmd ports promiscous mode
+        """
+        self.testpmd_pf()
+        self.pmdout_pf.execute_cmd("set promisc 0 off", "testpmd>")
+        self.pmdout_pf.execute_cmd("start", "testpmd>", 2)
+        self.testpmd_vf0()
+        self.pmdout_vf0.execute_cmd("start", "testpmd>", 2)
+        self.testpmd_vf1()
+        self.pmdout_vf1.execute_cmd("start", "testpmd>", 2)
+
+        # set vf promisc enable and send 40 packets
+        self.pmdout_pf.execute_cmd("set promisc 1 on", "testpmd>")
+        pkt1 = 'Ether(src="%s",dst="%s")/IP()' % (self.tester_mac, self.pf_mac)
+        pkt2 = 'Ether(src="%s",dst="%s")/IP()' % (self.tester_mac, self.vf0_mac)
+        pkt3 = 'Ether(src="%s",dst="%s")/IP()' % (self.tester_mac, self.vf1_mac)
+        pkt4 = 'Ether(src="%s",dst="%s")/IP()' % (self.tester_mac, self.unicast_mac)
+        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, count=10)
+        # check port stats in control testpmd
+        result_enable = self.check_port_stats()
+        self.verify(int(result_enable[1]) == 20 and int(result_enable[2]) == 20, "VFs receive packets error")
+        self.clear_port_stats()
+        # set vf promisc disable and send 40 packets
+        self.pmdout_pf.execute_cmd("set promisc 1 off", "testpmd>")
+        p = Packet()
+        for i in pkts:
+            p.append_pkt(i)
+        p.send_pkt(self.tester, tx_port=self.tester_itf, count=10)
+        # check port stats in control testpmd
+        result_disable = self.check_port_stats()
+        self.verify(int(result_disable[1]) == 10 and 
+ int(result_disable[2]) == 20, "VFs receive packets error")
+
+    def test_port_representor_vf_mac_addr(self):
+        """
+        use control testpmd to set vf mac address
+        """
+        self.testpmd_pf()
+        self.pmdout_pf.execute_cmd("mac_addr set 1 aa:11:22:33:44:55", "testpmd>")
+        self.pmdout_pf.execute_cmd("mac_addr set 2 aa:22:33:44:55:66", "testpmd>")
+        self.pmdout_pf.execute_cmd("set promisc 0 off", "testpmd>")
+        self.pmdout_pf.execute_cmd("start", "testpmd>", 2)
+        self.testpmd_vf0()
+        self.pmdout_vf0.execute_cmd("set promisc 0 off", "testpmd>")
+        self.pmdout_vf0.execute_cmd("start", "testpmd>", 2)
+        self.testpmd_vf1()
+        self.pmdout_vf1.execute_cmd("set promisc 0 off", "testpmd>")
+        self.pmdout_vf1.execute_cmd("start", "testpmd>", 2)
+        # send 40 packets
+        pkt1 = 'Ether(src="%s",dst="%s")/IP()' % (self.tester_mac, self.pf_mac)
+        pkt2 = 'Ether(src="%s",dst="%s")/IP()' % (self.tester_mac, self.vf0_mac)
+        pkt3 = 'Ether(src="%s",dst="%s")/IP()' % (self.tester_mac, self.vf1_mac)
+        pkt4 = 'Ether(src="%s",dst="%s")/IP()' % (self.tester_mac, self.unicast_mac)
+        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, count=10)
+        # check port stats in control testpmd
+        result = self.check_port_stats()
+        self.verify(int(result[1]) == 10 and int(result[2]) == 10, "VFs 
+ receive packets error")
+
+    def test_port_representor_vlan_filter(self):
+        """
+        use control testpmd to set vlan
+        """
+        self.testpmd_pf()
+        self.pmdout_pf.execute_cmd("set promisc 1 off", "testpmd>")
+        self.pmdout_pf.execute_cmd("vlan set filter on 1", "testpmd>")
+        self.pmdout_pf.execute_cmd("rx_vlan add 3 1", "testpmd>")
+        self.pmdout_pf.execute_cmd("set promisc 2 off", "testpmd>")
+        self.pmdout_pf.execute_cmd("vlan set filter on 2", "testpmd>")
+        self.pmdout_pf.execute_cmd("rx_vlan add 4 2", "testpmd>")
+        self.pmdout_pf.execute_cmd("start", "testpmd>", 2)
+        self.testpmd_vf0()
+        self.pmdout_vf0.execute_cmd("start", "testpmd>", 2)
+        self.testpmd_vf1()
+        self.pmdout_vf1.execute_cmd("start", "testpmd>", 2)
+        # send 20 packets
+        pkt1 = 'Ether(src="%s",dst="%s")/Dot1Q(vlan=3)/IP()' % (self.tester_mac, self.vf0_mac)
+        pkt2 = 'Ether(src="%s",dst="%s")/Dot1Q(vlan=4)/IP()' % (self.tester_mac, self.vf1_mac)
+        pkts = [pkt1, pkt2]
+        p = Packet()
+        for i in pkts:
+            p.append_pkt(i)
+        p.send_pkt(self.tester, tx_port=self.tester_itf, count=10)
+        # check port stats in control testpmd
+        result = self.check_port_stats()
+        self.verify(int(result[1]) == 10 and int(result[2]) == 10, "VFs 
+ receive packets error")
+
+    def tear_down(self):
+        """
+        Run after each test case.
+        """
+        self.destroy_env()
+
+    def tear_down_all(self):
+        """
+        Run after each test suite.
+        """
+        self.dut.kill_all()
+        self.dut.destroy_sriov_vfs_by_port(self.dut_ports[0])
+        self.dut.close_session(self.session_secondary)
+        self.dut.close_session(self.session_third)
--
2.17.2


[-- Attachment #2: TestPortRepresentor.log --]
[-- Type: application/octet-stream, Size: 52728 bytes --]

18/11/2019 22:27:41                            dts: 
TEST SUITE : TestPortRepresentor
18/11/2019 22:27:41                            dts: NIC :        fortville_eagle
18/11/2019 22:27:41             dut.10.240.176.208: 
18/11/2019 22:27:41                         tester: 
18/11/2019 22:27:47             dut.10.240.176.208: cat /sys/bus/pci/devices/0000\:81\:02.0/vendor
18/11/2019 22:27:47             dut.10.240.176.208: 0x8086
18/11/2019 22:27:47             dut.10.240.176.208: cat /sys/bus/pci/devices/0000\:81\:02.0/device
18/11/2019 22:27:48             dut.10.240.176.208: 0x154c
18/11/2019 22:27:48             dut.10.240.176.208: cat /sys/bus/pci/devices/0000\:81\:02.0/vendor
18/11/2019 22:27:48             dut.10.240.176.208: 0x8086
18/11/2019 22:27:48             dut.10.240.176.208: cat /sys/bus/pci/devices/0000\:81\:02.0/device
18/11/2019 22:27:48             dut.10.240.176.208: 0x154c
18/11/2019 22:27:48             dut.10.240.176.208: cat /sys/bus/pci/devices/0000\:81\:02.1/vendor
18/11/2019 22:27:48             dut.10.240.176.208: 0x8086
18/11/2019 22:27:48             dut.10.240.176.208: cat /sys/bus/pci/devices/0000\:81\:02.1/device
18/11/2019 22:27:48             dut.10.240.176.208: 0x154c
18/11/2019 22:27:48             dut.10.240.176.208: cat /sys/bus/pci/devices/0000\:81\:02.1/vendor
18/11/2019 22:27:48             dut.10.240.176.208: 0x8086
18/11/2019 22:27:48             dut.10.240.176.208: cat /sys/bus/pci/devices/0000\:81\:02.1/device
18/11/2019 22:27:48             dut.10.240.176.208: 0x154c
18/11/2019 22:27:48             dut.10.240.176.208: modprobe vfio-pci
18/11/2019 22:27:48             dut.10.240.176.208: 
18/11/2019 22:27:51            TestPortRepresentor: Test Case test_port_representor_vf_mac_addr Begin
18/11/2019 22:27:51             dut.10.240.176.208:  
18/11/2019 22:27:51                         tester: 
18/11/2019 22:27:51             dut.10.240.176.208: ./x86_64-native-linuxapp-gcc/app/testpmd -l 1,2 -n 4 -w 0000:81:00.0,representor=0-1  --file-prefix=dpdk_7830_20191118222723    -- -i --port-topology=chained
18/11/2019 22:27:52             dut.10.240.176.208: EAL: Detected 88 lcore(s)
EAL: Detected 2 NUMA nodes
EAL: Multi-process socket /var/run/dpdk/dpdk_7830_20191118222723/mp_socket
EAL: Selected IOVA mode 'PA'
EAL: Probing VFIO support...
EAL: VFIO support initialized
EAL: PCI device 0000:81:00.0 on NUMA socket 1
EAL:   probe driver: 8086:1572 net_i40e
Interactive-mode selected
testpmd: create a new mbuf pool <mbuf_pool_socket_0>: n=155456, size=2176, socket=0
testpmd: preferred mempool ops selected: ring_mp_mc
testpmd: create a new mbuf pool <mbuf_pool_socket_1>: n=155456, size=2176, socket=1
testpmd: preferred mempool ops selected: ring_mp_mc
Configuring Port 0 (socket 1)
Port 0: 3C:FD:FE:B2:4B:B8
Configuring Port 1 (socket 0)
Port 1: 00:00:00:00:00:00
Configuring Port 2 (socket 0)
Port 2: 00:00:00:00:00:00
Checking link statuses...
Done
18/11/2019 22:28:02             dut.10.240.176.208: mac_addr set 1 aa:11:22:33:44:55
18/11/2019 22:28:03             dut.10.240.176.208: mac_addr set 1 aa:11:22:33:44:55
18/11/2019 22:28:03             dut.10.240.176.208: mac_addr set 2 aa:22:33:44:55:66
18/11/2019 22:28:03             dut.10.240.176.208: mac_addr set 2 aa:22:33:44:55:66
18/11/2019 22:28:03             dut.10.240.176.208: set promisc 0 off
18/11/2019 22:28:03             dut.10.240.176.208: set promisc 0 off
18/11/2019 22:28:03             dut.10.240.176.208: start
18/11/2019 22:28:03             dut.10.240.176.208: start
io packet forwarding - ports=3 - cores=1 - streams=3 - NUMA support enabled, MP allocation mode: native
Logical Core 2 (socket 0) forwards packets on 3 streams:
  RX P=0/Q=0 (socket 1) -> TX P=1/Q=0 (socket 0) peer=02:00:00:00:00:01
  RX P=1/Q=0 (socket 0) -> TX P=2/Q=0 (socket 0) peer=02:00:00:00:00:02
  RX P=2/Q=0 (socket 0) -> TX P=0/Q=0 (socket 1) peer=02:00:00:00:00:00

  io packet forwarding packets/burst=32
  nb forwarding cores=1 - nb forwarding ports=3
  port 0: RX queue number: 1 Tx queue number: 1
    Rx offloads=0x0 Tx offloads=0x10000
    RX queue: 0
      RX desc=256 - RX free threshold=32
      RX threshold registers: pthresh=8 hthresh=8  wthresh=0
      RX Offloads=0x0
    TX queue: 0
      TX desc=256 - TX free threshold=32
      TX threshold registers: pthresh=32 hthresh=0  wthresh=0
      TX offloads=0x10000 - TX RS bit threshold=32
  port 1: RX queue number: 1 Tx queue number: 1
    Rx offloads=0x0 Tx offloads=0x0
    RX queue: 0
      RX desc=0 - RX free threshold=32
      RX threshold registers: pthresh=8 hthresh=8  wthresh=0
      RX Offloads=0x0
    TX queue: 0
      TX desc=0 - TX free threshold=32
      TX threshold registers: pthresh=32 hthresh=0  wthresh=0
      TX offloads=0x0 - TX RS bit threshold=32
  port 2: RX queue number: 1 Tx queue number: 1
    Rx offloads=0x0 Tx offloads=0x0
    RX queue: 0
      RX desc=0 - RX free threshold=32
      RX threshold registers: pthresh=8 hthresh=8  wthresh=0
      RX Offloads=0x0
    TX queue: 0
      TX desc=0 - TX free threshold=32
      TX threshold registers: pthresh=32 hthresh=0  wthresh=0
      TX offloads=0x0 - TX RS bit threshold=32
18/11/2019 22:28:27                         tester: scp -v /home/xiewei/dts_port_representor/output/tmp/pcap/scapy_ens256f0.pcap1574087307.71 root@10.240.176.177:/tmp/tester/
18/11/2019 22:28:28                         tester: scp -v /home/xiewei/dts_port_representor/output/tmp/pcap/scapy_ens256f0.cmd1574087307.71 root@10.240.176.177:/tmp/tester/
18/11/2019 22:28:30                         tester: python /tmp/tester/scapy_ens256f0.cmd1574087307.71
18/11/2019 22:28:30                         tester: WARNING: No route found for IPv6 destination :: (no default route?)
packet ready for sending...
Ether(src='3c:fd:fe:b2:42:40', dst='3c:fd:fe:b2:4b:b8', type=2048)/IP(frag=0L, src='127.0.0.1', proto=0, tos=0, dst='127.0.0.1', chksum=31975, len=20, version=4L, flags=0L, ihl=5L, ttl=64, id=1)
Ether(src='3c:fd:fe:b2:42:40', dst='aa:11:22:33:44:55', type=2048)/IP(frag=0L, src='127.0.0.1', proto=0, tos=0, dst='127.0.0.1', chksum=31975, len=20, version=4L, flags=0L, ihl=5L, ttl=64, id=1)
Ether(src='3c:fd:fe:b2:42:40', dst='aa:22:33:44:55:66', type=2048)/IP(frag=0L, src='127.0.0.1', proto=0, tos=0, dst='127.0.0.1', chksum=31975, len=20, version=4L, flags=0L, ihl=5L, ttl=64, id=1)
Ether(src='3c:fd:fe:b2:42:40', dst='00:11:22:33:44:55', type=2048)/IP(frag=0L, src='127.0.0.1', proto=0, tos=0, dst='127.0.0.1', chksum=31975, len=20, version=4L, flags=0L, ihl=5L, ttl=64, id=1)
........................................
Sent 40 packets.
18/11/2019 22:28:30             dut.10.240.176.208: show port stats all
18/11/2019 22:28:30             dut.10.240.176.208: show port stats all

  ######################## NIC statistics for port 0  ########################
  RX-packets: 30         RX-missed: 0          RX-bytes:  1800
  RX-errors: 0
  RX-nombuf:  0         
  TX-packets: 0          TX-errors: 0          TX-bytes:  0

  Throughput (since last show)
  Rx-pps:            0
  Tx-pps:            0
  ############################################################################

  ######################## NIC statistics for port 1  ########################
  RX-packets: 10         RX-missed: 0          RX-bytes:  600
  RX-errors: 0
  RX-nombuf:  0         
  TX-packets: 10         TX-errors: 0          TX-bytes:  600

  Throughput (since last show)
  Rx-pps:            0
  Tx-pps:            0
  ############################################################################

  ######################## NIC statistics for port 2  ########################
  RX-packets: 10         RX-missed: 0          RX-bytes:  600
  RX-errors: 0
  RX-nombuf:  0         
  TX-packets: 10         TX-errors: 0          TX-bytes:  600

  Throughput (since last show)
  Rx-pps:            0
  Tx-pps:            0
  ############################################################################
18/11/2019 22:28:30            TestPortRepresentor: show port stats all

  ######################## NIC statistics for port 0  ########################
  RX-packets: 30         RX-missed: 0          RX-bytes:  1800
  RX-errors: 0
  RX-nombuf:  0         
  TX-packets: 0          TX-errors: 0          TX-bytes:  0

  Throughput (since last show)
  Rx-pps:            0
  Tx-pps:            0
  ############################################################################

  ######################## NIC statistics for port 1  ########################
  RX-packets: 10         RX-missed: 0          RX-bytes:  600
  RX-errors: 0
  RX-nombuf:  0         
  TX-packets: 10         TX-errors: 0          TX-bytes:  600

  Throughput (since last show)
  Rx-pps:            0
  Tx-pps:            0
  ############################################################################

  ######################## NIC statistics for port 2  ########################
  RX-packets: 10         RX-missed: 0          RX-bytes:  600
  RX-errors: 0
  RX-nombuf:  0         
  TX-packets: 10         TX-errors: 0          TX-bytes:  600

  Throughput (since last show)
  Rx-pps:            0
  Tx-pps:            0
  ############################################################################
18/11/2019 22:28:30            TestPortRepresentor: Test Case test_port_representor_vf_mac_addr Result PASSED:
18/11/2019 22:28:38             dut.10.240.176.208: quit
18/11/2019 22:28:38             dut.10.240.176.208: quit
Telling cores to stop...
Waiting for lcores to finish...

  ---------------------- Forward statistics for port 0  ----------------------
  RX-packets: 10             RX-dropped: 0             RX-total: 10
  TX-packets: 0              TX-dropped: 0             TX-total: 0
  ----------------------------------------------------------------------------

  ---------------------- Forward statistics for port 1  ----------------------
  RX-packets: 0              RX-dropped: 0             RX-total: 0
  TX-packets: 0              TX-dropped: 10            TX-total: 10
  ----------------------------------------------------------------------------

  ---------------------- Forward statistics for port 2  ----------------------
  RX-packets: 0              RX-dropped: 0             RX-total: 0
  TX-packets: 0              TX-dropped: 0             TX-total: 0
  ----------------------------------------------------------------------------

  +++++++++++++++ Accumulated forward statistics for all ports+++++++++++++++
  RX-packets: 10             RX-dropped: 0             RX-total: 10
  TX-packets: 0              TX-dropped: 10            TX-total: 10
  ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Done.

Stopping port 0...
Stopping ports...
Done

Stopping port 1...
Stopping ports...
Done

Stopping port 2...
Stopping ports...
Done

Shutting down port 0...
Closing ports...
Done

Shutting down port 1...
Closing ports...
Done

Shutting down port 2...
Closing ports...
Done

Bye...
18/11/2019 22:28:41            TestPortRepresentor: Test Case test_port_representor_vf_promiscous Begin
18/11/2019 22:28:41             dut.10.240.176.208:  
18/11/2019 22:28:41                         tester: 
18/11/2019 22:28:41             dut.10.240.176.208: ./x86_64-native-linuxapp-gcc/app/testpmd -l 1,2 -n 4 -w 0000:81:00.0,representor=0-1  --file-prefix=dpdk_7830_20191118222723    -- -i --port-topology=chained
18/11/2019 22:28:43             dut.10.240.176.208: EAL: Detected 88 lcore(s)
EAL: Detected 2 NUMA nodes
EAL: Multi-process socket /var/run/dpdk/dpdk_7830_20191118222723/mp_socket
EAL: Selected IOVA mode 'PA'
EAL: Probing VFIO support...
EAL: VFIO support initialized
EAL: PCI device 0000:81:00.0 on NUMA socket 1
EAL:   probe driver: 8086:1572 net_i40e
Interactive-mode selected
testpmd: create a new mbuf pool <mbuf_pool_socket_0>: n=155456, size=2176, socket=0
testpmd: preferred mempool ops selected: ring_mp_mc
testpmd: create a new mbuf pool <mbuf_pool_socket_1>: n=155456, size=2176, socket=1
testpmd: preferred mempool ops selected: ring_mp_mc
Configuring Port 0 (socket 1)
Port 0: 3C:FD:FE:B2:4B:B8
Configuring Port 1 (socket 0)
Port 1: 00:00:00:00:00:00
Configuring Port 2 (socket 0)
Port 2: 00:00:00:00:00:00
Checking link statuses...
Done
18/11/2019 22:28:53             dut.10.240.176.208: set promisc 0 off
18/11/2019 22:28:53             dut.10.240.176.208: set promisc 0 off
18/11/2019 22:28:53             dut.10.240.176.208: start
18/11/2019 22:28:53             dut.10.240.176.208: start
io packet forwarding - ports=3 - cores=1 - streams=3 - NUMA support enabled, MP allocation mode: native
Logical Core 2 (socket 0) forwards packets on 3 streams:
  RX P=0/Q=0 (socket 1) -> TX P=1/Q=0 (socket 0) peer=02:00:00:00:00:01
  RX P=1/Q=0 (socket 0) -> TX P=2/Q=0 (socket 0) peer=02:00:00:00:00:02
  RX P=2/Q=0 (socket 0) -> TX P=0/Q=0 (socket 1) peer=02:00:00:00:00:00

  io packet forwarding packets/burst=32
  nb forwarding cores=1 - nb forwarding ports=3
  port 0: RX queue number: 1 Tx queue number: 1
    Rx offloads=0x0 Tx offloads=0x10000
    RX queue: 0
      RX desc=256 - RX free threshold=32
      RX threshold registers: pthresh=8 hthresh=8  wthresh=0
      RX Offloads=0x0
    TX queue: 0
      TX desc=256 - TX free threshold=32
      TX threshold registers: pthresh=32 hthresh=0  wthresh=0
      TX offloads=0x10000 - TX RS bit threshold=32
  port 1: RX queue number: 1 Tx queue number: 1
    Rx offloads=0x0 Tx offloads=0x0
    RX queue: 0
      RX desc=0 - RX free threshold=32
      RX threshold registers: pthresh=8 hthresh=8  wthresh=0
      RX Offloads=0x0
    TX queue: 0
      TX desc=0 - TX free threshold=32
      TX threshold registers: pthresh=32 hthresh=0  wthresh=0
      TX offloads=0x0 - TX RS bit threshold=32
  port 2: RX queue number: 1 Tx queue number: 1
    Rx offloads=0x0 Tx offloads=0x0
    RX queue: 0
      RX desc=0 - RX free threshold=32
      RX threshold registers: pthresh=8 hthresh=8  wthresh=0
      RX Offloads=0x0
    TX queue: 0
      TX desc=0 - TX free threshold=32
      TX threshold registers: pthresh=32 hthresh=0  wthresh=0
      TX offloads=0x0 - TX RS bit threshold=32
18/11/2019 22:29:18             dut.10.240.176.208: set promisc 1 on
18/11/2019 22:29:18             dut.10.240.176.208: set promisc 1 on
18/11/2019 22:29:18                         tester: scp -v /home/xiewei/dts_port_representor/output/tmp/pcap/scapy_ens256f0.pcap1574087358.16 root@10.240.176.177:/tmp/tester/
18/11/2019 22:29:19                         tester: scp -v /home/xiewei/dts_port_representor/output/tmp/pcap/scapy_ens256f0.cmd1574087358.16 root@10.240.176.177:/tmp/tester/
18/11/2019 22:29:20                         tester: python /tmp/tester/scapy_ens256f0.cmd1574087358.16
18/11/2019 22:29:21                         tester: WARNING: No route found for IPv6 destination :: (no default route?)
packet ready for sending...
Ether(src='3c:fd:fe:b2:42:40', dst='3c:fd:fe:b2:4b:b8', type=2048)/IP(frag=0L, src='127.0.0.1', proto=0, tos=0, dst='127.0.0.1', chksum=31975, len=20, version=4L, flags=0L, ihl=5L, ttl=64, id=1)
Ether(src='3c:fd:fe:b2:42:40', dst='b6:85:47:bf:86:bc', type=2048)/IP(frag=0L, src='127.0.0.1', proto=0, tos=0, dst='127.0.0.1', chksum=31975, len=20, version=4L, flags=0L, ihl=5L, ttl=64, id=1)
Ether(src='3c:fd:fe:b2:42:40', dst='8a:24:52:57:ec:17', type=2048)/IP(frag=0L, src='127.0.0.1', proto=0, tos=0, dst='127.0.0.1', chksum=31975, len=20, version=4L, flags=0L, ihl=5L, ttl=64, id=1)
Ether(src='3c:fd:fe:b2:42:40', dst='00:11:22:33:44:55', type=2048)/IP(frag=0L, src='127.0.0.1', proto=0, tos=0, dst='127.0.0.1', chksum=31975, len=20, version=4L, flags=0L, ihl=5L, ttl=64, id=1)
........................................
Sent 40 packets.
18/11/2019 22:29:21             dut.10.240.176.208: show port stats all
18/11/2019 22:29:21             dut.10.240.176.208: show port stats all

  ######################## NIC statistics for port 0  ########################
  RX-packets: 50         RX-missed: 0          RX-bytes:  3000
  RX-errors: 0
  RX-nombuf:  0         
  TX-packets: 20         TX-errors: 0          TX-bytes:  1200

  Throughput (since last show)
  Rx-pps:            0
  Tx-pps:            0
  ############################################################################

  ######################## NIC statistics for port 1  ########################
  RX-packets: 20         RX-missed: 0          RX-bytes:  1200
  RX-errors: 0
  RX-nombuf:  0         
  TX-packets: 20         TX-errors: 0          TX-bytes:  1200

  Throughput (since last show)
  Rx-pps:            0
  Tx-pps:            0
  ############################################################################

  ######################## NIC statistics for port 2  ########################
  RX-packets: 20         RX-missed: 0          RX-bytes:  1200
  RX-errors: 0
  RX-nombuf:  0         
  TX-packets: 20         TX-errors: 0          TX-bytes:  1200

  Throughput (since last show)
  Rx-pps:            0
  Tx-pps:            0
  ############################################################################
18/11/2019 22:29:21            TestPortRepresentor: show port stats all

  ######################## NIC statistics for port 0  ########################
  RX-packets: 50         RX-missed: 0          RX-bytes:  3000
  RX-errors: 0
  RX-nombuf:  0         
  TX-packets: 20         TX-errors: 0          TX-bytes:  1200

  Throughput (since last show)
  Rx-pps:            0
  Tx-pps:            0
  ############################################################################

  ######################## NIC statistics for port 1  ########################
  RX-packets: 20         RX-missed: 0          RX-bytes:  1200
  RX-errors: 0
  RX-nombuf:  0         
  TX-packets: 20         TX-errors: 0          TX-bytes:  1200

  Throughput (since last show)
  Rx-pps:            0
  Tx-pps:            0
  ############################################################################

  ######################## NIC statistics for port 2  ########################
  RX-packets: 20         RX-missed: 0          RX-bytes:  1200
  RX-errors: 0
  RX-nombuf:  0         
  TX-packets: 20         TX-errors: 0          TX-bytes:  1200

  Throughput (since last show)
  Rx-pps:            0
  Tx-pps:            0
  ############################################################################
18/11/2019 22:29:21             dut.10.240.176.208: clear vf stats 0 0
18/11/2019 22:29:21             dut.10.240.176.208: clear vf stats 0 0
18/11/2019 22:29:21             dut.10.240.176.208: clear vf stats 0 1
18/11/2019 22:29:21             dut.10.240.176.208: clear vf stats 0 1
18/11/2019 22:29:21             dut.10.240.176.208: clear port stats all
18/11/2019 22:29:21             dut.10.240.176.208: clear port stats all

  NIC statistics for port 0 cleared

  NIC statistics for port 1 cleared

  NIC statistics for port 2 cleared
18/11/2019 22:29:21             dut.10.240.176.208: set promisc 1 off
18/11/2019 22:29:21             dut.10.240.176.208: set promisc 1 off
18/11/2019 22:29:21                         tester: scp -v /home/xiewei/dts_port_representor/output/tmp/pcap/scapy_ens256f0.pcap1574087361.34 root@10.240.176.177:/tmp/tester/
18/11/2019 22:29:22                         tester: scp -v /home/xiewei/dts_port_representor/output/tmp/pcap/scapy_ens256f0.cmd1574087361.34 root@10.240.176.177:/tmp/tester/
18/11/2019 22:29:23                         tester: python /tmp/tester/scapy_ens256f0.cmd1574087361.34
18/11/2019 22:29:24                         tester: WARNING: No route found for IPv6 destination :: (no default route?)
packet ready for sending...
Ether(src='3c:fd:fe:b2:42:40', dst='3c:fd:fe:b2:4b:b8', type=2048)/IP(frag=0L, src='127.0.0.1', proto=0, tos=0, dst='127.0.0.1', chksum=31975, len=20, version=4L, flags=0L, ihl=5L, ttl=64, id=1)
Ether(src='3c:fd:fe:b2:42:40', dst='b6:85:47:bf:86:bc', type=2048)/IP(frag=0L, src='127.0.0.1', proto=0, tos=0, dst='127.0.0.1', chksum=31975, len=20, version=4L, flags=0L, ihl=5L, ttl=64, id=1)
Ether(src='3c:fd:fe:b2:42:40', dst='8a:24:52:57:ec:17', type=2048)/IP(frag=0L, src='127.0.0.1', proto=0, tos=0, dst='127.0.0.1', chksum=31975, len=20, version=4L, flags=0L, ihl=5L, ttl=64, id=1)
Ether(src='3c:fd:fe:b2:42:40', dst='00:11:22:33:44:55', type=2048)/IP(frag=0L, src='127.0.0.1', proto=0, tos=0, dst='127.0.0.1', chksum=31975, len=20, version=4L, flags=0L, ihl=5L, ttl=64, id=1)
........................................
Sent 40 packets.
18/11/2019 22:29:24             dut.10.240.176.208: show port stats all
18/11/2019 22:29:24             dut.10.240.176.208: show port stats all

  ######################## NIC statistics for port 0  ########################
  RX-packets: 40         RX-missed: 0          RX-bytes:  2400
  RX-errors: 0
  RX-nombuf:  0         
  TX-packets: 10         TX-errors: 0          TX-bytes:  600

  Throughput (since last show)
  Rx-pps:            0
  Tx-pps:            0
  ############################################################################

  ######################## NIC statistics for port 1  ########################
  RX-packets: 10         RX-missed: 0          RX-bytes:  600
  RX-errors: 0
  RX-nombuf:  0         
  TX-packets: 10         TX-errors: 0          TX-bytes:  600

  Throughput (since last show)
  Rx-pps:            0
  Tx-pps:            0
  ############################################################################

  ######################## NIC statistics for port 2  ########################
  RX-packets: 20         RX-missed: 0          RX-bytes:  1200
  RX-errors: 0
  RX-nombuf:  0         
  TX-packets: 20         TX-errors: 0          TX-bytes:  1200

  Throughput (since last show)
  Rx-pps:            0
  Tx-pps:            0
  ############################################################################
18/11/2019 22:29:24            TestPortRepresentor: show port stats all

  ######################## NIC statistics for port 0  ########################
  RX-packets: 40         RX-missed: 0          RX-bytes:  2400
  RX-errors: 0
  RX-nombuf:  0         
  TX-packets: 10         TX-errors: 0          TX-bytes:  600

  Throughput (since last show)
  Rx-pps:            0
  Tx-pps:            0
  ############################################################################

  ######################## NIC statistics for port 1  ########################
  RX-packets: 10         RX-missed: 0          RX-bytes:  600
  RX-errors: 0
  RX-nombuf:  0         
  TX-packets: 10         TX-errors: 0          TX-bytes:  600

  Throughput (since last show)
  Rx-pps:            0
  Tx-pps:            0
  ############################################################################

  ######################## NIC statistics for port 2  ########################
  RX-packets: 20         RX-missed: 0          RX-bytes:  1200
  RX-errors: 0
  RX-nombuf:  0         
  TX-packets: 20         TX-errors: 0          TX-bytes:  1200

  Throughput (since last show)
  Rx-pps:            0
  Tx-pps:            0
  ############################################################################
18/11/2019 22:29:24            TestPortRepresentor: Test Case test_port_representor_vf_promiscous Result PASSED:
18/11/2019 22:29:32             dut.10.240.176.208: quit
18/11/2019 22:29:32             dut.10.240.176.208: quit
Telling cores to stop...
Waiting for lcores to finish...

  ---------------------- Forward statistics for port 0  ----------------------
  RX-packets: 10             RX-dropped: 0             RX-total: 10
  TX-packets: 10             TX-dropped: 0             TX-total: 10
  ----------------------------------------------------------------------------

  ---------------------- Forward statistics for port 1  ----------------------
  RX-packets: 0              RX-dropped: 0             RX-total: 0
  TX-packets: 0              TX-dropped: 20            TX-total: 20
  ----------------------------------------------------------------------------

  ---------------------- Forward statistics for port 2  ----------------------
  RX-packets: 0              RX-dropped: 0             RX-total: 0
  TX-packets: 0              TX-dropped: 0             TX-total: 0
  ----------------------------------------------------------------------------

  +++++++++++++++ Accumulated forward statistics for all ports+++++++++++++++
  RX-packets: 10             RX-dropped: 0             RX-total: 10
  TX-packets: 10             TX-dropped: 20            TX-total: 30
  ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Done.

Stopping port 0...
Stopping ports...
Done

Stopping port 1...
Stopping ports...
Done

Stopping port 2...
Stopping ports...
Done

Shutting down port 0...
Closing ports...
Done

Shutting down port 1...
Closing ports...
Done

Shutting down port 2...
Closing ports...
Done

Bye...
18/11/2019 22:29:35            TestPortRepresentor: Test Case test_port_representor_vf_stats_show_and_clear Begin
18/11/2019 22:29:35             dut.10.240.176.208:  
18/11/2019 22:29:35                         tester: 
18/11/2019 22:29:35             dut.10.240.176.208: ./x86_64-native-linuxapp-gcc/app/testpmd -l 1,2 -n 4 -w 0000:81:00.0,representor=0-1  --file-prefix=dpdk_7830_20191118222723    -- -i --port-topology=chained
18/11/2019 22:29:36             dut.10.240.176.208: EAL: Detected 88 lcore(s)
EAL: Detected 2 NUMA nodes
EAL: Multi-process socket /var/run/dpdk/dpdk_7830_20191118222723/mp_socket
EAL: Selected IOVA mode 'PA'
EAL: Probing VFIO support...
EAL: VFIO support initialized
EAL: PCI device 0000:81:00.0 on NUMA socket 1
EAL:   probe driver: 8086:1572 net_i40e
Interactive-mode selected
testpmd: create a new mbuf pool <mbuf_pool_socket_0>: n=155456, size=2176, socket=0
testpmd: preferred mempool ops selected: ring_mp_mc
testpmd: create a new mbuf pool <mbuf_pool_socket_1>: n=155456, size=2176, socket=1
testpmd: preferred mempool ops selected: ring_mp_mc
Configuring Port 0 (socket 1)
Port 0: 3C:FD:FE:B2:4B:B8
Configuring Port 1 (socket 0)
Port 1: 00:00:00:00:00:00
Configuring Port 2 (socket 0)
Port 2: 00:00:00:00:00:00
Checking link statuses...
Done
18/11/2019 22:29:46             dut.10.240.176.208: set promisc 0 off
18/11/2019 22:29:47             dut.10.240.176.208: set promisc 0 off
18/11/2019 22:29:47             dut.10.240.176.208: start
18/11/2019 22:29:47             dut.10.240.176.208: start
io packet forwarding - ports=3 - cores=1 - streams=3 - NUMA support enabled, MP allocation mode: native
Logical Core 2 (socket 0) forwards packets on 3 streams:
  RX P=0/Q=0 (socket 1) -> TX P=1/Q=0 (socket 0) peer=02:00:00:00:00:01
  RX P=1/Q=0 (socket 0) -> TX P=2/Q=0 (socket 0) peer=02:00:00:00:00:02
  RX P=2/Q=0 (socket 0) -> TX P=0/Q=0 (socket 1) peer=02:00:00:00:00:00

  io packet forwarding packets/burst=32
  nb forwarding cores=1 - nb forwarding ports=3
  port 0: RX queue number: 1 Tx queue number: 1
    Rx offloads=0x0 Tx offloads=0x10000
    RX queue: 0
      RX desc=256 - RX free threshold=32
      RX threshold registers: pthresh=8 hthresh=8  wthresh=0
      RX Offloads=0x0
    TX queue: 0
      TX desc=256 - TX free threshold=32
      TX threshold registers: pthresh=32 hthresh=0  wthresh=0
      TX offloads=0x10000 - TX RS bit threshold=32
  port 1: RX queue number: 1 Tx queue number: 1
    Rx offloads=0x0 Tx offloads=0x0
    RX queue: 0
      RX desc=0 - RX free threshold=32
      RX threshold registers: pthresh=8 hthresh=8  wthresh=0
      RX Offloads=0x0
    TX queue: 0
      TX desc=0 - TX free threshold=32
      TX threshold registers: pthresh=32 hthresh=0  wthresh=0
      TX offloads=0x0 - TX RS bit threshold=32
  port 2: RX queue number: 1 Tx queue number: 1
    Rx offloads=0x0 Tx offloads=0x0
    RX queue: 0
      RX desc=0 - RX free threshold=32
      RX threshold registers: pthresh=8 hthresh=8  wthresh=0
      RX Offloads=0x0
    TX queue: 0
      TX desc=0 - TX free threshold=32
      TX threshold registers: pthresh=32 hthresh=0  wthresh=0
      TX offloads=0x0 - TX RS bit threshold=32
18/11/2019 22:30:12                         tester: scp -v /home/xiewei/dts_port_representor/output/tmp/pcap/scapy_ens256f0.pcap1574087412.12 root@10.240.176.177:/tmp/tester/
18/11/2019 22:30:13                         tester: scp -v /home/xiewei/dts_port_representor/output/tmp/pcap/scapy_ens256f0.cmd1574087412.12 root@10.240.176.177:/tmp/tester/
18/11/2019 22:30:14                         tester: python /tmp/tester/scapy_ens256f0.cmd1574087412.12
18/11/2019 22:30:14                         tester: WARNING: No route found for IPv6 destination :: (no default route?)
packet ready for sending...
Ether(src='3c:fd:fe:b2:42:40', dst='3c:fd:fe:b2:4b:b8', type=2048)/IP(frag=0L, src='127.0.0.1', proto=0, tos=0, dst='127.0.0.1', chksum=31975, len=20, version=4L, flags=0L, ihl=5L, ttl=64, id=1)
Ether(src='3c:fd:fe:b2:42:40', dst='0e:1c:4f:13:3c:06', type=2048)/IP(frag=0L, src='127.0.0.1', proto=0, tos=0, dst='127.0.0.1', chksum=31975, len=20, version=4L, flags=0L, ihl=5L, ttl=64, id=1)
Ether(src='3c:fd:fe:b2:42:40', dst='32:53:2a:c0:41:2e', type=2048)/IP(frag=0L, src='127.0.0.1', proto=0, tos=0, dst='127.0.0.1', chksum=31975, len=20, version=4L, flags=0L, ihl=5L, ttl=64, id=1)
..............................
Sent 30 packets.
18/11/2019 22:30:14             dut.10.240.176.208: show port stats all
18/11/2019 22:30:15             dut.10.240.176.208: show port stats all

  ######################## NIC statistics for port 0  ########################
  RX-packets: 30         RX-missed: 0          RX-bytes:  1800
  RX-errors: 0
  RX-nombuf:  0         
  TX-packets: 0          TX-errors: 0          TX-bytes:  0

  Throughput (since last show)
  Rx-pps:            0
  Tx-pps:            0
  ############################################################################

  ######################## NIC statistics for port 1  ########################
  RX-packets: 10         RX-missed: 0          RX-bytes:  600
  RX-errors: 0
  RX-nombuf:  0         
  TX-packets: 10         TX-errors: 0          TX-bytes:  600

  Throughput (since last show)
  Rx-pps:            0
  Tx-pps:            0
  ############################################################################

  ######################## NIC statistics for port 2  ########################
  RX-packets: 10         RX-missed: 0          RX-bytes:  600
  RX-errors: 0
  RX-nombuf:  0         
  TX-packets: 10         TX-errors: 0          TX-bytes:  600

  Throughput (since last show)
  Rx-pps:            0
  Tx-pps:            0
  ############################################################################
18/11/2019 22:30:15            TestPortRepresentor: show port stats all

  ######################## NIC statistics for port 0  ########################
  RX-packets: 30         RX-missed: 0          RX-bytes:  1800
  RX-errors: 0
  RX-nombuf:  0         
  TX-packets: 0          TX-errors: 0          TX-bytes:  0

  Throughput (since last show)
  Rx-pps:            0
  Tx-pps:            0
  ############################################################################

  ######################## NIC statistics for port 1  ########################
  RX-packets: 10         RX-missed: 0          RX-bytes:  600
  RX-errors: 0
  RX-nombuf:  0         
  TX-packets: 10         TX-errors: 0          TX-bytes:  600

  Throughput (since last show)
  Rx-pps:            0
  Tx-pps:            0
  ############################################################################

  ######################## NIC statistics for port 2  ########################
  RX-packets: 10         RX-missed: 0          RX-bytes:  600
  RX-errors: 0
  RX-nombuf:  0         
  TX-packets: 10         TX-errors: 0          TX-bytes:  600

  Throughput (since last show)
  Rx-pps:            0
  Tx-pps:            0
  ############################################################################
18/11/2019 22:30:15             dut.10.240.176.208: clear vf stats 0 0
18/11/2019 22:30:15             dut.10.240.176.208: clear vf stats 0 0
18/11/2019 22:30:15             dut.10.240.176.208: clear vf stats 0 1
18/11/2019 22:30:15             dut.10.240.176.208: clear vf stats 0 1
18/11/2019 22:30:15             dut.10.240.176.208: clear port stats all
18/11/2019 22:30:15             dut.10.240.176.208: clear port stats all

  NIC statistics for port 0 cleared

  NIC statistics for port 1 cleared

  NIC statistics for port 2 cleared
18/11/2019 22:30:15             dut.10.240.176.208: show port stats all
18/11/2019 22:30:15             dut.10.240.176.208: show port stats all

  ######################## NIC statistics for port 0  ########################
  RX-packets: 0          RX-missed: 0          RX-bytes:  0
  RX-errors: 0
  RX-nombuf:  0         
  TX-packets: 0          TX-errors: 0          TX-bytes:  0

  Throughput (since last show)
  Rx-pps:            0
  Tx-pps:            0
  ############################################################################

  ######################## NIC statistics for port 1  ########################
  RX-packets: 0          RX-missed: 0          RX-bytes:  0
  RX-errors: 0
  RX-nombuf:  0         
  TX-packets: 0          TX-errors: 0          TX-bytes:  0

  Throughput (since last show)
  Rx-pps:            0
  Tx-pps:            0
  ############################################################################

  ######################## NIC statistics for port 2  ########################
  RX-packets: 0          RX-missed: 0          RX-bytes:  0
  RX-errors: 0
  RX-nombuf:  0         
  TX-packets: 0          TX-errors: 0          TX-bytes:  0

  Throughput (since last show)
  Rx-pps:            0
  Tx-pps:            0
  ############################################################################
18/11/2019 22:30:15            TestPortRepresentor: show port stats all

  ######################## NIC statistics for port 0  ########################
  RX-packets: 0          RX-missed: 0          RX-bytes:  0
  RX-errors: 0
  RX-nombuf:  0         
  TX-packets: 0          TX-errors: 0          TX-bytes:  0

  Throughput (since last show)
  Rx-pps:            0
  Tx-pps:            0
  ############################################################################

  ######################## NIC statistics for port 1  ########################
  RX-packets: 0          RX-missed: 0          RX-bytes:  0
  RX-errors: 0
  RX-nombuf:  0         
  TX-packets: 0          TX-errors: 0          TX-bytes:  0

  Throughput (since last show)
  Rx-pps:            0
  Tx-pps:            0
  ############################################################################

  ######################## NIC statistics for port 2  ########################
  RX-packets: 0          RX-missed: 0          RX-bytes:  0
  RX-errors: 0
  RX-nombuf:  0         
  TX-packets: 0          TX-errors: 0          TX-bytes:  0

  Throughput (since last show)
  Rx-pps:            0
  Tx-pps:            0
  ############################################################################
18/11/2019 22:30:15            TestPortRepresentor: Test Case test_port_representor_vf_stats_show_and_clear Result PASSED:
18/11/2019 22:30:23             dut.10.240.176.208: quit
18/11/2019 22:30:23             dut.10.240.176.208: quit
Telling cores to stop...
Waiting for lcores to finish...

  ---------------------- Forward statistics for port 0  ----------------------
  RX-packets: 0              RX-dropped: 0             RX-total: 0
  TX-packets: 0              TX-dropped: 0             TX-total: 0
  ----------------------------------------------------------------------------

  ---------------------- Forward statistics for port 1  ----------------------
  RX-packets: 0              RX-dropped: 0             RX-total: 0
  TX-packets: 0              TX-dropped: 10            TX-total: 10
  ----------------------------------------------------------------------------

  ---------------------- Forward statistics for port 2  ----------------------
  RX-packets: 0              RX-dropped: 0             RX-total: 0
  TX-packets: 0              TX-dropped: 0             TX-total: 0
  ----------------------------------------------------------------------------

  +++++++++++++++ Accumulated forward statistics for all ports+++++++++++++++
  RX-packets: 0              RX-dropped: 0             RX-total: 0
  TX-packets: 0              TX-dropped: 10            TX-total: 10
  ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Done.

Stopping port 0...
Stopping ports...
Done

Stopping port 1...
Stopping ports...
Done

Stopping port 2...
Stopping ports...
Done

Shutting down port 0...
Closing ports...
Done

Shutting down port 1...
Closing ports...
Done

Shutting down port 2...
Closing ports...
Done

Bye...
18/11/2019 22:30:26            TestPortRepresentor: Test Case test_port_representor_vlan_filter Begin
18/11/2019 22:30:26             dut.10.240.176.208:  
18/11/2019 22:30:26                         tester: 
18/11/2019 22:30:26             dut.10.240.176.208: ./x86_64-native-linuxapp-gcc/app/testpmd -l 1,2 -n 4 -w 0000:81:00.0,representor=0-1  --file-prefix=dpdk_7830_20191118222723    -- -i --port-topology=chained
18/11/2019 22:30:27             dut.10.240.176.208: EAL: Detected 88 lcore(s)
EAL: Detected 2 NUMA nodes
EAL: Multi-process socket /var/run/dpdk/dpdk_7830_20191118222723/mp_socket
EAL: Selected IOVA mode 'PA'
EAL: Probing VFIO support...
EAL: VFIO support initialized
EAL: PCI device 0000:81:00.0 on NUMA socket 1
EAL:   probe driver: 8086:1572 net_i40e
Interactive-mode selected
testpmd: create a new mbuf pool <mbuf_pool_socket_0>: n=155456, size=2176, socket=0
testpmd: preferred mempool ops selected: ring_mp_mc
testpmd: create a new mbuf pool <mbuf_pool_socket_1>: n=155456, size=2176, socket=1
testpmd: preferred mempool ops selected: ring_mp_mc
Configuring Port 0 (socket 1)
Port 0: 3C:FD:FE:B2:4B:B8
Configuring Port 1 (socket 0)
Port 1: 00:00:00:00:00:00
Configuring Port 2 (socket 0)
Port 2: 00:00:00:00:00:00
Checking link statuses...
Done
18/11/2019 22:30:37             dut.10.240.176.208: set promisc 1 off
18/11/2019 22:30:38             dut.10.240.176.208: set promisc 1 off
18/11/2019 22:30:38             dut.10.240.176.208: vlan set filter on 1
18/11/2019 22:30:38             dut.10.240.176.208: vlan set filter on 1
18/11/2019 22:30:38             dut.10.240.176.208: rx_vlan add 3 1
18/11/2019 22:30:38             dut.10.240.176.208: rx_vlan add 3 1
18/11/2019 22:30:38             dut.10.240.176.208: set promisc 2 off
18/11/2019 22:30:38             dut.10.240.176.208: set promisc 2 off
18/11/2019 22:30:38             dut.10.240.176.208: vlan set filter on 2
18/11/2019 22:30:38             dut.10.240.176.208: vlan set filter on 2
18/11/2019 22:30:38             dut.10.240.176.208: rx_vlan add 4 2
18/11/2019 22:30:38             dut.10.240.176.208: rx_vlan add 4 2
18/11/2019 22:30:38             dut.10.240.176.208: start
18/11/2019 22:30:38             dut.10.240.176.208: start
io packet forwarding - ports=3 - cores=1 - streams=3 - NUMA support enabled, MP allocation mode: native
Logical Core 2 (socket 0) forwards packets on 3 streams:
  RX P=0/Q=0 (socket 1) -> TX P=1/Q=0 (socket 0) peer=02:00:00:00:00:01
  RX P=1/Q=0 (socket 0) -> TX P=2/Q=0 (socket 0) peer=02:00:00:00:00:02
  RX P=2/Q=0 (socket 0) -> TX P=0/Q=0 (socket 1) peer=02:00:00:00:00:00

  io packet forwarding packets/burst=32
  nb forwarding cores=1 - nb forwarding ports=3
  port 0: RX queue number: 1 Tx queue number: 1
    Rx offloads=0x0 Tx offloads=0x10000
    RX queue: 0
      RX desc=256 - RX free threshold=32
      RX threshold registers: pthresh=8 hthresh=8  wthresh=0
      RX Offloads=0x0
    TX queue: 0
      TX desc=256 - TX free threshold=32
      TX threshold registers: pthresh=32 hthresh=0  wthresh=0
      TX offloads=0x10000 - TX RS bit threshold=32
  port 1: RX queue number: 1 Tx queue number: 1
    Rx offloads=0x200 Tx offloads=0x0
    RX queue: 0
      RX desc=0 - RX free threshold=32
      RX threshold registers: pthresh=8 hthresh=8  wthresh=0
      RX Offloads=0x0
    TX queue: 0
      TX desc=0 - TX free threshold=32
      TX threshold registers: pthresh=32 hthresh=0  wthresh=0
      TX offloads=0x0 - TX RS bit threshold=32
  port 2: RX queue number: 1 Tx queue number: 1
    Rx offloads=0x200 Tx offloads=0x0
    RX queue: 0
      RX desc=0 - RX free threshold=32
      RX threshold registers: pthresh=8 hthresh=8  wthresh=0
      RX Offloads=0x0
    TX queue: 0
      TX desc=0 - TX free threshold=32
      TX threshold registers: pthresh=32 hthresh=0  wthresh=0
      TX offloads=0x0 - TX RS bit threshold=32
18/11/2019 22:31:03                         tester: scp -v /home/xiewei/dts_port_representor/output/tmp/pcap/scapy_ens256f0.pcap1574087463.28 root@10.240.176.177:/tmp/tester/
18/11/2019 22:31:04                         tester: scp -v /home/xiewei/dts_port_representor/output/tmp/pcap/scapy_ens256f0.cmd1574087463.28 root@10.240.176.177:/tmp/tester/
18/11/2019 22:31:05                         tester: python /tmp/tester/scapy_ens256f0.cmd1574087463.28
18/11/2019 22:31:06                         tester: WARNING: No route found for IPv6 destination :: (no default route?)
packet ready for sending...
Ether(src='3c:fd:fe:b2:42:40', dst='32:e6:7d:85:e5:34', type=33024)/Dot1Q(vlan=3L, type=2048, id=0L, prio=0L)/IP(frag=0L, src='127.0.0.1', proto=0, tos=0, dst='127.0.0.1', chksum=31975, len=20, version=4L, flags=0L, ihl=5L, ttl=64, id=1)
Ether(src='3c:fd:fe:b2:42:40', dst='16:fd:f3:74:d2:64', type=33024)/Dot1Q(vlan=4L, type=2048, id=0L, prio=0L)/IP(frag=0L, src='127.0.0.1', proto=0, tos=0, dst='127.0.0.1', chksum=31975, len=20, version=4L, flags=0L, ihl=5L, ttl=64, id=1)
....................
Sent 20 packets.
18/11/2019 22:31:06             dut.10.240.176.208: show port stats all
18/11/2019 22:31:06             dut.10.240.176.208: show port stats all

  ######################## NIC statistics for port 0  ########################
  RX-packets: 40         RX-missed: 0          RX-bytes:  2400
  RX-errors: 0
  RX-nombuf:  0         
  TX-packets: 20         TX-errors: 0          TX-bytes:  1200

  Throughput (since last show)
  Rx-pps:            0
  Tx-pps:            0
  ############################################################################

  ######################## NIC statistics for port 1  ########################
  RX-packets: 10         RX-missed: 0          RX-bytes:  600
  RX-errors: 0
  RX-nombuf:  0         
  TX-packets: 10         TX-errors: 0          TX-bytes:  600

  Throughput (since last show)
  Rx-pps:            0
  Tx-pps:            0
  ############################################################################

  ######################## NIC statistics for port 2  ########################
  RX-packets: 10         RX-missed: 0          RX-bytes:  600
  RX-errors: 0
  RX-nombuf:  0         
  TX-packets: 10         TX-errors: 0          TX-bytes:  600

  Throughput (since last show)
  Rx-pps:            0
  Tx-pps:            0
  ############################################################################
18/11/2019 22:31:06            TestPortRepresentor: show port stats all

  ######################## NIC statistics for port 0  ########################
  RX-packets: 40         RX-missed: 0          RX-bytes:  2400
  RX-errors: 0
  RX-nombuf:  0         
  TX-packets: 20         TX-errors: 0          TX-bytes:  1200

  Throughput (since last show)
  Rx-pps:            0
  Tx-pps:            0
  ############################################################################

  ######################## NIC statistics for port 1  ########################
  RX-packets: 10         RX-missed: 0          RX-bytes:  600
  RX-errors: 0
  RX-nombuf:  0         
  TX-packets: 10         TX-errors: 0          TX-bytes:  600

  Throughput (since last show)
  Rx-pps:            0
  Tx-pps:            0
  ############################################################################

  ######################## NIC statistics for port 2  ########################
  RX-packets: 10         RX-missed: 0          RX-bytes:  600
  RX-errors: 0
  RX-nombuf:  0         
  TX-packets: 10         TX-errors: 0          TX-bytes:  600

  Throughput (since last show)
  Rx-pps:            0
  Tx-pps:            0
  ############################################################################
18/11/2019 22:31:06            TestPortRepresentor: Test Case test_port_representor_vlan_filter Result PASSED:
18/11/2019 22:31:14             dut.10.240.176.208: quit
18/11/2019 22:31:14             dut.10.240.176.208: quit
Telling cores to stop...
Waiting for lcores to finish...

  ---------------------- Forward statistics for port 0  ----------------------
  RX-packets: 20             RX-dropped: 0             RX-total: 20
  TX-packets: 20             TX-dropped: 0             TX-total: 20
  ----------------------------------------------------------------------------

  ---------------------- Forward statistics for port 1  ----------------------
  RX-packets: 0              RX-dropped: 0             RX-total: 0
  TX-packets: 0              TX-dropped: 20            TX-total: 20
  ----------------------------------------------------------------------------

  ---------------------- Forward statistics for port 2  ----------------------
  RX-packets: 0              RX-dropped: 0             RX-total: 0
  TX-packets: 0              TX-dropped: 0             TX-total: 0
  ----------------------------------------------------------------------------

  +++++++++++++++ Accumulated forward statistics for all ports+++++++++++++++
  RX-packets: 20             RX-dropped: 0             RX-total: 20
  TX-packets: 20             TX-dropped: 20            TX-total: 40
  ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Done.

Stopping port 0...
Stopping ports...
Done

Stopping port 1...
Stopping ports...
Done

Stopping port 2...
Stopping ports...
Done

Shutting down port 0...
Closing ports...
Done

Shutting down port 1...
Closing ports...
Done

Shutting down port 2...
Closing ports...
Done

Bye...
18/11/2019 22:31:17             dut.10.240.176.208: kill_all: called by dut and prefix list has value.
18/11/2019 22:31:30             dut.10.240.176.208: There are some dpdk process not free hugepage
18/11/2019 22:31:30             dut.10.240.176.208: **************************************
18/11/2019 22:31:30             dut.10.240.176.208: lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/989/gvfs
      Output information may be incomplete.
18/11/2019 22:31:30             dut.10.240.176.208: **************************************
18/11/2019 22:31:31             dut.10.240.176.208: There are some dpdk process not free hugepage
18/11/2019 22:31:31             dut.10.240.176.208: **************************************
18/11/2019 22:31:31             dut.10.240.176.208: lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/989/gvfs
      Output information may be incomplete.
18/11/2019 22:31:31             dut.10.240.176.208: **************************************
18/11/2019 22:31:32             dut.10.240.176.208: There are some dpdk process not free hugepage
18/11/2019 22:31:32             dut.10.240.176.208: **************************************
18/11/2019 22:31:32             dut.10.240.176.208: lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/989/gvfs
      Output information may be incomplete.
18/11/2019 22:31:32             dut.10.240.176.208: **************************************
18/11/2019 22:31:33             dut.10.240.176.208: There are some dpdk process not free hugepage
18/11/2019 22:31:33             dut.10.240.176.208: **************************************
18/11/2019 22:31:33             dut.10.240.176.208: lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/989/gvfs
      Output information may be incomplete.
18/11/2019 22:31:33             dut.10.240.176.208: **************************************
18/11/2019 22:31:34             dut.10.240.176.208: There are some dpdk process not free hugepage
18/11/2019 22:31:34             dut.10.240.176.208: **************************************
18/11/2019 22:31:34             dut.10.240.176.208: lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/989/gvfs
      Output information may be incomplete.
18/11/2019 22:31:34             dut.10.240.176.208: **************************************
18/11/2019 22:31:35             dut.10.240.176.208: There are some dpdk process not free hugepage
18/11/2019 22:31:35             dut.10.240.176.208: **************************************
18/11/2019 22:31:35             dut.10.240.176.208: lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/989/gvfs
      Output information may be incomplete.
18/11/2019 22:31:35             dut.10.240.176.208: **************************************
18/11/2019 22:31:36             dut.10.240.176.208: There are some dpdk process not free hugepage
18/11/2019 22:31:36             dut.10.240.176.208: **************************************
18/11/2019 22:31:36             dut.10.240.176.208: lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/989/gvfs
      Output information may be incomplete.
18/11/2019 22:31:36             dut.10.240.176.208: **************************************
18/11/2019 22:31:38             dut.10.240.176.208: There are some dpdk process not free hugepage
18/11/2019 22:31:38             dut.10.240.176.208: **************************************
18/11/2019 22:31:38             dut.10.240.176.208: lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/989/gvfs
      Output information may be incomplete.
18/11/2019 22:31:38             dut.10.240.176.208: **************************************
18/11/2019 22:31:39             dut.10.240.176.208: There are some dpdk process not free hugepage
18/11/2019 22:31:39             dut.10.240.176.208: **************************************
18/11/2019 22:31:39             dut.10.240.176.208: lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/989/gvfs
      Output information may be incomplete.
18/11/2019 22:31:39             dut.10.240.176.208: **************************************
18/11/2019 22:31:40             dut.10.240.176.208: There are some dpdk process not free hugepage
18/11/2019 22:31:40             dut.10.240.176.208: **************************************
18/11/2019 22:31:40             dut.10.240.176.208: lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/989/gvfs
      Output information may be incomplete.
18/11/2019 22:31:40             dut.10.240.176.208: **************************************
18/11/2019 22:31:41             dut.10.240.176.208: There are some dpdk process not free hugepage
18/11/2019 22:31:41             dut.10.240.176.208: **************************************
18/11/2019 22:31:41             dut.10.240.176.208: lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/989/gvfs
      Output information may be incomplete.
18/11/2019 22:31:41             dut.10.240.176.208: **************************************
18/11/2019 22:31:42             dut.10.240.176.208: There are some dpdk process not free hugepage
18/11/2019 22:31:42             dut.10.240.176.208: **************************************
18/11/2019 22:31:42             dut.10.240.176.208: lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/989/gvfs
      Output information may be incomplete.
18/11/2019 22:31:42             dut.10.240.176.208: **************************************
18/11/2019 22:31:46             dut.10.240.176.208: kill_all: called by dut and has no prefix list.
18/11/2019 22:31:49                            dts: 
TEST SUITE ENDED: TestPortRepresentor

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dts] [PATCH V2] tests/port_representor:new automation of port_representor
  2019-11-18  3:03 ` Zeng, XiaoxiaoX
@ 2019-11-25  1:15   ` Zhang, Yuwei1
  0 siblings, 0 replies; 4+ messages in thread
From: Zhang, Yuwei1 @ 2019-11-25  1:15 UTC (permalink / raw)
  To: Zeng, XiaoxiaoX, Xie, WeiX, dts; +Cc: Xie, WeiX

Acked-by: Yuwei Zhang<yuwei1.zhang@intel.com>

-----Original Message-----
From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Zeng, XiaoxiaoX
Sent: Monday, November 18, 2019 11:03 AM
To: Xie, WeiX <weix.xie@intel.com>; dts@dpdk.org
Cc: Xie, WeiX <weix.xie@intel.com>
Subject: Re: [dts] [PATCH V2] tests/port_representor:new automation of port_representor

Tested-by:  Zeng,XiaoxiaoX< xiaoxiaox.zeng@intel.com>

-----Original Message-----
From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Xie Wei
Sent: Monday, November 18, 2019 10:54 AM
To: dts@dpdk.org
Cc: Xie, WeiX <weix.xie@intel.com>
Subject: [dts] [PATCH V2] tests/port_representor:new automation of port_representor

new automation of port_representor

Signed-off-by: Xie Wei <weix.xie@intel.com>
---
 tests/TestSuite_port_representor.py | 270 ++++++++++++++++++++++++++++
 1 file changed, 270 insertions(+)
 create mode 100644 tests/TestSuite_port_representor.py

diff --git a/tests/TestSuite_port_representor.py b/tests/TestSuite_port_representor.py
new file mode 100644
index 0000000..04f7838
--- /dev/null
+++ b/tests/TestSuite_port_representor.py
@@ -0,0 +1,270 @@
+# BSD LICENSE
+#
+# Copyright(c) <2019> Intel Corporation. All rights reserved.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without # 
+modification, are permitted provided that the following conditions # 
+are met:
+#
+#   * Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+#   * Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in
+#     the documentation and/or other materials provided with the
+#     distribution.
+#   * Neither the name of Intel Corporation nor the names of its
+#     contributors may be used to endorse or promote products derived
+#     from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # 
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # 
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # 
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # 
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # 
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # 
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # 
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # 
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # 
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # 
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Use two representor ports as the control plane to manage the two VFs, 
+the control plane could change VFs behavior such as change promiscous 
+mode, stats reset, etc. our statistical data information is independent 
+on the control plane and data plane.
+"""
+
+import time
+import re
+
+from test_case import TestCase
+from dut import Dut
+from packet import Packet
+from pmd_output import PmdOutput
+
+
+class TestPortRepresentor(TestCase):
+    def set_up_all(self):
+        """
+        Prerequisite steps for each test suite.
+        """
+        self.verify(self.nic in ["fortville_eagle", "fortville_spirit",
+                                 "fortville_spirit_single", "fortville_25g"], "NIC Unsupported: " + str(self.nic))
+        self.dut_ports = self.dut.get_ports(self.nic)
+        self.verify(len(self.dut_ports) >= 1, "Insufficient ports")
+
+        self.session_secondary = self.dut.new_session()
+        self.session_third = self.dut.new_session()
+        self.pmdout_pf = PmdOutput(self.dut)
+        self.pmdout_vf0 = PmdOutput(self.dut, self.session_secondary)
+        self.pmdout_vf1 = PmdOutput(self.dut, self.session_third)
+
+        localPort = self.tester.get_local_port(self.dut_ports[0])
+        self.tester_itf = self.tester.get_interface(localPort)
+        self.tester_mac = self.tester.get_mac(localPort)
+        self.pf_mac = self.dut.get_mac_address(0)
+        self.pf_pci = self.dut.ports_info[self.dut_ports[0]]['pci']
+
+        self.unicast_mac = "00:11:22:33:44:55"
+
+        # This is to set up 1pf and 2vfs environment
+        # PF is bound to igb_uio, while VF is bound to vfio-pci.
+        self.dut.generate_sriov_vfs_by_port(self.dut_ports[0], 2, "igb_uio")
+        self.two_vfs_port = self.dut.ports_info[self.dut_ports[0]]["vfs_port"]
+        self.dut.send_expect("modprobe vfio-pci", "#", 3)
+        try:
+            for port in self.two_vfs_port:
+                port.bind_driver(driver="vfio-pci")
+        except Exception as e:
+            self.destroy_env()
+            raise Exception(e)
+        self.vfs_pci =
+ self.dut.ports_info[self.dut_ports[0]]['sriov_vfs_pci']
+
+    def set_up(self):
+        """
+        Run before each test case.
+        """
+        self.vf_flag = 1
+
+    def destroy_env(self):
+        """
+        This is to stop testpmd and destroy 1pf and 2vfs environment.
+        """
+        if self.vf_flag == 1:
+            self.pmdout_vf1.execute_cmd("quit", "#")
+            time.sleep(3)
+            self.pmdout_vf0.execute_cmd("quit", "#")
+            time.sleep(3)
+            self.pmdout_pf.execute_cmd("quit", "#")
+            time.sleep(3)
+        else:
+            self.pmdout_pf.execute_cmd("quit", "#")
+        self.vf_flag = 0
+
+    def testpmd_pf(self):
+        self.pmdout_pf.start_testpmd("Default", eal_param="-w 
+ %s,representor=0-1" % self.pf_pci, param="--port-topology=chained")
+
+    def testpmd_vf0(self):
+        self.out_vf0 = self.pmdout_vf0.start_testpmd("Default", eal_param="-w %s --file-prefix testpmd-vf0" % self.vfs_pci[0])
+        self.vf0_mac = self.pmdout_vf0.get_port_mac(0)
+
+    def testpmd_vf1(self):
+        self.out_vf1 = self.pmdout_vf1.start_testpmd("Default", eal_param="-w %s --file-prefix testpmd-vf1" % self.vfs_pci[1])
+        self.vf1_mac = self.pmdout_vf1.get_port_mac(0)
+
+    def check_port_stats(self):
+        """
+        show and check port stats
+        """
+        out = self.pmdout_pf.execute_cmd("show port stats all", "testpmd>")
+        self.logger.info(out)
+        result = re.compile('RX-packets:\s+(.*?)\s+?').findall(out, re.S)
+        return result
+
+    def clear_port_stats(self):
+        """
+        clear port stats in control testpmd
+        """
+        self.pmdout_pf.execute_cmd("clear vf stats 0 0", "testpmd>", 2)
+        self.pmdout_pf.execute_cmd("clear vf stats 0 1", "testpmd>", 2)
+        self.pmdout_pf.execute_cmd("clear port stats all", "testpmd>",
+ 2)
+
+    def test_port_representor_vf_stats_show_and_clear(self):
+        """
+        use control testpmd to get and clear dataplane testpmd ports Stats
+        """
+        self.testpmd_pf()
+        self.pmdout_pf.execute_cmd("set promisc 0 off", "testpmd>")
+        self.pmdout_pf.execute_cmd("start", "testpmd>", 2)
+        self.testpmd_vf0()
+        self.pmdout_vf0.execute_cmd("set promisc 0 off", "testpmd>")
+        self.pmdout_vf0.execute_cmd("start", "testpmd>", 2)
+        self.testpmd_vf1()
+        self.pmdout_vf1.execute_cmd("set promisc 0 off", "testpmd>")
+        self.pmdout_vf1.execute_cmd("start", "testpmd>", 2)
+        # send 30 packets
+        pkt1 = 'Ether(src="%s",dst="%s")/IP()' % (self.tester_mac, self.pf_mac)
+        pkt2 = 'Ether(src="%s",dst="%s")/IP()' % (self.tester_mac, self.vf0_mac)
+        pkt3 = 'Ether(src="%s",dst="%s")/IP()' % (self.tester_mac, self.vf1_mac)
+        pkts = [pkt1, pkt2, pkt3]
+        p = Packet()
+        for i in pkts:
+            p.append_pkt(i)
+        p.send_pkt(self.tester, tx_port=self.tester_itf, count=10)
+        # check port stats in control testpmd
+        result_before = self.check_port_stats()
+        self.verify(int(result_before[1]) == 10 and int(result_before[2]) == 10, "VF Stats show error")
+        self.clear_port_stats()
+        result_after = self.check_port_stats()
+        self.verify(int(result_after[1]) == 0 and int(result_after[2]) 
+ == 0, "VF Stats clear error")
+
+    def test_port_representor_vf_promiscous(self):
+        """
+        use control testpmd to enable/disable dataplane testpmd ports promiscous mode
+        """
+        self.testpmd_pf()
+        self.pmdout_pf.execute_cmd("set promisc 0 off", "testpmd>")
+        self.pmdout_pf.execute_cmd("start", "testpmd>", 2)
+        self.testpmd_vf0()
+        self.pmdout_vf0.execute_cmd("start", "testpmd>", 2)
+        self.testpmd_vf1()
+        self.pmdout_vf1.execute_cmd("start", "testpmd>", 2)
+
+        # set vf promisc enable and send 40 packets
+        self.pmdout_pf.execute_cmd("set promisc 1 on", "testpmd>")
+        pkt1 = 'Ether(src="%s",dst="%s")/IP()' % (self.tester_mac, self.pf_mac)
+        pkt2 = 'Ether(src="%s",dst="%s")/IP()' % (self.tester_mac, self.vf0_mac)
+        pkt3 = 'Ether(src="%s",dst="%s")/IP()' % (self.tester_mac, self.vf1_mac)
+        pkt4 = 'Ether(src="%s",dst="%s")/IP()' % (self.tester_mac, self.unicast_mac)
+        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, count=10)
+        # check port stats in control testpmd
+        result_enable = self.check_port_stats()
+        self.verify(int(result_enable[1]) == 20 and int(result_enable[2]) == 20, "VFs receive packets error")
+        self.clear_port_stats()
+        # set vf promisc disable and send 40 packets
+        self.pmdout_pf.execute_cmd("set promisc 1 off", "testpmd>")
+        p = Packet()
+        for i in pkts:
+            p.append_pkt(i)
+        p.send_pkt(self.tester, tx_port=self.tester_itf, count=10)
+        # check port stats in control testpmd
+        result_disable = self.check_port_stats()
+        self.verify(int(result_disable[1]) == 10 and
+ int(result_disable[2]) == 20, "VFs receive packets error")
+
+    def test_port_representor_vf_mac_addr(self):
+        """
+        use control testpmd to set vf mac address
+        """
+        self.testpmd_pf()
+        self.pmdout_pf.execute_cmd("mac_addr set 1 aa:11:22:33:44:55", "testpmd>")
+        self.pmdout_pf.execute_cmd("mac_addr set 2 aa:22:33:44:55:66", "testpmd>")
+        self.pmdout_pf.execute_cmd("set promisc 0 off", "testpmd>")
+        self.pmdout_pf.execute_cmd("start", "testpmd>", 2)
+        self.testpmd_vf0()
+        self.pmdout_vf0.execute_cmd("set promisc 0 off", "testpmd>")
+        self.pmdout_vf0.execute_cmd("start", "testpmd>", 2)
+        self.testpmd_vf1()
+        self.pmdout_vf1.execute_cmd("set promisc 0 off", "testpmd>")
+        self.pmdout_vf1.execute_cmd("start", "testpmd>", 2)
+        # send 40 packets
+        pkt1 = 'Ether(src="%s",dst="%s")/IP()' % (self.tester_mac, self.pf_mac)
+        pkt2 = 'Ether(src="%s",dst="%s")/IP()' % (self.tester_mac, self.vf0_mac)
+        pkt3 = 'Ether(src="%s",dst="%s")/IP()' % (self.tester_mac, self.vf1_mac)
+        pkt4 = 'Ether(src="%s",dst="%s")/IP()' % (self.tester_mac, self.unicast_mac)
+        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, count=10)
+        # check port stats in control testpmd
+        result = self.check_port_stats()
+        self.verify(int(result[1]) == 10 and int(result[2]) == 10, "VFs 
+ receive packets error")
+
+    def test_port_representor_vlan_filter(self):
+        """
+        use control testpmd to set vlan
+        """
+        self.testpmd_pf()
+        self.pmdout_pf.execute_cmd("set promisc 1 off", "testpmd>")
+        self.pmdout_pf.execute_cmd("vlan set filter on 1", "testpmd>")
+        self.pmdout_pf.execute_cmd("rx_vlan add 3 1", "testpmd>")
+        self.pmdout_pf.execute_cmd("set promisc 2 off", "testpmd>")
+        self.pmdout_pf.execute_cmd("vlan set filter on 2", "testpmd>")
+        self.pmdout_pf.execute_cmd("rx_vlan add 4 2", "testpmd>")
+        self.pmdout_pf.execute_cmd("start", "testpmd>", 2)
+        self.testpmd_vf0()
+        self.pmdout_vf0.execute_cmd("start", "testpmd>", 2)
+        self.testpmd_vf1()
+        self.pmdout_vf1.execute_cmd("start", "testpmd>", 2)
+        # send 20 packets
+        pkt1 = 'Ether(src="%s",dst="%s")/Dot1Q(vlan=3)/IP()' % (self.tester_mac, self.vf0_mac)
+        pkt2 = 'Ether(src="%s",dst="%s")/Dot1Q(vlan=4)/IP()' % (self.tester_mac, self.vf1_mac)
+        pkts = [pkt1, pkt2]
+        p = Packet()
+        for i in pkts:
+            p.append_pkt(i)
+        p.send_pkt(self.tester, tx_port=self.tester_itf, count=10)
+        # check port stats in control testpmd
+        result = self.check_port_stats()
+        self.verify(int(result[1]) == 10 and int(result[2]) == 10, "VFs 
+ receive packets error")
+
+    def tear_down(self):
+        """
+        Run after each test case.
+        """
+        self.destroy_env()
+
+    def tear_down_all(self):
+        """
+        Run after each test suite.
+        """
+        self.dut.kill_all()
+        self.dut.destroy_sriov_vfs_by_port(self.dut_ports[0])
+        self.dut.close_session(self.session_secondary)
+        self.dut.close_session(self.session_third)
--
2.17.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dts] [PATCH V2] tests/port_representor:new automation of port_representor
  2019-11-18  2:53 [dts] [PATCH V2] tests/port_representor:new automation of port_representor Xie Wei
  2019-11-18  3:03 ` Zeng, XiaoxiaoX
@ 2019-11-27  9:01 ` Tu, Lijuan
  1 sibling, 0 replies; 4+ messages in thread
From: Tu, Lijuan @ 2019-11-27  9:01 UTC (permalink / raw)
  To: Xie, WeiX, dts; +Cc: Xie, WeiX

Applied, thanks

> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Xie Wei
> Sent: Monday, November 18, 2019 10:54 AM
> To: dts@dpdk.org
> Cc: Xie, WeiX <weix.xie@intel.com>
> Subject: [dts] [PATCH V2] tests/port_representor:new automation of
> port_representor
> 
> new automation of port_representor
> 
> Signed-off-by: Xie Wei <weix.xie@intel.com>
> ---
>  tests/TestSuite_port_representor.py | 270 ++++++++++++++++++++++++++++
>  1 file changed, 270 insertions(+)
>  create mode 100644 tests/TestSuite_port_representor.py
> 
> diff --git a/tests/TestSuite_port_representor.py
> b/tests/TestSuite_port_representor.py
> new file mode 100644
> index 0000000..04f7838
> --- /dev/null
> +++ b/tests/TestSuite_port_representor.py
> @@ -0,0 +1,270 @@
> +# BSD LICENSE
> +#
> +# Copyright(c) <2019> Intel Corporation. All rights reserved.
> +# All rights reserved.
> +#
> +# Redistribution and use in source and binary forms, with or without #
> +modification, are permitted provided that the following conditions #
> +are met:
> +#
> +#   * Redistributions of source code must retain the above copyright
> +#     notice, this list of conditions and the following disclaimer.
> +#   * Redistributions in binary form must reproduce the above copyright
> +#     notice, this list of conditions and the following disclaimer in
> +#     the documentation and/or other materials provided with the
> +#     distribution.
> +#   * Neither the name of Intel Corporation nor the names of its
> +#     contributors may be used to endorse or promote products derived
> +#     from this software without specific prior written permission.
> +#
> +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
> CONTRIBUTORS #
> +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> #
> +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
> FOR #
> +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
> COPYRIGHT #
> +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
> INCIDENTAL, #
> +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
> NOT #
> +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> USE, #
> +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> ON ANY #
> +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> #
> +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
> THE USE #
> +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
> DAMAGE.
> +
> +"""
> +Use two representor ports as the control plane to manage the two VFs,
> +the control plane could change VFs behavior such as change promiscous
> +mode, stats reset, etc. our statistical data information is independent
> +on the control plane and data plane.
> +"""
> +
> +import time
> +import re
> +
> +from test_case import TestCase
> +from dut import Dut
> +from packet import Packet
> +from pmd_output import PmdOutput
> +
> +
> +class TestPortRepresentor(TestCase):
> +    def set_up_all(self):
> +        """
> +        Prerequisite steps for each test suite.
> +        """
> +        self.verify(self.nic in ["fortville_eagle", "fortville_spirit",
> +                                 "fortville_spirit_single", "fortville_25g"], "NIC
> Unsupported: " + str(self.nic))
> +        self.dut_ports = self.dut.get_ports(self.nic)
> +        self.verify(len(self.dut_ports) >= 1, "Insufficient ports")
> +
> +        self.session_secondary = self.dut.new_session()
> +        self.session_third = self.dut.new_session()
> +        self.pmdout_pf = PmdOutput(self.dut)
> +        self.pmdout_vf0 = PmdOutput(self.dut, self.session_secondary)
> +        self.pmdout_vf1 = PmdOutput(self.dut, self.session_third)
> +
> +        localPort = self.tester.get_local_port(self.dut_ports[0])
> +        self.tester_itf = self.tester.get_interface(localPort)
> +        self.tester_mac = self.tester.get_mac(localPort)
> +        self.pf_mac = self.dut.get_mac_address(0)
> +        self.pf_pci = self.dut.ports_info[self.dut_ports[0]]['pci']
> +
> +        self.unicast_mac = "00:11:22:33:44:55"
> +
> +        # This is to set up 1pf and 2vfs environment
> +        # PF is bound to igb_uio, while VF is bound to vfio-pci.
> +        self.dut.generate_sriov_vfs_by_port(self.dut_ports[0], 2, "igb_uio")
> +        self.two_vfs_port = self.dut.ports_info[self.dut_ports[0]]["vfs_port"]
> +        self.dut.send_expect("modprobe vfio-pci", "#", 3)
> +        try:
> +            for port in self.two_vfs_port:
> +                port.bind_driver(driver="vfio-pci")
> +        except Exception as e:
> +            self.destroy_env()
> +            raise Exception(e)
> +        self.vfs_pci =
> + self.dut.ports_info[self.dut_ports[0]]['sriov_vfs_pci']
> +
> +    def set_up(self):
> +        """
> +        Run before each test case.
> +        """
> +        self.vf_flag = 1
> +
> +    def destroy_env(self):
> +        """
> +        This is to stop testpmd and destroy 1pf and 2vfs environment.
> +        """
> +        if self.vf_flag == 1:
> +            self.pmdout_vf1.execute_cmd("quit", "#")
> +            time.sleep(3)
> +            self.pmdout_vf0.execute_cmd("quit", "#")
> +            time.sleep(3)
> +            self.pmdout_pf.execute_cmd("quit", "#")
> +            time.sleep(3)
> +        else:
> +            self.pmdout_pf.execute_cmd("quit", "#")
> +        self.vf_flag = 0
> +
> +    def testpmd_pf(self):
> +        self.pmdout_pf.start_testpmd("Default", eal_param="-w
> + %s,representor=0-1" % self.pf_pci, param="--port-topology=chained")
> +
> +    def testpmd_vf0(self):
> +        self.out_vf0 = self.pmdout_vf0.start_testpmd("Default", eal_param="-
> w %s --file-prefix testpmd-vf0" % self.vfs_pci[0])
> +        self.vf0_mac = self.pmdout_vf0.get_port_mac(0)
> +
> +    def testpmd_vf1(self):
> +        self.out_vf1 = self.pmdout_vf1.start_testpmd("Default", eal_param="-
> w %s --file-prefix testpmd-vf1" % self.vfs_pci[1])
> +        self.vf1_mac = self.pmdout_vf1.get_port_mac(0)
> +
> +    def check_port_stats(self):
> +        """
> +        show and check port stats
> +        """
> +        out = self.pmdout_pf.execute_cmd("show port stats all", "testpmd>")
> +        self.logger.info(out)
> +        result = re.compile('RX-packets:\s+(.*?)\s+?').findall(out, re.S)
> +        return result
> +
> +    def clear_port_stats(self):
> +        """
> +        clear port stats in control testpmd
> +        """
> +        self.pmdout_pf.execute_cmd("clear vf stats 0 0", "testpmd>", 2)
> +        self.pmdout_pf.execute_cmd("clear vf stats 0 1", "testpmd>", 2)
> +        self.pmdout_pf.execute_cmd("clear port stats all", "testpmd>",
> + 2)
> +
> +    def test_port_representor_vf_stats_show_and_clear(self):
> +        """
> +        use control testpmd to get and clear dataplane testpmd ports Stats
> +        """
> +        self.testpmd_pf()
> +        self.pmdout_pf.execute_cmd("set promisc 0 off", "testpmd>")
> +        self.pmdout_pf.execute_cmd("start", "testpmd>", 2)
> +        self.testpmd_vf0()
> +        self.pmdout_vf0.execute_cmd("set promisc 0 off", "testpmd>")
> +        self.pmdout_vf0.execute_cmd("start", "testpmd>", 2)
> +        self.testpmd_vf1()
> +        self.pmdout_vf1.execute_cmd("set promisc 0 off", "testpmd>")
> +        self.pmdout_vf1.execute_cmd("start", "testpmd>", 2)
> +        # send 30 packets
> +        pkt1 = 'Ether(src="%s",dst="%s")/IP()' % (self.tester_mac, self.pf_mac)
> +        pkt2 = 'Ether(src="%s",dst="%s")/IP()' % (self.tester_mac, self.vf0_mac)
> +        pkt3 = 'Ether(src="%s",dst="%s")/IP()' % (self.tester_mac, self.vf1_mac)
> +        pkts = [pkt1, pkt2, pkt3]
> +        p = Packet()
> +        for i in pkts:
> +            p.append_pkt(i)
> +        p.send_pkt(self.tester, tx_port=self.tester_itf, count=10)
> +        # check port stats in control testpmd
> +        result_before = self.check_port_stats()
> +        self.verify(int(result_before[1]) == 10 and int(result_before[2]) == 10,
> "VF Stats show error")
> +        self.clear_port_stats()
> +        result_after = self.check_port_stats()
> +        self.verify(int(result_after[1]) == 0 and int(result_after[2])
> + == 0, "VF Stats clear error")
> +
> +    def test_port_representor_vf_promiscous(self):
> +        """
> +        use control testpmd to enable/disable dataplane testpmd ports
> promiscous mode
> +        """
> +        self.testpmd_pf()
> +        self.pmdout_pf.execute_cmd("set promisc 0 off", "testpmd>")
> +        self.pmdout_pf.execute_cmd("start", "testpmd>", 2)
> +        self.testpmd_vf0()
> +        self.pmdout_vf0.execute_cmd("start", "testpmd>", 2)
> +        self.testpmd_vf1()
> +        self.pmdout_vf1.execute_cmd("start", "testpmd>", 2)
> +
> +        # set vf promisc enable and send 40 packets
> +        self.pmdout_pf.execute_cmd("set promisc 1 on", "testpmd>")
> +        pkt1 = 'Ether(src="%s",dst="%s")/IP()' % (self.tester_mac, self.pf_mac)
> +        pkt2 = 'Ether(src="%s",dst="%s")/IP()' % (self.tester_mac, self.vf0_mac)
> +        pkt3 = 'Ether(src="%s",dst="%s")/IP()' % (self.tester_mac, self.vf1_mac)
> +        pkt4 = 'Ether(src="%s",dst="%s")/IP()' % (self.tester_mac,
> self.unicast_mac)
> +        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, count=10)
> +        # check port stats in control testpmd
> +        result_enable = self.check_port_stats()
> +        self.verify(int(result_enable[1]) == 20 and int(result_enable[2]) == 20,
> "VFs receive packets error")
> +        self.clear_port_stats()
> +        # set vf promisc disable and send 40 packets
> +        self.pmdout_pf.execute_cmd("set promisc 1 off", "testpmd>")
> +        p = Packet()
> +        for i in pkts:
> +            p.append_pkt(i)
> +        p.send_pkt(self.tester, tx_port=self.tester_itf, count=10)
> +        # check port stats in control testpmd
> +        result_disable = self.check_port_stats()
> +        self.verify(int(result_disable[1]) == 10 and
> + int(result_disable[2]) == 20, "VFs receive packets error")
> +
> +    def test_port_representor_vf_mac_addr(self):
> +        """
> +        use control testpmd to set vf mac address
> +        """
> +        self.testpmd_pf()
> +        self.pmdout_pf.execute_cmd("mac_addr set 1 aa:11:22:33:44:55",
> "testpmd>")
> +        self.pmdout_pf.execute_cmd("mac_addr set 2 aa:22:33:44:55:66",
> "testpmd>")
> +        self.pmdout_pf.execute_cmd("set promisc 0 off", "testpmd>")
> +        self.pmdout_pf.execute_cmd("start", "testpmd>", 2)
> +        self.testpmd_vf0()
> +        self.pmdout_vf0.execute_cmd("set promisc 0 off", "testpmd>")
> +        self.pmdout_vf0.execute_cmd("start", "testpmd>", 2)
> +        self.testpmd_vf1()
> +        self.pmdout_vf1.execute_cmd("set promisc 0 off", "testpmd>")
> +        self.pmdout_vf1.execute_cmd("start", "testpmd>", 2)
> +        # send 40 packets
> +        pkt1 = 'Ether(src="%s",dst="%s")/IP()' % (self.tester_mac, self.pf_mac)
> +        pkt2 = 'Ether(src="%s",dst="%s")/IP()' % (self.tester_mac, self.vf0_mac)
> +        pkt3 = 'Ether(src="%s",dst="%s")/IP()' % (self.tester_mac, self.vf1_mac)
> +        pkt4 = 'Ether(src="%s",dst="%s")/IP()' % (self.tester_mac,
> self.unicast_mac)
> +        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, count=10)
> +        # check port stats in control testpmd
> +        result = self.check_port_stats()
> +        self.verify(int(result[1]) == 10 and int(result[2]) == 10, "VFs
> + receive packets error")
> +
> +    def test_port_representor_vlan_filter(self):
> +        """
> +        use control testpmd to set vlan
> +        """
> +        self.testpmd_pf()
> +        self.pmdout_pf.execute_cmd("set promisc 1 off", "testpmd>")
> +        self.pmdout_pf.execute_cmd("vlan set filter on 1", "testpmd>")
> +        self.pmdout_pf.execute_cmd("rx_vlan add 3 1", "testpmd>")
> +        self.pmdout_pf.execute_cmd("set promisc 2 off", "testpmd>")
> +        self.pmdout_pf.execute_cmd("vlan set filter on 2", "testpmd>")
> +        self.pmdout_pf.execute_cmd("rx_vlan add 4 2", "testpmd>")
> +        self.pmdout_pf.execute_cmd("start", "testpmd>", 2)
> +        self.testpmd_vf0()
> +        self.pmdout_vf0.execute_cmd("start", "testpmd>", 2)
> +        self.testpmd_vf1()
> +        self.pmdout_vf1.execute_cmd("start", "testpmd>", 2)
> +        # send 20 packets
> +        pkt1 = 'Ether(src="%s",dst="%s")/Dot1Q(vlan=3)/IP()' %
> (self.tester_mac, self.vf0_mac)
> +        pkt2 = 'Ether(src="%s",dst="%s")/Dot1Q(vlan=4)/IP()' %
> (self.tester_mac, self.vf1_mac)
> +        pkts = [pkt1, pkt2]
> +        p = Packet()
> +        for i in pkts:
> +            p.append_pkt(i)
> +        p.send_pkt(self.tester, tx_port=self.tester_itf, count=10)
> +        # check port stats in control testpmd
> +        result = self.check_port_stats()
> +        self.verify(int(result[1]) == 10 and int(result[2]) == 10, "VFs
> + receive packets error")
> +
> +    def tear_down(self):
> +        """
> +        Run after each test case.
> +        """
> +        self.destroy_env()
> +
> +    def tear_down_all(self):
> +        """
> +        Run after each test suite.
> +        """
> +        self.dut.kill_all()
> +        self.dut.destroy_sriov_vfs_by_port(self.dut_ports[0])
> +        self.dut.close_session(self.session_secondary)
> +        self.dut.close_session(self.session_third)
> --
> 2.17.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-11-27  9:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-18  2:53 [dts] [PATCH V2] tests/port_representor:new automation of port_representor Xie Wei
2019-11-18  3:03 ` Zeng, XiaoxiaoX
2019-11-25  1:15   ` Zhang, Yuwei1
2019-11-27  9:01 ` Tu, Lijuan

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).