From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 3F902A0096 for ; Tue, 4 Jun 2019 07:29:47 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D51DC1B959; Tue, 4 Jun 2019 07:29:46 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 6F3F21B94E for ; Tue, 4 Jun 2019 07:29:44 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Jun 2019 22:29:43 -0700 X-ExtLoop1: 1 Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga004.fm.intel.com with ESMTP; 03 Jun 2019 22:29:43 -0700 Received: from shsmsx105.ccr.corp.intel.com (10.239.4.158) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 3 Jun 2019 22:29:43 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.134]) by SHSMSX105.ccr.corp.intel.com ([169.254.11.153]) with mapi id 14.03.0415.000; Tue, 4 Jun 2019 13:29:41 +0800 From: "Zhu, WenhuiX" To: "Zhang, YanX A" , "dts@dpdk.org" CC: "Zhang, YanX A" Thread-Topic: [dts] [PATCH V1] tests/TestSuite_vf_kernel:Optimize validation results and scripts Thread-Index: AQHVGpVFH1eUDvddNEaGMeS0Ca9pCKaK97Og Date: Tue, 4 Jun 2019 05:29:41 +0000 Message-ID: References: <1559625890-133337-1-git-send-email-yanx.a.zhang@intel.com> In-Reply-To: <1559625890-133337-1-git-send-email-yanx.a.zhang@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: 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/TestSuite_vf_kernel:Optimize validation results and scripts 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" Tested-by: Zhu, WenhuiX -----Original Message----- From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of zhang,yan Sent: Tuesday, June 4, 2019 1:25 PM To: dts@dpdk.org Cc: Zhang, YanX A Subject: [dts] [PATCH V1] tests/TestSuite_vf_kernel:Optimize validation res= ults and scripts 1.Modify the verification result of the case. --Before each case runs, we need to check that the connection state of = the corresponding NIC is yes. If no, we need to call the restore_interfaces= _linux() method to restore the NIC state to yes, and there is no need to do= any other operations. 2.Add code to check NIC status. --Sometimes, ifconfig %s up does not take effect due to the case runnin= g too fast, and it needs to wait for a certain period of time. 3.Add time.sleep() to enable tcpdump to start normally. --Sometimes, the tcpdump command requires a certain open time, otherwis= e the corresponding packet cannot be fetched. 4.Replace the virtual NIC intf0 to intf1. --When all cases run together, it will affect the intf0 NIC required by= test_vlan, so replace intf0 to intf1. Signed-off-by: zhang,yan --- tests/TestSuite_vf_kernel.py | 38 +++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/tests/TestSuite_vf_kernel.py b/tests/TestSuite_vf_kernel.py in= dex f80c9e9..92b1202 100644 --- a/tests/TestSuite_vf_kernel.py +++ b/tests/TestSuite_vf_kernel.py @@ -226,8 +226,16 @@ class TestVfKernel(TestCase): """ for i in range(5): # pf up + vf up -> vf up + start_time =3D time.time() self.vm0_dut.send_expect("ifconfig %s up" % self.vm0_intf0, "#= ") out =3D self.vm0_dut.send_expect("ethtool %s" % self.vm0_intf0= , "#") + while "Link detected: yes" not in out: + end_time =3D time.time() + if end_time - start_time >=3D 3: + break + else: + out =3D self.vm0_dut.send_expect("ethtool %s" % self.v= m0_intf0, "#") + time.sleep(1) self.verify("Link detected: yes" in out, "Wrong link status") time.sleep(3) =20 @@ -391,6 +399,7 @@ class TestVfKernel(TestCase): def verify_vm_tcpdump(self, vm_dut, intf, mac, pkt_lens=3D64, num=3D1,= vlan_id=3D'', param=3D''): vm_dut.send_expect("tcpdump -i %s %s -e ether src %s" % (intf, param, self.tester_mac), "tcpdump", 10) + time.sleep(2) self.send_packet(mac, pkt_lens, num, vlan_id) out =3D vm_dut.get_session_output(timeout=3D10) vm_dut.send_expect("^C", "#", 10) @@ -417,8 +426,8 @@ class TestVf= Kernel(TestCase): vlan_ids =3D random.randint(1, 4095) self.dut_testpmd.execute_cmd("vlan set filter on 0") self.dut_testpmd.execute_cmd("vlan set strip on 0") - self.vm0_dut.send_expect("ifconfig %s up" % self.vm0_intf0, "#") - vm0_vf0_mac =3D self.vm0_dut.ports_info[0]['port'].get_mac_addr() + self.vm0_dut.send_expect("ifconfig %s up" % self.vm0_intf1, "#") + vm0_vf1_mac =3D self.vm0_dut.ports_info[1]['port'].get_mac_addr() =20 self.vm0_dut.send_expect("modprobe 8021q", "#") out =3D self.vm0_dut.send_expect("lsmod |grep 8021q", "#") @@ -426= ,33 +435,33 @@ class TestVfKernel(TestCase): =20 # Add random vlan id(0~4095) on kernel VF0 self.vm0_dut.send_expect("vconfig add %s %s" % - (self.vm0_intf0, vlan_ids), "#") + (self.vm0_intf1, vlan_ids), "#") out =3D self.vm0_dut.send_expect("ls /proc/net/vlan/ ", "#") - self.verify("%s.%s" % (self.vm0_intf0, vlan_ids) + self.verify("%s.%s" % (self.vm0_intf1, vlan_ids) in out, "take vlan id failure") =20 # Send packet from tester to VF MAC with not-matching vlan id, che= ck # the packet can't be received at the vlan device # fortville nic need add -p parameter to disable promisc mode wrong_vlan =3D vlan_ids % 4095 + 1 - self.verify(self.verify_vm_tcpdump(self.vm0_dut, self.vm0_intf0, v= m0_vf0_mac, + self.verify(self.verify_vm_tcpdump(self.vm0_dut,=20 + self.vm0_intf1, vm0_vf1_mac, vlan_id=3D'%d' % wrong_vlan, pa= ram=3D'-p') =3D=3D False, "received wrong vlan packet") # Send packet from tester to VF MAC with matching vlan id, check t= he packet can be received at the vlan device. # check_result =3D self.verify_vm_tcpdump(self.vm0_dut, self.vm0_i= ntf0, self.vm0_vf0_mac, vlan_id=3D'%d' %vlan_ids) check_result =3D self.verify_vm_tcpdump( - self.vm0_dut, self.vm0_intf0, vm0_vf0_mac, vlan_id=3D'%d' % vl= an_ids, param=3D'-p') + self.vm0_dut, self.vm0_intf1, vm0_vf1_mac, vlan_id=3D'%d' %=20 + vlan_ids, param=3D'-p') self.verify(check_result, "can't received vlan_id=3D%d packet" % v= lan_ids) =20 # Delete configured vlan device self.vm0_dut.send_expect("vconfig rem %s.%s" % - (self.vm0_intf0, vlan_ids), "#") + (self.vm0_intf1, vlan_ids), "#") out =3D self.vm0_dut.send_expect("ls /proc/net/vlan/ ", "#") - self.verify("%s.%s" % (self.vm0_intf0, vlan_ids) + self.verify("%s.%s" % (self.vm0_intf1, vlan_ids) not in out, "vlan error") # behavior is different between niantic and fortville ,because of = kernel # driver - self.verify(self.verify_vm_tcpdump(self.vm0_dut, self.vm0_intf0, - vm0_vf0_mac, vlan_id=3D'%d' % v= lan_ids, param=3D'-p') =3D=3D False, "delete vlan error") + self.verify(self.verify_vm_tcpdump(self.vm0_dut, self.vm0_intf1, + vm0_vf1_mac, vlan_id=3D'%d' %=20 + vlan_ids, param=3D'-p') =3D=3D False, "delete vlan error") self.dut_testpmd.execute_cmd("vlan set filter off 0") =20 def test_packet_statistic(self): @@ -486,18 +495,15 @@ class TestVfKernel(TestCase): for i in range(5): # down-up get new mac form pf. # because dpdk pf will give an random mac when dpdk pf restar= t. - session.send_expect("ifconfig %s down" % intf, "#") - out =3D session.send_expect("ifconfig %s up" % intf, "#") + out =3D session.send_expect("ethtool %s" % intf, "#") # SIOCSIFFLAGS: Network is down # i think the pf link abnormal - if "Network is down" in out: + if "Link detected: no" in out: print GREEN(out) print GREEN("Try again") session.restore_interfaces_linux() else: - out =3D session.send_expect("ethtool %s" % intf, "#") - if "Link detected: yes" in out: - return True + return True time.sleep(1) return False =20 -- 2.17.2