test suite reviews and discussions
 help / color / mirror / Atom feed
From: LihongX Ma <lihongx.ma@intel.com>
To: dts@dpdk.org
Cc: yuan.peng@intel.com, LihongX Ma <lihongx.ma@intel.com>
Subject: [dts] [PATCH V1] tests/softnic: optimization suite
Date: Wed, 14 Oct 2020 02:40:05 +0800	[thread overview]
Message-ID: <1602614405-20002-1-git-send-email-lihongx.ma@intel.com> (raw)

 - remove useless code
 - modify the fwd method according to plan
 - use different pcap to configure stream

Signed-off-by: LihongX Ma <lihongx.ma@intel.com>
---
 tests/TestSuite_softnic.py | 30 ++++++++----------------------
 1 file changed, 8 insertions(+), 22 deletions(-)

diff --git a/tests/TestSuite_softnic.py b/tests/TestSuite_softnic.py
index 119d7a8..d0fb419 100644
--- a/tests/TestSuite_softnic.py
+++ b/tests/TestSuite_softnic.py
@@ -87,11 +87,6 @@ class TestSoftnic(TestCase):
             self.output_path = os.sep.join([cur_path, self.logger.log_path])
         # create an instance to set stream field setting
         self.pktgen_helper = PacketGeneratorHelper()
-        self.dut.restore_interfaces()
-        self.used_dut_port = self.dut_ports[1]
-        self.host_intf = self.dut.ports_info[self.used_dut_port]['intf']
-        out = self.dut.send_expect('ethtool %s' % self.host_intf, '#')
-        self.speed = re.findall('Supported link modes:   (\d*)', out)[0]
         self.dut.bind_interfaces_linux(self.drivername, [ports[0]])
 
     def set_up(self):
@@ -109,7 +104,6 @@ class TestSoftnic(TestCase):
         expect_pps = [14, 8, 4, 2, 1, 0.9, 0.8]
 
         self.dut.send_expect(self.cmd % (self.path, self.eal_param, 'firmware.cli'), "testpmd>", timeout=800)
-        self.dut.send_expect("set fwd macswap", "testpmd>")
         self.dut.send_expect("start", "testpmd>")
         rx_port = self.tester.get_local_port(0)
         tx_port = self.tester.get_local_port(0)
@@ -135,7 +129,6 @@ class TestSoftnic(TestCase):
     def test_perf_shaping_for_pipe(self):
         self.change_config_file('tm_firmware.cli')
         self.dut.send_expect(self.cmd % (self.path, self.eal_param, 'tm_firmware.cli'), "testpmd> ", timeout=800)
-        self.dut.send_expect("set fwd macswap", "testpmd>")
         self.dut.send_expect("start", "testpmd>")
         rx_port = self.tester.get_local_port(0)
         pkts = ["Ether(dst='%s')/IP(dst='100.0.0.0')/UDP()/Raw(load='x'*(64 - %s))", "Ether(dst='%s')/IP(dst='100.0.15.255')/UDP()/Raw(load='x'*(64 - %s))", "Ether(dst='%s')/IP(dst='100.0.4.0')/UDP()/Raw(load='x'*(64 - %s))"]
@@ -146,16 +139,19 @@ class TestSoftnic(TestCase):
                 pcap = os.sep.join([self.output_path, "test.pcap"])
                 pkt = pkts[i] % (self.dmac, self.headers_size)
                 self.tester.scapy_append('wrpcap("%s", [%s])' % (pcap, pkt))
-                tgen_input.append((rx_port, rx_port, pcap))
+                self.tester.scapy_execute()
                 if i == 2:
-                    vm_config = self.set_fields_ip()
+                    for j in range(16):
+                        pk = "Ether(dst='%s')/IP(dst='100.0.15.%d')/UDP()/Raw(load='x'*(64 - %s))" % (self.dmac, j, self.headers_size)
+                        self.tester.scapy_append('wrpcap("%s/test_%d.pcap", [%s])' % (self.output_path, j, pk))
+                        self.tester.scapy_execute()
+                        tgen_input.append((rx_port, rx_port, "%s/test_%d.pcap" % (self.output_path, j)))
                 else:
-                    vm_config = self.set_fields()
-                self.tester.scapy_execute()
+                    tgen_input.append((rx_port, rx_port, pcap))
                 # 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)
+                streams = self.pktgen_helper.prepare_stream_from_tginput(tgen_input, 100, None, self.tester.pktgen)
                 bps, pps = self.tester.pktgen.measure_throughput(stream_ids=streams)
                 if i == 2:
                     self.verify(except_bps_range[1]*16 > bps > except_bps_range[0]*16, 'No traffic detected')
@@ -205,16 +201,6 @@ class TestSoftnic(TestCase):
         self.tester.send_expect("tcpdump -A -nn -e -vv -w getPackageByTcpdump.cap -i %s 2> /dev/null& " % self.txItf, "#")
         time.sleep(4)
 
-    def set_fields(self):
-        fields_config = {
-        'ip':  {'dst': {'range': 1, 'action': 'inc'}, }, }
-        return fields_config
-
-    def set_fields_ip(self):
-        fields_config = {
-        'ip':  {'dst': {'range': 16, 'action': 'inc'}, }, }
-        return fields_config
-
     def tear_down(self):
         """
         Run after each test case.
-- 
2.7.4


             reply	other threads:[~2020-10-14  2:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-13 18:40 LihongX Ma [this message]
2020-10-22  6:34 ` 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=1602614405-20002-1-git-send-email-lihongx.ma@intel.com \
    --to=lihongx.ma@intel.com \
    --cc=dts@dpdk.org \
    --cc=yuan.peng@intel.com \
    /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).