From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 4EE4C2C28 for ; Tue, 14 Mar 2017 04:02:07 +0100 (CET) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Mar 2017 20:02:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,162,1486454400"; d="scan'208";a="75755107" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga005.fm.intel.com with ESMTP; 13 Mar 2017 20:02:06 -0700 Received: from fmsmsx122.amr.corp.intel.com (10.18.125.37) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 13 Mar 2017 20:02:06 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx122.amr.corp.intel.com (10.18.125.37) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 13 Mar 2017 20:02:05 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.20]) by shsmsx102.ccr.corp.intel.com ([169.254.2.88]) with mapi id 14.03.0248.002; Tue, 14 Mar 2017 11:02:02 +0800 From: "Liu, Yong" To: "Xu, GangX" , "dts@dpdk.org" CC: "Xu, GangX" Thread-Topic: [dts] [PATCH V1] add test suite vf kernel Thread-Index: AQHSm9b5KOjgaOHyukiP6P1ovHvISKGTo83g Date: Tue, 14 Mar 2017 03:02:01 +0000 Message-ID: <86228AFD5BCD8E4EBFD2B90117B5E81E62D79B07@SHSMSX103.ccr.corp.intel.com> References: <1489395125-18629-1-git-send-email-gangx.xu@intel.com> In-Reply-To: <1489395125-18629-1-git-send-email-gangx.xu@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dts] [PATCH V1] add test suite vf kernel X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Mar 2017 03:02:09 -0000 Thanks Gang, some comments below. > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of xu,gang > Sent: Monday, March 13, 2017 4:52 PM > To: dts@dpdk.org > Cc: Xu, GangX > Subject: [dts] [PATCH V1] add test suite vf kernel >=20 > Signed-off-by: xu,gang > --- > tests/TestSuite_vf_kernel.py | 590 > +++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 590 insertions(+) > create mode 100644 tests/TestSuite_vf_kernel.py >=20 > diff --git a/tests/TestSuite_vf_kernel.py b/tests/TestSuite_vf_kernel.py > new file mode 100644 > index 0000000..444ffbf > --- /dev/null > +++ b/tests/TestSuite_vf_kernel.py > @@ -0,0 +1,590 @@ > +# 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 string > +import time > +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, sniff_packets, load_sniff_packets > + > + > +class TestVfKernel(TestCase): > + > + def set_up_all(self): > + """ > + Run at the start of each test suite. > + """ > + self.dut_ports =3D self.dut.get_ports(self.nic) > + self.verify(len(self.dut_ports) >=3D 1, "Insufficient ports") > + self.cores =3D self.dut.get_core_list("1S/4C/1T") > + self.coremask =3D utils.create_mask(self.cores) > + > + self.dmac =3D self.dut.get_mac_address(self.dut_ports[0]) > + txport =3D self.tester.get_local_port(self.dut_ports[0]) > + self.tester_intf =3D self.tester.get_interface(txport) > + > + self.intf =3D self.dut.ports_info[self.dut_ports[0]]['intf'] > + self.pci =3D > self.dut.ports_info[self.dut_ports[0]]['pci'].split(':') > + > + self.IXGBE =3D '3.15.1-k' > + self.IXGBEVF =3D '2.11.3-k' > + self.IXGBE_FIRMWARE =3D '0x61bf0001' > + > + self.I40E =3D '2.0.15' > + self.I40EVF =3D '2.0.13' > + self.I40E_FIRMWARE =3D '5.50 0x80002c0c 1.3908.0' > + If hard code ixgbe and i40e driver verison, it can only work on your platfo= rm. Is that what expected? > + self.verify_version() > + self.dut.send_expect("killall qemu-system-x86_64", "#", 10) Please not kill qemu process, user may use it for other purpose. And our fr= amework will try to cleanup qemu process. > + self.setup_vm_env() > + self.get_vm_intf() > + > + self.vm0_mac =3D self.vm0_dut.get_mac_address(0) > + self.vm1_mac =3D self.vm1_dut.get_mac_address(0) > + > + def set_up(self): > + """ > + Run before each test case. > + """ > + self.dut.kill_all() > + time.sleep(2) > + pass > + > + def verify_version(self): > + """ > + verify the dut version > + """ > + self.dut.restore_interfaces_linux() > + if self.kdriver =3D=3D "ixgbe": > + out =3D self.dut.send_expect("ethtool -i %s" % self.intf, "#= ", > 60) > + self.verify(self.IXGBE in out, "%s does not ixgbe %s test" % > + (self.IXGBE, self.nic)) > + self.verify(self.IXGBE_FIRMWARE in out, "%s does not > firmware %s test" % ( > + self.IXGBE_FIRMWARE, self.nic)) > + put =3D self.dut.send_expect("modinfo %svf" % self.kdriver, = "# > ", 60) > + self.verify(self.IXGBEVF in put, "%s does not ixgbevf %s > test" % ( > + self.IXGBEVF, self.nic)) > + elif self.kdriver =3D=3D "i40e": > + out =3D self.dut.send_expect("ethtool -i %s" % self.intf, "#= ", > 60) > + self.verify(self.I40E in out and self.I40E_FIRMWARE in out, > + "Temporarily does not support %s test" % self.ni= c) > + put =3D self.dut.send_expect("modinfo %svf" % self.kdriver, = "# > ", 60) > + self.verify(self.I40EVF in put, > + "Temporarily does not support %s test" % self.ni= c) > + self.bind_interfaces_linux() > + > + def get_vm_intf(self): > + if self.vm0_dut is not None: > + self.vm0_intf =3D self.vm0_dut.ports_info[0]['intf'] > + self.verify(self.vm0_intf !=3D 'N/A', "erroe intf") > + if self.vm1_dut is not None: > + self.vm1_intf =3D self.vm1_dut.ports_info[0]['intf'] > + self.verify(self.vm1_intf !=3D 'N/A', "erroe intf") > + > + def setup_vm_env(self): > + """ > + Start One VM with one virtio device > + """ > + self.dut.generate_sriov_vfs_by_port( > + self.dut_ports[0], 6, driver=3D'igb_uio') > + self.sriov_vfs_port =3D self.dut.ports_info[ > + self.dut_ports[0]]['vfs_port'] > + self.dut.send_expect("rmmod %svf" % self.kdriver, "# ") > + self.dut_testpmd =3D PmdOutput(self.dut) > + vf0_prop_1 =3D {'opt_host': self.sriov_vfs_port[0].pci} > + vf0_prop_2 =3D {'opt_host': self.sriov_vfs_port[1].pci} > + vf0_prop_3 =3D {'opt_host': self.sriov_vfs_port[2].pci} > + vf0_prop_4 =3D {'opt_host': self.sriov_vfs_port[3].pci} > + self.vm0 =3D QEMUKvm(self.dut, 'vm0', 'vf_kernel') > + self.vm0.set_vm_device(driver=3D'pci-assign', **vf0_prop_1) > + self.vm0.set_vm_device(driver=3D'pci-assign', **vf0_prop_2) > + self.vm0.set_vm_device(driver=3D'pci-assign', **vf0_prop_3) > + self.vm0.set_vm_device(driver=3D'pci-assign', **vf0_prop_4) > + > + try: > + self.vm0_dut =3D self.vm0.start() > + if self.vm0_dut is None: > + raise Exception("Set up VM ENV failed") > + except Exception as e: > + self.destroy_vm_env() > + self.logger.error("Failure for %s" % str(e)) > + > + vf1_prop_5 =3D {'opt_host': self.sriov_vfs_port[4].pci} > + vf1_prop_6 =3D {'opt_host': self.sriov_vfs_port[5].pci} > + self.vm1 =3D QEMUKvm(self.dut, 'vm1', 'vf_kernel') > + self.vm1.set_vm_device(driver=3D'pci-assign', **vf1_prop_5) > + self.vm1.set_vm_device(driver=3D'pci-assign', **vf1_prop_6) > + > + try: > + self.vm1_dut =3D self.vm1.start() > + if self.vm1_dut is None: > + raise Exception("Set up VM1 ENV failed!") > + except Exception as e: > + self.destroy_vm_env() > + raise Exception(e) > + self.vm0_testpmd =3D PmdOutput(self.vm0_dut) > + self.vm1_testpmd =3D PmdOutput(self.vm1_dut) > + self.vm0_dut.restore_interfaces_linux() > + self.vm1_dut.restore_interfaces_linux() > + self.env_done =3D True > + > + def destroy_vm_env(self): > + """ > + destroy vm environment > + """ > + if getattr(self, 'vm0', None): > + self.vm0_dut.kill_all() > + self.vm0_dut_ports =3D None > + # destroy vm0 > + self.vm0.stop() > + self.vm0 =3D None > + > + if getattr(self, 'vm1', None): > + self.vm1_dut.kill_all() > + self.vm1_dut_ports =3D None > + # destroy vm1 > + self.vm1.stop() > + self.vm1 =3D None > + > + if getattr(self, 'used_dut_port', None): > + self.dut.destroy_sriov_vfs_by_port(self.used_dut_port) > + port =3D self.dut.ports_info[self.used_dut_port]['port'] > + self.used_dut_port =3D None > + > + self.env_done =3D False > + > + def send_packet(self, mac, vlan_id=3D'', pkt_lens=3D64, num=3D1, > tran_type=3D''): > + """ > + Send a packet to port > + """ > + if tran_type =3D=3D "vlan": > + pkt =3D Packet(pkt_type=3D'VLAN_UDP', pkt_len=3Dpkt_lens) > + pkt.config_layer('ether', {'dst': mac}) > + pkt.config_layer('vlan', {'vlan': vlan_id}) > + pkt.send_pkt(tx_port=3Dself.tester_intf, count=3Dnum) > + time.sleep(.5) > + else: > + pkt =3D Packet(pkt_type=3D'TCP', pkt_len=3Dpkt_lens) > + pkt.config_layer('ether', {'dst': mac}) > + pkt.send_pkt(tx_port=3Dself.tester_intf, count=3Dnum) > + time.sleep(.5) > + > + def test_link(self): > + """ > + verify the link state > + """ > + self.dut_testpmd.start_testpmd("Default", "--rxq=3D4 --txq=3D4") > + for time in range(2): > + self.vm0_dut.send_expect( > + "ifconfig %s up" % self.vm0_intf, "#", 10) > + out =3D self.vm0_dut.send_expect( > + "ifconfig %s" % self.vm0_intf, "#", 10) > + self.verify("UP" in out, "up error") > + self.vm0_dut.send_expect("ifconfig %s down" % > + self.vm0_intf, "#", 10) > + out =3D self.vm0_dut.send_expect( > + "ifconfig %s" % self.vm0_intf, "#", 10) > + self.verify("UP" not in out, "down error") > + self.dut_testpmd.quit() > + > + def test_ping(self): > + """ > + verify the ping state > + """ > + self.dut_testpmd.start_testpmd("Default", "--rxq=3D4 --txq=3D4") > + > + for i in range(3): > + self.vm0_dut.send_expect("ifconfig %s up" % self.vm0_intf, > "#", 10) > + self.tester.send_expect("ifconfig %s up " % > + self.tester_intf, "#", 10) > + > + self.vm0_dut.send_expect("ifconfig %s 5.5.5.7" % > + self.vm0_intf, "#", 10) > + self.tester.send_expect("ifconfig %s 5.5.5.9" % > + self.tester_intf, "#", 10) > + self.tester.send_expect("ping 5.5.5.7", "PING", 10) > + time.sleep(10) > + out =3D self.tester.send_expect("^C", "#", 10) > + packet =3D re.findall("\s*(\d*)% packet loss,", out) > + self.verify(packet[0] =3D=3D '0', "can't ping successfully t= o > vm0") > + > + self.tester.send_expect("ifconfig %s down" % > + self.tester_intf, "#", 10) > + self.vm0_dut.send_expect("ifconfig %s down" % > + self.vm0_intf, "#", 10) > + > + self.dut_testpmd.quit() > + > + def test_reset(self): > + """ > + verify reset the vf1 impact on VF0 > + """ > + for i in range(2): > + out =3D self.dut_testpmd.start_testpmd("Default", "--rxq=3D4= -- > txq=3D4") > + self.verify("Port %s Link Up" % self.dut_ports[ > + 0] in out, "PF link down error") > + > + self.vm0_dut.send_expect("ifconfig %s up" % self.vm0_intf, > "#", 20) > + self.vm1_dut.send_expect("ifconfig %s up" % self.vm1_intf, > "#", 20) > + > + self.vm1_dut.send_expect("ifconfig %s down" % > + self.vm1_intf, "#", 10) > + out =3D self.vm0_dut.send_expect( > + "ifconfig %s" % self.vm0_intf, "#", 10) > + self.verify("UP"in out, "VF1 link change impact on VF0") > + > + self.vm1_dut.send_expect("rmmod ixgbevf", "#", 10) Why not just unbind from ixgbevf driver?=20 > + out =3D self.vm0_dut.send_expect( > + "ifconfig %s" % self.vm0_intf, "#", 10) > + self.verify("UP"in out, "VF1 kernel driver change impact on > VF0") > + > + self.vm0_dut.send_expect("tcpdump -i %s" % > + self.vm0_intf, "listening on", 10) > + self.send_packet(self.vm0_mac) > + out =3D self.vm0_dut.send_expect("^C", "#", 10) > + packet =3D re.findall("\s*(\d*) packet captured", out) > + self.verify('1' =3D=3D packet[0], "VF0 rx_package failure") > + > + self.vm1_dut.restore_interfaces_linux() > + out =3D self.vm0_dut.send_expect( > + "ifconfig %s" % self.vm0_intf, "#", 10) > + self.verify("UP"in out, "VF0 link change impact on VF1") > + > + self.vm0_dut.send_expect("tcpdump -i %s" % > + self.vm0_intf, "listening on", 10) > + self.send_packet(self.vm0_mac) > + out =3D self.vm0_dut.send_expect("^C", "#", 10) > + packet =3D re.findall("\s*(\d*) packet captured", out) > + self.verify('1' =3D=3D packet[0], "VF1 rx_package failure") > + self.dut_testpmd.quit() > + > + def test_address(self): > + """ > + verify add/delete IP/MAC address > + """ > + self.dut_testpmd.start_testpmd("Default", "--rxq=3D4 --txq=3D4") > + self.vm0_dut.send_expect( > + "ifconfig %s up" % self.vm0_intf, "#", 10) > + self.vm0_dut.send_expect( > + "ifconfig %s add efdd::9fc8:6a6d:c232:f1c0" % self.vm0_intf, > "#", 10) > + self.vm0_dut.send_expect( > + "ifconfig %s del efdd::9fc8:6a6d:c232:f1c0" % self.vm0_intf, > "#", 10) > + self.vm0_dut.send_expect( > + "ifconfig %s hw ether 00:AA:BB:CC:dd:EE" % self.vm0_intf, "#= ", > 10) > + self.vm0_dut.send_expect("tcpdump -i %s" % > + self.vm0_intf, "tcpdump", 10) > + self.send_packet('00:AA:BB:CC:dd:EE') > + out =3D self.vm0_dut.send_expect("^C", "#", 10) > + packet =3D re.findall("\s*(\d*) packet captured", out) > + self.verify(packet[0] =3D=3D '1', "address error") > + self.dut_testpmd.quit() > + > + def test_vlan(self): > + """ > + verify add/delete vlan > + """ > + vlan_id =3D random.randint(0, 4095) > + > + self.dut_testpmd.start_testpmd("Default", "--rxq=3D4 --txq=3D4") > + self.vm0_dut.send_expect("modprobe 8021q", "#", 10) > + self.vm0_dut.send_expect("vconfig add %s %s" % > + (self.vm0_intf, vlan_id), "#", 10) > + > + out =3D self.vm0_dut.send_expect("ls /proc/net/vlan ", "#", 10) > + self.verify("%s.%s" % (self.vm0_intf, vlan_id) > + in out, "take vlan id failure") > + > + self.vm0_dut.send_expect("tcpdump -i %s" % self.vm0_intf, "#", 1= 0) > + self.send_packet(self.vm0_mac, '4096', tran_type=3D'vlan') > + out =3D self.vm0_dut.send_expect("^C", "#", 10) > + packet =3D re.findall("\s*(\d*) packet captured", out) > + self.verify('0' =3D=3D packet[0], "test_vlan1 error") > + > + self.vm0_dut.send_expect("tcpdump -i %s" % self.vm0_intf, "#", 1= 0) > + self.send_packet(self.vm0_mac, vlan_id, tran_type=3D'vlan') > + out =3D self.vm0_dut.send_expect("^C", "#", 10) > + packet =3D re.findall("\s*(\d*) packet captured", out) > + self.verify('1' =3D=3D packet[0], "test_vlan2 error") > + > + self.vm0_dut.send_expect("vconfig rem %s.%s" % > + (self.vm0_intf, vlan_id), "#", 10) > + out =3D self.vm0_dut.send_expect("ls /proc/net/vlan ", "#", 10) > + self.verify("%s.%s" % (self.vm0_intf, vlan_id) > + not in out, "vlan error") > + > + self.vm0_dut.send_expect("tcpdump -i %s" % self.vm0_intf, "#", 1= 0) > + self.send_packet(self.vm0_mac, vlan_id, tran_type=3D'vlan') > + out =3D self.vm0_dut.send_expect("^C", "#", 10) > + packet =3D re.findall("\s*(\d*) packet captured", out) > + self.verify('0' =3D=3D packet[0], "test_vlan3 error") > + self.dut_testpmd.quit() > + > + def test_packet_statistic(self): > + """ > + verify packet statistic > + """ > + self.dut_testpmd.start_testpmd("Default", "--rxq=3D4 --txq=3D4") > + out =3D self.vm0_dut.send_expect( > + "ethtool -S %s" % self.vm0_intf, "#", 10) > + packet_before =3D re.findall("rx_packets:\s*(\d*)", out) > + self.send_packet(self.vm0_mac, num=3D100) > + out =3D self.vm0_dut.send_expect( > + "ethtool -S %s" % self.vm0_intf, "#", 10) > + packet_after =3D re.findall("rx_packets:\s*(\d*)", out) > + self.verify(packet_after[0] > packet_before[ > + 0], "packet_statistic error") > + self.dut_testpmd.quit() > + > + def test_mtu(self): > + """ > + verify mtu change > + """ > + self.vm0_dut.send_expect("ifconfig %s" % self.vm0_intf, "mtu > 1500", 10) > + self.vm0_dut.send_expect("ifconfig %s up" % > + self.vm0_intf, "mtu 1500", 10) > + > + self.dut.send_expect("ifconfig %s" % self.intf, "mtu 1500", 10) > + > + self.dut_testpmd.start_testpmd("Default", "--rxq=3D4 --txq=3D4") > + > + self.vm0_dut.send_expect("tcpdump -i %s" % self.vm0_intf, "#", 1= 0) > + self.send_packet(self.vm0_mac, pkt_lens=3D2000) > + out =3D self.vm0_dut.send_expect("^C", "#", 10) > + packet =3D re.findall("\s*(\d*) packet captured", out) > + self.verify('0' =3D=3D packet[0], "mtu1 error") > + > + self.send_packet(self.dmac, pkt_lens=3D2000) > + out =3D self.dut_testpmd.execute_cmd('show port stats 0') > + out =3D self.vm0_dut.send_expect("^C", "#", 10) > + packet =3D re.findall("RX-packets:\s*(\d*)", out) > + self.verify('0' =3D=3D packet[0], "mtu1 error") > + > + self.dut_testpmd.execute_cmd('port stop all') > + self.dut_testpmd.execute_cmd('port config mtu 0 3000') > + self.dut_testpmd.execute_cmd('port start all') > + > + self.send_packet(self.dmac, pkt_lens=3D2000) > + out =3D self.dut_testpmd.execute_cmd('show port stats 0') > + packet =3D re.findall("RX-packets:\s*(\d*)", out) > + self.verify('1' =3D=3D packet[0], "mtu1 error") > + > + self.vm0_dut.send_expect("ifconfig %s mtu 3000" % > + self.vm0_intf, "#", 10) > + self.vm0_dut.send_expect("tcpdump -i %s" % self.vm0_intf, "#", 1= 0) > + self.send_packet(self.vm0_mac, pkt_lens=3D2000) > + out =3D self.vm0_dut.send_expect("^C", "#", 10) > + packet =3D re.findall("\s*(\d*) packet captured", out) > + self.verify('1' =3D=3D packet[0], "mtu1 error") > + > + self.dut_testpmd.execute_cmd('port stop all') > + self.dut_testpmd.execute_cmd('port config mtu 0 1500') > + self.dut_testpmd.execute_cmd('port start all') > + > + self.vm0_dut.send_expect("ifconfig %s mtu 1500" % > + self.vm0_intf, "#", 10) > + > + self.dut_testpmd.quit() > + > + def test_promisc_mode(self): > + """ > + verify Enable/disable promisc mode > + """ > + self.verify(self.nic in ["niantic"], > + "%s NIC not support tcpid " % self.nic) > + > + self.dut_testpmd.start_testpmd("Default", "--rxq=3D4 --txq=3D4") > + > + self.dut_testpmd.execute_cmd('set promisc all on') > + self.dut_testpmd.execute_cmd('set fwd rxonly') > + self.dut_testpmd.execute_cmd('set verbose 1') > + self.dut_testpmd.execute_cmd('start') > + self.vm0_dut.send_expect("tcpdump -i %s -n -e -vv" % > + self.vm0_intf, "tcpdump", 10) > + random_mac =3D '33:33:00:00:00:16' > + self.send_packet(random_mac) > + time.sleep(.5) > + out =3D self.vm0_dut.send_expect("^C", "#", 10) > + self.verify(random_mac in out, "promisc_mode failure") > + > + self.dut_testpmd.execute_cmd('set promisc all off') > + self.vm0_dut.send_expect("tcpdump -i %s -p -n -e -vv" % > + self.vm0_intf, "tcpdump", 10) > + self.send_packet(random_mac) > + time.sleep(.5) > + out =3D self.vm0_dut.send_expect("^C", "#", 10) > + self.verify(random_mac not in out, "disable promisc_mode failure= ") > + > + self.vm0_dut.send_expect( > + "tcpdump -i %s -p -n -e -vv ./getPackageByTcpdump.cap" % > self.vm0_intf, "tcpdump", 10) > + self.send_packet(self.vm0_mac) > + time.sleep(.5) > + out =3D self.vm0_dut.send_expect("^C", "#", 10) > + self.verify(self.vm0_mac in out, "promisc_mode error") > + > + self.dut_testpmd.quit() > + > + def test_rss(self): > + """ > + verify kernel VF each queue can receive packets > + """ > + self.verify(self.nic in ["niantic"], > + "%s NIC not support tcpid " % self.nic) > + self.dut_testpmd.start_testpmd("Default", "--rxq=3D4 --txq=3D4") > + out =3D self.vm0_dut.send_expect( > + "ethtool -l %s" % self.vm0_intf, "#", 10) > + qeumu_num =3D re.findall("Combined:\s*(\d*)", out) > + out =3D self.vm0_dut.send_expect( > + "ethtool -S %s" % self.vm0_intf, "#", 10) > + packet =3D re.findall("rx_packets:\s*(\d*)", out) > + for i in xrange(5): > + mythread =3D > threading.Thread(target=3Dself.send_packet(self.vm0_mac)) > + mythread.start() > + out =3D self.vm0_dut.send_expect( > + "ethtool -S %s" % self.vm0_intf, "#", 10) > + packet =3D re.findall("rx_packets:\s*(\d*)", out) > + self.verify(packet[0] > '0', "rss2 error") > + > + self.dut_testpmd.quit() > + > + def test_dpf_kvf_dvf(self): > + """ > + Check DPDK VF0 and kernel VF1 don't impact each other and no > performance drop > + """ > + out =3D self.dut_testpmd.start_testpmd("Default", "--rxq=3D4 --t= xq=3D4") > + self.verify("Port %s Link Up" % > + self.dut_ports[0] in out, "reset1 error") > + self.vm0_dut.send_expect( > + "ifconfig %s up " % self.vm0_dut.ports_info[0]['intf'], "#", > 10) > + self.vm0_dut.send_expect( > + "ifconfig %s up " % self.vm0_dut.ports_info[1]['intf'], "#", > 10) > + self.vm0_dut.send_expect( > + "./usertools/dpdk-devbind.py -b igb_uio %s" % > self.vm0_dut.ports_info[1]['intf'], "#", 10) > + self.vm0_testpmd.start_testpmd("Default") > + self.vm0_testpmd.execute_cmd('set promisc all on') > + self.vm0_testpmd.execute_cmd('set fwd rxonly') > + self.vm0_testpmd.execute_cmd('set verbose 1') > + self.vm0_testpmd.execute_cmd('start') > + mynewvmsession =3D self.vm0_dut.new_session() > + self.mynewvmsession.send_expect( > + "tcpdump -i %s -n -e -vv -w ./getPackageByTcpdump.cap" % > self.vm0_intf, "#", 10) > + self.send_packet(self.vm0_mac) > + out =3D self.mynewvmsession.send_expect( > + "tcpdump -nn -e -v -r ./getPackageByTcpdump.cap", "#", 10) > + self.verify(self.vm0_mac in out, "promisc_mode error") > + > + self.vm0_testpmd.quit() > + self.dut_testpmd.quit() > + > + def test_dpf_2kvf_2dvf_2vm(self): > + """ > + Check DPDK PF 2kernel VFs 2DPDK VFs 2VMs link change impact on > other VFs > + """ > + out =3D self.dut_testpmd.start_testpmd("Default", "--rxq=3D4 --t= xq=3D4") > + self.verify("Port %s Link Up" % > + self.dut_ports[0] in out, "reset1 error") > + for vm0_intf in self.vm0_dut.ports_info: > + self.vm0_dut.send_expect( > + "ifconfig %s up " % vm0_intf['intf'], "#", 10) > + for vm1_intf in self.vm1_dut.ports_info: > + self.vm0_dut.send_expect( > + "ifconfig %s up " % vm1_intf['intf'], "#", 10) > + self.vm0_dut.send_expect( > + "./usertools/dpdk-devbind.py -b igb_uio %s %s" % > (self.vm0_dut.ports_info[0]['pci'], self.vm0_dut.ports_info[1]['pci']), > "#", 10) > + self.vm0_dut.send_expect( > + "./usertools/dpdk-devbind.py -b igb_uio %s" % > (self.vm1_dut.ports_info[0]['pci']), "#", 10) > + > + self.vm0_testpmd.start_testpmd("Default") > + self.vm0_testpmd.execute_cmd('set promisc all on') > + self.vm0_testpmd.execute_cmd('set fwd rxonly') > + self.vm0_testpmd.execute_cmd('set verbose 1') > + self.vm0_testpmd.execute_cmd('start') > + > + self.vm1_testpmd.start_testpmd("Default") > + self.vm1_testpmd.execute_cmd('set promisc all on') > + self.vm1_testpmd.execute_cmd('set fwd rxonly') > + self.vm1_testpmd.execute_cmd('set verbose 1') > + self.vm1_testpmd.execute_cmd('start') > + > + mynewvmsession =3D self.vm0_dut.new_session() > + self.mynewvmsession.send_expect( > + "tcpdump -i %s -n -e -vv -w ./getPackageByTcpdump.cap" % > self.vm0_intf, "tcpdump", 10) > + self.send_packet(self.vm0_mac) > + out =3D self.mynewvmsession.send_expect( > + "tcpdump -nn -e -v -r ./getPackageByTcpdump.cap", "tcpdump", > 10) > + self.verify(self.vm0_mac in out, "promisc_mode error") > + > + self.vm0_testpmd.quit() > + self.dut_testpmd.quit() > + > + def test_stress(self): > + """ > + Load kernel driver stress > + """ > + out =3D self.dut_testpmd.start_testpmd("Default", "--rxq=3D4 --t= xq=3D4") > + self.verify("Port %s Link Up" % > + self.dut_ports[0] in out, "reset1 error") > + for i in xrange(5): > + out =3D self.vm0_dut.send_expect("rmmod ixgbevf", "#", 10) > + print out > + self.verify('error' not in out, > + "stress error for rmmod ixgbevf:%s" % out) > + out =3D self.vm0_dut.send_expect( > + "insmod /root/i40evf-2.0.16/src/ixgbevf.ko", "#", 10) > + self.verify( > + 'error' not in out, "stress error for insmod > /root/i40evf-2.0.16/src/ixgbevf.ko:%s" % out) Please remove hard code here, kernel driver should be pre-configured on vm. > + self.dut_testpmd.quit() > + > + def tear_down(self): > + """ > + Run after each test case. > + """ > + self.vm0_dut.kill_all() > + self.vm1_dut.kill_all() > + self.dut.kill_all() > + time.sleep(2) > + pass > + > + def tear_down_all(self): > + """ > + Run after each test suite. > + """ > + pass > -- > 1.9.3