From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id F3D7E5F1D for ; Mon, 18 Feb 2019 03:34:10 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Feb 2019 18:34:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,382,1544515200"; d="scan'208";a="127248126" Received: from unknown (HELO yaolei2.icx.intel.com) ([10.67.118.30]) by orsmga003.jf.intel.com with ESMTP; 17 Feb 2019 18:34:09 -0800 From: Lei To: dts@dpdk.org Cc: Lei Yao Date: Mon, 18 Feb 2019 09:58:45 +0000 Message-Id: <1550483925-69701-1-git-send-email-lei.a.yao@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [dts] [PATCH V1]tests: Add test suite for exception path sample 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: , X-List-Received-Date: Mon, 18 Feb 2019 02:34:11 -0000 From: Lei Yao Add test suite for exception path sample. The first patch will just include the performance test based on Ixia. Signed-off-by: Lei Yao --- tests/TestSuite_exception_path.py | 185 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 185 insertions(+) create mode 100644 tests/TestSuite_exception_path.py diff --git a/tests/TestSuite_exception_path.py b/tests/TestSuite_exception_path.py new file mode 100644 index 0000000..c1cf5a7 --- /dev/null +++ b/tests/TestSuite_exception_path.py @@ -0,0 +1,185 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2019 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. +Test exception path feature. +""" + +import dts +import time +import utils +from test_case import TestCase + + + +class TestExceptionpath(TestCase): + + def set_up_all(self): + """ + Run at the start of each test suite. + + Exception path prerequisites. + """ + + out = self.dut.send_expect("which brctl", "# ") + self.verify('no brctl' not in out, + "The linux tool brctl is needed to run this test suite") + self.verify('error' not in out, "Which brctl: %s" % out) + + self.dut_ports = self.dut.get_ports_performance(self.nic, force_same_socket=False, force_different_nic=False) + self.verify(len(self.dut_ports) >= 2, "Not enough ports available") + self.ports_socket = self.dut.get_numa_id(self.dut_ports[0]) + + out = self.dut.build_dpdk_apps('examples/helloworld') + self.steps = [] + self.steps.append({'cores': '1S/2C/1T', 'ports': 1, 'pps': '', 'bps': ''}) + + # If have enough core available + if(len(self.dut.get_core_list('1S/4C/1T')) == 4): + self.steps.append( + {'cores': '1S/4C/1T', 'ports': 2, 'pps': '', 'bps': ''}) + + def set_up(self): + """ + Run before each test case. + """ + pass + + def test_perf_exceptionpath_performance(self): + """ + Test the exception path performance. + """ + + # We create the pcap files to be sent to the DUT from the traffic + # generator (the second one is only needed in the last two steps) + txPort1 = self.tester.get_local_port(self.dut_ports[0]) + txPort2 = self.tester.get_local_port(self.dut_ports[1]) + + mac1 = self.tester.get_mac(txPort1) + mac2 = self.tester.get_mac(txPort2) + + self.tester.scapy_append('dstmac="ff:ff:ff:ff:ff:ff"') + self.tester.scapy_append('srcmac="%s"' % mac1) + self.tester.scapy_append( + 'wrpcap("excpath1.pcap", [Ether(src=srcmac,dst=dstmac)/Dot1Q(vlan=1)/IP(len=46)/UDP()/("X"*14)])') + self.tester.scapy_append('dstmac="ff:ff:ff:ff:ff:ff"') + self.tester.scapy_append('srcmac="%s"' % mac2) + self.tester.scapy_append( + 'wrpcap("excpath2.pcap", [Ether(src=srcmac,dst=dstmac)/Dot1Q(vlan=1)/IP(len=46)/UDP()/("X"*14)])') + self.tester.scapy_execute() + for n in range(len(self.steps)): + coreList = self.dut.get_core_list( + self.steps[n]['cores'], socket=self.ports_socket) + coreMask = utils.create_mask(coreList) + + if(self.steps[n]['ports'] == 1): + portMask = utils.create_mask([self.dut_ports[0]]) + self.dut.send_expect("./examples/exception_path/build/exception_path -n %d -c %s -- -p %s -i %s -o %s &" % (self.dut.get_memory_channels(), coreMask, portMask, utils.create_mask( + [coreList[1]]), utils.create_mask([coreList[0]])), "APP: Lcore [0-9]+ is reading from tap_dpdk_[0-9]+ and writing to port [0-9]+", 120) + elif(self.steps[n]['ports'] == 2): + portMask = utils.create_mask( + [self.dut_ports[0], self.dut_ports[1]]) + self.dut.send_expect("./examples/exception_path/build/exception_path -n %d -c %s -- -p %s -i %s -o %s &" % (self.dut.get_memory_channels(), coreMask, portMask, utils.create_mask( + [coreList[1], coreList[3]]), utils.create_mask([coreList[0], coreList[2]])), "APP: Lcore [0-9]+ is reading from tap_dpdk_[0-9]+ and writing to port [0-9]+", 120) + + self.dut.send_expect( + "ifconfig tap_dpdk_%02d up" % int(coreList[0]), "# ") + self.dut.send_expect( + "ifconfig tap_dpdk_%02d up" % int(coreList[1]), "# ") + self.dut.send_expect("brctl addbr \"br_dpdk_00\"", "# ") + self.dut.send_expect( + "brctl addif br_dpdk_00 tap_dpdk_%02d" % int(coreList[0]), "# ") + self.dut.send_expect( + "brctl addif br_dpdk_00 tap_dpdk_%02d" % int(coreList[1]), "# ") + self.dut.send_expect("ifconfig br_dpdk_00 up", "# ") + + tgenInput = [] + tgenInput.append((txPort1, txPort1, "excpath1.pcap")) + + if(len(coreList) == 4): + self.dut.send_expect( + "ifconfig tap_dpdk_%02d up" % int(coreList[2]), "# ") + self.dut.send_expect( + "ifconfig tap_dpdk_%02d up" % int(coreList[3]), "# ") + self.dut.send_expect("brctl addbr \"br_dpdk_01\"", "# ") + self.dut.send_expect( + "brctl addif br_dpdk_01 tap_dpdk_%02d" % int(coreList[2]), "# ") + self.dut.send_expect( + "brctl addif br_dpdk_01 tap_dpdk_%02d" % int(coreList[3]), "# ") + self.dut.send_expect("ifconfig br_dpdk_01 up", "# ") + tgenInput.append((txPort2, txPort2, "excpath2.pcap")) + + time.sleep(5) + bps, pps = self.tester.traffic_generator_throughput(tgenInput) + self.steps[n]['pps'] = pps / 1E6 + self.steps[n]['bps'] = bps + + self.dut.send_expect("ifconfig br_dpdk_00 down", "# ") + self.dut.send_expect("brctl delbr \"br_dpdk_00\"", "# ") + + if(len(coreList) == 4): + self.dut.send_expect("ifconfig br_dpdk_01 down", "# ") + self.dut.send_expect("brctl delbr \"br_dpdk_01\"", "# ") + + self.dut.kill_all() + + for n in range(len(self.steps)): + self.verify(self.steps[n]['pps'] != 0, "No traffic detected") + + # Print results + header = ['Frame Size', 'Ports', 'S/C/T', 'Mpps', + 'Mbps', '% linerate'] + self.result_table_create(header) + + for step in self.steps: + self.result_table_add([64, step['ports'], step['cores'], + step['pps'], + step['bps'] / 1E6, + step[ + 'pps'] * 100 / float(self.wirespeed(self.nic, + 64, 2))] + ) + + self.result_table_print() + + def tear_down(self): + """ + Run after each test case. + """ + pass + + def tear_down_all(self): + """ + Run after each test suite. + """ + pass -- 2.7.4