From: zhaomeijuan <meijuanx.zhao@intel.com>
To: dts@dpdk.org
Cc: zhaomeijuan <meijuanx.zhao@intel.com>
Subject: [dts] [next][PATCH V1 7/7] tests/l2fwd
Date: Sun, 28 Apr 2019 10:47:18 +0000 [thread overview]
Message-ID: <20190428104718.9143-7-meijuanx.zhao@intel.com> (raw)
In-Reply-To: <20190428104718.9143-1-meijuanx.zhao@intel.com>
*.remove old or unused module and code
which replace it with pktgen API
Signed-off-by: zhaomeijuan <meijuanx.zhao@intel.com>
---
tests/TestSuite_l2fwd.py | 42 +++++++++++++++++++++++++++++-----------
1 file changed, 31 insertions(+), 11 deletions(-)
diff --git a/tests/TestSuite_l2fwd.py b/tests/TestSuite_l2fwd.py
index 659d5f7..7d31452 100644
--- a/tests/TestSuite_l2fwd.py
+++ b/tests/TestSuite_l2fwd.py
@@ -1,6 +1,6 @@
# BSD LICENSE
#
-# Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+# Copyright(c) 2010-2019 Intel Corporation. All rights reserved.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -28,16 +28,16 @@
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
"""
DPDK Test suite.
Test Layer-2 Forwarding support
"""
-
+import os
+import time
import utils
from test_case import TestCase
from settings import HEADER_SIZE
-
+from pktgen import PacketGeneratorHelper
class TestL2fwd(TestCase):
@@ -78,6 +78,16 @@ class TestL2fwd(TestCase):
self.table_header.append("% linerate")
self.result_table_create(self.table_header)
+
+ # get dts output path
+ if self.logger.log_path.startswith(os.sep):
+ self.output_path = self.logger.log_path
+ else:
+ cur_path = os.path.dirname(
+ os.path.dirname(os.path.realpath(__file__)))
+ self.output_path = os.sep.join([cur_path, self.logger.log_path])
+ # create an instance to set stream field setting
+ self.pktgen_helper = PacketGeneratorHelper()
def set_up(self):
"""
@@ -163,16 +173,18 @@ class TestL2fwd(TestCase):
payload_size = frame_size - self.headers_size
tgen_input = []
+ cnt = 1
for port in xrange(self.number_of_ports):
rx_port = self.tester.get_local_port(self.dut_ports[port % self.number_of_ports])
tx_port = self.tester.get_local_port(self.dut_ports[(port + 1) % self.number_of_ports])
destination_mac = self.dut.get_mac_address(self.dut_ports[(port + 1) % self.number_of_ports])
- self.tester.scapy_append('wrpcap("l2fwd_%d.pcap", [Ether(dst="%s")/IP()/UDP()/("X"*%d)])' % (
- port, destination_mac, payload_size))
-
- tgen_input.append((tx_port, rx_port, "l2fwd_%d.pcap" % port))
-
- self.tester.scapy_execute()
+ pcap = os.sep.join([self.output_path, "l2fwd_{0}_{1}.pcap".format(port, cnt)])
+ self.tester.scapy_append('wrpcap("%s", [Ether(dst="%s")/IP()/UDP()/("X"*%d)])' % (
+ pcap, destination_mac, payload_size))
+ tgen_input.append((tx_port, rx_port, pcap))
+ time.sleep(3)
+ self.tester.scapy_execute()
+ cnt += 1
for queues in self.test_queues:
@@ -189,7 +201,15 @@ class TestL2fwd(TestCase):
self.logger.info(info)
self.rst_report(info, annex=True)
self.rst_report(command_line + "\n\n", frame=True, annex=True)
- _, pps = self.tester.traffic_generator_throughput(tgen_input)
+
+ # clear streams before add new streams
+ self.tester.pktgen.clear_streams()
+ # run packet generator
+ streams = self.pktgen_helper.prepare_stream_from_tginput(tgen_input, 100,
+ None, self.tester.pktgen)
+ _, pps = self.tester.pktgen.measure_throughput(stream_ids=streams)
+
+
Mpps = pps / 1000000.0
queues['Mpps'][frame_size] = Mpps
queues['pct'][frame_size] = Mpps * 100 / float(self.wirespeed(
--
2.17.1
prev parent reply other threads:[~2019-04-28 2:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-28 10:47 [dts] [next][PATCH V1 1/7] tests/checksum_offload zhaomeijuan
2019-04-28 10:47 ` [dts] [next][PATCH V1 2/7] tests/distributor zhaomeijuan
2019-04-28 10:47 ` [dts] [next][PATCH V1 3/7] tests/efd zhaomeijuan
2019-04-28 10:47 ` [dts] [next][PATCH V1 4/7] tests/fm10k_perf zhaomeijuan
2019-04-28 10:47 ` [dts] [next][PATCH V1 5/7] tests/ipfrag zhaomeijuan
2019-04-28 10:47 ` [dts] [next][PATCH V1 6/7] tests/kni zhaomeijuan
2019-04-28 10:47 ` zhaomeijuan [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190428104718.9143-7-meijuanx.zhao@intel.com \
--to=meijuanx.zhao@intel.com \
--cc=dts@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).