From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 0692C7CBD for ; Wed, 28 Mar 2018 04:41:24 +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 orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Mar 2018 19:41:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,369,1517904000"; d="scan'208";a="186590025" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga004.jf.intel.com with ESMTP; 27 Mar 2018 19:41:20 -0700 Received: from fmsmsx111.amr.corp.intel.com (10.18.116.5) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 27 Mar 2018 19:41:19 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx111.amr.corp.intel.com (10.18.116.5) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 27 Mar 2018 19:41:19 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.235]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.166]) with mapi id 14.03.0319.002; Wed, 28 Mar 2018 10:41:17 +0800 From: "Liu, Yong" To: Phil Yang , "dts@dpdk.org" CC: "nd@arm.com" , "herbert.guan@arm.com" Thread-Topic: [PATCH 01/17] framwork/packet: Add sniff_packet specify running Thread-Index: AQHTwn2f8h9IOE7iuUmjG+xb8dKSgKPk9LFA Date: Wed, 28 Mar 2018 02:41:17 +0000 Message-ID: <86228AFD5BCD8E4EBFD2B90117B5E81E62FCC680@SHSMSX103.ccr.corp.intel.com> References: <1521792246-4950-1-git-send-email-phil.yang@arm.com> In-Reply-To: <1521792246-4950-1-git-send-email-phil.yang@arm.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZWExOWUyNzUtMmVjMC00YmJkLTg2ZGMtOWIxNjIxN2ZkNzZmIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiJvR2xCS29jMHJoR0Zvc2t1ZHN6eGx4czA2djhzZ1VkaXNvREpLN0lnbTBBSEhhTjF2TTU0YTlGSXRPYVJLVlZ0In0= x-ctpclassification: CTP_NT 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 01/17] framwork/packet: Add sniff_packet specify running 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: Wed, 28 Mar 2018 02:41:29 -0000 Hi Phil, In previous design, DTS will be run on tester for simple design and stabili= ty.=20 In our site, I can't see the benefit of change the design. Could you please= explain why you change it? Anyway we can change the design, but I think it will need some kind of diag= nosis about the impact.=20 There may be some other staff depend on the assumption that DTS is on the t= ester machine. Just for this patch. In load function, DTS machine should transmit tester's= pcap file first and then analyze packets. Regards, Marvin=20 > -----Original Message----- > From: Phil Yang [mailto:phil.yang@arm.com] > Sent: Friday, March 23, 2018 4:04 PM > To: dts@dpdk.org > Cc: nd@arm.com; phil.yang@arm.com; Liu, Yong ; > herbert.guan@arm.com > Subject: [PATCH 01/17] framwork/packet: Add sniff_packet specify running >=20 > If tester in crb file was not the machine which running dts, > the sniff_packet process will not running on tester. >=20 > Create a ssh connection to the tester and run tcpdump to make sure > sniff_packet process running on the machine we expected. >=20 > Signed-off-by: Phil Yang > --- > framework/packet.py | 34 ++++++++++++++++++++++++++++------ > framework/tester.py | 34 ++++++++++++++++++++++++++++++++++ > 2 files changed, 62 insertions(+), 6 deletions(-) >=20 > diff --git a/framework/packet.py b/framework/packet.py > index 976b82b..484e511 100755 > --- a/framework/packet.py > +++ b/framework/packet.py > @@ -812,15 +812,30 @@ def get_filter_cmd(filters=3D[]): > return "" >=20 >=20 > -def sniff_packets(intf, count=3D0, timeout=3D5, filters=3D[]): > +def sniff_packets(intf, count=3D0, timeout=3D5, filters=3D[], target=3D[= ]): > """ > sniff all packets for certain port in certain seconds > """ > param =3D "" > direct_param =3D r"(\s+)\[ (\S+) in\|out\|inout \]" > - tcpdump_help =3D subprocess.check_output("tcpdump -h; echo 0", > - stderr=3Dsubprocess.STDOUT, > - shell=3DTrue) > + > + # target[] contain the remote machine info for ssh connection > + # target[0]: username > + # target[1]: ip address > + # target[2]: pass word > + if target: > + tcpdump_help_pipe =3D subprocess.Popen(["ssh", > + "%s@%s" % (target[0], target[1]), > + "tcpdump -h"], > + stderr=3Dsubprocess.PIPE, > + stdout=3Dsubprocess.PIPE, > + shell=3DFalse) > + tcpdump_help =3D "".join(tuple(tcpdump_help_pipe.communicate())) > + tcpdump_help_pipe.wait() > + else: > + tcpdump_help =3D subprocess.check_output("tcpdump -h; echo 0", > + stderr=3Dsubprocess.STDOUT, shell=3D= True) > + > for line in tcpdump_help.split('\n'): > m =3D re.match(direct_param, line) > if m: > @@ -850,9 +865,16 @@ def sniff_packets(intf, count=3D0, timeout=3D5, > filters=3D[]): > else: > cmd =3D sniff_cmd % options >=20 > - args =3D shlex.split(cmd) > + if target: > + pipe =3D subprocess.Popen(["ssh", > + "%s@%s" % (target[0], target[1]), > + cmd], > + stdin=3Dsubprocess.PIPE, > + shell=3DFalse) > + else: > + args =3D shlex.split(cmd) > + pipe =3D subprocess.Popen(args) >=20 > - pipe =3D subprocess.Popen(args) > index =3D str(time.time()) > SNIFF_PIDS[index] =3D (pipe, intf, timeout) > time.sleep(1) > diff --git a/framework/tester.py b/framework/tester.py > index a775f68..49749de 100755 > --- a/framework/tester.py > +++ b/framework/tester.py > @@ -704,6 +704,40 @@ class Tester(Crb): > self.proc.kill() > self.proc =3D None >=20 > + def tcpdump_sniff_packets(self, intf, count=3D0, timeout=3D5, filter= s=3D[]): > + """ > + Wrapper for packet module sniff_packets > + """ > + # load functions in packet module > + module =3D __import__("packet") > + sniff_f =3D getattr(module, "sniff_packets") > + > + target=3D[] > + target.append(self.get_username()) > + target.append(self.get_ip_address()) > + target.append(self.get_password()) > + return sniff_f(intf, count, timeout, filters, target) > + > + def load_tcpdump_sniff_pcap(self, index=3D''): > + """ > + Wrapper for packet module load_sniff_pcap > + """ > + # load functions in packet module > + module =3D __import__("packet") > + load_pcap_f =3D getattr(module, "load_sniff_pcap") > + > + return load_pcap_f(index) > + > + def load_tcpdump_sniff_packets(self, index=3D''): > + """ > + Wrapper for packet module load_sniff_packets > + """ > + # load functions in packet module > + module =3D __import__("packet") > + load_f =3D getattr(module, "load_sniff_packets") > + > + return load_f(index) > + > def kill_all(self, killall=3DFalse): > """ > Kill all scapy process or DPDK application on tester. > -- > 2.7.4