test suite reviews and discussions
 help / color / mirror / Atom feed
From: "Tu, Lijuan" <lijuan.tu@intel.com>
To: "Zhao, HaiyangX" <haiyangx.zhao@intel.com>,
	"dts@dpdk.org" <dts@dpdk.org>
Cc: "Zhao, HaiyangX" <haiyangx.zhao@intel.com>
Subject: Re: [dts] [next][PATCH V2 1/7] tests/l3fwd: replace etgen with pktgen
Date: Wed, 5 Jun 2019 01:40:36 +0000	[thread overview]
Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BAA0403@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <20190603163109.19706-1-haiyangx.zhao@intel.com>

Applied the series into next branch, thanks

> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Haiyang Zhao
> Sent: Tuesday, June 4, 2019 12:31 AM
> To: dts@dpdk.org
> Cc: Zhao, HaiyangX <haiyangx.zhao@intel.com>
> Subject: [dts] [next][PATCH V2 1/7] tests/l3fwd: replace etgen with pktgen
> 
> *.replace etgen with pktgen API which support both trex and ixia.
> *.delete old etgen override method ip
> 
> Signed-off-by: Haiyang Zhao <haiyangx.zhao@intel.com>
> ---
>  tests/TestSuite_l3fwd.py | 81 +++++++++++++++++++++++++++-------------
>  1 file changed, 55 insertions(+), 26 deletions(-)
> 
> diff --git a/tests/TestSuite_l3fwd.py b/tests/TestSuite_l3fwd.py index
> 78eaee7..7ffdcba 100644
> --- a/tests/TestSuite_l3fwd.py
> +++ b/tests/TestSuite_l3fwd.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 @@ -
> 37,12 +37,13 @@ Layer-3 forwarding test script.
>  import utils
>  import string
>  import re
> +import os
>  from test_case import TestCase
>  from exception import VerifyFailure
>  from settings import HEADER_SIZE
> -from etgen import IxiaPacketGenerator
> +from pktgen import PacketGeneratorHelper
> 
> -class TestL3fwd(TestCase,IxiaPacketGenerator):
> +class TestL3fwd(TestCase):
> 
>      path = "./examples/l3fwd/build/"
> 
> @@ -185,7 +186,7 @@ class TestL3fwd(TestCase,IxiaPacketGenerator):
>          out = self.dut.send_expect("make clean -C examples/l3fwd", "# ")
> 
>          # Compile l3fwd with hash/exact lookup.
> -	self.dut.send_expect(r"sed -i -e
> '/ipv4_l3fwd_em_route_array\[\].*{/,/^\}\;/c\\%s'
> examples/l3fwd/l3fwd_em.c" % exactStr, "# ")
> +        self.dut.send_expect(r"sed -i -e
> + '/ipv4_l3fwd_em_route_array\[\].*{/,/^\}\;/c\\%s'
> + examples/l3fwd/l3fwd_em.c" % exactStr, "# ")
>          out = self.dut.build_dpdk_apps("./examples/l3fwd", "USER_FLAGS=-
> DAPP_LOOKUP_METHOD=0")
> 
>          self.verify("Error" not in out, "compilation error 1") @@ -197,6 +198,16
> @@ class TestL3fwd(TestCase,IxiaPacketGenerator):
>          self.l3fwd_test_results = {'header': [],
>                                     'data': []}
> 
> +        # 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 flows(self):
>          """
>          Return a list of packets that implements the flows described in the @@
> -249,11 +260,26 @@ class TestL3fwd(TestCase,IxiaPacketGenerator):
>              payload_size = frame_size -  \
>                  HEADER_SIZE['ip'] - HEADER_SIZE['eth'] - HEADER_SIZE['tcp']
> 
> +            pcaps = {}
> +            flows = []
>              for _port in range(ports_num):
> -                dmac = self.dut.get_mac_address(valports[_port])
> -                flows = ['Ether(dst="%s")/%s/TCP()/("X"*%d)' % (dmac, flow,
> payload_size) for flow in self.flows()[_port *2:(_port +1)*2]]
> -                self.tester.scapy_append('wrpcap("dst%d.pcap",
> [%s])' %(valports[_port],string.join(flows,',')))
> -            self.tester.scapy_execute()
> +                index = valports[_port]
> +                dmac = self.dut.get_mac_address(index)
> +                cnt = 0
> +                for layer in self.flows()[_port *2:(_port +1)*2]:
> +                    flow = 'Ether(dst="%s")/%s/TCP()/("X"*%d)' % (
> +                                                    dmac, layer, payload_size)
> +                    flows.append(flow)
> +                    pcap = os.sep.join([
> +                                self.output_path,
> +                                "dst{0}_{1}.pcap".format(index, cnt)])
> +                    self.tester.scapy_append('wrpcap("%s", [%s])' % (
> +                                                pcap, flow))
> +                    self.tester.scapy_execute()
> +                    if index not in pcaps:
> +                        pcaps[index] = []
> +                    pcaps[index].append(pcap)
> +                    cnt += 1
> 
>              self.rst_report("Flows for %d ports, %d frame size.\n" % (ports_num,
> frame_size),
>                         annex=True)
> @@ -330,12 +356,23 @@ class TestL3fwd(TestCase,IxiaPacketGenerator):
>                                  txIntf = self.tester.get_local_port(valports[rxPort - 1])
> 
>                              rxIntf = self.tester.get_local_port(valports[rxPort])
> -                            if rxPort % 2 == 0:
> -                                tgenInput.append((txIntf, rxIntf,
> "dst%d.pcap" %valports[rxPort+1]))
> -                            else:
> -                                tgenInput.append((txIntf, rxIntf,
> "dst%d.pcap" %valports[rxPort-1]))
> +                            port_id = valports[rxPort+1] if rxPort % 2 == 0 else \
> +                                      valports[rxPort-1]
> +                            for pcap in pcaps[port_id]:
> +                                tgenInput.append((txIntf, rxIntf,
> + pcap))
> +
> +                        # Run traffic generator
> +
> +                        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(tgenInput,
> +                                            100, vm_config, self.tester.pktgen)
> +                        # set traffic option
> +                        traffic_opt = {'duration': 60}
> +                        zero_loss_rate, tx_pkts, rx_pkts =
> + self.tester.pktgen.measure_rfc2544(stream_ids=streams,
> + options=traffic_opt)
> 
> -                        zero_loss_rate, tx_pkts, rx_pkts =
> self.tester.run_rfc2544(tgenInput, delay=60)
>                          loss_pkts = tx_pkts - rx_pkts
>                          self.dut.send_expect("^C", "#")
>                          linerate = self.wirespeed(self.nic, frame_size, ports_num) @@
> -357,19 +394,11 @@ class TestL3fwd(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 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):
>          """
> --
> 2.17.1


      parent reply	other threads:[~2019-06-05  1:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-03 16:31 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 ` [dts] [next][PATCH V2 4/7] tests/multiprocess:replace " Haiyang Zhao
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 ` Tu, Lijuan [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=8CE3E05A3F976642AAB0F4675D0AD20E0BAA0403@SHSMSX101.ccr.corp.intel.com \
    --to=lijuan.tu@intel.com \
    --cc=dts@dpdk.org \
    --cc=haiyangx.zhao@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).