aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfmenguy <francoisregis.menguy@orange.com>2021-07-07 11:05:28 +0200
committerfmenguy <francoisregis.menguy@orange.com>2021-07-08 14:08:12 +0200
commit6b8818d15c7f88706ba638df0e5320bc68572e19 (patch)
treeff9014aae6582739571c8b9ce128072bb667fdc9
parentd746a7456e5e06c90edf61d04bdf33d97e5b958f (diff)
NFVBENCH-215 Fix wrong throughput ratio in latency tests
Change-Id: I5c976dd49a2c17b47559b1d6a565a6e78f7cfd0e Signed-off-by: fmenguy <francoisregis.menguy@orange.com>
-rw-r--r--behave_tests/features/steps/steps.py1
-rw-r--r--nfvbench/config_plugin.py2
-rw-r--r--nfvbench/credentials.py3
-rw-r--r--nfvbench/nfvbench.py3
-rw-r--r--nfvbench/summarizer.py8
-rw-r--r--nfvbench/traffic_server.py4
-rw-r--r--test/test_nfvbench.py4
7 files changed, 13 insertions, 12 deletions
diff --git a/behave_tests/features/steps/steps.py b/behave_tests/features/steps/steps.py
index 5762fa2..8798280 100644
--- a/behave_tests/features/steps/steps.py
+++ b/behave_tests/features/steps/steps.py
@@ -196,7 +196,6 @@ def step_impl(context, repeat=1):
results)
total_tx_rate = extract_value(context.result, "total_tx_rate")
- context.rates[context.json['frame_sizes'][0] + '_' + context.json['flow_count']] = total_tx_rate
overall = extract_value(context.result, "overall")
avg_delay_usec = extract_value(overall, "avg_delay_usec")
# create a synthesis with offered pps and latency values
diff --git a/nfvbench/config_plugin.py b/nfvbench/config_plugin.py
index 0596fcf..86e5505 100644
--- a/nfvbench/config_plugin.py
+++ b/nfvbench/config_plugin.py
@@ -91,7 +91,7 @@ class ConfigPlugin(ConfigPluginBase):
"""Return RunSpec for given platform."""
return specs.RunSpec(config.no_vswitch_access, openstack_spec)
- def validate_config(self, config, openstack_spec):
+ def validate_config(self, cfg, openstack_spec):
"""Nothing to validate by default."""
def prepare_results_config(self, cfg):
diff --git a/nfvbench/credentials.py b/nfvbench/credentials.py
index a707ba3..7562896 100644
--- a/nfvbench/credentials.py
+++ b/nfvbench/credentials.py
@@ -138,7 +138,8 @@ class Credentials(object):
if openrc_file:
if isinstance(openrc_file, str):
if os.path.exists(openrc_file):
- self.__parse_openrc(open(openrc_file))
+ with open(openrc_file) as rc_file:
+ self.__parse_openrc(rc_file)
else:
LOG.error('Error: rc file does not exist %s', openrc_file)
success = False
diff --git a/nfvbench/nfvbench.py b/nfvbench/nfvbench.py
index 0719247..740dca2 100644
--- a/nfvbench/nfvbench.py
+++ b/nfvbench/nfvbench.py
@@ -736,7 +736,8 @@ def main():
# dump the contents of the trex log file
if opts.show_trex_log:
try:
- print(open('/tmp/trex.log').read(), end="")
+ with open('/tmp/trex.log') as trex_log_file:
+ print(trex_log_file.read(), end="")
except FileNotFoundError:
print("No TRex log file found!")
sys.exit(0)
diff --git a/nfvbench/summarizer.py b/nfvbench/summarizer.py
index a4b02a6..7c69f52 100644
--- a/nfvbench/summarizer.py
+++ b/nfvbench/summarizer.py
@@ -577,9 +577,9 @@ class NFVBenchSummarizer(Summarizer):
lat_map['lat_' + str(percentile) + '_percentile'] = \
str(percentile) + ' %ile lat.'
- for key in lat_map:
+ for lat_value in lat_map.values():
# 'append' expects a single parameter => double parentheses
- header.append((lat_map[key], Formatter.standard))
+ header.append((lat_value, Formatter.standard))
table = Table(header)
for chain in sorted(list(chains.keys()), key=str):
@@ -633,9 +633,9 @@ class NFVBenchSummarizer(Summarizer):
run_specific_data['pdr'] = data['pdr']
run_specific_data['pdr']['drop_limit'] = self.config['measurement']['PDR']
del data['pdr']
- for key in run_specific_data:
+ for data_value in run_specific_data.values():
data_to_send = data.copy()
- data_to_send.update(run_specific_data[key])
+ data_to_send.update(data_value)
self.sender.record_send(data_to_send)
self.__record_init()
diff --git a/nfvbench/traffic_server.py b/nfvbench/traffic_server.py
index 53f4f39..2c85286 100644
--- a/nfvbench/traffic_server.py
+++ b/nfvbench/traffic_server.py
@@ -72,8 +72,8 @@ class TRexTrafficServer(TrafficServer):
hdrh_opt,
mbuf_opt, cfg)]
LOG.info(' '.join(cmd))
- subprocess.Popen(cmd, cwd=self.trex_dir)
- LOG.info('TRex server is running...')
+ with subprocess.Popen(cmd, cwd=self.trex_dir) as trex_process:
+ LOG.info('TRex server is running (PID: %s)...', trex_process.pid)
def __load_config(self, filename):
result = {}
diff --git a/test/test_nfvbench.py b/test/test_nfvbench.py
index 360e3bd..e48fbda 100644
--- a/test/test_nfvbench.py
+++ b/test/test_nfvbench.py
@@ -34,8 +34,8 @@ from nfvbench.traffic_client import GeneratorConfig
from nfvbench.traffic_client import IpBlock
from nfvbench.traffic_client import TrafficClient
from nfvbench.traffic_client import TrafficClientException
-import nfvbench.traffic_gen.traffic_utils as traffic_utils
-import nfvbench.utils as utils
+from nfvbench.traffic_gen import traffic_utils
+from nfvbench import utils
# just to get rid of the unused function warning
no_op()