From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id F189F388F for ; Wed, 4 May 2016 18:50:53 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 04 May 2016 09:42:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,578,1455004800"; d="scan'208";a="972598013" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga002.fm.intel.com with ESMTP; 04 May 2016 09:42:56 -0700 Received: from fmsmsx157.amr.corp.intel.com (10.18.116.73) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 4 May 2016 09:42:56 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX157.amr.corp.intel.com (10.18.116.73) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 4 May 2016 09:42:55 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.58]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.45]) with mapi id 14.03.0248.002; Thu, 5 May 2016 00:42:54 +0800 From: "Liu, Yong" To: "Mo, YufengX" , "dts@dpdk.org" CC: "Mo, YufengX" Thread-Topic: [dts] [PATCH V1]dpdk ethtool update test script and test plan Thread-Index: AQHRpc0SS/vXFxZan02AZfYMmIx8Up+o+ejA Date: Wed, 4 May 2016 16:42:53 +0000 Message-ID: <86228AFD5BCD8E4EBFD2B90117B5E81E14F1AF76@SHSMSX103.ccr.corp.intel.com> References: <1462342778-16746-1-git-send-email-yufengx.mo@intel.com> <1462342778-16746-2-git-send-email-yufengx.mo@intel.com> In-Reply-To: <1462342778-16746-2-git-send-email-yufengx.mo@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMDU3YWVjNWMtMzEyMy00NTFlLTk2ZDQtZTU3MTI0ZDU3MDhlIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IkowSDJzUmsrejFKSEpMbTcxUFwvWDRoY2lIV2Q0QlZ1ZUd1NHNZaXc2dllVPSJ9 x-ctpclassification: CTP_IC 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]dpdk ethtool update test script and test plan 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, 04 May 2016 16:50:54 -0000 Yufen, few comments below. > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Yufen Mo > Sent: Tuesday, May 03, 2016 11:20 PM > To: dts@dpdk.org > Cc: Mo, YufengX > Subject: [dts] [PATCH V1]dpdk ethtool update test script and test plan >=20 > From: yufengmx >=20 > change vlan packet check number,add process to resize linux ethtool eepro= m > dump data content, > ignore auto test link connect status on FVL. update related test cases' > test plan. >=20 > Signed-off-by: yufengmx > --- > tests/TestSuite_userspace_ethtool.py | 89 +++++++++++++++++++++++-------= - > ----- > 1 file changed, 58 insertions(+), 31 deletions(-) >=20 > diff --git a/tests/TestSuite_userspace_ethtool.py > b/tests/TestSuite_userspace_ethtool.py > index c479093..a0f4018 100644 > --- a/tests/TestSuite_userspace_ethtool.py > +++ b/tests/TestSuite_userspace_ethtool.py > @@ -38,12 +38,12 @@ import dts > import time > import re > from test_case import TestCase > -from pmd_output import PmdOutput > from packet import Packet, sniff_packets, load_sniff_packets > import random > from etgen import IxiaPacketGenerator > from settings import HEADER_SIZE > from settings import SCAPY2IXIA > +from utils import RED >=20 >=20 > class TestUserspaceEthtool(TestCase, IxiaPacketGenerator): > @@ -127,6 +127,22 @@ class TestUserspaceEthtool(TestCase, > IxiaPacketGenerator): > else: > return 1518 >=20 > + def resize_linux_eeprom_file(self, dpdk_eeprom_file, > linux_eeprom_file): > + basePath =3D "/root/dpdk/" This directory may not existed, please use "self.dut.base_dir" which will i= ndicated dpdk folder. > + with open( basePath + dpdk_eeprom_file, 'rb') as fpDpdk: > + dpdk_bytes =3D fpDpdk.read() > + dpdk_length =3D len(dpdk_bytes) > + > + with open( basePath + linux_eeprom_file, 'rb') as fplinux: > + linux_bytes =3D fplinux.read() > + linux_length =3D len(linux_bytes) > + > + self.verify(dpdk_length <=3D linux_length, > + "linux ethtool haven't dump out enough data as dpdk > ethtool") > + > + with open( basePath + linux_eeprom_file, 'wb') as fplinux: > + fplinux.write(linux_bytes[:dpdk_length]) > + > def strip_md5(self, filename): > md5_info =3D self.dut.send_expect("md5sum %s" % filename, "# ") > md5_pattern =3D r"(\w+) (\w+)" > @@ -155,30 +171,33 @@ class TestUserspaceEthtool(TestCase, > IxiaPacketGenerator): > version =3D m.group(3) > print dts.GREEN("Detect port %s with %s driver\n" % (por= t, > driver)) >=20 > - # check link status dump function > - for port in self.ports: > - tester_port =3D self.tester.get_local_port(port) > - intf =3D self.tester.get_interface(tester_port) > - self.tester.send_expect("ip link set dev %s down" % intf, "# > ") > - # wait for link stable > - time.sleep(5) > - > - out =3D self.dut.send_expect("link", "EthApp>", 60) > - link_pattern =3D r"Port (\d+): (.*)" > - link_infos =3D out.split("\r\n") > - for link_info in link_infos: > - m =3D re.match(link_pattern, link_info) > - if m: > - port =3D m.group(1) > - status =3D m.group(2) > - self.verify(status =3D=3D "Down", "Userspace tool failed= to > detect link down") > - > - for port in self.ports: > - tester_port =3D self.tester.get_local_port(port) > - intf =3D self.tester.get_interface(tester_port) > - self.tester.send_expect("ip link set dev %s up" % intf, "# "= ) > - # wait for link stable > - time.sleep(5) > + # ethtool doesn't support port disconnect by tools of linux > + # only detect physical link disconnect status > + if self.nic.startswith("fortville") =3D=3D False: > + # check link status dump function > + for port in self.ports: > + tester_port =3D self.tester.get_local_port(port) > + intf =3D self.tester.get_interface(tester_port) > + self.tester.send_expect("ip link set dev %s down" % intf= , > "# ") > + # wait for link stable > + time.sleep(5) > + > + out =3D self.dut.send_expect("link", "EthApp>", 60) > + link_pattern =3D r"Port (\d+): (.*)" > + link_infos =3D out.split("\r\n") > + for link_info in link_infos: > + m =3D re.match(link_pattern, link_info) > + if m: > + port =3D m.group(1) > + status =3D m.group(2) > + self.verify(status =3D=3D "Down", "Userspace tool fa= iled > to detect link down") > + > + for port in self.ports: > + tester_port =3D self.tester.get_local_port(port) > + intf =3D self.tester.get_interface(tester_port) > + self.tester.send_expect("ip link set dev %s up" % intf, > "# ") > + # wait for link stable > + time.sleep(5) >=20 > # check port stats function > pkt =3D Packet(pkt_type=3D'UDP') > @@ -271,8 +290,10 @@ class TestUserspaceEthtool(TestCase, > IxiaPacketGenerator): >=20 > for index in range(len(self.ports)): > md5 =3D self.strip_md5(portsinfo[index]['eeprom_file']) > + > self.resize_linux_eeprom_file( portsinfo[index]['eeprom_file'], > portsinfo[index]['ethtool_eeprom']) > md5_ref =3D self.strip_md5(portsinfo[index]['ethtool_eeprom'= ]) > - print dts.GREEN("Reference eeprom md5 %s" % md5_ref) > + print dts.GREEN("Reference eeprom md5 %s" % md5) > + print dts.GREEN("Reference eeprom md5_ref %s" % md5_ref) > self.verify(md5 =3D=3D md5_ref, "Dumped eeprom not same as l= inux > dumped") >=20 > def test_ring_parameter(self): > @@ -323,7 +344,6 @@ class TestUserspaceEthtool(TestCase, > IxiaPacketGenerator): > tester_port =3D self.tester.get_local_port(port) > intf =3D self.tester.get_interface(tester_port) > pkt.send_pkt(tx_port=3Dintf) > - time.sleep(2) > rx_pkts, tx_pkts =3D self.strip_portstats(port) > self.verify(rx_pkts =3D=3D ori_rx_pkts + 1, "Failed to Rx vl= an > packet") > self.verify(tx_pkts =3D=3D ori_tx_pkts + 1, "Failed to Tx vl= an > packet") > @@ -372,8 +392,8 @@ class TestUserspaceEthtool(TestCase, > IxiaPacketGenerator): > inst =3D sniff_packets(intf, timeout=3D5) > pkt.send_pkt(tx_port=3Dintf) > pkts =3D load_sniff_packets(inst) > - self.verify(len(pkts) =3D=3D 2, "Packet not forwarded as > expected") > - src_mac =3D pkts[1].strip_layer_element("layer2", "src") > + self.verify(len(pkts) =3D=3D 1, "Packet not forwarded as > expected") > + src_mac =3D pkts[0].strip_layer_element("layer2", "src") > self.verify(src_mac =3D=3D valid_mac, "Forwarded packet not = match > default mac") >=20 > # check multicase will not be valid mac > @@ -405,11 +425,17 @@ class TestUserspaceEthtool(TestCase, > IxiaPacketGenerator): > rx_pkts, tx_pkts =3D self.strip_portstats(index) > self.verify(rx_pkts =3D=3D ori_rx_pkts, "Failed to stop port= ") > # restart port and check packet can normally forwarded > + time.sleep(2) > self.dut.send_expect("open %d" % index, "EthApp>") > # wait few time for port ready > - time.sleep(0.5) > + rx_pkts, tx_pkts =3D self.strip_portstats(index) > + time.sleep(2) > pkt.send_pkt(tx_port=3Dintf) > rx_pkts_open, tx_pkts_open =3D self.strip_portstats(index) > + if rx_pkts_open !=3D rx_pkts + 1: > + RED( "Failed to reopen port rx") > + if tx_pkts_open !=3D tx_pkts + 1: > + RED( "Failed to reopen port tx") This logic look like the same as below verify judgement, what's the differe= nce here? > self.verify(rx_pkts_open =3D=3D rx_pkts + 1, "Failed to reop= en > port rx") > self.verify(tx_pkts_open =3D=3D tx_pkts + 1, "Failed to reop= en > port tx") >=20 > @@ -430,11 +456,12 @@ class TestUserspaceEthtool(TestCase, > IxiaPacketGenerator): > self.tester.send_expect("ifconfig %s mtu 9000" % (intf), "# = ") > for mtu in mtus: > self.dut.send_expect("mtu %d %d" % (index, mtu), > "EthApp>") > + ori_rx_pkts, _ =3D self.strip_portstats(index) > pkt_size =3D mtu + HEADER_SIZE['eth'] > pkt =3D Packet(pkt_len=3Dpkt_size) > pkt.send_pkt(tx_port=3Dintf) > rx_pkts, _ =3D self.strip_portstats(index) > - self.verify(rx_pkts =3D=3D 1, "Packet match mtu not forw= arded > as expected") > + self.verify(rx_pkts =3D=3D ori_rx_pkts, "Packet match mt= u not > forwarded as expected") > pkt =3D Packet(pkt_len=3Dmtu + 1) > pkt.send_pkt(tx_port=3Dintf) > rx_pkts_over, _ =3D self.strip_portstats(index) > -- > 1.9.3