From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id F279DA0096 for ; Wed, 5 Jun 2019 03:40:44 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E21C71B964; Wed, 5 Jun 2019 03:40:44 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 8BC1A1B958 for ; Wed, 5 Jun 2019 03:40:42 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Jun 2019 18:40:41 -0700 X-ExtLoop1: 1 Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga005.jf.intel.com with ESMTP; 04 Jun 2019 18:40:41 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 4 Jun 2019 18:40:40 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.10]) by shsmsx102.ccr.corp.intel.com ([169.254.2.134]) with mapi id 14.03.0415.000; Wed, 5 Jun 2019 09:40:37 +0800 From: "Tu, Lijuan" To: "Zhao, HaiyangX" , "dts@dpdk.org" CC: "Zhao, HaiyangX" Thread-Topic: [dts] [next][PATCH V2 1/7] tests/l3fwd: replace etgen with pktgen Thread-Index: AQHVGebECnfTQUTWEU2OUJQKeAcBlaaMS4TQ Date: Wed, 5 Jun 2019 01:40:36 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BAA0403@SHSMSX101.ccr.corp.intel.com> References: <20190603163109.19706-1-haiyangx.zhao@intel.com> In-Reply-To: <20190603163109.19706-1-haiyangx.zhao@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.600.7 dlp-reaction: no-action x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYWY1MTU4NDAtOWNkNi00NDZiLThmMGEtYTg0NzE3ODc3MjIzIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiQitcL0Y3U01FQkowXC9VTnpLSjNqdFZuOUsxeDVjdWFxdmRGNCtXTHI3bE9NcDNGNjB5d0lFTzE4bGg3ZXJEWmVxIn0= x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dts] [next][PATCH V2 1/7] tests/l3fwd: replace etgen with pktgen X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org Sender: "dts" 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 > Subject: [dts] [next][PATCH V2 1/7] tests/l3fwd: replace etgen with pktge= n >=20 > *.replace etgen with pktgen API which support both trex and ixia. > *.delete old etgen override method ip >=20 > Signed-off-by: Haiyang Zhao > --- > tests/TestSuite_l3fwd.py | 81 +++++++++++++++++++++++++++------------- > 1 file changed, 55 insertions(+), 26 deletions(-) >=20 > 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 >=20 > -class TestL3fwd(TestCase,IxiaPacketGenerator): > +class TestL3fwd(TestCase): >=20 > path =3D "./examples/l3fwd/build/" >=20 > @@ -185,7 +186,7 @@ class TestL3fwd(TestCase,IxiaPacketGenerator): > out =3D self.dut.send_expect("make clean -C examples/l3fwd", "# = ") >=20 > # 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 =3D self.dut.build_dpdk_apps("./examples/l3fwd", "USER_FLAGS= =3D- > DAPP_LOOKUP_METHOD=3D0") >=20 > self.verify("Error" not in out, "compilation error 1") @@ -197,6= +198,16 > @@ class TestL3fwd(TestCase,IxiaPacketGenerator): > self.l3fwd_test_results =3D {'header': [], > 'data': []} >=20 > + # get dts output path > + if self.logger.log_path.startswith(os.sep): > + self.output_path =3D self.logger.log_path > + else: > + cur_path =3D os.path.dirname( > + os.path.dirname(os.path.realpath(__file_= _))) > + self.output_path =3D os.sep.join([cur_path, self.logger.log_= path]) > + # create an instance to set stream field setting > + self.pktgen_helper =3D 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 =3D frame_size - \ > HEADER_SIZE['ip'] - HEADER_SIZE['eth'] - HEADER_SIZE['tc= p'] >=20 > + pcaps =3D {} > + flows =3D [] > for _port in range(ports_num): > - dmac =3D self.dut.get_mac_address(valports[_port]) > - flows =3D ['Ether(dst=3D"%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 =3D valports[_port] > + dmac =3D self.dut.get_mac_address(index) > + cnt =3D 0 > + for layer in self.flows()[_port *2:(_port +1)*2]: > + flow =3D 'Ether(dst=3D"%s")/%s/TCP()/("X"*%d)' % ( > + dmac, layer, payload= _size) > + flows.append(flow) > + pcap =3D 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] =3D [] > + pcaps[index].append(pcap) > + cnt +=3D 1 >=20 > self.rst_report("Flows for %d ports, %d frame size.\n" % (po= rts_num, > frame_size), > annex=3DTrue) > @@ -330,12 +356,23 @@ class TestL3fwd(TestCase,IxiaPacketGenerator): > txIntf =3D self.tester.get_local_port(va= lports[rxPort - 1]) >=20 > rxIntf =3D self.tester.get_local_port(valpor= ts[rxPort]) > - if rxPort % 2 =3D=3D 0: > - tgenInput.append((txIntf, rxIntf, > "dst%d.pcap" %valports[rxPort+1])) > - else: > - tgenInput.append((txIntf, rxIntf, > "dst%d.pcap" %valports[rxPort-1])) > + port_id =3D valports[rxPort+1] if rxPort % 2= =3D=3D 0 else \ > + valports[rxPort-1] > + for pcap in pcaps[port_id]: > + tgenInput.append((txIntf, rxIntf, > + pcap)) > + > + # Run traffic generator > + > + vm_config =3D self.set_fields() > + # clear streams before add new streams > + self.tester.pktgen.clear_streams() > + # run packet generator > + streams =3D > self.pktgen_helper.prepare_stream_from_tginput(tgenInput, > + 100, vm_config, self.tester.= pktgen) > + # set traffic option > + traffic_opt =3D {'duration': 60} > + zero_loss_rate, tx_pkts, rx_pkts =3D > + self.tester.pktgen.measure_rfc2544(stream_ids=3Dstreams, > + options=3Dtraffic_opt) >=20 > - zero_loss_rate, tx_pkts, rx_pkts =3D > self.tester.run_rfc2544(tgenInput, delay=3D60) > loss_pkts =3D tx_pkts - rx_pkts > self.dut.send_expect("^C", "#") > linerate =3D self.wirespeed(self.nic, frame_size= , ports_num) @@ > -357,19 +394,11 @@ class TestL3fwd(TestCase,IxiaPacketGenerator): >=20 > self.result_table_print() >=20 > - 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 =3D { > + 'ip': {'src': {'action': 'random'},},} > + return fields_config >=20 > def tear_down(self): > """ > -- > 2.17.1