From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 544122BDE for ; Thu, 4 Aug 2016 07:38:51 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 03 Aug 2016 22:38:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,469,1464678000"; d="scan'208";a="1029468634" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga002.jf.intel.com with ESMTP; 03 Aug 2016 22:38:48 -0700 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id u745ckEo004911; Thu, 4 Aug 2016 13:38:46 +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 u745chUI012776; Thu, 4 Aug 2016 13:38:45 +0800 Received: (from yliu84x@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id u745chBs012772; Thu, 4 Aug 2016 13:38:43 +0800 From: Marvin Liu To: dts@dpdk.org Cc: Marvin Liu Date: Thu, 4 Aug 2016 13:38:22 +0800 Message-Id: <1470289102-12677-10-git-send-email-yong.liu@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1470289102-12677-1-git-send-email-yong.liu@intel.com> References: <1470289102-12677-1-git-send-email-yong.liu@intel.com> Subject: [dts] [PATCH 9/9] tests: remove dependencies of dts module 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: Thu, 04 Aug 2016 05:38:52 -0000 Remove dts module from every suite. Suites now only have dependencies on some basic modules. Signed-off-by: Marvin Liu diff --git a/tests/TestSuite_blacklist.py b/tests/TestSuite_blacklist.py index 06dbf87..dd47ede 100644 --- a/tests/TestSuite_blacklist.py +++ b/tests/TestSuite_blacklist.py @@ -33,7 +33,7 @@ DPDK Test suite. Test device blacklisting. """ -import dts +import utils from test_case import TestCase from pmd_output import PmdOutput @@ -78,7 +78,7 @@ class TestBlackList(TestCase): regexp_blacklisted_port = self.regexp_blacklisted_port % (int(pci.split(':')[0], 16), pci.split(':')[1]) else: regexp_blacklisted_port = self.regexp_blacklisted_port % self.dut.ports_info[port]['pci'] - matching_ports = dts.regexp(output, regexp_blacklisted_port, True) + matching_ports = utils.regexp(output, regexp_blacklisted_port, True) if blacklisted: self.verify(len(matching_ports) == 1, "Blacklisted port is being initialized") @@ -92,7 +92,7 @@ class TestBlackList(TestCase): """ out = self.pmdout.start_testpmd("Default") rexp = r"Link" - match_status = dts.regexp(out, rexp, True) + match_status = utils.regexp(out, rexp, True) self.check_blacklisted_ports(out, self.ports) diff --git a/tests/TestSuite_checksum_offload.py b/tests/TestSuite_checksum_offload.py index 7dc8ddc..7a05b6d 100644 --- a/tests/TestSuite_checksum_offload.py +++ b/tests/TestSuite_checksum_offload.py @@ -36,10 +36,10 @@ Test support of RX/TX Checksum Offload Features by Poll Mode Drivers. """ -import dts import string import re import rst +import utils from test_case import TestCase from pmd_output import PmdOutput @@ -56,7 +56,7 @@ class TestChecksumOffload(TestCase): # Verify that enough ports are available 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.portMask = utils.create_mask([self.dut_ports[0]]) self.ports_socket = self.dut.get_numa_id(self.dut_ports[0]) def set_up(self): @@ -272,7 +272,7 @@ class TestChecksumOffload(TestCase): result.append(Pps[str(size)]) result.append(Pct[str(size)]) - dts.results_table_add_row(result) + self.result_table_add(result) def test_perf_checksum_throughtput(self): """ @@ -293,7 +293,7 @@ class TestChecksumOffload(TestCase): del pkts['IP/SCTP'] lcore = "1S/2C/1T" - portMask = dts.create_mask([self.dut_ports[0], self.dut_ports[1]]) + portMask = utils.create_mask([self.dut_ports[0], self.dut_ports[1]]) for mode in ["sw", "hw"]: self.logger.info("%s performance" % mode) rst.write_text(mode + " Performance" + '\r\n') @@ -301,7 +301,7 @@ class TestChecksumOffload(TestCase): for size in sizes: tblheader.append("%sB mpps" % str(size)) tblheader.append("%sB %% " % str(size)) - dts.results_table_add_header(tblheader) + self.result_table_create(tblheader) self.pmdout.start_testpmd( lcore, "--portmask=%s" % self.portMask, socket=self.ports_socket) @@ -321,7 +321,7 @@ class TestChecksumOffload(TestCase): self.dut.send_expect("stop", "testpmd> ") self.dut.send_expect("quit", "#", 10) - dts.results_table_print() + self.result_table_print() def tear_down(self): """ diff --git a/tests/TestSuite_cloud_filter.py b/tests/TestSuite_cloud_filter.py index 7348aea..3df9678 100644 --- a/tests/TestSuite_cloud_filter.py +++ b/tests/TestSuite_cloud_filter.py @@ -5,7 +5,6 @@ Test Cloud Filters features in DPDK. """ -import dts import string import re import time diff --git a/tests/TestSuite_cmdline.py b/tests/TestSuite_cmdline.py index 13b0e63..e4e1be9 100644 --- a/tests/TestSuite_cmdline.py +++ b/tests/TestSuite_cmdline.py @@ -34,8 +34,7 @@ DPDK Test suite. Test cmdline. """ -import dts - +import utils from test_case import TestCase @@ -57,7 +56,7 @@ class TestCmdline(TestCase): # Run cmdline app cores = self.dut.get_core_list('1S/1C/1T') - coreMask = dts.create_mask(cores) + coreMask = utils.create_mask(cores) self.dut.send_expect("./examples/cmdline/build/app/cmdline -n 1 -c " + coreMask, "> ", 10) def set_up(self): diff --git a/tests/TestSuite_coremask.py b/tests/TestSuite_coremask.py index 4f6f4bd..0d3feff 100644 --- a/tests/TestSuite_coremask.py +++ b/tests/TestSuite_coremask.py @@ -7,7 +7,7 @@ Test coremask parsing in DPDK. """ -import dts +import utils from exception import VerifyFailure from test_case import TestCase @@ -35,7 +35,7 @@ class TestCoremask(TestCase): Coremask Prerequisites. """ - self.port_mask = dts.create_mask(self.dut.get_ports(self.nic)) + self.port_mask = utils.create_mask(self.dut.get_ports(self.nic)) self.mem_channel = self.dut.get_memory_channels() self.all_cores = self.dut.get_core_list("all") @@ -53,7 +53,7 @@ class TestCoremask(TestCase): for core in self.all_cores: - core_mask = dts.create_mask([core]) + core_mask = utils.create_mask([core]) command = command_line % (self.target, core_mask, self.mem_channel) @@ -73,7 +73,7 @@ class TestCoremask(TestCase): Check coremask parsing for all the cores at once. """ - core_mask = dts.create_mask(self.all_cores) + core_mask = utils.create_mask(self.all_cores) command = command_line % (self.target, core_mask, self.mem_channel) diff --git a/tests/TestSuite_dual_vlan.py b/tests/TestSuite_dual_vlan.py index 1089b7f..81e370a 100644 --- a/tests/TestSuite_dual_vlan.py +++ b/tests/TestSuite_dual_vlan.py @@ -37,7 +37,7 @@ Test the support of Dual VLAN Offload Features by Poll Mode Drivers. """ -import dts +import utils import random import re @@ -90,12 +90,12 @@ class TestDualVlan(TestCase): self.ports_socket = self.dut.get_numa_id(ports[0]) cores = self.dut.get_core_list('1S/2C/2T') - coreMask = dts.create_mask(cores) + coreMask = utils.create_mask(cores) ports = self.dut.get_ports(self.nic) valports = [_ for _ in ports if self.tester.get_local_port(_) != -1] - portMask = dts.create_mask(valports[:2]) + portMask = utils.create_mask(valports[:2]) dutRxPortId = valports[0] dutTxPortId = valports[1] diff --git a/tests/TestSuite_dynamic_config.py b/tests/TestSuite_dynamic_config.py index 7df02b7..fa4b932 100644 --- a/tests/TestSuite_dynamic_config.py +++ b/tests/TestSuite_dynamic_config.py @@ -36,7 +36,7 @@ Test the dynamic driver configuration feature. """ -import dts +import utils from test_case import TestCase @@ -71,8 +71,8 @@ class TestDynamicConfig(TestCase): # Prepare cores and ports cores = self.dut.get_core_list('1S/2C/2T') - coreMask = dts.create_mask(cores) - portMask = dts.create_mask(self.dut_ports[:2]) + coreMask = utils.create_mask(cores) + portMask = utils.create_mask(self.dut_ports[:2]) # launch app cmd = "./%s/build/app/test-pmd/testpmd -c %s -n 3 -- -i --rxpt=0 \ @@ -87,7 +87,7 @@ class TestDynamicConfig(TestCase): self.dest = self.dut.get_mac_address(self.dut_ports[0]) mac_scanner = r"MAC address: (([\dA-F]{2}:){5}[\dA-F]{2})" - ret = dts.regexp(out, mac_scanner) + ret = utils.regexp(out, mac_scanner) self.verify(ret is not None, "MAC address not found") self.verify(cmp(ret.lower(), self.dest) == 0, "MAC address wrong") @@ -124,14 +124,14 @@ class TestDynamicConfig(TestCase): # get the current rx statistic out = self.dut.send_expect("clear port stats all" , "testpmd> ") out = self.dut.send_expect("show port stats %d" % portid, "testpmd> ") - cur_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)") + cur_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)") # send one packet with different MAC address than the portid self.dynamic_config_send_packet(portid) pre_rxpkt = cur_rxpkt out = self.dut.send_expect("show port stats %d" % portid, "testpmd> ") - cur_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)") + cur_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)") # check the pakcet increasment self.verify(int(cur_rxpkt) == int(pre_rxpkt) @@ -142,7 +142,7 @@ class TestDynamicConfig(TestCase): pre_rxpkt = cur_rxpkt out = self.dut.send_expect("show port stats %d" % portid, "testpmd> ") - cur_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)") + cur_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)") # check the pakcet increasment self.verify(int(cur_rxpkt) == int(pre_rxpkt) @@ -158,20 +158,20 @@ class TestDynamicConfig(TestCase): self.dut.send_expect("set promisc all off", "testpmd> ") out = self.dut.send_expect( "show port stats %d" % self.dut_ports[1], "testpmd> ") - cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)") + cur_rxpkt = utils.regexp(out, "TX-packets: ([0-9]+)") self.dynamic_config_send_packet(portid) pre_rxpkt = cur_rxpkt out = self.dut.send_expect( "show port stats %d" % self.dut_ports[1], "testpmd> ") - cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)") + cur_rxpkt = utils.regexp(out, "TX-packets: ([0-9]+)") self.verify(int(cur_rxpkt) == int( pre_rxpkt), "1st packet increasment error") self.dynamic_config_send_packet(portid, self.dest) pre_rxpkt = cur_rxpkt out = self.dut.send_expect( "show port stats %d" % self.dut_ports[1], "testpmd> ") - cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)") + cur_rxpkt = utils.regexp(out, "TX-packets: ([0-9]+)") self.verify(int(cur_rxpkt) == int( pre_rxpkt) + 1, "2nd packet increasment error") else: @@ -180,7 +180,7 @@ class TestDynamicConfig(TestCase): # get the current rx statistic out = self.dut.send_expect( "show port stats %d" % portid, "testpmd> ") - cur_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)") + cur_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)") # send one packet with different MAC address than the portid self.dynamic_config_send_packet(portid) @@ -188,7 +188,7 @@ class TestDynamicConfig(TestCase): pre_rxpkt = cur_rxpkt out = self.dut.send_expect( "show port stats %d" % portid, "testpmd> ") - cur_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)") + cur_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)") # check the pakcet increasment self.verify(int(cur_rxpkt) == int( @@ -200,7 +200,7 @@ class TestDynamicConfig(TestCase): pre_rxpkt = cur_rxpkt out = self.dut.send_expect( "show port stats %d" % portid, "testpmd> ") - cur_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)") + cur_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)") # check the pakcet increasment self.verify(int(cur_rxpkt) == int( @@ -221,7 +221,7 @@ class TestDynamicConfig(TestCase): self.dynamic_config_send_packet(self.dut_ports[0],"ff:ff:ff:ff:ff:ff") out = self.dut.send_expect("show port stats %d" % self.dut_ports[1], "testpmd> ") - cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)") + cur_rxpkt = utils.regexp(out, "TX-packets: ([0-9]+)") self.verify(int(cur_rxpkt) == 1, "not received broadcast packet") self.dut.send_expect("clear port stats all", "testpmd> ") @@ -229,7 +229,7 @@ class TestDynamicConfig(TestCase): self.dynamic_config_send_packet(self.dut_ports[0]) out = self.dut.send_expect("show port stats %d" % self.dut_ports[1], "testpmd> ") - cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)") + cur_rxpkt = utils.regexp(out, "TX-packets: ([0-9]+)") self.verify(int(cur_rxpkt) == 0, "disable promisc, received a dst mac not match packet") def test_dynamic_config_allmulticast(self): @@ -247,7 +247,7 @@ class TestDynamicConfig(TestCase): self.dynamic_config_send_packet(self.dut_ports[0],"01:00:00:33:00:01") out = self.dut.send_expect("show port stats %d" % self.dut_ports[1], "testpmd> ") - cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)") + cur_rxpkt = utils.regexp(out, "TX-packets: ([0-9]+)") self.verify(int(cur_rxpkt) == 1, "enable allmulti switch, not received allmulti packet") self.dut.send_expect("clear port stats all", "testpmd> ") @@ -256,7 +256,7 @@ class TestDynamicConfig(TestCase): self.dynamic_config_send_packet(self.dut_ports[0],"01:00:00:33:00:01") out = self.dut.send_expect("show port stats %d" % self.dut_ports[1], "testpmd> ") - cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)") + cur_rxpkt = utils.regexp(out, "TX-packets: ([0-9]+)") self.verify(int(cur_rxpkt) == 0, "disable allmulti switch, received allmulti packet") def test_dynamic_config_enable_promiscuous(self): @@ -270,14 +270,14 @@ class TestDynamicConfig(TestCase): # get the current rx statistic out = self.dut.send_expect("show port stats %d" % portid, "testpmd> ") - cur_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)") + cur_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)") # send one packet with different MAC address than the portid self.dynamic_config_send_packet(portid) pre_rxpkt = cur_rxpkt out = self.dut.send_expect("show port stats %d" % portid, "testpmd> ") - cur_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)") + cur_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)") # check the pakcet increasment self.verify(int(cur_rxpkt) == int(pre_rxpkt) @@ -288,7 +288,7 @@ class TestDynamicConfig(TestCase): pre_rxpkt = cur_rxpkt out = self.dut.send_expect("show port stats %d" % portid, "testpmd> ") - cur_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)") + cur_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)") # check the pakcet increasment self.verify(int(cur_rxpkt) == int(pre_rxpkt) diff --git a/tests/TestSuite_fdir.py b/tests/TestSuite_fdir.py index 537ab1f..40c9783 100644 --- a/tests/TestSuite_fdir.py +++ b/tests/TestSuite_fdir.py @@ -41,7 +41,7 @@ import string from time import sleep from scapy.utils import struct, socket, PcapWriter -import dts +import utils from etgen import IxiaPacketGenerator from test_case import TestCase from settings import HEADER_SIZE @@ -98,19 +98,19 @@ class TestFdir(TestCase, IxiaPacketGenerator): if m: m.groups() if (self.queue == int(m.group(2))): - print dts.GREEN("Pass: queue id is " + m.group(2)) + print utils.GREEN("Pass: queue id is " + m.group(2)) self.verify(1, "Pass") else: - print dts.RED("Fail: queue id is " + m.group(2)) + print utils.RED("Fail: queue id is " + m.group(2)) self.verify(0, "Fail") print out else: print "not match" if (-1 == self.queue): - print dts.GREEN("Pass: fdir should not match ") + print utils.GREEN("Pass: fdir should not match ") self.verify(1, "Pass") else: - print dts.RED("Fail") + print utils.RED("Fail") self.verify(0, "Fail") print out print "**************Print sub-case result****************" @@ -140,11 +140,11 @@ class TestFdir(TestCase, IxiaPacketGenerator): self.verify(len(self.dut_ports) >= 2, "Insufficient ports for testing") # Verify that enough threads are available - self.all_cores_mask = dts.create_mask(self.dut.get_core_list("all")) + self.all_cores_mask = utils.create_mask(self.dut.get_core_list("all")) cores = self.dut.get_core_list("1S/5C/1T") self.verify(cores is not None, "Insufficient cores for speed testing") - self.coreMask = dts.create_mask(cores) - self.portMask = dts.create_mask([self.dut_ports[0], self.dut_ports[1]]) + self.coreMask = utils.create_mask(cores) + self.portMask = utils.create_mask([self.dut_ports[0], self.dut_ports[1]]) self.ports_socket = self.dut.get_numa_id(self.dut_ports[0]) self.dut_rx_port = self.tester.get_local_port(self.dut_ports[0]) self.dut_rx_interface = self.tester.get_interface(self.dut_rx_port) @@ -239,7 +239,7 @@ class TestFdir(TestCase, IxiaPacketGenerator): """ self.dut.kill_all() - self.dut.send_expect("./%s/app/testpmd -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.target, self.coreMask, dts.create_mask([self.dut_ports[0]])), "testpmd>", 120) + self.dut.send_expect("./%s/app/testpmd -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.target, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120) self.dut.send_expect("set verbose 1", "testpmd>") self.dut.send_expect("set fwd rxonly", "testpmd>") @@ -315,10 +315,10 @@ class TestFdir(TestCase, IxiaPacketGenerator): self.dut.kill_all() if self.nic in ["niantic"]: # Niantic ipv6 only support signature mode - self.dut.send_expect("./%s/app/testpmd -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=signature" % (self.target, self.coreMask, dts.create_mask([self.dut_ports[0]])), "testpmd>", 120) + self.dut.send_expect("./%s/app/testpmd -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=signature" % (self.target, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120) elif self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortpark_TLV"]: # Fortville ipv6 support perfect mode - self.dut.send_expect("./%s/app/testpmd -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.target, self.coreMask, dts.create_mask([self.dut_ports[0]])), "testpmd>", 120) + self.dut.send_expect("./%s/app/testpmd -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.target, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120) self.dut.send_expect("set verbose 1", "testpmd>") self.dut.send_expect("set fwd rxonly", "testpmd>") @@ -386,7 +386,7 @@ class TestFdir(TestCase, IxiaPacketGenerator): def test_fdir_noflexword_drop_ipv4(self): # drop command testing self.dut.kill_all() - self.dut.send_expect("./%s/app/testpmd -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.target, self.coreMask, dts.create_mask([self.dut_ports[0]])), "testpmd>", 120) + self.dut.send_expect("./%s/app/testpmd -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.target, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120) self.dut.send_expect("set verbose 1", "testpmd>") self.dut.send_expect("set fwd rxonly", "testpmd>") @@ -464,7 +464,7 @@ class TestFdir(TestCase, IxiaPacketGenerator): # drop command testing self.dut.kill_all() - self.dut.send_expect("./%s/app/testpmd -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.target, self.coreMask, dts.create_mask([self.dut_ports[0]])), "testpmd>", 120) + self.dut.send_expect("./%s/app/testpmd -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.target, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120) self.dut.send_expect("set verbose 1", "testpmd>") self.dut.send_expect("set fwd rxonly", "testpmd>") @@ -521,7 +521,7 @@ class TestFdir(TestCase, IxiaPacketGenerator): self.dut.kill_all() # fwd testing with flexword - self.dut.send_expect("./%s/app/testpmd -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.target, self.coreMask, dts.create_mask([self.dut_ports[0]])), "testpmd>", 120) + self.dut.send_expect("./%s/app/testpmd -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.target, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120) self.dut.send_expect("set verbose 1", "testpmd>") self.dut.send_expect("set fwd rxonly", "testpmd>") @@ -600,10 +600,10 @@ class TestFdir(TestCase, IxiaPacketGenerator): # fwd testing with flexword if self.nic in ["niantic"]: # Niantic ipv6 only support signature mode - self.dut.send_expect("./%s/app/testpmd -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=signature" % (self.target, self.coreMask, dts.create_mask([self.dut_ports[0]])), "testpmd>", 120) + self.dut.send_expect("./%s/app/testpmd -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=signature" % (self.target, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120) elif self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortpark_TLV"]: # fortville ipv6 support perfect mode - self.dut.send_expect("./%s/app/testpmd -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.target, self.coreMask, dts.create_mask([self.dut_ports[0]])), "testpmd>", 120) + self.dut.send_expect("./%s/app/testpmd -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.target, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120) self.dut.send_expect("set verbose 1", "testpmd>") self.dut.send_expect("set fwd rxonly", "testpmd>") @@ -670,7 +670,7 @@ class TestFdir(TestCase, IxiaPacketGenerator): def test_fdir_flexword_drop_ipv4(self): # drop testing with flexword - self.dut.send_expect("./%s/app/testpmd -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.target, self.coreMask, dts.create_mask([self.dut_ports[0]])), "testpmd>", 120) + self.dut.send_expect("./%s/app/testpmd -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.target, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120) self.dut.send_expect("set verbose 1", "testpmd>") self.dut.send_expect("set fwd rxonly", "testpmd>") @@ -728,7 +728,7 @@ class TestFdir(TestCase, IxiaPacketGenerator): # Niantic is not support in drop ipv6 if (self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortpark_TLV"]): # drop testing with flexword - self.dut.send_expect("./%s/app/testpmd -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.target, self.coreMask, dts.create_mask([self.dut_ports[0]])), "testpmd>", 120) + self.dut.send_expect("./%s/app/testpmd -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.target, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120) self.dut.send_expect("set verbose 1", "testpmd>") self.dut.send_expect("set fwd rxonly", "testpmd>") @@ -771,7 +771,7 @@ class TestFdir(TestCase, IxiaPacketGenerator): self.dut.kill_all() - self.dut.send_expect("./%s/app/testpmd -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=8 --txq=8 --nb-cores=16 --nb-ports=2 --pkt-filter-mode=perfect" % (self.target, self.all_cores_mask, dts.create_mask([self.dut_ports[0]])), "testpmd>", 120) + self.dut.send_expect("./%s/app/testpmd -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=8 --txq=8 --nb-cores=16 --nb-ports=2 --pkt-filter-mode=perfect" % (self.target, self.all_cores_mask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120) self.dut.send_expect("set verbose 1", "testpmd>") self.dut.send_expect("set fwd rxonly", "testpmd>") @@ -855,8 +855,8 @@ class TestFdir(TestCase, IxiaPacketGenerator): else: self.queues = 1 - core_mask = dts.create_mask(core_list) - port_mask = dts.create_mask([self.dut_ports[0], self.dut_ports[1]]) + core_mask = utils.create_mask(core_list) + port_mask = utils.create_mask([self.dut_ports[0], self.dut_ports[1]]) if test_type == "fdir_disable": command_line = "./%s/app/testpmd -c 0xff00ff -n %d -- -i --rxq=2 --txq=2 --rxd=512 --txd=512 --burst=32 --rxfreet=64 --txfreet=64 --mbcache=256 \ @@ -869,8 +869,8 @@ class TestFdir(TestCase, IxiaPacketGenerator): info = "Executing PMD using %s\n" % test_cycle['cores'] self.logger.info(info) - dts.report(info, annex=True) - dts.report(command_line + "\n\n", frame=True, annex=True) + self.rst_report(info, annex=True) + self.rst_report(command_line + "\n\n", frame=True, annex=True) out = self.dut.send_expect(command_line, "testpmd> ", 100) print out @@ -932,16 +932,16 @@ class TestFdir(TestCase, IxiaPacketGenerator): frame_size] > 0, "No traffic detected") # Print results - dts.results_table_add_header(self.table_header) + self.result_table_create(self.table_header) for frame_size in self.frame_sizes: table_row = [frame_size] for test_cycle in self.test_cycles: table_row.append(test_cycle['Mpps'][frame_size]) table_row.append(test_cycle['pct'][frame_size]) - dts.results_table_add_row(table_row) + self.result_table_add(table_row) - dts.results_table_print() + self.result_table_print() def ip(self, port, frag, src, proto, tos, dst, chksum, len, version, flags, ihl, ttl, id, options=None): """ diff --git a/tests/TestSuite_fm10k_perf.py b/tests/TestSuite_fm10k_perf.py index c092950..a76aba4 100644 --- a/tests/TestSuite_fm10k_perf.py +++ b/tests/TestSuite_fm10k_perf.py @@ -34,7 +34,7 @@ DPDK Test suite. Layer-3 forwarding test script. """ -import dts +import utils import string import re from test_case import TestCase @@ -288,7 +288,7 @@ class TestFM10kL3fwd(TestCase, IxiaPacketGenerator): header_row = ["Frame", "mode", "S/C/T", "Mpps", "% linerate", "latency_max(us)", "latency_min(us)", "latency_avg(us)"] self.l3fwd_test_results['header'] = header_row - dts.results_table_add_header(header_row) + utils.result_table_create(header_row) self.l3fwd_test_results['data'] = [] mac = ["02:00:00:00:00:00", "02:00:00:00:00:01"] @@ -303,9 +303,9 @@ class TestFM10kL3fwd(TestCase, IxiaPacketGenerator): self.tester.scapy_append('wrpcap("dst%d.pcap", [%s])' %(valports[_port],string.join(flows,','))) self.tester.scapy_execute() - dts.report("Flows for 2 ports, %d frame size.\n" % (frame_size), + self.rst_report("Flows for 2 ports, %d frame size.\n" % (frame_size), annex=True) - dts.report("%s" % string.join(flows, '\n'), + self.rst_report("%s" % string.join(flows, '\n'), frame=True, annex=True) @@ -327,7 +327,7 @@ class TestFM10kL3fwd(TestCase, IxiaPacketGenerator): rtCmdLines[key] = pat.sub(self.repl, rtCmdLines[key]) self.logger.info("%s\n" % str(corelist)) - coreMask[key] = dts.create_mask(set(corelist)) + coreMask[key] = utils.create_mask(set(corelist)) # measure by two different mode #methods = TestFM10kL3fwd.methods @@ -343,15 +343,15 @@ class TestFM10kL3fwd(TestCase, IxiaPacketGenerator): mode, cores, frame_size) self.logger.info(info) - dts.report(info, annex=True) + self.rst_report(info, annex=True) subtitle.append(cores) cmdline = rtCmdLines[cores] % (TestFM10kL3fwd.path + "l3fwd_" + mode, coreMask[cores], - self.dut.get_memory_channels(), dts.create_mask(valports[:2])) + self.dut.get_memory_channels(), utils.create_mask(valports[:2])) if frame_size > 1518: cmdline = cmdline + " --max-pkt-len %d" % frame_size - dts.report(cmdline + "\n", frame=True, annex=True) + self.rst_report(cmdline + "\n", frame=True, annex=True) out = self.dut.send_expect(cmdline, "L3FWD:", 120) @@ -386,16 +386,16 @@ class TestFM10kL3fwd(TestCase, IxiaPacketGenerator): for latency in latencys: if latency['max'] > 0: data_row = [frame_size, mode, cores, str(pps), str(pct), str(latency['max']/1000), str(latency['min']/1000), str(latency['average']/1000)] - dts.results_table_add_row(data_row) + utils.result_table_add(data_row) self.l3fwd_test_results['data'].append(data_row) - dts.results_table_print() + self.result_table_print() def perf_rfc2544(self): header_row = ["Frame", "mode", "S/C/T", "tx_pkts(1min)", "LR_rx_pkts(1min)", "LR_loss_pkts(1min)", "% zero_loss_rate(0.01%loss)"] self.l3fwd_test_results['header'] = header_row - dts.results_table_add_header(header_row) + self.result_table_create(header_row) self.l3fwd_test_results['data'] = [] for frame_size in TestFM10kL3fwd.frame_sizes: @@ -409,9 +409,9 @@ class TestFM10kL3fwd(TestCase, IxiaPacketGenerator): self.tester.scapy_append('wrpcap("dst%d.pcap", [%s])' %(valports[_port],string.join(flows,','))) self.tester.scapy_execute() - dts.report("Flows for 2 ports, %d frame size.\n" % (frame_size), + self.rst_report("Flows for 2 ports, %d frame size.\n" % (frame_size), annex=True) - dts.report("%s" % string.join(flows, '\n'), + self.rst_report("%s" % string.join(flows, '\n'), frame=True, annex=True) @@ -433,7 +433,7 @@ class TestFM10kL3fwd(TestCase, IxiaPacketGenerator): rtCmdLines[key] = pat.sub(self.repl, rtCmdLines[key]) self.logger.info("%s\n" % str(corelist)) - coreMask[key] = dts.create_mask(set(corelist)) + coreMask[key] = utils.create_mask(set(corelist)) # measure by two different mode for mode in TestFM10kL3fwd.methods: @@ -449,16 +449,16 @@ class TestFM10kL3fwd(TestCase, IxiaPacketGenerator): mode, cores, frame_size) self.logger.info(info) - dts.report(info, annex=True) + self.rst_report(info, annex=True) subtitle.append(cores) cmdline = rtCmdLines[cores] % (TestFM10kL3fwd.path + "l3fwd_" + mode, coreMask[cores], - self.dut.get_memory_channels(), dts.create_mask(valports[:2])) + self.dut.get_memory_channels(), utils.create_mask(valports[:2])) if frame_size > 1518: cmdline = cmdline + " --max-pkt-len %d" % frame_size - dts.report(cmdline + "\n", frame=True, annex=True) + self.rst_report(cmdline + "\n", frame=True, annex=True) out = self.dut.send_expect(cmdline, "L3FWD:", 120) @@ -486,14 +486,14 @@ class TestFM10kL3fwd(TestCase, IxiaPacketGenerator): loss_pkts = human_read_number(loss_pkts) data_row = [frame_size, mode, cores, str(tx_pkts), str(rx_pkts), loss_pkts, zero_loss_rate] - dts.results_table_add_row(data_row) + self.result_table_add(data_row) self.l3fwd_test_results['data'].append(data_row) else: pass index += 1 - dts.results_table_print() + self.result_table_print() def test_perf_rfc2544_vec(self): # add setting for scatter diff --git a/tests/TestSuite_fortville_rss_granularity_config.py b/tests/TestSuite_fortville_rss_granularity_config.py index 6773573..dd06f06 100644 --- a/tests/TestSuite_fortville_rss_granularity_config.py +++ b/tests/TestSuite_fortville_rss_granularity_config.py @@ -50,7 +50,7 @@ Support 4*10G, 1*40G and 2*40G NICs. import time import random import re -import dts +import utils import dut testQueues = [16] @@ -177,7 +177,7 @@ class TestFortvilleRssGranularityConfig(TestCase): global reta_num #append the the hash value and queue id into table - dts.results_table_add_header( + self.result_table_create( ['packet index', 'hash value', 'hash index', 'queue id']) i = 0 @@ -186,7 +186,7 @@ class TestFortvilleRssGranularityConfig(TestCase): # compute the hash result of five tuple into the 7 LSBs value. hash_index = int(tmp_reta_line["RSS hash"], 16) % reta_num - dts.results_table_add_row( + self.result_table_add( [i, tmp_reta_line["RSS hash"], hash_index, tmp_reta_line["queue"]]) i = i + 1 @@ -238,29 +238,30 @@ class TestFortvilleRssGranularityConfig(TestCase): self.send_packet(itf, "ipv4-tcp") self.dut.send_expect("quit", "# ", 30) - dts.results_table_print() - self.verify(len(dts.results_table_rows) > 1, "There is no data in the table, testcase failed!") + self.result_table_print() + result_rows = self.result_table_getrows() + self.verify(len(result_rows) > 1, "There is no data in the table, testcase failed!") - if ((dts.results_table_rows[1][1]==dts.results_table_rows[2][1])or(dts.results_table_rows[1][3]==dts.results_table_rows[2][3])): + if ((result_rows[1][1]==result_rows[2][1])or(result_rows[1][3]==result_rows[2][3])): flag = 0 self.verify(flag, "The two hash values are the same, rss_granularity_config failed!") - elif ((dts.results_table_rows[1][1]==dts.results_table_rows[3][1])or(dts.results_table_rows[1][3]==dts.results_table_rows[3][3])): + elif ((result_rows[1][1]==result_rows[3][1])or(result_rows[1][3]==result_rows[3][3])): flag = 0 self.verify(flag, "The two hash values are the same, rss_granularity_config failed!") - elif ((dts.results_table_rows[2][1]==dts.results_table_rows[3][1])or(dts.results_table_rows[2][3]==dts.results_table_rows[3][3])): + elif ((result_rows[2][1]==result_rows[3][1])or(result_rows[2][3]==result_rows[3][3])): flag = 0 self.verify(flag, "The two hash values are the same, rss_granularity_config failed!") - elif ((dts.results_table_rows[1][1]==dts.results_table_rows[5][1])or(dts.results_table_rows[1][3]==dts.results_table_rows[5][3])): + elif ((result_rows[1][1]==result_rows[5][1])or(result_rows[1][3]==result_rows[5][3])): flag = 0 self.verify(flag, "The two hash values are the same, rss_granularity_config failed!") - elif ((dts.results_table_rows[2][1]==dts.results_table_rows[5][1])or(dts.results_table_rows[2][3]==dts.results_table_rows[5][3])): + elif ((result_rows[2][1]==result_rows[5][1])or(result_rows[2][3]==result_rows[5][3])): flag = 0 self.verify(flag, "The two hash values are the same, rss_granularity_config failed!") - elif ((dts.results_table_rows[3][1]==dts.results_table_rows[5][1])or(dts.results_table_rows[3][3]==dts.results_table_rows[5][3])): + elif ((result_rows[3][1]==result_rows[5][1])or(result_rows[3][3]==result_rows[5][3])): flag = 0 self.verify(flag, "The two hash values are the same, rss_granularity_config failed!") - elif ((dts.results_table_rows[1][1]!=dts.results_table_rows[4][1])or(dts.results_table_rows[1][3]!=dts.results_table_rows[4][3])): + elif ((result_rows[1][1]!=result_rows[4][1])or(result_rows[1][3]!=result_rows[4][3])): flag = 0 self.verify(flag, "The two hash values are different, rss_granularity_config failed!") @@ -313,29 +314,30 @@ class TestFortvilleRssGranularityConfig(TestCase): self.send_packet(itf, "ipv4-udp") self.dut.send_expect("quit", "# ", 30) - dts.results_table_print() - self.verify(len(dts.results_table_rows) > 1, "There is no data in the table, testcase failed!") + self.result_table_print() + result_rows = self.result_table_getrows() + self.verify(len(result_rows) > 1, "There is no data in the table, testcase failed!") #check the results - if ((dts.results_table_rows[1][1]==dts.results_table_rows[2][1])or(dts.results_table_rows[1][3]==dts.results_table_rows[2][3])): + if ((result_rows[1][1]==result_rows[2][1])or(result_rows[1][3]==result_rows[2][3])): flag = 0 self.verify(flag, "The two hash values are the same, rss_granularity_config failed!") - elif ((dts.results_table_rows[1][1]==dts.results_table_rows[3][1])or(dts.results_table_rows[1][3]==dts.results_table_rows[3][3])): + elif ((result_rows[1][1]==result_rows[3][1])or(result_rows[1][3]==result_rows[3][3])): flag = 0 self.verify(flag, "The two hash values are the same, rss_granularity_config failed!") - elif ((dts.results_table_rows[2][1]==dts.results_table_rows[3][1])or(dts.results_table_rows[2][3]==dts.results_table_rows[3][3])): + elif ((result_rows[2][1]==result_rows[3][1])or(result_rows[2][3]==result_rows[3][3])): flag = 0 self.verify(flag, "The two hash values are the same, rss_granularity_config failed!") - elif ((dts.results_table_rows[1][1]==dts.results_table_rows[5][1])or(dts.results_table_rows[1][3]==dts.results_table_rows[5][3])): + elif ((result_rows[1][1]==result_rows[5][1])or(result_rows[1][3]==result_rows[5][3])): flag = 0 self.verify(flag, "The two hash values are the same, rss_granularity_config failed!") - elif ((dts.results_table_rows[2][1]==dts.results_table_rows[5][1])or(dts.results_table_rows[2][3]==dts.results_table_rows[5][3])): + elif ((result_rows[2][1]==result_rows[5][1])or(result_rows[2][3]==result_rows[5][3])): flag = 0 self.verify(flag, "The two hash values are the same, rss_granularity_config failed!") - elif ((dts.results_table_rows[3][1]==dts.results_table_rows[5][1])or(dts.results_table_rows[3][3]==dts.results_table_rows[5][3])): + elif ((result_rows[3][1]==result_rows[5][1])or(result_rows[3][3]==result_rows[5][3])): flag = 0 self.verify(flag, "The two hash values are the same, rss_granularity_config failed!") - elif ((dts.results_table_rows[1][1]!=dts.results_table_rows[4][1])or(dts.results_table_rows[1][3]!=dts.results_table_rows[4][3])): + elif ((result_rows[1][1]!=result_rows[4][1])or(result_rows[1][3]!=result_rows[4][3])): flag = 0 self.verify(flag, "The two hash values are different, rss_granularity_config failed!") @@ -388,29 +390,30 @@ class TestFortvilleRssGranularityConfig(TestCase): self.send_packet(itf, "ipv6-tcp") self.dut.send_expect("quit", "# ", 30) - dts.results_table_print() - self.verify(len(dts.results_table_rows) > 1, "There is no data in the table, testcase failed!") + self.result_table_print() + result_rows = self.result_table_getrows() + self.verify(len(result_rows) > 1, "There is no data in the table, testcase failed!") #check the results - if ((dts.results_table_rows[1][1]==dts.results_table_rows[2][1])or(dts.results_table_rows[1][3]==dts.results_table_rows[2][3])): + if ((result_rows[1][1]==result_rows[2][1])or(result_rows[1][3]==result_rows[2][3])): flag = 0 self.verify(flag, "The two hash values are the same, rss_granularity_config failed!") - elif ((dts.results_table_rows[1][1]==dts.results_table_rows[3][1])or(dts.results_table_rows[1][3]==dts.results_table_rows[3][3])): + elif ((result_rows[1][1]==result_rows[3][1])or(result_rows[1][3]==result_rows[3][3])): flag = 0 self.verify(flag, "The two hash values are the same, rss_granularity_config failed!") - elif ((dts.results_table_rows[2][1]==dts.results_table_rows[3][1])or(dts.results_table_rows[2][3]==dts.results_table_rows[3][3])): + elif ((result_rows[2][1]==result_rows[3][1])or(result_rows[2][3]==result_rows[3][3])): flag = 0 self.verify(flag, "The two hash values are the same, rss_granularity_config failed!") - elif ((dts.results_table_rows[1][1]==dts.results_table_rows[5][1])or(dts.results_table_rows[1][3]==dts.results_table_rows[5][3])): + elif ((result_rows[1][1]==result_rows[5][1])or(result_rows[1][3]==result_rows[5][3])): flag = 0 self.verify(flag, "The two hash values are the same, rss_granularity_config failed!") - elif ((dts.results_table_rows[2][1]==dts.results_table_rows[5][1])or(dts.results_table_rows[2][3]==dts.results_table_rows[5][3])): + elif ((result_rows[2][1]==result_rows[5][1])or(result_rows[2][3]==result_rows[5][3])): flag = 0 self.verify(flag, "The two hash values are the same, rss_granularity_config failed!") - elif ((dts.results_table_rows[3][1]==dts.results_table_rows[5][1])or(dts.results_table_rows[3][3]==dts.results_table_rows[5][3])): + elif ((result_rows[3][1]==result_rows[5][1])or(result_rows[3][3]==result_rows[5][3])): flag = 0 self.verify(flag, "The two hash values are the same, rss_granularity_config failed!") - elif ((dts.results_table_rows[1][1]!=dts.results_table_rows[4][1])or(dts.results_table_rows[1][3]!=dts.results_table_rows[4][3])): + elif ((result_rows[1][1]!=result_rows[4][1])or(result_rows[1][3]!=result_rows[4][3])): flag = 0 self.verify(flag, "The two hash values are different, rss_granularity_config failed!") @@ -463,29 +466,30 @@ class TestFortvilleRssGranularityConfig(TestCase): self.send_packet(itf, "ipv6-udp") self.dut.send_expect("quit", "# ", 30) - dts.results_table_print() - self.verify(len(dts.results_table_rows) > 1, "There is no data in the table, testcase failed!") + self.result_table_print() + result_rows = self.result_table_getrows() + self.verify(len(result_rows) > 1, "There is no data in the table, testcase failed!") #check the results - if ((dts.results_table_rows[1][1]==dts.results_table_rows[2][1])or(dts.results_table_rows[1][3]==dts.results_table_rows[2][3])): + if ((result_rows[1][1]==result_rows[2][1])or(result_rows[1][3]==result_rows[2][3])): flag = 0 self.verify(flag, "The two hash values are the same, rss_granularity_config failed!") - elif ((dts.results_table_rows[1][1]==dts.results_table_rows[3][1])or(dts.results_table_rows[1][3]==dts.results_table_rows[3][3])): + elif ((result_rows[1][1]==result_rows[3][1])or(result_rows[1][3]==result_rows[3][3])): flag = 0 self.verify(flag, "The two hash values are the same, rss_granularity_config failed!") - elif ((dts.results_table_rows[2][1]==dts.results_table_rows[3][1])or(dts.results_table_rows[2][3]==dts.results_table_rows[3][3])): + elif ((result_rows[2][1]==result_rows[3][1])or(result_rows[2][3]==result_rows[3][3])): flag = 0 self.verify(flag, "The two hash values are the same, rss_granularity_config failed!") - elif ((dts.results_table_rows[1][1]==dts.results_table_rows[5][1])or(dts.results_table_rows[1][3]==dts.results_table_rows[5][3])): + elif ((result_rows[1][1]==result_rows[5][1])or(result_rows[1][3]==result_rows[5][3])): flag = 0 self.verify(flag, "The two hash values are the same, rss_granularity_config failed!") - elif ((dts.results_table_rows[2][1]==dts.results_table_rows[5][1])or(dts.results_table_rows[2][3]==dts.results_table_rows[5][3])): + elif ((result_rows[2][1]==result_rows[5][1])or(result_rows[2][3]==result_rows[5][3])): flag = 0 self.verify(flag, "The two hash values are the same, rss_granularity_config failed!") - elif ((dts.results_table_rows[3][1]==dts.results_table_rows[5][1])or(dts.results_table_rows[3][3]==dts.results_table_rows[5][3])): + elif ((result_rows[3][1]==result_rows[5][1])or(result_rows[3][3]==result_rows[5][3])): flag = 0 self.verify(flag, "The two hash values are the same, rss_granularity_config failed!") - elif ((dts.results_table_rows[1][1]!=dts.results_table_rows[4][1])or(dts.results_table_rows[1][3]!=dts.results_table_rows[4][3])): + elif ((result_rows[1][1]!=result_rows[4][1])or(result_rows[1][3]!=result_rows[4][3])): flag = 0 self.verify(flag, "The two hash values are different, rss_granularity_config failed!") @@ -532,20 +536,21 @@ class TestFortvilleRssGranularityConfig(TestCase): self.dut.send_expect("quit", "# ", 30) - dts.results_table_print() - self.verify(len(dts.results_table_rows) > 1, "There is no data in the table, testcase failed!") + self.result_table_print() + result_rows = self.result_table_getrows() + self.verify(len(result_rows) > 1, "There is no data in the table, testcase failed!") #check the results - if ((dts.results_table_rows[1][1]!=dts.results_table_rows[2][1])or(dts.results_table_rows[1][3]!=dts.results_table_rows[2][3])): + if ((result_rows[1][1]!=result_rows[2][1])or(result_rows[1][3]!=result_rows[2][3])): flag = 0 self.verify(flag, "The two hash values are different, rss_granularity_config failed!") - elif ((dts.results_table_rows[1][1]==dts.results_table_rows[3][1])or(dts.results_table_rows[1][3]==dts.results_table_rows[3][3])): + elif ((result_rows[1][1]==result_rows[3][1])or(result_rows[1][3]==result_rows[3][3])): flag = 0 self.verify(flag, "The two hash values are the same, rss_granularity_config failed!") - elif ((dts.results_table_rows[1][1]==dts.results_table_rows[4][1])or(dts.results_table_rows[1][3]==dts.results_table_rows[4][3])): + elif ((result_rows[1][1]==result_rows[4][1])or(result_rows[1][3]==result_rows[4][3])): flag = 0 self.verify(flag, "The two hash values are the same, rss_granularity_config failed!") - elif ((dts.results_table_rows[3][1]==dts.results_table_rows[4][1])or(dts.results_table_rows[3][3]==dts.results_table_rows[4][3])): + elif ((result_rows[3][1]==result_rows[4][1])or(result_rows[3][3]==result_rows[4][3])): flag = 0 self.verify(flag, "The two hash values are the same, rss_granularity_config failed!") @@ -584,32 +589,33 @@ class TestFortvilleRssGranularityConfig(TestCase): #set hash input set by testpmd on dut, enable src-ipv4 & dst-ipv4 self.dut.send_expect("set_hash_input_set 0 ipv4-other src-ipv4 add", "testpmd> ") self.dut.send_expect("set_hash_input_set 0 ipv4-other dst-ipv4 add", "testpmd> ") - self.send_packet(itf, "ipv4-other") + self.send_packet(itf, "ipv4-other") #set hash input set by testpmd on dut, enable src-ipv4, dst-ipv4, gre-key-len 3 self.dut.send_expect("global_config 0 gre-key-len 3", "testpmd> ") - self.dut.send_expect("set_hash_input_set 0 ipv4-other gre-key add", "testpmd> ") + self.dut.send_expect("set_hash_input_set 0 ipv4-other gre-key add", "testpmd> ") self.send_packet(itf, "ipv4-other") - #set hash input set by testpmd on dut, enable src-ipv4, dst-ipv4, gre-key-len 4 + #set hash input set by testpmd on dut, enable src-ipv4, dst-ipv4, gre-key-len 4 self.dut.send_expect("global_config 0 gre-key-len 4", "testpmd> ") - self.send_packet(itf, "ipv4-other") + self.send_packet(itf, "ipv4-other") self.dut.send_expect("quit", "# ", 30) - dts.results_table_print() - self.verify(len(dts.results_table_rows) > 1, "There is no data in the table, testcase failed!") + self.result_table_print() + result_rows = self.result_table_getrows() + self.verify(len(result_rows) > 1, "There is no data in the table, testcase failed!") #check the results - if ((dts.results_table_rows[1][1]==dts.results_table_rows[2][1])or(dts.results_table_rows[1][3]==dts.results_table_rows[2][3])): + if ((result_rows[1][1]==result_rows[2][1])or(result_rows[1][3]==result_rows[2][3])): flag = 0 self.verify(flag, "The two hash values are the same, rss_granularity_config failed!") - elif ((dts.results_table_rows[1][1]!=dts.results_table_rows[3][1])or(dts.results_table_rows[1][3]!=dts.results_table_rows[3][3])): + elif ((result_rows[1][1]!=result_rows[3][1])or(result_rows[1][3]!=result_rows[3][3])): flag = 0 self.verify(flag, "The two hash values are different, rss_granularity_config failed!") - elif ((dts.results_table_rows[1][1]==dts.results_table_rows[4][1])or(dts.results_table_rows[1][3]==dts.results_table_rows[4][3])): + elif ((result_rows[1][1]==result_rows[4][1])or(result_rows[1][3]==result_rows[4][3])): flag = 0 self.verify(flag, "The two hash values are the same, rss_granularity_config failed!") - elif ((dts.results_table_rows[4][1]==dts.results_table_rows[5][1])or(dts.results_table_rows[4][3]==dts.results_table_rows[5][3])): + elif ((result_rows[4][1]==result_rows[5][1])or(result_rows[4][3]==result_rows[5][3])): flag = 0 self.verify(flag, "The two hash values are the same, rss_granularity_config failed!") diff --git a/tests/TestSuite_generic_filter.py b/tests/TestSuite_generic_filter.py index 9f6676c..c42ec5a 100644 --- a/tests/TestSuite_generic_filter.py +++ b/tests/TestSuite_generic_filter.py @@ -36,7 +36,7 @@ Test the support of VLAN Offload Features by Poll Mode Drivers. """ -import dts +import utils import time import re @@ -67,7 +67,7 @@ class TestGeneric_filter(TestCase): global valports valports = [_ for _ in ports if self.tester.get_local_port(_) != -1] global portMask - portMask = dts.create_mask(valports[:2]) + portMask = utils.create_mask(valports[:2]) self.pmdout = PmdOutput(self.dut) self.ethertype_filter = "off" @@ -769,7 +769,7 @@ class TestGeneric_filter(TestCase): "ethertype": 'Ether(dst="%s")/ARP(pdst="192.168.1.1")' % tx_mac, "5tuple": 'flows.append(Ether(dst="%s")/IP(src="2.2.2.4",dst="2.2.2.5")/TCP(sport=1,dport=1,flags=0)/("X"*%d))', } - dts.results_table_add_header( + self.result_table_create( ['pack_size', "filter_type", "enable", "disable", "perf_compare"]) for key in test_type.keys(): if "5tuple" != key: @@ -789,7 +789,7 @@ class TestGeneric_filter(TestCase): _, pps = self.tester.traffic_generator_throughput( tgen_input) pps_lists.append(pps) - dts.results_table_add_row( + self.result_table_add( ["defult", key, pps_lists[0], pps_lists[1], (pps_lists[0] - pps_lists[1]) / float(pps_lists[1])]) # this is a TCP/IP package, need test different payload_size if ("5tuple" == key) and ("niantic" == self.nic): @@ -816,9 +816,9 @@ class TestGeneric_filter(TestCase): _, pps = self.tester.traffic_generator_throughput( tgen_input) pps_lists.append(pps) - dts.results_table_add_row( + self.result_table_add( [package_size, key, pps_lists[0], pps_lists[1], (pps_lists[0] - pps_lists[1]) / float(pps_lists[1])]) - dts.results_table_print() + self.result_table_print() def tear_down(self): """ diff --git a/tests/TestSuite_hello_world.py b/tests/TestSuite_hello_world.py index 255a8aa..1c5934c 100644 --- a/tests/TestSuite_hello_world.py +++ b/tests/TestSuite_hello_world.py @@ -34,7 +34,7 @@ DPDK Test suite. Test HelloWorld example. """ -import dts +import utils from test_case import TestCase class TestHelloWorld(TestCase): @@ -65,7 +65,7 @@ class TestHelloWorld(TestCase): # get the mask for the first core cores = self.dut.get_core_list('1S/1C/1T') - coreMask = dts.create_mask(cores) + coreMask = utils.create_mask(cores) cmdline = "./examples/helloworld/build/app/helloworld -n 1 -c " + coreMask out = self.dut.send_expect(cmdline, "# ", 30) self.verify("hello from core %s" % cores[0] in out, "EAL not started on core%s" % cores[0]) @@ -78,7 +78,7 @@ class TestHelloWorld(TestCase): # get the maximun logical core number cores = self.dut.get_core_list('all') - coreMask = dts.create_mask(cores) + coreMask = utils.create_mask(cores) cmdline = "./examples/helloworld/build/app/helloworld -n 1 -c " + coreMask out = self.dut.send_expect(cmdline, "# ", 50) diff --git a/tests/TestSuite_ieee1588.py b/tests/TestSuite_ieee1588.py index bfbb23b..58d9a10 100644 --- a/tests/TestSuite_ieee1588.py +++ b/tests/TestSuite_ieee1588.py @@ -34,7 +34,7 @@ DPDK Test suite. Test support of IEEE1588 Precise Time Protocol. """ -import dts +import utils import time import re from test_case import TestCase @@ -100,7 +100,7 @@ class TestIeee1588(TestCase): out = self.dut.get_session_output() self.dut.send_expect("stop", "testpmd> ") - text = dts.regexp(out, "(.*) by hardware") + text = utils.regexp(out, "(.*) by hardware") self.verify("IEEE1588 PTP V2 SYNC" in text, "Not filtered " + text) pattern_rx = re.compile("RX timestamp value (\d+) s (\d+) ns") diff --git a/tests/TestSuite_ip_pipeline.py b/tests/TestSuite_ip_pipeline.py index 46fdc8d..90dba31 100644 --- a/tests/TestSuite_ip_pipeline.py +++ b/tests/TestSuite_ip_pipeline.py @@ -39,7 +39,7 @@ from scapy.utils import struct, socket, PcapWriter from settings import HEADER_SIZE from test_case import TestCase from time import sleep -import dts +import utils class TestIPPipeline(TestCase): @@ -304,7 +304,7 @@ class TestIPPipeline(TestCase): out = self.dut.build_dpdk_apps("./examples/ip_pipeline") self.verify("Error" not in out, "Compilation error") - self.ports_mask = dts.create_mask( + self.ports_mask = utils.create_mask( [self.dut_ports[0], self.dut_ports[1]]) self.coremask = "0x3e" # IP Pipeline app requires FIVE cores @@ -336,7 +336,7 @@ class TestIPPipeline(TestCase): for frames_number in TestIPPipeline.number_of_frames: for inter in TestIPPipeline.inter: - print dts.BLUE( + print utils.BLUE( "\tNumber of frames %d, interval %.1f" % (frames_number, inter)) stats = self.send_and_sniff_pcap_file(pcap_file, frames_number, @@ -370,7 +370,7 @@ class TestIPPipeline(TestCase): self.create_pcap_file(pcap_file, frame_size, 100, True) self.tester.session.copy_file_to(pcap_file) - print dts.BLUE("\tFrame size %d, interval %.1f" % (frame_size, + print utils.BLUE("\tFrame size %d, interval %.1f" % (frame_size, inter)) stats = self.send_and_sniff_pcap_file(pcap_file, frames_number, diff --git a/tests/TestSuite_ipfrag.py b/tests/TestSuite_ipfrag.py index c2623b6..b2684f1 100644 --- a/tests/TestSuite_ipfrag.py +++ b/tests/TestSuite_ipfrag.py @@ -34,7 +34,7 @@ DPDK Test suite. Test IPv4 fragmentation features in DPDK. """ -import dts +import utils import string import re import time @@ -127,8 +127,8 @@ l3fwd_ipv4_route_array[] = {\\\n" Perform functional fragmentation checks. """ - coremask = dts.create_mask(cores) - portmask = dts.create_mask([P0, P1]) + coremask = utils.create_mask(cores) + portmask = utils.create_mask([P0, P1]) numPortThread = len([P0, P1]) / len(cores) result = True errString = '' @@ -185,8 +185,8 @@ l3fwd_ipv4_route_array[] = {\\\n" """ Perform functional fragmentation checks. """ - coremask = dts.create_mask(cores) - portmask = dts.create_mask([P0, P1]) + coremask = utils.create_mask(cores) + portmask = utils.create_mask([P0, P1]) numPortThread = len([P0, P1]) / len(cores) result = True errString = '' @@ -308,11 +308,11 @@ l3fwd_ipv4_route_array[] = {\\\n" Pct = dict() if int(lcore[0]) == 1: - core_mask = dts.create_mask(self.dut.get_core_list(lcore, socket=self.ports_socket)) + core_mask = utils.create_mask(self.dut.get_core_list(lcore, socket=self.ports_socket)) else: - core_mask = dts.create_mask(self.dut.get_core_list(lcore)) + core_mask = utils.create_mask(self.dut.get_core_list(lcore)) - portmask = dts.create_mask([P0, P1]) + portmask = utils.create_mask([P0, P1]) self.dut.send_expect("examples/ip_fragmentation/build/ip_fragmentation -c %s -n %d -- -p %s -q %s" % ( core_mask, self.dut.get_memory_channels(), portmask, num_pthreads), "IP_FRAG:", 120) @@ -350,7 +350,7 @@ l3fwd_ipv4_route_array[] = {\\\n" result.append(Pps[str(size)]) result.append(Pct[str(size)]) - dts.results_table_add_row(result) + self.result_table_add(result) self.dut.send_expect("^C", "#") @@ -368,7 +368,7 @@ l3fwd_ipv4_route_array[] = {\\\n" tblheader.append("%dB Mpps" % size) tblheader.append("%d" % size) - dts.results_table_add_header(tblheader) + self.result_table_create(tblheader) lcores = [("1S/1C/1T", 2), ("1S/1C/2T", 2), ("1S/2C/1T", 2), ("2S/1C/1T", 2)] index = 1 @@ -376,7 +376,7 @@ l3fwd_ipv4_route_array[] = {\\\n" self.benchmark(index, lcore, numThr, sizes) index += 1 - dts.results_table_print() + self.result_table_print() self.tester.send_expect("ifconfig %s mtu 1500" % self.tester.get_interface(self.tester.get_local_port(P0)), "#") self.tester.send_expect("ifconfig %s mtu 1500" % self.tester.get_interface(self.tester.get_local_port(P1)), "#") diff --git a/tests/TestSuite_ipv4_reassembly.py b/tests/TestSuite_ipv4_reassembly.py index 7935478..a1e15a2 100644 --- a/tests/TestSuite_ipv4_reassembly.py +++ b/tests/TestSuite_ipv4_reassembly.py @@ -13,7 +13,7 @@ from scapy.utils import struct, socket, PcapWriter from scapy.layers.inet import Ether, IP, TCP, fragment from scapy.route import * -import dts +import utils from test_case import TestCase @@ -43,7 +43,7 @@ class IpReassemblyTestConfig(object): def cpu_config(self): self.core_list = self.test_case.dut.get_core_list('1S/1C/1T') - self.core_mask = dts.create_mask(self.core_list) + self.core_mask = utils.create_mask(self.core_list) self.memory_channels = self.test_case.dut.get_memory_channels() def ports_config(self): @@ -51,7 +51,7 @@ class IpReassemblyTestConfig(object): dut_port = dut_ports[0] tester_port = self.test_case.tester.get_local_port(dut_port) self.tester_iface = self.test_case.tester.get_interface(tester_port) - self.dut_port_mask = dts.create_mask([dut_port]) + self.dut_port_mask = utils.create_mask([dut_port]) self.queue_config = '({},{},{})'.format(dut_port, '0', self.core_list[0]) def example_app_config(self): diff --git a/tests/TestSuite_jumboframes.py b/tests/TestSuite_jumboframes.py index 95b2540..58f2e17 100644 --- a/tests/TestSuite_jumboframes.py +++ b/tests/TestSuite_jumboframes.py @@ -34,7 +34,7 @@ DPDK Test suite. Test the support of Jumbo Frames by Poll Mode Drivers """ -import dts +import utils import re from time import sleep from test_case import TestCase @@ -115,9 +115,9 @@ class TestJumboframes(TestCase): self.tx_port = self.dut_ports[0] cores = self.dut.get_core_list("1S/2C/1T") - self.coremask = dts.create_mask(cores) + self.coremask = utils.create_mask(cores) - self.port_mask = dts.create_mask([self.rx_port, self.tx_port]) + self.port_mask = utils.create_mask([self.rx_port, self.tx_port]) if self.kdriver == "fm10k": netobj = self.dut.ports_info[self.tx_port]['port'] @@ -158,7 +158,7 @@ class TestJumboframes(TestCase): """ # RRC has no ability to set the max pkt len to hardware if self.kdriver == "fm10k": - print dts.RED("fm10k not support this case\n") + print utils.RED("fm10k not support this case\n") return self.pmdout.start_testpmd("Default", "--max-pkt-len=%d --port-topology=loop" % (ETHER_STANDARD_MTU)) self.dut.send_expect("set fwd mac", "testpmd> ") diff --git a/tests/TestSuite_kni.py b/tests/TestSuite_kni.py index d1cd986..18bd768 100644 --- a/tests/TestSuite_kni.py +++ b/tests/TestSuite_kni.py @@ -36,7 +36,7 @@ DPDK Test suite. Test Kernel NIC Interface. """ -import dts +import utils import re import time from random import randint @@ -288,7 +288,7 @@ class TestKni(TestCase): self.dut.kill_all() out = self.dut.send_expect("rmmod rte_kni", "# ", 10) self.verify("in use" not in out, "Error unloading KNI module: " + out) - if dts.drivername == "igb_uio": + if self.drivername == "igb_uio": self.dut.send_expect("rmmod igb_uio", "# ", 5) self.dut.send_expect( 'insmod ./%s/kmod/igb_uio.ko' % (self.target), "# ", 20) @@ -298,8 +298,8 @@ class TestKni(TestCase): self.verify("Error" not in out, "Error loading KNI module: " + out) - port_mask = dts.create_mask(self.config['ports']) - core_mask = dts.create_mask( + port_mask = utils.create_mask(self.config['ports']) + core_mask = utils.create_mask( self.config['rx_cores'] + self.config['tx_cores'] + self.config['kernel_cores']) config_param = self.build_config_param() @@ -311,7 +311,7 @@ class TestKni(TestCase): time.sleep(5) if kthread_mode == 'single': - kthread_mask = dts.create_mask(self.config['kernel_cores']) + kthread_mask = utils.create_mask(self.config['kernel_cores']) out = self.dut.send_expect( "taskset -p %s `pgrep -fl kni_single | awk '{print $1}'`" % kthread_mask, "#") self.verify( @@ -438,7 +438,7 @@ class TestKni(TestCase): dut_ports = self.dut.get_ports(self.nic) self.dut.restore_interfaces() allPort = self.dut.ports_info - if dts.drivername in ["igb_uio"]: + if self.drivername in ["igb_uio"]: self.dut.send_expect( "insmod ./" + self.target + "/kmod/igb_uio.ko", "#") for port in range(0, len(allPort)): @@ -824,7 +824,7 @@ class TestKni(TestCase): for size in packet_sizes_loopback: header.append('%d (pps)' % size) - dts.results_table_add_header(header) + self.result_table_create(header) # Execute the permutations of the test for step in loopback_performance_steps: @@ -834,7 +834,7 @@ class TestKni(TestCase): total_cores = len(self.config['tx_cores'] + self.config[ 'rx_cores'] + self.config['kernel_cores']) if total_cores > self.dut_physical_cores(): - print dts.RED("Skiping step %s (%d cores needed, got %d)" % + print utils.RED("Skiping step %s (%d cores needed, got %d)" % (step['config'], total_cores, self.dut_physical_cores()) ) @@ -873,17 +873,17 @@ class TestKni(TestCase): ports_number = len(self.config['ports']) results_row = [step['lo_mode'], step['kthread_mode'], ports_number, self.stripped_config_param()] + pps_results - dts.results_table_add_row(results_row) + self.result_table_add(results_row) self.dut.kill_all() - dts.results_table_print() + self.result_table_print() def test_perf_bridge(self): """ KNI performance bridge mode. """ - dts.results_table_add_header(bridge_perf_results_header) + self.result_table_create(bridge_perf_results_header) self.tester.scapy_append('srcmac="00:00:00:00:00:01"') self.tester.scapy_append( @@ -897,7 +897,7 @@ class TestKni(TestCase): total_cores = len(self.config['tx_cores'] + self.config[ 'rx_cores'] + self.config['kernel_cores']) if total_cores > self.dut_physical_cores(): - print dts.RED("Skiping step %s (%d cores needed, got %d)" % + print utils.RED("Skiping step %s (%d cores needed, got %d)" % (step['config'], total_cores, self.dut_physical_cores()) ) @@ -943,18 +943,18 @@ class TestKni(TestCase): results_row = [step['kthread_mode'], step['flows'], self.stripped_config_param(), (float(pps) / 10 ** 6)] - dts.results_table_add_row(results_row) + self.result_table_add(results_row) self.dut.send_expect("ifconfig br_kni down", "# ") self.dut.send_expect("brctl delbr \"br_kni\"", "# ", 10) - dts.results_table_print() + self.result_table_print() def test_perf_bridge_without_kni(self): """ Bridge mode performance without KNI. """ - dts.results_table_add_header(bridge_perf_no_kni_results_header) + self.result_table_create(bridge_perf_no_kni_results_header) self.dut.kill_all() @@ -998,7 +998,7 @@ class TestKni(TestCase): tgenInput.append((rx_port, tx_port, "kni.pcap")) _, pps = self.tester.traffic_generator_throughput(tgenInput) - dts.results_table_add_row([flows, float(pps) / 10 ** 6]) + self.result_table_add([flows, float(pps) / 10 ** 6]) self.dut.send_expect("ifconfig br1 down", "# ") self.dut.send_expect("brctl delbr \"br1\"", "# ", 30) @@ -1006,7 +1006,7 @@ class TestKni(TestCase): for port in white_list: self.dut.send_expect( "./tools/dpdk-devbind.py -b igb_uio %s" % (port), "# ") - dts.results_table_print() + self.result_table_print() def test_perf_routing(self): """ @@ -1018,7 +1018,7 @@ class TestKni(TestCase): for size in packet_sizes_routing: header.append("%d Mpps" % size) - dts.results_table_add_header(header) + self.result_table_create(header) self.dut.send_expect("echo 1 > /proc/sys/net/ipv4/ip_forward", "# ") @@ -1103,9 +1103,9 @@ class TestKni(TestCase): _, pps = self.tester.traffic_generator_throughput(tgen_input) resutls_row.append(float(pps) / 10 ** 6) - dts.results_table_add_row(resutls_row) + self.result_table_add(resutls_row) - dts.results_table_print() + self.result_table_print() def test_perf_routing_without_kni(self): """ @@ -1117,7 +1117,7 @@ class TestKni(TestCase): for size in packet_sizes_routing: header.append("%d Mpps" % size) - dts.results_table_add_header(header) + self.result_table_create(header) self.dut.kill_all() self.dut.send_expect("rmmod rte_kni", "# ", 20) @@ -1176,7 +1176,7 @@ class TestKni(TestCase): # Get throughput with 1 port _, pps = self.tester.traffic_generator_throughput(tgen_input) one_port_resutls_row.append(float(pps) / 10 ** 6) - dts.results_table_add_row(one_port_resutls_row) + self.result_table_add(one_port_resutls_row) # Prepare test with 'ports_without_kni' ports self.tester.scapy_append('flows = []') @@ -1195,13 +1195,13 @@ class TestKni(TestCase): # Get throughput with 'ports_without_kni' ports _, pps = self.tester.traffic_generator_throughput(tgen_input) two_port_resutls_row.append(float(pps) / 10 ** 6) - dts.results_table_add_row(two_port_resutls_row) + self.result_table_add(two_port_resutls_row) - dts.results_table_print() + self.result_table_print() for port in white_list: self.dut.send_expect( - "./tools/dpdk-devbind.py -b %s %s" % (dts.drivername, port), "# ") + "./tools/dpdk-devbind.py -b %s %s" % (self.drivername, port), "# ") def tear_down(self): """ diff --git a/tests/TestSuite_l2fwd.py b/tests/TestSuite_l2fwd.py index 10a86ca..23815cd 100644 --- a/tests/TestSuite_l2fwd.py +++ b/tests/TestSuite_l2fwd.py @@ -34,7 +34,7 @@ DPDK Test suite. Test Layer-2 Forwarding support """ -import dts +import utils from test_case import TestCase from settings import HEADER_SIZE @@ -77,7 +77,7 @@ class TestL2fwd(TestCase): self.table_header.append("%d queues Mpps" % queue['queues']) self.table_header.append("% linerate") - dts.results_table_add_header(self.table_header) + self.result_table_create(self.table_header) def set_up(self): """ @@ -94,7 +94,7 @@ class TestL2fwd(TestCase): Check port forwarding. """ # the cases use the first two ports - port_mask = dts.create_mask([self.dut_ports[0], self.dut_ports[1]]) + port_mask = utils.create_mask([self.dut_ports[0], self.dut_ports[1]]) self.dut.send_expect("./examples/l2fwd/build/app/l2fwd -n 1 -c f -- -q 8 -p %s &" % port_mask, "L2FWD: entering main loop", 60) @@ -124,9 +124,9 @@ class TestL2fwd(TestCase): Check port forwarding. """ # the cases use the first two ports - port_mask = dts.create_mask([self.dut_ports[0], self.dut_ports[1]]) + port_mask = utils.create_mask([self.dut_ports[0], self.dut_ports[1]]) - core_mask = dts.create_mask(self.dut.get_core_list(self.core_config, + core_mask = utils.create_mask(self.dut.get_core_list(self.core_config, socket=self.ports_socket)) for queues in self.test_queues: @@ -154,8 +154,8 @@ class TestL2fwd(TestCase): for port in xrange(self.number_of_ports): ports.append(self.dut_ports[port]) - port_mask = dts.create_mask(ports) - core_mask = dts.create_mask(self.dut.get_core_list(self.core_config, + port_mask = utils.create_mask(ports) + core_mask = utils.create_mask(self.dut.get_core_list(self.core_config, socket=self.ports_socket)) for frame_size in self.frame_sizes: @@ -180,14 +180,15 @@ class TestL2fwd(TestCase): (self.dut.get_memory_channels(), core_mask, str(queues['queues']), port_mask) - self.dut.send_expect(command_line, "memory mapped", 60) +# self.dut.send_expect(command_line, "memory mapped", 60) + self.dut.send_expect(command_line, "L2FWD: entering main loop", 60) info = "Executing l2fwd using %s queues, frame size %d and %s setup.\n" % \ (queues['queues'], frame_size, self.core_config) self.logger.info(info) - dts.report(info, annex=True) - dts.report(command_line + "\n\n", frame=True, annex=True) + self.rst_report(info, annex=True) + self.rst_report(command_line + "\n\n", frame=True, annex=True) _, pps = self.tester.traffic_generator_throughput(tgen_input) Mpps = pps / 1000000.0 queues['Mpps'][frame_size] = Mpps @@ -212,9 +213,9 @@ class TestL2fwd(TestCase): results_row.append(queue['Mpps'][frame_size]) results_row.append(queue['pct'][frame_size]) - dts.results_table_add_row(results_row) + self.result_table_add(results_row) - dts.results_table_print() + self.result_table_print() def tear_down(self): """ diff --git a/tests/TestSuite_l3fwd.py b/tests/TestSuite_l3fwd.py index f6fce26..43af04d 100644 --- a/tests/TestSuite_l3fwd.py +++ b/tests/TestSuite_l3fwd.py @@ -34,14 +34,13 @@ DPDK Test suite. Layer-3 forwarding test script. """ -import dts +import utils import string import re from test_case import TestCase from exception import VerifyFailure from settings import HEADER_SIZE from etgen import IxiaPacketGenerator -from utils import * class TestL3fwd(TestCase,IxiaPacketGenerator): @@ -152,9 +151,9 @@ class TestL3fwd(TestCase,IxiaPacketGenerator): pat = re.compile("P([0123])") # Update config file and rebuild to get best perf on FVL - self.dut.send_expect("sed -i -e 's/CONFIG_RTE_PCI_CONFIG=n/CONFIG_RTE_PCI_CONFIG=y/' ./config/common_base", "#", 20) - self.dut.send_expect("sed -i -e 's/CONFIG_RTE_PCI_EXTENDED_TAG=.*$/CONFIG_RTE_PCI_EXTENDED_TAG=\"on\"/' ./config/common_base", "#", 20) - self.dut.build_install_dpdk(self.target) +# self.dut.send_expect("sed -i -e 's/CONFIG_RTE_PCI_CONFIG=n/CONFIG_RTE_PCI_CONFIG=y/' ./config/common_base", "#", 20) +# self.dut.send_expect("sed -i -e 's/CONFIG_RTE_PCI_EXTENDED_TAG=.*$/CONFIG_RTE_PCI_EXTENDED_TAG=\"on\"/' ./config/common_base", "#", 20) +# self.dut.build_install_dpdk(self.target) # Prepare long prefix match table, replace P(x) port pattern @@ -252,7 +251,7 @@ class TestL3fwd(TestCase,IxiaPacketGenerator): self.logger.debug("%s\n" % str(corelist)) - core_mask = dts.create_mask(set(corelist)) + core_mask = utils.create_mask(set(corelist)) # First, measure by two different methods for method in TestL3fwd.methods: @@ -260,11 +259,11 @@ class TestL3fwd(TestCase,IxiaPacketGenerator): method_command_line = command_line % (TestL3fwd.path + "l3fwd_" + method, core_mask, self.dut.get_memory_channels(), - dts.create_mask(valports[:4])) + utils.create_mask(valports[:4])) if frame_size > 1518: method_command_line = method_command_line + " --enable-jumbo --max-pkt-len %d" % frame_size - dts.report(method_command_line + "\n", frame=True, annex=True) + self.rst_report(method_command_line + "\n", frame=True, annex=True) out = self.dut.send_expect(method_command_line, "L3FWD:", 120) @@ -300,7 +299,7 @@ class TestL3fwd(TestCase,IxiaPacketGenerator): data_row.append(pct[method]) # generate report table - dts.results_table_add_row(data_row) + self.result_table_add(data_row) self.l3fwd_test_results['data'].append(data_row) def set_up(self): @@ -325,7 +324,7 @@ class TestL3fwd(TestCase,IxiaPacketGenerator): header_row.append('%s Mpps' % method) header_row.append('% linerate') - dts.results_table_add_header(header_row) + self.result_table_create(header_row) self.l3fwd_test_results['header'] = header_row self.l3fwd_test_results['data'] = [] @@ -342,9 +341,9 @@ class TestL3fwd(TestCase,IxiaPacketGenerator): self.tester.scapy_execute() - dts.report("Flows for 4 ports, %d frame size.\n" % (frame_size), + self.rst_report("Flows for 4 ports, %d frame size.\n" % (frame_size), annex=True) - dts.report("%s" % string.join(flows, '\n'), + self.rst_report("%s" % string.join(flows, '\n'), frame=True, annex=True) # Get the number of sockets of the board @@ -358,7 +357,7 @@ class TestL3fwd(TestCase,IxiaPacketGenerator): if number_sockets >= int(test_case[1].split('/')[0][0]): self.get_throughput(frame_size, *test_case) - dts.results_table_print() + self.result_table_print() def no_test_perf_l3fwd_2ports(self): """ @@ -367,7 +366,7 @@ class TestL3fwd(TestCase,IxiaPacketGenerator): header_row = ["Frame", "mode", "S/C/T", "Mpps", "% linerate", "latency_max(us)", "latency_min(us)", "latency_avg(us)"] self.l3fwd_test_results['header'] = header_row - dts.results_table_add_header(header_row) + self.result_table_create(header_row) self.l3fwd_test_results['data'] = [] for frame_size in TestL3fwd.frame_sizes: @@ -381,9 +380,9 @@ class TestL3fwd(TestCase,IxiaPacketGenerator): self.tester.scapy_append('wrpcap("dst%d.pcap", [%s])' %(valports[_port],string.join(flows,','))) self.tester.scapy_execute() - dts.report("Flows for 2 ports, %d frame size.\n" % (frame_size), + self.rst_report("Flows for 2 ports, %d frame size.\n" % (frame_size), annex=True) - dts.report("%s" % string.join(flows, '\n'), + self.rst_report("%s" % string.join(flows, '\n'), frame=True, annex=True) @@ -408,7 +407,7 @@ class TestL3fwd(TestCase,IxiaPacketGenerator): rtCmdLines[cmdline_pat[1]] = pat.sub(self.repl, rtCmdLines[cmdline_pat[1]]) self.logger.info("%s\n" % str(corelist)) - coreMask[cmdline_pat[1]] = dts.create_mask(set(corelist)) + coreMask[cmdline_pat[1]] = utils.create_mask(set(corelist)) # measure by two different mode for mode in TestL3fwd.methods: @@ -422,15 +421,15 @@ class TestL3fwd(TestCase,IxiaPacketGenerator): mode, cores, frame_size) self.logger.info(info) - dts.report(info, annex=True) + self.rst_report(info, annex=True) subtitle.append(cores) cmdline = rtCmdLines[cores] % (TestL3fwd.path + "l3fwd_" + mode, coreMask[cores], - self.dut.get_memory_channels(), dts.create_mask(valports[:2])) + self.dut.get_memory_channels(), utils.create_mask(valports[:2])) if frame_size > 1518: cmdline = cmdline + " --enable-jumbo --max-pkt-len %d" % frame_size - dts.report(cmdline + "\n", frame=True, annex=True) + self.rst_report(cmdline + "\n", frame=True, annex=True) out = self.dut.send_expect(cmdline, "L3FWD:", 120) @@ -463,10 +462,10 @@ class TestL3fwd(TestCase,IxiaPacketGenerator): for latency in latencys: data_row = [frame_size, mode, cores, str(pps), str(pct), str(latency['max']), str(latency['min']), str(latency['average'])] - dts.results_table_add_row(data_row) + self.result_table_add(data_row) self.l3fwd_test_results['data'].append(data_row) - dts.results_table_print() + self.result_table_print() def test_perf_rfc2544(self): @@ -474,7 +473,7 @@ class TestL3fwd(TestCase,IxiaPacketGenerator): ports_num = len(ports) header_row = ["Frame_size(byte)", "mode", "S/C/T", "zero_loss_throughput(Mpps)", " % zero_loss_rate"]# "LR_tx_pkts(1min)", "LR_rx_pkts(1min)", "LR_loss_pkts(1min)", "% zero_loss_rate", "zero_loss_throughput(Mpps)"] self.l3fwd_test_results['header'] = header_row - dts.results_table_add_header(header_row) + self.result_table_create(header_row) self.l3fwd_test_results['data'] = [] for frame_size in TestL3fwd.frame_sizes: @@ -488,9 +487,9 @@ class TestL3fwd(TestCase,IxiaPacketGenerator): self.tester.scapy_append('wrpcap("dst%d.pcap", [%s])' %(valports[_port],string.join(flows,','))) self.tester.scapy_execute() - dts.report("Flows for %d ports, %d frame size.\n" % (ports_num, frame_size), + self.rst_report("Flows for %d ports, %d frame size.\n" % (ports_num, frame_size), annex=True) - dts.report("%s" % string.join(flows, '\n'), + self.rst_report("%s" % string.join(flows, '\n'), frame=True, annex=True) # Prepare the command line @@ -523,7 +522,7 @@ class TestL3fwd(TestCase,IxiaPacketGenerator): rtCmdLines[cmdline_pat[1]] = pat.sub(self.repl, rtCmdLines[cmdline_pat[1]]) self.logger.info("%s\n" % str(corelist)) - coreMask[cmdline_pat[1]] = dts.create_mask(set(corelist)) + coreMask[cmdline_pat[1]] = utils.create_mask(set(corelist)) # measure by two different mode for mode in TestL3fwd.methods: @@ -539,15 +538,15 @@ class TestL3fwd(TestCase,IxiaPacketGenerator): mode, ports_num, cores, frame_size) self.logger.info(info) - dts.report(info, annex=True) + self.rst_report(info, annex=True) subtitle.append(cores) cmdline = rtCmdLines[cores] % (TestL3fwd.path + "l3fwd_" + mode, coreMask[cores], - self.dut.get_memory_channels(), dts.create_mask(valports[:ports_num])) + self.dut.get_memory_channels(), utils.create_mask(valports[:ports_num])) if frame_size > 1518: cmdline = cmdline + " --enable-jumbo --max-pkt-len %d" % frame_size - dts.report(cmdline + "\n", frame=True, annex=True) + self.rst_report(cmdline + "\n", frame=True, annex=True) out = self.dut.send_expect(cmdline, "L3FWD:", 120) @@ -578,14 +577,14 @@ class TestL3fwd(TestCase,IxiaPacketGenerator): #data_row = [frame_size, mode, cores, tx_pkts, rx_pkts, loss_pkts, zero_loss_rate, zero_loss_throughput] data_row = [frame_size, mode, cores, zero_loss_throughput, zero_loss_rate] - dts.results_table_add_row(data_row) + self.result_table_add(data_row) self.l3fwd_test_results['data'].append(data_row) else: pass index += 1 - dts.results_table_print() + self.result_table_print() def ip(self, port, frag, src, proto, tos, dst, chksum, len, options, version, flags, ihl, ttl, id): self.add_tcl_cmd("protocol config -name ip") diff --git a/tests/TestSuite_l3fwd_em.py b/tests/TestSuite_l3fwd_em.py index 18e48a8..c8f0b18 100644 --- a/tests/TestSuite_l3fwd_em.py +++ b/tests/TestSuite_l3fwd_em.py @@ -34,7 +34,7 @@ DPDK Test suite. Layer-3 forwarding exact-match test script. """ -import dts +import utils import string import re from test_case import TestCase @@ -157,7 +157,7 @@ class TestL3fwdEM(TestCase,IxiaPacketGenerator): header_row = ["Frame", "mode", "S/C/T", "Mpps", "% linerate"] self.l3fwd_test_results['header'] = header_row - dts.results_table_add_header(header_row) + self.result_table_create(header_row) self.l3fwd_test_results['data'] = [] for frame_size in TestL3fwdEM.frame_sizes: @@ -197,7 +197,7 @@ class TestL3fwdEM(TestCase,IxiaPacketGenerator): rtCmdLines[key] = pat.sub(self.repl, rtCmdLines[key]) self.logger.info("%s\n" % str(corelist)) - coreMask[key] = dts.create_mask(set(corelist)) + coreMask[key] = utils.create_mask(set(corelist)) # measure by two different mode for mode in TestL3fwdEM.methods: @@ -211,13 +211,13 @@ class TestL3fwdEM(TestCase,IxiaPacketGenerator): mode, cores, frame_size) self.logger.info(info) - dts.report(info, annex=True) + self.rst_report(info, annex=True) subtitle.append(cores) cmdline = rtCmdLines[cores] % (TestL3fwdEM.path + "l3fwd", coreMask[cores], - self.dut.get_memory_channels(), dts.create_mask(valports[:2])) + self.dut.get_memory_channels(), utils.create_mask(valports[:2])) - dts.report(cmdline + "\n", frame=True, annex=True) + self.rst_report(cmdline + "\n", frame=True, annex=True) out = self.dut.send_expect(cmdline, "L3FWD: entering main loop", 120) @@ -252,10 +252,10 @@ class TestL3fwdEM(TestCase,IxiaPacketGenerator): # Stop l3fwd self.dut.send_expect("^C", "#") data_row = [frame_size, mode, cores, str(pps), str(pct)] - dts.results_table_add_row(data_row) + self.result_table_add(data_row) self.l3fwd_test_results['data'].append(data_row) - dts.results_table_print() + self.result_table_print() def ip(self, port, frag, src, proto, tos, dst, chksum, len, options, version, flags, ihl, ttl, id): diff --git a/tests/TestSuite_link_flowctrl.py b/tests/TestSuite_link_flowctrl.py index 11c1795..d9bedc6 100644 --- a/tests/TestSuite_link_flowctrl.py +++ b/tests/TestSuite_link_flowctrl.py @@ -34,7 +34,7 @@ DPDK Test suite. Test for Ethernet Link Flow Control Features by Poll Mode Drivers """ -import dts +import utils import re from time import sleep @@ -72,7 +72,7 @@ class TestLinkFlowctrl(TestCase): self.tx_port = self.dutPorts[1] - self.portMask = dts.create_mask([self.rx_port, self.tx_port]) + self.portMask = utils.create_mask([self.rx_port, self.tx_port]) self.memChannels = self.dut.get_memory_channels() self.pmdout = PmdOutput(self.dut) diff --git a/tests/TestSuite_link_status_interrupt.py b/tests/TestSuite_link_status_interrupt.py index bf73ba4..b00fa88 100644 --- a/tests/TestSuite_link_status_interrupt.py +++ b/tests/TestSuite_link_status_interrupt.py @@ -12,7 +12,7 @@ Link Status Detection # is left here for legacy reasons. -import dts +import utils import re testPorts = [] @@ -95,17 +95,17 @@ class TestLinkStatusInterrupt(TestCase): """ memChannel = self.dut.get_memory_channels() - portMask = dts.create_mask(testPorts) - if dts.drivername in ["igb_uio"]: + portMask = utils.create_mask(testPorts) + if self.drivername in ["igb_uio"]: cmdline = "./examples/link_status_interrupt/build/link_status_interrupt -c f -n %s -- -q 2 -p %s" % ( memChannel, portMask) - elif dts.drivername in ["vfio-pci"]: + elif self.drivername in ["vfio-pci"]: cmdline = "./examples/link_status_interrupt/build/link_status_interrupt -c f -n %s --vfio-intr=intx -- -q 2 -p %s" % ( memChannel, portMask) else: print "unknow driver" for n in range(len(intr_mode)): - if dts.drivername in ["igb_uio"]: + if self.drivername in ["igb_uio"]: self.dut.send_expect("rmmod igb_uio", "# ") self.dut.send_expect( "insmod %s/kmod/igb_uio.ko %s" % (self.target, intr_mode[n]), "# ") @@ -131,17 +131,17 @@ class TestLinkStatusInterrupt(TestCase): """ memChannel = self.dut.get_memory_channels() - portMask = dts.create_mask(testPorts) - if dts.drivername in ["igb_uio"]: + portMask = utils.create_mask(testPorts) + if self.drivername in ["igb_uio"]: cmdline = "./examples/link_status_interrupt/build/link_status_interrupt -c f -n %s -- -q 2 -p %s" % ( memChannel, portMask) - elif dts.drivername in ["vfio-pci"]: + elif self.drivername in ["vfio-pci"]: cmdline = "./examples/link_status_interrupt/build/link_status_interrupt -c f -n %s --vfio-intr=intx -- -q 2 -p %s " % ( memChannel, portMask) else: print "unknow driver" for n in range(1, len(intr_mode)): - if dts.drivername in ["igb_uio"]: + if self.drivername in ["igb_uio"]: self.dut.send_expect("rmmod igb_uio", "# ") self.dut.send_expect( "insmod %s/kmod/igb_uio.ko %s" % (self.target, intr_mode[n]), "# ") @@ -178,7 +178,7 @@ class TestLinkStatusInterrupt(TestCase): """ Recovery. """ - if dts.drivername in ["igb_uio"]: + if self.drivername in ["igb_uio"]: self.dut.send_expect("^C", "# ") self.dut.send_expect("rmmod igb_uio", "# ") self.dut.send_expect( @@ -187,7 +187,7 @@ class TestLinkStatusInterrupt(TestCase): "dmesg -c | grep '\'", "# ") self.verify( 'Use MSIX interrupt by default' in out, "Fail to recovery default igb_uio") - elif dts.drivername in ["vfio-pci"]: + elif self.drivername in ["vfio-pci"]: self.verify(Ture, "not need run this case, when used vfio driver") else: print "unknow driver" diff --git a/tests/TestSuite_mac_filter.py b/tests/TestSuite_mac_filter.py index d3ef667..1c58b87 100644 --- a/tests/TestSuite_mac_filter.py +++ b/tests/TestSuite_mac_filter.py @@ -34,7 +34,7 @@ DPDK Test suite. Test the support of Whitelist Features by Poll Mode Drivers """ -import dts +import utils import time from test_case import TestCase from pmd_output import PmdOutput @@ -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[:1]) + portMask = utils.create_mask(self.dutPorts[:1]) self.pmdout = PmdOutput(self.dut) self.pmdout.start_testpmd("Default", "--portmask=%s" % portMask) @@ -68,11 +68,11 @@ class TestWhitelist(TestCase): self.dest = self.dut.get_mac_address(self.dutPorts[0]) mac_scanner = r"MAC address: (([\dA-F]{2}:){5}[\dA-F]{2})" - ret = dts.regexp(out, mac_scanner) + ret = utils.regexp(out, mac_scanner) self.verify(ret is not None, "MAC address not found") self.verify(cmp(ret.lower(), self.dest) == 0, "MAC address wrong") - self.max_mac_addr = dts.regexp(out, "Maximum number of MAC addresses: ([0-9]+)") + self.max_mac_addr = utils.regexp(out, "Maximum number of MAC addresses: ([0-9]+)") def set_up(self): """ @@ -103,12 +103,12 @@ class TestWhitelist(TestCase): self.dut.send_expect("clear port stats all", "testpmd> ") out = self.dut.send_expect("show port stats %d" % portid, "testpmd> ") - pre_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)") + pre_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)") # send one packet with the portid MAC address self.whitelist_send_packet(portid, self.dest) out = self.dut.send_expect("show port stats %d" % portid, "testpmd> ") - cur_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)") + cur_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)") # check the packet increase self.verify(int(cur_rxpkt) == int(pre_rxpkt) + self.frames_to_send, "Packet has not been received on default address") @@ -118,7 +118,7 @@ class TestWhitelist(TestCase): pre_rxpkt = cur_rxpkt out = self.dut.send_expect("show port stats %d" % portid, "testpmd> ") - cur_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)") + cur_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)") # check the packet DO NOT increase self.verify(int(cur_rxpkt) == int(pre_rxpkt), @@ -131,7 +131,7 @@ class TestWhitelist(TestCase): pre_rxpkt = cur_rxpkt out = self.dut.send_expect("show port stats %d" % portid, "testpmd> ") - cur_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)") + cur_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)") # check the packet increase self.verify(int(cur_rxpkt) == int(pre_rxpkt) + self.frames_to_send, @@ -145,7 +145,7 @@ class TestWhitelist(TestCase): pre_rxpkt = cur_rxpkt out = self.dut.send_expect("show port stats %d" % portid, "testpmd> ") - cur_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)") + cur_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)") # check the packet increase self.verify(int(cur_rxpkt) == int(pre_rxpkt), diff --git a/tests/TestSuite_multiprocess.py b/tests/TestSuite_multiprocess.py index 97d3092..b305437 100644 --- a/tests/TestSuite_multiprocess.py +++ b/tests/TestSuite_multiprocess.py @@ -34,7 +34,7 @@ DPDK Test suite. Multi-process Test. """ -import dts +import utils import time from etgen import IxiaPacketGenerator executions = [] @@ -84,7 +84,7 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator): """ # Send message from secondary to primary cores = self.dut.get_core_list('1S/2C/1T') - coremask = dts.create_mask(cores) + coremask = utils.create_mask(cores) self.dut.send_expect("./examples/multi_process/simple_mp/simple_mp/%s/simple_mp -n 1 -c %s --proc-type=primary" % (self.target, coremask), "Finished Process Init", 100) time.sleep(20) coremask = hex(int(coremask, 16) * 0x10000).rstrip("L") @@ -97,7 +97,7 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator): self.verify("Received 'hello_primary'" in out, "Message not received on primary process") # Send message from primary to secondary cores = self.dut.get_core_list('1S/2C/1T') - coremask = dts.create_mask(cores) + coremask = utils.create_mask(cores) self.session_secondary.send_expect("./examples/multi_process/simple_mp/simple_mp/%s/simple_mp -n 1 -c %s --proc-type=primary " % (self.target, coremask), "Finished Process Init", 100) time.sleep(20) coremask = hex(int(coremask, 16) * 0x10000).rstrip("L") @@ -116,7 +116,7 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator): """ cores = self.dut.get_core_list('1S/2C/1T') - coremask = dts.create_mask(cores) + coremask = utils.create_mask(cores) self.session_secondary.send_expect("./examples/multi_process/simple_mp/simple_mp/%s/simple_mp -n 1 -c %s --proc-type=primary" % (self.target, coremask), "Finished Process Init", 100) time.sleep(20) coremask = hex(int(coremask, 16) * 0x10000).rstrip("L") @@ -140,7 +140,7 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator): # Send message from secondary to primary (auto process type) cores = self.dut.get_core_list('1S/2C/1T') - coremask = dts.create_mask(cores) + coremask = utils.create_mask(cores) out = self.dut.send_expect("./examples/multi_process/simple_mp/simple_mp/%s/simple_mp -n 1 -c %s --proc-type=auto " % (self.target, coremask), "Finished Process Init", 100) self.verify("EAL: Auto-detected process type: PRIMARY" in out, "The type of process (PRIMARY) was not detected properly") time.sleep(20) @@ -157,7 +157,7 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator): # Send message from primary to secondary (auto process type) cores = self.dut.get_core_list('1S/2C/1T') - coremask = dts.create_mask(cores) + coremask = utils.create_mask(cores) out = self.session_secondary.send_expect("./examples/multi_process/simple_mp/simple_mp/%s/simple_mp -n 1 -c %s --proc-type=auto" % (self.target, coremask), "Finished Process Init", 100) self.verify("EAL: Auto-detected process type: PRIMARY" in out, "The type of process (PRIMARY) was not detected properly") time.sleep(20) @@ -178,7 +178,7 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator): """ cores = self.dut.get_core_list('1S/2C/1T') - coremask = dts.create_mask(cores) + coremask = utils.create_mask(cores) self.session_secondary.send_expect("./examples/multi_process/simple_mp/simple_mp/%s/simple_mp -n 1 -c %s -m 64" % (self.target, coremask), "Finished Process Init", 100) coremask = hex(int(coremask, 16) * 0x10000).rstrip("L") out = self.dut.send_expect("./examples/multi_process/simple_mp/simple_mp/%s/simple_mp -n 1 -c %s" % (self.target, coremask), "# ", 100) @@ -216,15 +216,15 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator): for execution in validExecutions: coreList = self.dut.get_core_list(execution['cores']) - coreMask = dts.create_mask(self.dut.get_core_list('1S/1C/1T')) - portMask = dts.create_mask([dutPorts[0], dutPorts[1]]) + coreMask = utils.create_mask(self.dut.get_core_list('1S/1C/1T')) + portMask = utils.create_mask([dutPorts[0], dutPorts[1]]) self.dut.send_expect("./examples/multi_process/client_server_mp/mp_server/client_server_mp/mp_server/%s/mp_server -n %d -c %s -- -p %s -n %d" % (self.target, self.dut.get_memory_channels(), "0xA0", portMask, execution['nprocs']), "Finished Process Init", 20) self.dut.send_expect("^Z", "\r\n") self.dut.send_expect("bg", "# ") for n in range(execution['nprocs']): time.sleep(5) - coreMask = dts.create_mask([coreList[n]]) + coreMask = utils.create_mask([coreList[n]]) self.dut.send_expect("./examples/multi_process/client_server_mp/mp_client/client_server_mp/mp_client/%s/mp_client -n %d -c %s --proc-type=secondary -- -n %d" % (self.target, self.dut.get_memory_channels(), coreMask, n), "Finished Process Init") self.dut.send_expect("^Z", "\r\n") self.dut.send_expect("bg", "# ") @@ -239,12 +239,12 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator): for n in range(len(executions)): self.verify(executions[n]['pps'] is not 0, "No traffic detected") - dts.results_table_add_header(['Server threads', 'Server Cores/Threads', 'Num-procs', 'Sockets/Cores/Threads', 'Num Ports', 'Frame Size', '%-age Line Rate', 'Packet Rate(mpps)']) + self.result_table_create(['Server threads', 'Server Cores/Threads', 'Num-procs', 'Sockets/Cores/Threads', 'Num Ports', 'Frame Size', '%-age Line Rate', 'Packet Rate(mpps)']) for execution in validExecutions: - dts.results_table_add_row([1, '1S/1C/1T', execution['nprocs'], execution['cores'], 2, 64, execution['pps'] / float(100000000 / (8 * 84)), execution['pps'] / float(1000000)]) + self.result_table_add([1, '1S/1C/1T', execution['nprocs'], execution['cores'], 2, 64, execution['pps'] / float(100000000 / (8 * 84)), execution['pps'] / float(1000000)]) - dts.results_table_print() + self.result_table_print() def ip(self, port, frag, src, proto, tos, dst, chksum, len, options, version, flags, ihl, ttl, id): self.add_tcl_cmd("protocol config -name ip") diff --git a/tests/TestSuite_netmap_compat.py b/tests/TestSuite_netmap_compat.py index 0787136..5225a27 100644 --- a/tests/TestSuite_netmap_compat.py +++ b/tests/TestSuite_netmap_compat.py @@ -35,7 +35,7 @@ DPDK Test suite. Test Netmap_compat. """ -import dts +import utils import string import time import re @@ -54,7 +54,7 @@ class TestNetmapCompat(TestCase): self.dut_ports = self.dut.get_ports(self.nic) self.verify(len(self.dut_ports) >= 2, "Insufficient ports") cores = self.dut.get_core_list("1S/4C/1T") - self.coremask = dts.create_mask(cores) + self.coremask = utils.create_mask(cores) self.path = "./examples/netmap_compat/build/bridge" diff --git a/tests/TestSuite_nvgre.py b/tests/TestSuite_nvgre.py index 1da551b..8397f66 100644 --- a/tests/TestSuite_nvgre.py +++ b/tests/TestSuite_nvgre.py @@ -5,7 +5,7 @@ Test NVGRE features in DPDK. """ -import dts +import utils import string import re import time @@ -352,16 +352,16 @@ class TestNvgre(TestCase): self.verify(self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortpark_TLV", "sageville", "sagepond"], "NVGRE Only supported by Fortville and Sageville") # Based on h/w type, choose how many ports to use ports = self.dut.get_ports(self.nic) - self.portmask = dts.create_mask(self.dut.get_ports(self.nic)) + self.portmask = utils.create_mask(self.dut.get_ports(self.nic)) # Verify that enough ports are available self.verify(len(ports) >= 2, "Insufficient ports for testing") # Verify that enough threads are available - self.all_cores_mask = dts.create_mask(self.dut.get_core_list("all")) + self.all_cores_mask = utils.create_mask(self.dut.get_core_list("all")) cores = self.dut.get_core_list("1S/5C/1T") self.verify(cores is not None, "Insufficient cores for speed testing") - self.coremask = dts.create_mask(cores) + self.coremask = utils.create_mask(cores) # start testpmd self.pmdout = PmdOutput(self.dut) @@ -703,9 +703,9 @@ class TestNvgre(TestCase): self.nvgre_checksum(outer_vlan=1, inner_l4_invalid=1, inner_l4_type='SCTP') def test_perf_nvgre_tunnelfilter_performance_2ports(self): - dts.results_table_add_header(self.tunnel_header) + self.result_table_create(self.tunnel_header) core_list = self.dut.get_core_list('1S/%dC/1T' % (self.tunnel_multiqueue * 2), socket=self.ports_socket) - core_mask = dts.create_mask(core_list) + core_mask = utils.create_mask(core_list) command_line = "./%s/app/testpmd -c %s -n %d -- -i --disable-rss --coremask=%s --rxq=4 --txq=4 --portmask=%s" % (self.target, self.all_cores_mask, @@ -787,9 +787,9 @@ class TestNvgre(TestCase): perf_config['recvqueue'], perf_config['Mpps'], perf_config['pct']] - dts.results_table_add_row(table_row) + self.result_table_add(table_row) - dts.results_table_print() + self.result_table_print() def test_perf_nvgre_checksum_performance_2ports(self): config = NvgreTestConfig(self) @@ -809,7 +809,7 @@ class TestNvgre(TestCase): self.tester.get_local_port(self.dut_port), "nvgre.pcap")) - all_cores_mask = dts.create_mask(self.dut.get_core_list("all")) + all_cores_mask = utils.create_mask(self.dut.get_core_list("all")) # socket/core/thread for test_cycle in self.test_cycles: @@ -822,7 +822,7 @@ class TestNvgre(TestCase): else: core_list = self.dut.get_core_list(core_config) - core_mask = dts.create_mask(core_list) + core_mask = utils.create_mask(core_list) command_line = "./%s/app/testpmd -c %s -n %d -- -i \ --disable-rss --coremask=%s --portmask=%s" % (self.target, @@ -852,7 +852,7 @@ class TestNvgre(TestCase): self.dut.send_expect("quit", "# ", 10) - dts.results_table_add_header(self.table_header) + self.result_table_create(self.table_header) # save the results for cal in self.cal_type: @@ -861,9 +861,9 @@ class TestNvgre(TestCase): table_row.append(test_cycle['Mpps'][cal['Type']]) table_row.append(test_cycle['pct'][cal['Type']]) - dts.results_table_add_row(table_row) + self.result_table_add(table_row) - dts.results_table_print() + self.result_table_print() def set_up(self): """ diff --git a/tests/TestSuite_pmd.py b/tests/TestSuite_pmd.py index d078487..7b9e6b5 100644 --- a/tests/TestSuite_pmd.py +++ b/tests/TestSuite_pmd.py @@ -34,7 +34,7 @@ DPDK Test suite. Test userland 10Gb PMD """ -import dts +import utils import re import time from test_case import TestCase @@ -88,7 +88,7 @@ class TestPmd(TestCase,IxiaPacketGenerator): """ PMD Performance Benchmarking with 4 ports. """ - all_cores_mask = dts.create_mask(self.dut.get_core_list("all")) + all_cores_mask = utils.create_mask(self.dut.get_core_list("all")) # prepare traffic generator input self.verify(len(self.dut_ports) >= 4, @@ -120,17 +120,17 @@ class TestPmd(TestCase,IxiaPacketGenerator): else: queues = 1 - core_mask = dts.create_mask(core_list) - port_mask = dts.create_mask(self.dut.get_ports()) + core_mask = utils.create_mask(core_list) + port_mask = utils.create_mask(self.dut.get_ports()) self.pmdout.start_testpmd(core_config, " --rxq=%d --txq=%d --portmask=%s --rss-ip --txrst=32 --txfreet=32 --txd=128 --txqflags=0xf01" % (queues, queues, port_mask), socket=self.ports_socket) command_line = self.pmdout.get_pmd_cmd() info = "Executing PMD (mac fwd) using %s\n" % test_cycle['cores'] - dts.report(info, annex=True) + self.rst_report(info, annex=True) self.logger.info(info) - dts.report(command_line + "\n\n", frame=True, annex=True) + self.rst_report(command_line + "\n\n", frame=True, annex=True) # self.dut.send_expect("set fwd mac", "testpmd> ", 100) self.dut.send_expect("start", "testpmd> ") @@ -162,7 +162,7 @@ class TestPmd(TestCase,IxiaPacketGenerator): frame_size] is not 0, "No traffic detected") # Print results - dts.results_table_add_header(self.table_header) + self.result_table_create(self.table_header) for frame_size in self.frame_sizes: table_row = [frame_size] @@ -172,16 +172,16 @@ class TestPmd(TestCase,IxiaPacketGenerator): table_row.append(test_cycle['Mpps'][frame_size]) table_row.append(test_cycle['pct'][frame_size]) - dts.results_table_add_row(table_row) + self.result_table_add(table_row) - dts.results_table_print() + self.result_table_print() def test_perf_pmd_performance_2ports(self): """ PMD Performance Benchmarking with 2 ports. """ - all_cores_mask = dts.create_mask(self.dut.get_core_list("all")) + all_cores_mask = utils.create_mask(self.dut.get_core_list("all")) # prepare traffic generator input tgen_input = [] @@ -204,8 +204,8 @@ class TestPmd(TestCase,IxiaPacketGenerator): else: queues = 1 - core_mask = dts.create_mask(core_list) - port_mask = dts.create_mask([self.dut_ports[0], self.dut_ports[1]]) + core_mask = utils.create_mask(core_list) + port_mask = utils.create_mask([self.dut_ports[0], self.dut_ports[1]]) #self.pmdout.start_testpmd("all", "--coremask=%s --rxq=%d --txq=%d --portmask=%s" % (core_mask, queues, queues, port_mask)) self.pmdout.start_testpmd(core_config, " --rxq=%d --txq=%d --portmask=%s --rss-ip --txrst=32 --txfreet=32 --txd=128" % (queues, queues, port_mask), socket=self.ports_socket) @@ -213,8 +213,8 @@ class TestPmd(TestCase,IxiaPacketGenerator): info = "Executing PMD using %s\n" % test_cycle['cores'] self.logger.info(info) - dts.report(info, annex=True) - dts.report(command_line + "\n\n", frame=True, annex=True) + self.rst_report(info, annex=True) + self.rst_report(command_line + "\n\n", frame=True, annex=True) self.dut.send_expect("start", "testpmd> ") for frame_size in self.frame_sizes: @@ -244,7 +244,7 @@ class TestPmd(TestCase,IxiaPacketGenerator): frame_size] > 0, "No traffic detected") # Print results - dts.results_table_add_header(self.table_header) + self.result_table_create(self.table_header) for frame_size in self.frame_sizes: table_row = [frame_size] for test_cycle in self.test_cycles: @@ -252,9 +252,9 @@ class TestPmd(TestCase,IxiaPacketGenerator): table_row.append(test_cycle['Mpps'][frame_size]) table_row.append(test_cycle['pct'][frame_size]) - dts.results_table_add_row(table_row) + self.result_table_add(table_row) - dts.results_table_print() + self.result_table_print() def test_checksum_checking(self): """ @@ -263,7 +263,7 @@ class TestPmd(TestCase,IxiaPacketGenerator): self.dut.kill_all() - port_mask = dts.create_mask([self.dut_ports[0], self.dut_ports[1]]) + port_mask = utils.create_mask([self.dut_ports[0], self.dut_ports[1]]) for rxfreet_value in self.rxfreet_values: @@ -290,7 +290,7 @@ class TestPmd(TestCase,IxiaPacketGenerator): self.dut.kill_all() - port_mask = dts.create_mask([self.dut_ports[0], self.dut_ports[1]]) + port_mask = utils.create_mask([self.dut_ports[0], self.dut_ports[1]]) self.pmdout.start_testpmd("1S/2C/1T", "--portmask=%s" % port_mask, socket=self.ports_socket) self.dut.send_expect("start", "testpmd> ") diff --git a/tests/TestSuite_pmd_bonded.py b/tests/TestSuite_pmd_bonded.py index fd15c1d..8b8b8ee 100644 --- a/tests/TestSuite_pmd_bonded.py +++ b/tests/TestSuite_pmd_bonded.py @@ -43,7 +43,7 @@ import random from socket import htons, htonl from functools import wraps -import dts +import utils from test_case import TestCase from exception import TimeoutException from settings import TIMEOUT @@ -498,7 +498,7 @@ UDP(sport=srcport, dport=destport)/Raw(load="\x50"*%s)], iface="%s", count=%d)' Add the ports into the bonding device as slaves. """ if len(slave_port) <= 0: - dts.RED("No port exist when add slave to bonded device") + utils.RED("No port exist when add slave to bonded device") for slave_id in slave_port: self.__send_expect("add bonding slave %d %d" % (slave_id, bond_port), "testpmd> ") @@ -515,7 +515,7 @@ UDP(sport=srcport, dport=destport)/Raw(load="\x50"*%s)], iface="%s", count=%d)' Remove the specified slave port from the bonding device. """ if len(slave_port) <= 0: - dts.RED("No port exist when remove slave from bonded device") + utils.RED("No port exist when remove slave from bonded device") for slave_id in slave_port: self.dut.send_expect("remove bonding slave %d %d" % (int(slave_id), bond_port), "testpmd> ") out = self.get_info_from_bond_config("Slaves: \[", "\d*( \d*)*", bond_port) @@ -794,13 +794,13 @@ UDP(sport=srcport, dport=destport)/Raw(load="\x50"*%s)], iface="%s", count=%d)' self.dut_ports = self.dut.get_ports() - self.port_mask = dts.create_mask(self.dut_ports) + self.port_mask = utils.create_mask(self.dut_ports) self.verify(len(self.dut_ports) >= 4, "Insufficient ports") self.ports_socket = self.dut.get_numa_id(self.dut_ports[0]) - self.all_cores_mask = dts.create_mask(self.dut.get_core_list("all")) + self.all_cores_mask = utils.create_mask(self.dut.get_core_list("all")) self.pmdout = PmdOutput(self.dut) diff --git a/tests/TestSuite_pmdpcap.py b/tests/TestSuite_pmdpcap.py index 41e2cfe..a080dd0 100644 --- a/tests/TestSuite_pmdpcap.py +++ b/tests/TestSuite_pmdpcap.py @@ -32,7 +32,7 @@ ''' ''' from test_case import TestCase -import dts +import utils from time import sleep from scapy.all import * @@ -116,7 +116,7 @@ class TestPmdPcap(TestCase): out_pcap = '/tmp/out_pmdpcap.pcap' two_cores = self.dut.get_core_list("1S/2C/1T") - core_mask = dts.create_mask(two_cores) + core_mask = utils.create_mask(two_cores) self.create_pcap_file(in_pcap, TestPmdPcap.pcap_file_sizes[0]) self.dut.session.copy_file_to(in_pcap) @@ -147,7 +147,7 @@ class TestPmdPcap(TestCase): out_pcap2 = '/tmp/out2_pmdpcap.pcap' four_cores = self.dut.get_core_list("1S/4C/1T") - core_mask = dts.create_mask(four_cores) + core_mask = utils.create_mask(four_cores) self.create_pcap_file(in_pcap1, TestPmdPcap.pcap_file_sizes[0]) self.dut.session.copy_file_to(in_pcap1) diff --git a/tests/TestSuite_pmdrss_hash.py b/tests/TestSuite_pmdrss_hash.py index 0cb703b..0bd6396 100644 --- a/tests/TestSuite_pmdrss_hash.py +++ b/tests/TestSuite_pmdrss_hash.py @@ -39,7 +39,7 @@ Support 4*10G, 1*40G and 2*40G NICs. import time import random import re -import dts +import utils testQueues = [16] reta_entries = [] @@ -184,7 +184,7 @@ class TestPmdrssHash(TestCase): global reta_lines global reta_num result = [] - dts.results_table_add_header( + self.result_table_create( ['packet index', 'hash value', 'hash index', 'queue id', 'actual queue id', 'pass ']) i = 0 @@ -200,11 +200,11 @@ class TestPmdrssHash(TestCase): else: status = "fail" result.insert(i, 1) - dts.results_table_add_row( + self.result_table_add( [i, tmp_reta_line["RSS hash"], hash_index, reta_entries[hash_index], tmp_reta_line["queue"], status]) i = i + 1 - dts.results_table_print() + self.result_table_print() reta_lines = [] self.verify(sum(result) == 0, "the reta update function failed!") @@ -384,7 +384,7 @@ class TestPmdrssHash(TestCase): global reta_lines global reta_num result = [] - dts.results_table_add_header( + self.result_table_create( ['packet index', 'RSS hash', 'hash index', 'queue id', 'actual queue id', 'pass ']) i = 0 @@ -402,11 +402,11 @@ class TestPmdrssHash(TestCase): result.insert((i - 1) / 2, 1) pre_RSS_hash = tmp_reta_line["RSS hash"] - dts.results_table_add_row( + self.result_table_add( [i, tmp_reta_line["RSS hash"], hash_index, reta_entries[hash_index], tmp_reta_line["queue"], status]) i = i + 1 - dts.results_table_print() + self.result_table_print() reta_lines = [] self.verify( sum(result) == 0, "the symmetric RSS hash function failed!") diff --git a/tests/TestSuite_pmdrssreta.py b/tests/TestSuite_pmdrssreta.py index 653f8c0..10af47f 100644 --- a/tests/TestSuite_pmdrssreta.py +++ b/tests/TestSuite_pmdrssreta.py @@ -36,7 +36,7 @@ Test RSS reta (redirection table) update function. import time import random import re -import dts +import utils testQueues = [16] reta_entries = [] reta_lines = [] @@ -142,7 +142,7 @@ class TestPmdrssreta(TestCase): global reta_lines result = [] - dts.results_table_add_header( + self.result_table_create( ['packet index', 'hash value', 'hash index', 'queue id', 'actual queue id', 'pass ']) i = 0 @@ -160,11 +160,11 @@ class TestPmdrssreta(TestCase): else: status = "fail" result.insert(i, 1) - dts.results_table_add_row( + self.result_table_add( [i, tmp_reta_line["RSS hash"], hash_index, reta_entries[hash_index], tmp_reta_line["queue"], status]) i = i + 1 - dts.results_table_print() + self.result_table_print() reta_lines = [] self.verify(sum(result) == 0, "the reta update function failed!") @@ -244,8 +244,8 @@ class TestPmdrssreta(TestCase): m = pattern.search(out) if m is not None: size = m.group(1) - print dts.GREEN("******************") - print dts.GREEN("NIC %s hash size %d and expected %d" % (self.nic, int(size), nic_rss_key_size[self.nic])) + print utils.GREEN("******************") + print utils.GREEN("NIC %s hash size %d and expected %d" % (self.nic, int(size), nic_rss_key_size[self.nic])) if (nic_rss_key_size[self.nic] == int(size)): self.verify(True, "pass") else: diff --git a/tests/TestSuite_queue_start_stop.py b/tests/TestSuite_queue_start_stop.py index 360ed85..d1df66b 100644 --- a/tests/TestSuite_queue_start_stop.py +++ b/tests/TestSuite_queue_start_stop.py @@ -38,7 +38,6 @@ Test queue start stop Feature """ -import dts import time import re import os diff --git a/tests/TestSuite_quota_watermark.py b/tests/TestSuite_quota_watermark.py index 6811714..94957e2 100644 --- a/tests/TestSuite_quota_watermark.py +++ b/tests/TestSuite_quota_watermark.py @@ -36,7 +36,7 @@ Quota & Watermark example app test cases. """ import time -import dts +import utils from test_case import TestCase from etgen import IxiaPacketGenerator from packet import Packet, sniff_packets, load_sniff_packets @@ -86,9 +86,9 @@ class TestQuotaWatermark(TestCase, IxiaPacketGenerator): """ Adds the table header and some info about the executed test """ - dts.report('Core mask: %s' % core_mask) - dts.report('Port mask: %s' % port_mask) - dts.results_table_add_header([ + self.rst_report('Core mask: %s' % core_mask) + self.rst_report('Port mask: %s' % port_mask) + self.result_table_create([ 'Ring size', 'Quota', 'Low water-mark', @@ -228,7 +228,7 @@ class TestQuotaWatermark(TestCase, IxiaPacketGenerator): ports_config['dut_rx'] = dut_rx_port ports_config['dut_tx'] = dut_tx_port ports_config[ - 'dut_port_mask'] = dts.create_mask([ports_config['dut_tx'], + 'dut_port_mask'] = utils.create_mask([ports_config['dut_tx'], ports_config['dut_rx']]) ports_config['tester_rx'] = self.tester.get_local_port( ports_config['dut_rx']) @@ -297,7 +297,7 @@ class TestQuotaWatermark(TestCase, IxiaPacketGenerator): self.num_of_frames = test_config['frames_to_sent'] test_stats = self.tester.traffic_generator_throughput(tgen_input) - dts.results_table_add_row([ring_size, quota, low_watermark, high_watermark] + + self.result_table_add([ring_size, quota, low_watermark, high_watermark] + test_stats) def check_packets_transfer(self, tx_port, rx_port, tgen_input, pkt_cnt=1): @@ -435,7 +435,7 @@ class TestQuotaWatermark(TestCase, IxiaPacketGenerator): cores_one_socket = self.dut.get_core_list('1S/4C/1T') core_config = { 'cores': cores_one_socket, - 'mask': dts.create_mask(cores_one_socket) + 'mask': utils.create_mask(cores_one_socket) } self.func_iterate_through_qw_ring_sizes(ports_config, core_config) @@ -453,13 +453,13 @@ class TestQuotaWatermark(TestCase, IxiaPacketGenerator): cores_one_socket = self.dut.get_core_list('1S/4C/1T') core_config = { 'cores': cores_one_socket, - 'mask': dts.create_mask(cores_one_socket) + 'mask': utils.create_mask(cores_one_socket) } self.add_report_headers( core_config['mask'], ports_config['dut_port_mask']) self.iterate_through_qw_ring_sizes(ports_config, core_config) - dts.results_table_print() + self.result_table_print() def test_perf_quota_watermark_two_sockets(self): """ @@ -474,9 +474,9 @@ class TestQuotaWatermark(TestCase, IxiaPacketGenerator): cores_two_sockets = self.dut.get_core_list('2S/4C/1T') core_config = { 'cores': cores_two_sockets, - 'mask': dts.create_mask(cores_two_sockets) + 'mask': utils.create_mask(cores_two_sockets) } self.add_report_headers( core_config['mask'], ports_config['dut_port_mask']) self.iterate_through_qw_ring_sizes(ports_config, core_config) - dts.results_table_print() + self.result_table_print() diff --git a/tests/TestSuite_rxtx_callbacks.py b/tests/TestSuite_rxtx_callbacks.py index e8446b7..be79e56 100644 --- a/tests/TestSuite_rxtx_callbacks.py +++ b/tests/TestSuite_rxtx_callbacks.py @@ -34,7 +34,7 @@ DPDK Test suite. Test Rxtx_Callbacks. """ -import dts +import utils import string import time from test_case import TestCase @@ -56,7 +56,7 @@ class TestRxtxCallbacks(TestCase): self.verify(len(self.dut_ports) >= 2, "Insufficient ports") cores = self.dut.get_core_list("1S/2C/1T") - self.coremask = dts.create_mask(cores) + utils.create_mask(cores) self.mac = self.dut.get_mac_address(self.dut_ports[0]) self.path = "./examples/rxtx_callbacks/build/rxtx_callbacks" diff --git a/tests/TestSuite_scatter.py b/tests/TestSuite_scatter.py index 9a3a10a..0f382b7 100644 --- a/tests/TestSuite_scatter.py +++ b/tests/TestSuite_scatter.py @@ -33,7 +33,6 @@ DPDK Test suite. Test Scattered Packets. """ -import dts from test_case import TestCase from pmd_output import PmdOutput from packet import Packet, sniff_packets, load_sniff_packets, strip_pktload diff --git a/tests/TestSuite_short_live.py b/tests/TestSuite_short_live.py index 15ba444..320951f 100644 --- a/tests/TestSuite_short_live.py +++ b/tests/TestSuite_short_live.py @@ -38,7 +38,6 @@ Test short live dpdk app Feature """ -import dts import time import re import os diff --git a/tests/TestSuite_shutdown_api.py b/tests/TestSuite_shutdown_api.py index f03734a..a195f9e 100644 --- a/tests/TestSuite_shutdown_api.py +++ b/tests/TestSuite_shutdown_api.py @@ -36,13 +36,14 @@ Test Shutdown API Feature """ -import dts +import utils import time import re import os from test_case import TestCase from pmd_output import PmdOutput from settings import HEADER_SIZE +from exception import VerifyFailure # # @@ -183,7 +184,7 @@ class TestShutdownApi(TestCase): """ Stop and Restar. """ - self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % dts.create_mask(self.ports), socket=self.ports_socket) + self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % utils.create_mask(self.ports), socket=self.ports_socket) self.dut.send_expect("set fwd mac", "testpmd>") self.dut.send_expect("start", "testpmd> ") @@ -204,7 +205,7 @@ class TestShutdownApi(TestCase): """ ports = [self.ports[0]] - portmask = dts.create_mask(ports) + portmask = utils.create_mask(ports) self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % portmask, socket = self.ports_socket) self.dut.send_expect("port stop all", "testpmd> ", 100) @@ -215,7 +216,7 @@ class TestShutdownApi(TestCase): try: self.check_forwarding(ports) - except dts.VerifyFailure as e: + except VerifyFailure as e: print 'promiscuous mode is working correctly' except Exception as e: print " !!! DEBUG IT: " + e.message @@ -238,8 +239,8 @@ class TestShutdownApi(TestCase): """ testcorelist = self.dut.get_core_list("1S/8C/1T", 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.pmdout.start_testpmd(testcorelist, "--portmask=%s --port-topology=loop" % utils.create_mask([self.ports[0]]), socket=self.ports_socket) + fwdcoremask = utils.create_mask(testcorelist[-3:]) self.dut.send_expect("port stop all", "testpmd> ", 100) self.dut.send_expect("port config all rxq 2", "testpmd> ") @@ -258,7 +259,7 @@ class TestShutdownApi(TestCase): """ Reconfigure All Ports With The Same Configurations (CRC) """ - self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % dts.create_mask(self.ports), socket=self.ports_socket) + self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % utils.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> ") @@ -276,10 +277,10 @@ class TestShutdownApi(TestCase): Change Link Speed. """ if self.kdriver == "fm10k": - print dts.RED("RRC not support\n") + print utils.RED("RRC not support\n") return - self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % dts.create_mask(self.ports), socket=self.ports_socket) + self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % utils.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])), "# ") @@ -322,11 +323,11 @@ class TestShutdownApi(TestCase): Enable/Disable Jumbo Frames. """ if self.kdriver == "fm10k": - print dts.RED("RRC not support\n") + print utils.RED("RRC not support\n") return jumbo_size = 2048 - self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % dts.create_mask(self.ports), socket=self.ports_socket) + self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % utils.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> ") @@ -365,7 +366,7 @@ class TestShutdownApi(TestCase): """ Enable/Disable RSS. """ - self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % dts.create_mask(self.ports), socket=self.ports_socket) + self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % utils.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> ") @@ -378,7 +379,7 @@ class TestShutdownApi(TestCase): """ Change numbers of rxd and txd. """ - self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % dts.create_mask(self.ports), socket=self.ports_socket) + self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % utils.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> ") @@ -397,7 +398,7 @@ class TestShutdownApi(TestCase): """ Change the Number of rxd/txd. """ - self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % dts.create_mask(self.ports), socket=self.ports_socket) + self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % utils.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> ") @@ -427,7 +428,7 @@ class TestShutdownApi(TestCase): """ Change RX/TX thresholds """ - self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % dts.create_mask(self.ports), socket=self.ports_socket) + self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % utils.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> ") @@ -463,7 +464,7 @@ class TestShutdownApi(TestCase): """ stress_iterations = 10 - self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % dts.create_mask(self.ports), socket=self.ports_socket) + self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % utils.create_mask(self.ports), socket=self.ports_socket) tgenInput = [] for port in self.ports: @@ -485,10 +486,10 @@ class TestShutdownApi(TestCase): port link stats test """ if self.kdriver == "fm10k": - print dts.RED("RRC not support\n") + print utils.RED("RRC not support\n") return - self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % dts.create_mask(self.ports), socket=self.ports_socket) + self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % utils.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_skeleton.py b/tests/TestSuite_skeleton.py index c6fc231..a5cc591 100644 --- a/tests/TestSuite_skeleton.py +++ b/tests/TestSuite_skeleton.py @@ -34,7 +34,7 @@ DPDK Test suite. Test Skeleton. """ -import dts +import utils import string import time from test_case import TestCase @@ -56,7 +56,7 @@ class TestSkeleton(TestCase): self.verify(len(self.dut_ports) >= 2, "Insufficient ports") cores = self.dut.get_core_list("1S/2C/1T") - self.coremask = dts.create_mask(cores) + self.coremask = utils.create_mask(cores) self.mac = self.dut.get_mac_address(self.dut_ports[0]) self.path = "./examples/skeleton/build/basicfwd" diff --git a/tests/TestSuite_sriov_kvm.py b/tests/TestSuite_sriov_kvm.py index cd3d9c3..41af4dd 100644 --- a/tests/TestSuite_sriov_kvm.py +++ b/tests/TestSuite_sriov_kvm.py @@ -12,7 +12,6 @@ import re import pdb import time -import dts from qemu_kvm import QEMUKvm from test_case import TestCase diff --git a/tests/TestSuite_sriov_live_migration.py b/tests/TestSuite_sriov_live_migration.py index 7a75c59..754ad2f 100644 --- a/tests/TestSuite_sriov_live_migration.py +++ b/tests/TestSuite_sriov_live_migration.py @@ -3,7 +3,7 @@ import re import time -import dts +import utils from qemu_kvm import QEMUKvm from test_case import TestCase from exception import VirtDutInitException @@ -268,12 +268,12 @@ class TestVhostUserLiveMigration(TestCase): if getattr(self, 'host_vf', None): self.duts[0].destroy_sriov_vfs_by_port(self.dut_port) - self.bind_nic_driver(self.duts[0], [self.dut_port], dts.drivername) + self.bind_nic_driver(self.duts[0], [self.dut_port], self.drivername) self.host_vf = None if getattr(self, 'backup_vf', None): self.duts[1].destroy_sriov_vfs_by_port(self.backup_port) - self.bind_nic_driver(self.duts[1], [self.backup_port], dts.drivername) + self.bind_nic_driver(self.duts[1], [self.backup_port], self.drivername) self.backup_vf= None # # after vm stopped, stop vhost-switch diff --git a/tests/TestSuite_timer.py b/tests/TestSuite_timer.py index 765770d..c6f2234 100644 --- a/tests/TestSuite_timer.py +++ b/tests/TestSuite_timer.py @@ -34,7 +34,7 @@ DPDK Test suite. Test Timer. """ -import dts +import utils import re import time @@ -69,7 +69,7 @@ class TestTimer(TestCase): # get the mask for the first core cores = self.dut.get_core_list('1S/1C/1T') - coreMask = dts.create_mask(cores) + coreMask = utils.create_mask(cores) # run timer on the background cmdline = "./examples/timer/build/app/timer -n 1 -c " + coreMask + " &" @@ -80,7 +80,7 @@ class TestTimer(TestCase): self.dut.send_expect("killall timer", "# ", 5) # verify timer0 - dts.regexp(out, r'timer0_cb\(\) on lcore (\d+)') + utils.regexp(out, r'timer0_cb\(\) on lcore (\d+)') pat = re.compile(r'timer0_cb\(\) on lcore (\d+)') match = pat.findall(out) self.verify(match or match[0] == 0, "timer0 error") diff --git a/tests/TestSuite_tso.py b/tests/TestSuite_tso.py index 32db524..00f7539 100644 --- a/tests/TestSuite_tso.py +++ b/tests/TestSuite_tso.py @@ -37,7 +37,7 @@ Tests for TSO. """ -import dts +import utils import time import re from test_case import TestCase @@ -65,8 +65,8 @@ class TestTSO(TestCase): self.verify(len(self.dut_ports) >= 2, "Insufficient ports for testing") # Verify that enough threads are available - self.all_cores_mask = dts.create_mask(self.dut.get_core_list("all")) - self.portMask = dts.create_mask([self.dut_ports[0], self.dut_ports[1]]) + self.all_cores_mask = utils.create_mask(self.dut.get_core_list("all")) + self.portMask = utils.create_mask([self.dut_ports[0], self.dut_ports[1]]) self.ports_socket = self.dut.get_numa_id(self.dut_ports[0]) self.frame_sizes = [128, 1458] @@ -87,7 +87,7 @@ class TestTSO(TestCase): self.blacklist = "" - # self.coreMask = dts.create_mask(cores) + # self.coreMask = utils.create_mask(cores) self.headers_size = HEADER_SIZE['eth'] + HEADER_SIZE[ 'ip'] + HEADER_SIZE['tcp'] @@ -150,7 +150,7 @@ class TestTSO(TestCase): mac = self.dut.get_mac_address(self.dut_ports[0]) cores = self.dut.get_core_list("1S/2C/2T") self.verify(cores is not None, "Insufficient cores for speed testing") - self.coreMask = dts.create_mask(cores) + self.coreMask = utils.create_mask(cores) padding = self.frame_sizes[0] - self.headers_size @@ -216,7 +216,7 @@ class TestTSO(TestCase): cores = self.dut.get_core_list("1S/2C/2T") self.verify(cores is not None, "Insufficient cores for speed testing") - self.coreMask = dts.create_mask(cores) + self.coreMask = utils.create_mask(cores) padding = self.frame_sizes[0] - self.headers_size @@ -281,7 +281,7 @@ class TestTSO(TestCase): for test_cycle in self.test_cycles: core_config = test_cycle['cores'] cores = self.dut.get_core_list(core_config, socket=self.ports_socket) - self.coreMask = dts.create_mask(cores) + self.coreMask = utils.create_mask(cores) if len(cores) > 2: queues = len(cores) / 2 else: @@ -291,8 +291,8 @@ class TestTSO(TestCase): info = "Executing PMD using %s\n" % test_cycle['cores'] self.logger.info(info) - dts.report(info, annex=True) - dts.report(command_line + "\n\n", frame=True, annex=True) + self.rst_report(info, annex=True) + self.rst_report(command_line + "\n\n", frame=True, annex=True) self.dut.send_expect(command_line, "testpmd> ", 120) self.dut.send_expect("csum set ip hw %d" % self.dut_ports[0], "testpmd> ", 120) @@ -340,13 +340,13 @@ class TestTSO(TestCase): frame_size] > 0, "No traffic detected") # Print results - dts.results_table_add_header(self.table_header) + self.result_table_create(self.table_header) for frame_size in self.frame_sizes: table_row = [frame_size] for test_cycle in self.test_cycles: table_row.append(test_cycle['Mpps'][frame_size]) table_row.append(test_cycle['pct'][frame_size]) - dts.results_table_add_row(table_row) + self.result_table_add(table_row) - dts.results_table_print() + self.result_table_print() diff --git a/tests/TestSuite_uni_pkt.py b/tests/TestSuite_uni_pkt.py index 429546a..22ae9c7 100644 --- a/tests/TestSuite_uni_pkt.py +++ b/tests/TestSuite_uni_pkt.py @@ -43,7 +43,7 @@ translate the offloaded packet types into these 7 fields of information, for user applications """ -import dts +import utils from test_case import TestCase from exception import VerifyFailure from packet import Packet @@ -85,9 +85,9 @@ class TestUniPacket(TestCase): out = self.dut.get_session_output(timeout=2) for pkt_layer_name in pkt_names: if pkt_layer_name not in out: - print dts.RED("Fail to detect %s" % pkt_layer_name) + print utils.RED("Fail to detect %s" % pkt_layer_name) raise VerifyFailure("Failed to detect %s" % pkt_layer_name) - print dts.GREEN("Detected %s successfully" % pkt_type) + print utils.GREEN("Detected %s successfully" % pkt_type) def test_l2pkt_detect(self): """ @@ -107,7 +107,7 @@ class TestUniPacket(TestCase): pkt.send_pkt(tx_port=self.tester_iface) out = self.dut.get_session_output(timeout=2) if pkt_name in out: - print dts.GREEN("Detected L2 %s successfully" % l2_type) + print utils.GREEN("Detected L2 %s successfully" % l2_type) else: raise VerifyFailure("Failed to detect L2 %s" % l2_type) diff --git a/tests/TestSuite_unit_tests_eal.py b/tests/TestSuite_unit_tests_eal.py index 663e961..e8ea20b 100644 --- a/tests/TestSuite_unit_tests_eal.py +++ b/tests/TestSuite_unit_tests_eal.py @@ -7,7 +7,7 @@ EAL autotest. """ -import dts +import utils from test_case import TestCase @@ -185,7 +185,7 @@ class TestUnitTestsEal(TestCase): self.dut.send_expect("./app/test/test -n 1 -c ffff", "R.*T.*E.*>.*>", self.start_test_time) out = self.dut.send_expect('memory_autotest', "RTE>>", self.run_cmd_time * 5) regexp = "phys:0x[0-9a-f]*, len:([0-9a-f]*), virt:0x[0-9a-f]*, socket_id:[0-9]*" - match = dts.regexp(out, regexp) + match = utils.regexp(out, regexp) size = int(match, 16) self.verify(size > 0, "bad size") self.dut.send_expect("quit", "# ") diff --git a/tests/TestSuite_unit_tests_pmd_perf.py b/tests/TestSuite_unit_tests_pmd_perf.py index 3be47f9..695c8de 100644 --- a/tests/TestSuite_unit_tests_pmd_perf.py +++ b/tests/TestSuite_unit_tests_pmd_perf.py @@ -35,7 +35,7 @@ DPDK Test suite. This TestSuite runs the unit tests included in DPDK for pmd performance. """ -import dts +import utils import re from test_case import TestCase @@ -108,7 +108,7 @@ class TestUnitTestsPmdPerf(TestCase): self.table_header = ['Mode'] self.table_header += self.anchors - dts.results_table_add_header(self.table_header) + self.result_table_create(self.table_header) print self.table_header for mode in self.rxtx_modes: @@ -129,9 +129,9 @@ class TestUnitTestsPmdPerf(TestCase): table_row.append(result.group(1)) self.dut.send_expect("quit", "# ") - dts.results_table_add_row(table_row) + self.result_table_add(table_row) - dts.results_table_print() + self.result_table_print() def tear_down(self): """ diff --git a/tests/TestSuite_userspace_ethtool.py b/tests/TestSuite_userspace_ethtool.py index 2346e3b..ced7e96 100644 --- a/tests/TestSuite_userspace_ethtool.py +++ b/tests/TestSuite_userspace_ethtool.py @@ -35,7 +35,7 @@ Test support of userspace ethtool feature """ import os -import dts +import utils import time import re from test_case import TestCase @@ -170,7 +170,7 @@ class TestUserspaceEthtool(TestCase, IxiaPacketGenerator): port = m.group(1) driver = m.group(2) version = m.group(3) - print dts.GREEN("Detect port %s with %s driver\n" % (port, driver)) + print utils.GREEN("Detect port %s with %s driver\n" % (port, driver)) # ethtool doesn't support port disconnect by tools of linux # only detect physical link disconnect status @@ -296,8 +296,8 @@ class TestUserspaceEthtool(TestCase, IxiaPacketGenerator): md5 = self.strip_md5(portsinfo[index]['eeprom_file']) self.resize_linux_eeprom_file( portsinfo[index]['eeprom_file'], portsinfo[index]['ethtool_eeprom']) md5_ref = self.strip_md5(portsinfo[index]['ethtool_eeprom']) - print dts.GREEN("Reference eeprom md5 %s" % md5) - print dts.GREEN("Reference eeprom md5_ref %s" % md5_ref) + print utils.GREEN("Reference eeprom md5 %s" % md5) + print utils.GREEN("Reference eeprom md5_ref %s" % md5_ref) self.verify(md5 == md5_ref, "Dumped eeprom not same as linux dumped") def test_ring_parameter(self): diff --git a/tests/TestSuite_vf_jumboframe.py b/tests/TestSuite_vf_jumboframe.py index bac4a29..d32990a 100644 --- a/tests/TestSuite_vf_jumboframe.py +++ b/tests/TestSuite_vf_jumboframe.py @@ -3,7 +3,7 @@ import re import time -import dts +import utils from qemu_kvm import QEMUKvm from test_case import TestCase from pmd_output import PmdOutput @@ -29,7 +29,7 @@ class TestVfJumboFrame(TestCase): self.port = self.dut_ports[0] self.vm_port = 0 cores = self.dut.get_core_list("1S/1C/1T") - self.port_mask = dts.create_mask([self.port]) + self.port_mask = utils.create_mask([self.port]) # enable tester mtu tester_port = self.tester.get_local_port(self.port) diff --git a/tests/TestSuite_vf_macfilter.py b/tests/TestSuite_vf_macfilter.py index 061f7ab..1fce394 100644 --- a/tests/TestSuite_vf_macfilter.py +++ b/tests/TestSuite_vf_macfilter.py @@ -3,7 +3,6 @@ import re import time -import dts from qemu_kvm import QEMUKvm from test_case import TestCase from pmd_output import PmdOutput diff --git a/tests/TestSuite_vf_offload.py b/tests/TestSuite_vf_offload.py index 78fa5a6..6a4ab52 100644 --- a/tests/TestSuite_vf_offload.py +++ b/tests/TestSuite_vf_offload.py @@ -3,7 +3,7 @@ import re import time -import dts +import utils from qemu_kvm import QEMUKvm from test_case import TestCase from pmd_output import PmdOutput @@ -23,7 +23,7 @@ class TestVfOffload(TestCase): self.setup_2pf_2vf_1vm_env_flag = 0 self.setup_2pf_2vf_1vm_env(driver='') self.vm0_dut_ports = self.vm_dut_0.get_ports('any') - self.portMask = dts.create_mask([self.vm0_dut_ports[0]]) + self.portMask = utils.create_mask([self.vm0_dut_ports[0]]) self.vm0_testpmd = PmdOutput(self.vm_dut_0) def set_up(self): @@ -329,7 +329,7 @@ class TestVfOffload(TestCase): self.tester.send_expect("ethtool -K %s rx off tx off tso off gso off gro off lro off" % tx_interface, "# ") self.tester.send_expect("ip l set %s up" % tx_interface, "# ") - self.portMask = dts.create_mask([self.vm0_dut_ports[0]]) + self.portMask = utils.create_mask([self.vm0_dut_ports[0]]) self.vm0_testpmd.start_testpmd(VM_CORES_MASK, "--portmask=%s " % (self.portMask) + "--enable-rx-cksum " + "--txqflags=0 " + diff --git a/tests/TestSuite_vf_packet_rxtx.py b/tests/TestSuite_vf_packet_rxtx.py index 2f9dfc1..25b03eb 100644 --- a/tests/TestSuite_vf_packet_rxtx.py +++ b/tests/TestSuite_vf_packet_rxtx.py @@ -3,7 +3,6 @@ import re import time -import dts from qemu_kvm import QEMUKvm from test_case import TestCase from pmd_output import PmdOutput diff --git a/tests/TestSuite_vf_port_start_stop.py b/tests/TestSuite_vf_port_start_stop.py index 7657879..35309c4 100644 --- a/tests/TestSuite_vf_port_start_stop.py +++ b/tests/TestSuite_vf_port_start_stop.py @@ -3,7 +3,6 @@ import re import time -import dts from qemu_kvm import QEMUKvm from test_case import TestCase from pmd_output import PmdOutput diff --git a/tests/TestSuite_vf_rss.py b/tests/TestSuite_vf_rss.py index cb2ffc9..21c717b 100644 --- a/tests/TestSuite_vf_rss.py +++ b/tests/TestSuite_vf_rss.py @@ -36,7 +36,6 @@ Test RSS reta (redirection table) update function. import time import random import re -import dts testQueues = [4] reta_entries = [] reta_lines = [] @@ -182,7 +181,7 @@ class TestVfRss(TestCase): global reta_lines result = [] - dts.results_table_add_header( + self.result_table_create( ['packet index', 'hash value', 'hash index', 'queue id', 'actual queue id', 'pass ']) i = 0 @@ -200,11 +199,11 @@ class TestVfRss(TestCase): else: status = "fail" result.insert(i, 1) - dts.results_table_add_row( + self.result_table_add( [i, tmp_reta_line["RSS hash"], hash_index, reta_entries[hash_index], tmp_reta_line["queue"], status]) i = i + 1 - dts.results_table_print() + self.result_table_print() reta_lines = [] self.verify(sum(result) == 0, "the reta update function failed!") diff --git a/tests/TestSuite_vf_to_vf_nic_bridge.py b/tests/TestSuite_vf_to_vf_nic_bridge.py index 9c5548b..065038a 100644 --- a/tests/TestSuite_vf_to_vf_nic_bridge.py +++ b/tests/TestSuite_vf_to_vf_nic_bridge.py @@ -34,7 +34,7 @@ Test vf to vf nic bridge """ import re -import dts +import utils import time import pdb @@ -82,7 +82,7 @@ class TestVF2VFBridge(TestCase): if self.vm0_dut is None: raise Exception('Set up VM0 failed') except Exception as e: - print dts.RED(str(e)) + print utils.RED(str(e)) self.vm1 = QEMUKvm(self.dut, 'vm1', 'vf_to_vf_bridge') self.vm1.set_vm_device(driver='pci-assign', **vf1_prop) @@ -91,7 +91,7 @@ class TestVF2VFBridge(TestCase): if self.vm1_dut is None: raise Exception('Set up VM1 failed') except Exception as e: - print dts.RED(str(e)) + print utils.RED(str(e)) def clear_vf_to_vf_env(self): if self.vm0 is not None: @@ -210,7 +210,7 @@ class TestVF2VFBridge(TestCase): recv_info = recv_pattern.search(recv_tcpdump) recv_str = recv_info.group(0).split(' ')[0] recv_number = int(recv_str, 10) - self.vm0_dut.bind_interfaces_linux(dts.drivername) + self.vm0_dut.bind_interfaces_linux(self.drivername) self.verify(recv_number is SEND_PACKET, 'Rx port recv error: %d' % recv_number) @@ -236,7 +236,7 @@ class TestVF2VFBridge(TestCase): self.vm1_dut.send_expect('scapy', '>>> ', 10) self.vm1_dut.send_expect('sendp([%s], iface="%s", count=%d)' % (pkt_content, vf1_intf, SEND_PACKET), '>>> ', 30) self.vm1_dut.send_expect('quit()', '# ', 10) - self.vm1_dut.bind_interfaces_linux(dts.drivername) + self.vm1_dut.bind_interfaces_linux(self.drivername) recv_num = self.vm0_pmd.get_pmd_stats(0)['RX-packets'] self.vm0_pmd.execute_cmd('stop') self.vm0_pmd.execute_cmd('quit', '# ') diff --git a/tests/TestSuite_vf_vlan.py b/tests/TestSuite_vf_vlan.py index fc1527c..f106cac 100644 --- a/tests/TestSuite_vf_vlan.py +++ b/tests/TestSuite_vf_vlan.py @@ -3,7 +3,6 @@ import re import time -import dts from qemu_kvm import QEMUKvm from test_case import TestCase from pmd_output import PmdOutput diff --git a/tests/TestSuite_vhost_cuse_one_copy_one_vm.py b/tests/TestSuite_vhost_cuse_one_copy_one_vm.py index e7d71e9..415ab0d 100644 --- a/tests/TestSuite_vhost_cuse_one_copy_one_vm.py +++ b/tests/TestSuite_vhost_cuse_one_copy_one_vm.py @@ -35,7 +35,7 @@ DPDK Test suite. Vhost Cuse one-copy sample test suite. """ import os -import dts +import utils import string import re import time @@ -147,7 +147,7 @@ class TestVhostCuseOneCopyOneVm(TestCase, IxiaPacketGenerator): # # Launch the vhost sample with different parameters # - self.coremask = dts.create_mask(self.cores) + self.coremask = utils.create_mask(self.cores) self.vhostapp_testcmd = self.vhost_test % ( self.coremask, self.memory_channel, self.jumbo, self.zero_copy, self.vm2vm) # Clean and prepare the vhost cuse modules @@ -172,7 +172,7 @@ class TestVhostCuseOneCopyOneVm(TestCase, IxiaPacketGenerator): else: print "Launch vhost sample finished" except Exception as e: - print dts.RED("Failed to launch vhost sample: %s" % str(e)) + print utils.RED("Failed to launch vhost sample: %s" % str(e)) def start_onevm(self): # @@ -195,7 +195,7 @@ class TestVhostCuseOneCopyOneVm(TestCase, IxiaPacketGenerator): if self.vm_dut is None: raise Exception("Set up VM ENV failed") except Exception as e: - print dts.RED("Failure for %s" % str(e)) + print utils.RED("Failure for %s" % str(e)) return True @@ -317,7 +317,7 @@ class TestVhostCuseOneCopyOneVm(TestCase, IxiaPacketGenerator): return (txRate,recvRate) def send_verify(self, case, frame_sizes, vlan_id1=0, vlan_id2=0): - dts.results_table_add_header(self.header_row) + self.result_table_create(self.header_row) for frame_size in frame_sizes: info = "Running test %s, and %d frame size." % (case, frame_size) self.logger.info(info) @@ -341,8 +341,8 @@ class TestVhostCuseOneCopyOneVm(TestCase, IxiaPacketGenerator): sendpkt /= 1000000.0 pct = sendpkt * 100 / recvpkt data_row = [frame_size, str(recvpkt), str(sendpkt), str(pct)] - dts.results_table_add_row(data_row) - dts.results_table_print() + self.result_table_add(data_row) + self.result_table_print() def test_perf_cuse_one_vm_legacy_fwd(self): # diff --git a/tests/TestSuite_vhost_user_live_migration.py b/tests/TestSuite_vhost_user_live_migration.py index 95e2fb3..2650952 100644 --- a/tests/TestSuite_vhost_user_live_migration.py +++ b/tests/TestSuite_vhost_user_live_migration.py @@ -3,7 +3,6 @@ import re import time -import dts from qemu_kvm import QEMUKvm from test_case import TestCase from exception import VirtDutInitException diff --git a/tests/TestSuite_vhost_user_one_copy_one_vm.py b/tests/TestSuite_vhost_user_one_copy_one_vm.py index 24d68b7..f9e9430 100644 --- a/tests/TestSuite_vhost_user_one_copy_one_vm.py +++ b/tests/TestSuite_vhost_user_one_copy_one_vm.py @@ -35,7 +35,7 @@ DPDK Test suite. Vhost user one-copy sample test suite. """ import os -import dts +import utils import string import re import time @@ -139,7 +139,7 @@ class TestVhostUserOneCopyOneVm(TestCase, IxiaPacketGenerator): # # Launch the vhost sample with different parameters # - self.coremask = dts.create_mask(self.cores) + self.coremask = utils.create_mask(self.cores) self.vhostapp_testcmd = self.vhost_test % ( self.coremask, self.memory_channel, self.jumbo, self.zero_copy, self.vm2vm) self.dut.send_expect(self.vhostapp_testcmd, "# ", 40) @@ -155,7 +155,7 @@ class TestVhostUserOneCopyOneVm(TestCase, IxiaPacketGenerator): else: print "Launch vhost sample finished" except Exception as e: - print dts.RED("Failed to launch vhost sample: %s" % str(e)) + print utils.RED("Failed to launch vhost sample: %s" % str(e)) def start_onevm(self): # @@ -177,7 +177,7 @@ class TestVhostUserOneCopyOneVm(TestCase, IxiaPacketGenerator): if self.vm_dut is None: raise Exception("Set up VM ENV failed") except Exception as e: - print dts.RED("Failure for %s" % str(e)) + print utils.RED("Failure for %s" % str(e)) return True @@ -299,7 +299,7 @@ class TestVhostUserOneCopyOneVm(TestCase, IxiaPacketGenerator): return (txRate,recvRate) def send_verify(self, case, frame_sizes, vlan_id1=0, vlan_id2=0): - dts.results_table_add_header(self.header_row) + self.result_table_create(self.header_row) for frame_size in frame_sizes: info = "Running test %s, and %d frame size." % (case, frame_size) self.logger.info(info) @@ -323,8 +323,8 @@ class TestVhostUserOneCopyOneVm(TestCase, IxiaPacketGenerator): sendpkt /= 1000000.0 pct = sendpkt * 100 / recvpkt data_row = [frame_size, str(recvpkt), str(sendpkt), str(pct)] - dts.results_table_add_row(data_row) - dts.results_table_print() + self.result_table_add(data_row) + self.result_table_print() def test_perf_user_one_vm_legacy_fwd(self): # diff --git a/tests/TestSuite_virtio_iperf.py b/tests/TestSuite_virtio_iperf.py index 7f7e427..a0bd6e9 100644 --- a/tests/TestSuite_virtio_iperf.py +++ b/tests/TestSuite_virtio_iperf.py @@ -33,8 +33,9 @@ DPDK Test suite Test DPDK vhost + virtio scenarios """ import re -import dts +import utils import time +import os from test_case import TestCase from qemu_kvm import QEMUKvm @@ -56,7 +57,7 @@ class TestVirtioIperf(TestCase): netdev = self.dut.ports_info[self.phy_function]['port'] self.socket = netdev.get_nic_socket() self.cores = self.dut.get_core_list("1S/3C/1T", socket=self.socket) - self.coremask = dts.create_mask(self.cores) + self.coremask = utils.create_mask(self.cores) def set_up(self): pass @@ -124,11 +125,10 @@ class TestVirtioIperf(TestCase): fp = open("./iperf_client.log") fmsg = fp.read() iperfdata = re.compile('[\d+]*.[\d+] [M|G]bits/sec').findall(fmsg) - dts.results_table_add_header(['Data', 'Unit']) + self.result_table_create(['Data', 'Unit']) for data in iperfdata: - dts.results_table_add_row([data.split()[0], data.split()[1]]) - dts.results_table_print() - import os + self.results_table_add([data.split()[0], data.split()[1]]) + self.result_table_print() os.popen("rm -rf ./iperf_client.log") def test_perf_vhost_legacy_virtio_iperf(self): @@ -148,7 +148,7 @@ class TestVirtioIperf(TestCase): self.dut_execut_cmd('modprobe cuse') self.dut_execut_cmd('insmod ./x86_64-native-linuxapp-gcc/kmod/igb_uio.ko') self.dut_execut_cmd('insmod ./lib/librte_vhost/eventfd_link/eventfd_link.ko') - self.dut.bind_interfaces_linux(dts.drivername) + self.dut.bind_interfaces_linux(self.drivername) self.launch_vhost_switch(self.coremask, 4, 0, 1) self.vm1 = QEMUKvm(self.dut, 'vm0', 'virtio_iperf') @@ -164,7 +164,7 @@ class TestVirtioIperf(TestCase): if self.vm1_dut is None: raise Exception('VM1 start failed') except Exception as e0: - print dts.RED('VM1 already exist, powerdown it first') + print utils.RED('VM1 already exist, powerdown it first') self.vm1_dut.restore_interfaces() self.vm2 = QEMUKvm(self.dut, 'vm1', 'virtio_iperf') @@ -180,7 +180,7 @@ class TestVirtioIperf(TestCase): if self.vm2_dut is None: raise Exception('VM2 start failed') except Exception as e1: - print dts.RED('VM2 already exist, powerdown it first') + print utils.RED('VM2 already exist, powerdown it first') self.vm2_dut.restore_interfaces() #self.start_iperf_server() @@ -228,7 +228,7 @@ class TestVirtioIperf(TestCase): #self.dut_execut_cmd('modprobe cuse') self.dut_execut_cmd('insmod ./x86_64-native-linuxapp-gcc/kmod/igb_uio.ko') self.dut_execut_cmd('insmod ./lib/librte_vhost/eventfd_link/eventfd_link.ko') - self.dut.bind_interfaces_linux(dts.drivername) + self.dut.bind_interfaces_linux(self.drivername) self.launch_vhost_switch(self.coremask, 4, 0, 1) self.vm1 = QEMUKvm(self.dut, 'vm0', 'virtio_iperf') @@ -242,7 +242,7 @@ class TestVirtioIperf(TestCase): if self.vm1_dut is None: raise Exception('VM1 start failed') except Exception as e0: - print dts.RED('VM1 already exist, powerdown it first') + print utils.RED('VM1 already exist, powerdown it first') self.vm1_dut.restore_interfaces() self.vm2 = QEMUKvm(self.dut, 'vm1', 'virtio_iperf') @@ -256,7 +256,7 @@ class TestVirtioIperf(TestCase): if self.vm2_dut is None: raise Exception('VM2 start failed') except Exception as e1: - print dts.RED('VM2 already exist, powerdown it first') + print utils.RED('VM2 already exist, powerdown it first') self.vm2_dut.restore_interfaces() diff --git a/tests/TestSuite_vlan.py b/tests/TestSuite_vlan.py index 70a9813..9bed8da 100644 --- a/tests/TestSuite_vlan.py +++ b/tests/TestSuite_vlan.py @@ -37,7 +37,7 @@ Test the support of VLAN Offload Features by Poll Mode Drivers. """ -import dts +import utils import time @@ -67,7 +67,7 @@ class TestVlan(TestCase): valports = [_ for _ in ports if self.tester.get_local_port(_) != -1] dutRxPortId = valports[0] dutTxPortId = valports[0] - portMask = dts.create_mask(valports[:1]) + portMask = utils.create_mask(valports[:1]) self.pmdout = PmdOutput(self.dut) self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % portMask) @@ -133,7 +133,7 @@ class TestVlan(TestCase): """ if self.kdriver == "fm10k": - print dts.RED("fm10k not support this case\n") + print utils.RED("fm10k not support this case\n") return self.dut.send_expect("rx_vlan add %d %s" % (self.vlan, dutRxPortId), "testpmd> ") self.dut.send_expect("vlan set strip off %s" % dutRxPortId, "testpmd> ") @@ -178,7 +178,7 @@ class TestVlan(TestCase): def test_vlan_strip_config_off(self): if self.kdriver == "fm10k": - print dts.RED("fm10k not support this case\n") + print utils.RED("fm10k not support this case\n") return self.dut.send_expect("vlan set strip off %s" % dutRxPortId, "testpmd> ", 20) self.dut.send_expect("rx_vlan add %d %s" % (self.vlan, dutRxPortId), "testpmd> ", 20) diff --git a/tests/TestSuite_vm_power_manager.py b/tests/TestSuite_vm_power_manager.py index f58fb45..e9d25b3 100644 --- a/tests/TestSuite_vm_power_manager.py +++ b/tests/TestSuite_vm_power_manager.py @@ -35,7 +35,7 @@ VM power manager test suite. """ import re -import dts +import utils from test_case import TestCase from etgen import IxiaPacketGenerator from settings import HEADER_SIZE @@ -158,7 +158,7 @@ class TestVmPowerManager(TestCase, IxiaPacketGenerator): self.vm_dut.send_expect( "set_cpu_freq %d down" % vcpu, "vmpower\(guest\)>") cur_freq = self.get_cpu_frequency(self.vcpu_map[vcpu]) - print dts.GREEN("After freqency down, freq is %d\n" % cur_freq) + print utils.GREEN("After freqency down, freq is %d\n" % cur_freq) self.verify( ori_freq > cur_freq, "Cpu freqenecy can not scale down") ori_freq = cur_freq @@ -187,7 +187,7 @@ class TestVmPowerManager(TestCase, IxiaPacketGenerator): self.vm_dut.send_expect( "set_cpu_freq %d up" % vcpu, "vmpower\(guest\)>") cur_freq = self.get_cpu_frequency(self.vcpu_map[vcpu]) - print dts.GREEN("After freqency up, freq is %d\n" % cur_freq) + print utils.GREEN("After freqency up, freq is %d\n" % cur_freq) self.verify( cur_freq > ori_freq, "Cpu freqenecy can not scale up") ori_freq = cur_freq @@ -216,7 +216,7 @@ class TestVmPowerManager(TestCase, IxiaPacketGenerator): max_freq = int(out) self.verify(freq == max_freq, "Cpu max frequency not correct") - print dts.GREEN("After freqency max, freq is %d\n" % max_freq) + print utils.GREEN("After freqency max, freq is %d\n" % max_freq) self.vm_dut.send_expect("quit", "# ") def test_vm_power_managment_freqmin(self): @@ -241,7 +241,7 @@ class TestVmPowerManager(TestCase, IxiaPacketGenerator): min_freq = int(out) self.verify(freq == min_freq, "Cpu min frequency not correct") - print dts.GREEN("After freqency min, freq is %d\n" % min_freq) + print utils.GREEN("After freqency min, freq is %d\n" % min_freq) self.vm_dut.send_expect("quit", "# ") def test_vm_power_multivms(self): @@ -281,7 +281,7 @@ class TestVmPowerManager(TestCase, IxiaPacketGenerator): # check host core has correct mapped cpu_idx = 0 for cpu in cpus: - mask = dts.create_mask([cpu]) + mask = utils.create_mask([cpu]) cpu_map = '[%d]: Physical CPU Mask %s' % (cpu_idx, mask) self.verify(cpu_map in vm_info, "Faile to map host cpu %s" % cpu) cpu_idx += 1 @@ -305,7 +305,7 @@ class TestVmPowerManager(TestCase, IxiaPacketGenerator): latency_header = ['Frame Size', 'Max latency', 'Min lantecy', 'Avg latency'] - dts.results_table_add_header(latency_header) + self.result_table_create(latency_header) rx_port = self.dut_ports[0] tx_port = self.dut_ports[1] @@ -341,9 +341,9 @@ class TestVmPowerManager(TestCase, IxiaPacketGenerator): print latency table_row = [frame_size, latency['max'], latency['min'], latency['average']] - dts.results_table_add_row(table_row) + self.result_table_add(table_row) - dts.results_table_print() + self.result_table_print() self.vm_dut.kill_all() @@ -353,7 +353,7 @@ class TestVmPowerManager(TestCase, IxiaPacketGenerator): """ latency_header = ['Tx linerate%', 'Rx linerate%', 'Cpu freq'] - dts.results_table_add_header(latency_header) + self.result_table_create(latency_header) rx_port = self.dut_ports[0] tx_port = self.dut_ports[1] @@ -398,15 +398,15 @@ class TestVmPowerManager(TestCase, IxiaPacketGenerator): wirespeed = self.wirespeed(self.nic, self.def_framesize, 1) pct = pps * 100 / wirespeed table_row = [rate, pct, freq] - dts.results_table_add_row(table_row) + self.result_table_add(table_row) - dts.results_table_print() + self.result_table_print() self.vm_dut.kill_all() def get_freq_in_transmission(self): self.cur_freq = self.get_cpu_frequency(self.vcpu_map[1]) - print dts.GREEN("Current cpu frequency %d" % self.cur_freq) + print utils.GREEN("Current cpu frequency %d" % self.cur_freq) def get_max_freq(self, core_num): freq_path = "cat /sys/devices/system/cpu/cpu%d/cpufreq/" + \ diff --git a/tests/TestSuite_vmdq.py b/tests/TestSuite_vmdq.py index 8c5fa57..10cb8e6 100644 --- a/tests/TestSuite_vmdq.py +++ b/tests/TestSuite_vmdq.py @@ -7,7 +7,7 @@ Tests for vmdq. """ -import dts +import utils import re from etgen import IxiaPacketGenerator from test_case import TestCase @@ -62,7 +62,7 @@ class TestVmdq(TestCase, IxiaPacketGenerator): minimum = 1000000 maximun = 0 - # Need to use Python re package because dts.regexp only handles 1 group, + # Need to use Python re package because utils.regexp only handles 1 group, # we need 4. scanner = re.compile( "^Pool [0-9]+: ([0-9]+) ([0-9]+) ([0-9]+) ([0-9]+)$") @@ -91,9 +91,9 @@ class TestVmdq(TestCase, IxiaPacketGenerator): self.dut_ports = self.dut.get_ports(self.nic) core_list = self.dut.get_core_list("1S/4C/1T", socket=self.ports_socket) - core_mask = dts.create_mask(core_list) + core_mask = utils.create_mask(core_list) - port_mask = dts.create_mask([self.dut_ports[0], self.dut_ports[1]]) + port_mask = utils.create_mask([self.dut_ports[0], self.dut_ports[1]]) # Run the application out = self.dut.send_expect("./examples/vmdq/build/vmdq_app -n 4 -c %s -- -p %s --nb-pools %s&" % (core_mask, port_mask, str(npools)), "reading queues", 120) @@ -153,13 +153,13 @@ class TestVmdq(TestCase, IxiaPacketGenerator): frame_sizes = [64, 128, 256, 512, 1024, 1280, 1518] for config in self.core_configs: - print dts.BLUE(config["cores"]) + print utils.BLUE(config["cores"]) self.dut.kill_all() core_config = config['cores'] core_list = self.dut.get_core_list(core_config,socket=self.ports_socket) - core_mask = dts.create_mask(core_list) - portmask = dts.create_mask(self.dut.get_ports()) + core_mask = utils.create_mask(core_list) + portmask = utils.create_mask(self.dut.get_ports()) if self.nic in ("niantic", "springfountain"): self.queues = 64 self.dut.send_expect( @@ -184,14 +184,14 @@ class TestVmdq(TestCase, IxiaPacketGenerator): tx_port = self.tester.get_local_port(self.dut_ports[0]) rx_port = self.tester.get_local_port(self.dut_ports[1]) - print dts.GREEN("Waiting for application to initialize") + print utils.GREEN("Waiting for application to initialize") sleep(5) for frame_size in frame_sizes: TestVmdq.current_frame_size = frame_size - print dts.BLUE(str(frame_size)) + print utils.BLUE(str(frame_size)) self.tester.scapy_append('dstmac="%s"' % self.destmac_port0) tx_mac = self.tester.get_mac(tx_port) @@ -226,14 +226,14 @@ class TestVmdq(TestCase, IxiaPacketGenerator): self.core_configs[n]['mpps'][size] is not 0, "No traffic detected") # Print results - dts.results_table_add_header( + self.result_table_create( ['Frame size'] + [n['cores'] for n in self.core_configs]) for size in frame_sizes: - dts.results_table_add_row( + self.result_table_add( [size] + [n['mpps'][size] for n in self.core_configs]) - dts.results_table_print() + self.result_table_print() # Override etgen.dot1q function def dot1q(self, port, prio, id, vlan, type): diff --git a/tests/TestSuite_vxlan.py b/tests/TestSuite_vxlan.py index c1d0200..a334761 100644 --- a/tests/TestSuite_vxlan.py +++ b/tests/TestSuite_vxlan.py @@ -5,7 +5,7 @@ Test VXLAN behaviour in DPDK. """ -import dts +import utils import string import re import time @@ -271,14 +271,14 @@ class TestVxlan(TestCase, IxiaPacketGenerator): global valports valports = [_ for _ in ports if self.tester.get_local_port(_) != -1] - self.portMask = dts.create_mask(valports[:2]) + self.portMask = utils.create_mask(valports[:2]) # Verify that enough threads are available netdev = self.dut.ports_info[ports[0]]['port'] self.ports_socket = netdev.socket cores = self.dut.get_core_list("1S/5C/1T", socket=self.ports_socket) self.verify(cores is not None, "Insufficient cores for speed testing") - self.coremask = dts.create_mask(cores) + self.coremask = utils.create_mask(cores) # start testpmd self.pmdout = PmdOutput(self.dut) @@ -837,7 +837,7 @@ class TestVxlan(TestCase, IxiaPacketGenerator): recv_queue = perf_config['recvqueue'] # there's known bug that if enable vxlan, rss will be disabled if tun_filter == "None" and recv_queue == 'Multi': - print dts.RED("RSS and Tunel filter can't enable in the same time") + print utils.RED("RSS and Tunel filter can't enable in the same time") else: self.enable_vxlan(dut_port) @@ -913,11 +913,11 @@ class TestVxlan(TestCase, IxiaPacketGenerator): wrpcap(dest_pcap, pkts) def test_perf_vxlan_tunnelfilter_performance_2ports(self): - dts.results_table_add_header(self.tunnel_header) + self.result_table_create(self.tunnel_header) core_list = self.dut.get_core_list( '1S/%dC/1T' % (self.tunnel_multiqueue * 2 + 1), socket=self.ports_socket) - core_mask = dts.create_mask(core_list) + core_mask = utils.create_mask(core_list) pmd_temp = "./%(TARGET)s/app/testpmd -c %(COREMASK)s -n " + \ "%(CHANNEL)d -- -i --disable-rss --rxq=2 --txq=2" + \ @@ -926,7 +926,7 @@ class TestVxlan(TestCase, IxiaPacketGenerator): for perf_config in self.tunnel_perf: tun_filter = perf_config['tunnel_filter'] recv_queue = perf_config['recvqueue'] - print dts.GREEN("Measure tunnel performance of [%s %s %s]" + print utils.GREEN("Measure tunnel performance of [%s %s %s]" % (perf_config['Packet'], tun_filter, recv_queue)) if tun_filter == "None" and recv_queue == "Multi": @@ -991,12 +991,12 @@ class TestVxlan(TestCase, IxiaPacketGenerator): table_row = [perf_config['Packet'], tun_filter, recv_queue, perf_config['Mpps'], perf_config['pct']] - dts.results_table_add_row(table_row) + self.result_table_add(table_row) - dts.results_table_print() + self.result_table_print() def test_perf_vxlan_checksum_performance_2ports(self): - dts.results_table_add_header(self.chksum_header) + self.result_table_create(self.chksum_header) vxlan = VxlanTestConfig(self, payload_size=self.vxlan_payload) vxlan.outer_mac_dst = self.dut.get_mac_address(self.dut_port) vxlan.pcap_file = "vxlan1.pcap" @@ -1013,13 +1013,13 @@ class TestVxlan(TestCase, IxiaPacketGenerator): core_list = self.dut.get_core_list( '1S/%dC/1T' % (self.tunnel_multiqueue * 2 + 1), socket=self.ports_socket) - core_mask = dts.create_mask(core_list) + core_mask = utils.create_mask(core_list) tgen_dut = self.tester.get_local_port(self.dut_port) tgen_tester = self.tester.get_local_port(self.recv_port) for cal in self.cal_type: recv_queue = cal['recvqueue'] - print dts.GREEN("Measure checksum performance of [%s %s %s]" + print utils.GREEN("Measure checksum performance of [%s %s %s]" % (cal['Type'], recv_queue, cal['csum'])) # configure flows @@ -1091,9 +1091,9 @@ class TestVxlan(TestCase, IxiaPacketGenerator): "Queue %d no traffic" % queue) table_row = [cal['Type'], recv_queue, cal['Mpps'], cal['pct']] - dts.results_table_add_row(table_row) + self.result_table_add(table_row) - dts.results_table_print() + self.result_table_print() def enable_vxlan(self, port): self.dut.send_expect("rx_vxlan_port add %d %d" diff --git a/tests/TestSuite_vxlan_sample.py b/tests/TestSuite_vxlan_sample.py index 189bc38..1dbb727 100644 --- a/tests/TestSuite_vxlan_sample.py +++ b/tests/TestSuite_vxlan_sample.py @@ -36,7 +36,7 @@ Vxlan sample test suite. """ import os -import dts +import utils import string import re import time @@ -154,7 +154,7 @@ class TestVxlanSample(TestCase): Run before each test case. """ # create coremask - self.coremask = dts.create_mask(self.cores) + self.coremask = utils.create_mask(self.cores) if "2VM" not in self.running_case: vm_num = 1 @@ -220,7 +220,7 @@ class TestVxlanSample(TestCase): if self.vm_dut is None: raise Exception("Set up VM ENV failed!") except Exception as e: - print dts.RED("Failure for %s" % str(e)) + print utils.RED("Failure for %s" % str(e)) # create another vm if vm_num == 2: @@ -331,10 +331,10 @@ class TestVxlanSample(TestCase): self.verify(ord(payload[i]) == 88, "Check udp data failed") except: case_pass = False - print dts.RED("Failure in checking packet payload") + print utils.RED("Failure in checking packet payload") if case_pass: - print dts.GREEN("Check normal udp packet forward pass on " + print utils.GREEN("Check normal udp packet forward pass on " "virtIO port %d" % vf_id) if pkt_type == "vxlan_udp_decap": @@ -353,7 +353,7 @@ class TestVxlanSample(TestCase): vxlan_pkt.send_pcap(tester_iface) time.sleep(5) - # transfer capture pcap to dts server + # transfer capture pcap to server pkts = self.transfer_capture_file() # check packet number and payload self.verify(len(pkts) >= 1, "Failed to capture packets") @@ -366,10 +366,10 @@ class TestVxlanSample(TestCase): self.verify(ord(payload[i]) == 88, "Check udp data failed") except: case_pass = False - print dts.RED("Failure in checking packet payload") + print utils.RED("Failure in checking packet payload") if case_pass: - print dts.GREEN("Check vxlan packet decap pass on virtIO port" + print utils.GREEN("Check vxlan packet decap pass on virtIO port" " %d" % vf_id) if pkt_type == "vxlan_udp": @@ -388,7 +388,7 @@ class TestVxlanSample(TestCase): vxlan_pkt.send_pcap(tester_iface) time.sleep(5) - # transfer capture pcap to dts server + # transfer capture pcap to server pkts = self.transfer_capture_file() # check packet number and payload self.verify(len(pkts) >= 1, "Failed to capture packets") @@ -400,10 +400,10 @@ class TestVxlanSample(TestCase): self.verify(ord(payload[i]) == 88, "Check udp data failed") except: case_pass = False - print dts.RED("Failure in checking packet payload") + print utils.RED("Failure in checking packet payload") if case_pass: - print dts.GREEN("Check vxlan packet decap and encap pass on " + print utils.GREEN("Check vxlan packet decap and encap pass on " "virtIO port %d" % vf_id) if pkt_type == "vxlan_udp_chksum": @@ -423,7 +423,7 @@ class TestVxlanSample(TestCase): vxlan_pkt = VxlanTestConfig(self, **params) vxlan_pkt.create_pcap() chksums_ref = vxlan_pkt.get_chksums() - print dts.GREEN("Checksum reference: %s" % chksums_ref) + print utils.GREEN("Checksum reference: %s" % chksums_ref) params['inner_ip_invalid'] = 1 params['inner_l4_invalid'] = 1 @@ -436,21 +436,21 @@ class TestVxlanSample(TestCase): self.start_capture(tester_iface, pkt_smac=self.pf_mac) vxlan_pkt.send_pcap(tester_iface) time.sleep(5) - # transfer capture pcap to dts server + # transfer capture pcap to server pkts = self.transfer_capture_file() # check packet number and payload self.verify(len(pkts) >= 1, "Failed to capture packets") self.verify(pkts[0].haslayer(Vxlan) == 1, "Packet not encapsulated") chksums = vxlan_pkt.get_chksums(pcap='vxlan_cap.pcap') - print dts.GREEN("Checksum : %s" % chksums) + print utils.GREEN("Checksum : %s" % chksums) for key in chksums_ref: if 'inner' in key: # only check inner packet chksum self.verify(chksums[key] == chksums_ref[key], "%s not matched to %s" % (key, chksums_ref[key])) - print dts.GREEN("%s checksum pass" % params['inner_l4_type']) + print utils.GREEN("%s checksum pass" % params['inner_l4_type']) if pkt_type == "vxlan_tcp_tso": # create vxlan packet pf mac + vni=1000 + inner virtIO port0 mac + @@ -470,7 +470,7 @@ class TestVxlanSample(TestCase): vxlan_pkt.send_pcap(tester_iface) time.sleep(5) - # transfer capture pcap to dts server + # transfer capture pcap to server pkts = self.transfer_capture_file() # check packet number and payload self.verify(len(pkts) == 4, "Failed to capture tso packets") @@ -485,11 +485,11 @@ class TestVxlanSample(TestCase): length += len(payload) except: case_pass = False - print dts.RED("Failure in checking tso payload") + print utils.RED("Failure in checking tso payload") self.verify(length == 892, "Total tcp payload size not match") if case_pass: - print dts.GREEN("Vxlan packet tso pass on virtIO port %d" + print utils.GREEN("Vxlan packet tso pass on virtIO port %d" % vf_id) def test_perf_vxlan_sample(self): @@ -501,7 +501,7 @@ class TestVxlanSample(TestCase): HEADER_SIZE['ip'] - HEADER_SIZE['udp'] + 4 vxlansample_header = ['Type', 'Queue', 'Mpps', '% linerate'] - dts.results_table_add_header(vxlansample_header) + self.result_table_create(vxlansample_header) for perf_cfg in self.perf_cfg: func = perf_cfg['Func'] if func is 'Decap': @@ -592,11 +592,11 @@ class TestVxlanSample(TestCase): table_row = [perf_cfg['Func'], perf_cfg['VirtIO'], perf_cfg['Mpps'], perf_cfg['pct']] - dts.results_table_add_row(table_row) + self.result_table_add(table_row) self.tear_down() - dts.results_table_print() + self.result_table_print() def combine_pcap(self, dest_pcap, src_pcap): pkts = rdpcap(dest_pcap) -- 1.9.3