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 A6627A328D for ; Tue, 22 Oct 2019 11:07:00 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 977591BE9B; Tue, 22 Oct 2019 11:07:00 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id E33941BE95 for ; Tue, 22 Oct 2019 11:06:58 +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; 22 Oct 2019 02:06:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,326,1566889200"; d="scan'208";a="348997032" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga004.jf.intel.com with ESMTP; 22 Oct 2019 02:06:57 -0700 Received: from fmsmsx112.amr.corp.intel.com (10.18.116.6) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 22 Oct 2019 02:06:35 -0700 Received: from shsmsx154.ccr.corp.intel.com (10.239.6.54) by FMSMSX112.amr.corp.intel.com (10.18.116.6) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 22 Oct 2019 02:06:35 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.96]) by SHSMSX154.ccr.corp.intel.com ([10.239.6.54]) with mapi id 14.03.0439.000; Tue, 22 Oct 2019 17:06:32 +0800 From: "Tu, Lijuan" To: "Ma, LihongX" , "dts@dpdk.org" CC: "Ma, LihongX" Thread-Topic: [dts] [PATCH V1] tests/vf_port_start_stop: use Packet to send pkt Thread-Index: AQHVgzWQx2o/5nYQWkeqhx5vUNEp76dmaYWA Date: Tue, 22 Oct 2019 09:06:33 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BB44EE2@SHSMSX101.ccr.corp.intel.com> References: <1571102684-10923-1-git-send-email-lihongx.ma@intel.com> In-Reply-To: <1571102684-10923-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.2.0.6 dlp-reaction: no-action x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYjJiNWVjYzQtMDhiYS00YTg2LTk4ZWYtMDM5MDUzYmYxZWFmIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoickRDNVwveGZYbDNFS05KRys4dkRTVUxVZDg5MW5FNkUrQnJUSDVTOStmTGM5Z3A3SkZpSGZTQzM1a0pcL21LcGp0In0= 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/vf_port_start_stop: use Packet to send pkt 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: Tuesday, October 15, 2019 9:25 AM > To: dts@dpdk.org > Cc: Ma, LihongX > Subject: [dts] [PATCH V1] tests/vf_port_start_stop: use Packet to send pk= t >=20 > Signed-off-by: lihong > --- > tests/TestSuite_vf_port_start_stop.py | 44 +++++++++++------------------= ------ > 1 file changed, 14 insertions(+), 30 deletions(-) >=20 > diff --git a/tests/TestSuite_vf_port_start_stop.py > b/tests/TestSuite_vf_port_start_stop.py > index dcd799b..945c671 100644 > --- a/tests/TestSuite_vf_port_start_stop.py > +++ b/tests/TestSuite_vf_port_start_stop.py > @@ -6,11 +6,7 @@ import time > from virt_common import VM > from test_case import TestCase > from pmd_output import PmdOutput > -from utils import RED, GREEN > -from net_device import NetDevice > -from crb import Crb > -from scapy.all import * > -from scapy.layers.sctp import SCTP, SCTPChunkData > +from packet import Packet > VM_CORES_MASK =3D 'all' >=20 > class TestVfPortStartStop(TestCase): > @@ -22,10 +18,8 @@ class TestVfPortStartStop(TestCase): > self.dut_ports =3D self.dut.get_ports(self.nic) > self.verify(len(self.dut_ports) >=3D 1, "Insufficient ports") > self.vm0 =3D None > - self.filename =3D "/tmp/vf.pcap" > self.tester_tx_port =3D self.tester.get_local_port(self.dut_port= s[0]) > self.tester_tintf =3D self.tester.get_interface(self.tester_tx_p= ort) > - self.send_pks_session =3D None > # set vf assign method and vf driver > self.vf_driver =3D self.get_suite_cfg()['vf_driver'] > if self.vf_driver is None: > @@ -40,6 +34,8 @@ class TestVfPortStartStop(TestCase): > def set_up(self): >=20 > self.setup_1pf_2vf_1vm_env_flag =3D 0 > + self.send_pks_session =3D None > + self.pkts =3D Packet() >=20 > def send_and_verify(self, dst_mac, testpmd): > """ > @@ -50,33 +46,23 @@ class TestVfPortStartStop(TestCase): > src_mac =3D self.tester.get_mac(self.tester_tx_port) > if src_mac =3D=3D 'N/A': > src_mac =3D "02:00:00:00:01" > - self.send_pkts(self.filename, dst_mac, src_mac) > + self.send_pkts(dst_mac, src_mac) > time.sleep(1) > self.check_port_start_stop(testpmd) > - self.tester.send_expect('killall -s INT scapy', '# ') > - self.tester.destroy_session(self.send_pks_session) > - self.send_pks_session =3D None >=20 > - def send_pkts(self, filename, dst_mac, src_mac): > + def send_pkts(self, dst_mac, src_mac): > """ > Generates a valid PCAP file with the given configuration. > """ > - def_pkts =3D {'IP/UDP': Ether(dst=3D"%s" % dst_mac, src=3D"%s" % > src_mac)/IP(src=3D"127.0.0.2")/UDP()/("X"*46), > - 'IP/TCP': Ether(dst=3D"%s" % dst_mac, src=3D"%s" % > src_mac)/IP(src=3D"127.0.0.2")/TCP()/("X"*46), > - 'IP/SCTP': Ether(dst=3D"%s" % dst_mac, src=3D"%s" % > src_mac)/IP(src=3D"127.0.0.2")/SCTP()/("X"*48), > - 'IPv6/UDP': Ether(dst=3D"%s" % dst_mac, src=3D"%s" % > src_mac)/IPv6(src=3D"::2")/UDP()/("X"*46), > - 'IPv6/TCP': Ether(dst=3D"%s" % dst_mac, src=3D"%s" % > src_mac)/IPv6(src=3D"::2")/TCP()/("X"*46),} > + def_pkts =3D {'IP/UDP': 'Ether(dst=3D"%s", > src=3D"%s")/IP(src=3D"127.0.0.2")/UDP()/("X"*46)' % (dst_mac, src_mac), > + 'IP/TCP': 'Ether(dst=3D"%s", > src=3D"%s")/IP(src=3D"127.0.0.2")/TCP()/("X"*46)' % (dst_mac, src_mac), > + 'IP/SCTP': 'Ether(dst=3D"%s", > src=3D"%s")/IP(src=3D"127.0.0.2")/SCTP()/("X"*48)' % (dst_mac, src_mac), > + 'IPv6/UDP': 'Ether(dst=3D"%s", > src=3D"%s")/IPv6(src=3D"::2")/UDP()/("X"*46)' % (dst_mac, src_mac), > + 'IPv6/TCP': 'Ether(dst=3D"%s", > src=3D"%s")/IPv6(src=3D"::2")/TCP()/("X"*46)' % (dst_mac, src_mac),} >=20 > - pkts =3D [] > for key in def_pkts.keys(): > - pkts.append(def_pkts[key]) > - wrpcap(filename, pkts) > - > - sendp_fmt =3D "sendp(pk, iface=3D'%s', loop=3D1)" % (self.tester= _tintf) > - self.send_pks_session =3D self.tester.create_session("scapy1") > - self.send_pks_session.send_expect("scapy", ">>>") > - self.send_pks_session.send_expect("pk=3Drdpcap('%s')" % filename= , > ">>>") > - self.send_pks_session.send_command(sendp_fmt) > + self.pkts.append_pkt(def_pkts[key]) > + self.send_pks_session =3D self.pkts.send_pkt_bg(self.tester, > self.tester_tintf) >=20 > def testpmd_reset_status(self, testpmd): > """ > @@ -195,15 +181,13 @@ class TestVfPortStartStop(TestCase): >=20 > def tear_down(self): >=20 > + if self.send_pks_session: > + self.pkts.stop_send_pkt_bg(self.tester, self.send_pks_sessio= n) > if self.setup_1pf_2vf_1vm_env_flag =3D=3D 1: > self.destroy_1pf_2vf_1vm_env() >=20 > def tear_down_all(self): >=20 > - if self.send_pks_session: > - self.tester.send_expect('killall -s INT scapy', '# ') > - self.tester.destroy_session(self.send_pks_session) > - > if getattr(self, 'vm0', None): > self.vm0.stop() >=20 > -- > 2.7.4