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
19 import functest.utils.functest_logger as ft_logger
20 import functest.utils.functest_utils as functest_utils
23 parser = argparse.ArgumentParser()
24 parser.add_argument("-r", "--report",
25 help="Create json result file",
27 args = parser.parse_args()
29 functest_yaml = functest_utils.get_functest_yaml()
31 dirs = functest_yaml.get('general').get('directories')
32 DOCTOR_REPO = dirs.get('dir_repo_doctor')
33 RESULTS_DIR = functest_utils.get_parameter_from_yaml(
34 'general.directories.dir_results')
36 logger = ft_logger.Logger("doctor").getLogger()
41 cmd = 'cd %s/tests && ./run.sh' % DOCTOR_REPO
42 log_file = RESULTS_DIR + "/doctor.log"
44 start_time = time.time()
46 ret = functest_utils.execute_command(cmd,
51 stop_time = time.time()
52 duration = round(stop_time - start_time, 1)
54 logger.info("Doctor test case OK")
58 logger.info("Doctor test case FAILED")
62 'timestart': start_time,
64 'status': test_status,
67 if details['status'] == "OK":
69 functest_utils.logger_test_results("Doctor",
70 "doctor-notification",
73 functest_utils.push_results_to_db("doctor",
74 "doctor-notification",
79 logger.info("Doctor results pushed to DB")
83 if __name__ == '__main__':