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 87405A04DD; Thu, 2 Jan 2020 08:15:38 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6950C1BFD7; Thu, 2 Jan 2020 08:15:38 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id BA5641BE94 for ; Thu, 2 Jan 2020 08:15:35 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Jan 2020 23:15:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,385,1571727600"; d="scan'208";a="301896513" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga001.jf.intel.com with ESMTP; 01 Jan 2020 23:15:34 -0800 Received: from fmsmsx606.amr.corp.intel.com (10.18.126.86) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 1 Jan 2020 23:15:34 -0800 Received: from fmsmsx606.amr.corp.intel.com (10.18.126.86) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 1 Jan 2020 23:15:34 -0800 Received: from shsmsx108.ccr.corp.intel.com (10.239.4.97) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Wed, 1 Jan 2020 23:15:33 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.197]) by SHSMSX108.ccr.corp.intel.com ([169.254.8.39]) with mapi id 14.03.0439.000; Thu, 2 Jan 2020 15:15:32 +0800 From: "Chen, Zhaoyan" To: "Zhu, ShuaiX" , "dts@dpdk.org" CC: "Chen, Zhaoyan" Thread-Topic: [PATCH V3] tests:add new test_suite flexible rxd. Thread-Index: AQHVv7zbyOWQ7VosyEKOyFMDV8Bqh6fW+U7w Date: Thu, 2 Jan 2020 07:15:31 +0000 Message-ID: <9DEEADBC57E43F4DA73B571777FECECA41E772CD@SHSMSX104.ccr.corp.intel.com> References: <1577784890-137293-1-git-send-email-shuaix.zhu@intel.com> In-Reply-To: <1577784890-137293-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 V3] 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" Acked-by: Zhaoyan Chen Regards, Zhaoyan Chen > -----Original Message----- > From: Zhu, ShuaiX > Sent: Tuesday, December 31, 2019 5:35 PM > To: dts@dpdk.org > Cc: Chen, Zhaoyan ; Zhu, ShuaiX > Subject: [PATCH V3] 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 | 271 ++++++++++++++++++++++++++++++++ > 1 file changed, 271 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..77001ab > --- /dev/null > +++ b/tests/TestSuite_flexible_rxd.py > @@ -0,0 +1,271 @@ > +# 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 > + > + > +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, proto_xdr): > + """ > + start testpmd > + """ > + para =3D '--rxq=3D32 --txq=3D32 --portmask=3D0x1 --nb-cores=3D%d= ' % self.nb_core > + self.pmdout.start_testpmd("1S/3C/1T", param=3Dpara, ports=3D[sel= f.pci_info], > port_options=3D{self.pci_info: 'proto_xtr=3D%s' % proto_xdr}) > + 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 send_pkts_and_get_output(self, pkts_str): > + pkt =3D Packet(pkts_str) > + 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 > + > + def test_check_single_VLAN_fields_in_RXD_8021Q(self): > + """ > + Check single VLAN fields in RXD (802.1Q) > + """ > + self.start_testpmd("vlan") > + pkts_str =3D 'Ether(src=3D"%s", dst=3D"%s", > type=3D0x8100)/Dot1Q(prio=3D1,vlan=3D23)/IP()/UDP()/DNS()' % (self.src_ma= c, > self.dst_mac) > + out =3D self.send_pkts_and_get_output(pkts_str) > + 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") > + pkts_str =3D 'Ether(src=3D"%s", dst=3D"%s", > type=3D0x88A8)/Dot1Q(prio=3D1,vlan=3D23)/IP()/UDP()/DNS()' % (self.src_ma= c, > self.dst_mac) > + out =3D self.send_pkts_and_get_output(pkts_str) > + 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") > + pkts_str =3D 'Ether(src=3D"%s", dst=3D"%s", > type=3D0x9100)/Dot1Q(prio=3D1,vlan=3D23)/IP()/UDP()/DNS()' % (self.src_ma= c, > self.dst_mac) > + out =3D self.send_pkts_and_get_output(pkts_str) > + 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") > + pkts_str =3D 'Ether(src=3D"%s", dst=3D"%s", > type=3D0x9100)/Dot1Q(prio=3D1,vlan=3D23)/Dot1Q(prio=3D4,vlan=3D56)/IP()/U= DP()/DNS()' % > (self.src_mac, self.dst_mac) > + out =3D self.send_pkts_and_get_output(pkts_str) > + mesg =3D "There are no related fields in the received VLAN packe= t" > + fields_list =3D ["stag=3D1:0:23", "ctag=3D4:0:56"] > + 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") > + pkts_str =3D 'Ether(src=3D"%s", dst=3D"%s", > type=3D0x88A8)/Dot1Q(prio=3D1,vlan=3D23)/Dot1Q(prio=3D4,vlan=3D56)/IP()/U= DP()/DNS()' % > (self.src_mac, self.dst_mac) > + out =3D self.send_pkts_and_get_output(pkts_str) > + mesg =3D "There are no related fields in the received VLAN packe= t" > + fields_list =3D ["stag=3D1:0:23", "ctag=3D4:0:56"] > + self.verify_result(fields_list, out, mesg) > + > + def test_check_IPv4_fields_in_RXD(self): > + """ > + Check IPv4 fields in RXD > + """ > + self.start_testpmd("ipv4") > + pkts_str =3D 'Ether(src=3D"%s", dst=3D"%s")/IP(tos=3D23, > ttl=3D98)/UDP()/Raw(load=3D"XXXXXXXXXX")' % (self.src_mac, self.dst_mac) > + out =3D self.send_pkts_and_get_output(pkts_str) > + 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") > + pkts_str =3D 'Ether(src=3D"%s", > dst=3D"%s")/IPv6(tc=3D12,hlim=3D34,fl=3D0x98765)/UDP()/Raw(load=3D"XXXXXX= XXXX")' % > (self.src_mac, self.dst_mac) > + out =3D self.send_pkts_and_get_output(pkts_str) > + 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") > + pkts_str =3D 'Ether(src=3D"%s", > dst=3D"%s")/IPv6(tc=3D12,hlim=3D34,fl=3D0x98765)/UDP()/Raw(load=3D"XXXXXX= XXXX")' % > (self.src_mac, self.dst_mac) > + out =3D self.send_pkts_and_get_output(pkts_str) > + 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") > + pkts_str =3D 'Ether(src=3D"%s", > dst=3D"%s")/IP()/TCP(flags=3D"AS")/Raw(load=3D"XXXXXXXXXX")' % (self.src_= mac, > self.dst_mac) > + out =3D self.send_pkts_and_get_output(pkts_str) > + 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") > + pkts_str =3D 'Ether(src=3D"%s", > dst=3D"%s")/IPv6()/TCP(flags=3D"S")/Raw(load=3D"XXXXXXXXXX")' % (self.src= _mac, > self.dst_mac) > + out =3D self.send_pkts_and_get_output(pkts_str) > + 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 > + pkts_str =3D > 'Ether(dst=3D"%s")/IP(src=3D"192.168.0.1",dst=3D"192.168.0.2",tos=3D23,tt= l=3D98)/UDP()/Ra > w(load=3D"XXXXXXXXXX")' % (self.dst_mac) > + out1 =3D self.send_pkts_and_get_output(pkts_str) > + 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 > + pkts_str =3D "Ether(src=3D'%s', dst=3D'%s')/IPv6(src=3D'2001::3'= , dst=3D'2001::4', > tc=3D12,hlim=3D34,fl=3D0x98765)/UDP()/Raw(load=3D'XXXXXXXXXX')" % (self.s= rc_mac, > self.dst_mac) > + out2 =3D self.send_pkts_and_get_output(pkts_str) > + 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 > + pkts_str =3D 'Ether(dst=3D"%s")/IP(src=3D"192.168.0.1", > dst=3D"192.168.0.2")/TCP(flags=3D"AS", dport=3D23, > sport=3D25)/Raw(load=3D"XXXXXXXXXX")' % (self.dst_mac) > + out3 =3D self.send_pkts_and_get_output(pkts_str) > + 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