- client = docker.from_env()
- con = client.containers.get('bottleneckcompose_yardstick_1')
- cmd = ('yardstick task start /home/opnfv/repos/yardstick/'
- 'samples/ping_bottlenecks.yaml --output-file ' + out_file)
- stdout = con.exec_run(cmd)
- LOG.debug(stdout)
- with open(out_file) as f:
- data = json.load(f)
- if data["status"] == 1:
- LOG.info("yardstick run success")
- out_value = 1
- else:
- LOG.error("yardstick error exit")
- out_value = 0
- os.remove(out_file)
+ parameter_info = {}
+ yardstick_container = docker_env.yardstick_info['container']
+ cmd = runner_yardstick.yardstick_command_parser(debug=runner_DEBUG,
+ cidr=cidr,
+ outfile=out_file,
+ parameter=parameter_info)
+ stdout = docker_env.docker_exec_cmd(yardstick_container, cmd)
+ LOG.info(stdout)
+ out_value = 0
+ loop_value = 0
+ while loop_value < 60:
+ time.sleep(2)
+ loop_value = loop_value + 1
+ with open(out_file) as f:
+ data = json.load(f)
+ if data["result"]["criteria"] == "PASS":
+ LOG.info("yardstick run success")
+ out_value = 1
+ break
+ else:
+ LOG.error("yardstick error exit")
+ out_value = 0
+ break
+ q.put((out_value, func_name))