From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 1AC591DB1 for ; Mon, 8 Jun 2015 03:54:37 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP; 07 Jun 2015 18:54:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,570,1427785200"; d="scan'208";a="739123308" Received: from pgsmsx106.gar.corp.intel.com ([10.221.44.98]) by fmsmga002.fm.intel.com with ESMTP; 07 Jun 2015 18:54:34 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by PGSMSX106.gar.corp.intel.com (10.221.44.98) with Microsoft SMTP Server (TLS) id 14.3.224.2; Mon, 8 Jun 2015 09:54:33 +0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.120]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.168]) with mapi id 14.03.0224.002; Mon, 8 Jun 2015 09:54:31 +0800 From: "Fu, JingguoX" To: "Xu, HuilongX" , "dts@dpdk.org" Thread-Topic: [dts 3/3] [PATCH V2] add shutdown api test code Thread-Index: AQHQmbXnIIcOd+bDtUSh3hlWwUTqBJ2h6KKQ Date: Mon, 8 Jun 2015 01:54:32 +0000 Message-ID: <6BD6202160B55B409D42329311582262673368@SHSMSX101.ccr.corp.intel.com> References: <1432865952-22407-1-git-send-email-huilongx.xu@intel.com> <1432865952-22407-3-git-send-email-huilongx.xu@intel.com> In-Reply-To: <1432865952-22407-3-git-send-email-huilongx.xu@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-cr-hashedpuzzle: Ayph BEhr BQMx CXpS C1TF Djuf EKPT EL3U FT3y Fpm2 IXUu IlVH JblP JgYd Kiyn Ktxd; 1; ZAB0AHMAQABkAHAAZABrAC4AbwByAGcA; Sosha1_v1; 7; {0AAA35EE-2B4D-4DCE-951D-2C28E9AFAF50}; agBpAG4AZwBnAHUAbwB4AC4AZgB1AEAAaQBuAHQAZQBsAC4AYwBvAG0A; Mon, 08 Jun 2015 01:54:30 GMT; UgBFADoAIABbAGQAdABzACAAMwAvADMAXQAgAFsAUABBAFQAQwBIACAAVgAyAF0AIABhAGQAZAAgAHMAaAB1AHQAZABvAHcAbgAgAGEAcABpACAAdABlAHMAdAAgAGMAbwBkAGUA x-cr-puzzleid: {0AAA35EE-2B4D-4DCE-951D-2C28E9AFAF50} 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] [dts 3/3] [PATCH V2] add shutdown api test code 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: Mon, 08 Jun 2015 01:54:39 -0000 > -----Original Message----- > From: Xu, HuilongX > Sent: Friday, May 29, 2015 10:19 > To: dts@dpdk.org > Cc: Fu, JingguoX; Xu, HuilongX > Subject: [dts 3/3] [PATCH V2] add shutdown api test code >=20 > From: huilong xu >=20 >=20 > Signed-off-by: huilong xu > --- > tests/TestSuite_shutdown_api.py | 488 > +++++++++++++++++++++++++++++++++++++++ > 1 files changed, 488 insertions(+), 0 deletions(-) > create mode 100644 tests/TestSuite_shutdown_api.py >=20 > diff --git a/tests/TestSuite_shutdown_api.py b/tests/TestSuite_shutdown_a= pi.py > new file mode 100644 > index 0000000..fd38ae8 > --- /dev/null > +++ b/tests/TestSuite_shutdown_api.py > @@ -0,0 +1,488 @@ > +# > + > +""" > +DPDK Test suite. > + > +Test Shutdown API Feature > + > +""" > + > +import dts > +import time > +import re > +import os > +from test_case import TestCase > +from pmd_output import PmdOutput > +from setting import HEADER_SIZE > + > +# > +# > +# Test class. > +# > + > + > +class TestShutdownApi(TestCase): > + > + # > + # > + # > + # Test cases. > + # > + > + def set_up_all(self): > + """ > + Run at the start of each test suite. > + """ > + self.ports =3D self.dut.get_ports() > + print self.nic, self.ports > + self.verify(len(self.ports) >=3D 2, "Insufficient number of port= s.") > + self.ports_socket =3D self.dut.get_numa_id(self.ports[0]) > + > + for port in self.ports: > + self.tester.send_expect("ifconfig %s mtu %s" % ( > + self.tester.get_interface(self.tester.get_local_port(por= t)), > 5000), "# ") > + > + self.pmdout =3D PmdOutput(self.dut) > + > + def get_stats(self, portid): > + """ > + Get packets number from port statistic. > + """ > + output =3D PmdOutput(self.dut) > + stats =3D output.get_pmd_stats(portid) > + return stats > + > + def check_forwarding(self, ports, nic, testerports=3D[None, None], > pktSize=3D64, received=3DTrue, crcStrip=3DFalse, vlan=3DFalse): > + for i in range(len(ports)): > + if i % 2 =3D=3D 0: > + self.send_packet(ports[i], ports[i + 1], self.nic, > testerports[1], pktSize, received, crcStrip=3DcrcStrip, vlan=3Dvlan) > + self.send_packet(ports[i + 1], ports[i], self.nic, > testerports[0], pktSize, received, crcStrip=3DcrcStrip, vlan=3Dvlan) > + > + def send_packet(self, txPort, rxPort, nic, testerports=3DNone, pktSi= ze=3D64, > received=3DTrue, crcStrip=3DFalse, vlan=3DFalse): > + """ > + Send packages according to parameters. > + """ > + port0_stats =3D self.get_stats(txPort) > + gp0tx_pkts, gp0tx_bytes =3D [port0_stats['TX-packets'], > port0_stats['TX-bytes']] > + port1_stats =3D self.get_stats(rxPort) > + gp1rx_pkts, gp1rx_err, gp1rx_bytes =3D [port1_stats['RX-packets'= ], > port1_stats['RX-errors'], port1_stats['RX-bytes']] > + time.sleep(5) > + > + if testerports is None: > + itf =3D > self.tester.get_interface(self.tester.get_local_port(rxPort)) > + else: > + itf =3D testerports > + mac =3D self.dut.get_mac_address(txPort) > + > + self.tester.scapy_foreground() > + if self.nic in ["fortville_eagle", "fortville_spirit", > + "fortville_spirit_single", "bartonhills", > + "powerville", "springville", "hartwell"]: > + pktlen =3D pktSize - HEADER_SIZE['eth'] -4 > + else: > + pktlen =3D pktSize - HEADER_SIZE['eth'] > + padding =3D pktlen - HEADER_SIZE['ip'] > + > + if vlan: > + > self.tester.scapy_append('sendp([Ether(dst=3D"%s")/Dot1Q(vlan=3D1)/IP()/R= aw(load=3D" > \x50"*%s)], iface=3D"%s")' % (mac, padding, itf)) > + else: > + > self.tester.scapy_append('sendp([Ether(dst=3D"%s")/IP()/Raw(load=3D"\x50"= *%s)], > iface=3D"%s")' % (mac, padding, itf)) > + > + self.tester.scapy_execute() > + time.sleep(3) > + > + port0_stats =3D self.get_stats(txPort) > + p0tx_pkts, p0tx_bytes =3D [port0_stats['TX-packets'], port0_stat= s['TX- > bytes']] > + port1_stats =3D self.get_stats(rxPort) > + p1rx_pkts, p1rx_err, p1rx_bytes =3D [port1_stats['RX-packets'], > port1_stats['RX-errors'], port1_stats['RX-bytes']] > + time.sleep(5) > + > + p0tx_pkts -=3D gp0tx_pkts > + p0tx_bytes -=3D gp0tx_bytes > + p1rx_pkts -=3D gp1rx_pkts > + p1rx_bytes -=3D gp1rx_bytes > + p1rx_err -=3D gp1rx_err > + if received: > + > + if vlan: > + self.verify(p0tx_pkts =3D=3D p1rx_pkts, > + "Wrong TX pkts p0_tx=3D%d, p1_rx=3D%d" % (p0= tx_pkts, > p1rx_pkts)) > + else: > + if self.nic in ["fortville_eagle", "fortville_spirit", > + "fortville_spirit_single", "bartonhills"= , > + "powerville", "springville", "hartwell"]= : > + > + self.verify(p0tx_bytes =3D=3D pktSize, > + "Wrong TX bytes p0_tx=3D%d, pktSize=3D%d= " % > (p0tx_bytes, pktSize)) > + else: > + self.verify(p0tx_bytes =3D=3D pktSize, > + "Wrong TX bytes p0_tx=3D%d, pktSize=3D%d= " % > (p0tx_bytes, pktSize)) > + if crcStrip: > + if self.nic in ["fortville_eagle", "fortville_spirit", > + "fortville_spirit_single", "bartonhills"= , > + "powerville", "springville", "hartwell"]= : > + self.verify(p1rx_bytes - 4 =3D=3D pktSize, > + "Wrong RX bytes CRC strip: p1_rx=3D%d, > pktSize=3D%d" % (p1rx_bytes, pktSize)) > + else: > + self.verify(p1rx_bytes =3D=3D pktSize - 4, > + "Wrong RX bytes CRC strip: p1_rx=3D%d, > pktSize=3D%d" % (p1rx_bytes, pktSize)) > + else: > + if vlan: > + if self.nic in ["fortville_eagle", "fortville_spirit= ", > + "fortville_spirit_single", "bartonhi= lls", > + "powerville", "springville", "hartwe= ll"]: > + self.verify(p1rx_bytes =3D=3D pktSize, > + "Wrong RX bytes No CRC strip: > p1_rx=3D%d, pktSize=3D%d" % (p1rx_bytes, pktSize)) > + else: > + self.verify(p1rx_bytes =3D=3D pktSize + 4, > + "Wrong RX bytes No CRC strip: p1_rx= =3D%d, > pktSize=3D%d" % (p1rx_bytes, pktSize)) > + else: > + self.verify(p1rx_bytes =3D=3D pktSize, > + "Wrong RX bytes No CRC strip: p1_rx=3D%d= , > pktSize=3D%d" % (p1rx_bytes, pktSize)) > + else: > + self.verify( > + p0tx_pkts =3D=3D 0, "Packet not dropped p0tx_pkts=3D%d" = % p0tx_pkts) > + self.verify( > + p0tx_bytes =3D=3D 0, "Packet not dropped p0tx_bytes=3D%d= " % > p0tx_bytes) > + > + def check_ports(self, ports, status): > + """ > + Check link status of the ports. > + """ > + for port in ports: > + out =3D self.tester.send_expect( > + "ethtool %s" % > self.tester.get_interface(self.tester.get_local_port(port)), "# ") > + if status: > + self.verify("Link detected: yes" in out, "Wrong link sta= tus") > + else: > + self.verify("Link detected: no" in out, "Wrong link stat= us") > + > + def set_up(self): > + """ > + Run before each test case. > + """ > + pass > + > + def test_stop_restart(self): > + """ > + Stop and Restar. > + """ > + self.pmdout.start_testpmd("Default", "--portmask=3D%s" % > dts.create_mask(self.ports), socket=3Dself.ports_socket) > + > + self.dut.send_expect("set fwd mac", "testpmd>") > + self.dut.send_expect("start", "testpmd> ") > + self.check_forwarding(self.ports, self.nic) > + self.dut.send_expect("stop", "testpmd> ") > + self.check_forwarding(self.ports, self.nic, received=3DFalse) > + self.dut.send_expect("port stop all", "testpmd> ", 100) > + self.check_ports(self.ports, False) > + self.dut.send_expect("port start all", "testpmd> ", 100) > + self.check_ports(self.ports, True) > + self.dut.send_expect("start", "testpmd> ") > + self.check_forwarding(self.ports, self.nic) > + > + def test_set_promiscuousmode(self): > + """ > + Promiscuous mode. > + """ > + self.pmdout.start_testpmd("Default", "--portmask=3D%s" % > dts.create_mask([self.ports[0], self.ports[1]]), self.ports_socket) > + > + self.dut.send_expect("port stop all", "testpmd> ", 100) > + self.dut.send_expect("set promisc all off", "testpmd> ") > + self.dut.send_expect("port start all", "testpmd> ", 100) > + self.dut.send_expect("show config rxtx", "testpmd> ") > + self.dut.send_expect("start", "testpmd> ") > + > + try: > + self.check_forwarding([self.ports[0], self.ports[1]], self.n= ic) > + except dts.VerifyFailure as e: > + print 'promiscuous mode is working correctly' > + except Exception as e: > + print " !!! DEBUG IT: " + e.message > + return "FAIL" > + > + self.dut.send_expect("port stop all", "testpmd> ", 100) > + self.dut.send_expect("set promisc all on", "testpmd> ") > + self.dut.send_expect("port start all", "testpmd> ", 100) > + self.dut.send_expect("show config rxtx", "testpmd> ") > + self.dut.send_expect("start", "testpmd> ") > + self.check_forwarding([self.ports[0], self.ports[1]], self.nic) > + self.dut.send_expect("port stop all", "testpmd> ", 100) > + self.dut.send_expect("set promisc all off", "testpmd> ") > + self.dut.send_expect("start", "testpmd> ") > + self.dut.send_expect("quit", "# ", 30) > + > + def test_reset_queues(self): > + """ > + Reset RX/TX Queues. > + """ > + testerports =3D > [self.tester.get_interface(self.tester.get_local_port(self.ports[0])), > + > self.tester.get_interface(self.tester.get_local_port(self.ports[1])) > + ] > + #blackList =3D self.dut.create_blacklist_string(self.target, sel= f.nic) > + > + self.pmdout.start_testpmd("1S/8C/1T", "--portmask=3D%s" % > dts.create_mask([self.ports[0], self.ports[1]]), socket=3Dself.ports_sock= et) > + > + self.dut.send_expect("port stop all", "testpmd> ", 100) > + self.dut.send_expect("port config all rxq 2", "testpmd> ") > + self.dut.send_expect("port config all txq 2", "testpmd> ") > + #self.dut.send_expect("set coremask 0x1e", "testpmd> ") > + self.dut.send_expect("set coremask 0xe0", "testpmd> ") > + self.dut.send_expect("set fwd mac", "testpmd>") > + self.dut.send_expect("port start all", "testpmd> ", 100) > + out =3D self.dut.send_expect("show config rxtx", "testpmd> ") > + self.verify("RX queues=3D2" in out, "RX queues not reconfigured > properly") > + self.verify("TX queues=3D2" in out, "TX queues not reconfigured > properly") > + self.dut.send_expect("start", "testpmd> ") > + self.check_forwarding([0, 1], self.nic, testerports) > + self.dut.send_expect("quit", "# ", 30) > + #self.dut.send_expect("rmmod igb_uio", "# ", 20) > + #self.dut.send_expect("insmod ./%s/kmod/igb_uio.ko" % self.targe= t, > "#") > + #self.dut.bind_interfaces_linux() > + > + def test_reconfigure_ports(self): > + """ > + Reconfigure All Ports With The Same Configurations (CRC) > + """ > + self.pmdout.start_testpmd("Default", "--portmask=3D%s" % > dts.create_mask(self.ports), socket=3Dself.ports_socket) > + > + self.dut.send_expect("port stop all", "testpmd> ", 100) > + self.dut.send_expect("port config all crc-strip on", "testpmd> "= ) > + self.dut.send_expect("set fwd mac", "testpmd>") > + self.dut.send_expect("port start all", "testpmd> ", 100) > + out =3D self.dut.send_expect("show config rxtx", "testpmd> ") > + self.verify( > + "CRC stripping enabled" in out, "CRC stripping not enabled > properly") > + self.dut.send_expect("start", "testpmd> ") > + if self.nic in ["fortville_eagle", "fortville_spirit", > "fortville_spirit_single"]: > + self.check_forwarding(self.ports, self.nic, crcStrip=3DFalse= ) > + else: > + self.check_forwarding(self.ports, self.nic, crcStrip=3DTrue) > + > + > + def test_change_linkspeed(self): > + """ > + Change Link Speed. > + """ > + self.pmdout.start_testpmd("Default", "--portmask=3D%s" % > dts.create_mask(self.ports), socket=3Dself.ports_socket) > + > + out =3D self.tester.send_expect( > + "ethtool %s" % > self.tester.get_interface(self.tester.get_local_port(self.ports[0])), "# = ") > + if 'fortville_spirit' =3D=3D self.nic: > + result_scanner =3D r"([0-9]+)baseSR4/([A-Za-z]+)" > + else: > + result_scanner =3D r"([0-9]+)baseT/([A-Za-z]+)" > + scanner =3D re.compile(result_scanner, re.DOTALL) > + m =3D scanner.findall(out) > + configs =3D m[:-(len(m) / 2)] > + for config in configs: > + print config > + self.dut.send_expect("port stop all", "testpmd> ", 100) > + for port in self.ports: > + self.dut.send_expect("port config %d speed %s duplex %s"= % > (port, > + > config[0], config[1].lower()), "testpmd> ") > + self.dut.send_expect("set fwd mac", "testpmd>") > + self.dut.send_expect("port start all", "testpmd> ", 100) > + time.sleep(5) # sleep few seconds for link stable > + > + for port in self.ports: > + out =3D self.tester.send_expect( > + "ethtool %s" % > self.tester.get_interface(self.tester.get_local_port(port)), "# ") > + self.verify("Speed: %s" % config[0] in out, > + "Wrong speed reported by the self.tester.") > + self.verify("Duplex: %s" % config[1] in out, > + "Wrong link type reported by the self.tester= .") > + self.dut.send_expect("start", "testpmd> ") > + self.check_forwarding(self.ports, self.nic) > + self.dut.send_expect("stop", "testpmd> ") > + > + def failed_test_enable_disablejumbo(self): > + """ > + Enable/Disable Jumbo Frames. > + """ > + self.pmdout.start_testpmd("Default", "--portmask=3D%s" % > dts.create_mask(self.ports), socket=3Dself.ports_socket) > + self.dut.send_expect("port stop all", "testpmd> ", 100) > + self.dut.send_expect("vlan set strip off all", "testpmd> ") > + self.dut.send_expect("port config all max-pkt-len 2048", "testpm= d> ") > + for port in self.ports: > + self.dut.send_expect("rx_vlan add 1 %d" % port, "testpmd> ") > + self.dut.send_expect("set fwd mac", "testpmd>") > + self.dut.send_expect("port start all", "testpmd> ", 100) > + self.dut.send_expect("start", "testpmd> ") > + > + self.check_forwarding(self.ports, self.nic, pktSize=3D2047, vlan= =3DTrue) > + self.check_forwarding(self.ports, self.nic, pktSize=3D2048, vlan= =3DTrue) > + self.check_forwarding(self.ports, self.nic, pktSize=3D2049, > received=3DFalse, vlan=3DTrue) > + > + self.dut.send_expect("stop", "testpmd> ") > + self.dut.send_expect("port stop all", "testpmd> ", 100) > + self.dut.send_expect("port config all hw-vlan off", "testpmd> ") > + self.dut.send_expect("port start all", "testpmd> ", 100) > + self.dut.send_expect("start", "testpmd> ") > + if ((self.nic =3D=3D "bartonhills") or (self.nic =3D=3D "powervi= lle") or > (self.nic =3D=3D "springville") or (self.nic =3D=3D "hartwell")): > + self.check_forwarding(self.ports, self.nic, pktSize=3D2051) > + self.check_forwarding(self.ports, self.nic, pktSize=3D2052) > + self.check_forwarding(self.ports, self.nic, pktSize=3D2053, > received=3DFalse) > + else: > + self.check_forwarding(self.ports, self.nic, pktSize=3D2047) > + self.check_forwarding(self.ports, self.nic, pktSize=3D2048) > + self.check_forwarding(self.ports, self.nic, pktSize=3D2049, > received=3DFalse) > + > + def test_enable_disablerss(self): > + """ > + Enable/Disable RSS. > + """ > + self.pmdout.start_testpmd("Default", "--portmask=3D%s" % > dts.create_mask(self.ports), socket=3Dself.ports_socket) > + > + self.dut.send_expect("port stop all", "testpmd> ", 100) > + self.dut.send_expect("port config rss ip", "testpmd> ") > + self.dut.send_expect("set fwd mac", "testpmd>") > + self.dut.send_expect("port start all", "testpmd> ", 100) > + self.dut.send_expect("start", "testpmd> ") > + self.check_forwarding(self.ports, self.nic) > + > + def test_change_numberrxdtxd(self): > + """ > + Enable/Disable Jumbo Frame. > + """ > + self.pmdout.start_testpmd("Default", "--portmask=3D%s" % > dts.create_mask(self.ports), socket=3Dself.ports_socket) > + > + self.dut.send_expect("port stop all", "testpmd> ", 100) > + self.dut.send_expect("port config all rxd 1024", "testpmd> ") > + self.dut.send_expect("port config all txd 1024", "testpmd> ") > + self.dut.send_expect("set fwd mac", "testpmd>") > + self.dut.send_expect("port start all", "testpmd> ", 100) > + out =3D self.dut.send_expect("show config rxtx", "testpmd> ") > + self.verify( > + "RX desc=3D1024" in out, "RX descriptor not reconfigured pro= perly") > + self.verify( > + "TX desc=3D1024" in out, "TX descriptor not reconfigured pro= perly") > + self.dut.send_expect("start", "testpmd> ") > + self.check_forwarding(self.ports, self.nic) > + > + def test_change_numberrxdtxdaftercycle(self): > + """ > + Change the Number of rxd/txd. > + """ > + self.pmdout.start_testpmd("Default", "--portmask=3D%s" % > dts.create_mask(self.ports), socket=3Dself.ports_socket) > + > + self.dut.send_expect("port stop all", "testpmd> ", 100) > + self.dut.send_expect("port config all rxd 1024", "testpmd> ") > + self.dut.send_expect("port config all txd 1024", "testpmd> ") > + self.dut.send_expect("set fwd mac", "testpmd>") > + self.dut.send_expect("port start all", "testpmd> ", 100) > + out =3D self.dut.send_expect("show config rxtx", "testpmd> ") > + self.verify( > + "RX desc=3D1024" in out, "RX descriptor not reconfigured pro= perly") > + self.verify( > + "TX desc=3D1024" in out, "TX descriptor not reconfigured pro= perly") > + self.dut.send_expect("start", "testpmd> ") > + self.check_forwarding(self.ports, self.nic) > + > + self.dut.send_expect("stop", "testpmd> ") > + self.dut.send_expect("port stop all", "testpmd> ", 100) > + self.dut.send_expect("port start all", "testpmd> ", 100) > + out =3D self.dut.send_expect("show config rxtx", "testpmd> ") > + self.verify( > + "RX desc=3D1024" in out, "RX descriptor not reconfigured pro= perly") > + self.verify( > + "TX desc=3D1024" in out, "TX descriptor not reconfigured pro= perly") > + self.dut.send_expect("start", "testpmd> ") > + self.check_forwarding(self.ports, self.nic) > + > + def test_change_thresholds(self): > + """ > + Change RX/TX thresholds > + """ > + self.pmdout.start_testpmd("Default", "--portmask=3D%s" % > dts.create_mask(self.ports), socket=3Dself.ports_socket) > + > + self.dut.send_expect("port stop all", "testpmd> ", 100) > + self.dut.send_expect("port config all txfreet 32", "testpmd> ") > + self.dut.send_expect("port config all txrst 32", "testpmd> ") > + self.dut.send_expect("port config all rxfreet 32", "testpmd> ") > + self.dut.send_expect("port config all txpt 64", "testpmd> ") > + self.dut.send_expect("port config all txht 64", "testpmd> ") > + self.dut.send_expect("port config all txwt 0", "testpmd> ") > + self.dut.send_expect("port config all rxpt 64", "testpmd> ") > + self.dut.send_expect("port config all rxht 64", "testpmd> ") > + self.dut.send_expect("port config all rxwt 64", "testpmd> ") > + self.dut.send_expect("port start all", "testpmd> ", 100) > + out =3D self.dut.send_expect("show config rxtx", "testpmd> ") > + self.verify("RX free threshold=3D32" in out, > + "RX descriptor not reconfigured properly") > + self.verify("TX free threshold=3D32" in out, > + "TX descriptor not reconfigured properly") > + self.verify("TX RS bit threshold=3D32" in out, > + "TX descriptor not reconfigured properly") > + self.verify("pthresh=3D64" in out, "TX descriptor not reconfigur= ed > properly") > + self.verify("hthresh=3D64" in out, "TX descriptor not reconfigur= ed > properly") > + self.verify("wthresh=3D64" in out, "TX descriptor not reconfigur= ed > properly") > + self.verify("pthresh=3D64" in out, "TX descriptor not reconfigur= ed > properly") > + self.verify("hthresh=3D64" in out, "TX descriptor not reconfigur= ed > properly") > + self.verify("wthresh=3D64" in out, "TX descriptor not reconfigur= ed > properly") > + self.dut.send_expect("set fwd mac", "testpmd>") > + self.dut.send_expect("start", "testpmd> ") > + self.check_forwarding(self.ports, self.nic) > + > + def test_stress_test(self): > + """ > + Start/stop stress test. > + """ > + stress_iterations =3D 10 > + > + self.pmdout.start_testpmd("Default", "--portmask=3D%s" % > dts.create_mask(self.ports), socket=3Dself.ports_socket) > + > + self.tester.scapy_append('wrpcap("test.pcap", > [Ether()/IP()/UDP()/()])') > + tgenInput =3D [] > + > + for port in self.ports: > + tgenInput.append((self.tester.get_local_port( > + port), self.tester.get_local_port(port), "test.pcap")) > + > + for _ in range(stress_iterations): > + self.dut.send_expect("port stop all", "testpmd> ", 100) > + self.dut.send_expect("set fwd mac", "testpmd>") > + self.dut.send_expect("port start all", "testpmd> ", 100) > + self.dut.send_expect("start", "testpmd> ") > + self.check_forwarding(self.ports, self.nic) > + self.dut.send_expect("stop", "testpmd> ") > + > + self.dut.send_expect("quit", "# ") > + > + def test_link_stats(self): > + """ > + port link stats test > + """ > + self.pmdout.start_testpmd("Default", "--portmask=3D%s" % > dts.create_mask(self.ports), socket=3Dself.ports_socket) > + self.dut.send_expect("set fwd mac", "testpmd>") > + self.dut.send_expect("start", "testpmd>") > + > + # default test > + # self.check_forwarding([0,1], self.nic) > + > + ports_num =3D len(self.ports) > + # link down test > + for i in range(ports_num): > + self.dut.send_expect("set link-down port %d" % i, "testpmd>"= ) > + # leep few seconds for NIC link status update > + time.sleep(5) > + self.check_ports(self.ports, False) > + > + # link up test > + for j in range(ports_num): > + self.dut.send_expect("set link-up port %d" % j, "testpmd>") > + time.sleep(5) > + self.check_ports(self.ports, True) > + self.check_forwarding(self.ports, self.nic) > + > + def tear_down(self): > + """ > + Run after each test case. > + """ > + self.dut.kill_all() > + > + def tear_down_all(self): > + """ > + Run after each test suite. > + """ > + self.dut.kill_all() > -- > 1.7.4.4 Acked-by: Jingguo Fu