3 # Copyright (c) 2015 All rights reserved
4 # This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # 0.1: This script boots the VM1 and allocates IP address from Nova
11 # Later, the VM2 boots then execute cloud-init to ping VM1.
12 # After successful ping, both the VMs are deleted.
13 # 0.2: measure test duration and publish results under json format
20 import functest.utils.functest_logger as ft_logger
21 import functest.utils.functest_utils as functest_utils
24 parser = argparse.ArgumentParser()
25 parser.add_argument("-r", "--report",
26 help="Create json result file",
28 args = parser.parse_args()
30 functest_yaml = functest_utils.get_functest_yaml()
33 functest_utils.get_functest_config('general.directories.dir_repo_doctor')
35 functest_utils.get_functest_config('general.directories.dir_results')
37 logger = ft_logger.Logger("doctor").getLogger()
43 # if the image name is explicitly set for the doctor suite, set it as
45 if 'doctor' in functest_yaml and 'image_name' in functest_yaml['doctor']:
46 os.environ["IMAGE_NAME"] = functest_yaml['doctor']['image_name']
48 cmd = 'cd %s/tests && ./run.sh' % DOCTOR_REPO
49 log_file = RESULTS_DIR + "/doctor.log"
51 start_time = time.time()
53 ret = functest_utils.execute_command(cmd,
58 stop_time = time.time()
59 duration = round(stop_time - start_time, 1)
61 logger.info("Doctor test case OK")
65 logger.info("Doctor test case FAILED")
69 'timestart': start_time,
71 'status': test_status,
74 if details['status'] == "OK":
76 functest_utils.logger_test_results("Doctor",
77 "doctor-notification",
80 functest_utils.push_results_to_db("doctor",
81 "doctor-notification",
86 logger.info("Doctor results pushed to DB")
90 if __name__ == '__main__':