From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id DE4EF5A9B for ; Wed, 20 Jan 2016 09:41:32 +0100 (CET) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP; 20 Jan 2016 00:41:31 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,320,1449561600"; d="scan'208";a="32817276" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by fmsmga004.fm.intel.com with ESMTP; 20 Jan 2016 00:41:30 -0800 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id u0K8fS4g028462; Wed, 20 Jan 2016 16:41:28 +0800 Received: from shecgisg003.sh.intel.com (localhost [127.0.0.1]) by shecgisg003.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id u0K8fQof015256; Wed, 20 Jan 2016 16:41:28 +0800 Received: (from yliu84x@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id u0K8fQbZ015252; Wed, 20 Jan 2016 16:41:26 +0800 From: Yong Liu To: dts@dpdk.org Date: Wed, 20 Jan 2016 16:41:21 +0800 Message-Id: <1453279281-15206-3-git-send-email-yong.liu@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1453279281-15206-1-git-send-email-yong.liu@intel.com> References: <1453279281-15206-1-git-send-email-yong.liu@intel.com> Subject: [dts] [PATCH 3/3] tests: support atwood in suites 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, 20 Jan 2016 08:41:33 -0000 Reduce port requirements of each suite, thus only one atwood card still can run valiation. Atwood channel now support checksum offload/jumbo frame/mac filter/pmd rss/queue start stop/vlan features. Signed-off-by: Marvin Liu diff --git a/tests/TestSuite_checksum_offload.py b/tests/TestSuite_checksum_offload.py index 3522c80..a1f3280 100644 --- a/tests/TestSuite_checksum_offload.py +++ b/tests/TestSuite_checksum_offload.py @@ -54,9 +54,9 @@ class TestChecksumOffload(TestCase): # Based on h/w type, choose how many ports to use self.dut_ports = self.dut.get_ports(self.nic) # Verify that enough ports are available - self.verify(len(self.dut_ports) >= 2, "Insufficient ports for testing") + self.verify(len(self.dut_ports) >= 1, "Insufficient ports for testing") self.pmdout = PmdOutput(self.dut) - self.portMask = dts.create_mask([self.dut_ports[0], self.dut_ports[1]]) + self.portMask = dts.create_mask([self.dut_ports[0]]) self.ports_socket = self.dut.get_numa_id(self.dut_ports[0]) def set_up(self): @@ -65,7 +65,8 @@ class TestChecksumOffload(TestCase): """ if self.dut.want_func_tests: self.pmdout.start_testpmd("Default", "--portmask=%s " % - (self.portMask) + "--disable-hw-vlan --enable-rx-cksum --crc-strip", socket=self.ports_socket) + (self.portMask) + "--disable-hw-vlan --enable-rx-cksum " + + "--crc-strip --port-topology=loop", socket=self.ports_socket) self.dut.send_expect("set verbose 1", "testpmd>") self.dut.send_expect("set fwd csum", "testpmd>") @@ -85,7 +86,7 @@ class TestChecksumOffload(TestCase): """ Validate the checksum. """ - tx_interface = self.tester.get_interface(self.tester.get_local_port(self.dut_ports[1])) + tx_interface = self.tester.get_interface(self.tester.get_local_port(self.dut_ports[0])) rx_interface = self.tester.get_interface(self.tester.get_local_port(self.dut_ports[0])) sniff_src = self.dut.get_mac_address(self.dut_ports[0]) @@ -105,7 +106,7 @@ class TestChecksumOffload(TestCase): self.tester.send_expect("exit()", "#") self.tester.scapy_background() - self.tester.scapy_append('p = sniff(filter="ether src %s", iface="%s", count=%d)' % (sniff_src,rx_interface, len(packets_sent))) + self.tester.scapy_append('p = sniff(filter="ether src %s", iface="%s", count=%d)' % (sniff_src, rx_interface, len(packets_sent))) self.tester.scapy_append('nr_packets=len(p)') self.tester.scapy_append('reslist = [p[i].sprintf("%IP.chksum%;%TCP.chksum%;%UDP.chksum%;%SCTP.chksum%") for i in range(nr_packets)]') self.tester.scapy_append('import string') @@ -154,27 +155,25 @@ class TestChecksumOffload(TestCase): Verify that the same number of packet are correctly received on the traffic generator side. """ - dmac = self.dut.get_mac_address(self.dut_ports[1]) - smac = self.dut.get_mac_address(self.dut_ports[0]) - - pktsChkErr = {'IP/UDP': 'Ether(dst="%s", src="52:00:00:00:00:00")/Dot1Q(vlan=1)/IP(chksum=0x0)/UDP(chksum=0xf)/("X"*46)' % dmac, - 'IP/TCP': 'Ether(dst="%s", src="52:00:00:00:00:00")/Dot1Q(vlan=1)/IP(chksum=0x0)/TCP(chksum=0xf)/("X"*46)' % dmac, - 'IP/SCTP': 'Ether(dst="%s", src="52:00:00:00:00:00")/Dot1Q(vlan=1)/IP(chksum=0x0)/SCTP(chksum=0xf)/("X"*48)' % dmac, - 'IPv6/UDP': 'Ether(dst="%s", src="52:00:00:00:00:00")/Dot1Q(vlan=1)/IPv6(src="::1")/UDP(chksum=0xf)/("X"*46)' % dmac, - 'IPv6/TCP': 'Ether(dst="%s", src="52:00:00:00:00:00")/Dot1Q(vlan=1)/IPv6(src="::1")/TCP(chksum=0xf)/("X"*46)' % dmac} - - pkts = {'IP/UDP': 'Ether(dst="02:00:00:00:00:00", src="%s")/Dot1Q(vlan=1)/IP(src="127.0.0.2")/UDP()/("X"*46)' % smac, - 'IP/TCP': 'Ether(dst="02:00:00:00:00:00", src="%s")/Dot1Q(vlan=1)/IP(src="127.0.0.2")/TCP()/("X"*46)' % smac, - 'IP/SCTP': 'Ether(dst="02:00:00:00:00:00", src="%s")/Dot1Q(vlan=1)/IP(src="127.0.0.2")/SCTP()/("X"*48)' % smac, - 'IPv6/UDP': 'Ether(dst="02:00:00:00:00:00", src="%s")/Dot1Q(vlan=1)/IPv6(src="::2")/UDP()/("X"*46)' % smac, - 'IPv6/TCP': 'Ether(dst="02:00:00:00:00:00", src="%s")/Dot1Q(vlan=1)/IPv6(src="::2")/TCP()/("X"*46)' % smac} - - if self.nic == 'redrockcanyou': + mac = self.dut.get_mac_address(self.dut_ports[0]) + + pktsChkErr = {'IP/UDP': 'Ether(dst="%s", src="52:00:00:00:00:00")/Dot1Q(vlan=1)/IP(chksum=0x0)/UDP(chksum=0xf)/("X"*46)' % mac, + 'IP/TCP': 'Ether(dst="%s", src="52:00:00:00:00:00")/Dot1Q(vlan=1)/IP(chksum=0x0)/TCP(chksum=0xf)/("X"*46)' % mac, + 'IP/SCTP': 'Ether(dst="%s", src="52:00:00:00:00:00")/Dot1Q(vlan=1)/IP(chksum=0x0)/SCTP(chksum=0xf)/("X"*48)' % mac, + 'IPv6/UDP': 'Ether(dst="%s", src="52:00:00:00:00:00")/Dot1Q(vlan=1)/IPv6(src="::1")/UDP(chksum=0xf)/("X"*46)' % mac, + 'IPv6/TCP': 'Ether(dst="%s", src="52:00:00:00:00:00")/Dot1Q(vlan=1)/IPv6(src="::1")/TCP(chksum=0xf)/("X"*46)' % mac} + + pkts = {'IP/UDP': 'Ether(dst="02:00:00:00:00:00", src="%s")/Dot1Q(vlan=1)/IP(src="127.0.0.2")/UDP()/("X"*46)' % mac, + 'IP/TCP': 'Ether(dst="02:00:00:00:00:00", src="%s")/Dot1Q(vlan=1)/IP(src="127.0.0.2")/TCP()/("X"*46)' % mac, + 'IP/SCTP': 'Ether(dst="02:00:00:00:00:00", src="%s")/Dot1Q(vlan=1)/IP(src="127.0.0.2")/SCTP()/("X"*48)' % mac, + 'IPv6/UDP': 'Ether(dst="02:00:00:00:00:00", src="%s")/Dot1Q(vlan=1)/IPv6(src="::2")/UDP()/("X"*46)' % mac, + 'IPv6/TCP': 'Ether(dst="02:00:00:00:00:00", src="%s")/Dot1Q(vlan=1)/IPv6(src="::2")/TCP()/("X"*46)' % mac} + + if self.nic in ['redrockcanyou', 'atwood']: del pktsChkErr['IP/SCTP'] del pkts['IP/SCTP'] self.checksum_enablehw(self.dut_ports[0]) - self.checksum_enablehw(self.dut_ports[1]) self.dut.send_expect("start", "testpmd>") result = self.checksum_validate(pktsChkErr, pkts) self.dut.send_expect("stop", "testpmd>") @@ -187,27 +186,25 @@ class TestChecksumOffload(TestCase): Verify that the same number of packet are correctly received on the traffic generator side. """ - dmac = self.dut.get_mac_address(self.dut_ports[1]) - smac = self.dut.get_mac_address(self.dut_ports[0]) - - pkts = {'IP/UDP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(chksum=0x0)/UDP(chksum=0xf)/("X"*46)' % dmac, - 'IP/TCP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(chksum=0x0)/TCP(chksum=0xf)/("X"*46)' % dmac, - 'IP/SCTP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(chksum=0x0)/SCTP(chksum=0xf)/("X"*48)' % dmac, - 'IPv6/UDP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="::1")/UDP(chksum=0xf)/("X"*46)' % dmac, - 'IPv6/TCP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="::1")/TCP(chksum=0xf)/("X"*46)' % dmac} - - pkts_ref = {'IP/UDP': 'Ether(dst="02:00:00:00:00:00", src="%s")/IP(src="127.0.0.2")/UDP()/("X"*46)' % smac, - 'IP/TCP': 'Ether(dst="02:00:00:00:00:00", src="%s")/IP(src="127.0.0.2")/TCP()/("X"*46)' % smac, - 'IP/SCTP': 'Ether(dst="02:00:00:00:00:00", src="%s")/IP(src="127.0.0.2")/SCTP()/("X"*48)' % smac, - 'IPv6/UDP': 'Ether(dst="02:00:00:00:00:00", src="%s")/IPv6(src="::2")/UDP()/("X"*46)' % smac, - 'IPv6/TCP': 'Ether(dst="02:00:00:00:00:00", src="%s")/IPv6(src="::2")/TCP()/("X"*46)' % smac} - - if self.nic == 'redrockcanyou': + mac = self.dut.get_mac_address(self.dut_ports[0]) + + pkts = {'IP/UDP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(chksum=0x0)/UDP(chksum=0xf)/("X"*46)' % mac, + 'IP/TCP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(chksum=0x0)/TCP(chksum=0xf)/("X"*46)' % mac, + 'IP/SCTP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(chksum=0x0)/SCTP(chksum=0xf)/("X"*48)' % mac, + 'IPv6/UDP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="::1")/UDP(chksum=0xf)/("X"*46)' % mac, + 'IPv6/TCP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="::1")/TCP(chksum=0xf)/("X"*46)' % mac} + + pkts_ref = {'IP/UDP': 'Ether(dst="02:00:00:00:00:00", src="%s")/IP(src="127.0.0.2")/UDP()/("X"*46)' % mac, + 'IP/TCP': 'Ether(dst="02:00:00:00:00:00", src="%s")/IP(src="127.0.0.2")/TCP()/("X"*46)' % mac, + 'IP/SCTP': 'Ether(dst="02:00:00:00:00:00", src="%s")/IP(src="127.0.0.2")/SCTP()/("X"*48)' % mac, + 'IPv6/UDP': 'Ether(dst="02:00:00:00:00:00", src="%s")/IPv6(src="::2")/UDP()/("X"*46)' % mac, + 'IPv6/TCP': 'Ether(dst="02:00:00:00:00:00", src="%s")/IPv6(src="::2")/TCP()/("X"*46)' % mac} + + if self.nic in ['redrockcanyou', 'atwood']: del pkts['IP/SCTP'] del pkts_ref['IP/SCTP'] self.checksum_enablehw(self.dut_ports[0]) - self.checksum_enablehw(self.dut_ports[1]) self.dut.send_expect("start", "testpmd>") @@ -224,21 +221,20 @@ class TestChecksumOffload(TestCase): Verify that the same number of packet are correctly received on the traffic generator side. """ - dmac = self.dut.get_mac_address(self.dut_ports[1]) - smac = self.dut.get_mac_address(self.dut_ports[0]) + mac = self.dut.get_mac_address(self.dut_ports[0]) sndIP = '10.0.0.1' sndIPv6 = '::1' - sndPkts = {'IP/UDP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(src="%s",chksum=0x0)/UDP(chksum=0xf)/("X"*46)' % (dmac, sndIP), - 'IP/TCP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(src="%s",chksum=0x0)/TCP(chksum=0xf)/("X"*46)' % (dmac, sndIP), - 'IPv6/UDP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="%s")/UDP(chksum=0xf)/("X"*46)' % (dmac, sndIPv6), - 'IPv6/TCP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="%s")/TCP(chksum=0xf)/("X"*46)' % (dmac, sndIPv6)} + sndPkts = {'IP/UDP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(src="%s",chksum=0x0)/UDP(chksum=0xf)/("X"*46)' % (mac, sndIP), + 'IP/TCP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(src="%s",chksum=0x0)/TCP(chksum=0xf)/("X"*46)' % (mac, sndIP), + 'IPv6/UDP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="%s")/UDP(chksum=0xf)/("X"*46)' % (mac, sndIPv6), + 'IPv6/TCP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="%s")/TCP(chksum=0xf)/("X"*46)' % (mac, sndIPv6)} expIP = "10.0.0.2" expIPv6 = '::2' - expPkts = {'IP/UDP': 'Ether(dst="02:00:00:00:00:00", src="%s")/IP(src="%s")/UDP()/("X"*46)' % (smac, expIP), - 'IP/TCP': 'Ether(dst="02:00:00:00:00:00", src="%s")/IP(src="%s")/TCP()/("X"*46)' % (smac, expIP), - 'IPv6/UDP': 'Ether(dst="02:00:00:00:00:00", src="%s")/IPv6(src="%s")/UDP()/("X"*46)' % (smac, expIPv6), - 'IPv6/TCP': 'Ether(dst="02:00:00:00:00:00", src="%s")/IPv6(src="%s")/TCP()/("X"*46)' % (smac, expIPv6)} + expPkts = {'IP/UDP': 'Ether(dst="02:00:00:00:00:00", src="%s")/IP(src="%s")/UDP()/("X"*46)' % (mac, expIP), + 'IP/TCP': 'Ether(dst="02:00:00:00:00:00", src="%s")/IP(src="%s")/TCP()/("X"*46)' % (mac, expIP), + 'IPv6/UDP': 'Ether(dst="02:00:00:00:00:00", src="%s")/IPv6(src="%s")/UDP()/("X"*46)' % (mac, expIPv6), + 'IPv6/TCP': 'Ether(dst="02:00:00:00:00:00", src="%s")/IPv6(src="%s")/TCP()/("X"*46)' % (mac, expIPv6)} self.dut.send_expect("start", "testpmd>") result = self.checksum_validate(sndPkts, expPkts) @@ -282,6 +278,9 @@ class TestChecksumOffload(TestCase): """ Test checksum offload performance. """ + # Verify that enough ports are available + self.verify(len(self.dut_ports) >= 2, "Insufficient ports for testing") + # sizes = [64, 128, 256, 512, 1024] sizes = [64, 128] pkts = {'IP/UDP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP()/UDP()/("X"*(%d-46))', @@ -290,7 +289,7 @@ class TestChecksumOffload(TestCase): 'IPv6/UDP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6()/UDP()/("X"* (lambda x: x - 66 if x > 66 else 0)(%d))', 'IPv6/TCP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6()/TCP()/("X"* (lambda x: x - 78 if x > 78 else 0)(%d))'} - if self.nic == 'redrockcanyou': + if self.nic in ['redrockcanyou', 'atwood']: del pkts['IP/SCTP'] lcore = "1S/2C/1T" diff --git a/tests/TestSuite_jumboframes.py b/tests/TestSuite_jumboframes.py index e4ea10a..813ed9d 100644 --- a/tests/TestSuite_jumboframes.py +++ b/tests/TestSuite_jumboframes.py @@ -64,8 +64,8 @@ class TestJumboframes(TestCase): """ Send 1 packet to portid """ - gp0tx_pkts, _, gp0tx_bytes = [int(_) for _ in self.jumboframes_get_stat(self.rx_port, "tx")] - gp1rx_pkts, gp1rx_err, gp1rx_bytes = [int(_) for _ in self.jumboframes_get_stat(self.tx_port, "rx")] + tx_pkts_ori, _, tx_bytes_ori = [int(_) for _ in self.jumboframes_get_stat(self.rx_port, "tx")] + rx_pkts_ori, rx_err_ori, rx_bytes_ori = [int(_) for _ in self.jumboframes_get_stat(self.tx_port, "rx")] itf = self.tester.get_interface(self.tester.get_local_port(self.tx_port)) mac = self.dut.get_mac_address(self.tx_port) @@ -82,22 +82,22 @@ class TestJumboframes(TestCase): out = self.tester.scapy_execute() sleep(5) - p0tx_pkts, _, p0tx_bytes = [int(_) for _ in self.jumboframes_get_stat(self.rx_port, "tx")] + tx_pkts, _, tx_bytes = [int(_) for _ in self.jumboframes_get_stat(self.rx_port, "tx")] # p0tx_pkts, p0tx_err, p0tx_bytes - p1rx_pkts, p1rx_err, p1rx_bytes = [int(_) for _ in self.jumboframes_get_stat(self.tx_port, "rx")] + rx_pkts, rx_err, rx_bytes = [int(_) for _ in self.jumboframes_get_stat(self.tx_port, "rx")] - p0tx_pkts -= gp0tx_pkts - p0tx_bytes -= gp0tx_bytes - p1rx_pkts -= gp1rx_pkts - p1rx_bytes -= gp1rx_bytes - p1rx_err -= gp1rx_err + tx_pkts -= tx_pkts_ori + tx_bytes -= tx_bytes_ori + rx_pkts -= rx_pkts_ori + rx_bytes -= rx_bytes_ori + rx_err -= rx_err_ori if received: - self.verify((p0tx_pkts == p1rx_pkts) and ((p0tx_bytes + 4) == pktsize) and ((p1rx_bytes + 4) == pktsize), + self.verify((tx_pkts == rx_pkts) and ((tx_bytes + 4) == pktsize) and ((rx_bytes + 4) == pktsize), "packet pass assert error") else: #self.verify(p0tx_pkts == p1rx_pkts and (p1rx_err == 1 or p1rx_pkts == 0), - self.verify(p1rx_err == 1 or p0tx_pkts == 0, "packet drop assert error") + self.verify(rx_err == 1 or tx_pkts == 0, "packet drop assert error") return out # @@ -110,23 +110,23 @@ class TestJumboframes(TestCase): Prerequisite steps for each test suit. """ self.dut_ports = self.dut.get_ports() - self.verify(len(self.dut_ports) >= 2, "Insufficient ports") + self.verify(len(self.dut_ports) >= 1, "Insufficient ports") self.rx_port = self.dut_ports[0] - self.tx_port = self.dut_ports[1] + self.tx_port = self.dut_ports[0] cores = self.dut.get_core_list("1S/2C/1T") self.coremask = dts.create_mask(cores) self.port_mask = dts.create_mask([self.rx_port, self.tx_port]) - if self.nic == "redrockcanyou": + if self.nic in ["redrockcanyou", "atwood"]: netobj = self.dut.ports_info[self.tx_port]['port'] netobj.enable_jumbo(framesize = ETHER_JUMBO_FRAME_MTU) netobj = self.dut.ports_info[self.rx_port]['port'] netobj.enable_jumbo(framesize = ETHER_JUMBO_FRAME_MTU) self.tester.send_expect("ifconfig %s mtu %s" % (self.tester.get_interface(self.tester.get_local_port(self.rx_port)), ETHER_JUMBO_FRAME_MTU + 200), "# ") - self.tester.send_expect("ifconfig %s mtu %s" % (self.tester.get_interface(self.tester.get_local_port(self.tx_port)), ETHER_JUMBO_FRAME_MTU + 200), "# ") +# self.tester.send_expect("ifconfig %s mtu %s" % (self.tester.get_interface(self.tester.get_local_port(self.tx_port)), ETHER_JUMBO_FRAME_MTU + 200), "# ") self.pmdout = PmdOutput(self.dut) @@ -139,9 +139,9 @@ class TestJumboframes(TestCase): def test_jumboframes_normal_nojumbo(self): """ This case aims to test transmitting normal size packet without jumbo - frame on testpmd app. + f=rame on testpmd app. """ - self.pmdout.start_testpmd("Default", "--max-pkt-len=%d" % (ETHER_STANDARD_MTU)) + self.pmdout.start_testpmd("Default", "--max-pkt-len=%d --port-topology=loop" % (ETHER_STANDARD_MTU)) self.dut.send_expect("set fwd mac", "testpmd> ") self.dut.send_expect("start", "testpmd> ") @@ -157,10 +157,10 @@ class TestJumboframes(TestCase): jumbo frame support. """ # RRC has no ability to set the max pkt len to hardware - if self.nic == "redrockcanyou": + if self.nic in ["redrockcanyou", "atwood"]: print dts.RED("fm10k not support this case\n") return - self.pmdout.start_testpmd("Default", "--max-pkt-len=%d" % (ETHER_STANDARD_MTU)) + self.pmdout.start_testpmd("Default", "--max-pkt-len=%d --port-topology=loop" % (ETHER_STANDARD_MTU)) self.dut.send_expect("set fwd mac", "testpmd> ") self.dut.send_expect("start", "testpmd> ") @@ -174,7 +174,7 @@ class TestJumboframes(TestCase): When jumbo frame supported, this case is to verify that the normal size packet forwrding should be support correct. """ - self.pmdout.start_testpmd("Default", "--max-pkt-len=%s" % (ETHER_JUMBO_FRAME_MTU)) + self.pmdout.start_testpmd("Default", "--max-pkt-len=%s --port-topology=loop" % (ETHER_JUMBO_FRAME_MTU)) self.dut.send_expect("set fwd mac", "testpmd> ") self.dut.send_expect("start", "testpmd> ") @@ -189,7 +189,7 @@ class TestJumboframes(TestCase): When jumbo frame supported, this case is to verify that jumbo frame packet can be forwarded correct. """ - self.pmdout.start_testpmd("Default", "--max-pkt-len=%s" % (ETHER_JUMBO_FRAME_MTU)) + self.pmdout.start_testpmd("Default", "--max-pkt-len=%s --port-topology=loop" % (ETHER_JUMBO_FRAME_MTU)) self.dut.send_expect("set fwd mac", "testpmd> ") self.dut.send_expect("start", "testpmd> ") @@ -205,7 +205,7 @@ class TestJumboframes(TestCase): When the jubmo frame MTU set as 9000, this case is to verify that the packet which the length bigger than MTU can not be forwarded. """ - self.pmdout.start_testpmd("Default", "--max-pkt-len=%s" % (ETHER_JUMBO_FRAME_MTU)) + self.pmdout.start_testpmd("Default", "--max-pkt-len=%s --port-topology=loop" % (ETHER_JUMBO_FRAME_MTU)) self.dut.send_expect("set fwd mac", "testpmd> ") self.dut.send_expect("start", "testpmd> ") diff --git a/tests/TestSuite_mac_filter.py b/tests/TestSuite_mac_filter.py index 7cae09c..d3ef667 100644 --- a/tests/TestSuite_mac_filter.py +++ b/tests/TestSuite_mac_filter.py @@ -54,7 +54,7 @@ class TestWhitelist(TestCase): self.dutPorts = self.dut.get_ports() # Verify that enough ports are available self.verify(len(self.dutPorts) >= 1, "Insufficient ports") - portMask = dts.create_mask(self.dutPorts[:2]) + portMask = dts.create_mask(self.dutPorts[:1]) self.pmdout = PmdOutput(self.dut) self.pmdout.start_testpmd("Default", "--portmask=%s" % portMask) @@ -98,7 +98,6 @@ class TestWhitelist(TestCase): # initialise first port without promiscuous mode fake_mac_addr = "00:01:01:00:00:00" portid = self.dutPorts[0] - txportid = self.dutPorts[1] self.dut.send_expect("set promisc %d off" % portid, "testpmd> ") self.dut.send_expect("clear port stats all", "testpmd> ") diff --git a/tests/TestSuite_pmdrss_hash.py b/tests/TestSuite_pmdrss_hash.py index 860bfbd..d87bb03 100644 --- a/tests/TestSuite_pmdrss_hash.py +++ b/tests/TestSuite_pmdrss_hash.py @@ -417,14 +417,14 @@ class TestPmdrssHash(TestCase): """ self.verify(self.nic in ["fortville_eagle", "fortville_spirit", - "fortville_spirit_single", "redrockcanyou"], + "fortville_spirit_single", "redrockcanyou", "atwood"], "NIC Unsupported: " + str(self.nic)) global reta_num if self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single"]: reta_num = 512 elif self.nic in ["niantic"]: reta_num = 128 - elif self.nic in ["redrockcanyou"]: + elif self.nic in ["redrockcanyou", "atwood"]: reta_num = 128 else: self.verify(False, "NIC Unsupported:%s" % str(self.nic)) diff --git a/tests/TestSuite_queue_start_stop.py b/tests/TestSuite_queue_start_stop.py index 1d84992..360ed85 100644 --- a/tests/TestSuite_queue_start_stop.py +++ b/tests/TestSuite_queue_start_stop.py @@ -45,6 +45,7 @@ import os from test_case import TestCase from pmd_output import PmdOutput from settings import FOLDERS +from packet import Packet, sniff_packets, load_sniff_packets, strip_pktload # # @@ -64,7 +65,7 @@ class TestQueueStartStop(TestCase): Run at the start of each test suite. """ self.ports = self.dut.get_ports(self.nic) - self.verify(len(self.ports) >= 2, "Insufficient number of ports.") + self.verify(len(self.ports) >= 1, "Insufficient number of ports.") def set_up(self): """ @@ -86,40 +87,29 @@ class TestQueueStartStop(TestCase): except Exception, e: raise IOError("dpdk setup failure: %s" % e) - def check_forwarding(self, ports, nic, testerports=[None, None], pktSize=64, received=True): - self.send_packet(ports[0], ports[1], self.nic, testerports[1], pktSize, received) + def check_forwarding(self, ports, nic, pktSize=64, received=True): + self.send_packet(ports[0], ports[1], self.nic, pktSize, received) - def send_packet(self, txPort, rxPort, nic, testerports=None, pktSize=64, received=True): + def send_packet(self, txPort, rxPort, nic, pktSize=64, received=True): """ Send packages according to parameters. """ + rxitf = self.tester.get_interface(self.tester.get_local_port(rxPort)) + txitf = self.tester.get_interface(self.tester.get_local_port(txPort)) - if testerports is None: - rxitf = self.tester.get_interface(self.tester.get_local_port(rxPort)) - txitf = self.tester.get_interface(self.tester.get_local_port(txPort)) - else: - itf = testerports - smac = self.tester.get_mac(self.tester.get_local_port(txPort)) dmac = self.dut.get_mac_address(txPort) - self.tester.scapy_background() - self.tester.scapy_append('p=sniff(iface="%s",count=1,timeout=5)' % rxitf) - self.tester.scapy_append('RESULT=str(p)') - - self.tester.scapy_foreground() - - pktlen = pktSize - 14 - padding = pktlen - 20 - self.tester.scapy_append('sendp([Ether(src="%s", dst="%s")/IP()/Raw(load="P"*%s)], iface="%s")' % (smac, dmac, padding, txitf)) - - self.tester.scapy_execute() - time.sleep(3) + pkt = Packet(pkt_type="UDP", pkt_len=pktSize) + inst = sniff_packets(rxitf) + pkt.config_layer('ether', {'dst': dmac}) + pkt.send_pkt(tx_port=txitf) + sniff_pkts = load_sniff_packets(inst) - out = self.tester.scapy_get_result() if received: - self.verify('PPP' in out, "start queue failed") + res = strip_pktload(sniff_pkts[0], layer="L4") + self.verify("58 58 58 58 58 58 58 58" in res, "receive queue not work as expected") else: - self.verify('PPP' not in out, "stop queue failed") + self.verify(len(sniff_pkts) == 0, "stop queue not work as expected") def patch_hotfix_dpdk(self, patch_dir, on = True): """ diff --git a/tests/TestSuite_scatter.py b/tests/TestSuite_scatter.py index 1953185..c8b86fa 100644 --- a/tests/TestSuite_scatter.py +++ b/tests/TestSuite_scatter.py @@ -42,12 +42,15 @@ import time # # Test class. # + + class TestScatter(TestCase): # # # # Test cases. # + def set_up_all(self): """ Run at the start of each test suite. @@ -57,29 +60,38 @@ class TestScatter(TestCase): # Verify that enough ports are available self.verify(len(dutPorts) >= 1, "Insufficient ports") self.port = dutPorts[0] + tester_port = self.tester.get_local_port(self.port) + self.intf = self.tester.get_interface(tester_port) + self.pmdout = PmdOutput(self.dut) - if self.nic in ["niantic", "sageville", "fortpark", "fortville_eagle", "fortville_spirit", "fortville_spirit_single", "redrockcanyou", "ironpond", "twinpond", "springfountain"]: + if self.nic in ["niantic", "sageville", "fortpark", "fortville_eagle", + "fortville_spirit", "fortville_spirit_single", + "redrockcanyou", "atwood", + "ironpond", "twinpond", "springfountain"]: self.mbsize = 2048 else: self.mbsize = 1024 + if self.nic in ['redrockcanyou', 'atwood']: + self.dut.ports_info[self.port]['port'].enable_jumbo(framesize=9000) + + self.tester.send_expect("ifconfig %s mtu 9000" % self.intf, "#") + def scatter_pktgen_send_packet(self, pktsize): """ Functional test for scatter packets. """ - tester_port = self.tester.get_local_port(self.port) - intf = self.tester.get_interface(tester_port) dmac = self.dut.get_mac_address(self.port) - self.tester.send_expect("ifconfig %s mtu 9000" % intf, "#") - inst = sniff_packets(intf) + inst = sniff_packets(self.intf) pkt = Packet(pkt_type="IP_RAW", pkt_len=pktsize) pkt.config_layer('ether', {'dst': dmac}) - pkt.send_pkt(tx_port=intf) + pkt.send_pkt(tx_port=self.intf) sniff_pkts = load_sniff_packets(inst) - res = strip_pktload(sniff_pkts[0], layer="L4") - self.tester.send_expect("ifconfig %s mtu 1500" % intf, "#") + res = "" + if len(sniff_pkts): + res = strip_pktload(sniff_pkts[0], layer="L4") return res def set_up(self): @@ -92,9 +104,9 @@ class TestScatter(TestCase): """ Scatter 2048 mbuf """ - # set the mbuf size to 1024 out = self.pmdout.start_testpmd( - "1S/2C/1T", "--mbcache=200 --mbuf-size=%d --portmask=0x1 --max-pkt-len=9000 --port-topology=loop" % (self.mbsize)) + "1S/2C/1T", "--mbcache=200 --mbuf-size=%d --portmask=0x1 " + "--max-pkt-len=9000 --port-topology=loop" % (self.mbsize)) self.verify("Error" not in out, "launch error 1") @@ -103,7 +115,8 @@ class TestScatter(TestCase): for offset in [-1, 0, 1, 4, 5]: ret = self.scatter_pktgen_send_packet(self.mbsize + offset) - self.verify("58 58 58 58 58 58 58 58" in ret, "packet receive error") + self.verify( + "58 58 58 58 58 58 58 58" in ret, "packet receive error") self.dut.send_expect("stop", "testpmd> ") self.dut.send_expect("quit", "# ", 30) @@ -118,4 +131,7 @@ class TestScatter(TestCase): """ Run after each test suite. """ + if self.nic in ['redrockcanyou', 'atwood']: + self.dut.ports_info[self.port]['port'].enable_jumbo(framesize=1518) + self.tester.send_expect("ifconfig %s mtu 1500" % self.intf, "#") pass diff --git a/tests/TestSuite_shutdown_api.py b/tests/TestSuite_shutdown_api.py index 6329649..eea7b8e 100644 --- a/tests/TestSuite_shutdown_api.py +++ b/tests/TestSuite_shutdown_api.py @@ -63,8 +63,8 @@ class TestShutdownApi(TestCase): Run at the start of each test suite. """ ports = self.dut.get_ports() - self.verify(len(ports) >= 2, "Insufficient number of ports.") - self.ports = ports[:2] + self.verify(len(ports) >= 1, "Insufficient number of ports.") + self.ports = ports[:1] self.ports_socket = self.dut.get_numa_id(self.ports[0]) for port in self.ports: @@ -89,11 +89,6 @@ class TestShutdownApi(TestCase): self.send_packet(ports[0], ports[0], pktSize, received, vlan, promisc) return - for i in range(len(ports)): - if i % 2 == 0: - self.send_packet(ports[i], ports[i + 1], pktSize, received, vlan, promisc) - self.send_packet(ports[i + 1], ports[i], pktSize, received, vlan, promisc) - def send_packet(self, txPort, rxPort, pktSize=68, received=True, vlan=False, promisc=False): """ Send packages according to parameters. @@ -138,7 +133,7 @@ class TestShutdownApi(TestCase): rx_bytes_exp = pktSize tx_bytes_exp = pktSize - if self.nic in ['redrockcanyou']: + if self.nic in ['redrockcanyou', 'atwood']: # RRC will always strip rx/tx crc rx_bytes_exp -= 4 tx_bytes_exp -= 4 @@ -167,7 +162,7 @@ class TestShutdownApi(TestCase): Check link status of the ports. """ # RRC not support link speed change - if self.nic in ['redrockcanyou']: + if self.nic in ['redrockcanyou', 'atwood']: return for port in self.ports: @@ -188,7 +183,7 @@ class TestShutdownApi(TestCase): """ Stop and Restar. """ - self.pmdout.start_testpmd("Default", "--portmask=%s" % dts.create_mask(self.ports), socket=self.ports_socket) + self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % dts.create_mask(self.ports), socket=self.ports_socket) self.dut.send_expect("set fwd mac", "testpmd>") self.dut.send_expect("start", "testpmd> ") @@ -207,16 +202,10 @@ class TestShutdownApi(TestCase): """ Promiscuous mode. """ - ports = [] - # RRC is different with other type, inside a switch, - # so better to use one port to verify promisc mode - if self.nic == "redrockcanyou": - ports = [self.ports[0]] - else: - ports = [self.ports[0], self.ports[1]] + ports = [self.ports[0]] portmask = dts.create_mask(ports) - self.pmdout.start_testpmd("Default", "--portmask=%s" % portmask, socket = self.ports_socket) + self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % portmask, socket = self.ports_socket) self.dut.send_expect("port stop all", "testpmd> ", 100) self.dut.send_expect("set promisc all off", "testpmd> ") @@ -247,12 +236,9 @@ class TestShutdownApi(TestCase): """ Reset RX/TX Queues. """ - testerports = [self.tester.get_interface(self.tester.get_local_port(self.ports[0])), - self.tester.get_interface(self.tester.get_local_port(self.ports[1])) - ] testcorelist = self.dut.get_core_list("1S/8C/1T", socket=self.ports_socket) - self.pmdout.start_testpmd(testcorelist, "--portmask=%s" % dts.create_mask([self.ports[0], self.ports[1]]), socket=self.ports_socket) + self.pmdout.start_testpmd(testcorelist, "--portmask=%s --port-topology=loop" % dts.create_mask([self.ports[0]]), socket=self.ports_socket) fwdcoremask = dts.create_mask(testcorelist[-3:]) self.dut.send_expect("port stop all", "testpmd> ", 100) @@ -272,7 +258,7 @@ class TestShutdownApi(TestCase): """ Reconfigure All Ports With The Same Configurations (CRC) """ - self.pmdout.start_testpmd("Default", "--portmask=%s" % dts.create_mask(self.ports), socket=self.ports_socket) + self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % dts.create_mask(self.ports), socket=self.ports_socket) self.dut.send_expect("port stop all", "testpmd> ", 100) self.dut.send_expect("port config all crc-strip on", "testpmd> ") @@ -289,11 +275,11 @@ class TestShutdownApi(TestCase): """ Change Link Speed. """ - if self.nic == "redrockcanyou": + if self.nic in ["redrockcanyou", "atwood"]: print dts.RED("RRC not support\n") return - self.pmdout.start_testpmd("Default", "--portmask=%s" % dts.create_mask(self.ports), socket=self.ports_socket) + self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % dts.create_mask(self.ports), socket=self.ports_socket) out = self.tester.send_expect( "ethtool %s" % self.tester.get_interface(self.tester.get_local_port(self.ports[0])), "# ") @@ -335,12 +321,12 @@ class TestShutdownApi(TestCase): """ Enable/Disable Jumbo Frames. """ - if self.nic == "redrockcanyou": + if self.nic in ["redrockcanyou", "atwood"]: print dts.RED("RRC not support\n") return jumbo_size = 2048 - self.pmdout.start_testpmd("Default", "--portmask=%s" % dts.create_mask(self.ports), socket=self.ports_socket) + self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % dts.create_mask(self.ports), socket=self.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 %d" % jumbo_size, "testpmd> ") @@ -379,7 +365,7 @@ class TestShutdownApi(TestCase): """ Enable/Disable RSS. """ - self.pmdout.start_testpmd("Default", "--portmask=%s" % dts.create_mask(self.ports), socket=self.ports_socket) + self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % dts.create_mask(self.ports), socket=self.ports_socket) self.dut.send_expect("port stop all", "testpmd> ", 100) self.dut.send_expect("port config rss ip", "testpmd> ") @@ -392,7 +378,7 @@ class TestShutdownApi(TestCase): """ Change numbers of rxd and txd. """ - self.pmdout.start_testpmd("Default", "--portmask=%s" % dts.create_mask(self.ports), socket=self.ports_socket) + self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % dts.create_mask(self.ports), socket=self.ports_socket) self.dut.send_expect("port stop all", "testpmd> ", 100) self.dut.send_expect("port config all rxd 1024", "testpmd> ") @@ -411,7 +397,7 @@ class TestShutdownApi(TestCase): """ Change the Number of rxd/txd. """ - self.pmdout.start_testpmd("Default", "--portmask=%s" % dts.create_mask(self.ports), socket=self.ports_socket) + self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % dts.create_mask(self.ports), socket=self.ports_socket) self.dut.send_expect("port stop all", "testpmd> ", 100) self.dut.send_expect("port config all rxd 1024", "testpmd> ") @@ -441,7 +427,7 @@ class TestShutdownApi(TestCase): """ Change RX/TX thresholds """ - self.pmdout.start_testpmd("Default", "--portmask=%s" % dts.create_mask(self.ports), socket=self.ports_socket) + self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % dts.create_mask(self.ports), socket=self.ports_socket) self.dut.send_expect("port stop all", "testpmd> ", 100) self.dut.send_expect("port config all txfreet 32", "testpmd> ") @@ -477,7 +463,7 @@ class TestShutdownApi(TestCase): """ stress_iterations = 10 - self.pmdout.start_testpmd("Default", "--portmask=%s" % dts.create_mask(self.ports), socket=self.ports_socket) + self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % dts.create_mask(self.ports), socket=self.ports_socket) tgenInput = [] for port in self.ports: @@ -498,11 +484,11 @@ class TestShutdownApi(TestCase): """ port link stats test """ - if self.nic == "redrockcanyou": + if self.nic in ["redrockcanyou", "atwood"]: print dts.RED("RRC not support\n") return - self.pmdout.start_testpmd("Default", "--portmask=%s" % dts.create_mask(self.ports), socket=self.ports_socket) + self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % dts.create_mask(self.ports), socket=self.ports_socket) self.dut.send_expect("set fwd mac", "testpmd>") self.dut.send_expect("start", "testpmd>") diff --git a/tests/TestSuite_vlan.py b/tests/TestSuite_vlan.py index 570c59e..b32a0f8 100644 --- a/tests/TestSuite_vlan.py +++ b/tests/TestSuite_vlan.py @@ -82,7 +82,7 @@ class TestVlan(TestCase): self.verify('Set mac packet forwarding mode' in out, "set fwd rxonly error") self.vlan = 51 - if self.nic == "redrockcanyou": + if self.nic in ["redrockcanyou", "atwood"]: netobj = self.dut.ports_info[dutRxPortId]['port'] netobj.add_vlan(vlan_id = self.vlan) @@ -132,7 +132,7 @@ class TestVlan(TestCase): Enable receipt of VLAN packets """ - if self.nic == "redrockcanyou": + if self.nic in ["redrockcanyou", "atwood"]: print dts.RED("fm10k not support this case\n") return self.dut.send_expect("rx_vlan add %d %s" % (self.vlan, dutRxPortId), "testpmd> ") @@ -177,7 +177,7 @@ class TestVlan(TestCase): def test_vlan_strip_config_off(self): - if self.nic == "redrockcanyou": + if self.nic in ["redrockcanyou", "atwood"]: print dts.RED("fm10k not support this case\n") return self.dut.send_expect("vlan set strip off %s" % dutRxPortId, "testpmd> ", 20) @@ -195,7 +195,7 @@ class TestVlan(TestCase): """ Enable VLAN header insertion in transmitted packets """ - if self.nic == "redrockcanyou": + if self.nic in ["redrockcanyou", "atwood"]: netobj = self.dut.ports_info[dutTxPortId]['port'] netobj.add_vlan(vlan_id = self.vlan) netobj.add_txvlan(vlan_id = self.vlan) @@ -214,7 +214,7 @@ class TestVlan(TestCase): self.dut.send_expect("tx_vlan reset %s" % dutTxPortId, "testpmd> ", 30) self.dut.send_expect("stop", "testpmd> ", 30) - if self.nic == "redrockcanyou": + if self.nic in ["redrockcanyou", "atwood"]: netobj = self.dut.ports_info[dutTxPortId]['port'] # not delete vlan for self.vlan will used later netobj.delete_txvlan(vlan_id = self.vlan) @@ -230,7 +230,7 @@ class TestVlan(TestCase): Run after each test suite. """ self.dut.kill_all() - if self.nic == "redrockcanyou": + if self.nic in ["redrockcanyou", "atwood"]: netobj = self.dut.ports_info[dutRxPortId]['port'] netobj.delete_txvlan(vlan_id = self.vlan) netobj.delete_vlan(vlan_id = self.vlan) -- 2.4.3