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
"""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):
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
# 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)
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):
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()
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 = {}
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()