From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 2BE2EA00E6 for ; Wed, 12 Jun 2019 04:38:30 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E1A161D0D9; Wed, 12 Jun 2019 04:38:29 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id D32DA1D06B for ; Wed, 12 Jun 2019 04:38:26 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Jun 2019 19:38:25 -0700 X-ExtLoop1: 1 Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by FMSMGA003.fm.intel.com with ESMTP; 11 Jun 2019 19:38:25 -0700 Received: from fmsmsx119.amr.corp.intel.com (10.18.124.207) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 11 Jun 2019 19:38:25 -0700 Received: from shsmsx153.ccr.corp.intel.com (10.239.6.53) by FMSMSX119.amr.corp.intel.com (10.18.124.207) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 11 Jun 2019 19:38:23 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.104]) by SHSMSX153.ccr.corp.intel.com ([169.254.12.76]) with mapi id 14.03.0439.000; Wed, 12 Jun 2019 10:38:21 +0800 From: "Tu, Lijuan" To: "Ma, LihongX" , "dts@dpdk.org" CC: "Wang, Yinan" , "Ma, LihongX" Thread-Topic: [dts] [PATCH V1] tests: delete useless testsuite of virtio Thread-Index: AQHVG3UtIVH6P1A8AkyayJB9G9uuyqaXWNfw Date: Wed, 12 Jun 2019 02:38:21 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BAB9331@SHSMSX101.ccr.corp.intel.com> References: <1559695313-16891-1-git-send-email-lihongx.ma@intel.com> In-Reply-To: <1559695313-16891-1-git-send-email-lihongx.ma@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.600.7 dlp-reaction: no-action x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYTMzYmI0ZmUtZWJmYS00NmNlLWI2ZTItZDU2MDc4NzU2ODY3IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiQ0diaFVoa0lKaTZuSThSYlNpMkIzelJBelVNQkxUYWlKUnNCWVwvK1pUZkRPVWZia0tcL1BrNUlGNU8zVXRIdGlLIn0= 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] tests: delete useless testsuite of virtio 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: , Errors-To: dts-bounces@dpdk.org Sender: "dts" Applied, thanks > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of lihong > Sent: Wednesday, June 5, 2019 8:42 AM > To: dts@dpdk.org > Cc: Wang, Yinan ; Ma, LihongX > > Subject: [dts] [PATCH V1] tests: delete useless testsuite of virtio >=20 > Signed-off-by: lihong > --- > tests/TestSuite_vhost_cuse_one_copy_one_vm.py | 446 --------------------= ------ > tests/TestSuite_vhost_user_one_copy_one_vm.py | 421 --------------------= ---- > tests/TestSuite_virtio_iperf.py | 305 ------------------ > 3 files changed, 1172 deletions(-) > delete mode 100644 tests/TestSuite_vhost_cuse_one_copy_one_vm.py > delete mode 100644 tests/TestSuite_vhost_user_one_copy_one_vm.py > delete mode 100644 tests/TestSuite_virtio_iperf.py >=20 > diff --git a/tests/TestSuite_vhost_cuse_one_copy_one_vm.py > b/tests/TestSuite_vhost_cuse_one_copy_one_vm.py > deleted file mode 100644 > index 573419a..0000000 > --- a/tests/TestSuite_vhost_cuse_one_copy_one_vm.py > +++ /dev/null > @@ -1,446 +0,0 @@ > -# BSD LICENSE > -# > -# Copyright(c) 2010-2015 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. > - > -Vhost Cuse one-copy sample test suite. > -""" > -import os > -import utils > -import string > -import re > -import time > -from scapy.utils import wrpcap, rdpcap > -from test_case import TestCase > -from exception import VerifyFailure > -from settings import HEADER_SIZE > -from etgen import IxiaPacketGenerator > -from qemu_kvm import QEMUKvm > - > - > -class TestVhostCuseOneCopyOneVm(TestCase, IxiaPacketGenerator): > - > - def set_up_all(self): > - # To Extend IXIA packet generator method, call the tester's meth= od. > - > self.tester.extend_external_packet_generator(TestVhostCuseOneCopyOneV > m, self) > - > - # Change config file to enable vhost-cuse compiled. > - self.dut.send_expect( > - "sed -i -e > 's/CONFIG_RTE_LIBRTE_VHOST_USER=3D.*$/CONFIG_RTE_LIBRTE" > - "_VHOST_USER=3Dn/' ./config/common_base", > - "# ", > - 30) > - self.dut.build_install_dpdk(self.target) > - self.dut.send_expect("cd ./lib/librte_vhost", "#", 30) > - print self.dut.send_expect("make", "#", 30) > - self.dut.send_expect("cd ./eventfd_link", "#", 30) > - print self.dut.send_expect("make", "#", 30) > - self.dut.send_expect("cd ~/dpdk", "#", 30) > - > - # build the vhost sample in vhost-cuse mode. > - if self.nic in ['niantic']: > - self.dut.send_expect( > - "sed -i -e 's/#define MAX_QUEUES.*$/#define MAX_QUEUES 1= 28/' > " > - "./examples/vhost/main.c", > - "#") > - else: > - self.dut.send_expect( > - "sed -i -e 's/#define MAX_QUEUES.*$/#define MAX_QUEUES 5= 12/' > " > - "./examples/vhost/main.c", > - "#") > - out =3D self.dut.send_expect("make -C examples/vhost", "#") > - self.verify("Error" not in out, "compilation error") > - self.verify("No such file" not in out, "Not found file error") > - > - # Build target with modified config file > - self.dut.build_install_dpdk(self.target) > - > - # Get and verify the ports > - self.dut_ports =3D self.dut.get_ports() > - self.verify(len(self.dut_ports) >=3D 1, "Insufficient ports for = testing") > - > - # Get the port's socket > - self.pf =3D self.dut_ports[0] > - netdev =3D self.dut.ports_info[self.pf]['port'] > - self.socket =3D netdev.get_nic_socket() > - self.cores =3D self.dut.get_core_list("1S/3C/1T", socket=3Dself.= socket) > - > - # Set the params of vhost-cuse sample > - self.vhost_app =3D "./examples/vhost/build/vhost-switch" > - self.zero_copy =3D 0 > - self.vm2vm =3D 0 > - self.jumbo =3D 0 > - self.vhost_test =3D self.vhost_app + \ > - " -c %s -n %d --socket-mem 1024,1024 -- -p 0x1 --mergeable %= d" + \ > - " --zero-copy %d --vm2vm %d 2 > ./vhost.out &" > - > - # Define the virtio/VM variables > - self.virtio1 =3D "eth1" > - self.virtio2 =3D "eth2" > - self.virtio1_mac =3D "52:54:00:00:00:01" > - self.virtio2_mac =3D "52:54:00:00:00:02" > - self.src1 =3D "192.168.4.1" > - self.src2 =3D "192.168.3.1" > - self.dst1 =3D "192.168.3.1" > - self.dst2 =3D "192.168.4.1" > - self.vm_dut =3D None > - self.virtio_cmd_params =3D \ > - > 'csum=3Doff,gso=3Doff,guest_csum=3Doff,guest_tso4=3Doff,guest_tso6=3Doff,= guest_ecn=3D > off' > - # Define the table columns > - self.header_row =3D ["FrameSize(B)", "Injection(Mpps)", > "Throughput(Mpps)", "LineRate(%)"] > - self.memory_channel =3D 4 > - > - def set_up(self): > - # > - # Run before each test case. > - # > - # Launch vhost sample using default params > - > - if "jumbo" in self.running_case: > - self.jumbo =3D 1 > - self.frame_sizes =3D [64, 128, 256, 512, 1024, 1280, 1518, 2= 048, 5000, > 9000] > - self.vm_testpmd =3D "./x86_64-native-linuxapp-gcc/app/testpm= d -c 0x3 > -n 3" \ > - + " -- -i --tx-offloads=3D0x8000 " \ > - + "--disable-hw-vlan-filter --max-pkt-len 9600" > - else: > - self.jumbo =3D 0 > - self.frame_sizes =3D [64, 128, 256, 512, 1024, 1280, 1518] > - self.vm_testpmd =3D "./x86_64-native-linuxapp-gcc/app/testpm= d -c 0x3 > -n 3" \ > - + " -- -i --tx-offloads=3D0x8000 --disable-hw-vlan-filte= r" > - self.dut.send_expect("rm -rf ./vhost.out", "#") > - > - self.launch_vhost_sample() > - > - # start VM with 2virtio > - self.start_onevm() > - > - def launch_vhost_sample(self): > - # > - # Launch the vhost sample with different parameters > - # > - self.coremask =3D utils.create_mask(self.cores) > - self.vhostapp_testcmd =3D self.vhost_test % ( > - self.coremask, self.memory_channel, self.jumbo, self.zero_co= py, > self.vm2vm) > - # Clean and prepare the vhost cuse modules > - self.dut.send_expect("rm -rf /dev/vhost-net", "#", 20) > - self.dut.send_expect("modprobe fuse", "#", 20) > - self.dut.send_expect("modprobe cuse", "#", 20) > - self.dut.send_expect("rmmod eventfd_link", "#", 20) > - self.dut.send_expect( > - "insmod lib/librte_vhost/eventfd_link/eventfd_link.ko", > - "#", > - 20) > - self.dut.send_expect(self.vhostapp_testcmd, "# ", 40) > - time.sleep(30) > - try: > - print "Launch vhost sample:" > - self.dut.session.copy_file_from("/root/dpdk/vhost.out") > - fp =3D open('./vhost.out', 'r') > - out =3D fp.read() > - fp.close() > - if "Error" in out: > - raise Exception("Launch vhost sample failed") > - else: > - print "Launch vhost sample finished" > - except Exception as e: > - print utils.RED("Failed to launch vhost sample: %s" % str(e)= ) > - > - def start_onevm(self): > - # > - # Start One VM with 2 virtio devices > - # > - > - self.vm =3D QEMUKvm(self.dut, 'vm0', 'vhost_cuse_sample') > - if "cuse" in self.running_case: > - vm_params =3D {} > - vm_params['driver'] =3D 'vhost-cuse' > - vm_params['opt_mac'] =3D self.virtio1_mac > - vm_params['opt_settings'] =3D self.virtio_cmd_params > - self.vm.set_vm_device(**vm_params) > - > - vm_params['opt_mac'] =3D self.virtio2_mac > - vm_params['opt_settings'] =3D self.virtio_cmd_params > - self.vm.set_vm_device(**vm_params) > - try: > - self.vm_dut =3D self.vm.start() > - if self.vm_dut is None: > - raise Exception("Set up VM ENV failed") > - except Exception as e: > - print utils.RED("Failure for %s" % str(e)) > - > - return True > - > - def vm_testpmd_start(self): > - # > - # Start testpmd in vm > - # > - if self.vm_dut is not None: > - # Start testpmd with user > - self.vm_dut.send_expect(self.vm_testpmd, "testpmd>", 20) > - # Start tx_first > - self.vm_dut.send_expect("start tx_first", "testpmd>") > - > - def clear_vhost_env(self): > - # > - # Kill all vhost sample, shutdown VM > - # > - if self.vm_dut: > - self.vm_dut.kill_all() > - time.sleep(1) > - if self.vm: > - self.vm.stop() > - self.vm =3D None > - > - def set_legacy_disablefw(self): > - # > - # Disable firewall and ip tables in legacy case > - # > - if self.vm_dut is not None: > - self.vm_dut.send_expect("systemctl stop firewalld.service", = "#") > - self.vm_dut.send_expect("systemctl disable firewalld.service= ", "#") > - self.vm_dut.send_expect("systemctl stop ip6tables.service", = "#") > - self.vm_dut.send_expect("systemctl disable ip6tables.service= ", "#") > - self.vm_dut.send_expect("systemctl stop iptables.service", "= #") > - self.vm_dut.send_expect("systemctl disable iptables.service"= , "#") > - self.vm_dut.send_expect( > - "systemctl stop NetworkManager.service", > - "#") > - self.vm_dut.send_expect( > - "systemctl disable NetworkManager.service", > - "#") > - self.vm_dut.send_expect( > - "echo 1 >/proc/sys/net/ipv4/ip_forward", > - "#") > - > - def set_onevm_legacy_fwd(self): > - if self.vm_dut is not None: > - ifcfg =3D self.vm_dut.send_expect("ifconfig -a", "#", 10) > - intfs =3D re.compile('eth\d').findall(ifcfg) > - # Get the virito1/virtio2's interface names > - for intf in intfs: > - out_mac =3D self.vm_dut.send_expect( > - "ifconfig %s" % > - intf, "#", 10) > - if self.virtio1_mac in out_mac: > - self.virtio1 =3D intf > - if self.virtio2_mac in out_mac: > - self.virtio2 =3D intf > - print "Virtio1's intf is %s" % self.virtio1 > - print "Virtio2's intf is %s" % self.virtio2 > - # Set the MTU for jumboframe enabled case > - if self.jumbo =3D=3D 1: > - self.vm_dut.send_expect( > - "ifconfig %s mtu 9000" % > - self.virtio1, "#") > - self.vm_dut.send_expect( > - "ifconfig %s mtu 9000" % > - self.virtio2, "#") > - # Set the ipv4 fwd rules > - self.vm_dut.send_expect( > - "ip addr add 192.168.4.2/24 dev %s" % > - self.virtio1, "#") > - self.vm_dut.send_expect( > - "ip addr add 192.168.3.2/24 dev %s" % > - self.virtio2, "#") > - self.vm_dut.send_expect( > - "ip link set dev %s up" % > - self.virtio1, "#") > - self.vm_dut.send_expect( > - "ip link set dev %s up" % > - self.virtio2, "#") > - self.vm_dut.send_expect( > - "ip neigh add 192.168.4.1 lladdr 52:00:00:00:00:01 dev %= s" % > - self.virtio1, "#") > - self.vm_dut.send_expect( > - "ip neigh add 192.168.3.1 lladdr 52:00:00:00:00:02 dev %= s" % > - self.virtio2, "#") > - self.vm_dut.send_expect("ip route show", "#") > - print self.vm_dut.send_expect("arp -a", "#") > - > - def get_transmission_results(self, rx_port_list, tx_port_list, delay= =3D5): > - time.sleep(delay) > - recvbpsRate =3D 0 > - recvRate =3D 0 > - txbpsRate =3D 0 > - txRate =3D 0 > - for port in tx_port_list: > - self.stat_get_rate_stat_all_stats(port) > - out =3D self.send_expect('stat cget -framesSent', '%', 10) > - txRate +=3D int(out.strip()) > - self.logger.info("Port %s: TX %f Mpps" % (port, (txRate * 1.= 0 / > 1000000))) > - out =3D self.send_expect('stat cget -bitsSent', '%', 10) > - txbpsRate +=3D int(out.strip()) > - self.logger.info("Port %s: TX %f Mbps" % (port, (txbpsRate *= 1.0 / > 1000000))) > - for port in rx_port_list: > - self.stat_get_rate_stat_all_stats(port) > - out =3D self.send_expect('stat cget -framesReceived', '%', 1= 0) > - recvRate +=3D int(out.strip()) > - out =3D self.send_expect('stat cget -oversize', '%', 10) > - recvRate +=3D int(out.strip()) > - self.logger.info("Port %s: RX %f Mpps" % (port, (recvRate * = 1.0 / > 1000000))) > - out =3D self.send_expect('stat cget -bitsReceived', '%', 10) > - recvbpsRate +=3D int(out.strip()) > - self.logger.info("Port %s: RX %f Mbps" % (port, (recvbpsRate= * 1.0 / > 1000000))) > - > - self.hook_transmissoin_func() > - self.send_expect("ixStopTransmit portList", "%", 30) > - > - return (txRate,recvRate) > - > - def send_verify(self, case, frame_sizes, vlan_id1=3D0, vlan_id2=3D0)= : > - self.result_table_create(self.header_row) > - for frame_size in frame_sizes: > - info =3D "Running test %s, and %d frame size." % (case, fram= e_size) > - self.logger.info(info) > - payload =3D frame_size - HEADER_SIZE['eth'] - HEADER_SIZE['i= p'] > - flow1 =3D > '[Ether(dst=3D"%s")/Dot1Q(vlan=3D%s)/IP(src=3D"%s",dst=3D"%s")/("X"*%d)]'= % ( > - self.virtio1_mac, vlan_id1, self.src1, self.dst1, payloa= d) > - flow2 =3D > '[Ether(dst=3D"%s")/Dot1Q(vlan=3D%s)/IP(src=3D"%s",dst=3D"%s")/("X"*%d)]'= % ( > - self.virtio2_mac, vlan_id2, self.src2, self.dst2, payloa= d) > - self.tester.scapy_append('wrpcap("flow1.pcap", %s)' % flow1) > - self.tester.scapy_append('wrpcap("flow2.pcap", %s)' % flow2) > - self.tester.scapy_execute() > - > - tgenInput =3D [] > - port =3D self.tester.get_local_port(self.pf) > - tgenInput.append((port, port, "flow1.pcap")) > - tgenInput.append((port, port, "flow2.pcap")) > - > - recvpkt, sendpkt =3D self.tester.traffic_generator_throughpu= t( > - tgenInput, delay=3D15) > - recvpkt /=3D 1000000.0 > - sendpkt /=3D 1000000.0 > - pct =3D sendpkt * 100 / recvpkt > - data_row =3D [frame_size, str(recvpkt), str(sendpkt), str(pc= t)] > - self.result_table_add(data_row) > - self.result_table_print() > - > - def test_perf_cuse_one_vm_legacy_fwd(self): > - # > - # Test the performance of one vm with 2virtio devices in legacy = fwd > - # > - > - self.vm_dut.restore_interfaces() > - # Setup legacy env > - self.set_legacy_disablefw() > - self.set_onevm_legacy_fwd() > - time.sleep(5) > - > - self.dut.get_session_output(timeout=3D2) > - # print "\nclean out1:", out1 > - self.dut.session.copy_file_from("/root/dpdk/vhost.out") > - fp =3D open('./vhost.out', 'r') > - out =3D fp.read() > - fp.close() > - # Get the VLAN ID for virtio > - print "Check the vlan info: " > - l1 =3D re.findall( > - 'MAC_ADDRESS.*?%s.*?and.*?VLAN_TAG.*?(\d+).*?registered' % > - (str(self.virtio1_mac)), out) > - if len(l1) > 0: > - vlan_id1 =3D l1[0] > - print "vlan_id1 is ", vlan_id1 > - l2 =3D re.findall( > - 'MAC_ADDRESS.*?%s.*?and.*?VLAN_TAG.*?(\d+).*?registered' % > - (str(self.virtio2_mac)), out) > - if len(l2) > 0: > - vlan_id2 =3D l2[0] > - print "vlan_id2 is ", vlan_id2 > - > - self.send_verify(self.running_case, self.frame_sizes, vlan_id1, = vlan_id2) > - # Stop the Vhost sample > - self.dut.send_expect("killall -s INT vhost-switch", "#", 20) > - > - def test_perf_cuse_one_vm_dpdk_fwd(self): > - # > - # Test the performance of one vm with 2virtio devices in legacy = fwd > - # > - > - # start testpmd on VM > - self.vm_testpmd_start() > - time.sleep(5) > - # Clean the output to make the next command can get correct answ= ers > - self.dut.get_session_output(timeout=3D2) > - self.dut.session.copy_file_from("/root/dpdk/vhost.out") > - fp =3D open('./vhost.out', 'r') > - out =3D fp.read() > - fp.close() > - # Get the VLAN ID for virtio > - print "Check the vlan info: " > - l1 =3D re.findall( > - 'MAC_ADDRESS.*?%s.*?and.*?VLAN_TAG.*?(\d+).*?registered' % > - (str(self.virtio1_mac)), out) > - if len(l1) > 0: > - vlan_id1 =3D l1[0] > - print vlan_id1 > - l2 =3D re.findall( > - 'MAC_ADDRESS.*?%s.*?and.*?VLAN_TAG.*?(\d+).*?registered' % > - (str(self.virtio2_mac)), out) > - if len(l2) > 0: > - vlan_id2 =3D l2[0] > - print vlan_id2 > - > - self.send_verify(self.running_case, self.frame_sizes, vlan_id1, = vlan_id2) > - # Stop testpmd > - self.vm_dut.send_expect("stop", "testpmd>") > - time.sleep(1) > - self.vm_dut.send_expect("quit", "# ") > - > - # Stop the Vhost sample > - self.dut.send_expect("killall -s INT vhost-switch", "#") > - > - def test_perf_cuse_one_vm_legacy_fwd_jumboframe(self): > - self.test_perf_cuse_one_vm_legacy_fwd() > - > - def test_perf_cuse_one_vm_dpdk_fwd_jumboframe(self): > - self.test_perf_cuse_one_vm_dpdk_fwd() > - > - def tear_down(self): > - # > - # Run after each test case. > - # > - self.clear_vhost_env() > - self.dut.kill_all() > - time.sleep(2) > - > - def tear_down_all(self): > - """ > - Run after each test suite. > - """ > - # Restore the config file and recompile the package > - self.dut.send_expect( > - "sed -i -e > 's/CONFIG_RTE_LIBRTE_VHOST_USER=3D.*$/CONFIG_RTE_LIBRTE_VHOST_USER > =3Dy/' " > - "./config/common_base", > - "# ", > - 30) > - self.dut.build_install_dpdk(self.target) > - time.sleep(20) > diff --git a/tests/TestSuite_vhost_user_one_copy_one_vm.py > b/tests/TestSuite_vhost_user_one_copy_one_vm.py > deleted file mode 100644 > index ae7b5e9..0000000 > --- a/tests/TestSuite_vhost_user_one_copy_one_vm.py > +++ /dev/null > @@ -1,421 +0,0 @@ > -# BSD LICENSE > -# > -# Copyright(c) 2010-2015 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. > - > -Vhost user one-copy sample test suite. > -""" > -import os > -import utils > -import string > -import re > -import time > -from scapy.utils import wrpcap, rdpcap > -from test_case import TestCase > -from exception import VerifyFailure > -from settings import HEADER_SIZE > -from etgen import IxiaPacketGenerator > -from qemu_kvm import QEMUKvm > - > - > -class TestVhostUserOneCopyOneVm(TestCase, IxiaPacketGenerator): > - > - def set_up_all(self): > - # To Extend IXIA packet generator method, call the tester's meth= od. > - > self.tester.extend_external_packet_generator(TestVhostUserOneCopyOneVm, > self) > - > - # Build target with modified config file > - self.dut.send_expect( > - "sed -i -e > 's/CONFIG_RTE_LIBRTE_VHOST_USER=3D.*$/CONFIG_RTE_LIBRTE" > - "_VHOST_USER=3Dy/' ./config/common_base", > - "# ", > - 30) > - self.dut.build_install_dpdk(self.target) > - > - # Get and verify the ports > - self.dut_ports =3D self.dut.get_ports() > - self.verify(len(self.dut_ports) >=3D 1, "Insufficient ports for = testing") > - > - # Get the port's socket > - self.pf =3D self.dut_ports[0] > - netdev =3D self.dut.ports_info[self.pf]['port'] > - self.socket =3D netdev.get_nic_socket() > - self.cores =3D self.dut.get_core_list("1S/3C/1T", socket=3Dself.= socket) > - > - # Set the params of vhost sample > - self.vhost_app =3D "./examples/vhost/build/vhost-switch" > - self.zero_copy =3D 0 > - self.vm2vm =3D 0 > - self.jumbo =3D 0 > - > - # Using file to save the vhost sample output since in jumboframe= case, > - # there will be lots of output > - self.vhost_test =3D self.vhost_app + \ > - " -c %s -n %d --socket-mem 1024,1024 -- -p 0x1 --mergeable %= d" + \ > - " --zero-copy %d --vm2vm %d 2 > ./vhost.out &" > - # build the vhost sample in vhost-user mode. > - if self.nic in ['niantic']: > - self.dut.send_expect( > - "sed -i -e 's/#define MAX_QUEUES.*$/#define MAX_QUEUES 1= 28/' > " > - "./examples/vhost/main.c", > - "#", 10) > - else: > - self.dut.send_expect( > - "sed -i -e 's/#define MAX_QUEUES.*$/#define MAX_QUEUES 5= 12/' > " > - "./examples/vhost/main.c", > - "#", 10) > - out =3D self.dut.send_expect("make -C examples/vhost", "#") > - self.verify("Error" not in out, "compilation error") > - self.verify("No such file" not in out, "Not found file error") > - > - # Define the virtio/VM variables > - self.virtio1 =3D "eth1" > - self.virtio2 =3D "eth2" > - self.virtio1_mac =3D "52:54:00:00:00:01" > - self.virtio2_mac =3D "52:54:00:00:00:02" > - self.src1 =3D "192.168.4.1" > - self.src2 =3D "192.168.3.1" > - self.dst1 =3D "192.168.3.1" > - self.dst2 =3D "192.168.4.1" > - self.vm_dut =3D None > - > - self.header_row =3D ["FrameSize(B)", "Injection(Mpps)", > "Throughput(Mpps)", "LineRate(%)"] > - self.memory_channel =3D 4 > - > - def set_up(self): > - # > - # Run before each test case. > - # > - # Launch vhost sample using default params > - > - if "jumbo" in self.running_case: > - self.jumbo =3D 1 > - self.frame_sizes =3D [64, 128, 256, 512, 1024, 1280, 1518, 2= 048, 5000, > 9000] > - self.vm_testpmd =3D "./x86_64-native-linuxapp-gcc/app/testpm= d -c 0x3 > -n 3" \ > - + " -- -i --tx-offloads=3D0x8000 " \ > - + "--disable-hw-vlan-filter --max-pkt-len 9600" > - else: > - self.jumbo =3D 0 > - self.frame_sizes =3D [64, 128, 256, 512, 1024, 1280, 1518] > - self.vm_testpmd =3D "./x86_64-native-linuxapp-gcc/app/testpm= d -c 0x3 > -n 3" \ > - + " -- -i --tx-offloads=3D0x8000 --disable-hw-vlan-filte= r" > - self.dut.send_expect("rm -rf ./vhost.out", "#") > - > - self.launch_vhost_sample() > - > - # start VM with 2virtio > - self.start_onevm() > - > - def launch_vhost_sample(self): > - # > - # Launch the vhost sample with different parameters > - # > - self.coremask =3D utils.create_mask(self.cores) > - self.vhostapp_testcmd =3D self.vhost_test % ( > - self.coremask, self.memory_channel, self.jumbo, self.zero_co= py, > self.vm2vm) > - self.dut.send_expect(self.vhostapp_testcmd, "# ", 40) > - time.sleep(30) > - try: > - print "Launch vhost sample:" > - self.dut.session.copy_file_from("/root/dpdk/vhost.out") > - fp =3D open('./vhost.out', 'r') > - out =3D fp.read() > - fp.close() > - if "Error" in out: > - raise Exception("Launch vhost sample failed") > - else: > - print "Launch vhost sample finished" > - except Exception as e: > - print utils.RED("Failed to launch vhost sample: %s" % str(e)= ) > - > - def start_onevm(self): > - # > - # Start One VM with 2 virtio devices > - # > - > - self.vm =3D QEMUKvm(self.dut, 'vm0', 'vhost_sample') > - if "user" in self.running_case: > - vm_params =3D {} > - vm_params['driver'] =3D 'vhost-user' > - vm_params['opt_path'] =3D './vhost-net' > - vm_params['opt_mac'] =3D self.virtio1_mac > - self.vm.set_vm_device(**vm_params) > - vm_params['opt_mac'] =3D self.virtio2_mac > - self.vm.set_vm_device(**vm_params) > - > - try: > - self.vm_dut =3D self.vm.start() > - if self.vm_dut is None: > - raise Exception("Set up VM ENV failed") > - except Exception as e: > - print utils.RED("Failure for %s" % str(e)) > - > - return True > - > - def vm_testpmd_start(self): > - # > - # Start testpmd in vm > - # > - if self.vm_dut is not None: > - # Start testpmd with user > - self.vm_dut.send_expect(self.vm_testpmd, "testpmd>", 20) > - # Start tx_first > - self.vm_dut.send_expect("start tx_first", "testpmd>") > - > - def clear_vhost_env(self): > - # > - # Kill all vhost sample, shutdown VM > - # > - if self.vm_dut: > - self.vm_dut.kill_all() > - time.sleep(1) > - if self.vm: > - self.vm.stop() > - self.vm =3D None > - > - def set_legacy_disablefw(self): > - # > - # Disable firewall and iptables in legacy case > - # > - if self.vm_dut is not None: > - self.vm_dut.send_expect("systemctl stop firewalld.service", = "#") > - self.vm_dut.send_expect("systemctl disable firewalld.service= ", "#") > - self.vm_dut.send_expect("systemctl stop ip6tables.service", = "#") > - self.vm_dut.send_expect("systemctl disable ip6tables.service= ", "#") > - self.vm_dut.send_expect("systemctl stop iptables.service", "= #") > - self.vm_dut.send_expect("systemctl disable iptables.service"= , "#") > - self.vm_dut.send_expect( > - "systemctl stop NetworkManager.service", > - "#") > - self.vm_dut.send_expect( > - "systemctl disable NetworkManager.service", > - "#") > - self.vm_dut.send_expect( > - "echo 1 >/proc/sys/net/ipv4/ip_forward", > - "#") > - > - def set_onevm_legacy_fwd(self): > - if self.vm_dut is not None: > - ifcfg =3D self.vm_dut.send_expect("ifconfig -a", "#", 10) > - intfs =3D re.compile('eth\d').findall(ifcfg) > - # Find the virtio1 and virtio2's interface names > - for intf in intfs: > - out_mac =3D self.vm_dut.send_expect( > - "ifconfig %s" % > - intf, "#", 10) > - if self.virtio1_mac in out_mac: > - self.virtio1 =3D intf > - if self.virtio2_mac in out_mac: > - self.virtio2 =3D intf > - print "Virtio1's intf is %s" % self.virtio1 > - print "Virtio2's intf is %s" % self.virtio2 > - # Set the mtu 9000 if jumboframe is enabled. > - if self.jumbo =3D=3D 1: > - self.vm_dut.send_expect( > - "ifconfig %s mtu 9000" % > - self.virtio1, "#") > - self.vm_dut.send_expect( > - "ifconfig %s mtu 9000" % > - self.virtio2, "#") > - # Set up the ip address/ipv4 fwd tables > - self.vm_dut.send_expect( > - "ip addr add 192.168.4.2/24 dev %s" % > - self.virtio1, "#") > - self.vm_dut.send_expect( > - "ip addr add 192.168.3.2/24 dev %s" % > - self.virtio2, "#") > - self.vm_dut.send_expect( > - "ip link set dev %s up" % > - self.virtio1, "#") > - self.vm_dut.send_expect( > - "ip link set dev %s up" % > - self.virtio2, "#") > - self.vm_dut.send_expect( > - "ip neigh add 192.168.4.1 lladdr 52:00:00:00:00:01 dev %= s" % > - self.virtio1, "#") > - self.vm_dut.send_expect( > - "ip neigh add 192.168.3.1 lladdr 52:00:00:00:00:02 dev %= s" % > - self.virtio2, "#") > - self.vm_dut.send_expect("ip route show", "#") > - print self.vm_dut.send_expect("arp -a", "#") > - > - def get_transmission_results(self, rx_port_list, tx_port_list, delay= =3D5): > - time.sleep(delay) > - recvbpsRate =3D 0 > - recvRate =3D 0 > - txbpsRate =3D 0 > - txRate =3D 0 > - for port in tx_port_list: > - self.stat_get_rate_stat_all_stats(port) > - out =3D self.send_expect('stat cget -framesSent', '%', 10) > - txRate +=3D int(out.strip()) > - self.logger.info("Port %s: TX %f Mpps" % (port, (txRate * 1.= 0 / > 1000000))) > - out =3D self.send_expect('stat cget -bitsSent', '%', 10) > - txbpsRate +=3D int(out.strip()) > - self.logger.info("Port %s: TX %f Mbps" % (port, (txbpsRate *= 1.0 / > 1000000))) > - for port in rx_port_list: > - self.stat_get_rate_stat_all_stats(port) > - out =3D self.send_expect('stat cget -framesReceived', '%', 1= 0) > - recvRate +=3D int(out.strip()) > - out =3D self.send_expect('stat cget -oversize', '%', 10) > - recvRate +=3D int(out.strip()) > - self.logger.info("Port %s: RX %f Mpps" % (port, (recvRate * = 1.0 / > 1000000))) > - out =3D self.send_expect('stat cget -bitsReceived', '%', 10) > - recvbpsRate +=3D int(out.strip()) > - self.logger.info("Port %s: RX %f Mbps" % (port, (recvbpsRate= * 1.0 / > 1000000))) > - > - self.hook_transmissoin_func() > - self.send_expect("ixStopTransmit portList", "%", 30) > - > - return (txRate,recvRate) > - > - def send_verify(self, case, frame_sizes, vlan_id1=3D0, vlan_id2=3D0)= : > - self.result_table_create(self.header_row) > - for frame_size in frame_sizes: > - info =3D "Running test %s, and %d frame size." % (case, fram= e_size) > - self.logger.info(info) > - payload =3D frame_size - HEADER_SIZE['eth'] - HEADER_SIZE['i= p'] > - flow1 =3D > '[Ether(dst=3D"%s")/Dot1Q(vlan=3D%s)/IP(src=3D"%s",dst=3D"%s")/("X"*%d)]'= % ( > - self.virtio1_mac, vlan_id1, self.src1, self.dst1, payloa= d) > - flow2 =3D > '[Ether(dst=3D"%s")/Dot1Q(vlan=3D%s)/IP(src=3D"%s",dst=3D"%s")/("X"*%d)]'= % ( > - self.virtio2_mac, vlan_id2, self.src2, self.dst2, payloa= d) > - self.tester.scapy_append('wrpcap("flow1.pcap", %s)' % flow1) > - self.tester.scapy_append('wrpcap("flow2.pcap", %s)' % flow2) > - self.tester.scapy_execute() > - > - tgenInput =3D [] > - port =3D self.tester.get_local_port(self.pf) > - tgenInput.append((port, port, "flow1.pcap")) > - tgenInput.append((port, port, "flow2.pcap")) > - > - recvpkt, sendpkt =3D self.tester.traffic_generator_throughpu= t( > - tgenInput, delay=3D15) > - recvpkt /=3D 1000000.0 > - sendpkt /=3D 1000000.0 > - pct =3D sendpkt * 100 / recvpkt > - data_row =3D [frame_size, str(recvpkt), str(sendpkt), str(pc= t)] > - self.result_table_add(data_row) > - self.result_table_print() > - > - def test_perf_user_one_vm_legacy_fwd(self): > - # > - # Test the performance of one vm with 2virtio devices in legacy = fwd > - # > - # Restore the virtio interfaces to use legacy driver > - self.vm_dut.restore_interfaces() > - self.set_legacy_disablefw() > - # Set the legacy fwd rules then get the VLAN id from vhost sampl= e > - # output > - self.set_onevm_legacy_fwd() > - time.sleep(5) > - > - self.dut.get_session_output(timeout=3D2) > - self.dut.session.copy_file_from("/root/dpdk/vhost.out") > - fp =3D open('./vhost.out', 'r') > - out =3D fp.read() > - fp.close() > - # Get the VLAN ID for virtio > - print "Check the vlan info: " > - l1 =3D re.findall( > - 'MAC_ADDRESS.*?%s.*?and.*?VLAN_TAG.*?(\d+).*?registered' % > - (str(self.virtio1_mac)), out) > - if len(l1) > 0: > - vlan_id1 =3D l1[0] > - print "vlan_id1 is ", vlan_id1 > - l2 =3D re.findall( > - 'MAC_ADDRESS.*?%s.*?and.*?VLAN_TAG.*?(\d+).*?registered' % > - (str(self.virtio2_mac)), out) > - if len(l2) > 0: > - vlan_id2 =3D l2[0] > - print "vlan_id2 is ", vlan_id2 > - > - self.send_verify(self.running_case, self.frame_sizes, vlan_id1, = vlan_id2) > - # Stop the Vhost sample > - self.dut.send_expect("killall -s INT vhost-switch", "#", 20) > - > - def test_perf_user_one_vm_dpdk_fwd(self): > - # > - # Test the performance of one vm with 2virtio devices in legacy = fwd > - # > - # start testpmd on VM > - self.vm_testpmd_start() > - time.sleep(5) > - # Clean the output to ensure the commands cat ./vhost.out can be > sent > - # and got answered correctly. > - self.dut.get_session_output(timeout=3D2) > - self.dut.session.copy_file_from("/root/dpdk/vhost.out") > - fp =3D open('./vhost.out', 'r') > - out =3D fp.read() > - fp.close() > - # Get the VLAN ID for virtio > - print "Check the vlan info: " > - l1 =3D re.findall( > - 'MAC_ADDRESS.*?%s.*?and.*?VLAN_TAG.*?(\d+).*?registered' % > - (str(self.virtio1_mac)), out) > - if len(l1) > 0: > - vlan_id1 =3D l1[0] > - print vlan_id1 > - l2 =3D re.findall( > - 'MAC_ADDRESS.*?%s.*?and.*?VLAN_TAG.*?(\d+).*?registered' % > - (str(self.virtio2_mac)), out) > - if len(l2) > 0: > - vlan_id2 =3D l2[0] > - print vlan_id2 > - > - self.send_verify(self.running_case, self.frame_sizes, vlan_id1, = vlan_id2) > - # Stop testpmd > - self.vm_dut.send_expect("stop", "testpmd>") > - time.sleep(1) > - self.vm_dut.send_expect("quit", "# ") > - > - # Stop the Vhost sample > - self.dut.send_expect("killall -s INT vhost-switch", "#") > - > - def test_perf_user_one_vm_legacy_fwd_jumboframe(self): > - self.test_perf_user_one_vm_legacy_fwd() > - > - def test_perf_user_one_vm_dpdk_fwd_jumboframe(self): > - self.test_perf_user_one_vm_dpdk_fwd() > - > - def tear_down(self): > - # > - # Run after each test case. > - # > - self.clear_vhost_env() > - self.dut.kill_all() > - time.sleep(2) > - > - def tear_down_all(self): > - """ > - Run after each test suite. > - """ > - pass > diff --git a/tests/TestSuite_virtio_iperf.py b/tests/TestSuite_virtio_ipe= rf.py > deleted file mode 100644 > index a0bd6e9..0000000 > --- a/tests/TestSuite_virtio_iperf.py > +++ /dev/null > @@ -1,305 +0,0 @@ > -# BSD LICENSE > -# > -# Copyright(c) 2010-2014 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 DPDK vhost + virtio scenarios > -""" > -import re > -import utils > -import time > -import os > - > -from test_case import TestCase > -from qemu_kvm import QEMUKvm > - > -class TestVirtioIperf(TestCase): > - def set_up_all(self): > - > self.vhost_legacy_virtio_cmdline=3D"csum=3Doff,gso=3Doff,guest_csum=3Doff= ,guest_ts > o4=3Doff,guest_tso6=3Doff,guest_ecn=3Doff" > - > self.vhost_cuse_virtio_cmdline=3D"csum=3Doff,gso=3Doff,guest_csum=3Doff,g= uest_tso > 4=3Doff,guest_tso6=3Doff,guest_ecn=3Doff" > - self.vhost_user_virtio_cmdline=3D"" > - self.virtio_mac =3D ["52:54:00:00:00:01", "52:54:00:00:00:02"] > - self.virtio_ip =3D ["1.1.1.2", "1.1.1.3"] > - self.vm =3D [] > - self.vm_dut =3D [] > - > - self.dut_ports =3D self.dut.get_ports(self.nic) > - self.verify(len(self.dut_ports) >=3D 1, 'Insufficient ports for = test') > - > - self.phy_function =3D self.dut_ports[0] > - netdev =3D self.dut.ports_info[self.phy_function]['port'] > - self.socket =3D netdev.get_nic_socket() > - self.cores =3D self.dut.get_core_list("1S/3C/1T", socket=3Dself.= socket) > - self.coremask =3D utils.create_mask(self.cores) > - > - def set_up(self): > - pass > - > - def dut_execut_cmd(self, cmdline, ex=3D'#', timout=3D30): > - return self.dut.send_expect(cmdline, ex, timout) > - > - def build_vhost_lib(self, vhost=3D'user'): > - self.dut_execut_cmd('git clean -x -d -f') > - self.dut_execut_cmd('git checkout *') > - if vhost =3D=3D 'cuse': > - self.dut_execut_cmd( > - "sed -i -e > 's/CONFIG_RTE_LIBRTE_VHOST_USER=3D.*$/CONFIG_RTE_LIBRTE" + > - "_VHOST_USER=3Dn/' ./config/common_base") > - else: > - self.dut_execut_cmd( > - "sed -i -e > 's/CONFIG_RTE_LIBRTE_VHOST_USER=3D.*$/CONFIG_RTE_LIBRTE" + > - "_VHOST_USER=3Dy/' ./config/common_base") > - self.dut.build_install_dpdk(self.target) > - self.dut_execut_cmd("cd ./lib/librte_vhost") > - out =3D self.dut_execut_cmd("make") > - self.verify('Error' not in out, 'bulid err: build lib vhost fail= ed') > - self.dut_execut_cmd("cd ./eventfd_link") > - out =3D self.dut_execut_cmd("make") > - self.verify('Error' not in out, 'bulid err: build eventfd_link f= ailed') > - self.dut_execut_cmd("cd ~/dpdk") > - > - def build_vhost_app(self): > - if self.nic in "niantic": > - self.dut_execut_cmd( > - "sed -i -e 's/define MAX_QUEUES.*/define MAX_QUEUES 128/= ' " + > - "./examples/vhost/main.c") > - else: > - self.dut_execut_cmd( > - "sed -i -e 's/define MAX_QUEUES.*/define MAX_QUEUES 512/= ' " + > - "./examples/vhost/main.c") > - out =3D self.dut_execut_cmd("make -C ./examples/vhost") > - self.verify("Error" not in out, "compilation error") > - self.verify("No such file" not in out, "Not found file error") > - > - def launch_vhost_switch(self, coremask, channel, jumbo, scenario): > - self.vhost_switch =3D "./examples/vhost/build/vhost-switch" > - self.vhost_switch_cmd =3D self.vhost_switch + \ > - " -c %s -n %d --socket-mem 2048,2048 -- -p 0x1" + \ > - " --mergeable %d --zero-copy 0 --vm2vm %d > ./vhost.out &" > - self.dut_execut_cmd(self.vhost_switch_cmd % (coremask, channel, > jumbo, scenario)) > - time.sleep(20) > - self.dut.session.copy_file_from('/root/dpdk/vhost.out') > - time.sleep(5) > - fp =3D open('./vhost.out') > - fmsg =3D fp.read() > - fp.close() > - if 'Error' or 'error' in fmsg: > - print 'launch vhost sample failed' > - return False > - else: > - return True > - > - def iperf_result_verify(self, vm_client): > - ''' > - vm_client.session.copy_file_from("/root/dpdk/iperf_client.log") > - self.tester.send_expect('scp -P') > - ''' > - vm_client.session.copy_file_from("/root/dpdk/iperf_client.log") > - fp =3D open("./iperf_client.log") > - fmsg =3D fp.read() > - iperfdata =3D re.compile('[\d+]*.[\d+] [M|G]bits/sec').findall(f= msg) > - self.result_table_create(['Data', 'Unit']) > - for data in iperfdata: > - self.results_table_add([data.split()[0], data.split()[1]]) > - self.result_table_print() > - os.popen("rm -rf ./iperf_client.log") > - > - def test_perf_vhost_legacy_virtio_iperf(self): > - pass > - > - def test_perf_vhost_cuse_virtio_iperf(self): > - """ > - vhost cuse as back end, legacy virtio dirver as front end > - """ > - self.build_vhost_lib(vhost=3D'cuse') > - self.build_vhost_app() > - self.dut_execut_cmd('rm -rf /dev/vhost-net') > - self.dut_execut_cmd('rmmod igb_uio -f') > - self.dut_execut_cmd('rmmod eventfd_link') > - self.dut_execut_cmd('modprobe uio') > - self.dut_execut_cmd('modprobe fuse') > - self.dut_execut_cmd('modprobe cuse') > - self.dut_execut_cmd('insmod ./x86_64-native-linuxapp- > gcc/kmod/igb_uio.ko') > - > self.dut_execut_cmd('insmod ./lib/librte_vhost/eventfd_link/eventfd_link.= ko') > - self.dut.bind_interfaces_linux(self.drivername) > - self.launch_vhost_switch(self.coremask, 4, 0, 1) > - > - self.vm1 =3D QEMUKvm(self.dut, 'vm0', 'virtio_iperf') > - vm1_params =3D {} > - vm1_params['driver'] =3D 'vhost-cuse' > - vm1_params['opt_tap'] =3D 'vhost0' > - vm1_params['opt_mac'] =3D self.virtio_mac[0] > - vm1_params['opt_settings'] =3D self.vhost_cuse_virtio_cmdline > - self.vm1.set_vm_device(**vm1_params) > - try: > - self.vm1_dut =3D self.vm1.start(auto_portmap=3DFalse) > - time.sleep(10) > - if self.vm1_dut is None: > - raise Exception('VM1 start failed') > - except Exception as e0: > - print utils.RED('VM1 already exist, powerdown it first') > - self.vm1_dut.restore_interfaces() > - > - self.vm2 =3D QEMUKvm(self.dut, 'vm1', 'virtio_iperf') > - vm2_params =3D {} > - vm2_params['driver'] =3D 'vhost-cuse' > - vm2_params['opt_tap'] =3D 'vhost1' > - vm2_params['opt_mac'] =3D self.virtio_mac[1] > - vm2_params['opt_settings'] =3D self.vhost_cuse_virtio_cmdline > - self.vm2.set_vm_device(**vm2_params) > - try: > - self.vm2_dut =3D self.vm2.start(auto_portmap=3DFalse) > - time.sleep(10) > - if self.vm2_dut is None: > - raise Exception('VM2 start failed') > - except Exception as e1: > - print utils.RED('VM2 already exist, powerdown it first') > - self.vm2_dut.restore_interfaces() > - > - #self.start_iperf_server() > - vm1_vport =3D self.vm1_dut.send_expect('ifconfig -a', '#', 30) > - print 'vm net port:' > - print vm1_vport > - intfs =3D re.compile('eth\d').findall(vm1_vport) > - for intf in intfs: > - outmac =3D self.vm1_dut.send_expect('ifconfig %s' % intf, '#= ', 30) > - if self.virtio_mac[0] in outmac: > - self.vm1_intf =3D intf > - self.vm1_dut.send_expect('ifconfig %s %s' % (self.vm1_intf, > self.virtio_ip[0]), '#', 10) > - self.vm1_dut.send_expect('ifconfig %s up' % self.vm1_intf, '#', = 10) > - self.vm1_dut.send_expect('arp -s %s %s' % (self.virtio_ip[1], > self.virtio_mac[1]), '#', 10) > - self.vm1_dut.send_expect('iperf -s -p 12345 -i 1 > iperf_server.= log &', '', > 10) > - > - #self.start_iperf_client() > - vm2_vport =3D self.vm2_dut.send_expect('ifconfig -a', '#', 30) > - print 'vm net port:' > - print vm2_vport > - intfs =3D re.compile('eth\d').findall(vm2_vport) > - for intf in intfs: > - outmac =3D self.vm2_dut.send_expect('ifconfig %s' % intf, '#= ', 30) > - if self.virtio_mac[1] in outmac: > - self.vm2_intf =3D intf > - self.vm2_dut.send_expect('ifconfig %s %s' % (self.vm2_intf, > self.virtio_ip[1]), '#', 10) > - self.vm2_dut.send_expect('ifconfig %s up' % self.vm2_intf, '#', = 10) > - self.vm2_dut.send_expect('arp -s %s %s' % (self.virtio_ip[0], > self.virtio_mac[0]), '#', 10) > - self.vm2_dut.send_expect('iperf -c %s -p 12345 -i 1 -t 60 > > iperf_client.log &' % self.virtio_ip[0], '', 60) > - time.sleep(70) > - self.vm1_dut.send_expect("killall -s INT iperf", '', 10) > - self.iperf_result_verify(self.vm2_dut) > - > - def test_perf_vhost_user_virtio_iperf(self): > - """ > - vhost user as back end, legacy virtio dirver as front end > - """ > - self.build_vhost_lib(vhost=3D'user') > - self.build_vhost_app() > - #self.dut_execut_cmd('rm -rf /dev/vhost-net') > - self.dut_execut_cmd('rmmod igb_uio -f') > - self.dut_execut_cmd('rmmod eventfd_link') > - self.dut_execut_cmd('modprobe uio') > - #self.dut_execut_cmd('modprobe fuse') > - #self.dut_execut_cmd('modprobe cuse') > - self.dut_execut_cmd('insmod ./x86_64-native-linuxapp- > gcc/kmod/igb_uio.ko') > - > self.dut_execut_cmd('insmod ./lib/librte_vhost/eventfd_link/eventfd_link.= ko') > - self.dut.bind_interfaces_linux(self.drivername) > - self.launch_vhost_switch(self.coremask, 4, 0, 1) > - > - self.vm1 =3D QEMUKvm(self.dut, 'vm0', 'virtio_iperf') > - vm1_params =3D {} > - vm1_params['driver'] =3D 'vhost-user' > - vm1_params['opt_path'] =3D './vhost-net' > - vm1_params['opt_mac'] =3D self.virtio_mac[0] > - self.vm1.set_vm_device(**vm1_params) > - try: > - self.vm1_dut =3D self.vm1.start(auto_portmap=3DFalse) > - if self.vm1_dut is None: > - raise Exception('VM1 start failed') > - except Exception as e0: > - print utils.RED('VM1 already exist, powerdown it first') > - self.vm1_dut.restore_interfaces() > - > - self.vm2 =3D QEMUKvm(self.dut, 'vm1', 'virtio_iperf') > - vm2_params =3D {} > - vm2_params['driver'] =3D 'vhost-user' > - vm2_params['opt_path'] =3D './vhost-net' > - vm2_params['opt_mac'] =3D self.virtio_mac[1] > - self.vm2.set_vm_device(**vm2_params) > - try: > - self.vm2_dut =3D self.vm2.start(auto_portmap=3DFalse) > - if self.vm2_dut is None: > - raise Exception('VM2 start failed') > - except Exception as e1: > - print utils.RED('VM2 already exist, powerdown it first') > - > - self.vm2_dut.restore_interfaces() > - > - #self.start_iperf_server() > - vm1_vport =3D self.vm1_dut.send_expect('ifconfig -a', '#', 30) > - print 'vm net port:' > - print vm1_vport > - intfs =3D re.compile('eth\d').findall(vm1_vport) > - for intf in intfs: > - outmac =3D self.vm1_dut.send_expect('ifconfig %s' % intf, '#= ', 30) > - if self.virtio_mac[0] in outmac: > - self.vm1_intf =3D intf > - self.vm1_dut.send_expect('ifconfig %s %s' % (self.vm1_intf, > self.virtio_ip[0]), '#', 10) > - self.vm1_dut.send_expect('ifconfig %s up' % self.vm1_intf, '#', = 10) > - self.vm1_dut.send_expect('arp -s %s %s' % (self.virtio_ip[1], > self.virtio_mac[1]), '#', 10) > - self.vm1_dut.send_expect('iperf -s -p 12345 -i 1 > iperf_server.= log &', '', > 10) > - > - #self.start_iperf_client() > - vm2_vport =3D self.vm2_dut.send_expect('ifconfig -a', '#', 30) > - print 'vm net port:' > - print vm2_vport > - intfs =3D re.compile('eth\d').findall(vm2_vport) > - for intf in intfs: > - outmac =3D self.vm2_dut.send_expect('ifconfig %s' % intf, '#= ', 30) > - if self.virtio_mac[1] in outmac: > - self.vm2_intf =3D intf > - self.vm2_dut.send_expect('ifconfig %s %s' % (self.vm2_intf, > self.virtio_ip[1]), '#', 10) > - self.vm2_dut.send_expect('ifconfig %s up' % self.vm2_intf, '#', = 10) > - self.vm2_dut.send_expect('arp -s %s %s' % (self.virtio_ip[0], > self.virtio_mac[0]), '#', 10) > - self.vm2_dut.send_expect('iperf -c %s -p 12345 -i 1 -t 60 > > iperf_client.log &' % self.virtio_ip[0], '', 60) > - time.sleep(70) > - > - self.vm1_dut.session.send_expect('killall -s INT iperf', '#', 10= ) > - self.iperf_result_verify(self.vm2_dut) > - > - def tear_down(self): > - if self.vm2: > - self.vm2.stop() > - self.vm2 =3D None > - if self.vm1: > - self.vm1.stop() > - self.vm1 =3D None > - self.dut.send_expect("killall -s INT vhost-switch", "#") > - > - def tear_down_all(self): > - pass > -- > 2.7.4