test suite reviews and discussions
 help / color / mirror / Atom feed
From: Haiyang Zhao <haiyangx.zhao@intel.com>
To: dts@dpdk.org
Cc: Haiyang Zhao <haiyangx.zhao@intel.com>
Subject: [dts] [next][PATCH V2 4/7] tests/multiprocess:replace etgen with pktgen
Date: Mon,  3 Jun 2019 16:31:06 +0000	[thread overview]
Message-ID: <20190603163109.19706-4-haiyangx.zhao@intel.com> (raw)
In-Reply-To: <20190603163109.19706-1-haiyangx.zhao@intel.com>

*.replace etgen with pktgen API which support both trex and ixia. 
*.delete old etgen override method ip. 
*.add function set_fields. 
*.delete judgement of want_perf_tests.

Signed-off-by: Haiyang Zhao <haiyangx.zhao@intel.com>
---
 tests/TestSuite_multiprocess.py | 62 +++++++++++++++++++--------------
 1 file changed, 36 insertions(+), 26 deletions(-)

diff --git a/tests/TestSuite_multiprocess.py b/tests/TestSuite_multiprocess.py
index 1bac35c..a22266a 100644
--- a/tests/TestSuite_multiprocess.py
+++ b/tests/TestSuite_multiprocess.py
@@ -36,12 +36,13 @@ Multi-process Test.
 
 import utils
 import time
-from etgen import IxiaPacketGenerator
+import os
 executions = []
 from test_case import TestCase
+from pktgen import PacketGeneratorHelper
 
 
-class TestMultiprocess(TestCase, IxiaPacketGenerator):
+class TestMultiprocess(TestCase):
 
     def set_up_all(self):
         """
@@ -53,7 +54,7 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator):
             DUT core number >= 4
             multi_process build pass
         """
-        #self.verify('bsdapp' not in self.target, "Multiprocess not support freebsd")
+        # self.verify('bsdapp' not in self.target, "Multiprocess not support freebsd")
 
         self.verify(len(self.dut.get_all_cores()) >= 4, "Not enough Cores")
         self.tester.extend_external_packet_generator(TestMultiprocess, self)
@@ -69,8 +70,17 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator):
         executions.append({'nprocs': 8, 'cores': '1S/4C/2T', 'pps': 0})
         self.dut.alt_session.send_expect("cd dpdk","# ",5)
 
-       # start new session to run secondary
+        # start new session to run secondary
         self.session_secondary = self.dut.new_session()
+        # 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):
         """
@@ -201,11 +211,10 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator):
 
         self.tester.scapy_append('dmac="%s"' % self.dut.get_mac_address(dutPorts[0]))
         self.tester.scapy_append('smac="%s"' % mac)
-        if not self.dut.want_perf_tests:
-            self.tester.scapy_append('flows = [Ether(src=smac, dst=dmac)/IP(src="192.168.1.%s" % src, dst="192.168.1.%s" % dst)/("X"*26) for src in range(64) for dst in range(64)]')
-        else:
-            self.tester.scapy_append('flows = [Ether(src=smac, dst=dmac)/IP(src="192.168.1.1", dst="192.168.1.1")/("X"*26)]')
-        self.tester.scapy_append('wrpcap("test.pcap", flows)')
+        self.tester.scapy_append('flows = [Ether(src=smac, dst=dmac)/IP(src="192.168.1.1", dst="192.168.1.1")/("X"*26)]')
+
+        pcap = os.sep.join([self.output_path, "test.pcap"])
+        self.tester.scapy_append('wrpcap("%s", flows)' % pcap)
         self.tester.scapy_execute()
 
         validExecutions = []
@@ -230,8 +239,15 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator):
                 self.dut.send_expect("bg", "# ")
 
             tgenInput = []
-            tgenInput.append([txPort, rxPort, "test.pcap"])
-            _, pps = self.tester.traffic_generator_throughput(tgenInput)
+            tgenInput.append([txPort, rxPort, pcap])
+
+            # clear streams before add new streams
+            self.tester.pktgen.clear_streams()
+            # run packet generator
+            streams = self.pktgen_helper.prepare_stream_from_tginput(tgenInput, 100,
+                                                None, self.tester.pktgen)
+            _, pps = self.tester.pktgen.measure_throughput(stream_ids=streams)
+
             execution['pps'] = pps
             self.dut.kill_all()
             time.sleep(5)
@@ -246,21 +262,15 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator):
 
         self.result_table_print()
 
-    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 ipIncrHost')
-        self.add_tcl_cmd('ip config -sourceIpAddrRepeatCount %d' % 64)
-        self.add_tcl_cmd('ip config -destIpAddr "%s"' % dst)
-        self.add_tcl_cmd('ip config -destIpAddrMode ipIncrHost')
-        self.add_tcl_cmd('ip config -destIpAddrRepeatCount %d' % 64)
-        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 %d" % proto)
-        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': {'range': 64, 'action': 'inc'},
+            'dst': {'range': 64, 'action': 'inc'},
+        },}
+
+        return fields_config
 
     def tear_down(self):
         """
-- 
2.17.1


  parent reply	other threads:[~2019-06-03  8:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-03 16:31 [dts] [next][PATCH V2 1/7] tests/l3fwd: replace " Haiyang Zhao
2019-06-03 16:31 ` [dts] [next][PATCH V2 2/7] tests/l3fwd_em: replace etgen with pktgen and fix pep8 issue Haiyang Zhao
2019-06-03 16:31 ` [dts] [next][PATCH V2 3/7] tests/link_flowctrl: replace etgen with pktgen Haiyang Zhao
2019-06-03 16:31 ` Haiyang Zhao [this message]
2019-06-03 16:31 ` [dts] [next][PATCH V2 5/7] tests/pmd:replace " Haiyang Zhao
2019-06-03 16:31 ` [dts] [next][PATCH V2 6/7] tests/tso:replace etgen with pktgen and fix pep8 issue Haiyang Zhao
2019-06-03 16:31 ` [dts] [next][PATCH V2 7/7] tests/vmdq:replace etgen with pktgen Haiyang Zhao
2019-06-05  1:40 ` [dts] [next][PATCH V2 1/7] tests/l3fwd: replace " Tu, Lijuan

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=20190603163109.19706-4-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).