From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id E0D9FA00E6 for ; Wed, 12 Jun 2019 10:22:09 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A66C11D35F; Wed, 12 Jun 2019 10:22:09 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id A7C1D1C419 for ; Wed, 12 Jun 2019 10:22:07 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Jun 2019 01:22:06 -0700 X-ExtLoop1: 1 Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga006.fm.intel.com with ESMTP; 12 Jun 2019 01:22:05 -0700 Received: from fmsmsx156.amr.corp.intel.com (10.18.116.74) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 12 Jun 2019 01:22:06 -0700 Received: from shsmsx105.ccr.corp.intel.com (10.239.4.158) by fmsmsx156.amr.corp.intel.com (10.18.116.74) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 12 Jun 2019 01:22:05 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.104]) by SHSMSX105.ccr.corp.intel.com ([169.254.11.72]) with mapi id 14.03.0439.000; Wed, 12 Jun 2019 16:22:04 +0800 From: "Tu, Lijuan" To: "Zhao, MeijuanX" , "dts@dpdk.org" CC: "Zhao, MeijuanX" Thread-Topic: [dts] [PATCH V1] tests add new testsuite vxlan gpe support in i40e Thread-Index: AQHVG05thNzvqb97xkC71riSZE5L2qaXuSiQ Date: Wed, 12 Jun 2019 08:22:03 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BABB9A1@SHSMSX101.ccr.corp.intel.com> References: <20190605112612.23599-1-meijuanx.zhao@intel.com> In-Reply-To: <20190605112612.23599-1-meijuanx.zhao@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.0.600.7 dlp-reaction: no-action x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMDE2N2NhNzYtOTJmMS00ODg1LWJiNzMtNTk2ZWI0MmExMWVmIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiQ216NDlQak83OFVtelJHWWNJck9BQjZyR25RQ0ZTaTdTYzQ2RVR1dWYxcTJ0UU9sanpLTytXdzRYWXdqSE9xTSJ9 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 add new testsuite vxlan gpe support in i40e 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 zhaomeijuan > Sent: Wednesday, June 5, 2019 7:26 PM > To: dts@dpdk.org > Cc: Zhao, MeijuanX > Subject: [dts] [PATCH V1] tests add new testsuite vxlan gpe support in i4= 0e >=20 > Signed-off-by: zhaomeijuan > --- > tests/TestSuite_vxlan_gpe_support_in_i40e.py | 320 +++++++++++++++++++ > 1 file changed, 320 insertions(+) > create mode 100644 tests/TestSuite_vxlan_gpe_support_in_i40e.py >=20 > diff --git a/tests/TestSuite_vxlan_gpe_support_in_i40e.py > b/tests/TestSuite_vxlan_gpe_support_in_i40e.py > new file mode 100644 > index 0000000..f87c541 > --- /dev/null > +++ b/tests/TestSuite_vxlan_gpe_support_in_i40e.py > @@ -0,0 +1,320 @@ > +# 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. > + > +""" > +DPDK Test suite. > + > +Test VXLAN-GPE behaviour in DPDK. > + > +""" > + > +import utils > +import os > +import re > +from pmd_output import PmdOutput > +from scapy.utils import wrpcap, rdpcap > +from scapy.layers.inet import Ether, IP, UDP from scapy.layers.l2 > +import Dot1Q from vxlan import Vxlan from scapy.config import conf from > +test_case import TestCase from settings import FOLDERS > + > +# > +# > +# Test class. > +# > + > +VXLAN_GPE_PORT =3D 4790 > + > + > +class VxlanGpeTestConfig(object): > + > + """ > + Module for config/create/transmit vxlan packet > + """ > + > + def __init__(self, test_case, **kwargs): > + self.test_case =3D test_case > + self.init() > + for name in kwargs: > + setattr(self, name, kwargs[name]) > + > + def init(self): > + self.packets_config() > + > + def packets_config(self): > + """ > + Default vxlan packet format > + """ > + self.pcap_file =3D '/root/vxlan_gpe.pcap' > + self.outer_mac_dst =3D '11:22:33:44:55:66' > + self.outer_ip_dst =3D '192.168.1.2' > + self.outer_udp_dst =3D VXLAN_GPE_PORT > + self.vni =3D 1 > + self.inner_mac_dst =3D '00:00:20:00:00:01' > + self.inner_vlan =3D 'N/A' > + self.inner_ip_dst =3D '192.168.2.2' > + self.payload_size =3D 18 > + > + def create_pcap(self): > + """ > + Create pcap file and copy it to tester > + """ > + self.inner_payload =3D ("X" * self.payload_size) > + > + if self.inner_vlan !=3D 'N/A': > + inner =3D Ether() / Dot1Q() / IP() / UDP() / self.inner_payl= oad > + inner[Dot1Q].vlan =3D self.inner_vlan > + else: > + inner =3D Ether() / IP() / UDP() / self.inner_payload > + > + inner[IP().name].dst =3D self.inner_ip_dst > + > + inner[Ether].dst =3D self.inner_mac_dst > + > + outer =3D Ether() / IP() / UDP() > + > + outer[Ether].dst =3D self.outer_mac_dst > + > + outer[IP().name].dst =3D self.outer_ip_dst > + > + outer[UDP].dport =3D self.outer_udp_dst > + > + if self.outer_udp_dst =3D=3D VXLAN_GPE_PORT: > + self.pkt =3D outer / Vxlan(vni=3Dself.vni) / inner > + else: > + self.pkt =3D outer / ("X" * self.payload_size) > + > + wrpcap(self.pcap_file, self.pkt) > + > + def send_pcap(self, iface=3D""): > + """ > + Send vxlan pcap file by iface > + """ > + # load vxlan module to scapy > + cwd =3D os.getcwd() > + dir_vxlan_module =3D cwd + r'/' + FOLDERS['Depends'] > + self.test_case.tester.scapy_append("sys.path.append('%s')" % > dir_vxlan_module) > + self.test_case.tester.scapy_append("from vxlan import Vxlan") > + self.test_case.tester.scapy_append( > + 'pcap =3D rdpcap("%s")' % self.pcap_file) > + self.test_case.tester.scapy_append( > + 'sendp(pcap, iface=3D"%s")' % iface) > + self.test_case.tester.scapy_execute() > + > + > +class TestVxlanGpeSupportInI40e(TestCase): > + > + def set_up_all(self): > + """ > + vxlan Prerequisites > + """ > + # this feature only enable in FVL now > + if self.nic not in ["fortville_eagle", "fortville_spirit", > "fortville_spirit_single", "fortville_25g"]: > + self.verify(False, "%s not support this vxlan-gpe" % self.ni= c) > + # Based on h/w type, choose how many ports to use > + ports =3D self.dut.get_ports() > + > + # Verify that enough ports are available > + self.verify(len(ports) >=3D 2, "Insufficient ports for testing") > + global valports > + valports =3D [_ for _ in ports if self.tester.get_local_port(_) > + !=3D -1] > + > + self.portMask =3D utils.create_mask(valports[:2]) > + > + # Verify that enough threads are available > + netdev =3D self.dut.ports_info[ports[0]]['port'] > + self.ports_socket =3D netdev.socket > + cores =3D self.dut.get_core_list("all", socket=3Dself.ports_sock= et) > + self.verify(cores is not None, "Insufficient cores for speed tes= ting") > + self.coremask =3D utils.create_mask(cores) > + > + # start testpmd > + self.pmdout =3D PmdOutput(self.dut) > + > + # init port config > + self.dut_port =3D valports[0] > + self.dut_port_mac =3D self.dut.get_mac_address(self.dut_port) > + tester_port =3D self.tester.get_local_port(self.dut_port) > + self.tester_iface =3D self.tester.get_interface(tester_port) > + > + def set_up(self): > + """ > + Run before each test case. > + """ > + pass > + > + def filter_and_check(self, filter_type=3D"imac-ivlan", queue_id=3D3, > + vlan=3DFalse, remove=3DFalse): > + """ > + send vxlan packet and check whether receive packet in assigned q= ueue > + """ > + if vlan is not False: > + config =3D VxlanGpeTestConfig(self, inner_vlan=3Dvlan) > + vlan_id =3D vlan > + else: > + config =3D VxlanGpeTestConfig(self) > + vlan_id =3D 1 > + > + # now cloud filter will default enable L2 mac filter, so dst mac= must > + # be same > + config.outer_mac_dst =3D self.dut_port_mac > + > + args =3D [self.dut_port, config.outer_mac_dst, config.inner_mac_= dst, > + config.inner_ip_dst, vlan_id, filter_type, config.vni, > + queue_id] > + > + self.tunnel_filter_add(*args) > + > + # invalid case request to remove tunnel filter > + if remove is True: > + queue_id =3D 0 > + args =3D [self.dut_port, config.outer_mac_dst, config.inner_= mac_dst, > + config.inner_ip_dst, vlan_id, filter_type, config.vn= i, > + queue_id] > + self.tunnel_filter_del(*args) > + > + # send vxlan packet > + config.create_pcap() > + self.dut.send_expect("start", "testpmd>", 10) > + config.send_pcap(self.tester_iface) > + out =3D self.dut.get_session_output(timeout=3D2) > + > + queue =3D -1 > + pattern =3D re.compile("- Receive queue=3D0x(\d)") > + m =3D pattern.search(out) > + if m is not None: > + queue =3D m.group(1) > + > + # verify received in expected queue > + self.verify(queue_id =3D=3D int(queue), "invalid receive queue") > + > + self.dut.send_expect("stop", "testpmd>", 10) > + > + def test_vxlan_gpe_ipv4_detect(self): > + self.pmdout.start_testpmd('all') > + self.pmdout.execute_cmd('set fwd io') > + self.pmdout.execute_cmd('set verbose 1') > + # add VXLAN-GPE packet type > + self.pmdout.execute_cmd('port config 0 udp_tunnel_port add vxlan= - > gpe %s' % VXLAN_GPE_PORT) > + self.pmdout.execute_cmd('start') > + mac =3D self.pmdout.get_port_mac(0) > + # send one VXLAN-GPE type packet > + packet =3D 'sendp([Ether(dst=3D"%s")/IP(src=3D"18.0.0.1")/UDP(dp= ort=3D%d, > sport=3D43)/' % (mac, VXLAN_GPE_PORT) + \ > + 'VXLAN(flags=3D12)/IP(src=3D"10.0.0.1")], iface=3D"%s",= count=3D1)' % > self.tester_iface > + self.tester.scapy_append(packet) > + self.tester.scapy_execute() > + out =3D self.dut.get_session_output(timeout=3D5) > + print out > + self.verify('L3_IPV4_EXT_UNKNOWN' in out and '%s' % > + VXLAN_GPE_PORT in out, 'no detect vxlan-gpe packet') > + > + # delete the VXLAN-GPE packet type, testpmd should treat the pac= ket > as a normal UDP packet > + self.pmdout.execute_cmd('port config 0 udp_tunnel_port rm vxlan- > gpe %s' % VXLAN_GPE_PORT) > + self.tester.scapy_append(packet) > + self.tester.scapy_execute() > + out =3D self.dut.get_session_output(timeout=3D5) > + print out > + self.pmdout.execute_cmd('quit', '#') > + self.verify('L3_IPV4_EXT_UNKNOWN' in out and '%s' % > + VXLAN_GPE_PORT not in out, 'no detect vxlan-gpe packet') > + > + def test_tunnel_filter_vxlan_gpe(self): > + """ > + verify tunnel filter feature > + """ > + pmd_temp =3D "./%(TARGET)s/app/testpmd -c %(COREMASK)s -n " + \ > + "%(CHANNEL)d -- -i --disable-rss --rxq=3D4 --txq=3D4" + \ > + " --nb-cores=3D4 --portmask=3D%(PORT)s" > + pmd_cmd =3D pmd_temp % {'TARGET': self.target, > + 'COREMASK': self.coremask, > + 'CHANNEL': self.dut.get_memory_channels(), > + 'PORT': self.portMask} > + self.dut.send_expect(pmd_cmd, "testpmd>", 30) > + > + self.dut.send_expect("set fwd rxonly", "testpmd>", 10) > + self.dut.send_expect("set verbose 1", "testpmd>", 10) > + self.enable_vxlan(self.dut_port) > + > + # check inner mac + inner vlan filter can work > + self.filter_and_check(filter_type=3D"imac-ivlan", vlan=3D1) > + # check inner mac + inner vlan + tunnel id filter can work > + self.filter_and_check(filter_type=3D"imac-ivlan-tenid", vlan=3D1= ) > + # check inner mac + tunnel id filter can work > + self.filter_and_check(filter_type=3D"imac-tenid") > + # check inner mac filter can work > + self.filter_and_check(filter_type=3D"imac") > + # check outer mac + inner mac + tunnel id filter can work > + self.filter_and_check(filter_type=3D"omac-imac-tenid") > + # iip not supported by now > + self.filter_and_check(filter_type=3D"iip") > + > + self.dut.send_expect("quit", "#", 10) > + > + def enable_vxlan(self, port): > + self.dut.send_expect("rx_vxlan_port add %d %d" > + % (VXLAN_GPE_PORT, port), > + "testpmd>", 10) > + > + def tunnel_filter_add(self, *args): > + # tunnel_filter add port_id outer_mac inner_mac ip inner_vlan > + # tunnel_type(vxlan) > + # filter_type > + # (imac-ivlan|imac-ivlan-tenid|imac-tenid|imac|omac-imac-tenid|i= ip) > + # tenant_id queue_num > + out =3D self.dut.send_expect("tunnel_filter add %d " % args[0] + > + "%s %s %s " % (args[1], args[2], args= [3]) + > + "%d vxlan-gpe %s " % (args[4], args[5= ]) + > + "%d %d" % (args[6], args[7]), > + "testpmd>", 10) > + self.verify("Bad arguments" not in out, "Failed to add tunnel fi= lter") > + self.verify("error" not in out, "Failed to add tunnel filter") > + > + def tunnel_filter_del(self, *args): > + out =3D self.dut.send_expect("tunnel_filter rm %d " % args[0] + > + "%s %s %s " % (args[1], args[2], args= [3]) + > + "%d vxlan-gpe %s " % (args[4], args[5= ]) + > + "%d %d" % (args[6], args[7]), > + "testpmd>", 10) > + self.verify("Bad arguments" not in out, > + "Failed to remove tunnel filter") > + self.verify("error" not in out, "Failed to remove tunnel > + filter") > + > + def tear_down(self): > + """ > + Run after each test case. > + """ > + self.dut.kill_all() > + > + def tear_down_all(self): > + """ > + Run after each test suite. > + """ > + pass > -- > 2.17.1