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 A3EE1A04A3; Mon, 4 Nov 2019 03:55:09 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8D0C04C74; Mon, 4 Nov 2019 03:55:09 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 741871BE0 for ; Mon, 4 Nov 2019 03:55:08 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Nov 2019 18:55:07 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,265,1569308400"; d="scan'208";a="195315857" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga008.jf.intel.com with ESMTP; 03 Nov 2019 18:55:07 -0800 Received: from fmsmsx155.amr.corp.intel.com (10.18.116.71) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 3 Nov 2019 18:55:07 -0800 Received: from shsmsx105.ccr.corp.intel.com (10.239.4.158) by FMSMSX155.amr.corp.intel.com (10.18.116.71) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 3 Nov 2019 18:55:06 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.213]) by SHSMSX105.ccr.corp.intel.com ([169.254.11.225]) with mapi id 14.03.0439.000; Mon, 4 Nov 2019 10:55:05 +0800 From: "Tu, Lijuan" To: "Zeng, XiaoxiaoX" , "dts@dpdk.org" CC: "Zeng, XiaoxiaoX" Thread-Topic: [dts] [PATCH V2] tests/flow_filtering complete automation of flow_filtering Thread-Index: AQHVjsulii/ZJLJ52EGhke1cWQz39Kd6WOVg Date: Mon, 4 Nov 2019 02:55:05 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BB5D39C@SHSMSX101.ccr.corp.intel.com> References: <20191030144132.12559-1-xiaoxiaox.zeng@intel.com> In-Reply-To: <20191030144132.12559-1-xiaoxiaox.zeng@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-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNjZhMzg5ZDMtYzA2MC00MGQzLTliZDMtYWFjOTUxYmQ5ZWNmIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiWHlUQUFXbHFYZzlZUzlNelhCbVk5NExGU0lIKzR0QjBFMlU2Nmg2SFo0ckpFYUE4Z2tDdTlEQ3U3eDBJaFUwTSJ9 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 V2] tests/flow_filtering complete 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" Applied, thanks > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Xiaoxiao Zeng > Sent: Wednesday, October 30, 2019 10:42 PM > To: dts@dpdk.org > Cc: Zeng, XiaoxiaoX > Subject: [dts] [PATCH V2] tests/flow_filtering complete automation of > flow_filtering >=20 > *.automation of flow_filtering according to the test_plan. >=20 > Signed-off-by: Xiaoxiao Zeng > --- > tests/TestSuite_flow_filtering.py | 110 ++++++++++++++++++++++++++++++ > 1 file changed, 110 insertions(+) > create mode 100644 tests/TestSuite_flow_filtering.py >=20 > diff --git a/tests/TestSuite_flow_filtering.py > b/tests/TestSuite_flow_filtering.py > new file mode 100644 > index 0000000..242d321 > --- /dev/null > +++ b/tests/TestSuite_flow_filtering.py > @@ -0,0 +1,110 @@ > +# BSD LICENSE > +# > +# Copyright(c) <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. > + > +import os > +import utils > +import time > +import re > +import os > +import packet > +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) > + self.dts_mac =3D self.dut.get_mac_address(self.dut_ports[0]) > + self.txitf =3D > self.tester.get_interface(self.tester.get_local_port(self.dut_ports[0])) > + # Verify that enough ports are available > + self.verify(len(self.dut_ports) >=3D 1, "Insufficient ports for = testing") > + 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. > + """ > + self.dut.send_expect("./examples/flow_filtering/build/flow -l 1 > + -n 1", "initializing port", 100) > + > + def send_packet(self, pkg): > + """ > + Send packets according to parameters. > + """ > + self.pkt =3D packet.Packet() > + for packet_type in pkg.keys(): > + self.pkt.append_pkt(pkg[packet_type]) > + self.pkt.send_pkt(crb=3Dself.tester, tx_port=3Dself.txitf, count= =3D1) > + > + time.sleep(2) > + > + def check_flow_queue(self): > + ''' > + Get dut flow result > + ''' > + result =3D self.dut.get_session_output(timeout=3D2) > + if str.upper(self.dts_mac) in result: > + self.verify("queue" in result, "Dut receive flow failed!") > + queue_result =3D re.findall(r"queue=3D(\S+)", result) > + return queue_result > + else: > + raise Exception("Dut not receive correct package!") > + > + def test_flow_filtering_match_rule(self): > + pkg =3D {'IP/src1': 'Ether(dst=3D"%s")/IP(src=3D"0.0.0.0", > dst=3D"192.168.1.1")/Raw("x"*20)' % self.dts_mac, > + 'IP/src2': 'Ether(dst=3D"%s")/IP(src=3D"0.0.0.1", > dst=3D"192.168.1.1")/Raw("x"*20)' % self.dts_mac} > + self.send_packet(pkg) > + queue_list =3D self.check_flow_queue() > + self.verify(len(queue_list) =3D=3D 2, "Dut receive flow queue er= ror!") > + self.verify(queue_list[0] =3D=3D queue_list[1] and queue_list[0]= =3D=3D > + "0x1", "Flow filter not match rule!") > + > + def test_flow_filtering_dismatch_rule(self): > + pkg =3D {'IP/dst': '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 "0= x0", > + "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