aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDeepak S <deepak.s@linux.intel.com>2017-08-30 02:22:07 -0700
committerRoss Brattain <ross.b.brattain@intel.com>2017-10-02 21:47:26 -0700
commitcec4342dee5c13260b680f6dddbc33ae5bf0c127 (patch)
treec04c4655ed43d5406185502d9fb6364b9d41731a
parentdd3cbc21dfb505ea70dd3574869c1fb33b7de956 (diff)
Enable multi-port perf in trex as TG
set TRex -c option for threads per port based on hardware number of queues. We can't auto-detect number of queues and we can't use more than one thread per core on systems with single-queue interfaces, so move the option to the config file options: tg_0: queues_per_port: 2 also enable trex debug by removing >/dev/null redirection options: tg_0: trex_server_debug: true Change-Id: I46da187849282bf28f4ef5b333e1ae890e202768 Signed-off-by: Deepak S <deepak.s@linux.intel.com> Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py13
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_tg_prox.py1
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_tg_trex.py12
-rw-r--r--yardstick/network_services/vnf_generic/vnf/sample_vnf.py1
-rw-r--r--yardstick/network_services/vnf_generic/vnf/tg_trex.py24
5 files changed, 29 insertions, 22 deletions
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py b/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py
index d0c4b6f42..77c92e0fb 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py
@@ -1136,11 +1136,6 @@ class TestClientResourceHelper(unittest.TestCase):
dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
client_resource_helper = ClientResourceHelper(dpdk_setup_helper)
client_resource_helper.client = mock.MagicMock()
- client_resource_helper._vpci_ascending = [
- '0000:05:00.0',
- '0000:05:00.1',
- '0000:05:00.2',
- ]
client_resource_helper.client.get_stats.return_value = {
0: {
'rx_pps': 5.5,
@@ -1186,10 +1181,6 @@ class TestClientResourceHelper(unittest.TestCase):
dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
client_resource_helper = ClientResourceHelper(dpdk_setup_helper)
client_resource_helper.client = mock.MagicMock()
- client_resource_helper._vpci_ascending = [
- '0000:05:00.0',
- '0000:05:00.1',
- ]
client_resource_helper.client.get_stats.return_value = {
'key_name': 'key_value',
0: {
@@ -1238,10 +1229,6 @@ class TestClientResourceHelper(unittest.TestCase):
dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
client_resource_helper = ClientResourceHelper(dpdk_setup_helper)
client_resource_helper.client = mock.MagicMock()
- client_resource_helper._vpci_ascending = [
- '0000:05:00.0',
- '0000:05:00.1',
- ]
client_resource_helper.client.get_stats.return_value = {
0: {
'rx_pps': 5.5,
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_tg_prox.py b/tests/unit/network_services/vnf_generic/vnf/test_tg_prox.py
index eb569cfe6..bdda149c5 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_tg_prox.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_tg_prox.py
@@ -395,7 +395,6 @@ class TestProxTrafficGen(unittest.TestCase):
sut.ssh_helper = mock.Mock()
sut.ssh_helper.run = mock.Mock()
sut.setup_helper.prox_config_dict = {}
- sut._vpci_ascending = ["0000:05:00.0", "0000:05:00.1"]
sut._connect_client = mock.Mock(autospec=STLClient)
sut._connect_client.get_stats = mock.Mock(return_value="0")
sut._traffic_runner(mock_traffic_profile)
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_tg_trex.py b/tests/unit/network_services/vnf_generic/vnf/test_tg_trex.py
index eb9f0525b..d08c62e0b 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_tg_trex.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_tg_trex.py
@@ -356,6 +356,17 @@ class TestTrexTrafficGen(unittest.TestCase):
trex_traffic_gen = TrexTrafficGen(NAME, vnfd)
trex_traffic_gen.ssh_helper = mock.MagicMock()
trex_traffic_gen.resource_helper.ssh_helper = mock.MagicMock()
+ trex_traffic_gen.scenario_helper.scenario_cfg = {}
+ self.assertIsNone(trex_traffic_gen._start_server())
+
+ @mock.patch(SSH_HELPER)
+ def test__start_server_multiple_queues(self, ssh):
+ mock_ssh(ssh)
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ trex_traffic_gen = TrexTrafficGen(NAME, vnfd)
+ trex_traffic_gen.ssh_helper = mock.MagicMock()
+ trex_traffic_gen.resource_helper.ssh_helper = mock.MagicMock()
+ trex_traffic_gen.scenario_helper.scenario_cfg = {"options": {NAME: {"queues_per_port": 2}}}
self.assertIsNone(trex_traffic_gen._start_server())
@mock.patch(SSH_HELPER)
@@ -371,7 +382,6 @@ class TestTrexTrafficGen(unittest.TestCase):
self.sut = TrexTrafficGen(NAME, vnfd)
self.sut.ssh_helper = mock.Mock()
self.sut.ssh_helper.run = mock.Mock()
- self.sut._vpci_ascending = ["0000:05:00.0", "0000:05:00.1"]
self.sut._connect_client = mock.Mock(autospec=STLClient)
self.sut._connect_client.get_stats = mock.Mock(return_value="0")
self.sut.resource_helper.RUN_DURATION = 0
diff --git a/yardstick/network_services/vnf_generic/vnf/sample_vnf.py b/yardstick/network_services/vnf_generic/vnf/sample_vnf.py
index 5cf234514..bbaae39e3 100644
--- a/yardstick/network_services/vnf_generic/vnf/sample_vnf.py
+++ b/yardstick/network_services/vnf_generic/vnf/sample_vnf.py
@@ -423,7 +423,6 @@ class ClientResourceHelper(ResourceHelper):
self._queue = Queue()
self._result = {}
self._terminated = Value('i', 0)
- self._vpci_ascending = None
def _build_ports(self):
self.networks = self.vnfd_helper.port_pairs.networks
diff --git a/yardstick/network_services/vnf_generic/vnf/tg_trex.py b/yardstick/network_services/vnf_generic/vnf/tg_trex.py
index 1fe790f08..fe435f63e 100644
--- a/yardstick/network_services/vnf_generic/vnf/tg_trex.py
+++ b/yardstick/network_services/vnf_generic/vnf/tg_trex.py
@@ -21,7 +21,7 @@ import os
import yaml
-from yardstick.common.utils import mac_address_to_hex_list
+from yardstick.common.utils import mac_address_to_hex_list, try_int
from yardstick.network_services.utils import get_nsb_option
from yardstick.network_services.vnf_generic.vnf.sample_vnf import SampleVNFTrafficGen
from yardstick.network_services.vnf_generic.vnf.sample_vnf import ClientResourceHelper
@@ -76,7 +76,6 @@ class TrexResourceHelper(ClientResourceHelper):
cfg_str = yaml.safe_dump(cfg_file, default_flow_style=False, explicit_start=True)
self.ssh_helper.upload_config_file(os.path.basename(self.CONF_FILE), cfg_str)
- self._vpci_ascending = sorted(vpci_list)
def check_status(self):
status, _, _ = self.ssh_helper.execute("sudo lsof -i:%s" % self.SYNC_PORT)
@@ -109,15 +108,28 @@ class TrexResourceHelper(ClientResourceHelper):
self.ssh_helper.execute("sudo pkill -9 rex > /dev/null 2>&1")
+ # We MUST default to 1 because TRex won't work on single-queue devices with
+ # more than one core per port
+ # We really should be trying to find the number of queues in the driver,
+ # but there doesn't seem to be a way to do this
+ # TRex Error: the number of cores should be 1 when the driver
+ # support only one tx queue and one rx queue. Please use -c 1
+ threads_per_port = try_int(self.scenario_helper.options.get("queues_per_port"), 1)
+
trex_path = self.ssh_helper.join_bin_path("trex", "scripts")
path = get_nsb_option("trex_path", trex_path)
- # cmd = "sudo ./t-rex-64 -i --cfg %s > /dev/null 2>&1" % self.CONF_FILE
- cmd = "./t-rex-64 -i --cfg '{}'".format(self.CONF_FILE)
+ cmd = "./t-rex-64 --no-scapy-server -i -c {} --cfg '{}'".format(threads_per_port,
+ self.CONF_FILE)
- # if there are errors we want to see them
+ if self.scenario_helper.options.get("trex_server_debug"):
+ # if there are errors we want to see them
+ redir = ""
+ else:
+ redir = ">/dev/null"
# we have to sudo cd because the path might be owned by root
- trex_cmd = """sudo bash -c "cd '{}' ; {}" >/dev/null""".format(path, cmd)
+ trex_cmd = """sudo bash -c "cd '{}' ; {}" {}""".format(path, cmd, redir)
+ LOG.debug(trex_cmd)
self.ssh_helper.execute(trex_cmd)
def terminate(self):