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 01B691B42B for ; Wed, 28 Nov 2018 04:25:10 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Nov 2018 19:25:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,289,1539673200"; d="scan'208";a="286484080" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga006.fm.intel.com with ESMTP; 27 Nov 2018 19:25:10 -0800 Received: from fmsmsx101.amr.corp.intel.com (10.18.124.199) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 27 Nov 2018 19:25:09 -0800 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx101.amr.corp.intel.com (10.18.124.199) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 27 Nov 2018 19:25:09 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.102]) by shsmsx102.ccr.corp.intel.com ([169.254.2.84]) with mapi id 14.03.0415.000; Wed, 28 Nov 2018 11:25:06 +0800 From: "Tu, Lijuan" To: "Zhao, MeijuanX" , "dts@dpdk.org" CC: "Zhao, MeijuanX" Thread-Topic: [dts] [PATCH V1 1/2] tests/vf mackfilter: add dpdk pf test scenorio Thread-Index: AQHUgwkofUB6AaTLKU6UpaiSJHBmW6VkjHRw Date: Wed, 28 Nov 2018 03:25:05 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0B9C1B55@SHSMSX101.ccr.corp.intel.com> References: <1542962988-5207-1-git-send-email-meijuanx.zhao@intel.com> In-Reply-To: <1542962988-5207-1-git-send-email-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.400.15 dlp-reaction: no-action x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiOWNkZTMzMjAtNDc1NC00ZGQzLThiNjAtOWI0N2I4ZWQ4YWRlIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiR1psXC9vTGN4NllQaVI4dXVOMGFhU2M1ZzNMVUhhVERySmIzZ25iekJoaDZPV3pHTmluMTVPUzVjNk9mUXNLejEifQ== 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 1/2] tests/vf mackfilter: add dpdk pf test scenorio 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: Wed, 28 Nov 2018 03:25:11 -0000 Hi meijun, Good to see a new function: result_verify_iplink. I found self.iplinkset only used in result_verify_iplink, so It's better to= take iplinkset as a parameter of iplinkset. For instance: > + def result_verify_iplink(self, iplinkset=3DFalse): > + if iplinkset =3D=3D False: > + self.host_testpmd.execute_cmd('set vf mac addr 0 0 %s' % > + self.pf0_vf0_mac) > def test_kernel_2pf_2vf_1vm_iplink_macfilter(self): > self.setup_2pf_2vf_1vm_env(driver=3D'') > + self.result_verify_iplink(iplinkset=3DTrue) > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of zhao,meijuan > Sent: Friday, November 23, 2018 4:50 PM > To: dts@dpdk.org > Cc: Zhao, MeijuanX > Subject: [dts] [PATCH V1 1/2] tests/vf mackfilter: add dpdk pf test sceno= rio >=20 > add dpdk pf test scenorio >=20 > Signed-off-by: zhao,meijuan > --- > tests/TestSuite_vf_macfilter.py | 46 ++++++++++++++++++++++++++------- > 1 file changed, 36 insertions(+), 10 deletions(-) >=20 > diff --git a/tests/TestSuite_vf_macfilter.py b/tests/TestSuite_vf_macfilt= er.py > index f0de169..c255d01 100644 > --- a/tests/TestSuite_vf_macfilter.py > +++ b/tests/TestSuite_vf_macfilter.py > @@ -13,13 +13,15 @@ VM_CORES_MASK =3D 'all' > class TestVfMacFilter(TestCase): >=20 > supported_vf_driver =3D ['pci-stub', 'vfio-pci'] > + vf0_wrongmac =3D "00:11:22:33:48:55" > + vf0_setmac =3D "00:11:22:33:44:55" >=20 > def set_up_all(self): > self.dut_ports =3D self.dut.get_ports(self.nic) > self.verify(len(self.dut_ports) > 1, "Insufficient ports") > self.vm0 =3D None > self.pf0_vf0_mac =3D "00:12:34:56:78:01" > - self.iplinkset =3D True > + self.iplinkset =3D False >=20 > # set vf assign method and vf driver > self.vf_driver =3D self.get_suite_cfg()['vf_driver'] @@ -124,15 > +126,18 @@ class TestVfMacFilter(TestCase): > ###### send the packets with wrong MAC address to VF, check if the VF wi= ll > not RX the packets. >=20 > def test_kernel_2pf_2vf_1vm_iplink_macfilter(self): > - > + self.iplinkset =3D True > self.setup_2pf_2vf_1vm_env(driver=3D'') > + self.result_verify_iplink() >=20 > + def result_verify_iplink(self): > + if self.iplinkset =3D=3D False: > + self.host_testpmd.execute_cmd('set vf mac addr 0 0 %s' % > + self.pf0_vf0_mac) > self.vm0_dut_ports =3D self.vm_dut_0.get_ports('any') > self.vm0_testpmd =3D PmdOutput(self.vm_dut_0) > self.vm0_testpmd.start_testpmd(VM_CORES_MASK) > # Get VF's MAC > pmd_vf0_mac =3D self.vm0_testpmd.get_port_mac(0) > - vf0_wrongmac =3D "00:11:22:33:48:55" > self.vm0_testpmd.execute_cmd('set promisc all off') > self.vm0_testpmd.execute_cmd('set fwd mac') > self.vm0_testpmd.execute_cmd('start') > @@ -147,18 +152,19 @@ class TestVfMacFilter(TestCase): > src_mac =3D self.tester.get_mac(tx_port) > pkt_param=3D[("ether", {'dst': dst_mac, 'src': src_mac})] >=20 > - print "\nfirst send packets to the kernel PF set MAC, expected > result is RX packets=3DTX packets\n" > + print "\nfirst send packets to the PF set MAC, expected result i= s > RX packets=3DTX packets\n" > result1 =3D self.tester.check_random_pkts(tgen_ports, pktnum=3D1= 00, > allow_miss=3DFalse, params=3Dpkt_param) > print "\nshow port stats in testpmd for double check: \n", > self.vm0_testpmd.execute_cmd('show port stats all') > self.verify(result1 !=3D False, "VF0 failed to forward packets t= o > VF1") >=20 > print "\nSecondly, negative test, send packets to a wrong MAC, > expected result is RX packets=3D0\n" > - dst_mac =3D vf0_wrongmac > + dst_mac =3D self.vf0_wrongmac > pkt_param=3D[("ether", {'dst': dst_mac, 'src': src_mac})] > result2 =3D self.tester.check_random_pkts(tgen_ports, pktnum=3D1= 00, > allow_miss=3DFalse, params=3Dpkt_param) > print "\nshow port stats in testpmd for double check: \n", > self.vm0_testpmd.execute_cmd('show port stats all') > self.verify(result2 !=3D True, "VF0 failed to forward packets to= VF1") >=20 > + > #######2. test case for kernel pf and dpdk vf 2pf_2vf_1vm MAC filter > scenario. > ####### kernel pf will not set MAC address and the VF will get a random > generated MAC ####### in the testpmd in VM, and then add VF mac > address in the testpmd,for example, VF_MAC1 @@ -170,17 +176,37 @@ > class TestVfMacFilter(TestCase): >=20 > self.iplinkset =3D False > self.setup_2pf_2vf_1vm_env(driver=3D'') > + self.send_packet_and_verify() > + > +#######3. test case for dpdk pf and dpdk vf 2pf_2vf_1vm MAC filter > scenario. > +####### kernel pf will not set MAC address and the VF will get a random > +generated MAC ####### in the testpmd in VM, and then add VF mac > address > +in the testpmd,for example, VF_MAC1 ####### then send packets to the VF > +with the random generated MAC and the new added VF_MAC1 ####### > and the > +expected result is that all packets can be RXed and TXed. What's more, s= end > ####### packets with a wrong MAC address to the VF will not received by > the VF. > + def test_dpdk_2pf_2vf_1vm_mac_add_filter(self): > + self.iplinkset =3D False > + self.setup_2pf_2vf_1vm_env(driver=3D'igb_uio') > + self.send_packet_and_verify() > + > +######4. test case for dpdk pf and dpdk vf 2pf_2vf_1vm MAC filter > +scenario ###### dpdk pf will first run 'set vf mac addr 0 0 > +xx:xx:xx:xx:xx:xx, then ###### in the vm, send packets with this MAC to > +VF, check if the MAC filter works. Also ###### send the packets with wro= ng > MAC address to VF, check if the VF will not RX the packets. > + def test_dpdk_2pf_2vf_1vm_iplink_macfilter(self): > + self.iplinkset =3D False > + self.setup_2pf_2vf_1vm_env(driver=3D'igb_uio') > + self.result_verify_iplink() >=20 > + def send_packet_and_verify(self): > self.vm0_dut_ports =3D self.vm_dut_0.get_ports('any') > self.vm0_testpmd =3D PmdOutput(self.vm_dut_0) > self.vm0_testpmd.start_testpmd(VM_CORES_MASK) >=20 > # Get VF0 port MAC address > pmd_vf0_mac =3D self.vm0_testpmd.get_port_mac(0) > - vf0_setmac =3D "00:11:22:33:44:55" > - vf0_wrongmac =3D "00:11:22:33:48:55" > self.vm0_testpmd.execute_cmd('set promisc all off') > - ret =3D self.vm0_testpmd.execute_cmd('mac_addr add > 0 %s' %vf0_setmac) > + ret =3D self.vm0_testpmd.execute_cmd('mac_addr add 0 %s' > + %self.vf0_setmac) > # check the operation is supported or not. > print ret >=20 > @@ -203,14 +229,14 @@ class TestVfMacFilter(TestCase): > self.verify(result1 !=3D False, "VF0 failed to forward packets t= o > VF1") >=20 > print "\nsecondly, send packets to the new added MAC, expected > result is RX packets=3DTX packets\n" > - dst_mac =3D vf0_setmac > + dst_mac =3D self.vf0_setmac > pkt_param=3D[("ether", {'dst': dst_mac, 'src': src_mac})] > result2 =3D self.tester.check_random_pkts(tgen_ports, pktnum=3D1= 00, > allow_miss=3DFalse, params=3Dpkt_param) > print "\nshow port stats in testpmd for double check: \n", > self.vm0_testpmd.execute_cmd('show port stats all') > self.verify(result2 !=3D False, "VF0 failed to forward packets t= o > VF1") >=20 > print "\nThirdly, negative test, send packets to a wrong MAC, > expected result is RX packets=3D0\n" > - dst_mac =3D vf0_wrongmac > + dst_mac =3D self.vf0_wrongmac > pkt_param=3D[("ether", {'dst': dst_mac, 'src': src_mac})] > result3 =3D self.tester.check_random_pkts(tgen_ports, pktnum=3D1= 00, > allow_miss=3DFalse, params=3Dpkt_param) > print "\nshow port stats in testpmd for double check: \n", > self.vm0_testpmd.execute_cmd('show port stats all') > -- > 2.17.2