From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 2ECAB255 for ; Thu, 29 Mar 2018 04:31:28 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Mar 2018 19:31:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,374,1517904000"; d="scan'208";a="43089989" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga001.jf.intel.com with ESMTP; 28 Mar 2018 19:31:27 -0700 Received: from fmsmsx122.amr.corp.intel.com (10.18.125.37) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 28 Mar 2018 19:31:27 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx122.amr.corp.intel.com (10.18.125.37) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 28 Mar 2018 19:31:26 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.235]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.129]) with mapi id 14.03.0319.002; Thu, 29 Mar 2018 10:31:25 +0800 From: "Liu, Yong" To: Phil Yang , "dts@dpdk.org" CC: nd , Herbert Guan Thread-Topic: [PATCH 01/17] framwork/packet: Add sniff_packet specify running Thread-Index: AQHTwn2f8h9IOE7iuUmjG+xb8dKSgKPk9LFA//+9ugCAAdJMMA== Date: Thu, 29 Mar 2018 02:31:24 +0000 Message-ID: <86228AFD5BCD8E4EBFD2B90117B5E81E62FCD573@SHSMSX103.ccr.corp.intel.com> References: <1521792246-4950-1-git-send-email-phil.yang@arm.com> <86228AFD5BCD8E4EBFD2B90117B5E81E62FCC680@SHSMSX103.ccr.corp.intel.com> In-Reply-To: Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNTA4M2VkODgtOTc3NC00M2Y2LWJhZGYtYjJmMTNhZWNhMzRjIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiJlTzZPZmpVY3BFNXhUWm1JcDcrdkpNNmlhMXNPdUtGaE15QnJoVkVpY1NZTE1LMEVFRWw3ZVI3U0tLY2FBeStKIn0= 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: Thu, 29 Mar 2018 02:31:29 -0000 Phil, Please go on, I think this change won't affect most of suites. =20 Please also keep packet module still workable with directly call. Some of o= ur internal tools are using it for sniffing packets. Regards, Marvin > -----Original Message----- > From: Phil Yang [mailto:Phil.Yang@arm.com] > Sent: Wednesday, March 28, 2018 2:34 PM > To: Liu, Yong ; dts@dpdk.org > Cc: nd ; Herbert Guan > Subject: RE: [PATCH 01/17] framwork/packet: Add sniff_packet specify > running >=20 > Hi Marvin, >=20 > > -----Original Message----- > > From: Liu, Yong > > Sent: Wednesday, March 28, 2018 10:41 AM > > To: Phil Yang ; dts@dpdk.org > > Cc: nd ; Herbert Guan > > Subject: RE: [PATCH 01/17] framwork/packet: Add sniff_packet specify > running > > > > Hi Phil, > > In previous design, DTS will be run on tester for simple design and > stability. > > 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 > diagnosis > > about the impact. > > There may be some other staff depend on the assumption that DTS is on > the > > tester machine. >=20 >=20 > We are trying to use one machine as the controller to run DTS. The > controller communicate with testers which listed in the crbs.cfg by SSH > connection. > So the DTS will not running on tester. >=20 > Since testers are connected with DUTs port by port, so I think introduce > controller into the DTS is more flexible to manager machines. If other > staff depend on the assumption that DTS is no the tester machine, > sniff_packet process will also connect to the tester by SSH connection. > Just one more SSH connection. > However, we cannot make sure the DTS is always running on the tester. >=20 >=20 > > > > Just for this patch. In load function, DTS machine should transmit > tester's pcap > > file first and then analyze packets. >=20 > You are correct. Thanks to point out. >=20 > If my proposal is acceptable, I will resend the version 2 to add the > transmit process. >=20 > Thanks. >=20 > > > > Regards, > > Marvin > > > > > -----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 > > > > > > If tester in crb file was not the machine which running dts, the > > > sniff_packet process will not running on tester. > > > > > > Create a ssh connection to the tester and run tcpdump to make sure > > > sniff_packet process running on the machine we expected. > > > > > > Signed-off-by: Phil Yang > > > --- > > > framework/packet.py | 34 ++++++++++++++++++++++++++++------ > > > framework/tester.py | 34 ++++++++++++++++++++++++++++++++++ > > > 2 files changed, 62 insertions(+), 6 deletions(-) > > > > > > 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 "" > > > > > > > > > -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.STDOU= T, > > > - 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=3DTrue) > > > + > > > 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 > > > > > > - 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) > > > > > > - 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 > > > > > > + def tcpdump_sniff_packets(self, intf, count=3D0, timeout=3D5, > filters=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