test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH] tests: add TestSuite_ixgbe_vf_get_extra_queue_information.py
@ 2019-04-02  9:37 Yuan Peng
  2019-04-03  3:02 ` Li, WenjieX A
  2019-04-03 18:16 ` Tu, Lijuan
  0 siblings, 2 replies; 5+ messages in thread
From: Yuan Peng @ 2019-04-02  9:37 UTC (permalink / raw)
  To: dts; +Cc: Peng Yuan

From: Peng Yuan <yuan.peng@intel.com>

Add TestSuite_ixgbe_vf_get_extra_queue_information.py

Signed-off-by: Peng Yuan <yuan.peng@intel.com>

diff --git a/tests/TestSuite_ixgbe_vf_get_extra_queue_information.py b/tests/TestSuite_ixgbe_vf_get_extra_queue_information.py
new file mode 100644
index 0000000..c712942
--- /dev/null
+++ b/tests/TestSuite_ixgbe_vf_get_extra_queue_information.py
@@ -0,0 +1,285 @@
+# BSD LICENSE
+#
+# Copyright(c) 2010-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.
+
+"""
+DPDK Test suite.
+Test Niantic ixgbe_get_vf_queue Include Extra Information function.
+"""
+import time
+import random
+import re
+import utils
+
+# Use scapy to send packets with different source and dest ip.
+# and collect the hash result of five tuple and the queue id.
+from test_case import TestCase
+from pmd_output import PmdOutput
+from virt_common import VM
+from qemu_kvm import QEMUKvm
+
+class TestIxgbeVfGetExtraInfo(TestCase):
+
+
+    def get_packet_bytes(self, queue):
+        """
+        Get rx queue packets and bytes.
+        """
+        out = self.vm0_dut.send_expect("ethtool -S %s" % self.vm0_intf0, "#")
+        lines = out.split("\r\n")
+
+        for line in lines:
+            line = line.strip()
+            if ("rx_queue_%s_packets" % queue) in line:
+                rev_queue, rev_num = line.split(': ', 1)
+        for line in lines:
+            line = line.strip()
+            if ("rx_queue_%s_bytes" % queue) in line:
+                rev_queue, rev_byte = line.split(': ', 1)
+
+        return rev_num, rev_byte
+
+    def send_verify_up(self, prio="", vlan=""):
+        """
+        Send packets including user priority and verify the result.
+        """
+        if prio=="1" or prio=="2" or prio=="3":
+            rev_num, rev_byte = self.get_packet_bytes(prio)
+        else:
+            rev_num, rev_byte = self.get_packet_bytes("0")
+
+        self.tester.scapy_foreground()
+        self.tester.scapy_append('sys.path.append("./")')
+        self.vm0_vf0_mac = self.vm0_dut.get_mac_address(0)
+        # send packet with different parameters
+        packet = r'sendp([Ether(src="%s",dst="%s")/Dot1Q(prio=%s, vlan=%s)/IP()/Raw("x"*20)], iface="%s")' % (
+            self.src_mac, self.vm0_vf0_mac, prio, vlan, self.tester_intf)
+        self.tester.scapy_append(packet)
+        self.tester.scapy_execute()
+        time.sleep(.5)
+
+        if prio=="1" or prio=="2" or prio=="3":
+            rev_num_after, rev_byte_after = self.get_packet_bytes(prio)
+        else:
+            rev_num_after, rev_byte_after = self.get_packet_bytes("0")
+
+        rev_num_added = int(rev_num_after) - int(rev_num)
+        rev_byte_added = int(rev_byte_after) - int(rev_byte)
+
+        if vlan == "0":
+            self.verify((rev_num_added == 1 and rev_byte_added == 60), "the packet is not sent to the right queue.")
+        else:
+            self.verify((rev_num_added == 0 and rev_byte_added == 0), "the packet is received.")
+
+    def send_verify_queue(self, ptype="ip"):
+        """
+        Send different packets, return the received queue.
+        """
+        rev_num0, rev_byte0 = self.get_packet_bytes("0")
+        rev_num1, rev_byte1 = self.get_packet_bytes("1")
+        self.tester.scapy_foreground()
+        self.tester.scapy_append('sys.path.append("./")')
+        self.vm0_vf0_mac = self.vm0_dut.get_mac_address(0)
+        # send packet with different parameters
+        if ptype == "ip":
+            packet = r'sendp([Ether(src="%s",dst="%s")/IP()/Raw("x"*20)], count=100, iface="%s")' % (
+                self.src_mac, self.vm0_vf0_mac, self.tester_intf)
+        elif ptype == "udp":
+            packet = r'sendp([Ether(src="%s",dst="%s")/IP(src="192.168.0.1", dst="192.168.0.3")/UDP(sport=23,dport=24)/Raw("x"*20)], count=100, iface="%s")' % (
+                self.src_mac, self.vm0_vf0_mac, self.tester_intf)
+        self.tester.scapy_append(packet)
+        self.tester.scapy_execute()
+
+        rev_num_after0, rev_byte_after0 = self.get_packet_bytes("0")
+        rev_num_after1, rev_byte_after1 = self.get_packet_bytes("1")
+
+        rev_num_added0 = int(rev_num_after0) - int(rev_num0)
+        rev_byte_added0 = int(rev_byte_after0) - int(rev_byte0)
+        rev_num_added1 = int(rev_num_after1) - int(rev_num1)
+        rev_byte_added1 = int(rev_byte_after1) - int(rev_byte1)
+
+        if rev_num_added0 == 100 and rev_byte_added0 != 0:
+            queue = 0
+        elif rev_num_added1 == 100 and rev_byte_added1 != 0:
+            queue = 1
+        else:
+            print utils.RED("There is no packet received.")
+
+        return queue
+
+    def set_up_all(self):
+        """
+        Run at the start of each test suite.
+        """
+        self.verify(self.nic in ["niantic"],
+            "NIC Unsupported: " + str(self.nic))
+        self.dut_ports = self.dut.get_ports(self.nic)
+        self.verify(len(self.dut_ports) >= 1, "Insufficient ports")
+        self.cores = "1S/8C/1T"
+
+        self.pf_mac = self.dut.get_mac_address(self.dut_ports[0])
+        txport = self.tester.get_local_port(self.dut_ports[0])
+        self.tester_intf = self.tester.get_interface(txport)
+        self.tester_mac = self.tester.get_mac(txport)
+
+        self.pf_intf = self.dut.ports_info[self.dut_ports[0]]['intf']
+        self.pf_pci = self.dut.ports_info[self.dut_ports[0]]['pci']
+        self.src_mac = '00:02:00:00:00:01'
+        self.dut.send_expect('modprobe vfio-pci', '#')
+
+        self.used_dut_port = self.dut_ports[0]
+        self.dut.generate_sriov_vfs_by_port(
+            self.used_dut_port, 1, driver='igb_uio')
+        self.sriov_vfs_port = self.dut.ports_info[
+            self.used_dut_port]['vfs_port']
+        for port in self.sriov_vfs_port:
+            port.bind_driver('vfio-pci')
+        time.sleep(1)
+
+    def set_up(self):
+        """
+        Run before each test case.
+        """
+        pass
+
+    def setup_vm_env(self):
+        """
+        1pf -> 1vf , vf->vm0
+        """
+        vf0_prop_1 = {'opt_host': self.sriov_vfs_port[0].pci}
+        self.vm0 = QEMUKvm(self.dut, 'vm0', 'ixgbe_vf_get_extra_queue_information')
+        self.vm0.set_vm_device(driver='vfio-pci', **vf0_prop_1)
+        try:
+            self.vm0_dut = self.vm0.start()
+            if self.vm0_dut is None:
+                raise Exception("Set up VM ENV failed")
+            else:
+                self.verify(self.vm0_dut.ports_info[0][
+                            'intf'] != 'N/A', "Not interface")
+        except Exception as e:
+            self.destroy_vm_env()
+            self.logger.error("Failure for %s" % str(e))
+
+        self.vm0_vf0_mac = self.vm0_dut.get_mac_address(0)
+        self.vm0_intf0 = self.vm0_dut.ports_info[0]['intf']
+
+        self.vm0_dut.restore_interfaces_linux()
+
+    def destroy_vm_env(self):
+        """
+        destroy vm environment
+        """
+        if getattr(self, 'vm0', None):
+            self.vm0_dut.kill_all()
+            self.vm0_dut_ports = None
+            self.vm0.stop()
+            self.vm0 = None
+
+        self.dut.virt_exit()
+
+    def destroy_vf_env(self):
+        """
+        destroy vf
+        """
+        if getattr(self, 'used_dut_port', None) != None:
+            self.dut.destroy_sriov_vfs_by_port(self.used_dut_port)
+            port = self.dut.ports_info[self.used_dut_port]['port']
+            self.used_dut_port = None
+
+    def verify_rx_queue(self, num):
+        """
+        verify the rx queue number
+        """
+        # pf up + vf up -> vf up
+        self.vm0_dut.send_expect("ifconfig %s up" % self.vm0_intf0, "#")
+        time.sleep(10)
+        out = self.vm0_dut.send_expect("ethtool -S %s" % self.vm0_intf0, "#")
+        self.verify(("rx_queue_%d" % (num-1)) in out, "Wrong rx queue number")
+        time.sleep(3)
+
+    def test_enable_dcb(self):
+        """
+        DPDK PF, kernel VF, enable DCB mode with TC=4
+        """
+        # start testpmd with PF on the host
+        self.dut_testpmd = PmdOutput(self.dut)
+        self.dut_testpmd.start_testpmd(
+            "%s" % self.cores, "--rxq=4 --txq=4 --nb-cores=4", "-w %s" % self.pf_pci)
+        self.dut_testpmd.execute_cmd("port stop 0")
+        self.dut_testpmd.execute_cmd("port config 0 dcb vt on 4 pfc off")
+        self.dut_testpmd.execute_cmd("port start 0")
+        time.sleep(5)
+        self.setup_vm_env()
+        # verify the vf get the extra info.
+        self.verify_rx_queue(4)
+        # verify the packet enter into the expected queue.
+        self.send_verify_up(prio="0",vlan="0")
+        self.send_verify_up(prio="1",vlan="0")
+        self.send_verify_up(prio="2",vlan="0")
+        self.send_verify_up(prio="3",vlan="0")
+        self.send_verify_up(prio="4",vlan="0")
+        self.send_verify_up(prio="5",vlan="0")
+        self.send_verify_up(prio="6",vlan="0")
+        self.send_verify_up(prio="7",vlan="0")
+        self.send_verify_up(prio="0",vlan="1")
+
+    def test_disable_dcb(self):
+        """
+        DPDK PF, kernel VF, disable DCB mode
+        """
+        # start testpmd with PF on the host
+        self.dut_testpmd = PmdOutput(self.dut)
+        self.dut_testpmd.start_testpmd(
+            "%s" % self.cores, "--rxq=2 --txq=2 --nb-cores=2", "-w %s" % self.pf_pci)
+        self.dut_testpmd.execute_cmd("start")
+        time.sleep(5)
+        self.setup_vm_env()
+        # verify the vf get the extra info.
+        self.verify_rx_queue(2)
+        # verify the packet enter into the expected queue.
+        rss_queue0 = self.send_verify_queue(ptype="ip")
+        rss_queue1 = self.send_verify_queue(ptype="udp")
+        self.verify(rss_queue0 != rss_queue1, "Different packets not mapping to different queues.")
+
+    def tear_down(self):
+        """
+        Run after each test case.
+        """
+        self.dut_testpmd.quit()
+        self.destroy_vm_env()
+        time.sleep(2)
+
+    def tear_down_all(self):
+        """
+        Run after each test suite.
+        """
+        self.destroy_vf_env()
+        self.dut.kill_all()
+        time.sleep(2)
-- 
2.14.3


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

