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 62D7CA04F0; Mon, 13 Jan 2020 03:43:01 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0AC881D578; Mon, 13 Jan 2020 03:43:01 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 74E251D567 for ; Mon, 13 Jan 2020 03:42:59 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Jan 2020 18:42:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,427,1571727600"; d="scan'208";a="218552339" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga007.fm.intel.com with ESMTP; 12 Jan 2020 18:42:58 -0800 Received: from shsmsx606.ccr.corp.intel.com (10.109.6.216) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 12 Jan 2020 18:42:58 -0800 Received: from shsmsx603.ccr.corp.intel.com (10.109.6.143) by SHSMSX606.ccr.corp.intel.com (10.109.6.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 13 Jan 2020 10:42:56 +0800 Received: from shsmsx603.ccr.corp.intel.com ([10.109.6.143]) by SHSMSX603.ccr.corp.intel.com ([10.109.6.143]) with mapi id 15.01.1713.004; Mon, 13 Jan 2020 10:42:56 +0800 From: "Ma, LihongX" To: "Yao, BingX Y" , "dts@dpdk.org" CC: "Yao, BingX Y" Thread-Topic: [dts] [PATCH V2] add suite qos meter Thread-Index: AQHVybnfAUXoH9uL502cECRWW2Xs5afn4svA Date: Mon, 13 Jan 2020 02:42:56 +0000 Message-ID: <8321791a2b914bb3adc375444bb3e965@intel.com> References: <1578883129-98603-1-git-send-email-bingx.y.yao@intel.com> In-Reply-To: <1578883129-98603-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-originating-ip: [10.239.127.36] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dts] [PATCH V2] 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" Tested-by: ma,lihong -----Original Message----- From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of yaobing Sent: Monday, January 13, 2020 10:39 AM To: dts@dpdk.org Cc: Yao, BingX Y Subject: [dts] [PATCH V2] add suite qos meter V1: add suite V2: change method group package Signed-off-by: yaobing --- tests/TestSuite_qos_meter.py | 170 +++++++++++++++++++++++++++++++++++ 1 file changed, 170 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..062de81 --- /dev/null +++ b/tests/TestSuite_qos_meter.py @@ -0,0 +1,170 @@ +# BSD LICENSE +# +# Copyright(c) <2019-2020> 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 TRANSMIT_CONT +from pmd_output import PmdOutput +from packet import Packet + + +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]) + self.pmdout =3D PmdOutput(self.dut) + + # Verify that enough ports are available + self.verify(len(ports) >=3D 2, "Insufficient ports for testing") + + #get data from https://doc.dpdk.org/guides/sample_app_ug/qos_meter= ing.html + self.blind_pps =3D 14880000 + self.aware_pps =3D 13880000 + + 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") + eal_params =3D self.dut.create_eal_parameters(cores=3D'1S/1C/1T', = fixed_prefix=3DTrue, prefix=3D'qos_meter') + cmd =3D './examples/qos_meter/build/qos_meter ' + eal_params + '--= -p 0x3' + self.dut.send_expect(cmd, "TX =3D 1") + payload_size =3D 64 - HEADER_SIZE['eth'] - HEADER_SIZE['ip'] + dts_mac =3D self.dut.get_mac_address(self.dut_ports[self.rx_port]) + pkt =3D Packet(pkt_type=3D'IP_RAW') + pkt.save_pcapfile(self.tester, "%s/tester.pcap" % self.tester.tmp_= file) + stream_option =3D { + 'pcap': "%s/tester.pcap" % self.tester.tmp_file, + 'stream_config': { + 'rate': 100, + 'transmit_mode': TRANSMIT_CONT, + } + } + self.tester.pktgen.clear_streams() + stream_ids =3D [] + stream_id =3D self.tester.pktgen.add_stream(self.tx_port, self.rx_= port, "%s/tester.pcap" % self.tester.tmp_file) + self.tester.pktgen.config_stream(stream_id,stream_option) + stream_ids.append(stream_id) + stream_id =3D self.tester.pktgen.add_stream(self.rx_port, self.tx_= port, "%s/tester.pcap" % self.tester.tmp_file) + self.tester.pktgen.config_stream(stream_id, stream_option) + stream_ids.append(stream_id) + traffic_opt =3D { + 'method': 'throughput', + 'rate': 100, + 'duration': 20 + } + bps, pps =3D self.tester.pktgen.measure(stream_ids, traffic_opt) + return bps, pps + + def verify_throughput(self, throughput, pps): + difference_value =3D throughput - pps + #performance data is allowed to float by 10% + self.verify(- pps*0.1 < difference_value < pps*0.1, "throughput=20 + validation failure") + + 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() + self.verify_throughput(pps, self.aware_pps) + + 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() + self.verify_throughput(pps, self.blind_pps) + + 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() + self.verify_throughput(pps, self.blind_pps) + + 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() + self.verify_throughput(pps, self.aware_pps) + + 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() + self.verify_throughput(pps, self.blind_pps) + + def tear_down(self): + """ + Run after each test case. + """ + self.dut.kill_all() + + def tear_down_all(self): + """ + Run after each test suite. + """ + self.dut.kill_all() -- 2.17.2