From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3AEFEA0471 for ; Fri, 19 Jul 2019 12:55:49 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 11F962BA8; Fri, 19 Jul 2019 12:55:49 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id A9DAD3DC for ; Fri, 19 Jul 2019 12:55:46 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Jul 2019 03:55:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,282,1559545200"; d="scan'208";a="319932754" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga004.jf.intel.com with ESMTP; 19 Jul 2019 03:55:44 -0700 Received: from fmsmsx120.amr.corp.intel.com (10.18.124.208) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 19 Jul 2019 03:55:44 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx120.amr.corp.intel.com (10.18.124.208) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 19 Jul 2019 03:55:44 -0700 Received: from shsmsx106.ccr.corp.intel.com ([169.254.10.240]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.55]) with mapi id 14.03.0439.000; Fri, 19 Jul 2019 18:55:42 +0800 From: "Yao, BingX Y" To: "Zhang, YanX A" , "dts@dpdk.org" CC: "Zhang, YanX A" Thread-Topic: [dts] [PATCH V1] tests/TestSuite_vf_to_vf_nic_bridge:Change the way you distribute Thread-Index: AQHVPhsxAwsxF/YcLk2XZV9+qKVo26bRxK9A Date: Fri, 19 Jul 2019 10:55:42 +0000 Message-ID: <95BCD24840F32441BEA74E0F8A31839E058F55BC@SHSMSX106.ccr.corp.intel.com> References: <1563531703-152978-1-git-send-email-yanx.a.zhang@intel.com> In-Reply-To: <1563531703-152978-1-git-send-email-yanx.a.zhang@intel.com> Accept-Language: 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] tests/TestSuite_vf_to_vf_nic_bridge:Change the way you distribute 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" Tested-by: Yao, BingX Y -----Original Message----- From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of zhang,yan Sent: Friday, July 19, 2019 6:22 PM To: dts@dpdk.org Cc: Zhang, YanX A Subject: [dts] [PATCH V1] tests/TestSuite_vf_to_vf_nic_bridge:Change the wa= y you distribute Change the way packets are sent and use testpmd instead of pktgen. Signed-off-by: zhang,yan --- tests/TestSuite_vf_to_vf_nic_bridge.py | 116 +++++++------------------ 1 file changed, 33 insertions(+), 83 deletions(-) diff --git a/tests/TestSuite_vf_to_vf_nic_bridge.py b/tests/TestSuite_vf_to= _vf_nic_bridge.py index 15b2ff9..1e7374c 100644 --- a/tests/TestSuite_vf_to_vf_nic_bridge.py +++ b/tests/TestSuite_vf_to_vf_nic_bridge.py @@ -125,57 +125,7 @@ class TestVF2VFBridge(TestCase): port.bind_driver() self.pf_port_for_vfs =3D 0 =20 - def generate_pcap_pkt(self, dst, src, load, pktname=3D'flow.pcap'): - """ - dst: - server: dst server object - ether: dst mac - ip: dst ip - udp: dst udp protocol - tcp: dst tcp protocal - src: - server: src server object - ether: src mac - ip: src ip - udp: src udp protocol - tcp: src tcp protocal - load: - content: pay load - length: content length - """ - context =3D '[Ether(dst=3D"%s", src=3D"%s")/IP()/Raw(load=3D%s)]' = % \ - (str(dst['ether']), str(src['ether']), load['content']) - src['server'].send_expect('scapy', '>>> ', 10) - src['server'].send_expect( - 'wrpcap("%s", %s)' % (pktname, context), '>>> ', 10) - src['server'].send_expect('quit()', '#', 10) - - def prepare_pktgen(self, vm): - vm.session.copy_file_to('./dep/tgen.tgz') - vm.send_expect("cd /root", "#", 10) - vm.send_expect("tar xvf tgen.tgz", '#', 20) - - def send_stream_pktgen(self, vm, pktname=3D'flow.pcap'): - vm.send_expect( - "echo 2048 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_huge= pages", "#", 10) - vm.send_expect(" mount -t hugetlbfs nodedev /mnt/huge/", "#", 10) - vm.send_expect( - "./pktgen -c 0xf -n 2 --proc-type auto -- -P -T -m '1.0' -s 0:= %s" % - pktname, "", 100) - time.sleep(60) - vm.send_expect("set 0 rate 50", "", 20) - time.sleep(5) - vm.send_expect("set 0 count %d" % SEND_PACKET, "", 20) - time.sleep(5) - vm.send_expect("start all", "", 20) - time.sleep(20) - - def stop_stream_pktgen(self, vm): - vm.send_expect("stop all", "", 20) - time.sleep(5) - vm.send_expect("quit", "#", 20) - - def test_2vf_d2d_pktgen_stream(self): + def test_2vf_d2d_testpmd_stream(self): self.vm0_ports =3D self.vm0_dut.get_ports('any') self.vm0_pmd =3D PmdOutput(self.vm0_dut) self.vm0_pmd.start_testpmd('all') @@ -183,60 +133,60 @@ class Test= VF2VFBridge(TestCase): self.vm0_pmd.execute_cmd("set promisc all off") self.vm0_pmd.execute_cmd('start') =20 - self.vm1_ports =3D self.vm1_dut.get_ports('any') - self.prepare_pktgen(self.vm1_dut) - - dst =3D {} - dst['server'] =3D self.vm0_dut - dst['ether'] =3D self.vm0_dut.ports_info[self.vm0_ports[0]]['mac'] - src =3D {} - src['server'] =3D self.vm1_dut - src['ether'] =3D self.vm1_dut.ports_info[self.vm1_ports[0]]['mac'] - load =3D {} - load['content'] =3D "'X'*46" - self.generate_pcap_pkt(dst, src, load) - self.vm0_pmd.execute_cmd('clear port stats all') - self.send_stream_pktgen(self.vm1_dut) + vm0_mac =3D self.vm0_dut.ports_info[self.vm0_ports[0]]['mac'] + + self.vm1_pmd =3D PmdOutput(self.vm1_dut) + self.vm1_pmd.start_testpmd('all') + self.vm1_pmd.execute_cmd('set fwd mac') + self.vm1_pmd.execute_cmd("set promisc all off") + self.vm1_pmd.execute_cmd('set eth-peer 0 %s' % vm0_mac) + self.vm1_pmd.execute_cmd('set burst 50') + self.vm1_pmd.execute_cmd('start tx_first 2') + recv_num =3D self.vm0_pmd.get_pmd_stats(0)['RX-packets'] time.sleep(1) - self.stop_stream_pktgen(self.vm1_dut) self.vm0_pmd.execute_cmd('stop') self.vm0_pmd.execute_cmd('quit', '# ') =20 + self.vm1_pmd.execute_cmd('stop') + self.vm1_pmd.execute_cmd('quit', '# ') + self.verify(recv_num is SEND_PACKET, 'Rx port recv error: %d' % recv_num) =20 - def test_2vf_d2k_pktgen_stream(self): + def test_2vf_d2k_testpmd_stream(self): self.vm0_dut.restore_interfaces() self.vm0_ports =3D self.vm0_dut.get_ports('any') vf0_intf =3D self.vm0_dut.ports_info[self.vm0_ports[0]]['intf'] =20 self.vm1_ports =3D self.vm1_dut.get_ports('any') - self.prepare_pktgen(self.vm1_dut) - - dst =3D {} - dst['server'] =3D self.vm0_dut - dst['ether'] =3D self.vm0_dut.ports_info[self.vm0_ports[0]]['mac'] - src =3D {} - src['server'] =3D self.vm1_dut - src['ether'] =3D self.vm1_dut.ports_info[self.vm1_ports[0]]['mac'] - load =3D {} - load['content'] =3D "'X'*46" - self.generate_pcap_pkt(dst, src, load) + + vm0_mac =3D self.vm0_dut.ports_info[self.vm0_ports[0]]['mac'] + filename =3D "m.pcap" + self.vm0_dut.send_expect( - 'tcpdump -i %s -s 1000 "ether src %s and ether dst %s"' % - (vf0_intf, src['ether'], dst['ether']), '= tcpdump', 30) - self.send_stream_pktgen(self.vm1_dut) - self.stop_stream_pktgen(self.vm1_dut) + 'tcpdump -i %s ether dst %s -w %s' % (vf0_intf,=20 + vm0_mac, filename), 'tcpdump', 30) =20 + self.vm1_pmd =3D PmdOutput(self.vm1_dut) + self.vm1_pmd.start_testpmd('all') + self.vm1_pmd.execute_cmd('set fwd mac') + self.vm1_pmd.execute_cmd("set promisc all off") + self.vm1_pmd.execute_cmd('set eth-peer 0 %s' % vm0_mac) + self.vm1_pmd.execute_cmd('set burst 50') + self.vm1_pmd.execute_cmd('start tx_first 2') + + time.sleep(1) recv_tcpdump =3D self.vm0_dut.send_expect('^C', '#', 30) time.sleep(5) - recv_pattern =3D re.compile("(\d+) packets captured") + recv_pattern =3D re.compile("(\d+) packet\w{0,1} captured") recv_info =3D recv_pattern.search(recv_tcpdump) recv_str =3D recv_info.group(0).split(' ')[0] recv_number =3D int(recv_str, 10) self.vm0_dut.bind_interfaces_linux(self.drivername) =20 + self.vm1_pmd.execute_cmd('stop') + self.vm1_pmd.execute_cmd('quit', '# ') + self.verify(recv_number is SEND_PACKET, 'Rx port recv error: %d' % recv_number) =20 -- 2.17.2