From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id F35E62BB4 for ; Mon, 11 Sep 2017 03:21:26 +0200 (CEST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Sep 2017 18:21:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,375,1500966000"; d="scan'208";a="310139295" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga004.fm.intel.com with ESMTP; 10 Sep 2017 18:21:24 -0700 Received: from fmsmsx126.amr.corp.intel.com (10.18.125.43) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 10 Sep 2017 18:21:24 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX126.amr.corp.intel.com (10.18.125.43) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 10 Sep 2017 18:21:24 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.219]) by shsmsx102.ccr.corp.intel.com ([169.254.2.39]) with mapi id 14.03.0319.002; Mon, 11 Sep 2017 09:21:19 +0800 From: "Liu, Yong" To: "Wang, FeiX Y" , "dts@dpdk.org" CC: "Wang, FeiX Y" Thread-Topic: [dts] [[patch v1]] framework/etgen.py: add in a function for ixia to send fixed number of packets Thread-Index: AQHTKIXCV4/xk/0wbkSpTBY3b3hQjaKu5dgg Date: Mon, 11 Sep 2017 01:21:19 +0000 Message-ID: <86228AFD5BCD8E4EBFD2B90117B5E81E62EA05DD@SHSMSX103.ccr.corp.intel.com> References: <1504872430-39616-1-git-send-email-feix.y.wang@intel.com> In-Reply-To: <1504872430-39616-1-git-send-email-feix.y.wang@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.0.116 dlp-reaction: no-action 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]] framework/etgen.py: add in a function for ixia to send fixed number of packets 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: Mon, 11 Sep 2017 01:21:27 -0000 Fei, some comments below. Thanks, Marvin > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of wang fei > Sent: Friday, September 08, 2017 8:07 PM > To: dts@dpdk.org > Cc: Wang, FeiX Y > Subject: [dts] [[patch v1]] framework/etgen.py: add in a function for ixi= a > to send fixed number of packets >=20 > Signed-off-by: wang fei > --- > framework/etgen.py | 33 ++++++++++++++++++++++++++++++++- > 1 file changed, 32 insertions(+), 1 deletion(-) >=20 > diff --git a/framework/etgen.py b/framework/etgen.py > index f45a96e..7ee24ac 100644 > --- a/framework/etgen.py > +++ b/framework/etgen.py > @@ -141,7 +141,6 @@ class IxiaPacketGenerator(SSHConnection): > self.logger =3D getLogger(self.NAME) > super(IxiaPacketGenerator, self).__init__(self.get_ip_address(), > self.NAME, > - self.get_username(), > self.get_password()) > super(IxiaPacketGenerator, self).init_log(self.logger) >=20 > @@ -869,3 +868,35 @@ class IxiaPacketGenerator(SSHConnection): > retrieved capture buffer. Call packetGroupStats get before. > """ > return self._packetgroup_cget_value('averageLatency') > + > + def > send_packets(self,portList,ratePercent,packetNum,delay=3D5,runTime=3D60): Please add space after each parameter for PEP alignment. > + """ > + configure ixia to send fixed number of packets for each tx port > + and returns the throughput for rx ports > + """ > + rxPortlist, txPortlist =3D self._configure_everything(portList, > ratePercent) > + time.sleep(delay) > + self.send_expect("ixStopTransmit portList","%",5) > + > + self.send_expect("stream config -numFrames %s" % packetNum,"%",5= ) > + self.send_expect("stream config -dma stopStream","%",5) Look like it will not work for multiple streams, is this function support t= hat? If not, please add check or rename the function. > + for txPort in txPortlist: > + port =3D self.pci_to_port(self.tester.get_pci(txPort)) > + self.send_expect("stream set %d %d %d 1" % (self.chasId, > port['card'], port['port']),"%",5) > + > + self.send_expect("ixWritePortsToHardware portList","%",5) > + self.send_expect("ixClearStats portList","%",5) > + self.send_expect("ixStartTransmit portList","%",5) > + time.sleep(runTime) > + time.sleep(3) Sleep 60 seconds cannot assure that all packets transmitted. And most of ca= ses will waste time for waiting. You can add one while loop here and break the loop when transmitted packets= equal to "packetNum".=20 > + > + txPackets =3D 0 > + rxPackets =3D 0 > + for port in txPortlist: > + self.stat_get_stat_all_stats(port) > + txPackets +=3D self.get_frames_sent() > + rxPackets +=3D self.get_frames_received() > + self.logger.info("Transmitted packets :%s" % txPackets) > + self.logger.info("Received packets :%s" % rxPackets) > + > + return txPackets,rxPackets > -- > 2.7.4