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 798C5A05D3 for ; Sun, 24 Mar 2019 19:46:17 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1D4EC2674; Sun, 24 Mar 2019 19:46:17 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 7C50B25D9 for ; Sun, 24 Mar 2019 19:46:15 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Mar 2019 11:46:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,256,1549958400"; d="scan'208";a="128271163" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga008.jf.intel.com with ESMTP; 24 Mar 2019 11:46:14 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.408.0; Sun, 24 Mar 2019 11:46:13 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.158]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.134]) with mapi id 14.03.0415.000; Mon, 25 Mar 2019 02:46:11 +0800 From: "Tu, Lijuan" To: "Wu, ChangqingX" , "dts@dpdk.org" CC: "Wu, ChangqingX" Thread-Topic: [dts] [PATCH V3] tests:add tests suite about loadbalancer Thread-Index: AQHU2w57i1KqtzTW4Uu3zomMuu2pJ6YbLYvw Date: Sun, 24 Mar 2019 18:46:11 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BA45C37@SHSMSX101.ccr.corp.intel.com> References: <1552641023-34441-1-git-send-email-changqingx.wu@intel.com> In-Reply-To: <1552641023-34441-1-git-send-email-changqingx.wu@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.400.15 dlp-reaction: no-action x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiOTUwZDFjN2YtMWI0MS00NTI2LTk2YjUtNjgyM2ExY2QzZTgxIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiRDBSQklXV2JRUWk3bVd2SVhzNllCTkZTVVBcL2tsZHRjVDJKXC9NNDFsSGVqYXFNdHVWaXJcL05xbjY0OVg2YlpSNiJ9 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] [PATCH V3] tests:add tests suite about loadbalancer 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, thanks > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of changqingxwu > Sent: Friday, March 15, 2019 2:10 AM > To: dts@dpdk.org > Cc: Wu, ChangqingX > Subject: [dts] [PATCH V3] tests:add tests suite about loadbalancer >=20 > Signed-off-by: changqingxwu > --- > tests/TestSuite_loadbalancer.py | 125 ++++++++++++++++++++++++++++++++ > 1 file changed, 125 insertions(+) > create mode 100644 tests/TestSuite_loadbalancer.py >=20 > diff --git a/tests/TestSuite_loadbalancer.py b/tests/TestSuite_loadbalanc= er.py > new file mode 100644 index 0000000..19fbe67 > --- /dev/null > +++ b/tests/TestSuite_loadbalancer.py > @@ -0,0 +1,125 @@ > +# > + > +""" > +DPDK Test suite. > + > +Test Load Balancer. > + > +""" > + > +import dts > +from packet import Packet > +from test_case import TestCase > +import utils > +import time > + > + > +class TestLoadbalancer(TestCase): > + > + def set_up_all(self): > + """ > + Run at the start of each test suite. > + > + Load Balancer prerequisites. > + """ > + # Verify that enough ports are available > + global dutPorts > + # Based on h/w type, choose how many ports to use > + dutPorts =3D self.dut.get_ports(self.nic) > + > + # Verify that enough ports are available > + self.verify(len(dutPorts) >=3D 4, "Insufficient ports for > + testing") > + > + cores =3D self.dut.get_core_list("all") > + self.verify(len(cores) >=3D 5, "Insufficient cores for testing") > + self.cores =3D self.dut.get_core_list("1S/5C/1T") > + self.coremask =3D utils.create_mask(self.cores) > + > + global rx_port0, rx_port1, rx_port2, rx_port3, trafficFlow > + rx_port0 =3D self.tester.get_local_port(dutPorts[0]) > + rx_port1 =3D self.tester.get_local_port(dutPorts[1]) > + rx_port2 =3D self.tester.get_local_port(dutPorts[2]) > + rx_port3 =3D self.tester.get_local_port(dutPorts[3]) > + > + """ > + Designation the traffic flow is the same as LPM rules, send and = receive > packet verification: > + 0: 1.0.0.0/24 =3D> 0; > + 1: 1.0.1.0/24 =3D> 1; > + 2: 1.0.2.0/24 =3D> 2; > + 3: 1.0.3.0/24 =3D> 3; > + """ > + trafficFlow =3D { > + "Flow1": [rx_port0, "1.0.0.1"], > + "Flow2": [rx_port1, "1.0.1.1"], > + "Flow3": [rx_port2, "1.0.2.1"], > + "Flow4": [rx_port3, "1.0.3.1"], > + } > + > + out =3D self.dut.send_expect("make -C examples/load_balancer", "= #") > + self.verify("Error" not in out, "compilation error 1") > + self.verify("No such file" not in out, "compilation error 2") > + > + def set_up(self): > + """ > + Run before each test case. > + """ > + pass > + > + def test_load_balancer(self): > + """ > + --rx: Set the receive port, queue and main core; > + --tx: Set the send port and main core; > + --w: specify 4 workers lcores, > + --lpm: IPv4 routing table, > + --bsz: The number of packet is 10 for transceivers, > + --pos-lb: Position of the 1-byte header field within the input p= acket that is > used to > + determine the worker ID for each packet > + """ > + > + cmd =3D './examples/load_balancer/build/load_balancer -l {0}-{1}= -n 4 -- --rx > "(0,0,{2}),(1,0,{2}),(2,0,{2}),(3,0,{2})" '\ > + '--tx "(0,{2}),(1,{2}),(2,{2}),(3,{2})" --w "{3},{4},{5},{= 6}" '\ > + '--lpm "1.0.0.0/24=3D>0;1.0.1.0/24=3D>1;1.0.2.0/24=3D>2;1.= 0.3.0/24=3D>3;" '\ > + '--bsz "(10, 10), (10, 10), (10, 10)" --pos-lb > + 29'.format(self.cores[0], self.cores[4], self.cores[0], self.cores[1], > + self.cores[2], self.cores[3], self.cores[4]) > + > + self.dut.send_expect(cmd, 'main loop.') > + > + # Verify the traffic flow according to Ipv4 route table > + for flow in trafficFlow.keys(): > + rx_port =3D trafficFlow[flow][0] > + > + for i in range(len(dutPorts)): > + dstport =3D self.tester.get_local_port(dutPorts[i]) > + pkt_count =3D 10 > + inst =3D > + self.tester.tcpdump_sniff_packets(intf=3Dself.tester.get_interface(rx_p= o > + rt), timeout=3D10, count=3Dpkt_count) > + > + pkt =3D Packet() > + dst_mac =3D self.dut.get_mac_address(dutPorts[i]) > + pkt.config_layer('ether', {'dst': dst_mac}) > + pkt.config_layer('ipv4', {'src': "0.0.0.1", 'dst': traff= icFlow[flow][1]}) > + pkt.send_pkt(tx_port=3Dself.tester.get_interface(dstport= ), count=3D10) > + # Wait for the sniffer to finish. > + time.sleep(5) > + > + pkts =3D self.tester.load_tcpdump_sniff_packets(inst) > + len_pkts =3D len(pkts) > + > + self.verify(len_pkts =3D=3D pkt_count, "Packet number is= wrong") > + for packet in pkts: > + result =3D str(packet.pktgen.pkt.show) > + self.verify("Ether" in result, "No packet received") > + self.verify("src=3D0.0.0.1" + " dst=3D" + trafficFlo= w[flow][1] in result, > "Wrong IP address") > + self.verify("dst=3D%s" % dst_mac in result, "No > + packet received or packet missed") > + > + self.dut.send_expect("^C", "#") > + > + def tear_down(self): > + """ > + Run after each test case. > + """ > + self.dut.kill_all() > + > + def tear_down_all(self): > + """ > + Run after each test suite. > + """ > + pass > -- > 2.17.2