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 AAC2DA046B for ; Fri, 23 Aug 2019 11:04:17 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 69A5B1BF98; Fri, 23 Aug 2019 11:04:17 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 932C81BF91 for ; Fri, 23 Aug 2019 11:04:15 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Aug 2019 02:04:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,420,1559545200"; d="scan'208";a="186819833" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by FMSMGA003.fm.intel.com with ESMTP; 23 Aug 2019 02:04:14 -0700 Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 23 Aug 2019 02:04:13 -0700 Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Fri, 23 Aug 2019 02:04:13 -0700 Received: from shsmsx107.ccr.corp.intel.com (10.239.4.96) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Fri, 23 Aug 2019 02:04:13 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.19]) by SHSMSX107.ccr.corp.intel.com ([169.254.9.65]) with mapi id 14.03.0439.000; Fri, 23 Aug 2019 17:04:11 +0800 From: "Zhu, WenhuiX" To: "Zhang, YanX A" , "dts@dpdk.org" CC: "Zhang, YanX A" Thread-Topic: [dts] [PATCH V1] tests/TestSuite_metering_and_policing:Modify scripts to run less time Thread-Index: AQHVWZGMohsj3Pk1l0eN8ZohCTwULKcIcA7A Date: Fri, 23 Aug 2019 09:04:10 +0000 Message-ID: References: <1566551217-44175-1-git-send-email-yanx.a.zhang@intel.com> In-Reply-To: <1566551217-44175-1-git-send-email-yanx.a.zhang@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: 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] tests/TestSuite_metering_and_policing:Modify scripts to run less time 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: Zhu, WenhuiX -----Original Message----- From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of zhang,yan Sent: Friday, August 23, 2019 5:07 PM To: dts@dpdk.org Cc: Zhang, YanX A Subject: [dts] [PATCH V1] tests/TestSuite_metering_and_policing:Modify scri= pts to run less time Optimize scapy open and close mode. Signed-off-by: zhang,yan --- tests/TestSuite_metering_and_policing.py | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/tests/TestSuite_metering_and_policing.py b/tests/TestSuite_met= ering_and_policing.py index c4c83d6..77da805 100644 --- a/tests/TestSuite_metering_and_policing.py +++ b/tests/TestSuite_metering_and_policing.py @@ -45,6 +45,22 @@ from dut import Dut =20 =20 class TestMeteringAndPolicing(TestCase): + scapyCmds =3D [] + + def start_scapy(self): + self.tester.scapy_foreground() + self.tester.send_expect('scapy', '>>> ', 10) + self.scapy_status =3D True + + def end_scapy(self): + self.tester.send_expect("exit()", "#") + self.scapy_status =3D False + + def scapy_execute(self, timeout=3D60): + for cmd in self.scapyCmds: + self.tester.send_expect(cmd, ">>> ", timeout) + + self.scapyCmds =3D [] =20 def copy_config_files_to_dut(self): """ @@ -219,10 +235,10 @@ class TestMeteringAndPolicing(TestCase): if protocol =3D=3D "UDP": proto_str =3D "nh=3D17" =20 - self.tester.scapy_append( + self.scapyCmds.append( 'sendp([Ether(dst=3D"%s")/%s(src=3D"%s",dst=3D"%s",%s)/%s(spor= t=3D%d,dport=3D%d)/Raw(load=3D"P"*%d)], iface=3D"%s")' % (self.dut_p0_mac, tag, src_ip, dst_ip, proto_str, protocol, = fwd_port, fwd_port, pktsize, source_port)) - self.tester.scapy_execute() + self.scapy_execute() =20 def send_packet_and_check(self, ip_ver, protocol, fwd_port, pktsize, e= xpect_port): """ @@ -296,6 +312,7 @@ class TestMeteringAndPolicing(TestCase): self.dut_p0_mac =3D self.dut.get_mac_address(self.dut_ports[0]) self.port_id =3D len(self.dut_ports) self.copy_config_files_to_dut() + self.start_scapy() =20 def set_up(self): """ @@ -653,4 +670,5 @@ class TestMeteringAndPolicing(TestCase): """ Run after each test suite. """ - pass + if self.scapy_status: + self.end_scapy() --=20 2.17.2