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 02015A055E; Wed, 26 Feb 2020 07:36:26 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E6F1B1BF8D; Wed, 26 Feb 2020 07:36:26 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 8B4C8B62 for ; Wed, 26 Feb 2020 07:36:24 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Feb 2020 22:36:23 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,487,1574150400"; d="scan'208";a="241568078" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga006.jf.intel.com with ESMTP; 25 Feb 2020 22:36:23 -0800 Received: from shsmsx602.ccr.corp.intel.com (10.109.6.142) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 25 Feb 2020 22:36:22 -0800 Received: from shsmsx603.ccr.corp.intel.com (10.109.6.143) by SHSMSX602.ccr.corp.intel.com (10.109.6.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 26 Feb 2020 14:36:20 +0800 Received: from shsmsx603.ccr.corp.intel.com ([10.109.6.143]) by SHSMSX603.ccr.corp.intel.com ([10.109.6.143]) with mapi id 15.01.1713.004; Wed, 26 Feb 2020 14:36:20 +0800 From: "Ma, LihongX" To: "dts@dpdk.org" Thread-Topic: [dts][PATCH V1] framework/crb: fix the issue of kill trex Thread-Index: AQHV7G724FgkMkxDIku553veMtw1nagtBSng Date: Wed, 26 Feb 2020 06:36:20 +0000 Message-ID: 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: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.36] 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" Tested-by:ma,lihong Regards, Ma,lihong -----Original Message----- From: Ma, LihongX=20 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 when tester and dut on same server, and the pktgen is trex, skip to kill tr= ex when dut call the kill_all. Signed-off-by: lihong --- framework/crb.py | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/framework/crb.py b/framework/crb.py index 2d81550..2ac197e 100= 644 --- 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 -fr= om 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, @@ -46= 6,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_p= refix 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 f= ile_prefix in prefix_list] pids =3D [] pid_reg =3D r'p(\d+)' -- 2.7.4