* Re: [dts] [PATCH] tests: add TestSuite_ixgbe_vf_get_extra_queue_information.py
  2019-04-02  9:37 [dts] [PATCH] tests: add TestSuite_ixgbe_vf_get_extra_queue_information.py Yuan Peng
@ 2019-04-03  3:02 ` Li, WenjieX A
  2019-04-03 18:16 ` Tu, Lijuan
  1 sibling, 0 replies; 5+ messages in thread
From: Li, WenjieX A @ 2019-04-03  3:02 UTC (permalink / raw)
  To: Peng, Yuan, dts; +Cc: Peng, Yuan, Zhang, YanX A

Tested-by: Zhang, YanX A <yanx.a.zhang@intel.com>

> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Yuan Peng
> Sent: Tuesday, April 2, 2019 5:38 PM
> To: dts@dpdk.org
> Cc: Peng, Yuan <yuan.peng@intel.com>
> Subject: [dts] [PATCH] tests: add
> TestSuite_ixgbe_vf_get_extra_queue_information.py
> 
> From: Peng Yuan <yuan.peng@intel.com>
> 
> Add TestSuite_ixgbe_vf_get_extra_queue_information.py
> 
> Signed-off-by: Peng Yuan <yuan.peng@intel.com>
> 
> diff --git a/tests/TestSuite_ixgbe_vf_get_extra_queue_information.py
> b/tests/TestSuite_ixgbe_vf_get_extra_queue_information.py
> new file mode 100644
> index 0000000..c712942
> --- /dev/null
> +++ b/tests/TestSuite_ixgbe_vf_get_extra_queue_information.py
> @@ -0,0 +1,285 @@
> +# BSD LICENSE
> +#
> +# Copyright(c) 2010-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.
> +
> +"""
> +DPDK Test suite.
> +Test Niantic ixgbe_get_vf_queue Include Extra Information function.
> +"""
> +import time
> +import random
> +import re
> +import utils
> +
> +# Use scapy to send packets with different source and dest ip.
> +# and collect the hash result of five tuple and the queue id.
> +from test_case import TestCase
> +from pmd_output import PmdOutput
> +from virt_common import VM
> +from qemu_kvm import QEMUKvm
> +
> +class TestIxgbeVfGetExtraInfo(TestCase):
> +
> +
> +    def get_packet_bytes(self, queue):
> +        """
> +        Get rx queue packets and bytes.
> +        """
> +        out = self.vm0_dut.send_expect("ethtool -S %s" % self.vm0_intf0, "#")
> +        lines = out.split("\r\n")
> +
> +        for line in lines:
> +            line = line.strip()
> +            if ("rx_queue_%s_packets" % queue) in line:
> +                rev_queue, rev_num = line.split(': ', 1)
> +        for line in lines:
> +            line = line.strip()
> +            if ("rx_queue_%s_bytes" % queue) in line:
> +                rev_queue, rev_byte = line.split(': ', 1)
> +
> +        return rev_num, rev_byte
> +
> +    def send_verify_up(self, prio="", vlan=""):
> +        """
> +        Send packets including user priority and verify the result.
> +        """
> +        if prio=="1" or prio=="2" or prio=="3":
> +            rev_num, rev_byte = self.get_packet_bytes(prio)
> +        else:
> +            rev_num, rev_byte = self.get_packet_bytes("0")
> +
> +        self.tester.scapy_foreground()
> +        self.tester.scapy_append('sys.path.append("./")')
> +        self.vm0_vf0_mac = self.vm0_dut.get_mac_address(0)
> +        # send packet with different parameters
> +        packet = r'sendp([Ether(src="%s",dst="%s")/Dot1Q(prio=%s,
> vlan=%s)/IP()/Raw("x"*20)], iface="%s")' % (
> +            self.src_mac, self.vm0_vf0_mac, prio, vlan, self.tester_intf)
> +        self.tester.scapy_append(packet)
> +        self.tester.scapy_execute()
> +        time.sleep(.5)
> +
> +        if prio=="1" or prio=="2" or prio=="3":
> +            rev_num_after, rev_byte_after = self.get_packet_bytes(prio)
> +        else:
> +            rev_num_after, rev_byte_after = self.get_packet_bytes("0")
> +
> +        rev_num_added = int(rev_num_after) - int(rev_num)
> +        rev_byte_added = int(rev_byte_after) - int(rev_byte)
> +
> +        if vlan == "0":
> +            self.verify((rev_num_added == 1 and rev_byte_added == 60), "the packet
> is not sent to the right queue.")
> +        else:
> +            self.verify((rev_num_added == 0 and rev_byte_added == 0),
> + "the packet is received.")
> +
> +    def send_verify_queue(self, ptype="ip"):
> +        """
> +        Send different packets, return the received queue.
> +        """
> +        rev_num0, rev_byte0 = self.get_packet_bytes("0")
> +        rev_num1, rev_byte1 = self.get_packet_bytes("1")
> +        self.tester.scapy_foreground()
> +        self.tester.scapy_append('sys.path.append("./")')
> +        self.vm0_vf0_mac = self.vm0_dut.get_mac_address(0)
> +        # send packet with different parameters
> +        if ptype == "ip":
> +            packet = r'sendp([Ether(src="%s",dst="%s")/IP()/Raw("x"*20)],
> count=100, iface="%s")' % (
> +                self.src_mac, self.vm0_vf0_mac, self.tester_intf)
> +        elif ptype == "udp":
> +            packet = r'sendp([Ether(src="%s",dst="%s")/IP(src="192.168.0.1",
> dst="192.168.0.3")/UDP(sport=23,dport=24)/Raw("x"*20)], count=100,
> iface="%s")' % (
> +                self.src_mac, self.vm0_vf0_mac, self.tester_intf)
> +        self.tester.scapy_append(packet)
> +        self.tester.scapy_execute()
> +
> +        rev_num_after0, rev_byte_after0 = self.get_packet_bytes("0")
> +        rev_num_after1, rev_byte_after1 = self.get_packet_bytes("1")
> +
> +        rev_num_added0 = int(rev_num_after0) - int(rev_num0)
> +        rev_byte_added0 = int(rev_byte_after0) - int(rev_byte0)
> +        rev_num_added1 = int(rev_num_after1) - int(rev_num1)
> +        rev_byte_added1 = int(rev_byte_after1) - int(rev_byte1)
> +
> +        if rev_num_added0 == 100 and rev_byte_added0 != 0:
> +            queue = 0
> +        elif rev_num_added1 == 100 and rev_byte_added1 != 0:
> +            queue = 1
> +        else:
> +            print utils.RED("There is no packet received.")
> +
> +        return queue
> +
> +    def set_up_all(self):
> +        """
> +        Run at the start of each test suite.
> +        """
> +        self.verify(self.nic in ["niantic"],
> +            "NIC Unsupported: " + str(self.nic))
> +        self.dut_ports = self.dut.get_ports(self.nic)
> +        self.verify(len(self.dut_ports) >= 1, "Insufficient ports")
> +        self.cores = "1S/8C/1T"
> +
> +        self.pf_mac = self.dut.get_mac_address(self.dut_ports[0])
> +        txport = self.tester.get_local_port(self.dut_ports[0])
> +        self.tester_intf = self.tester.get_interface(txport)
> +        self.tester_mac = self.tester.get_mac(txport)
> +
> +        self.pf_intf = self.dut.ports_info[self.dut_ports[0]]['intf']
> +        self.pf_pci = self.dut.ports_info[self.dut_ports[0]]['pci']
> +        self.src_mac = '00:02:00:00:00:01'
> +        self.dut.send_expect('modprobe vfio-pci', '#')
> +
> +        self.used_dut_port = self.dut_ports[0]
> +        self.dut.generate_sriov_vfs_by_port(
> +            self.used_dut_port, 1, driver='igb_uio')
> +        self.sriov_vfs_port = self.dut.ports_info[
> +            self.used_dut_port]['vfs_port']
> +        for port in self.sriov_vfs_port:
> +            port.bind_driver('vfio-pci')
> +        time.sleep(1)
> +
> +    def set_up(self):
> +        """
> +        Run before each test case.
> +        """
> +        pass
> +
> +    def setup_vm_env(self):
> +        """
> +        1pf -> 1vf , vf->vm0
> +        """
> +        vf0_prop_1 = {'opt_host': self.sriov_vfs_port[0].pci}
> +        self.vm0 = QEMUKvm(self.dut, 'vm0',
> 'ixgbe_vf_get_extra_queue_information')
> +        self.vm0.set_vm_device(driver='vfio-pci', **vf0_prop_1)
> +        try:
> +            self.vm0_dut = self.vm0.start()
> +            if self.vm0_dut is None:
> +                raise Exception("Set up VM ENV failed")
> +            else:
> +                self.verify(self.vm0_dut.ports_info[0][
> +                            'intf'] != 'N/A', "Not interface")
> +        except Exception as e:
> +            self.destroy_vm_env()
> +            self.logger.error("Failure for %s" % str(e))
> +
> +        self.vm0_vf0_mac = self.vm0_dut.get_mac_address(0)
> +        self.vm0_intf0 = self.vm0_dut.ports_info[0]['intf']
> +
> +        self.vm0_dut.restore_interfaces_linux()
> +
> +    def destroy_vm_env(self):
> +        """
> +        destroy vm environment
> +        """
> +        if getattr(self, 'vm0', None):
> +            self.vm0_dut.kill_all()
> +            self.vm0_dut_ports = None
> +            self.vm0.stop()
> +            self.vm0 = None
> +
> +        self.dut.virt_exit()
> +
> +    def destroy_vf_env(self):
> +        """
> +        destroy vf
> +        """
> +        if getattr(self, 'used_dut_port', None) != None:
> +            self.dut.destroy_sriov_vfs_by_port(self.used_dut_port)
> +            port = self.dut.ports_info[self.used_dut_port]['port']
> +            self.used_dut_port = None
> +
> +    def verify_rx_queue(self, num):
> +        """
> +        verify the rx queue number
> +        """
> +        # pf up + vf up -> vf up
> +        self.vm0_dut.send_expect("ifconfig %s up" % self.vm0_intf0, "#")
> +        time.sleep(10)
> +        out = self.vm0_dut.send_expect("ethtool -S %s" % self.vm0_intf0, "#")
> +        self.verify(("rx_queue_%d" % (num-1)) in out, "Wrong rx queue number")
> +        time.sleep(3)
> +
> +    def test_enable_dcb(self):
> +        """
> +        DPDK PF, kernel VF, enable DCB mode with TC=4
> +        """
> +        # start testpmd with PF on the host
> +        self.dut_testpmd = PmdOutput(self.dut)
> +        self.dut_testpmd.start_testpmd(
> +            "%s" % self.cores, "--rxq=4 --txq=4 --nb-cores=4", "-w %s" % self.pf_pci)
> +        self.dut_testpmd.execute_cmd("port stop 0")
> +        self.dut_testpmd.execute_cmd("port config 0 dcb vt on 4 pfc off")
> +        self.dut_testpmd.execute_cmd("port start 0")
> +        time.sleep(5)
> +        self.setup_vm_env()
> +        # verify the vf get the extra info.
> +        self.verify_rx_queue(4)
> +        # verify the packet enter into the expected queue.
> +        self.send_verify_up(prio="0",vlan="0")
> +        self.send_verify_up(prio="1",vlan="0")
> +        self.send_verify_up(prio="2",vlan="0")
> +        self.send_verify_up(prio="3",vlan="0")
> +        self.send_verify_up(prio="4",vlan="0")
> +        self.send_verify_up(prio="5",vlan="0")
> +        self.send_verify_up(prio="6",vlan="0")
> +        self.send_verify_up(prio="7",vlan="0")
> +        self.send_verify_up(prio="0",vlan="1")
> +
> +    def test_disable_dcb(self):
> +        """
> +        DPDK PF, kernel VF, disable DCB mode
> +        """
> +        # start testpmd with PF on the host
> +        self.dut_testpmd = PmdOutput(self.dut)
> +        self.dut_testpmd.start_testpmd(
> +            "%s" % self.cores, "--rxq=2 --txq=2 --nb-cores=2", "-w %s" % self.pf_pci)
> +        self.dut_testpmd.execute_cmd("start")
> +        time.sleep(5)
> +        self.setup_vm_env()
> +        # verify the vf get the extra info.
> +        self.verify_rx_queue(2)
> +        # verify the packet enter into the expected queue.
> +        rss_queue0 = self.send_verify_queue(ptype="ip")
> +        rss_queue1 = self.send_verify_queue(ptype="udp")
> +        self.verify(rss_queue0 != rss_queue1, "Different packets not
> + mapping to different queues.")
> +
> +    def tear_down(self):
> +        """
> +        Run after each test case.
> +        """
> +        self.dut_testpmd.quit()
> +        self.destroy_vm_env()
> +        time.sleep(2)
> +
> +    def tear_down_all(self):
> +        """
> +        Run after each test suite.
> +        """
> +        self.destroy_vf_env()
> +        self.dut.kill_all()
> +        time.sleep(2)
> --
> 2.14.3


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

* Re: [dts] [PATCH] tests: add TestSuite_ixgbe_vf_get_extra_queue_information.py
  2019-04-02  9:37 [dts] [PATCH] tests: add TestSuite_ixgbe_vf_get_extra_queue_information.py Yuan Peng
  2019-04-03  3:02 ` Li, WenjieX A
@ 2019-04-03 18:16 ` Tu, Lijuan
  1 sibling, 0 replies; 5+ messages in thread
From: Tu, Lijuan @ 2019-04-03 18:16 UTC (permalink / raw)
  To: Peng, Yuan, dts; +Cc: Peng, Yuan



> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Yuan Peng
> Sent: Tuesday, April 2, 2019 2:38 AM
> To: dts@dpdk.org
> Cc: Peng, Yuan <yuan.peng@intel.com>
> Subject: [dts] [PATCH] tests: add
> TestSuite_ixgbe_vf_get_extra_queue_information.py
> 
> From: Peng Yuan <yuan.peng@intel.com>
> 
> Add TestSuite_ixgbe_vf_get_extra_queue_information.py
> 
> Signed-off-by: Peng Yuan <yuan.peng@intel.com>
> 
> diff --git a/tests/TestSuite_ixgbe_vf_get_extra_queue_information.py
> b/tests/TestSuite_ixgbe_vf_get_extra_queue_information.py
> new file mode 100644
> index 0000000..c712942
> --- /dev/null
> +++ b/tests/TestSuite_ixgbe_vf_get_extra_queue_information.py
> @@ -0,0 +1,285 @@
> +# BSD LICENSE
> +#
> +# Copyright(c) 2010-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.
> +
> +"""
> +DPDK Test suite.
> +Test Niantic ixgbe_get_vf_queue Include Extra Information function.
> +"""
> +import time
> +import random
> +import re
> +import utils
> +
> +# Use scapy to send packets with different source and dest ip.
> +# and collect the hash result of five tuple and the queue id.
> +from test_case import TestCase
> +from pmd_output import PmdOutput
> +from virt_common import VM
> +from qemu_kvm import QEMUKvm
> +
> +class TestIxgbeVfGetExtraInfo(TestCase):
> +
> +
> +    def get_packet_bytes(self, queue):
> +        """
> +        Get rx queue packets and bytes.
> +        """
> +        out = self.vm0_dut.send_expect("ethtool -S %s" % self.vm0_intf0, "#")
> +        lines = out.split("\r\n")
> +
> +        for line in lines:
> +            line = line.strip()
> +            if ("rx_queue_%s_packets" % queue) in line:
> +                rev_queue, rev_num = line.split(': ', 1)
> +        for line in lines:
> +            line = line.strip()
> +            if ("rx_queue_%s_bytes" % queue) in line:
> +                rev_queue, rev_byte = line.split(': ', 1)
> +
> +        return rev_num, rev_byte
> +
> +    def send_verify_up(self, prio="", vlan=""):
> +        """
> +        Send packets including user priority and verify the result.
> +        """
> +        if prio=="1" or prio=="2" or prio=="3":
> +            rev_num, rev_byte = self.get_packet_bytes(prio)
> +        else:
> +            rev_num, rev_byte = self.get_packet_bytes("0")
> +
> +        self.tester.scapy_foreground()
> +        self.tester.scapy_append('sys.path.append("./")')
> +        self.vm0_vf0_mac = self.vm0_dut.get_mac_address(0)
> +        # send packet with different parameters
> +        packet = r'sendp([Ether(src="%s",dst="%s")/Dot1Q(prio=%s,
> vlan=%s)/IP()/Raw("x"*20)], iface="%s")' % (
> +            self.src_mac, self.vm0_vf0_mac, prio, vlan, self.tester_intf)
> +        self.tester.scapy_append(packet)
> +        self.tester.scapy_execute()
> +        time.sleep(.5)
> +
> +        if prio=="1" or prio=="2" or prio=="3":
> +            rev_num_after, rev_byte_after = self.get_packet_bytes(prio)
> +        else:
> +            rev_num_after, rev_byte_after = self.get_packet_bytes("0")
> +
> +        rev_num_added = int(rev_num_after) - int(rev_num)
> +        rev_byte_added = int(rev_byte_after) - int(rev_byte)
> +
> +        if vlan == "0":
> +            self.verify((rev_num_added == 1 and rev_byte_added == 60), "the
> packet is not sent to the right queue.")
> +        else:
> +            self.verify((rev_num_added == 0 and rev_byte_added == 0),
> + "the packet is received.")
> +
> +    def send_verify_queue(self, ptype="ip"):
> +        """
> +        Send different packets, return the received queue.
> +        """
> +        rev_num0, rev_byte0 = self.get_packet_bytes("0")
> +        rev_num1, rev_byte1 = self.get_packet_bytes("1")
> +        self.tester.scapy_foreground()
> +        self.tester.scapy_append('sys.path.append("./")')
> +        self.vm0_vf0_mac = self.vm0_dut.get_mac_address(0)
> +        # send packet with different parameters
> +        if ptype == "ip":
> +            packet = r'sendp([Ether(src="%s",dst="%s")/IP()/Raw("x"*20)],
> count=100, iface="%s")' % (
> +                self.src_mac, self.vm0_vf0_mac, self.tester_intf)
> +        elif ptype == "udp":
> +            packet = r'sendp([Ether(src="%s",dst="%s")/IP(src="192.168.0.1",
> dst="192.168.0.3")/UDP(sport=23,dport=24)/Raw("x"*20)], count=100,
> iface="%s")' % (
> +                self.src_mac, self.vm0_vf0_mac, self.tester_intf)
> +        self.tester.scapy_append(packet)
> +        self.tester.scapy_execute()
> +
> +        rev_num_after0, rev_byte_after0 = self.get_packet_bytes("0")
> +        rev_num_after1, rev_byte_after1 = self.get_packet_bytes("1")
> +
> +        rev_num_added0 = int(rev_num_after0) - int(rev_num0)
> +        rev_byte_added0 = int(rev_byte_after0) - int(rev_byte0)
> +        rev_num_added1 = int(rev_num_after1) - int(rev_num1)
> +        rev_byte_added1 = int(rev_byte_after1) - int(rev_byte1)
> +
> +        if rev_num_added0 == 100 and rev_byte_added0 != 0:
> +            queue = 0
> +        elif rev_num_added1 == 100 and rev_byte_added1 != 0:
> +            queue = 1
> +        else:
> +            print utils.RED("There is no packet received.")
> +
> +        return queue
> +
> +    def set_up_all(self):
> +        """
> +        Run at the start of each test suite.
> +        """
> +        self.verify(self.nic in ["niantic"],
> +            "NIC Unsupported: " + str(self.nic))
> +        self.dut_ports = self.dut.get_ports(self.nic)
> +        self.verify(len(self.dut_ports) >= 1, "Insufficient ports")
> +        self.cores = "1S/8C/1T"
[Lijuan] Not all platform has 8 cores.
> +
> +        self.pf_mac = self.dut.get_mac_address(self.dut_ports[0])
> +        txport = self.tester.get_local_port(self.dut_ports[0])
> +        self.tester_intf = self.tester.get_interface(txport)
> +        self.tester_mac = self.tester.get_mac(txport)
> +
> +        self.pf_intf = self.dut.ports_info[self.dut_ports[0]]['intf']
> +        self.pf_pci = self.dut.ports_info[self.dut_ports[0]]['pci']
> +        self.src_mac = '00:02:00:00:00:01'
> +        self.dut.send_expect('modprobe vfio-pci', '#')
> +
> +        self.used_dut_port = self.dut_ports[0]
> +        self.dut.generate_sriov_vfs_by_port(
> +            self.used_dut_port, 1, driver='igb_uio')
> +        self.sriov_vfs_port = self.dut.ports_info[
> +            self.used_dut_port]['vfs_port']
> +        for port in self.sriov_vfs_port:
> +            port.bind_driver('vfio-pci')
[Lijuan] does it support igb_uio ?
> +        time.sleep(1)
> +
> +    def set_up(self):
> +        """
> +        Run before each test case.
> +        """
> +        pass
> +
> +    def setup_vm_env(self):
> +        """
> +        1pf -> 1vf , vf->vm0
> +        """
> +        vf0_prop_1 = {'opt_host': self.sriov_vfs_port[0].pci}
> +        self.vm0 = QEMUKvm(self.dut, 'vm0',
> 'ixgbe_vf_get_extra_queue_information')
> +        self.vm0.set_vm_device(driver='vfio-pci', **vf0_prop_1)
> +        try:
> +            self.vm0_dut = self.vm0.start()
> +            if self.vm0_dut is None:
> +                raise Exception("Set up VM ENV failed")
> +            else:
> +                self.verify(self.vm0_dut.ports_info[0][
> +                            'intf'] != 'N/A', "Not interface")
> +        except Exception as e:
> +            self.destroy_vm_env()
> +            self.logger.error("Failure for %s" % str(e))
> +
> +        self.vm0_vf0_mac = self.vm0_dut.get_mac_address(0)
> +        self.vm0_intf0 = self.vm0_dut.ports_info[0]['intf']
> +
> +        self.vm0_dut.restore_interfaces_linux()
> +
> +    def destroy_vm_env(self):
> +        """
> +        destroy vm environment
> +        """
> +        if getattr(self, 'vm0', None):
> +            self.vm0_dut.kill_all()
> +            self.vm0_dut_ports = None
> +            self.vm0.stop()
> +            self.vm0 = None
> +
> +        self.dut.virt_exit()
> +
> +    def destroy_vf_env(self):
> +        """
> +        destroy vf
> +        """
> +        if getattr(self, 'used_dut_port', None) != None:
> +            self.dut.destroy_sriov_vfs_by_port(self.used_dut_port)
> +            port = self.dut.ports_info[self.used_dut_port]['port']
> +            self.used_dut_port = None
> +
> +    def verify_rx_queue(self, num):
> +        """
> +        verify the rx queue number
> +        """
> +        # pf up + vf up -> vf up
> +        self.vm0_dut.send_expect("ifconfig %s up" % self.vm0_intf0, "#")
> +        time.sleep(10)
> +        out = self.vm0_dut.send_expect("ethtool -S %s" % self.vm0_intf0, "#")
> +        self.verify(("rx_queue_%d" % (num-1)) in out, "Wrong rx queue
> number")
> +        time.sleep(3)
> +
> +    def test_enable_dcb(self):
> +        """
> +        DPDK PF, kernel VF, enable DCB mode with TC=4
> +        """
> +        # start testpmd with PF on the host
> +        self.dut_testpmd = PmdOutput(self.dut)
> +        self.dut_testpmd.start_testpmd(
> +            "%s" % self.cores, "--rxq=4 --txq=4 --nb-cores=4", "-w %s" %
> self.pf_pci)
> +        self.dut_testpmd.execute_cmd("port stop 0")
> +        self.dut_testpmd.execute_cmd("port config 0 dcb vt on 4 pfc off")
> +        self.dut_testpmd.execute_cmd("port start 0")
> +        time.sleep(5)
> +        self.setup_vm_env()
> +        # verify the vf get the extra info.
> +        self.verify_rx_queue(4)
> +        # verify the packet enter into the expected queue.
> +        self.send_verify_up(prio="0",vlan="0")
> +        self.send_verify_up(prio="1",vlan="0")
> +        self.send_verify_up(prio="2",vlan="0")
> +        self.send_verify_up(prio="3",vlan="0")
> +        self.send_verify_up(prio="4",vlan="0")
> +        self.send_verify_up(prio="5",vlan="0")
> +        self.send_verify_up(prio="6",vlan="0")
> +        self.send_verify_up(prio="7",vlan="0")
> +        self.send_verify_up(prio="0",vlan="1")
> +
> +    def test_disable_dcb(self):
> +        """
> +        DPDK PF, kernel VF, disable DCB mode
> +        """
> +        # start testpmd with PF on the host
> +        self.dut_testpmd = PmdOutput(self.dut)
> +        self.dut_testpmd.start_testpmd(
> +            "%s" % self.cores, "--rxq=2 --txq=2 --nb-cores=2", "-w %s" %
> self.pf_pci)
> +        self.dut_testpmd.execute_cmd("start")
> +        time.sleep(5)
> +        self.setup_vm_env()
> +        # verify the vf get the extra info.
> +        self.verify_rx_queue(2)
> +        # verify the packet enter into the expected queue.
> +        rss_queue0 = self.send_verify_queue(ptype="ip")
> +        rss_queue1 = self.send_verify_queue(ptype="udp")
> +        self.verify(rss_queue0 != rss_queue1, "Different packets not
> + mapping to different queues.")
> +
> +    def tear_down(self):
> +        """
> +        Run after each test case.
> +        """
> +        self.dut_testpmd.quit()
> +        self.destroy_vm_env()
> +        time.sleep(2)
> +
> +    def tear_down_all(self):
> +        """
> +        Run after each test suite.
> +        """
> +        self.destroy_vf_env()
> +        self.dut.kill_all()
> +        time.sleep(2)
> --
> 2.14.3


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

* Re: [dts] [PATCH] tests: add TestSuite_ixgbe_vf_get_extra_queue_information.py
  2017-12-29  8:14 Peng Yuan
@ 2018-01-30  3:31 ` Liu, Yong
  0 siblings, 0 replies; 5+ messages in thread
From: Liu, Yong @ 2018-01-30  3:31 UTC (permalink / raw)
  To: Peng, Yuan, dts; +Cc: Peng, Yuan

Yuan, sorry for late response. My comments are inline.

Thanks,
Marvin

> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Peng Yuan
> Sent: Friday, December 29, 2017 4:14 PM
> To: dts@dpdk.org
> Cc: Peng, Yuan <yuan.peng@intel.com>
> Subject: [dts] [PATCH] tests: add
> TestSuite_ixgbe_vf_get_extra_queue_information.py
> 
> Signed-off-by: Peng Yuan <yuan.peng@intel.com>
> 
> diff --git a/tests/TestSuite_ixgbe_vf_get_extra_queue_information.py
> b/tests/TestSuite_ixgbe_vf_get_extra_queue_information.py
> new file mode 100644
> index 0000000..5ddeb29
> --- /dev/null
> +++ b/tests/TestSuite_ixgbe_vf_get_extra_queue_information.py
> @@ -0,0 +1,309 @@
> +# BSD LICENSE
> +#
> +# Copyright(c) 2010-2017 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.
> +
> +
> +"""
> +DPDK Test suite.
> +Test VF kernel
> +"""
> +
> +import utils
> +import time
> +import datetime
> +import re
> +import random
> +import threading
> +from test_case import TestCase
> +from qemu_kvm import QEMUKvm
> +from pmd_output import PmdOutput
> +from packet import Packet
> +import random
> +from utils import GREEN, RED
> +
> +
> +class TestVfKernel(TestCase):
> +
> +    def set_up_all(self):
> +        """
> +        Run at the start of each test suite.
> +        """
> +        self.dut.send_expect("service network-manager stop", "#", 60)

Yuan, please do not do this kind of command in the suite. This should be guaranteed by the one who owned test machine.

> +        self.dut_ports = self.dut.get_ports(self.nic)
> +        self.verify(len(self.dut_ports) >= 1, "Insufficient ports")
> +        self.cores = self.dut.get_core_list("1S/4C/1T")
> +        self.coremask = utils.create_mask(self.cores)
> +
> +        self.dmac = self.dut.get_mac_address(self.dut_ports[0])
> +        txport = self.tester.get_local_port(self.dut_ports[0])
> +        self.tester_intf = self.tester.get_interface(txport)
> +        self.tester_mac = self.tester.get_mac(txport)
> +
> +        self.intf = self.dut.ports_info[self.dut_ports[0]]['intf']
> +        self.pci =
> self.dut.ports_info[self.dut_ports[0]]['pci'].split(':')

I think pci address should keep domain in. Why split it?

> +
> +        self.src_logo = '12:34:56:78:90:10'
> +        self.setup_vm_env()
> +
> +    def set_up(self):
> +        """
> +        Run before each test case.
> +        """
> +        self.start_pf_vf()
> +        self.verify(self.check_pf_vf_link_status(
> +            self.vm0_dut, self.vm0_intf0), "vf link down")
> +
> +        pass
> +
> +    def setup_vm_env(self):
> +        """
> +        1pf -> 1vf , vf->vm0
> +        """
> +        self.used_dut_port = self.dut_ports[0]
> +        self.dut.generate_sriov_vfs_by_port(
> +            self.used_dut_port, 1, driver='igb_uio')
> +        self.sriov_vfs_port = self.dut.ports_info[
> +            self.used_dut_port]['vfs_port']
> +        for port in self.sriov_vfs_port:
> +            port.bind_driver('pci-stub')
> +        time.sleep(1)
> +
> +        self.dut_testpmd = PmdOutput(self.dut)
> +        self.dut.send_expect("./%s/app/testpmd -c 1f -n 4 -- -i --rxq=4 -
> -txq=4 --nb-cores=4" % self.target, "testpmd> ", 120)
> +        # dpdk-2208
> +        # since there is no forward engine on DPDK PF to forward or drop
> packet in packet pool,
> +        # so finally the pool will be full, then no more packet will be
> +        # received by VF
> +        self.dut_testpmd.execute_cmd("start")
> +
> +        vf0_prop_1 = {'opt_host': self.sriov_vfs_port[0].pci}
> +
> +        self.vm0 = QEMUKvm(self.dut, 'vm0', 'vf_kernel')
> +        self.vm0.set_vm_device(driver='pci-assign', **vf0_prop_1)
> +        try:
> +            self.vm0_dut = self.vm0.start()
> +            if self.vm0_dut is None:
> +                raise Exception("Set up VM ENV failed")
> +            else:
> +                self.verify(self.vm0_dut.ports_info[0][
> +                            'intf'] != 'N/A', "Not interface")

Kernel driver is must for this suite? If not, please remove this check.

> +        except Exception as e:
> +            self.destroy_vm_env()
> +            raise Exception(e)
> +
> +        self.vm0_testpmd = PmdOutput(self.vm0_dut)
> +
> +        self.vm0_intf0 = self.vm0_dut.ports_info[0]['intf']
> +        self.vm0_dut.restore_interfaces_linux()
> +
> +        # stop NetworkManager, this if for centos7
> +        # you may change it when the os no support
> +        self.vm0_dut.send_expect("systemctl stop NetworkManager", "# ",
> 60)

Execution owner should do this one time setting. Please remove it from test suite.
One comment is enough for reminder. 

> +
> +        self.dut_testpmd.quit()
> +
> +    def destroy_vm_env(self):
> +        """
> +        destroy vm environment
> +        """
> +        if getattr(self, 'vm0', None):
> +            self.vm0_dut.kill_all()
> +            self.vm0_dut_ports = None
> +            # destroy vm0
> +            self.vm0.stop()
> +            self.vm0 = None
> +        self.dut.virt_exit()
> +
> +        if getattr(self, 'used_dut_port', None) is not None:
> +            self.dut.destroy_sriov_vfs_by_port(self.used_dut_port)
> +            port = self.dut.ports_info[self.used_dut_port]['port']
> +            self.used_dut_port = None
> +
> +    def start_pf_vf(self):
> +        """
> +        know issue DPDK-2208. dpdk-2849
> +        """
> +        self.dut.send_expect("./%s/app/testpmd -c 1f -n 4 -- -i --rxq=4 -
> -txq=4 --nb-cores=4" % self.target, "testpmd> ", 120)
> +        self.dut_testpmd.execute_cmd('set fwd rxonly')
> +        self.dut_testpmd.execute_cmd('set verbose 1')
> +        self.dut_testpmd.execute_cmd("start")
> +        time.sleep(10)
> +        self.vm0_dut.send_expect("rmmod %svf" % self.kdriver, "#")
> +        self.vm0_dut.send_expect("modprobe %svf" % self.kdriver, "#")
> +
> +    def check_pf_vf_link_status(self, session, intf):
> +        """
> +        sometimes pf/vf will up abnormal, retry 5 times
> +        """
> +        for i in range(5):
> +            # down-up get new mac form pf.
> +            # because  dpdk pf will give an random mac when dpdk pf
> restart.
> +            session.send_expect("ifconfig %s down" % intf, "#")
> +            out = session.send_expect("ifconfig %s up" % intf, "#")
> +            # SIOCSIFFLAGS: Network is down
> +            # i think the pf link abnormal
> +            if "Network is down" in out:
> +                print GREEN(out)
> +                print GREEN("Try again")
> +                self.dut_testpmd.quit()
> +                self.vm0_dut.restore_interfaces_linux()
> +                self.start_pf_vf()
> +            else:
> +                out = session.send_expect("ethtool %s" % intf, "#")
> +                if "Link detected: yes" in out:
> +                    return True
> +            time.sleep(1)
> +        return False
> +
> +    def send_packet_UP(self, mac, pkt_lens=64, num=1, prio=0):
> +        """
> +        send different User Priority packets.
> +        """
> +        pkt = Packet(pkt_type='VLAN_UDP', pkt_len=pkt_lens)
> +        pkt.config_layer('ether', {'dst': mac, 'src': self.tester_mac})
> +        pkt.config_layer('vlan', {'vlan': 0, 'prio': prio})
> +        pkt.send_pkt(tx_port=self.tester_intf, count=num)
> +
> +    def send_packet(self, mac, pkt_type, pkt_lens=64, num=100):
> +        """
> +        send packets with different PCtype.
> +        """
> +        if (pkt_type == "udp"):
> +            pkt = Packet(pkt_type='UDP', pkt_len=pkt_lens)
> +            pkt.config_layer('ether', {'dst': mac, 'src':
> self.tester_mac})
> +            pkt.config_layer('ipv4', {'src': '192.168.0.1', 'dst':
> '192.168.0.2'})
> +            pkt.config_layer('udp', {'src': 22, 'dst': 23})
> +            pkt.send_pkt(tx_port=self.tester_intf, count=num)
> +        elif (pkt_type == "ipv4"):
> +            pkt = Packet(pkt_type='IP_RAW', pkt_len=pkt_lens)
> +            pkt.config_layer('ether', {'dst': mac, 'src':
> self.tester_mac})
> +            pkt.send_pkt(tx_port=self.tester_intf, count=num)
> +
> +    def verify_result(self, prio, pkt_num):
> +        """
> +        verify if the packets with different User Priority
> +        enter to the expected TC queue.
> +        """
> +        out = self.vm0_dut.send_expect(
> +            "ethtool -S %s |grep rx_.*packets" % self.vm0_intf0, "#")
> +        rx_queue_packet = re.findall("rx_.*packets:\s*(\d*)", out)
> +        self.verify(int(rx_queue_packet[prio + 1]) == pkt_num,
> +                    "the packet didn't enter expected queue.")
> +
> +    def test_DCB_TC4(self):
> +        """
> +        DPDK PF, kernel VF, enable DCB mode with TC=4
> +        """
> +        self.dut_testpmd.execute_cmd("stop")
> +        self.dut_testpmd.execute_cmd("port stop 0")
> +        self.dut_testpmd.execute_cmd("port config 0 dcb vt on 4 pfc off")
> +        self.dut_testpmd.execute_cmd("port start 0")
> +        time.sleep(10)
> +        self.vm0_dut.send_expect("rmmod %svf" % self.kdriver, "#")
> +        self.vm0_dut.send_expect("modprobe %svf" % self.kdriver, "#")
> +        self.verify(self.check_pf_vf_link_status(
> +            self.vm0_dut, self.vm0_intf0), "vf link down")
> +        # get the vf's mac address after vf reset.
> +        vf_out = self.vm0_dut.send_expect("ifconfig %s" % self.vm0_intf0,
> "#")
> +        vf_mac = re.findall("ether\s(\S*)\s*", vf_out)
> +        # verify the rx_queue number equals to TC number.
> +        out = self.vm0_dut.send_expect(
> +            "ethtool -S %s" % self.vm0_intf0, "#")
> +        rx_queue_num = re.findall("rx_.*misses:\s*(\d*)", out)
> +        self.verify(len(rx_queue_num) == 4, "the queues count error")
> +        # verify the packet with prio 0-3 enter to queue 0-3
> +        # verify the packet with prio 4-7 enter to queue 0
> +        self.send_packet_UP(mac=vf_mac[0], prio=0)
> +        self.verify_result(prio=0, pkt_num=1)
> +        self.send_packet_UP(mac=vf_mac[0], prio=1)
> +        self.verify_result(prio=1, pkt_num=1)
> +        self.send_packet_UP(mac=vf_mac[0], prio=2)
> +        self.verify_result(prio=2, pkt_num=1)
> +        self.send_packet_UP(mac=vf_mac[0], prio=3)
> +        self.verify_result(prio=3, pkt_num=1)
> +        self.send_packet_UP(mac=vf_mac[0], prio=4)
> +        self.verify_result(prio=0, pkt_num=2)
> +        self.send_packet_UP(mac=vf_mac[0], prio=5)
> +        self.verify_result(prio=0, pkt_num=3)
> +        self.send_packet_UP(mac=vf_mac[0], prio=6)
> +        self.verify_result(prio=0, pkt_num=4)
> +        self.send_packet_UP(mac=vf_mac[0], prio=7)
> +        self.verify_result(prio=0, pkt_num=5)
> +
> +    def test_disable_DCB(self):
> +        """
> +        DPDK PF, kernel VF, disable DCB mode
> +        """
> +        self.dut_testpmd.execute_cmd("set vf vlan insert 0 0 1")
> +        # verify the rx_queue number is the default number.
> +        out = self.vm0_dut.send_expect(
> +            "ethtool -S %s" % self.vm0_intf0, "#")
> +        rx_queue_num = re.findall("rx_.*misses:\s*(\d*)", out)
> +        self.verify(len(rx_queue_num) == 2, "the queues count error")
> +        # get the vf's mac address after vf reset.
> +        vf_out = self.vm0_dut.send_expect("ifconfig %s" % self.vm0_intf0,
> "#")
> +        vf_mac = re.findall("ether\s(\S*)\s*", vf_out)
> +        # verify different packet enter different queues with RSS.
> +        self.send_packet(mac=vf_mac[0], pkt_type="ipv4")
> +        out = self.vm0_dut.send_expect(
> +            "ethtool -S %s |grep rx_.*packets" % self.vm0_intf0, "#")
> +        rx_queue_packet = re.findall("rx_.*packets:\s*(\d*)", out)
> +        self.verify(int(rx_queue_packet[1]) == 100,
> +                    "the packet didn't enter expected queue.")
> +        self.verify(int(rx_queue_packet[2]) == 0,
> +                    "the packet didn't enter expected queue.")
> +        self.send_packet(mac=vf_mac[0], pkt_type="udp")
> +        out = self.vm0_dut.send_expect(
> +            "ethtool -S %s |grep rx_.*packets" % self.vm0_intf0, "#")
> +        rx_queue_packet = re.findall("rx_.*packets:\s*(\d*)", out)
> +        self.verify(int(rx_queue_packet[2]) == 100,
> +                    "the packet didn't enter expected queue.")
> +
> +    def tear_down(self):
> +        """
> +        Run after each test case.
> +        """
> +        self.vm0_testpmd.quit()
> +        self.vm0_dut.restore_interfaces_linux()
> +        self.dut_testpmd.quit()
> +
> +        # Sometime test failed ,we still need clear ip.
> +        self.vm0_dut.send_expect(
> +            "ifconfig %s 0.0.0.0" % self.vm0_intf0, "#")
> +        self.tester.send_expect("ifconfig %s 0.0.0.0" %
> +                                self.tester_intf, "#")
> +
> +    def tear_down_all(self):
> +        """
> +        Run after each test suite.
> +        """
> +        self.destroy_vm_env()
> +        self.dut.kill_all()
> +        time.sleep(2)
> --
> 2.5.0

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

* [dts] [PATCH] tests: add TestSuite_ixgbe_vf_get_extra_queue_information.py
@ 2017-12-29  8:14 Peng Yuan
  2018-01-30  3:31 ` Liu, Yong
  0 siblings, 1 reply; 5+ messages in thread
From: Peng Yuan @ 2017-12-29  8:14 UTC (permalink / raw)
  To: dts; +Cc: Peng Yuan

Signed-off-by: Peng Yuan <yuan.peng@intel.com>

diff --git a/tests/TestSuite_ixgbe_vf_get_extra_queue_information.py b/tests/TestSuite_ixgbe_vf_get_extra_queue_information.py
new file mode 100644
index 0000000..5ddeb29
--- /dev/null
+++ b/tests/TestSuite_ixgbe_vf_get_extra_queue_information.py
@@ -0,0 +1,309 @@
+# BSD LICENSE
+#
+# Copyright(c) 2010-2017 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.
+
+
+"""
+DPDK Test suite.
+Test VF kernel
+"""
+
+import utils
+import time
+import datetime
+import re
+import random
+import threading
+from test_case import TestCase
+from qemu_kvm import QEMUKvm
+from pmd_output import PmdOutput
+from packet import Packet
+import random
+from utils import GREEN, RED
+
+
+class TestVfKernel(TestCase):
+
+    def set_up_all(self):
+        """
+        Run at the start of each test suite.
+        """
+        self.dut.send_expect("service network-manager stop", "#", 60)
+        self.dut_ports = self.dut.get_ports(self.nic)
+        self.verify(len(self.dut_ports) >= 1, "Insufficient ports")
+        self.cores = self.dut.get_core_list("1S/4C/1T")
+        self.coremask = utils.create_mask(self.cores)
+
+        self.dmac = self.dut.get_mac_address(self.dut_ports[0])
+        txport = self.tester.get_local_port(self.dut_ports[0])
+        self.tester_intf = self.tester.get_interface(txport)
+        self.tester_mac = self.tester.get_mac(txport)
+
+        self.intf = self.dut.ports_info[self.dut_ports[0]]['intf']
+        self.pci = self.dut.ports_info[self.dut_ports[0]]['pci'].split(':')
+
+        self.src_logo = '12:34:56:78:90:10'
+        self.setup_vm_env()
+
+    def set_up(self):
+        """
+        Run before each test case.
+        """
+        self.start_pf_vf()
+        self.verify(self.check_pf_vf_link_status(
+            self.vm0_dut, self.vm0_intf0), "vf link down")
+
+        pass
+
+    def setup_vm_env(self):
+        """
+        1pf -> 1vf , vf->vm0
+        """
+        self.used_dut_port = self.dut_ports[0]
+        self.dut.generate_sriov_vfs_by_port(
+            self.used_dut_port, 1, driver='igb_uio')
+        self.sriov_vfs_port = self.dut.ports_info[
+            self.used_dut_port]['vfs_port']
+        for port in self.sriov_vfs_port:
+            port.bind_driver('pci-stub')
+        time.sleep(1)
+
+        self.dut_testpmd = PmdOutput(self.dut)
+        self.dut.send_expect("./%s/app/testpmd -c 1f -n 4 -- -i --rxq=4 --txq=4 --nb-cores=4" % self.target, "testpmd> ", 120)
+        # dpdk-2208
+        # since there is no forward engine on DPDK PF to forward or drop packet in packet pool,
+        # so finally the pool will be full, then no more packet will be
+        # received by VF
+        self.dut_testpmd.execute_cmd("start")
+
+        vf0_prop_1 = {'opt_host': self.sriov_vfs_port[0].pci}
+
+        self.vm0 = QEMUKvm(self.dut, 'vm0', 'vf_kernel')
+        self.vm0.set_vm_device(driver='pci-assign', **vf0_prop_1)
+        try:
+            self.vm0_dut = self.vm0.start()
+            if self.vm0_dut is None:
+                raise Exception("Set up VM ENV failed")
+            else:
+                self.verify(self.vm0_dut.ports_info[0][
+                            'intf'] != 'N/A', "Not interface")
+        except Exception as e:
+            self.destroy_vm_env()
+            raise Exception(e)
+
+        self.vm0_testpmd = PmdOutput(self.vm0_dut)
+
+        self.vm0_intf0 = self.vm0_dut.ports_info[0]['intf']
+        self.vm0_dut.restore_interfaces_linux()
+
+        # stop NetworkManager, this if for centos7
+        # you may change it when the os no support
+        self.vm0_dut.send_expect("systemctl stop NetworkManager", "# ", 60)
+
+        self.dut_testpmd.quit()
+
+    def destroy_vm_env(self):
+        """
+        destroy vm environment
+        """
+        if getattr(self, 'vm0', None):
+            self.vm0_dut.kill_all()
+            self.vm0_dut_ports = None
+            # destroy vm0
+            self.vm0.stop()
+            self.vm0 = None
+        self.dut.virt_exit()
+
+        if getattr(self, 'used_dut_port', None) is not None:
+            self.dut.destroy_sriov_vfs_by_port(self.used_dut_port)
+            port = self.dut.ports_info[self.used_dut_port]['port']
+            self.used_dut_port = None
+
+    def start_pf_vf(self):
+        """
+        know issue DPDK-2208. dpdk-2849
+        """
+        self.dut.send_expect("./%s/app/testpmd -c 1f -n 4 -- -i --rxq=4 --txq=4 --nb-cores=4" % self.target, "testpmd> ", 120)
+        self.dut_testpmd.execute_cmd('set fwd rxonly')
+        self.dut_testpmd.execute_cmd('set verbose 1')
+        self.dut_testpmd.execute_cmd("start")
+        time.sleep(10)
+        self.vm0_dut.send_expect("rmmod %svf" % self.kdriver, "#")
+        self.vm0_dut.send_expect("modprobe %svf" % self.kdriver, "#")
+
+    def check_pf_vf_link_status(self, session, intf):
+        """
+        sometimes pf/vf will up abnormal, retry 5 times
+        """
+        for i in range(5):
+            # down-up get new mac form pf.
+            # because  dpdk pf will give an random mac when dpdk pf restart.
+            session.send_expect("ifconfig %s down" % intf, "#")
+            out = session.send_expect("ifconfig %s up" % intf, "#")
+            # SIOCSIFFLAGS: Network is down
+            # i think the pf link abnormal
+            if "Network is down" in out:
+                print GREEN(out)
+                print GREEN("Try again")
+                self.dut_testpmd.quit()
+                self.vm0_dut.restore_interfaces_linux()
+                self.start_pf_vf()
+            else:
+                out = session.send_expect("ethtool %s" % intf, "#")
+                if "Link detected: yes" in out:
+                    return True
+            time.sleep(1)
+        return False
+
+    def send_packet_UP(self, mac, pkt_lens=64, num=1, prio=0):
+        """
+        send different User Priority packets.
+        """
+        pkt = Packet(pkt_type='VLAN_UDP', pkt_len=pkt_lens)
+        pkt.config_layer('ether', {'dst': mac, 'src': self.tester_mac})
+        pkt.config_layer('vlan', {'vlan': 0, 'prio': prio})
+        pkt.send_pkt(tx_port=self.tester_intf, count=num)
+
+    def send_packet(self, mac, pkt_type, pkt_lens=64, num=100):
+        """
+        send packets with different PCtype.
+        """
+        if (pkt_type == "udp"):
+            pkt = Packet(pkt_type='UDP', pkt_len=pkt_lens)
+            pkt.config_layer('ether', {'dst': mac, 'src': self.tester_mac})
+            pkt.config_layer('ipv4', {'src': '192.168.0.1', 'dst': '192.168.0.2'})
+            pkt.config_layer('udp', {'src': 22, 'dst': 23})
+            pkt.send_pkt(tx_port=self.tester_intf, count=num)
+        elif (pkt_type == "ipv4"):
+            pkt = Packet(pkt_type='IP_RAW', pkt_len=pkt_lens)
+            pkt.config_layer('ether', {'dst': mac, 'src': self.tester_mac})
+            pkt.send_pkt(tx_port=self.tester_intf, count=num)
+
+    def verify_result(self, prio, pkt_num):
+        """
+        verify if the packets with different User Priority
+        enter to the expected TC queue.
+        """
+        out = self.vm0_dut.send_expect(
+            "ethtool -S %s |grep rx_.*packets" % self.vm0_intf0, "#")
+        rx_queue_packet = re.findall("rx_.*packets:\s*(\d*)", out)
+        self.verify(int(rx_queue_packet[prio + 1]) == pkt_num,
+                    "the packet didn't enter expected queue.")
+
+    def test_DCB_TC4(self):
+        """
+        DPDK PF, kernel VF, enable DCB mode with TC=4
+        """
+        self.dut_testpmd.execute_cmd("stop")
+        self.dut_testpmd.execute_cmd("port stop 0")
+        self.dut_testpmd.execute_cmd("port config 0 dcb vt on 4 pfc off")
+        self.dut_testpmd.execute_cmd("port start 0")
+        time.sleep(10)
+        self.vm0_dut.send_expect("rmmod %svf" % self.kdriver, "#")
+        self.vm0_dut.send_expect("modprobe %svf" % self.kdriver, "#")
+        self.verify(self.check_pf_vf_link_status(
+            self.vm0_dut, self.vm0_intf0), "vf link down")
+        # get the vf's mac address after vf reset.
+        vf_out = self.vm0_dut.send_expect("ifconfig %s" % self.vm0_intf0, "#")
+        vf_mac = re.findall("ether\s(\S*)\s*", vf_out)
+        # verify the rx_queue number equals to TC number.
+        out = self.vm0_dut.send_expect(
+            "ethtool -S %s" % self.vm0_intf0, "#")
+        rx_queue_num = re.findall("rx_.*misses:\s*(\d*)", out)
+        self.verify(len(rx_queue_num) == 4, "the queues count error")
+        # verify the packet with prio 0-3 enter to queue 0-3
+        # verify the packet with prio 4-7 enter to queue 0
+        self.send_packet_UP(mac=vf_mac[0], prio=0)
+        self.verify_result(prio=0, pkt_num=1)
+        self.send_packet_UP(mac=vf_mac[0], prio=1)
+        self.verify_result(prio=1, pkt_num=1)
+        self.send_packet_UP(mac=vf_mac[0], prio=2)
+        self.verify_result(prio=2, pkt_num=1)
+        self.send_packet_UP(mac=vf_mac[0], prio=3)
+        self.verify_result(prio=3, pkt_num=1)
+        self.send_packet_UP(mac=vf_mac[0], prio=4)
+        self.verify_result(prio=0, pkt_num=2)
+        self.send_packet_UP(mac=vf_mac[0], prio=5)
+        self.verify_result(prio=0, pkt_num=3)
+        self.send_packet_UP(mac=vf_mac[0], prio=6)
+        self.verify_result(prio=0, pkt_num=4)
+        self.send_packet_UP(mac=vf_mac[0], prio=7)
+        self.verify_result(prio=0, pkt_num=5)
+
+    def test_disable_DCB(self):
+        """
+        DPDK PF, kernel VF, disable DCB mode
+        """
+        self.dut_testpmd.execute_cmd("set vf vlan insert 0 0 1")
+        # verify the rx_queue number is the default number.
+        out = self.vm0_dut.send_expect(
+            "ethtool -S %s" % self.vm0_intf0, "#")
+        rx_queue_num = re.findall("rx_.*misses:\s*(\d*)", out)
+        self.verify(len(rx_queue_num) == 2, "the queues count error")
+        # get the vf's mac address after vf reset.
+        vf_out = self.vm0_dut.send_expect("ifconfig %s" % self.vm0_intf0, "#")
+        vf_mac = re.findall("ether\s(\S*)\s*", vf_out)
+        # verify different packet enter different queues with RSS.
+        self.send_packet(mac=vf_mac[0], pkt_type="ipv4")
+        out = self.vm0_dut.send_expect(
+            "ethtool -S %s |grep rx_.*packets" % self.vm0_intf0, "#")
+        rx_queue_packet = re.findall("rx_.*packets:\s*(\d*)", out)
+        self.verify(int(rx_queue_packet[1]) == 100,
+                    "the packet didn't enter expected queue.")
+        self.verify(int(rx_queue_packet[2]) == 0,
+                    "the packet didn't enter expected queue.")
+        self.send_packet(mac=vf_mac[0], pkt_type="udp")
+        out = self.vm0_dut.send_expect(
+            "ethtool -S %s |grep rx_.*packets" % self.vm0_intf0, "#")
+        rx_queue_packet = re.findall("rx_.*packets:\s*(\d*)", out)
+        self.verify(int(rx_queue_packet[2]) == 100,
+                    "the packet didn't enter expected queue.")
+
+    def tear_down(self):
+        """
+        Run after each test case.
+        """
+        self.vm0_testpmd.quit()
+        self.vm0_dut.restore_interfaces_linux()
+        self.dut_testpmd.quit()
+
+        # Sometime test failed ,we still need clear ip.
+        self.vm0_dut.send_expect(
+            "ifconfig %s 0.0.0.0" % self.vm0_intf0, "#")
+        self.tester.send_expect("ifconfig %s 0.0.0.0" %
+                                self.tester_intf, "#")
+
+    def tear_down_all(self):
+        """
+        Run after each test suite.
+        """
+        self.destroy_vm_env()
+        self.dut.kill_all()
+        time.sleep(2)
-- 
2.5.0

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

end of thread, other threads:[~2019-04-03 18:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-02  9:37 [dts] [PATCH] tests: add TestSuite_ixgbe_vf_get_extra_queue_information.py Yuan Peng
2019-04-03  3:02 ` Li, WenjieX A
2019-04-03 18:16 ` Tu, Lijuan
  -- strict thread matches above, loose matches on Subject: below --
2017-12-29  8:14 Peng Yuan
2018-01-30  3:31 ` Liu, Yong

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