def run(self, opts, args):
status = NFVBench.STATUS_OK
result = None
message = ''
if fluent_logger:
# take a snapshot of the current time for this new run
# so that all subsequent logs can relate to this run
fluent_logger.start_new_run()
LOG.info(args)
try:
self.update_config(opts)
self.setup()
result = {
"date": datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
"nfvbench_version": __version__,
"openstack_spec": {
"vswitch": self.specs.openstack.vswitch,
"encaps": self.specs.openstack.encaps
},
"config": self.config_plugin.prepare_results_config(copy.deepcopy(self.config)),
"benchmarks": {
"network": {
"service_chain": self.chain_runner.run(),
"versions": self.chain_runner.get_version(),
}
}
}
result['benchmarks']['network']['versions'].update(self.config_plugin.get_version())
except Exception:
status = NFVBench.STATUS_ERROR
message = traceback.format_exc()
except KeyboardInterrupt:
status = NFVBench.STATUS_ERROR
message = traceback.format_exc()
finally:
if self.chain_runner:
self.chain_runner.close()
if status == NFVBench.STATUS_OK:
result = utils.dict_to_json_dict(result)
return {
'status': status,
'result': result
}
return {
'status': status,
'error_message': message
}
评论列表
文章目录