aboutsummaryrefslogtreecommitdiffstats
path: root/nfvbench
diff options
context:
space:
mode:
Diffstat (limited to 'nfvbench')
-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
5 files changed, 11 insertions, 9 deletions
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 = {}