aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xnfvbench/cfg.default.yaml9
-rwxr-xr-xnfvbench/traffic_client.py7
-rw-r--r--nfvbench/traffic_server.py12
-rw-r--r--test/test_nfvbench.py4
4 files changed, 25 insertions, 7 deletions
diff --git a/nfvbench/cfg.default.yaml b/nfvbench/cfg.default.yaml
index 3138420..5c791ab 100755
--- a/nfvbench/cfg.default.yaml
+++ b/nfvbench/cfg.default.yaml
@@ -229,7 +229,7 @@ traffic_generator:
- name: trex-local
tool: TRex
ip: 127.0.0.1
- cores: 3
+ cores: 4
software_mode: false
interfaces:
- port: 0
@@ -240,6 +240,13 @@ traffic_generator:
switch_port:
intf_speed:
+# Simpler override for trex core count and mbuf multilier factor
+# if empty defaults to the one specified in generator_profile.cores
+cores:
+
+# mbuffer ratio to use for TRex (see TRex documentation for more details)
+mbuf_factor: 0.2
+
# -----------------------------------------------------------------------------
# These variables are not likely to be changed
diff --git a/nfvbench/traffic_client.py b/nfvbench/traffic_client.py
index c9daf40..093a02d 100755
--- a/nfvbench/traffic_client.py
+++ b/nfvbench/traffic_client.py
@@ -328,7 +328,12 @@ class GeneratorConfig(object):
# copy over fields from the dict
self.tool = gen_config.tool
self.ip = gen_config.ip
- self.cores = gen_config.get('cores', 1)
+ # overrides on config.cores and config.mbuf_factor
+ if config.cores:
+ self.cores = config.cores
+ else:
+ self.cores = gen_config.get('cores', 1)
+ self.mbuf_factor = config.mbuf_factor
if gen_config.intf_speed:
# interface speed is overriden from config
self.intf_speed = bitmath.parse_string(gen_config.intf_speed.replace('ps', '')).bits
diff --git a/nfvbench/traffic_server.py b/nfvbench/traffic_server.py
index b2d8367..c3d4d14 100644
--- a/nfvbench/traffic_server.py
+++ b/nfvbench/traffic_server.py
@@ -35,8 +35,7 @@ class TRexTrafficServer(TrafficServer):
self.trex_dir = os.path.join(trex_base_dir, contents[0])
def run_server(self, generator_config, filename='/etc/trex_cfg.yaml'):
- """
- Runs TRex server for specified traffic profile.
+ """Run TRex server for specified traffic profile.
:param traffic_profile: traffic profile object based on config file
:param filename: path where to save TRex config file
@@ -46,10 +45,15 @@ class TRexTrafficServer(TrafficServer):
vtep_vlan = generator_config.gen_config.get('vtep_vlan')
sw_mode = "--software" if generator_config.software_mode else ""
vlan_opt = "--vlan" if (generator_config.vlan_tagging or vtep_vlan) else ""
+ if generator_config.mbuf_factor:
+ mbuf_opt = "--mbuf-factor " + str(generator_config.mbuf_factor)
+ else:
+ mbuf_opt = ""
subprocess.Popen(['nohup', '/bin/bash', '-c',
'./t-rex-64 -i -c {} --iom 0 --no-scapy-server --close-at-end {} '
- '{} --cfg {} &> /tmp/trex.log & disown'.format(cores, sw_mode,
- vlan_opt, cfg)],
+ '{} {} --cfg {} &> /tmp/trex.log & disown'.format(cores, sw_mode,
+ vlan_opt,
+ mbuf_opt, cfg)],
cwd=self.trex_dir)
LOG.info('TRex server is running...')
diff --git a/test/test_nfvbench.py b/test/test_nfvbench.py
index 04778e7..2a7ca77 100644
--- a/test/test_nfvbench.py
+++ b/test/test_nfvbench.py
@@ -314,7 +314,9 @@ def _get_dummy_tg_config(chain_type, rate, scc=1, fc=10, step_ip='0.0.0.1',
'check_traffic_time_sec': 200,
'generic_poll_sec': 2,
'measurement': {'NDR': 0.001, 'PDR': 0.1, 'load_epsilon': 0.1},
- 'l2_loopback': False
+ 'l2_loopback': False,
+ 'cores': None,
+ 'mbuf_factor': None
})
def _get_traffic_client():