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 06934A04FC; Thu, 26 Dec 2019 06:49:05 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A90B71BF80; Thu, 26 Dec 2019 06:49:05 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 7CA111BF7C for ; Thu, 26 Dec 2019 06:49:03 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Dec 2019 21:49:01 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,357,1571727600"; d="scan'208";a="219790943" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga006.jf.intel.com with ESMTP; 25 Dec 2019 21:49:01 -0800 Received: from FMSMSX110.amr.corp.intel.com (10.18.116.10) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 25 Dec 2019 21:49:01 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx110.amr.corp.intel.com (10.18.116.10) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 25 Dec 2019 21:49:00 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.90]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.214]) with mapi id 14.03.0439.000; Thu, 26 Dec 2019 13:48:59 +0800 From: "Chen, Zhaoyan" To: "dts@dpdk.org" CC: "Zhu, ShuaiX" , "Chen, Zhaoyan" Thread-Topic: [dts][PATCH V1] tests:Add new test_suite flexible rxd. Thread-Index: AQHVs6/woXoKUgDLkEqpmffGeUKzsKfL9h5g Date: Thu, 26 Dec 2019 05:48:58 +0000 Message-ID: <9DEEADBC57E43F4DA73B571777FECECA41E56BA3@SHSMSX104.ccr.corp.intel.com> References: <1576459928-72138-1-git-send-email-shuaix.zhu@intel.com> In-Reply-To: <1576459928-72138-1-git-send-email-shuaix.zhu@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:Add new test_suite flexible rxd. 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" Comments inline Regards, Zhaoyan Chen > -----Original Message----- > From: Zhu, ShuaiX > Sent: Monday, December 16, 2019 9:32 AM > To: dts@dpdk.org > Cc: Chen, Zhaoyan ; Zhu, ShuaiX > Subject: [dts][PATCH V1] tests:Add new test_suite flexible rxd. >=20 > add new test_suite flexible rxd. >=20 > Signed-off-by: zhu,shuai > --- > tests/TestSuite_flexible_rxd.py | 302 ++++++++++++++++++++++++++++++++ > 1 file changed, 302 insertions(+) > create mode 100644 tests/TestSuite_flexible_rxd.py >=20 > diff --git a/tests/TestSuite_flexible_rxd.py b/tests/TestSuite_flexible_r= xd.py new file > mode 100644 index 0000000..9ebd97e > --- /dev/null > +++ b/tests/TestSuite_flexible_rxd.py > @@ -0,0 +1,302 @@ > +# Copyright (c) <2019> Intel Corporation # 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. > + > + > +import time > +from test_case import TestCase > +from packet import Packet > +from pmd_output import PmdOutput > + > +TYPE =3D ["0x8100", "0x88A8", "0x9100"] > + > + > +class TestFlexibleRxd(TestCase): > + > + def set_up_all(self): > + """ > + run at the start of each test suite. > + """ > + self.verify(self.nic in ["columbiaville_25g", "columbiaville_100= g"], > + "flexible rxd only supports CVL NIC.") > + self.nb_core =3D 2 > + self.pkg_count =3D 1 > + self.dut_ports =3D self.dut.get_ports(self.nic) > + self.verify(len(self.dut_ports) >=3D 1, "Insufficient ports for = testing") > + self.pci_info =3D self.dut.ports_info[0]['pci'] > + self.ports_socket =3D self.dut.get_numa_id(self.dut_ports[0]) > + self.cores =3D self.dut.get_core_list("1S/3C/1T", socket=3Dself.= ports_socket) > + self.verify(len(self.cores) >=3D 3, "The machine has too few cor= es.") > + self.tx_interface =3D > self.tester.get_interface(self.tester.get_local_port(self.dut_ports[0])) > + self.dst_mac =3D self.dut.get_mac_address(self.dut_ports[0]) > + self.src_mac =3D self.tester.get_mac(self.tester.get_local_port(= self.dut_ports[0])) > + self.pmdout =3D PmdOutput(self.dut) > + self.prepare_test_pmd() > + > + def set_up(self): > + """ > + Run before each test case. > + """ > + pass > + > + def prepare_test_pmd(self): > + """ > + Modify the dpdk code. > + """ > + self.dut.send_expect("cp ./app/test-pmd/util.c .", "#", 15) > + self.dut.send_expect( > + "sed -i '/#include /a\#include ' = app/test- > pmd/util.c", "#", 15) > + self.dut.send_expect( > + "sed -i '/if (ol_flags & PKT_RX_TIMESTAMP)/i\ > rte_net_ice_dump_proto_xtr_metadata(mb);' app/test-pmd/util.c", "#", 15) > + self.dut.build_install_dpdk(self.dut.target) > + > + def restory_test_pmd(self): > + """ > + Resume editing operation. > + """ > + self.dut.send_expect("\cp ./util.c ./app/test-pmd/", "#", 15) > + self.dut.send_expect("rm -rf ./util.c", "#", 15) > + self.dut.build_install_dpdk(self.dut.target) > + > + def start_testpmd(self, pkg_type): > + """ > + start testpmd > + """ > + eal_params =3D self.dut.create_eal_parameters(cores=3Dself.cores= , > ports=3D[self.pci_info], > + port_options=3D{self= .pci_info: 'proto_xtr=3D%s' % pkg_type}) > + self.pmdout.execute_cmd("./%s/app/testpmd %s -- -i --rxq=3D32 --= txq=3D32 -- > portmask=3D0x1 --nb-cores=3D%d" % \ > + (self.target, eal_params, self.nb_core)) [Chen, Zhaoyan] pmdout has already integrated create_eal_parameters. So we= don't need generate eal first then call pmdout > + self.pmdout.execute_cmd("set verbose 1", "testpmd> ", 120) > + self.pmdout.execute_cmd("set fwd io", "testpmd> ", 120) > + self.pmdout.execute_cmd("set promisc all off", "testpmd> ", 120) > + self.pmdout.execute_cmd("clear port stats all", "testpmd> ", 120= ) > + self.pmdout.execute_cmd("start", "testpmd> ", 120) > + > + def verify_result(self, fields_list, out, mesg): > + """ > + Validation results > + """ > + for field in fields_list: > + self.verify(field in out, mesg) > + self.dut.send_expect("quit", "#", 15) > + > + def combine_and_send_pkts(self, pkg_type, config, ether_type=3DNone)= : > + if pkg_type =3D=3D 'vlan': > + num =3D config['vlan_tag'] > + vlan_list =3D [] > + for i in range(num): > + vlan_list.append('Dot1Q(prio=3D%d+1,vlan=3D%d+23)' % (i,= i)) > + self.vlan_str =3D '/'.join(vlan_list) > + pkt_str =3D 'Ether(src=3D"%s", dst=3D"%s", type=3D%s)/%s/IP(= )/UDP()/DNS()' % > (self.src_mac, self.dst_mac, ether_type, self.vlan_str) > + pkt =3D Packet(pkt_str) > + else: > + pkt =3D Packet(pkt_type=3Dpkg_type, pkt_len=3D128) > + pkt.config_layers(config) > + pkt.send_pkt(self.tester, tx_port=3Dself.tx_interface, count=3Ds= elf.pkg_count, > timeout=3D30) > + out_info =3D self.dut.get_session_output(timeout=3D3) > + return out_info > + [Chen, Zhaoyan] We don't need this combine_and send pkts function, for each= test case has specific scapy packet.=20 I feel that if put packet str in each test case directly, the test case wil= l be more readable. > + def test_check_single_VLAN_fields_in_RXD_8021Q(self): > + """ > + Check single VLAN fields in RXD (802.1Q) > + """ > + self.start_testpmd('vlan') > + config =3D {'vlan_tag': 1} > + out =3D self.combine_and_send_pkts('vlan', config, ether_type=3D= TYPE[0]) > + mesg =3D "The packet does not carry a VLAN tag." > + fields_list =3D ["vlan"] > + self.verify_result(fields_list, out, mesg) > + > + def test_check_single_VLAN_fields_in_RXD_8021ad(self): > + """ > + Check single VLAN fields in RXD (802.1ad) > + """ > + self.start_testpmd("vlan") > + config =3D {'vlan_tag': 1} > + out =3D self.combine_and_send_pkts("vlan", config, ether_type=3D= TYPE[1]) > + mesg =3D "stag result is not expected (stag=3D1:0:23)" > + fields_list =3D ["stag=3D1:0:23"] > + self.verify_result(fields_list, out, mesg) > + > + def test_check_double_VLAN_fields_in_RXD_8021Q_1_VLAN_tag(self): > + """ > + Check double VLAN fields in RXD (802.1Q) only 1 VLAN tag > + """ > + self.start_testpmd("vlan") > + config =3D {'vlan_tag': 1} > + out =3D self.combine_and_send_pkts("vlan", config, ether_type=3D= TYPE[2]) > + mesg =3D "stag result is not expected (stag=3D1:0:23)" > + fields_list =3D ["stag=3D1:0:23"] > + self.verify_result(fields_list, out, mesg) > + > + def test_check_double_VLAN_fields_in_RXD_8021Q_2_VLAN_tag(self): > + """ > + Check double VLAN fields in RXD (802.1Q) 2 VLAN tags > + """ > + self.start_testpmd("vlan") > + config =3D {'vlan_tag': 2} > + out =3D self.combine_and_send_pkts("vlan", config, ether_type=3D= TYPE[2]) > + mesg =3D "There are no related fields in the received VLAN packe= t" > + fields_list =3D ["stag=3D1:0:23", "ctag=3D2:0:24"] > + self.verify_result(fields_list, out, mesg) > + > + def test_check_double_VLAN_fields_in_RXD_8021ad(self): > + """ > + Check double VLAN fields in RXD (802.1ad) > + """ > + self.start_testpmd("vlan") > + config =3D {'vlan_tag': 2} > + out =3D self.combine_and_send_pkts("vlan", config, ether_type=3D= TYPE[1]) > + mesg =3D "There are no related fields in the received VLAN packe= t" > + fields_list =3D ["stag=3D1:0:23", "ctag=3D2:0:24"] > + self.verify_result(fields_list, out, mesg) > + > + def test_check_IPv4_fields_in_RXD(self): > + """ > + Check IPv4 fields in RXD > + """ > + self.start_testpmd("ipv4") > + pkg_type =3D 'UDP' > + config =3D [('ether', {'src': self.src_mac, 'dst': self.dst_mac}= ), > + ('ipv4', {'tos': 23, 'ttl': 98})] > + out =3D self.combine_and_send_pkts(pkg_type, config) > + mesg =3D "There are no related fields in the received IPV4 packe= t" > + fields_list =3D ["ver=3D4", "hdrlen=3D5", "tos=3D23", "ttl=3D98"= , "proto=3D17"] > + self.verify_result(fields_list, out, mesg) > + > + def test_check_IPv6_fields_in_RXD(self): > + """ > + Check IPv6 fields in RXD > + """ > + self.start_testpmd("ipv6") > + pkg_type =3D 'IPv6_UDP' > + config =3D [('ether', {'src': self.src_mac, 'dst': self.dst_mac}= ), > + ('ipv6', {'tc': 12, 'hlim': 34, 'fl': 0x98765})] > + out =3D self.combine_and_send_pkts(pkg_type, config) > + mesg =3D "There are no related fields in the received IPV6 packe= t" > + fields_list =3D ["ver=3D6", "tc=3D12", "flow_hi4=3D0x9", "nexthd= r=3D17", "hoplimit=3D34"] > + self.verify_result(fields_list, out, mesg) > + > + def test_check_IPv6_flow_field_in_RXD(self): > + """ > + Check IPv6 flow field in RXD > + """ > + self.start_testpmd("ipv6_flow") > + pkg_type =3D 'IPv6_UDP' > + config =3D [('ether', {'src': self.src_mac, 'dst': self.dst_mac}= ), > + ('ipv6', {'tc': 12, 'hlim': 34, 'fl': 0x98765})] > + out =3D self.combine_and_send_pkts(pkg_type, config) > + mesg =3D "There are no related fields in the received IPV6_flow = packet" > + fields_list =3D ["ver=3D6", "tc=3D12", "flow=3D0x98765"] > + self.verify_result(fields_list, out, mesg) > + > + def test_check_TCP_fields_in_IPv4_in_RXD(self): > + """ > + Check TCP fields in IPv4 in RXD > + """ > + self.start_testpmd("tcp") > + pkg_type =3D 'TCP' > + config =3D [('ether', {'src': self.src_mac, 'dst': self.dst_mac}= ), > + ('tcp', {'flags': 'AS'})] > + out =3D self.combine_and_send_pkts(pkg_type, config) > + mesg =3D "There are no related fields in the received TCP packet= " > + fields_list =3D ["doff=3D5", "flags=3DAS"] > + self.verify_result(fields_list, out, mesg) > + > + def test_check_TCP_fields_in_IPv6_in_RXD(self): > + """ > + Check TCP fields in IPv6 in RXD > + """ > + self.start_testpmd("tcp") > + pkg_type =3D 'IPv6_TCP' > + config =3D [('ether', {'src': self.src_mac, 'dst': self.dst_mac}= ), > + ('tcp', {'flags': 'S'})] > + out =3D self.combine_and_send_pkts(pkg_type, config) > + mesg =3D "There are no related fields in the received TCP packet= " > + fields_list =3D ["doff=3D5", "flags=3DS"] > + self.verify_result(fields_list, out, mesg) > + > + def test_check_IPv4_IPv6_TCP_fields_in_RXD_on_specific_queues(self): > + """ > + Check IPv4, IPv6, TCP fields in RXD on specific queues > + """ > + self.start_testpmd("'[(2):ipv4,(3):ipv6,(4):tcp]'") > + self.dut.send_expect( > + "flow create 0 ingress pattern eth dst is %s / ipv4 src is 1= 92.168.0.1 dst is > 192.168.0.2 tos is 23 ttl is 98 / end actions queue index 2 / end" % self= .dst_mac, > "created") > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / ipv6 src is 2001::3 dst= is 2001::4 tc is 12 / > end actions queue index 3 / end", "created") > + self.dut.send_expect( > + "flow create 0 ingress pattern eth dst is %s / ipv4 src is > + 192.168.0.1 dst is 192.168.0.2 / tcp src is 25 dst is 23 / end actions > + queue index 4 / end" % self.dst_mac, "created") > + > + # send IPv4 > + pkg_type =3D 'UDP' > + config =3D [('ether', {'dst': self.dst_mac}), > + ('ipv4', {'src': '192.168.0.1', 'dst': '192.168.0.2', = 'tos': 23, 'ttl': 98})] > + out1 =3D self.combine_and_send_pkts(pkg_type, config) > + mesg1 =3D "There are no relevant fields in the received IPv4 pac= ket." > + fields_list1 =3D ["Receive queue=3D0x2", "ver=3D4", "hdrlen=3D5"= , "tos=3D23", "ttl=3D98", > "proto=3D17"] > + for field1 in fields_list1: > + self.verify(field1 in out1, mesg1) > + > + # send IPv6 > + pkg_type =3D 'IPv6_UDP' > + config =3D [('ether', {'src': self.src_mac, 'dst': self.dst_mac}= ), > + ('ipv6', {'src': '2001::3', 'dst': '2001::4', 'tc': 12= , 'hlim': 34, 'fl': 0x98765})] > + out2 =3D self.combine_and_send_pkts(pkg_type, config) > + mesg2 =3D "There are no relevant fields in the received IPv6 pac= ket." > + fields_list2 =3D ["Receive queue=3D0x3", "ver=3D6", "tc=3D12", "= flow_hi4=3D0x9", > "nexthdr=3D17", "hoplimit=3D34"] > + for field2 in fields_list2: > + self.verify(field2 in out2, mesg2) > + > + # send TCP > + pkg_type =3D 'TCP' > + config =3D [('ether', {'dst': self.dst_mac}), > + ('ipv4', {'src': '192.168.0.1', 'dst': '192.168.0.2'})= , > + ('tcp', {'flags': 'AS', 'src': 25, 'dst': 23})] > + out3 =3D self.combine_and_send_pkts(pkg_type, config) > + mesg3 =3D "There are no relevant fields in the received TCP pack= et." > + fields_list3 =3D ["Receive queue=3D0x4", "doff=3D5", "flags=3DAS= "] > + for field3 in fields_list3: > + self.verify(field3 in out3, mesg3) > + self.dut.send_expect("quit", "#", 15) > + > + def tear_down(self): > + """ > + Run after each test case. > + """ > + self.dut.kill_all() > + time.sleep(2) > + > + def tear_down_all(self): > + """ > + Run after each test suite. > + """ > + self.restory_test_pmd() > -- > 2.17.2