From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A7221A034F; Thu, 29 Jul 2021 13:53:25 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6FADA40DFB; Thu, 29 Jul 2021 13:53:25 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 1A5DB40687 for ; Thu, 29 Jul 2021 13:53:23 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10059"; a="273943892" X-IronPort-AV: E=Sophos;i="5.84,278,1620716400"; d="scan'208";a="273943892" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jul 2021 04:53:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,278,1620716400"; d="scan'208";a="465051797" Received: from fmsmsx604.amr.corp.intel.com ([10.18.126.84]) by orsmga008.jf.intel.com with ESMTP; 29 Jul 2021 04:53:22 -0700 Received: from shsmsx602.ccr.corp.intel.com (10.109.6.142) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Thu, 29 Jul 2021 04:53:22 -0700 Received: from shsmsx601.ccr.corp.intel.com (10.109.6.141) by SHSMSX602.ccr.corp.intel.com (10.109.6.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Thu, 29 Jul 2021 19:53:20 +0800 Received: from shsmsx601.ccr.corp.intel.com ([10.109.6.141]) by SHSMSX601.ccr.corp.intel.com ([10.109.6.141]) with mapi id 15.01.2242.010; Thu, 29 Jul 2021 19:53:19 +0800 From: "Tu, Lijuan" To: "Xia, YanX" , "dts@dpdk.org" , "Peng, Yuan" CC: "Xia, YanX" Thread-Topic: [dts] [PATCH V1] tests/generic_flow_api:add test case dual_vlan Thread-Index: AQHXf6BlXLtZUtY81UeJtmfRRYHiUatZ4BCA Date: Thu, 29 Jul 2021 11:53:19 +0000 Message-ID: <4c5f75d3d11a4078841e4fadf9f39594@intel.com> References: <20210723172626.22041-1-yanx.xia@intel.com> In-Reply-To: <20210723172626.22041-1-yanx.xia@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.5.1.3 dlp-product: dlpe-windows x-originating-ip: [10.239.127.36] Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dts] [PATCH V1] tests/generic_flow_api:add test case dual_vlan X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 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" > -----Original Message----- > From: dts On Behalf Of Yan Xia > Sent: 2021=1B$BG/=1B(B7=1B$B7n=1B(B24=1B$BF|=1B(B 1:26 > To: dts@dpdk.org > Cc: Xia, YanX > Subject: [dts] [PATCH V1] tests/generic_flow_api:add test case dual_vlan >=20 > move test_dual_vlan in TestSuite_fortville_rss_granularity_config to > TestSuite_generic_flow_api, then modify lengacy command. >=20 > Signed-off-by: Yan Xia > --- > tests/TestSuite_generic_flow_api.py | 136 ++++++++++++++++++++++++++++ > 1 file changed, 136 insertions(+) >=20 > diff --git a/tests/TestSuite_generic_flow_api.py > b/tests/TestSuite_generic_flow_api.py > index e8171589..c4462a4e 100644 > --- a/tests/TestSuite_generic_flow_api.py > +++ b/tests/TestSuite_generic_flow_api.py > @@ -59,6 +59,8 @@ from scapy.utils import rdpcap >=20 > MAX_VLAN =3D 4095 > MAX_QUEUE =3D 15 > +testQueues =3D [16] > +reta_lines =3D [] > MAX_VFQUEUE =3D 3 > MAX_PORT =3D 65535 > MAX_TTL =3D 255 > @@ -642,6 +644,78 @@ class TestGeneric_flow_api(TestCase): > self.pkt_obj.append_pkt(pktstr) > self.pkt_obj.send_pkt(self.tester, tx_port=3Dself.tester_itf, co= unt=3Dcount) >=20 > + def send_packet(self, itf, tran_type, enable=3DNone): > + """ > + Sends packets for l2_payload. > + """ > + global reta_lines > + self.tester.scapy_foreground() > + self.dut.send_expect("start", "testpmd>") > + mac =3D self.dut.get_mac_address(0) > + > + # send packet with different source and dest ip > + if tran_type =3D=3D "l2_payload": > + if enable =3D=3D "ovlan": > + packet =3D r'sendp([Ether(dst=3D"%s", > src=3Dget_if_hwaddr("%s"))/Dot1Q(id=3D0x8100,vlan=3D4)/Dot1Q(id=3D0x8100,= vlan=3D2,ty > pe=3D0xaaaa)/Raw(load=3D"x"*60)], iface=3D"%s")' % ( > + mac, itf, itf) > + elif enable =3D=3D "ivlan": > + packet =3D r'sendp([Ether(dst=3D"%s", > src=3Dget_if_hwaddr("%s"))/Dot1Q(id=3D0x8100,vlan=3D1)/Dot1Q(id=3D0x8100,= vlan=3D3,ty > pe=3D0xaaaa)/Raw(load=3D"x"*60)], iface=3D"%s")' % ( > + mac, itf, itf) > + else: > + packet =3D r'sendp([Ether(dst=3D"%s", > src=3Dget_if_hwaddr("%s"))/Dot1Q(id=3D0x8100,vlan=3D1)/Dot1Q(id=3D0x8100,= vlan=3D2,ty > pe=3D0xaaaa)/Raw(load=3D"x"*60)], iface=3D"%s")' % ( > + mac, itf, itf) > + self.tester.scapy_append(packet) > + self.tester.scapy_execute() > + time.sleep(.5) > + else: > + print("\ntran_type error!\n") > + > + out =3D self.dut.get_session_output(timeout=3D1) > + self.dut.send_expect("stop", "testpmd>") > + lines =3D out.split("\r\n") > + reta_line =3D {} > + # collect the hash result and the queue id > + for line in lines: > + line =3D line.strip() > + if len(line) !=3D 0 and line.strip().startswith("port "): > + reta_line =3D {} > + rexp =3D r"port (\d)/queue (\d{1,2}): received (\d) pack= ets" > + m =3D re.match(rexp, line.strip()) > + if m: > + reta_line["port"] =3D m.group(1) > + reta_line["queue"] =3D m.group(2) > + > + elif len(line) !=3D 0 and line.startswith(("src=3D",)): > + for item in line.split("-"): > + item =3D item.strip() > + if(item.startswith("RSS hash")): > + name, value =3D item.split("=3D", 1) > + > + reta_line[name.strip()] =3D value.strip() > + reta_lines.append(reta_line) > + > + self.append_result_table() > + > + def append_result_table(self): > + """ > + Append the hash value and queue id into table. > + """ > + > + global reta_lines > + > + # append the the hash value and queue id into table > + self.result_table_create( > + ['packet index', 'hash value', 'hash index', 'queue id']) > + i =3D 0 > + > + for tmp_reta_line in reta_lines: > + > + # compute the hash result of five tuple into the 7 LSBs valu= e. > + hash_index =3D int(tmp_reta_line["RSS hash"], 16) > + self.result_table_add( > + [i, tmp_reta_line["RSS hash"], hash_index, tmp_reta_line= ["queue"]]) > + i =3D i + 1 > + > def test_syn_filter(self): > """ > Only supported by ixgbe and igb. > @@ -2351,6 +2425,68 @@ class TestGeneric_flow_api(TestCase): > rule_num =3D extrapkt_rulenum['rulenum'] > self.verify_rulenum(rule_num) >=20 > + def test_dual_vlan(self): > + """ > + Test with flow type dual vlan(QinQ). > + """ > + flag =3D 1 > + > + for queue in testQueues: > + self.pmdout.start_testpmd( > + "Default", " --portmask=3D0x1 --rxq=3D%d --txq=3D%d" % = (queue, queue)) > + > + self.dut.send_expect("set verbose 8", "testpmd> ") > + self.dut.send_expect("set fwd rxonly", "testpmd> ") > + > + self.dut.send_expect("port stop all", "testpmd> ") > + self.dut.send_expect("vlan set extend on 0", "testpmd> ") > + self.dut.send_expect( > + "flow create 0 ingress pattern eth / end actions rss typ= es l2-payload > end queues end func toeplitz / end", "testpmd> ") > + self.dut.send_expect("port start all", "testpmd> ") > + res =3D self.pmdout.wait_link_status_up("all") > + self.verify(res is True, "link is down") > + > + self.send_packet(self.tester_itf, "l2_payload") > + > + # set flow rss type s-vlan c-vlan set by testpmd on dut > + self.dut.send_expect("flow create 0 ingress pattern eth / en= d actions rss > types s-vlan c-vlan end key_len 0 queues end / end", "testpmd> ") > + self.send_packet(self.tester_itf, "l2_payload") > + > + self.send_packet(self.tester_itf, "l2_payload", enable=3D"ov= lan") > + > + self.send_packet(self.tester_itf, "l2_payload", enable=3D"iv= lan") > + > + self.dut.send_expect("quit", "# ", 30) > + > + self.result_table_print() > + result_rows =3D self.result_table_getrows() > + self.verify(len(result_rows) > 1, "There is no data in the table= , testcase > failed!") > + > + # check the results > + if result_rows[1][1] =3D=3D result_rows[2][1]: > + flag =3D 0 > + self.verify(flag, "The two hash values are same, rss_granula= rity_config > failed!") > + > + elif result_rows[1][1] =3D=3D result_rows[3][1]: > + flag =3D 0 > + self.verify(flag, "The two hash values are same, rss_granula= rity_config > failed!") > + > + elif result_rows[1][1] =3D=3D result_rows[4][1]: > + flag =3D 0 > + self.verify(flag, "The two hash values are same, rss_granula= rity_config > failed!") > + > + elif result_rows[2][1] =3D=3D result_rows[3][1]: > + flag =3D 0 > + self.verify(flag, "The two hash values are same, rss_granula= rity_config > failed!") > + > + elif result_rows[2][1] =3D=3D result_rows[4][1]: > + flag =3D 0 > + self.verify(flag, "The two hash values are same, rss_granula= rity_config > failed!") > + > + elif result_rows[3][1] =3D=3D result_rows[4][3]: > + flag =3D 0 > + self.verify(flag, "The two hash values are same, rss_granula= rity_config > failed!") It might occur " IndexError: list index out of range" So many verification are using the same message, it is hard to identify wha= t's the matter, it 's very bad to users. > + > def tear_down(self): > """ > Run after each test case. > -- > 2.17.1