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 B5373A32A2 for ; Fri, 25 Oct 2019 03:47:38 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 78E071E8E2; Fri, 25 Oct 2019 03:47:38 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 77D872BE9 for ; Fri, 25 Oct 2019 03:47:37 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Oct 2019 18:47:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,226,1569308400"; d="scan'208";a="192384425" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga008.jf.intel.com with ESMTP; 24 Oct 2019 18:47:35 -0700 Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 24 Oct 2019 18:47:34 -0700 Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 24 Oct 2019 18:47:33 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Thu, 24 Oct 2019 18:47:33 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.96]) by shsmsx102.ccr.corp.intel.com ([169.254.2.176]) with mapi id 14.03.0439.000; Fri, 25 Oct 2019 09:47:31 +0800 From: "Ma, LihongX" To: "Zeng, XiaoxiaoX" , "dts@dpdk.org" CC: "Zeng, XiaoxiaoX" Thread-Topic: [dts] [PATCH V1] tests/flow_filtering: automation of flow_filtering Thread-Index: AQHVijcqZqEIBczGAUiq+tIEoGg5fadqk2wg Date: Fri, 25 Oct 2019 01:47:31 +0000 Message-ID: References: <20191024184851.30631-1-xiaoxiaox.zeng@intel.com> In-Reply-To: <20191024184851.30631-1-xiaoxiaox.zeng@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: 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/flow_filtering: automation of flow_filtering 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" Hi, xiaoxiao I have some comments as below. BR lihong -----Original Message----- From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Xiaoxiao Zeng Sent: Friday, October 25, 2019 2:49 AM To: dts@dpdk.org Cc: Zeng, XiaoxiaoX Subject: [dts] [PATCH V1] tests/flow_filtering: automation of flow_filterin= g *.add automation scripts according to flow_filtering test plan Signed-off-by: Xiaoxiao Zeng --- tests/TestSuite_flow_filtering.py | 110 ++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 tests/TestSuite_flow_filtering.py diff --git a/tests/TestSuite_flow_filtering.py b/tests/TestSuite_flow_filte= ring.py new file mode 100644 index 0000000..60511dc --- /dev/null +++ b/tests/TestSuite_flow_filtering.py @@ -0,0 +1,110 @@ +# BSD LICENSE +# Lihong: change 2010-2019 to <2019> +# Copyright(c) 2010-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. + +import os +import utils +import time +import re +import os +from test_case import TestCase +from settings import HEADER_SIZE + + +class TestFlowFiltering(TestCase): + + def set_up_all(self): + """ + Run before each test suite + """ + # initialize ports topology + self.dut_ports =3D self.dut.get_ports(self.nic) + # Verify that enough ports are available + self.verify(len(self.dut_ports) >=3D 1, "Insufficient ports for te= sting") Lihong: the command is useless, because framework have set this command + self.dut.send_expect("export RTE_SDK=3D`pwd`", "#") + out =3D self.dut.build_dpdk_apps("./examples/flow_filtering/") + self.verify('Error' not in out, "Compilation failed") + + def set_up(self): + """ + Run before each test case. + """ Lihong: the self.dts_mac is fixed, so I think you can put this value in set= _up_all + self.dts_mac =3D self.dut.get_mac_address(self.dut_ports[0]) + self.dut.send_expect("./examples/flow_filtering/build/flow -l 1=20 + -n 1", "initializing port", 100) + + + def send_packet(self, pkg): + """ + Send packets according to parameters. + """ Lihong: please use the Packet method to send pkt + txitf =3D=20 + self.tester.get_interface(self.tester.get_local_port(self.dut_ports[0] + )) + + self.tester.scapy_foreground() + self.tester.scapy_append('sendp(%s, iface=3D"%s")' % (pkg, txitf)) + self.tester.scapy_execute() + time.sleep(3) + + def check_flow_queue(self): + ''' + Get dut flow result + ''' Lihong: the default timeout of function get_session_ouput is 15s, in this s= uite, I think timeout=3D2 is enough, 15s will too long. + result =3D self.dut.get_session_output() + self.verify("queue" in result, "Dut receive flow failed!") + queue_result =3D re.findall(r"queue=3D(\S+)", result) + return queue_result + + def test_flow_filtering_match_rule(self): + + pkg_list =3D ['Ether(dst=3D"%s")/IP(src=3D"0.0.0.0", dst=3D"192.16= 8.1.1")/Raw("x"*20)' % self.dts_mac, + 'Ether(dst=3D"%s")/IP(src=3D"0.0.0.1", dst=3D"192.168.= 1.1")/Raw("x"*20)' % self.dts_mac] + for pkg in pkg_list: + self.send_packet(pkg) + + queue_list =3D self.check_flow_queue() + self.verify(len(queue_list) =3D=3D 2, "Dut receive flow queue erro= r!") + self.verify(queue_list[0] =3D=3D queue_list[1] and queue_list[0] = =3D=3D=20 + "0x1", "Flow filter not match rule!") + + def test_flow_filtering_dismatch_rule(self): + pkg =3D 'Ether(dst=3D"%s")/IP(src=3D"0.0.0.0", dst=3D"192.168.1.2"= )/Raw("x"*20)' % self.dts_mac + self.send_packet(pkg) + queue_list =3D self.check_flow_queue() + self.verify(len(queue_list) =3D=3D 1 and queue_list[0] =3D=3D "0x0= ",=20 + "Dismatch rule failed!") + + 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.kill_all() -- 2.17.0