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 43DA0A046B for ; Fri, 23 Aug 2019 11:02:28 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 18E3E1BF98; Fri, 23 Aug 2019 11:02:28 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id C88AB1BF91 for ; Fri, 23 Aug 2019 11:02:25 +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 fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Aug 2019 02:02:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,420,1559545200"; d="scan'208";a="263139512" Received: from unknown (HELO dpdk-wenjielx-dtspatch135.sh.intel.com) ([10.240.176.135]) by orsmga001.jf.intel.com with ESMTP; 23 Aug 2019 02:02:23 -0700 From: "zhang,yan" To: dts@dpdk.org Cc: "zhang,yan" Date: Fri, 23 Aug 2019 17:06:57 +0800 Message-Id: <1566551217-44175-1-git-send-email-yanx.a.zhang@intel.com> X-Mailer: git-send-email 1.9.3 Subject: [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" 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_metering_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 class TestMeteringAndPolicing(TestCase): + scapyCmds = [] + + def start_scapy(self): + self.tester.scapy_foreground() + self.tester.send_expect('scapy', '>>> ', 10) + self.scapy_status = True + + def end_scapy(self): + self.tester.send_expect("exit()", "#") + self.scapy_status = False + + def scapy_execute(self, timeout=60): + for cmd in self.scapyCmds: + self.tester.send_expect(cmd, ">>> ", timeout) + + self.scapyCmds = [] def copy_config_files_to_dut(self): """ @@ -219,10 +235,10 @@ class TestMeteringAndPolicing(TestCase): if protocol == "UDP": proto_str = "nh=17" - self.tester.scapy_append( + self.scapyCmds.append( 'sendp([Ether(dst="%s")/%s(src="%s",dst="%s",%s)/%s(sport=%d,dport=%d)/Raw(load="P"*%d)], iface="%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() def send_packet_and_check(self, ip_ver, protocol, fwd_port, pktsize, expect_port): """ @@ -296,6 +312,7 @@ class TestMeteringAndPolicing(TestCase): self.dut_p0_mac = self.dut.get_mac_address(self.dut_ports[0]) self.port_id = len(self.dut_ports) self.copy_config_files_to_dut() + self.start_scapy() def set_up(self): """ @@ -653,4 +670,5 @@ class TestMeteringAndPolicing(TestCase): """ Run after each test suite. """ - pass + if self.scapy_status: + self.end_scapy() -- 2.17.2