3 # Copyright 2016 AT&T Intellectual Property, Inc
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
21 import functest.utils.functest_logger as ft_logger
22 import functest.utils.functest_utils as functest_utils
23 import functest.utils.functest_constants as ft_constants
25 parser = argparse.ArgumentParser()
26 parser.add_argument("-r", "--report",
27 help="Create json result file",
29 args = parser.parse_args()
31 COPPER_REPO_DIR = ft_constants.COPPER_REPO_DIR
32 RESULTS_DIR = ft_constants.FUNCTEST_RESULTS_DIR
34 logger = ft_logger.Logger("copper").getLogger()
38 cmd = "%s/tests/run.sh %s/tests" % (COPPER_REPO_DIR, COPPER_REPO_DIR)
40 start_time = time.time()
42 log_file = RESULTS_DIR + "/copper.log"
43 ret_val = functest_utils.execute_command(cmd,
46 stop_time = time.time()
47 duration = round(stop_time - start_time, 1)
49 logger.info("COPPER PASSED")
52 logger.info("COPPER FAILED")
56 'timestart': start_time,
58 'status': test_status,
60 functest_utils.logger_test_results("Copper",
61 "copper-notification",
62 details['status'], details)
65 functest_utils.push_results_to_db("copper",
66 "copper-notification",
71 logger.info("COPPER results pushed to DB")
73 logger.error("Error pushing results into Database '%s'"
82 if __name__ == '__main__':