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 A178AA0613 for ; Mon, 23 Sep 2019 08:57:47 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 901971B994; Mon, 23 Sep 2019 08:57:47 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id AEA914C90 for ; Mon, 23 Sep 2019 08:57:45 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Sep 2019 23:57:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,539,1559545200"; d="scan'208";a="188058132" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga008.fm.intel.com with ESMTP; 22 Sep 2019 23:57:44 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 22 Sep 2019 23:57:44 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.113]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.92]) with mapi id 14.03.0439.000; Mon, 23 Sep 2019 14:57:42 +0800 From: "Mo, YufengX" To: "dts@dpdk.org" , "Li, WenjieX A" , "Chen, Zhaoyan" , "Tu, Lijuan" Thread-Topic: [dts][PATCH V2 6/7] framework/pktgen_trex: fix internal bug Thread-Index: AQHVcdsGacmACRBq+USvIFnWKmzpkac41Krg Date: Mon, 23 Sep 2019 06:57:42 +0000 Message-ID: References: <20190923065040.8251-1-yufengx.mo@intel.com> <20190923065040.8251-7-yufengx.mo@intel.com> In-Reply-To: <20190923065040.8251-7-yufengx.mo@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 V2 6/7] framework/pktgen_trex: fix internal bug 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 Mo, YufengX > -----Original Message----- > From: Mo, YufengX > Sent: Monday, September 23, 2019 2:51 PM > To: dts@dpdk.org; Li, WenjieX A ; Chen, Zhaoyan <= zhaoyan.chen@intel.com>; Tu, Lijuan > Cc: Mo, YufengX > Subject: [dts][PATCH V2 6/7] framework/pktgen_trex: fix internal bug >=20 >=20 > *. use tester alt session to close trex. > *. set part of information logger display to debug level. > *. remove logger format setting after import libs to eliminate dts redund= ant logs. >=20 > Signed-off-by: yufengmx > --- > framework/pktgen_trex.py | 38 ++++++++++++++++---------------------- > 1 file changed, 16 insertions(+), 22 deletions(-) >=20 > diff --git a/framework/pktgen_trex.py b/framework/pktgen_trex.py > index c6c904b..690d070 100644 > --- a/framework/pktgen_trex.py > +++ b/framework/pktgen_trex.py > @@ -35,14 +35,9 @@ import time > import logging > from pprint import pformat >=20 > -from pktgen_base import (PacketGenerator, PKTGEN_TREX, > +from pktgen_base import (PacketGenerator, PKTGEN_TREX, PKTGEN, > TRANSMIT_CONT, TRANSMIT_M_BURST, TRANSMIT_S_BUR= ST) >=20 > -FORMAT =3D '%(message)s' > -logging.basicConfig(format=3DFORMAT) > -logger =3D logging.getLogger(os.path.basename(__file__)[:-3].upper()) > -logger.setLevel(logging.INFO) > - >=20 > class TrexConfigVm(object): > ''' > @@ -492,7 +487,7 @@ class TrexPacketGenerator(PacketGenerator): > ''' > for name, _port_obj in self._conn.ports.iteritems(): > _pci =3D _port_obj.info['pci_addr'] > - self.logger.info((_pci, pci)) > + self.logger.debug((_pci, pci)) > if _pci =3D=3D pci: > return True > else: > @@ -585,9 +580,7 @@ class TrexPacketGenerator(PacketGenerator): > app_param_temp =3D app_param_temp + " --cfg " + self= .conf[key] > elif key =3D=3D 'core_num': > app_param_temp =3D app_param_temp + " -c " + self.co= nf[key] > - self.control_session =3D \ > - self.tester.create_session('trex_control_session= ') > - > + self.control_session =3D self.tester.create_session(PKTGEN) > self.control_session.send_expect( > ';'.join(['cd ' + self.conf['trex_root_path'], > './' + self.trex_app + " " + app_param_temp]), > @@ -628,7 +621,7 @@ class TrexPacketGenerator(PacketGenerator): > if port_id not in ports: > return None > features =3D self._conn.ports[port_id].get_formatted_info() > - self.logger.info(pformat(features)) > + self.logger.debug(pformat(features)) >=20 > return features >=20 > @@ -637,7 +630,7 @@ class TrexPacketGenerator(PacketGenerator): > features =3D self._get_port_features(port_id) > if not features or features.get('fc_supported') =3D=3D 'no': > msg =3D "trex port <{0}> not support flow control".format(po= rt_id) > - self.logger.warning(msg) > + self.logger.debug(msg) > return False > else: > return True > @@ -669,8 +662,8 @@ class TrexPacketGenerator(PacketGenerator): > "Tx Port %d stats: " % (tx_port_id), > "tx_port: %d, tx_bps: %f, tx_pps: %f " % ( > tx_port_id, tx_bps, tx_pps)] > - self.logger.info(pformat(port_stats)) > - self.logger.info(os.linesep.join(msg)) > + self.logger.debug(pformat(port_stats)) > + self.logger.debug(os.linesep.join(msg)) > # rx bps/pps > rx_port_id =3D stream["rx_port"] > port_stats =3D self.runtime_stats.get(rx_port_id) > @@ -684,8 +677,8 @@ class TrexPacketGenerator(PacketGenerator): > "rx_port: %d, rx_bps: %f, rx_pps: %f" % ( > rx_port_id, rx_bps, rx_pps)] >=20 > - self.logger.info(pformat(port_stats)) > - self.logger.info(os.linesep.join(msg)) > + self.logger.debug(pformat(port_stats)) > + self.logger.debug(os.linesep.join(msg)) >=20 > return rx_bps, rx_pps >=20 > @@ -699,13 +692,13 @@ class TrexPacketGenerator(PacketGenerator): > self.logger.error(msg) > return None > msg =3D "Tx Port %d stats: " % (port_id) > - self.logger.info(msg) > + self.logger.debug(msg) > opackets =3D port_stats["opackets"] > # rx packet > port_id =3D stream.get("rx_port") > port_stats =3D stats[port_id] > msg =3D "Rx Port %d stats: " % (port_id) > - self.logger.info(msg) > + self.logger.debug(msg) > ipackets =3D port_stats["ipackets"] >=20 > return opackets, ipackets > @@ -813,13 +806,14 @@ class TrexPacketGenerator(PacketGenerator): > 'core_mask':core_mask, > 'force': True,} > self.logger.info("begin traffic ......") > + self.logger.debug(run_opt) > self._conn.start(**run_opt) > ########################################### > if sample_delay: > time.sleep(sample_delay) # wait > # get ports runtime statistics > self.runtime_stats =3D self._conn.get_stats() > - self.logger.info(pformat(self.runtime_stats)) > + self.logger.debug(pformat(self.runtime_stats)) > ########################################### > # Block until traffic on specified port(s) has ended > wait_opt =3D {'ports': self._traffic_ports} > @@ -840,8 +834,8 @@ class TrexPacketGenerator(PacketGenerator): > ''' > stats =3D self._conn.get_stats() > stream =3D self._get_stream(stream_id) > - self.logger.info(pformat(stream)) > - self.logger.info(pformat(stats)) > + self.logger.debug(pformat(stream)) > + self.logger.debug(pformat(stats)) > if mode =3D=3D 'throughput': > return self._throughput_stats(stream, stats) > elif mode =3D=3D 'loss': > @@ -855,7 +849,7 @@ class TrexPacketGenerator(PacketGenerator): > if self._conn is not None: > self._disconnect() > if self.control_session is not None: > - self.tester.send_expect('pkill -f _t-rex-64', '# ') > + self.tester.alt_session.send_expect('pkill -f _t-rex-64', '#= ') > time.sleep(5) > self.tester.destroy_session(self.control_session) > self.control_session =3D None > -- > 2.21.0