From: Haiyang Zhao <haiyangx.zhao@intel.com>
To: dts@dpdk.org
Cc: Haiyang Zhao <haiyangx.zhao@intel.com>
Subject: [dts] [next][PATCH V1 5/7] tests/pmd
Date: Sun, 28 Apr 2019 03:05:07 +0000 [thread overview]
Message-ID: <20190428030509.11490-5-haiyangx.zhao@intel.com> (raw)
In-Reply-To: <20190428030509.11490-1-haiyangx.zhao@intel.com>
1.replace etgen to pktgen API which support both trex and ixia.
2.delete old etgen override method ip.
3.add function set_fields.
Signed-off-by: Haiyang Zhao <haiyangx.zhao@intel.com>
---
tests/TestSuite_pmd.py | 86 +++++++++++++++++++++++++-----------------
1 file changed, 51 insertions(+), 35 deletions(-)
diff --git a/tests/TestSuite_pmd.py b/tests/TestSuite_pmd.py
index f5df8d5..99c4805 100644
--- a/tests/TestSuite_pmd.py
+++ b/tests/TestSuite_pmd.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
@@ -43,15 +43,14 @@ from test_case import TestCase
from time import sleep
from settings import HEADER_SIZE
from pmd_output import PmdOutput
-from etgen import IxiaPacketGenerator
from settings import FOLDERS
from system_info import SystemInfo
import perf_report
from datetime import datetime
+from pktgen import PacketGeneratorHelper
-
-class TestPmd(TestCase,IxiaPacketGenerator):
+class TestPmd(TestCase):
def set_up_all(self):
"""
@@ -104,6 +103,16 @@ class TestPmd(TestCase,IxiaPacketGenerator):
self.pmdout = PmdOutput(self.dut)
+ # 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):
"""
Run before each test case.
@@ -151,22 +160,21 @@ class TestPmd(TestCase,IxiaPacketGenerator):
PMD Performance Benchmarking with 4 ports.
"""
all_cores_mask = utils.create_mask(self.dut.get_core_list("all"))
-
# prepare traffic generator input
tgen_input = []
-
+ pcap = os.sep.join([self.output_path, "test.pcap"])
tgen_input.append((self.tester.get_local_port(self.dut_ports[0]),
self.tester.get_local_port(self.dut_ports[1]),
- "test.pcap"))
+ pcap))
tgen_input.append((self.tester.get_local_port(self.dut_ports[2]),
self.tester.get_local_port(self.dut_ports[3]),
- "test.pcap"))
+ pcap))
tgen_input.append((self.tester.get_local_port(self.dut_ports[1]),
self.tester.get_local_port(self.dut_ports[0]),
- "test.pcap"))
+ pcap))
tgen_input.append((self.tester.get_local_port(self.dut_ports[3]),
self.tester.get_local_port(self.dut_ports[2]),
- "test.pcap"))
+ pcap))
# run testpmd for each core config
for test_cycle in self.test_cycles:
@@ -184,7 +192,7 @@ class TestPmd(TestCase,IxiaPacketGenerator):
port_mask = utils.create_mask(self.dut.get_ports())
self.pmdout.start_testpmd(core_config, " --rxq=%d --txq=%d --portmask=%s --rss-ip --txrst=32 --txfreet=32 --txd=128 --tx-offloads=0" % (queues, queues, port_mask), socket=self.ports_socket)
- command_line = self.pmdout.get_pmd_cmd()
+ command_line = self.pmdout.get_pmd_cmd()
info = "Executing PMD using %s\n" % test_cycle['cores']
self.rst_report(info, annex=True)
@@ -200,12 +208,19 @@ class TestPmd(TestCase,IxiaPacketGenerator):
self.logger.info("Running with frame size %d " % frame_size)
payload_size = frame_size - self.headers_size
self.tester.scapy_append(
- 'wrpcap("test.pcap", [Ether(src="52:00:00:00:00:00")/IP(src="1.2.3.4",dst="1.1.1.1")/TCP()/("X"*%d)])' % payload_size)
+ 'wrpcap("%s", [Ether(src="52:00:00:00:00:00")/IP(src="1.2.3.4",dst="1.1.1.1")/TCP()/("X"*%d)])' % (pcap, payload_size))
self.tester.scapy_execute()
- # run traffic generator
- _, pps = self.tester.traffic_generator_throughput(tgen_input, rate_percent=100, delay=60)
-
+
+ vm_config = self.set_fields()
+ # 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,
+ vm_config, self.tester.pktgen)
+ traffic_opt = {'duration': 60, }
+ _, pps = self.tester.pktgen.measure_throughput(stream_ids=streams, options=traffic_opt)
+
pps /= 1000000.0
pct = pps * 100 / wirespeed
test_cycle['Mpps'][frame_size] = float('%.3f' % pps)
@@ -244,12 +259,13 @@ class TestPmd(TestCase,IxiaPacketGenerator):
# prepare traffic generator input
tgen_input = []
+ pcap = os.sep.join([self.output_path, "test.pcap"])
tgen_input.append((self.tester.get_local_port(self.dut_ports[0]),
self.tester.get_local_port(self.dut_ports[1]),
- "test.pcap"))
+ pcap))
tgen_input.append((self.tester.get_local_port(self.dut_ports[1]),
self.tester.get_local_port(self.dut_ports[0]),
- "test.pcap"))
+ pcap))
# run testpmd for each core config
for test_cycle in self.test_cycles:
@@ -284,11 +300,20 @@ class TestPmd(TestCase,IxiaPacketGenerator):
self.logger.info("Running with frame size %d " % frame_size)
payload_size = frame_size - self.headers_size
self.tester.scapy_append(
- 'wrpcap("test.pcap", [Ether(src="52:00:00:00:00:00")/IP(src="1.2.3.4",dst="1.1.1.1")/TCP()/("X"*%d)])' % payload_size)
+ 'wrpcap("%s", [Ether(src="52:00:00:00:00:00")/IP(src="1.2.3.4",dst="1.1.1.1")/TCP()/("X"*%d)])' % (pcap, payload_size))
self.tester.scapy_execute()
# run traffic generator
- _, pps = self.tester.traffic_generator_throughput(tgen_input, rate_percent=100, delay=60)
+
+ vm_config = self.set_fields()
+ # 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,
+ vm_config, self.tester.pktgen)
+ traffic_opt = {'duration': 60, }
+ _, pps = self.tester.pktgen.measure_throughput(stream_ids=streams, options=traffic_opt)
+
pps /= 1000000.0
pct = pps * 100 / wirespeed
@@ -436,22 +461,13 @@ class TestPmd(TestCase,IxiaPacketGenerator):
"packet pass assert error, expected %d TX bytes, actual %d" % (frame_size - 4, p0tx_bytes))
return out
-
- def ip(self, port, frag, src, proto, tos, dst, chksum, len, options, version, flags, ihl, ttl, id):
- self.add_tcl_cmd("protocol config -name ip")
- self.add_tcl_cmd('ip config -sourceIpAddr "%s"' % src)
- self.add_tcl_cmd("ip config -sourceIpAddrMode ipRandom")
- self.add_tcl_cmd('ip config -destIpAddr "%s"' % dst)
- self.add_tcl_cmd("ip config -destIpAddrMode ipIdle")
- self.add_tcl_cmd("ip config -ttl %d" % ttl)
- self.add_tcl_cmd("ip config -totalLength %d" % len)
- self.add_tcl_cmd("ip config -fragment %d" % frag)
- self.add_tcl_cmd("ip config -ipProtocol ipV4ProtocolReserved255")
- self.add_tcl_cmd("ip config -identifier %d" % id)
- self.add_tcl_cmd("stream config -framesize %d" % (len + 18))
- self.add_tcl_cmd("ip set %d %d %d" % (self.chasId, port['card'], port['port']))
-
-
+
+ def set_fields(self):
+ ''' set ip protocol field behavior '''
+ fields_config = {
+ 'ip': {'src': {'action': 'random'},},}
+ return fields_config
+
def tear_down(self):
"""
Run after each test case.
--
2.17.1
next prev parent reply other threads:[~2019-04-28 3:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-28 3:05 [dts] [next][PATCH V1 1/7] tests/l3fwd Haiyang Zhao
2019-04-28 3:05 ` [dts] [next][PATCH V1 2/7] tests/l3fwd_em Haiyang Zhao
2019-04-28 3:05 ` [dts] [next][PATCH V1 3/7] tests/link_flowctrl Haiyang Zhao
2019-04-28 3:05 ` [dts] [next][PATCH V1 4/7] tests/multiprocess Haiyang Zhao
2019-04-28 3:05 ` Haiyang Zhao [this message]
2019-04-28 3:05 ` [dts] [next][PATCH V1 6/7] tests/tso Haiyang Zhao
2019-04-28 3:05 ` [dts] [next][PATCH V1 7/7] tests/vmdq Haiyang Zhao
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=20190428030509.11490-5-haiyangx.zhao@intel.com \
--to=haiyangx.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).