From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50072.outbound.protection.outlook.com [40.107.5.72]) by dpdk.org (Postfix) with ESMTP id 5334120F for ; Thu, 29 Mar 2018 04:35:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=5dmwErXyb++xARkGCNq1/L+5/eEuNDnKlEsyQQStOZk=; b=n2Ja5hx0Uzqcyus6dXy3dy21vFjCMfbgVuNip/F4Ako946VvEtwE/1ByuByUu72G1Qh3ogeZ4wsA8vdgoIghs0+dEbi38s9B3oENZAoaanKgb+2Fwx5kmuYgRB6fjX2incXtXvHrOB30pW2rWcvBHWxkCRC7082weIeEL9ntKwY= Received: from AM4PR08MB0913.eurprd08.prod.outlook.com (10.166.133.135) by AM4PR08MB1060.eurprd08.prod.outlook.com (10.166.134.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.631.10; Thu, 29 Mar 2018 02:35:04 +0000 Received: from AM4PR08MB0913.eurprd08.prod.outlook.com ([fe80::3418:15f6:2cf7:e5ef]) by AM4PR08MB0913.eurprd08.prod.outlook.com ([fe80::3418:15f6:2cf7:e5ef%3]) with mapi id 15.20.0609.012; Thu, 29 Mar 2018 02:35:04 +0000 From: Phil Yang To: "Liu, Yong" , "dts@dpdk.org" CC: nd , Herbert Guan Thread-Topic: [PATCH 01/17] framwork/packet: Add sniff_packet specify running Thread-Index: AQHTwn2UYevtu5s2FkaYy5PMVJXdIaPk94KAgAAJrACAAYXmAIAAAEPQ Date: Thu, 29 Mar 2018 02:35:03 +0000 Message-ID: References: <1521792246-4950-1-git-send-email-phil.yang@arm.com> <86228AFD5BCD8E4EBFD2B90117B5E81E62FCC680@SHSMSX103.ccr.corp.intel.com> <86228AFD5BCD8E4EBFD2B90117B5E81E62FCD573@SHSMSX103.ccr.corp.intel.com> In-Reply-To: <86228AFD5BCD8E4EBFD2B90117B5E81E62FCD573@SHSMSX103.ccr.corp.intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Phil.Yang@arm.com; x-originating-ip: [113.29.88.7] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM4PR08MB1060; 7:2kjWRnWvaRp5JK/rfcskAt7/k0v9AqA72u1Tza6YZqY9+2tWwxlmH5f36O/Zer1P4tYdEEwnxUpbxkCzABeX8XhQeSwOJAzuIPTU2tdFrvhihK5eMECc90/0LlGLCTf/yHBZ/VQujPe1leuJdVEdjCN/1gEOfbVeRFFoK/HDiw0VKtns/dk06ath11QTKcl92rshgaFs8HwYyFvw6K+FbcJT9KqTXYHEoMrOm6gKjTc7ItDY1dq32X1/sOpyjEoz x-ms-exchange-antispam-srfa-diagnostics: SOS;SOR; x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: f50db60d-d8fc-489f-3e88-08d5951dad7f x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:AM4PR08MB1060; x-ms-traffictypediagnostic: AM4PR08MB1060: nodisclaimer: True x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(180628864354917)(21532816269658)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231221)(944501327)(52105095)(10201501046)(3002001)(6055026)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(6072148)(201708071742011); SRVR:AM4PR08MB1060; BCL:0; PCL:0; RULEID:; SRVR:AM4PR08MB1060; x-forefront-prvs: 0626C21B10 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(366004)(376002)(39380400002)(346002)(396003)(13464003)(199004)(189003)(5660300001)(53546011)(7736002)(478600001)(55236004)(81166006)(25786009)(5250100002)(4326008)(6246003)(561944003)(59450400001)(7696005)(102836004)(99286004)(2900100001)(2501003)(76176011)(106356001)(551544002)(33656002)(81156014)(26005)(229853002)(186003)(68736007)(3846002)(97736004)(66066001)(6116002)(6506007)(3660700001)(8676002)(3280700002)(2906002)(476003)(14454004)(93886005)(110136005)(316002)(486005)(54906003)(486005)(55016002)(8936002)(53936002)(6436002)(446003)(74316002)(72206003)(11346002)(105586002)(86362001)(9686003)(305945005); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR08MB1060; H:AM4PR08MB0913.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: nXqc5UaNA/fDVJWwwnCxxWH2+QspPbcygLevIJeB9Mft2Vc15JO1Cl/LaarknoXLtLnV07r1fRdh26TSLf49G8gdjTc9YVhfnx7jBaATTH2MK8F1ZMdsq5x1h7+ls1XWvKFR9Lkgn8s608IUbToOvW9I663ZVzA+RutKbbl575wAFIZsmiUPgegd+Nh6h8jeCqy6f9/fSABNt4W7MCazULv0EiHsxGJT2SF1MGr4CsFw1Tvdzz3u3aA92ALvoKyTAWe2XBkP9dYnrEq6BJxWjrZUm83D1P3BItC21HwPgKal0xQXVQ/t92UebrhKxatPgNFOuu8hyr98H2T/7Hdn1Q== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: f50db60d-d8fc-489f-3e88-08d5951dad7f X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Mar 2018 02:35:03.9087 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR08MB1060 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:35:06 -0000 Ok, Thanks. Thanks, Phil Yang > -----Original Message----- > From: Liu, Yong > Sent: Thursday, March 29, 2018 10:31 AM > To: Phil Yang ; dts@dpdk.org > Cc: nd ; Herbert Guan > Subject: RE: [PATCH 01/17] framwork/packet: Add sniff_packet specify runn= ing >=20 > Phil, > Please go on, I think this change won't affect most of suites. > Please also keep packet module still workable with directly call. Some of= our > internal tools are using it for sniffing packets. >=20 > Regards, > Marvin >=20 > > -----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 > > > > Hi Marvin, > > > > > -----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. > > > > > > 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. > > > > 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. > > > > > > > > > > Just for this patch. In load function, DTS machine should transmit > > tester's pcap > > > file first and then analyze packets. > > > > You are correct. Thanks to point out. > > > > If my proposal is acceptable, I will resend the version 2 to add the > > transmit process. > > > > Thanks. > > > > > > > > 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[], targ= et=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.STD= OUT, > > > > - 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.communica= te())) > > > > + 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