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 3B9B0A055E; Wed, 26 Feb 2020 10:15:12 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0AE561BFCE; Wed, 26 Feb 2020 10:15:12 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id B143E1BF8D for ; Wed, 26 Feb 2020 10:15:09 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Feb 2020 01:15:08 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,487,1574150400"; d="scan'208";a="436561444" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga005.fm.intel.com with ESMTP; 26 Feb 2020 01:15:08 -0800 Received: from fmsmsx111.amr.corp.intel.com (10.18.116.5) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 26 Feb 2020 01:14:05 -0800 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx111.amr.corp.intel.com (10.18.116.5) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 26 Feb 2020 01:14:04 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.222]) by shsmsx102.ccr.corp.intel.com ([169.254.2.126]) with mapi id 14.03.0439.000; Wed, 26 Feb 2020 17:14:02 +0800 From: "Tu, Lijuan" To: "Ma, LihongX" , "dts@dpdk.org" CC: "Ma, LihongX" Thread-Topic: [dts] [PATCH V1] framework/crb: fix the issue of kill trex Thread-Index: AQHV7G77kG4R/kLtvUqAh8SEMIbL6qgtMUKQ Date: Wed, 26 Feb 2020 09:14:01 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BBCE8D1@SHSMSX101.ccr.corp.intel.com> References: <1582671998-31664-1-git-send-email-lihongx.ma@intel.com> In-Reply-To: <1582671998-31664-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-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/crb: fix the issue of kill trex 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, February 26, 2020 7:07 AM > To: dts@dpdk.org > Cc: Ma, LihongX > Subject: [dts] [PATCH V1] framework/crb: fix the issue of kill trex >=20 > when tester and dut on same server, and the pktgen is trex, skip to kill = trex > when dut call the kill_all. >=20 > Signed-off-by: lihong > --- > framework/crb.py | 27 ++++++++++++++++++++++++++- > 1 file changed, 26 insertions(+), 1 deletion(-) >=20 > diff --git a/framework/crb.py b/framework/crb.py index 2d81550..2ac197e > 100644 > --- a/framework/crb.py > +++ b/framework/crb.py > @@ -35,7 +35,7 @@ import os > from settings import TIMEOUT, IXIA > from ssh_connection import SSHConnection from logger import getLogger - > from config import PortConf, PORTCONF > +from config import PortConf, PORTCONF, PktgenConf >=20 > """ > CRB (customer reference board) basic functions and handlers @@ -60,6 > +60,7 @@ class Crb(object): > self.sessions =3D [] > self.stage =3D 'pre-init' > self.name =3D name > + self.trex_prefix =3D None >=20 > self.logger =3D getLogger(name) > self.session =3D SSHConnection(self.get_ip_address(), name, @@ -= 466,10 > +467,34 @@ class Crb(object): > f.write(contents) > self.session.copy_file_to(fileName, password=3Dself.get_password= ()) >=20 > + def check_trex_process_existed(self): > + """ > + if the tester and dut on same server > + and pktgen is trex, do not kill the process > + """ > + if self.crb['pktgen'].lower() =3D=3D 'trex': > + if self.crb['IP'] =3D=3D self.crb['tester IP'] and self.trex= _prefix is None: > + conf_inst =3D PktgenConf('trex') > + conf_info =3D conf_inst.load_pktgen_config() > + if 'config_file' in conf_info: > + config_file =3D conf_info['config_file'] > + else: > + config_file =3D '/etc/trex_cfg.yaml' > + fd =3D open(config_file, 'r') > + output =3D fd.read() > + fd.close() > + prefix =3D re.search("prefix\s*:\s*(\S*)", output) > + if prefix is not None: > + self.trex_prefix =3D prefix.group(1) > + return self.trex_prefix > + > def get_dpdk_pids(self, prefix_list, alt_session): > """ > get all dpdk applications on CRB. > """ > + trex_prefix =3D self.check_trex_process_existed() > + if trex_prefix is not None and trex_prefix in prefix_list: > + prefix_list.remove(trex_prefix) > file_directorys =3D ['/var/run/dpdk/%s/config' % file_prefix for= file_prefix > in prefix_list] > pids =3D [] > pid_reg =3D r'p(\d+)' > -- > 2.7.4