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 7695AA04F3; Fri, 3 Jan 2020 04:01:41 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6B7A41C1FC; Fri, 3 Jan 2020 04:01:41 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 009BE1C02D for ; Fri, 3 Jan 2020 04:01:38 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Jan 2020 19:01:38 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,389,1571727600"; d="scan'208";a="252454405" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga002.fm.intel.com with ESMTP; 02 Jan 2020 19:01:38 -0800 Received: from fmsmsx163.amr.corp.intel.com (10.18.125.72) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 2 Jan 2020 19:01:37 -0800 Received: from shsmsx153.ccr.corp.intel.com (10.239.6.53) by fmsmsx163.amr.corp.intel.com (10.18.125.72) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 2 Jan 2020 19:01:36 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.30]) by SHSMSX153.ccr.corp.intel.com ([169.254.12.89]) with mapi id 14.03.0439.000; Fri, 3 Jan 2020 11:01:34 +0800 From: "Tu, Lijuan" To: "Fu, Qi" , "dts@dpdk.org" CC: "Fu, Qi" Thread-Topic: [dts] [PATCH V1] tests/: add test script for rte flow priority Thread-Index: AQHVwTuTwBdpmpCMikaFFIxRkT9SqKfYQblg Date: Fri, 3 Jan 2020 03:01:33 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BBA167D@SHSMSX101.ccr.corp.intel.com> References: <20200102160337.27309-1-qi.fu@intel.com> In-Reply-To: <20200102160337.27309-1-qi.fu@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-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 test script for rte flow priority 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 > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of qifu > Sent: Friday, January 3, 2020 12:04 AM > To: dts@dpdk.org > Cc: Fu, Qi > Subject: [dts] [PATCH V1] tests/: add test script for rte flow priority >=20 > add test script for rte flow priority >=20 > Signed-off-by: qifu > --- > tests/TestSuite_rteflow_priority.py | 373 ++++++++++++++++++++++++++++ > 1 file changed, 373 insertions(+) > create mode 100644 tests/TestSuite_rteflow_priority.py >=20 > diff --git a/tests/TestSuite_rteflow_priority.py > b/tests/TestSuite_rteflow_priority.py > new file mode 100644 > index 0000000..dbea334 > --- /dev/null > +++ b/tests/TestSuite_rteflow_priority.py > @@ -0,0 +1,373 @@ > +# 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 rte_flow priority > +""" > + > +import re > +import time > +import string > +from time import sleep > +from scapy.utils import struct, socket, PcapWriter > + > +import utils > +from etgen import IxiaPacketGenerator > +from test_case import TestCase > +from settings import HEADER_SIZE > +from pmd_output import PmdOutput > +import sys > +reload(sys) > +sys.setdefaultencoding('utf8') > + > + > +class TestRteflowPriority(TestCase): > + > + def set_up_all(self): > + """ > + Run at the start of each test suite. > + > + PMD prerequisites. > + """ > + self.dut_ports =3D self.dut.get_ports(self.nic) > + localPort =3D self.tester.get_local_port(self.dut_ports[0]) > + self.__tx_iface =3D self.tester.get_interface(localPort) > + cores =3D self.dut.get_core_list("1S/5C/1T") > + self.coreMask =3D utils.create_mask(cores) > + self.portMask =3D utils.create_mask([self.dut_ports[0]]) > + > + def set_up(self): > + """ > + Run before each test case. > + """ > + pass > + # > + # Utility methods and other non-test code. > + # > + > ################################################################ > ########### > + scapyCmds =3D [] > + > + def check_link(self): > + # check status in test case, dut and tester both should be up. > + self.pmd_output =3D PmdOutput(self.dut) > + res =3D self.pmd_output.wait_link_status_up('all', timeout=3D30) > + if res is True: > + for i in range(15): > + out =3D self.tester.get_port_status(self.dut_ports[0]) > + if out =3D=3D 'up': > + break > + else: > + time.sleep(1) > + return True > + else: > + return False > + > + def send_pkt(self, cmd): > + """ > + Send packages and verify behavior. > + """ > + self.tester.scapyCmds.append(cmd) > + self.tester.scapy_execute() > + > + def get_packet_number(self, out, match_string): > + """ > + get the rx packets number. > + """ > + > + out_lines=3Dout.splitlines() > + pkt_num=3D0 > + for i in range(len(out_lines)): > + if match_string in out_lines[i]: > + result_scanner=3D(r'RX-packets:\s?(\d+)') > + scanner=3Dre.compile(result_scanner,re.DOTALL) > + m=3Dscanner.search(out_lines[i+1]) > + pkt_num=3Dint(m.group(1)) > + break > + return pkt_num > + > + def check_queue_rx_packets_number(self, out, queue_id): > + """ > + check the queue rx packets number. > + """ > + match_string=3D"------- Forward Stats for RX Port=3D 0/Queue=3D = %d" % > queue_id > + pkt_num=3Dself.get_packet_number(out, match_string) > + return pkt_num > + # > + # test cases. > + # > + > + > ################################################################ > ###### > + ##### > + > + def test_priority_in_pipeline_mode(self): > + """ > + priority is active in pipeline mode. > + """ > + #start testpmd in pipeline mode > + # genarate eal > + command =3D './%s/app/testpmd -c %s -n 4 -w %s,pipeline-mode- > support=3D1 --log-level=3D"ice,7" -- -i --portmask=3D%s --rxq=3D10 --txq= =3D10' % > (self.target, self.coreMask, self.dut.ports_info[0]['pci'], > utils.create_mask([self.dut_ports[0]])) > + out =3D self.dut.send_expect(command, "testpmd> ", 120) > + self.logger.debug(out) > + > + self.dut.send_expect("set fwd rxonly", "testpmd> ", 15) > + self.dut.send_expect("set verbose 1", "testpmd> ", 15) > + self.dut.send_expect("rx_vxlan_port add 4789 0", "testpmd> ", > + 15) > + > + #create fdir and switch rules with different priority > + out=3Dself.dut.send_expect("flow create 0 priority 0 ingress pat= tern eth / > ipv4 src is 192.168.0.2 dst is 192.168.0.3 tos is 4 / tcp src is 25 dst i= s 23 / end > actions queue index 1 / end ", "testpmd>", 15) > + self.verify("Successed" and "(2)" in out, "failed: rule map to w= rong > filter") > + out=3Dself.dut.send_expect("flow create 0 priority 0 ingress pat= tern eth / > ipv4 / udp / vxlan / eth / ipv4 src is 192.168.0.2 dst is 192.168.0.3 tos= is 4 / > udp src is 25 dst is 23 / end actions queue index 2 / end ", "testpmd>", = 15) > + self.verify("Successed" and "(2)" in out, "failed: rule map to w= rong > filter") > + out=3Dself.dut.send_expect("flow create 0 priority 1 ingress pat= tern eth / > ipv4 src is 192.168.0.4 dst is 192.168.0.7 tos is 4 ttl is 20 / tcp src i= s 25 dst is 23 > / end actions queue index 3 / end ", "testpmd>", 15) > + self.verify("Successed" and "(1)" in out, "failed: rule map to w= rong > filter") > + out=3Dself.dut.send_expect("flow create 0 priority 1 ingress pat= tern eth / > ipv4 / udp / vxlan / eth / ipv4 src is 192.168.0.4 dst is 192.168.0.7 / u= dp src is > 25 dst is 23 / end actions queue index 4 / end ", "testpmd>", 15) > + self.verify("Successed" and "(1)" in out, "failed: rule map to w= rong > filter") > + out =3D self.dut.send_expect("flow list 0", "testpmd> ", 15) > + self.logger.info(out) > + self.verify( "3" in out, "failed: flow rules created error") > + > + #send pkts and check the rules are written to different filter t= ables and > the rules can work > + self.dut.send_expect("start", "testpmd>", 20) > + a=3Dself.check_link() > + self.verify(a, "failed: link can not up") > + > self.send_pkt('sendp([Ether(dst=3D"00:00:00:00:01:00",src=3D"11:22:33:44:= 55:66" > )/IP(src=3D"192.168.0.2",dst=3D"192.168.0.3",tos=3D4)/TCP(sport=3D25,dpor= t=3D23)/Ra > w("x"*80)],iface=3D"%s")'%(self.__tx_iface)) > + out=3Dself.dut.send_expect("stop", "testpmd>", 20) > + pkt_num=3Dself.check_queue_rx_packets_number(out, 1) > + self.verify(pkt_num=3D=3D1, "failed: the flow rule can not work"= ) > + self.logger.info('pass: queue id is 1') > + > + self.dut.send_expect("start", "testpmd>", 20) > + > self.send_pkt('sendp([Ether(dst=3D"00:00:00:00:01:00",src=3D"11:22:33:44:= 55:66" > )/IP()/UDP()/VXLAN()/Ether()/IP(src=3D"192.168.0.2",dst=3D"192.168.0.3",t= os=3D4)/ > UDP(sport=3D25,dport=3D23)/Raw("x"*80)],iface=3D"%s")'%(self.__tx_iface)) > + out=3Dself.dut.send_expect("stop", "testpmd>", 20) > + pkt_num=3Dself.check_queue_rx_packets_number(out, 2) > + self.verify(pkt_num=3D=3D1, "failed: the flow rule can not work"= ) > + self.logger.info('pass: queue id is 2') > + > + self.dut.send_expect("start", "testpmd>", 20) > + > self.send_pkt('sendp([Ether(dst=3D"00:00:00:00:01:00",src=3D"11:22:33:44:= 55:66" > )/IP(src=3D"192.168.0.4",dst=3D"192.168.0.7",tos=3D4,ttl=3D20)/TCP(sport= =3D25,dport=3D2 > 3)/Raw("x"*80)],iface=3D"%s")'%(self.__tx_iface)) > + out=3Dself.dut.send_expect("stop", "testpmd>", 20) > + pkt_num=3Dself.check_queue_rx_packets_number(out, 3) > + self.verify(pkt_num=3D=3D1, "failed: the flow rule can not work"= ) > + self.logger.info('pass: queue id is 3') > + > + self.dut.send_expect("start", "testpmd>", 20) > + > self.send_pkt('sendp([Ether(dst=3D"00:00:00:00:01:00",src=3D"11:22:33:44:= 55:66" > )/IP()/UDP()/VXLAN()/Ether()/IP(src=3D"192.168.0.4 > ",dst=3D"192.168.0.7")/UDP(sport=3D25,dport=3D23)/Raw("x"*80)],iface=3D"%= s")'%(s > elf.__tx_iface)) > + out=3Dself.dut.send_expect("stop", "testpmd>", 20) > + pkt_num=3Dself.check_queue_rx_packets_number(out, 4) > + self.verify(pkt_num=3D=3D1, "failed: the flow rule can not work"= ) > + self.logger.info('pass: queue id is 4') > + > + #create rules without priority, only the pattern supported by sw= itch can > be created. > + out=3D self.dut.send_expect("flow create 0 ingress pattern eth /= ipv4 src > is 192.168.1.2 dst is 192.168.0.3 tos is 5 / tcp src is 25 dst is 23 / en= d actions > queue index 1 / end ", "testpmd>", 15) > + self.verify( "Failed" not in out, "failed: default priority 0 is= not work") > + out=3Dself.dut.send_expect("flow create 0 ingress pattern eth / = ipv4 src is > 192.168.0.2 dst is 192.168.0.3 tos is 4 ttl is 20 / sctp src is 25 dst is= 23 / end > actions queue index 1 / end ", "testpmd>", 15) > + self.verify( "Failed" in out, "failed: pattern only support by > + fdir can not be created in default priority") > + > + self.dut.send_expect("flow flush 0", "testpmd>", 20) > + self.dut.send_expect("quit", "#", 50) > + > + def test_priority_in_nonpipeline_mode(self): > + """ > + priority is not active in pipeline mode. > + """ > + > + #start testpmd without pipeline-mode-support parameter, check th= e > testpmd is launch in non-pipeline mode > + command =3D './%s/app/testpmd -c %s -n 4 -w %s --log-level=3D"ic= e,7" -- -i - > -portmask=3D%s --rxq=3D10 --txq=3D10' % (self.target, self.coreMask, > self.dut.ports_info[0]['pci'], utils.create_mask([self.dut_ports[0]])) > + out =3D self.dut.send_expect(command, "testpmd> ", 120) > + self.logger.debug(out) > + > + out=3Dself.dut.send_expect("flow create 0 priority 0 ingress pat= tern eth / > ipv4 src is 192.168.0.2 dst is 192.168.0.3 tos is 4 / end actions queue i= ndex 2 / > end", "testpmd>", 15) > + self.verify( "Successed" and "(1)" in out, "failed: rule can't b= e created to > fdir") > + out=3Dself.dut.send_expect("flow create 0 priority 1 ingress pat= tern eth / > ipv4 src is 192.168.0.2 dst is 192.168.0.3 tos is 4 / end actions queue i= ndex 2 / > end", "testpmd>", 15) > + self.verify( "Failed" in out, "failed: default value of priority= is 0 in non- > pipeline mode") > + self.dut.send_expect("flow flush 0", "testpmd>", 20) > + self.dut.send_expect("quit", "#", 50) > + > + #restart testpmd with pipeline-mode-support=3D0, check the testp= md is > launch in non-pipeline mode > + command =3D './%s/app/testpmd -c %s -n 4 -w %s,pipeline-mode- > support=3D0 --log-level=3D"ice,7" -- -i --portmask=3D%s --rxq=3D10 --txq= =3D10' % > (self.target, self.coreMask, self.dut.ports_info[0]['pci'], > utils.create_mask([self.dut_ports[0]])) > + out =3D self.dut.send_expect(command, "testpmd> ", 120) > + self.logger.debug(out) > + > + out=3Dself.dut.send_expect("flow create 0 priority 0 ingress pat= tern eth / > ipv4 src is 192.168.0.2 dst is 192.168.0.3 tos is 4 / end actions queue i= ndex 2 / > end", "testpmd>", 15) > + self.verify( "Successed" and "(1)" in out, "failed: rule can't b= e created to > fdir") > + out=3Dself.dut.send_expect("flow create 0 priority 1 ingress pat= tern eth / > ipv4 src is 192.168.0.2 dst is 192.168.0.3 tos is 4 / end actions queue i= ndex 2 / > end", "testpmd>", 15) > + self.verify( "Failed" in out, "failed: default value of priority= is 0 in non- > pipeline mode") > + self.dut.send_expect("flow flush 0", "testpmd>", 20) > + self.dut.send_expect("quit", "#", 50) > + > + def test_no_destination_high_prority(self): > + """ > + no destination high priority rule is not acceptable. > + """ > + > + #start testpmd in pipeline mode > + command =3D './%s/app/testpmd -c %s -n 4 -w %s,pipeline-mode- > support=3D1 --log-level=3D"ice,7" -- -i --portmask=3D%s --rxq=3D10 --txq= =3D10' % > (self.target, self.coreMask, self.dut.ports_info[0]['pci'], > utils.create_mask([self.dut_ports[0]])) > + out =3D self.dut.send_expect(command, "testpmd> ", 120) > + self.logger.debug(out) > + > + #create no destination high priority rules, check the rules can = not be > created. > + out=3Dself.dut.send_expect("flow create 0 priority 0 ingress pat= tern eth / > ipv4 src is 192.168.0.2 dst is 192.168.0.3 tos is 4 / tcp src is 25 dst i= s 23 / end > actions / end", "testpmd>", 15) > + self.verify( "Bad argument" in out, "failed: no destination high= priority > rule is not acceptable") > + out=3Dself.dut.send_expect("flow create 0 priority 0 ingress pat= tern eth / > ipv4 src is 192.168.0.2 dst is 192.168.0.3 tos is 4 / tcp src is 25 dst i= s 23 / end", > "testpmd>", 15) > + self.verify( "Bad argument" in out, "failed: no destination high= priority > rule is not acceptable") > + self.dut.send_expect("quit", "#", 50) > + > + def test_create_fdir_rule_with_priority_0(self): > + """ > + create a rule only supported by fdir filter with priority 0 is n= ot > acceptable. > + """ > + > + #start testpmd in pipeline mode > + command =3D './%s/app/testpmd -c %s -n 4 -w %s,pipeline-mode- > support=3D1 --log-level=3D"ice,7" -- -i --portmask=3D%s --rxq=3D10 --txq= =3D10' % > (self.target, self.coreMask, self.dut.ports_info[0]['pci'], > utils.create_mask([self.dut_ports[0]])) > + out =3D self.dut.send_expect(command, "testpmd> ", 120) > + self.logger.debug(out) > + > + #create rules only supported by fdir with priority 0, check the = rules can > not be created. > + out=3Dself.dut.send_expect("flow create 0 priority 0 ingress pat= tern eth / > ipv6 src is 1111:2222:3333:4444:5555:6666:7777:8888 dst is > 1111:2222:3333:4444:5555:6666:7777:9999 / sctp src is 25 dst is 23 / end > actions queue index 1 / end", "testpmd>", 15) > + self.verify( "Failed" in out, "failed: priority is not work") > + out=3Dself.dut.send_expect("flow create 0 priority 0 ingress pat= tern eth / > ipv4 src is 192.168.0.2 dst is 192.168.0.3 tos is 4 ttl is 20 / sctp src = is 25 dst is > 23 / end actions queue index 1 / end", "testpmd>", 15) > + self.verify( "Failed" in out, "failed: priority is not work") > + self.dut.send_expect("quit", "#", 50) > + > + def test_create_switch_rule_with_priority_1(self): > + """ > + create a rule only supported by switch filter with priority 1 is= not > acceptable. > + """ > + > + #start testpmd in pipeline mode > + command =3D './%s/app/testpmd -c %s -n 4 -w %s,pipeline-mode- > support=3D1 --log-level=3D"ice,7" -- -i --portmask=3D%s --rxq=3D10 --txq= =3D10' % > (self.target, self.coreMask, self.dut.ports_info[0]['pci'], > utils.create_mask([self.dut_ports[0]])) > + out =3D self.dut.send_expect(command, "testpmd> ", 120) > + self.logger.debug(out) > + > + #create rules only supported by switch with priority 1, check th= e rules > can not be created. > + out=3Dself.dut.send_expect("flow create 0 priority 1 ingress pat= tern eth / > ipv4 / nvgre / eth / ipv4 src is 192.168.0.2 dst is 192.168.0.3 tos is 4 = / end > actions queue index 3 / end", "testpmd>", 15) > + self.verify( "Failed" in out, "failed: priority is not work") > + out=3Dself.dut.send_expect("flow create 0 priority 1 ingress pat= tern eth / > ipv4 / nvgre / eth / ipv4 src is 192.168.0.2 dst is 192.168.0.3 tos is 4 = / udp src > is 25 dst is 23 / end actions queue index 3 / end", "testpmd>", 15) > + self.verify( "Failed" in out, "failed: priority is not work") > + self.dut.send_expect("quit", "#", 50) > + > + def test_rules_with_same_parameters_different_action(self): > + """ > + it's acceptable to create same rules with different filter in pi= peline > mode. > + """ > + > + #start testpmd in pipeline mode > + command =3D './%s/app/testpmd -c %s -n 4 -w %s,pipeline-mode- > support=3D1 --log-level=3D"ice,7" -- -i --portmask=3D%s --rxq=3D10 --txq= =3D10' % > (self.target, self.coreMask, self.dut.ports_info[0]['pci'], > utils.create_mask([self.dut_ports[0]])) > + out =3D self.dut.send_expect(command, "testpmd> ", 120) > + > + self.dut.send_expect("set fwd rxonly", "testpmd> ", 15) > + self.dut.send_expect("set verbose 1", "testpmd> ", 15) > + > + > + #create rules with same parameters but different action > + out=3Dself.dut.send_expect("flow create 0 priority 0 ingress pat= tern eth / > ipv4 src is 192.168.0.2 dst is 192.168.0.3 tos is 4 / tcp src is 25 dst i= s 23 / end > actions queue index 1 / end", "testpmd>", 15) > + self.verify( "Successed" and "(2)" in out, "failed: switch rule = can't be > created") > + out=3Dself.dut.send_expect("flow create 0 priority 1 ingress pat= tern eth / > ipv4 src is 192.168.0.2 dst is 192.168.0.3 tos is 4 / tcp src is 25 dst i= s 23 / end > actions queue index 3 / end", "testpmd>", 15) > + self.verify( "Successed" and "(1)" in out, "failed: fdir rule > + can't be created") > + > + #send a pkt to check the switch rule is work for its high priori= ty > + self.dut.send_expect("start", "testpmd>", 20) > + a=3Dself.check_link() > + self.verify(a, "failed: link can not up") > + > + > self.send_pkt('sendp([Ether(dst=3D"00:00:00:00:01:00",src=3D"11:22:33:44:= 55:01" > )/IP(src=3D"192.168.0.2",dst=3D"192.168.0.3",tos=3D4)/TCP(sport=3D25,dpor= t=3D23)/Ra > w("x"*80)],iface=3D"%s")'%(self.__tx_iface)) > + out=3Dself.dut.send_expect("stop", "testpmd>", 20) > + pkt_num=3Dself.check_queue_rx_packets_number(out, 1) > + self.verify(pkt_num=3D=3D1, "failed: the flow rule can not work"= ) > + self.logger.info('pass: queue id is 1') > + > + #remove the switch rule and check the fdir rule is work > + self.dut.send_expect("flow destroy 0 rule 0", "testpmd>", 15) > + self.dut.send_expect("start", "testpmd>", 20) > + > self.send_pkt('sendp([Ether(dst=3D"00:00:00:00:01:00",src=3D"11:22:33:44:= 55:02" > )/IP(src=3D"192.168.0.2",dst=3D"192.168.0.3",tos=3D4)/TCP(sport=3D25,dpor= t=3D23)/Ra > w("x"*80)],iface=3D"%s")'%(self.__tx_iface)) > + out=3Dself.dut.send_expect("stop", "testpmd>", 20) > + pkt_num=3Dself.check_queue_rx_packets_number(out, 3) > + self.verify(pkt_num=3D=3D1, "failed: the flow rule can not work"= ) > + self.logger.info('pass: queue id is 3') > + > + self.dut.send_expect("flow flush 0", "testpmd>", 15) > + self.dut.send_expect("quit", "#", 50) > + > + #restart testpmd in pipeline mode > + command =3D './%s/app/testpmd -c %s -n 4 -w %s,pipeline-mode- > support=3D1 --log-level=3D"ice,7" -- -i --portmask=3D%s --rxq=3D10 --txq= =3D10' % > (self.target, self.coreMask, self.dut.ports_info[0]['pci'], > utils.create_mask([self.dut_ports[0]])) > + out =3D self.dut.send_expect(command, "testpmd> ", 120) > + self.logger.debug(out) > + > + self.dut.send_expect("set fwd rxonly", "testpmd> ", 15) > + self.dut.send_expect("set verbose 1", "testpmd> ", 15) > + > + #create rules with same parameters but different action > + out=3Dself.dut.send_expect("flow create 0 priority 1 ingress pat= tern eth / > ipv4 src is 192.168.0.2 dst is 192.168.0.3 tos is 4 / tcp src is 25 dst i= s 23 / end > actions queue index 3 / end", "testpmd>", 15) > + self.verify( "Successed" and "(1)" in out, "failed: fdir rule ca= n't be > created") > + out=3Dself.dut.send_expect("flow create 0 priority 0 ingress pat= tern eth / > ipv4 src is 192.168.0.2 dst is 192.168.0.3 tos is 4 / tcp src is 25 dst i= s 23 / end > actions queue index 1 / end", "testpmd>", 15) > + self.verify( "Successed" and "(2)" in out, "failed: switch rule > + can't be created") > + > + #send a pkt to check the switch rule is work for its high priori= ty > + self.dut.send_expect("start", "testpmd>", 20) > + a=3Dself.check_link() > + self.verify(a, "failed: link can not up") > + > self.send_pkt('sendp([Ether(dst=3D"00:00:00:00:01:00",src=3D"11:22:33:44:= 55:01" > )/IP(src=3D"192.168.0.2",dst=3D"192.168.0.3",tos=3D4)/TCP(sport=3D25,dpor= t=3D23)/Ra > w("x"*80)],iface=3D"%s")'%(self.__tx_iface)) > + out=3Dself.dut.send_expect("stop", "testpmd>", 20) > + pkt_num=3Dself.check_queue_rx_packets_number(out, 1) > + self.verify(pkt_num=3D=3D1, "failed: the flow rule can not work"= ) > + self.logger.info('pass: queue id is 1') > + > + #remove the switch rule and check the fdir rule is work > + self.dut.send_expect("flow destroy 0 rule 1", "testpmd>", 15) > + self.dut.send_expect("start", "testpmd>", 20) > + > self.send_pkt('sendp([Ether(dst=3D"00:00:00:00:01:00",src=3D"11:22:33:44:= 55:02" > )/IP(src=3D"192.168.0.2",dst=3D"192.168.0.3",tos=3D4)/TCP(sport=3D25,dpor= t=3D23)/Ra > w("x"*80)],iface=3D"%s")'%(self.__tx_iface)) > + out=3Dself.dut.send_expect("stop", "testpmd>", 20) > + pkt_num=3Dself.check_queue_rx_packets_number(out, 3) > + self.verify(pkt_num=3D=3D1, "failed: the flow rule can not work"= ) > + self.logger.info('pass: queue id is 3') > + > + self.dut.send_expect("flow flush 0", "testpmd>", 20) > + self.dut.send_expect("quit", "#", 50) > + # > + > + > ################################################################ > ###### > + ##### > + > + def tear_down_all(self): > + pass > + > + def tear_down(self): > + self.dut.kill_all() > + > + > + > + > + > + > + > + > + > + > + > + > -- > 2.17.1