From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 3E7FB5A3E for ; Mon, 20 Nov 2017 07:21:36 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Nov 2017 22:21:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,425,1505804400"; d="scan'208";a="4281798" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga003.jf.intel.com with ESMTP; 19 Nov 2017 22:21:35 -0800 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 19 Nov 2017 22:21:34 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.213]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.159]) with mapi id 14.03.0319.002; Mon, 20 Nov 2017 14:21:32 +0800 From: "Liu, Yong" To: "Peng, Yuan" , "dts@dpdk.org" CC: "Peng, Yuan" Thread-Topic: [dts] [PATCH] tests: add TestSuite_queue_region.py Thread-Index: AQHTX4kn4RpRKLSlfUqu1PuWNehKkqMczYAQ Date: Mon, 20 Nov 2017 06:21:32 +0000 Message-ID: <86228AFD5BCD8E4EBFD2B90117B5E81E62F1ADA9@SHSMSX103.ccr.corp.intel.com> References: <1510912123-51199-1-git-send-email-yuan.peng@intel.com> In-Reply-To: <1510912123-51199-1-git-send-email-yuan.peng@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYmRjZGVkM2ItODJmZi00NDFjLTgyODMtMDA4ODFlM2YzYzFlIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiJNNUxsXC90WTdzdDFNYUZoTWFoSmVMVXlxdFJGeUNuZll4UDdLVENGYkl6Wk1HSG1GYXVTZklBRFh4WVJcLzVuQkoifQ== x-ctpclassification: CTP_IC dlp-product: dlpe-windows dlp-version: 11.0.0.116 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] tests: add TestSuite_queue_region.py 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, 20 Nov 2017 06:21:38 -0000 Yuan, Some overall comments for this patch, also few comments are inline. 1. Use lower letters for function and local variable definition. If variabl= e is global, you can use upper letters. 2. Some codes are not consistent with pep rules, please use pep8 check the = format first. Regards, Marvin > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Peng Yuan > Sent: Friday, November 17, 2017 5:49 PM > To: dts@dpdk.org > Cc: Peng, Yuan > Subject: [dts] [PATCH] tests: add TestSuite_queue_region.py >=20 > Signed-off-by: Peng Yuan >=20 > diff --git a/tests/TestSuite_queue_region.py > b/tests/TestSuite_queue_region.py > new file mode 100644 > index 0000000..5b46288 > --- /dev/null > +++ b/tests/TestSuite_queue_region.py > @@ -0,0 +1,397 @@ > +# BSD LICENSE > +# > +# Copyright(c) 2010-2017 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 the support of VLAN Offload Features by Poll Mode Drivers. > + > +""" > + > +import utils > +import time > +import re > + > +from test_case import TestCase > +from settings import HEADER_SIZE > +from pmd_output import PmdOutput > +from settings import DRIVERS > + > +from project_dpdk import DPDKdut > +from dut import Dut > +from packet import Packet > + > + > +class TestQueue_region(TestCase): > + > + def get_queue_number(self): > + """ > + get the queue which packet enter. > + """ > + #self.tester.scapy_execute() > + #time.sleep(2) > + outstring =3D self.dut.send_expect("stop", "testpmd> ") > + result_scanner =3D r"Forward Stats for RX Port=3D %s/Queue=3D\s?= ([0- > 9]+)" % self.dut_ports[0] > + scanner =3D re.compile(result_scanner, re.DOTALL) > + m =3D scanner.search(outstring) > + queue_id =3D m.group(1) > + print "queue is %s" % queue_id > + self.dut.send_expect("start", "testpmd> ") > + return queue_id=09 > + > + def send_and_check(self, queue_region, mac, pkt_type=3D"udp", frag= =3D0, > prio=3DNone, flags=3DNone, tag=3DNone, ethertype=3DNone): > + """ > + send packet and check the result > + """ > + if prio is None: > + self.send_packet_PCTYPE(mac, pkt_type, frag, flags, tag, > ethertype) > + else: > + self.send_packet_UP(mac, pkt_type, prio) > + queue =3D self.get_queue_number() > + self.verify(queue in queue_region, "the packet doesn't enter the > expected queue region.") > + > + def send_packet_PCTYPE(self, mac, pkt_type=3D"udp", frag=3D0, flags= =3DNone, > tag=3DNone, ethertype=3DNone): > + """ Please only use lower letter for naming functions. > + send different PCTYPE packets. > + """ > + if (pkt_type =3D=3D "udp"): > + pkt =3D Packet(pkt_type=3D'UDP') > + pkt.config_layer('ether', {'dst': mac, 'src': > self.tester_mac}) > + elif (pkt_type =3D=3D "tcp"): > + pkt =3D Packet(pkt_type=3D'TCP') > + pkt.config_layer('ether', {'dst': mac, 'src': > self.tester_mac}) > + pkt.config_layer('tcp', {'flags': flags}) > + elif (pkt_type =3D=3D "sctp"): > + pkt =3D Packet(pkt_type=3D'SCTP') > + pkt.config_layer('ether', {'dst': mac, 'src': > self.tester_mac}) > + pkt.config_layer('sctp', {'tag': tag}) > + elif (pkt_type =3D=3D "ipv4"): > + pkt =3D Packet(pkt_type=3D'IP_RAW') > + pkt.config_layer('ether', {'dst': mac, 'src': > self.tester_mac}) > + pkt.config_layer('ipv4', {'frag': frag}) > + elif (pkt_type =3D=3D "ipv6_udp"): > + pkt =3D Packet(pkt_type=3D'IPv6_UDP') > + pkt.config_layer('ether', {'dst': mac, 'src': > self.tester_mac}) > + elif (pkt_type =3D=3D "ipv6_tcp"): > + pkt =3D Packet(pkt_type=3D'IPv6_TCP') > + pkt.config_layer('ether', {'dst': mac, 'src': > self.tester_mac}) > + elif (pkt_type =3D=3D "ipv6_sctp"): > + pkt =3D Packet(pkt_type=3D'IPv6_SCTP') > + pkt.config_layer('ether', {'dst': mac, 'src': > self.tester_mac}) > + pkt.config_layer('sctp', {'tag': tag}) > + elif (pkt_type =3D=3D "ipv6"): > + pkt =3D Packet() > + pkt.assign_layers(['ether', 'ipv6', 'raw']) > + pkt.config_layer('ether', {'dst': mac, 'src': > self.tester_mac}) > + elif (pkt_type =3D=3D "L2"): > + pkt =3D Packet() > + pkt.assign_layers(['ether', 'raw']) > + pkt.config_layer('ether', {'dst': mac, 'src': self.tester_ma= c, > 'type': ethertype}) > + pkt.send_pkt(tx_port=3Dself.tester_intf) > + > + def send_packet_UP(self, mac, pkt_type=3D"udp", prio=3D0): > + """ > + send different User Priority packets. > + """ > + if (pkt_type =3D=3D "ipv4"): > + pkt =3D Packet() > + pkt.assign_layers(['ether', 'vlan', 'ipv4', 'raw']) > + pkt.config_layer('ether', {'dst': mac, 'src': > self.tester_mac}) > + pkt.config_layer('vlan', {'vlan': 0, 'prio': prio}) > + elif (pkt_type =3D=3D "udp"): > + pkt =3D Packet(pkt_type=3D'VLAN_UDP') > + pkt.config_layer('ether', {'dst': mac, 'src': > self.tester_mac}) > + pkt.config_layer('vlan', {'vlan': 0, 'prio': prio}) > + elif (pkt_type =3D=3D "tcp"): > + pkt =3D Packet() > + pkt.assign_layers(['ether', 'vlan', 'ipv4', 'tcp', 'raw']) > + pkt.config_layer('ether', {'dst': mac, 'src': > self.tester_mac}) > + pkt.config_layer('vlan', {'vlan': 0, 'prio': prio}) > + elif (pkt_type =3D=3D "ipv6_udp"): > + pkt =3D Packet() > + pkt.assign_layers(['ether', 'vlan', 'ipv6', 'udp', 'raw']) > + pkt.config_layer('ether', {'dst': mac, 'src': > self.tester_mac}) > + pkt.config_layer('vlan', {'vlan': 0, 'prio': prio}) > + pkt.send_pkt(tx_port=3Dself.tester_intf) > + > + def set_up_all(self): > + """ > + Run at the start of each test suite. > + Queue region Prerequistites > + """ > + self.verify(self.nic in ["fortville_eagle", "fortville_spirit", > + "fortville_spirit_single", > "fortpark_TLV"], "NIC Unsupported: " + str(self.nic)) > + > + # Based on h/w type, choose how many ports to use > + 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") > + > + localPort =3D self.tester.get_local_port(self.dut_ports[0]) > + self.tester_intf =3D self.tester.get_interface(localPort) > + self.tester_mac =3D self.tester.get_mac(localPort) > + self.pf_interface =3D self.dut.ports_info[self.dut_ports[0]]['in= tf'] > + self.pf_mac =3D self.dut.get_mac_address(0) > + self.pf_pci =3D self.dut.ports_info[self.dut_ports[0]]['pci'] > + self.dut.send_expect("./%s/app/testpmd -c 1ffff -n 4 -- -i -- > rxq=3D16 --txq=3D16" % self.target, "testpmd>", 120) Please reduce core number for this suite. If no performance concern, two co= re is enough. If 17 cores is must, please add check function in set_up_all.=20 > + self.dut.send_expect("port config all rss all", "testpmd> ", 120= ) > + self.dut.send_expect("set fwd rxonly", "testpmd> ", 120) > + self.dut.send_expect("set verbose 1", "testpmd> ", 120) > + self.dut.send_expect("start", "testpmd> ", 120) > + time.sleep(2) Please place set_up_all and set_up functions to the beginning of class. Wil= l be more easily to understand. > + > + def set_up(self): > + """ > + Run before each test case. > + """ > + pass > + > + def get_and_compare_rules(self, out, QueueRegion_num, FlowType_num, > UP_num): > + """ > + dump all queue region rules that have been created in memory and > compare that total rules number with the given expected number > + to see if they are equal, as to get your conclusion after you > have deleted any queue region rule entry. > + """ > + print out > + self.verify("error" not in out, "the queue region settings has > error.") > + actual_QRnum =3D re.findall("region_id.*", out) > + actual_FTnum =3D re.findall("flowtype_num\D*(\d*).*", out) > + actual_UPnum =3D re.findall("user_priority_num\D*(\d*).*", out) > + actual_flowtypenum =3D 0 > + actual_UserPrioritynum =3D 0 > + self.verify(len(actual_QRnum) =3D=3D QueueRegion_num, "the queue= - > region number count error") > + for i in range(len(actual_FTnum)): > + actual_flowtypenum +=3D int(actual_FTnum[i]) > + self.verify(actual_flowtypenum =3D=3D FlowType_num, "the flowtyp= e > number count error") > + for i in range(len(actual_UPnum)): > + actual_UserPrioritynum +=3D int(actual_UPnum[i])=09 > + self.verify(actual_UserPrioritynum =3D=3D UP_num, "the UP number > count error") > + > + def test_PCTYPE_map_QueueRegion(self): > + # set queue region on a port > + self.dut.send_expect("set port 0 queue-region region_id 0 > queue_start_index 1 queue_num 1", "testpmd> ") > + self.dut.send_expect("set port 0 queue-region region_id 1 > queue_start_index 3 queue_num 2", "testpmd> ") > + self.dut.send_expect("set port 0 queue-region region_id 2 > queue_start_index 6 queue_num 2", "testpmd> ") > + self.dut.send_expect("set port 0 queue-region region_id 3 > queue_start_index 8 queue_num 2", "testpmd> ") > + self.dut.send_expect("set port 0 queue-region region_id 4 > queue_start_index 11 queue_num 4", "testpmd> ") > + self.dut.send_expect("set port 0 queue-region region_id 5 > queue_start_index 15 queue_num 1", "testpmd> ") > + self.dut.send_expect("set port 0 queue-region region_id 6 > queue_start_index 2 queue_num 1", "testpmd> ") > + self.dut.send_expect("set port 0 queue-region region_id 7 > queue_start_index 10 queue_num 1", "testpmd> ") > + > + # Set the mapping of flowtype to region index on a port > + self.dut.send_expect("set port 0 queue-region region_id 0 > flowtype 31", "testpmd> ") > + self.dut.send_expect("set port 0 queue-region region_id 1 > flowtype 32", "testpmd> ") > + self.dut.send_expect("set port 0 queue-region region_id 2 > flowtype 33", "testpmd> ") > + self.dut.send_expect("set port 0 queue-region region_id 3 > flowtype 34", "testpmd> ") > + self.dut.send_expect("set port 0 queue-region region_id 4 > flowtype 35", "testpmd> ") > + self.dut.send_expect("set port 0 queue-region region_id 6 > flowtype 36", "testpmd> ") > + self.dut.send_expect("set port 0 queue-region region_id 2 > flowtype 41", "testpmd> ") > + self.dut.send_expect("set port 0 queue-region region_id 3 > flowtype 43", "testpmd> ") > + self.dut.send_expect("set port 0 queue-region region_id 4 > flowtype 44", "testpmd> ") > + self.dut.send_expect("set port 0 queue-region region_id 5 > flowtype 45", "testpmd> ") > + self.dut.send_expect("set port 0 queue-region region_id 7 > flowtype 46", "testpmd> ") > + self.dut.send_expect("set port 0 queue-region region_id 1 > flowtype 63", "testpmd> ") > + self.dut.send_expect("set port 0 queue-region flush on", "testpm= d> > ") > + > + # send the packets and verify the results > + queue_region=3D["1"] > + self.send_and_check(queue_region, mac=3Dself.pf_mac, pkt_type=3D= "udp") > + > + # fortville can't parse the TCP SYN type packet, fortpark can > parse it. > + if(self.nic in ["fortpark_TLV"]): > + queue_region=3D["3", "4"] > + else: > + queue_region=3D["6", "7"] > + self.send_and_check(queue_region, mac=3Dself.pf_mac, pkt_type=3D= "tcp", > flags=3D"S") > + > + queue_region=3D["6", "7"] > + self.send_and_check(queue_region, mac=3Dself.pf_mac, pkt_type=3D= "tcp", > flags=3D"PA") > + > + queue_region=3D["8", "9"] > + self.send_and_check(queue_region, mac=3Dself.pf_mac, > pkt_type=3D"sctp", tag=3D1) > + > + queue_region=3D["11", "12", "13", "14"] > + self.send_and_check(queue_region, mac=3Dself.pf_mac, > pkt_type=3D"ipv4") > + > + queue_region=3D["2"] > + self.send_and_check(queue_region, mac=3Dself.pf_mac, > pkt_type=3D"ipv4", frag=3D1) > + > + queue_region=3D["8", "9"] > + self.send_and_check(queue_region, mac=3Dself.pf_mac, > pkt_type=3D"ipv6_tcp") > + > + queue_region=3D["11", "12", "13", "14"] > + self.send_and_check(queue_region, mac=3Dself.pf_mac, > pkt_type=3D"ipv6_sctp", tag=3D2) > + > + queue_region=3D["6", "7"] > + self.send_and_check(queue_region, mac=3Dself.pf_mac, > pkt_type=3D"ipv6_udp") > + > + queue_region=3D["15"] > + self.send_and_check(queue_region, mac=3Dself.pf_mac, > pkt_type=3D"ipv6") > + > + queue_region=3D["3", "4"] > + self.send_and_check(queue_region, mac=3Dself.pf_mac, pkt_type=3D= "L2", > ethertype=3D0x88bb) > + > + queue_region=3D["11", "12", "13", "14"] > + self.send_and_check(queue_region, mac=3Dself.pf_mac, > pkt_type=3D"ipv4", prio=3D1) > + > + # clear all the queue region configuration > + # check if there is 1 flow rule have been created > + out =3D self.dut.send_expect("show port 0 queue-region", "testpm= d> > ") > + self.get_and_compare_rules(out, 8, 12, 0) > + self.dut.send_expect("set port 0 queue-region flush off", > "testpmd> ") > + out =3D self.dut.send_expect("show port 0 queue-region", "testpm= d> > ") > + self.get_and_compare_rules(out, 0, 0, 0) > + > + def test_UP_map_QueueRegion(self): > + # set queue region on a port > + self.dut.send_expect("set port 0 queue-region region_id 0 > queue_start_index 0 queue_num 1", "testpmd> ") > + self.dut.send_expect("set port 0 queue-region region_id 6 > queue_start_index 1 queue_num 8", "testpmd> ") > + self.dut.send_expect("set port 0 queue-region region_id 2 > queue_start_index 10 queue_num 4", "testpmd> ") > + > + # Set the mapping of user priority to region index on a port > + self.dut.send_expect("set port 0 queue-region UP 3 region_id 0", > "testpmd> ") > + self.dut.send_expect("set port 0 queue-region UP 1 region_id 6", > "testpmd> ") > + self.dut.send_expect("set port 0 queue-region UP 2 region_id 2", > "testpmd> ") > + self.dut.send_expect("set port 0 queue-region UP 7 region_id 2", > "testpmd> ") > + self.dut.send_expect("set port 0 queue-region flush on", "testpm= d> > ") > + > + # send the packets and verify the results > + queue_region=3D["0"] This format is not coherent to pep rules, please use pep8 check the format = fist. > + self.send_and_check(queue_region, mac=3Dself.pf_mac, pkt_type=3D= "udp", > prio=3D4) > + > + queue_region=3D["0"] > + self.send_and_check(queue_region, mac=3Dself.pf_mac, pkt_type=3D= "udp", > prio=3D3) > + > + queue_region=3D["1", "2", "3", "4", "5", "6", "7", "8"] > + self.send_and_check(queue_region, mac=3Dself.pf_mac, > pkt_type=3D"ipv6_udp", prio=3D1) > + > + queue_region=3D["10", "11", "12", "13"] > + self.send_and_check(queue_region, mac=3Dself.pf_mac, pkt_type=3D= "tcp", > prio=3D2) > + > + queue_region=3D["10", "11", "12", "13"] > + self.send_and_check(queue_region, mac=3Dself.pf_mac, pkt_type=3D= "tcp", > prio=3D7) > + > + queue_region=3D["10", "11", "12", "13"] > + self.send_and_check(queue_region, mac=3Dself.pf_mac, pkt_type=3D= "udp", > prio=3D7) > + > + self.send_packet_PCTYPE(mac=3Dself.pf_mac, pkt_type=3D"udp") > + queue =3D self.get_queue_number() > + self.verify(queue not in ["10", "11", "12", "13"], "the packet > doesn't enter the expected queue.") > + > + # clear all the queue region configuration > + out =3D self.dut.send_expect("show port 0 queue-region", "testpm= d> > ") > + self.get_and_compare_rules(out, 3, 0, 4) > + self.dut.send_expect("set port 0 queue-region flush off", > "testpmd> ") > + out =3D self.dut.send_expect("show port 0 queue-region", "testpm= d> > ") > + self.get_and_compare_rules(out, 0, 0, 0) > + > + # confirm packet can't into the previous queue_region > + self.send_packet_UP(mac=3Dself.pf_mac, pkt_type=3D"udp", prio=3D= 7) > + queue =3D self.get_queue_number() > + self.verify(queue not in ["10", "11", "12", "13"], "the queue > regions have not been flushed clearly.") > + > + def test_boundary_values(self): > + # boundary value testing of "Set a queue region on a port" > + # the following parameters can be set successfully > + outstring =3D self.dut.send_expect("set port 0 queue-region > region_id 0 queue_start_index 0 queue_num 16", "testpmd> ") > + self.verify("error" not in outstring, "boundary value check > failed") > + self.dut.send_expect("set port 0 queue-region flush on", "testpm= d> > ") > + self.dut.send_expect("set port 0 queue-region flush off", > "testpmd> ") > + > + outstring =3D self.dut.send_expect("set port 0 queue-region > region_id 0 queue_start_index 15 queue_num 1", "testpmd> ") > + self.verify("error" not in outstring, "boundary value check > failed") > + self.dut.send_expect("set port 0 queue-region flush on", "testpm= d> > ") > + self.dut.send_expect("set port 0 queue-region flush off", > "testpmd> ") > + > + outstring =3D self.dut.send_expect("set port 0 queue-region > region_id 7 queue_start_index 2 queue_num 8", "testpmd> ") > + self.verify("error" not in outstring, "boundary value check > failed") > + self.dut.send_expect("set port 0 queue-region flush on", "testpm= d> > ") > + self.dut.send_expect("set port 0 queue-region flush off", > "testpmd> ") > + > + # the following parameters failed to be set. > + # region_id can be set to 0-7 > + self.dut.send_expect("set port 0 queue-region region_id 8 > queue_start_index 2 queue_num 2", "error") > + self.dut.send_expect("set port 0 queue-region region_id 1 > queue_start_index 16 queue_num 1", "error") > + self.dut.send_expect("set port 0 queue-region region_id 2 > queue_start_index 15 queue_num 2", "error") > + self.dut.send_expect("set port 0 queue-region region_id 3 > queue_start_index 2 queue_num 3", "error") > + self.dut.send_expect("set port 0 queue-region flush on", "testpm= d> > ") > + out =3D self.dut.send_expect("show port 0 queue-region", "testpm= d> > ") > + self.get_and_compare_rules(out, 0, 0, 0) > + self.dut.send_expect("set port 0 queue-region flush off", > "testpmd> ") > + > + # boundary value testing of "Set the mapping of flowtype to > region index on a port" > + self.dut.send_expect("set port 0 queue-region region_id 0 > queue_start_index 2 queue_num 2", "testpmd> ") > + self.dut.send_expect("set port 0 queue-region region_id 7 > queue_start_index 4 queue_num 4", "testpmd> ") > + > + # the following parameters can be set successfully > + outstring =3D self.dut.send_expect("set port 0 queue-region > region_id 0 flowtype 63", "testpmd> ") > + self.verify("error" not in outstring, "boundary value check > failed") > + outstring =3D self.dut.send_expect("set port 0 queue-region > region_id 7 flowtype 0", "testpmd> ") > + self.verify("error" not in outstring, "boundary value check > failed") > + > + # the following parameters failed to be set. > + self.dut.send_expect("set port 0 queue-region region_id 0 > flowtype 64", "error") > + self.dut.send_expect("set port 0 queue-region region_id 2 > flowtype 34", "error") > + self.dut.send_expect("set port 0 queue-region flush on", "testpm= d> > ") > + out =3D self.dut.send_expect("show port 0 queue-region", "testpm= d> > ") > + self.get_and_compare_rules(out, 2, 2, 0) > + self.dut.send_expect("set port 0 queue-region flush off", > "testpmd> ") > + > + # boundary value testing of "Set the mapping of UP to region > index on a port" > + self.dut.send_expect("set port 0 queue-region region_id 0 > queue_start_index 2 queue_num 2", "testpmd> ") > + self.dut.send_expect("set port 0 queue-region region_id 7 > queue_start_index 4 queue_num 4", "testpmd> ") > + > + # the following parameters can be set successfully > + # UP value can be set to 0-7 > + outstring =3D self.dut.send_expect("set port 0 queue-region UP 7 > region_id 0", "testpmd> ") > + self.verify("error" not in outstring, "boundary value check > failed") > + outstring =3D self.dut.send_expect("set port 0 queue-region UP 0 > region_id 7", "testpmd> ") > + self.verify("error" not in outstring, "boundary value check > failed") > + > + # the following parameters failed to be set. > + self.dut.send_expect("set port 0 queue-region UP 8 region_id 0", > "error") > + self.dut.send_expect("set port 0 queue-region UP 1 region_id 2", > "error") > + self.dut.send_expect("set port 0 queue-region flush on", "testpm= d> > ") > + out =3D self.dut.send_expect("show port 0 queue-region", "testpm= d> > ") > + self.get_and_compare_rules(out, 2, 0, 2) > + self.dut.send_expect("set port 0 queue-region flush off", > "testpmd> ") > + > + def tear_down(self): > + """ > + Run after each test case. > + """ > + > + def tear_down_all(self): > + """ > + Run after each test suite. > + """ > + self.dut.send_expect("quit", "# ") > + time.sleep(2) > + self.dut.kill_all() > -- > 2.5.0