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 A6C35A04FA; Wed, 8 Jan 2020 09:25:03 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7FD691D6B0; Wed, 8 Jan 2020 09:25:03 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 345B51C219 for ; Wed, 8 Jan 2020 09:25:01 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Jan 2020 00:25:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,409,1571727600"; d="scan'208";a="225856011" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga001.fm.intel.com with ESMTP; 08 Jan 2020 00:25:00 -0800 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 8 Jan 2020 00:25:00 -0800 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 8 Jan 2020 00:24:59 -0800 Received: from shsmsx154.ccr.corp.intel.com (10.239.6.54) by fmsmsx608.amr.corp.intel.com (10.18.126.88) 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, 8 Jan 2020 00:24:59 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.245]) by SHSMSX154.ccr.corp.intel.com ([169.254.7.132]) with mapi id 14.03.0439.000; Wed, 8 Jan 2020 16:24:57 +0800 From: "Peng, Yuan" To: "Yao, BingX Y" , "dts@dpdk.org" CC: "Yao, BingX Y" , "Peng, Yuan" Thread-Topic: [dts] [PATCH V1] add suite qos meter Thread-Index: AQHVxfzLWSphAnvdZUaCJ1bjQBF1FKfgbhzw Date: Wed, 8 Jan 2020 08:24:57 +0000 Message-ID: <67D543A150B29E4CAAE53918F64EDAEA377CD876@SHSMSX103.ccr.corp.intel.com> References: <1578472076-145296-1-git-send-email-bingx.y.yao@intel.com> In-Reply-To: <1578472076-145296-1-git-send-email-bingx.y.yao@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZjE3YjhiODgtYTc5OS00YzY1LTkzZGUtNWU4MzEzMTBlNWJmIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiVTZyNnk0MVwvYVVXNThqYUJUTFpcL3BCaGNGQklveCtKQkFJZ2VCUGdZa0hzeGNWNEJWSHRDOHFBOWFjdVhXSldEIn0= x-ctpclassification: CTP_NT 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] add suite qos meter 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 Peng, Yuan -----Original Message----- From: dts On Behalf Of yaobing Sent: Wednesday, January 8, 2020 4:28 PM To: dts@dpdk.org Cc: Yao, BingX Y Subject: [dts] [PATCH V1] add suite qos meter add suite Signed-off-by: yaobing --- tests/TestSuite_qos_meter.py | 159 +++++++++++++++++++++++++++++++++++ 1 file changed, 159 insertions(+) create mode 100644 tests/TestSuite_qos_meter.py diff --git a/tests/TestSuite_qos_meter.py b/tests/TestSuite_qos_meter.py ne= w file mode 100644 index 0000000..aa38936 --- /dev/null +++ b/tests/TestSuite_qos_meter.py @@ -0,0 +1,159 @@ +# BSD LICENSE +# +# Copyright(c) <2011-2019> Intel Corporation. All rights reserved. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without #=20 +modification, are permitted provided that the following conditions #=20 +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 #=20 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT #=20 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR #=20 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT #=20 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, #=20 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT #=20 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, #=20 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY #=20 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT #=20 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE #=20 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +""" +DPDK Test suite. +Test QOS API in DPDK. +The DUT must have two 10G Ethernet ports connected to two ports of IXIA. +""" +import os +from test_case import TestCase +from settings import HEADER_SIZE +from pktgen import PacketGeneratorHelper + + +class TestQosMeter(TestCase): + + def set_up_all(self): + """ + ip_fragmentation Prerequisites + """ + + # Based on h/w type, choose how many ports to use + ports =3D self.dut.get_ports() + self.dut_ports =3D self.dut.get_ports(self.nic) + self.tx_port =3D self.tester.get_local_port(self.dut_ports[0]) + self.rx_port =3D self.tester.get_local_port(self.dut_ports[1]) + + # Verify that enough ports are available + self.verify(len(ports) >=3D 2, "Insufficient ports for testing") + self.output_path =3D '/tmp' + out =3D self.tester.send_expect('ls -d %s' % self.output_path, '# = ') + if 'No such file or directory' in out: + self.tester.send_expect('mkdir -p %s' % self.output_path, '# '= ) + # create an instance to set stream field setting + self.pktgen_helper =3D PacketGeneratorHelper() + + def set_up(self): + """ + Run before each test case. + """ + pass + + def build_app_and_send_package(self): + """ + Build app and send pkt + Return bps and pps + """ + + self.dut.send_expect('rm -rf ./examples/qos_meter/build',"#") + out =3D self.dut.build_dpdk_apps("./examples/qos_meter") + self.verify("Error" not in out, "Compilation error") + self.verify("No such" not in out, "Compilation error") + self.dut.send_expect('./examples/qos_meter/build/qos_meter --file-= prefix=3Dqos_meter -c 1 -n 4 -- -p 0x3 ', "TX =3D 1") + payload_size =3D 64 - HEADER_SIZE['eth'] - HEADER_SIZE['ip'] + pcap =3D os.sep.join([self.output_path, "tester.pcap"]) + flow =3D 'Ether()/IP()/Raw("x"*%s)' % payload_size + self.tester.scapy_append('wrpcap("%s", [%s])' % (pcap, flow)) + self.tester.scapy_execute() + + tgenInput =3D [] + tgenInput.append([self.tx_port, self.rx_port, pcap]) + tgenInput.append([self.rx_port, self.tx_port, pcap]) + + self.tester.scapy_execute() + self.tester.pktgen.clear_streams() + streams =3D self.pktgen_helper.prepare_stream_from_tginput(tgenInp= ut, 1388000, None, self.tester.pktgen) + bps, pps =3D self.tester.pktgen.measure_throughput(stream_ids=3Dst= reams) + self.dut.send_expect('^C', '#') + return bps,pps + + def test_perf_srTCM_blind_RED(self): + """ + srTCM blind red + """ + self.dut.send_expect(r"sed -i -e '/#define APP_PKT_COLOR_POS/s/[0-= 9]/5/g' ./examples/qos_meter/main.c", "#") + self.dut.send_expect(r"sed -i -e '/^#define APP_MODE /s/APP_MODE_*= /APP_MODE_SRTCM_COLOR_BLIND/2' ./examples/qos_meter/main.c", "#") + bps,pps =3D self.build_app_and_send_package() + difference_value =3D pps - 13880000 + self.verify(-1388000 < difference_value <1388000,"throughput=20 + validation failure") + + def test_perf_srTCM_blind_GREEN(self): + """ + srTCM blind GREEN + """ + self.dut.send_expect(r"sed -i -e '/#define APP_PKT_COLOR_POS/s/[0-= 9]/3/g' ./examples/qos_meter/main.c", "#") + self.dut.send_expect(r"sed -i -e '/^#define APP_MODE /s/APP_MODE_*= /APP_MODE_SRTCM_COLOR_BLIND/2' ./examples/qos_meter/main.c", "#") + bps, pps=3D self.build_app_and_send_package() + difference_value =3D pps - 14880000 + self.verify(-1488000 < difference_value <1488000,"throughput=20 + validation failure") + + def test_perf_srTCM_aware_RED(self): + """ + srTCM aware RED + """ + self.dut.send_expect(r"sed -i -e '/#define APP_PKT_COLOR_POS/s/[0-= 9]/5/g' ./examples/qos_meter/main.c", "#") + self.dut.send_expect(r"sed -i -e '/^#define APP_MODE /s/APP_MODE_*= /APP_MODE_SRTCM_COLOR_AWARE/2' ./examples/qos_meter/main.c", "#") + bps, pps=3D self.build_app_and_send_package() + difference_value =3D pps - 14880000 + self.verify(-1488000 < difference_value <1488000,"throughput=20 + validation failure") + + def test_perf_trTCM_blind(self): + """ + trTCM blind + """ + self.dut.send_expect(r"sed -i -e '/#define APP_PKT_COLOR_POS/s/[0-= 9]/5/g' ./examples/qos_meter/main.c", "#") + self.dut.send_expect(r"sed -i -e '/^#define APP_MODE /s/APP_MODE_*= /APP_MODE_TRTCM_COLOR_BLIND/2' ./examples/qos_meter/main.c", "#") + bps, pps =3D self.build_app_and_send_package() + difference_value =3D pps - 13880000 + self.verify(-1388000 < difference_value <1388000,"throughput=20 + validation failure") + + def test_perf_trTCM_aware(self): + """ + trTCM aware + """ + self.dut.send_expect(r"sed -i -e '/#define APP_PKT_COLOR_POS/s/[0-= 9]/5/g' ./examples/qos_meter/main.c", "#") + self.dut.send_expect(r"sed -i -e '/^#define APP_MODE /s/APP_MODE_*= /APP_MODE_TRTCM_COLOR_AWARE/2' ./examples/qos_meter/main.c", "#") + bps, pps =3D self.build_app_and_send_package() + difference_value =3D pps - 14880000 + self.verify(-1488000 < difference_value <1488000,"throughput=20 + validation failure") + + def tear_down(self): + """ + Run after each test case. + """ + self.dut.send_expect('^C', '#') + + def tear_down_all(self): + """ + Run after each test suite. + """ + self.dut.send_expect('^C', '#') -- 2.17.2