From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 677E6A056D; Tue, 3 Mar 2020 06:41:20 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5EEB61C00D; Tue, 3 Mar 2020 06:41:20 +0100 (CET) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 2E3762BB8 for ; Tue, 3 Mar 2020 06:41:18 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Mar 2020 21:41:17 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,510,1574150400"; d="scan'208";a="228757962" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga007.jf.intel.com with ESMTP; 02 Mar 2020 21:41:17 -0800 Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 2 Mar 2020 21:41:16 -0800 Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 2 Mar 2020 21:41:16 -0800 Received: from shsmsx153.ccr.corp.intel.com (10.239.6.53) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Mon, 2 Mar 2020 21:41:15 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.43]) by SHSMSX153.ccr.corp.intel.com ([169.254.12.96]) with mapi id 14.03.0439.000; Tue, 3 Mar 2020 13:41:14 +0800 From: "Tu, Lijuan" To: "Han, YingyaX" , "dts@dpdk.org" , "Wan, Zhe" CC: "Han, YingyaX" Thread-Topic: [dts] [PATCH V1]tests/packet_ordering: add packet_ordering function test case Thread-Index: AQHV7HRSsOyazeefy0WoJCNOT5JwXKg2Y8ew Date: Tue, 3 Mar 2020 05:41:13 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BBE8F47@SHSMSX101.ccr.corp.intel.com> References: <1582701551-35320-1-git-send-email-yingyax.han@intel.com> In-Reply-To: <1582701551-35320-1-git-send-email-yingyax.han@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.2.0.6 dlp-reaction: no-action 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 V1]tests/packet_ordering: add packet_ordering function test case 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 hanyingya > Sent: Wednesday, February 26, 2020 3:19 PM > To: dts@dpdk.org; Wan, Zhe > Cc: Han, YingyaX > Subject: [dts] [PATCH V1]tests/packet_ordering: add packet_ordering > function test case >=20 > Signed-off-by: hanyingya > --- > tests/TestSuite_packet_ordering.py | 169 +++++++++++++++++++++++++++++ > 1 file changed, 169 insertions(+) > create mode 100644 tests/TestSuite_packet_ordering.py >=20 > diff --git a/tests/TestSuite_packet_ordering.py > b/tests/TestSuite_packet_ordering.py > new file mode 100644 > index 0000000..ac6b930 > --- /dev/null > +++ b/tests/TestSuite_packet_ordering.py > @@ -0,0 +1,169 @@ > +# BSD LICENSE > +# > +# Copyright(c) 2010-2020 Intel Corporation. All rights reserved. > +# All rights reserved. > +# > +# Redistribution and use in source and binary forms, with or without # > +modification, are permitted provided that the following conditions # > +are met: > +# > +# * Redistributions of source code must retain the above copyright > +# notice, this list of conditions and the following disclaimer. > +# * Redistributions in binary form must reproduce the above copyright > +# notice, this list of conditions and the following disclaimer in > +# the documentation and/or other materials provided with the > +# distribution. > +# * Neither the name of Intel Corporation nor the names of its > +# contributors may be used to endorse or promote products derived > +# from this software without specific prior written permission. > +# > +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND > CONTRIBUTORS # > +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT > # > +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS > FOR # > +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE > COPYRIGHT # > +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, > INCIDENTAL, # > +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT > NOT # > +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF > USE, # > +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND > ON ANY # > +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT > # > +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF > THE USE # > +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH > DAMAGE. > + > +""" > +DPDK Test suite. > +Packet ordering example app test cases. > +""" > + > +import os > +import time > +import utils > +from test_case import TestCase > +from packet import Packet > + > + > +class TestPacketOrdering(TestCase): > + > + def set_up_all(self): > + """ > + Executes the Packet Ordering prerequisites. Creates a simple sca= py > + packet to be used later on the tests. It also compiles the examp= le app. > + """ > + self.tester.extend_external_packet_generator(TestPacketOrdering,= self) > + self.dut_ports =3D self.dut.get_ports(self.nic) > + global valports > + valports =3D [_ for _ in self.dut_ports if > + self.tester.get_local_port(_) !=3D -1] > + > + # Verify that enough ports are available > + self.verify(len(valports) >=3D 1, "Insufficient ports for speed = testing") > + self.port =3D self.tester.get_local_port(valports[0]) > + > + # get socket and cores > + self.socket =3D self.dut.get_numa_id(self.dut_ports[0]) > + self.cores =3D self.dut.get_core_list("1S/4C/1T", socket=3Dself.= socket) > + self.verify(self.cores is not None, "Insufficient cores for > + speed testing") > + > + self.core_mask =3D utils.create_mask(self.cores) > + self.port_mask =3D utils.create_mask(valports) > + > + # Builds the packet ordering example app and checks for errors. > + out =3D self.dut.send_expect("make -C examples/packet_ordering",= "#") > + self.verify("Error" not in out and "No such file" not in out, > + "Compilation error") > + > + def set_up(self): > + """ > + Run before each test case. > + """ > + pass > + > + def start_application(self): > + > + cmdline =3D './examples/packet_ordering/build/packet_ordering -c= {0} -n > {1} -- -p {2}' . \ > + format(self.core_mask, self.dut.get_memory_channels(), > self.port_mask) > + # Executes the packet ordering example app. > + self.dut.send_expect(cmdline, 'REORDERAPP', 120) > + > + def remove_dhcp_from_revpackets(self, inst, timeout=3D3): > + > + pkts =3D self.tester.load_tcpdump_sniff_packets(inst, timeout) > + i =3D 0 > + while len(pkts) !=3D 0 and i <=3D len(pkts) - 1: > + if pkts[i].pktgen.pkt.haslayer('DHCP'): > + pkts.remove(pkts[i]) > + i =3D i - 1 > + i =3D i + 1 > + return pkts > + > + def send_ordered_packet(self): > + """ > + send the packets with ordered of src-ip info. > + compose the pcap file, each queue has same 5 tuple and diff load= info > + """ > + > + pkt =3D Packet() > + src_ip =3D "11.12.13.1" > + pay_load =3D "000001" > + packet_num =3D 1000 > + smac =3D "00:00:00:00:00:00" > + rx_interface =3D self.tester.get_interface(self.port) > + tx_interface =3D rx_interface > + for _port in valports: > + index =3D valports[_port] > + dmac =3D self.dut.get_mac_address(index) > + config_opt =3D [('ether', {'dst': dmac, 'src': smac}), > + ('ipv4', {'src': src_ip, 'dst': '11.12.1.1'}), > + ('udp', {'src': 123, 'dst': 12})] > + pkt.generate_random_pkts(pktnum=3Dpacket_num, > random_type=3D['UDP'], ip_increase=3DFalse, > + random_payload=3DFalse, options=3D{= 'layers_config': > config_opt}) > + # config raw info in pkts > + for i in range(packet_num): > + payload =3D "0000%.3d" % (i + 1) > + pkt.pktgen.pkts[i + packet_num * _port]['Raw'].load =3D > + payload > + > + filt =3D [{'layer': 'ether', 'config': {'src': '%s' % smac}}] > + inst =3D self.tester.tcpdump_sniff_packets(rx_interface, filters= =3Dfilt) > + pkt.send_pkt(crb=3Dself.tester, tx_port=3Dtx_interface, timeout= =3D300) > + self.pkts =3D self.remove_dhcp_from_revpackets(inst) > + > + def check_packet_order(self): > + """ > + observe the packets sended by scapy, check the packets order > + """ > + > + for _port in valports: > + src_ip =3D "11.12.13.%d" % (_port + 1) > + packet_index =3D 0 > + for i in range(len(self.pkts)): > + pay_load =3D "0000%.2d" % packet_index > + if self.pkts[i]['IP'].src =3D=3D src_ip: > + print(self.pkts[i].show) > + if packet_index =3D=3D 0: > + packet_index =3D int(self.pkts[i]['Raw'].load[-2= :]) > + pay_load =3D "0000%.2d" % packet_index > + self.verify(self.pkts[i]['Raw'].load =3D=3D pay_load= , "The packets not > ordered") > + packet_index =3D packet_index + 1 > + > + def test_keep_packet_oeder(self): > + """ > + keep the packets order with one ordered stage in single-flow and= multi- > flow > + according to the tcpdump may be capture the packets whitch not > belong current > + flow, so set different src_mac of flow to identify the packets > + """ > + self.start_application() > + # send packets > + self.send_ordered_packet() > + # check packet ordering > + self.check_packet_order() > + self.dut.send_expect("^c", "#", 10) > + > + 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