From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 9247C1E2B for ; Tue, 26 Feb 2019 04:14:19 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Feb 2019 19:14:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,413,1544515200"; d="scan'208";a="147283078" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga004.fm.intel.com with ESMTP; 25 Feb 2019 19:14:18 -0800 Received: from fmsmsx122.amr.corp.intel.com (10.18.125.37) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 25 Feb 2019 19:14:17 -0800 Received: from shsmsx153.ccr.corp.intel.com (10.239.6.53) by fmsmsx122.amr.corp.intel.com (10.18.125.37) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 25 Feb 2019 19:14:17 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.110]) by SHSMSX153.ccr.corp.intel.com ([169.254.12.190]) with mapi id 14.03.0415.000; Tue, 26 Feb 2019 11:14:15 +0800 From: "Tu, Lijuan" To: "Peng, Yuan" , "dts@dpdk.org" CC: "Peng, Yuan" Thread-Topic: [dts] [PATCH]tests: encapsulate funtion for TestSuite_veb_switch Thread-Index: AQHUxPpxGtLLPTN5nUKuT+KSUHWMcqXxeLjg Date: Tue, 26 Feb 2019 03:14:14 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BA2722A@SHSMSX101.ccr.corp.intel.com> References: <1550213520-7242-1-git-send-email-yuan.peng@intel.com> In-Reply-To: <1550213520-7242-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: dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMTE0NjQxZjUtMGM3Yy00NWNmLTg3Y2EtZDc4NGVlZWNiMWU5IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiZGdvMmdXaWZ3TlBOQUFGbVYrdFBhYlBkMFwvSlJPUTE0U2JXcitZVU9oRGk5VWxZTTZoVFwvXC9UeW14TVE4cmNHRyJ9 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: encapsulate funtion for TestSuite_veb_switch 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: Tue, 26 Feb 2019 03:14:20 -0000 Applied, thanks > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Peng Yuan > Sent: Friday, February 15, 2019 2:52 PM > To: dts@dpdk.org > Cc: Peng, Yuan > Subject: [dts] [PATCH]tests: encapsulate funtion for TestSuite_veb_switch >=20 > Encapsulate funtion for TestSuite_veb_switch.py >=20 > Signed-off-by: Peng Yuan >=20 > diff --git a/tests/TestSuite_veb_switch.py b/tests/TestSuite_veb_switch.p= y index > 0dc570a..0b0089b 100644 > --- a/tests/TestSuite_veb_switch.py > +++ b/tests/TestSuite_veb_switch.py > @@ -127,7 +127,30 @@ class TestVEBSwitching(TestCase): > pkt.config_layer('ether', {'dst': vf_mac}) > pkt.send_pkt(tx_port=3Ditf) > time.sleep(.5) > - > + > + def count_packet(self, out, mac): > + """ > + Count packet sum number. > + """ > + lines =3D out.split("\r\n") > + cnt =3D 0 > + count_pkt =3D 0 > + # count the packet received from specified mac address. > + for line in lines: > + line =3D line.strip() > + if len(line) !=3D 0 and line.startswith(("src=3D",)): > + for item in line.split(" "): > + item =3D item.strip() > + if(item =3D=3D ("src=3D%s" % mac)): > + cnt =3D cnt + 1 > + elif(item =3D=3D "L4_UDP"): > + cnt =3D cnt + 1 > + if (cnt =3D=3D 2): > + count_pkt =3D count_pkt + 1 > + cnt =3D 0 > + print utils.GREEN("The number of UDP packets received by pf is %= d." % > count_pkt) > + return count_pkt > + > # Test cases. > def set_up_all(self): > """ > @@ -207,8 +230,8 @@ class TestVEBSwitching(TestCase): >=20 > def test_VEB_switching_inter_vfs(self): > """ > - Kernel PF, then create 2VFs. VFs running dpdk testpmd, send traf= fic to > - VF1, and set the packet's DEST MAC to VF2, check if VF2 can rece= ive > + Kernel PF, then create 2VFs. VFs running dpdk testpmd, > + send traffic from VF1 to VF2, check if VF2 can receive > the packets. Check Inter VF-VF MAC switch. > """ > self.setup_env(driver=3D'default') @@ -234,8 +257,8 @@ class > TestVEBSwitching(TestCase): > def test_VEB_switching_inter_vfs_mac_fwd(self): > """ > Kernel PF, then create 2VFs. VFs running dpdk testpmd, send traf= fic to > - VF1, and set the packet's DEST MAC to VF2, check if VF2 can rece= ive > - the packets. Check Inter VF-VF MAC switch. > + VF1 with VF1's MAC as packet's DEST MAC, set ether peer address = to VF2's > MAC. > + Check if VF2 can receive the packets. Check Inter VF-VF MAC swit= ch. > """ > self.setup_env(driver=3D'default') > self.dut.send_expect("./%s/app/testpmd -c 0xf -n 4 --socket-mem > 1024,1024 -w %s --file-prefix=3Dtest1 -- -i --eth-peer=3D0,%s" % (self.ta= rget, > self.sriov_vfs_port[0].pci, self.vf1_mac), "testpmd>", 120) @@ -344,27 +3= 67,12 > @@ class TestVEBSwitching(TestCase): > out =3D self.dut.get_session_output(timeout=3D1) > self.session_secondary.send_expect("stop", "testpmd>", 2) > self.dut.send_expect("stop", "testpmd>", 2) > - lines =3D out.split("\r\n") > - cnt =3D 0 > - count_pkt =3D 0 > - # count the packet received by pf from vf. > - for line in lines: > - line =3D line.strip() > - if len(line) !=3D 0 and line.startswith(("src=3D",)): > - for item in line.split(" "): > - item =3D item.strip() > - if(item =3D=3D ("src=3D%s" % self.vf0_mac)): > - cnt =3D cnt + 1 > - elif(item =3D=3D "L4_UDP"): > - cnt =3D cnt + 1 > - if (cnt =3D=3D 2): > - count_pkt =3D count_pkt + 1 > - cnt =3D 0 > - print utils.GREEN("The number of UDP packets received by pf is %= d." % > count_pkt) > + > + count_pkt =3D self.count_packet(out, self.vf0_mac) > vf0_tx_stats =3D self.veb_get_pmd_stats("second", 0, "tx") > pf_rx_stats =3D self.veb_get_pmd_stats("first", 0, "rx") > - self.verify(vf0_tx_stats[0] > 0, "no packet was sent by VF0") > - self.verify(count_pkt > 0, "no packet was received by PF") > + self.verify(vf0_tx_stats[0] > 1000, "no packet was sent by VF0") > + self.verify(count_pkt > 100, "no packet was received by PF") > self.session_secondary.send_expect("quit", "# ") > time.sleep(2) > self.dut.send_expect("quit", "# ") @@ -388,7 +396,7 @@ class > TestVEBSwitching(TestCase): >=20 > vf0_rx_stats =3D self.veb_get_pmd_stats("second", 0, "rx") > print utils.GREEN("The number of UDP packets received by vf is %= d." % > vf0_rx_stats[0]) > - self.verify(vf0_rx_stats[0] > 0, "no packet was received by VF0"= ) > + self.verify(vf0_rx_stats[0] > 100, "no packet was received by > + VF0") > self.session_secondary.send_expect("quit", "# ") > time.sleep(2) > self.dut.send_expect("quit", "# ") > -- > 2.5.0