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
22 import functest.utils.functest_constants as ft_constants
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()
32 DOCTOR_REPO_DIR = ft_constants.DOCTOR_REPO_DIR
33 RESULTS_DIR = ft_constants.FUNCTEST_RESULTS_DIR
35 logger = ft_logger.Logger("doctor").getLogger()
41 # if the image name is explicitly set for the doctor suite, set it as
43 if 'doctor' in functest_yaml and 'image_name' in functest_yaml['doctor']:
44 os.environ["IMAGE_NAME"] = functest_yaml['doctor']['image_name']
46 cmd = 'cd %s/tests && ./run.sh' % DOCTOR_REPO_DIR
47 log_file = RESULTS_DIR + "/doctor.log"
49 start_time = time.time()
51 ret = functest_utils.execute_command(cmd,
55 stop_time = time.time()
56 duration = round(stop_time - start_time, 1)
58 logger.info("Doctor test case OK")
62 logger.info("Doctor test case FAILED")
66 'timestart': start_time,
68 'status': test_status,
71 if details['status'] == "OK":
73 functest_utils.logger_test_results("Doctor",
74 "doctor-notification",
77 functest_utils.push_results_to_db("doctor",
78 "doctor-notification",
83 logger.info("Doctor results pushed to DB")
88 if __name__ == '__main__':