From 690d329a91af99777a0d48cdd2ea84ac7e803c0e Mon Sep 17 00:00:00 2001 From: MatthewLi Date: Wed, 12 Oct 2016 05:17:29 -0400 Subject: preparation for setup.py JIRA: DOVETAIL-26 1)change the directory scripts to dovetail, to make it unified in OPNFV and for setup.py 2)change the paths accordingly 3)this should be first merged, since docker is changed, then to add setup.py and run the local test Change-Id: I65974bde17f310ebbfe3c025532b05dae8752945 Signed-off-by: MatthewLi --- scripts/run.py | 84 ---------------------------------------------------------- 1 file changed, 84 deletions(-) delete mode 100755 scripts/run.py (limited to 'scripts/run.py') diff --git a/scripts/run.py b/scripts/run.py deleted file mode 100755 index 85871fab..00000000 --- a/scripts/run.py +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/env python -# -# grakiss.wanglei@huawei.com -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -# - - -import click -import yaml -import os -import time - -import utils.dovetail_logger as dt_logger -import utils.dovetail_utils as dt_utils - - -from container import Container -from testcase import * -from report import * -from conf.dovetail_config import * - -logger = dt_logger.Logger('run.py').getLogger() - -def load_scenario(scenario): - Scenario.load() - return Scenario.get(SCENARIO_NAMING_FMT % scenario) - -def load_testcase(): - Testcase.load() - -def run_test(scenario): - for testcase_name in scenario['testcase_list']: - logger.info('>>[testcase]: %s' % (testcase_name)) - testcase = Testcase.get(testcase_name) - run_testcase = True - - if testcase.exceed_max_retry_times(): - run_testcase = False - - if testcase.script_result_acquired(): - run_testcase = False - - if run_testcase: - Container.pull_image(testcase.script_type()) - container_id = Container.create(testcase.script_type()) - logger.debug('container id:%s' % container_id) - - if not Testcase.prepared(testcase.script_type()): - cmds = Testcase.pre_condition(testcase.script_type())['cmds'] - if cmds: - for cmd in cmds: - Container.exec_cmd(container_id, cmd) - Testcase.prepared(testcase.script_type(),True) - - if not testcase.prepare_cmd(): - logger.error('failed to prepare testcase:%s' % testcase.name()) - else: - for cmd in testcase.cmds: - Container.exec_cmd(container_id, cmd) - - #testcase.post_condition() - - Container.clean(container_id) - - db_result = Report.get_result(testcase) - Report.check_result(testcase, db_result) - -@click.command() -@click.option('--scenario', default='basic', help='certification scenario') -def main(scenario): - """Dovetail certification test entry!""" - logger.info('=======================================') - logger.info('Dovetail certification: %s!' % scenario) - logger.info('=======================================') - load_testcase() - scenario_yaml = load_scenario(scenario) - run_test(scenario_yaml) - Report.generate(scenario_yaml) - -if __name__ == '__main__': - main() -- cgit 1.2.3-korg