From c7e43d91f4a6babaff1f373b0a7ed102a876e7d3 Mon Sep 17 00:00:00 2001 From: liyin Date: Wed, 7 Mar 2018 03:47:28 +0000 Subject: bottlenecks offiline support JIRA: BOTTLENECK-224 This patch for bottlenecks support offiline. By use some offiline image rather than yardstick env prepare. This will solve some problem happened in yardstick image builder. Change-Id: I62b6606570c2ea6ce365212c79777af01c47c9a6 Signed-off-by: liyin (cherry picked from commit adf6a02bae295455f584ebab762592dd57e2422c) --- .../testcase_cfg/posca_factor_multistack_storage.yaml | 3 ++- .../posca_factor_multistack_storage_parallel.yaml | 5 +++-- .../testcase_script/posca_factor_multistack_storage.py | 12 ++++++------ .../posca_factor_multistack_storage_parallel.py | 12 ++++++------ testsuites/posca/testcase_script/posca_factor_ping.py | 18 +++++++++++------- .../testcase_script/posca_feature_testpmd_scale_up.py | 5 ----- .../testcase_script/posca_feature_vnf_scale_out.py | 10 +--------- testsuites/run_testsuite.py | 9 +++++---- 8 files changed, 34 insertions(+), 40 deletions(-) (limited to 'testsuites') diff --git a/testsuites/posca/testcase_cfg/posca_factor_multistack_storage.yaml b/testsuites/posca/testcase_cfg/posca_factor_multistack_storage.yaml index 95edd86e..e2f48438 100644 --- a/testsuites/posca/testcase_cfg/posca_factor_multistack_storage.yaml +++ b/testsuites/posca/testcase_cfg/posca_factor_multistack_storage.yaml @@ -14,13 +14,14 @@ load_manager: #this "rw" value could be write read rw rr or randrw rw: 'randrw' bs: '4k' - size: '50g' + size: '20g' rwmixwrite: '50' num_thread: 1, 2 num_stack: 1 volume_num: '1' num_jobs: '1' direct: '1' + volume_size: 50 runners: stack_create: yardstick diff --git a/testsuites/posca/testcase_cfg/posca_factor_multistack_storage_parallel.yaml b/testsuites/posca/testcase_cfg/posca_factor_multistack_storage_parallel.yaml index 44147db8..b55b826c 100644 --- a/testsuites/posca/testcase_cfg/posca_factor_multistack_storage_parallel.yaml +++ b/testsuites/posca/testcase_cfg/posca_factor_multistack_storage_parallel.yaml @@ -13,12 +13,13 @@ load_manager: # for this option we provide " write, read, rw, rr" rw: "randrw" bs: "4k" - size: "50g" + size: "20g" rwmixwrite: "50" num_stack: 1, 3 volume_num: "1" num_jobs: "1" direct: "1" + volume_size: 50 runners: stack_create: yardstick @@ -29,4 +30,4 @@ load_manager: contexts: dashboard: "Bottlenecks-ELK" yardstick: "Bottlenecks-Yardstick" - yardstick_envpre: True \ No newline at end of file + yardstick_envpre: True diff --git a/testsuites/posca/testcase_script/posca_factor_multistack_storage.py b/testsuites/posca/testcase_script/posca_factor_multistack_storage.py index db4cb736..34ee225c 100644 --- a/testsuites/posca/testcase_script/posca_factor_multistack_storage.py +++ b/testsuites/posca/testcase_script/posca_factor_multistack_storage.py @@ -54,11 +54,9 @@ def env_pre(test_config): test_yardstick = True stack_prepare._prepare_env_daemon(test_yardstick) quota_prepare.quota_env_prepare() - cmd = ('yardstick env prepare') LOG.info("yardstick environment prepare!") if(test_config["contexts"]['yardstick_envpre']): - yardstick_container = docker_env.yardstick_info['container'] - stdout = docker_env.docker_exec_cmd(yardstick_container, cmd) + stdout = yardstick_task.yardstick_image_prepare() LOG.debug(stdout) @@ -83,11 +81,11 @@ def do_test(test_config): loop_value = loop_value + 1 with open(out_file) as f: data = json.load(f) - if data["status"] == 1: + if data["result"]["criteria"] == "PASS": LOG.info("yardstick run success") LOG.info("%s" % data["result"]["testcases"]) break - elif data["status"] == 2: + else: LOG.error("yardstick error exit") break @@ -192,6 +190,7 @@ def run(test_config): numjobs = scenarios_conf["num_jobs"] direct = scenarios_conf["direct"] volume_num = scenarios_conf["volume_num"] + volume_size = scenarios_conf["volume_size"] for value in test_num: result = [] @@ -211,7 +210,8 @@ def run(test_config): "size": size, "rwmixwrite": rwmixwrite, "numjobs": numjobs, - "direct": direct} + "direct": direct, + "volume_size": int(volume_size)} tmp_thread = threading.Thread(target=func_run, args=(case_config,)) threadings.append(tmp_thread) tmp_thread.start() diff --git a/testsuites/posca/testcase_script/posca_factor_multistack_storage_parallel.py b/testsuites/posca/testcase_script/posca_factor_multistack_storage_parallel.py index 58f9dc8c..8c623d41 100644 --- a/testsuites/posca/testcase_script/posca_factor_multistack_storage_parallel.py +++ b/testsuites/posca/testcase_script/posca_factor_multistack_storage_parallel.py @@ -50,10 +50,8 @@ def env_pre(test_config): stack_prepare._prepare_env_daemon(test_yardstick) quota_prepare.quota_env_prepare() if(test_config["contexts"]['yardstick_envpre']): - cmd = ('yardstick env prepare') LOG.info("yardstick environment prepare!") - yardstick_container = docker_env.yardstick_info['container'] - stdout = docker_env.docker_exec_cmd(yardstick_container, cmd) + stdout = yardstick_task.yardstick_image_prepare() LOG.debug(stdout) @@ -78,11 +76,11 @@ def do_test(test_config): loop_value = loop_value + 1 with open(out_file) as f: data = json.load(f) - if data["status"] == 1: + if data["result"]["criteria"] == "PASS": LOG.info("yardstick run success") LOG.info("%s" % data["result"]["testcases"]) break - elif data["status"] == 2: + else: LOG.error("yardstick error exit") break @@ -140,6 +138,7 @@ def run(test_config): numjobs = scenarios_conf["num_jobs"] direct = scenarios_conf["direct"] volume_num = scenarios_conf["volume_num"] + volume_size = scenarios_conf["volume_size"] result = [] @@ -151,7 +150,8 @@ def run(test_config): "size": size, "rwmixwrite": rwmixwrite, "numjobs": numjobs, - "direct": direct} + "direct": direct, + "volume_size": int(volume_size)} data_reply = do_test(case_config) result.append(data_reply) diff --git a/testsuites/posca/testcase_script/posca_factor_ping.py b/testsuites/posca/testcase_script/posca_factor_ping.py index 3a2277cf..ea79d3ad 100644 --- a/testsuites/posca/testcase_script/posca_factor_ping.py +++ b/testsuites/posca/testcase_script/posca_factor_ping.py @@ -23,6 +23,7 @@ import Queue from utils.parser import Parser as conf_parser import utils.env_prepare.quota_prepare as quota_prepare import utils.env_prepare.stack_prepare as stack_prepare +import utils.infra_setup.runner.yardstick as runner_yardstick import testsuites.posca.testcase_dashboard.posca_stress_ping as DashBoard import utils.infra_setup.runner.docker_env as docker_env @@ -42,6 +43,8 @@ test_dict = { } testfile = os.path.basename(__file__) testcase, file_format = os.path.splitext(testfile) +cidr = "/home/opnfv/repos/yardstick/samples/storage_bottlenecks.yaml" +runner_DEBUG = True q = Queue.Queue() @@ -52,20 +55,21 @@ def env_pre(test_config): test_yardstick = True stack_prepare._prepare_env_daemon(test_yardstick) quota_prepare.quota_env_prepare() - cmd = ('yardstick env prepare') LOG.info("yardstick environment prepare!") if(test_config["contexts"]['yardstick_envpre']): - yardstick_container = docker_env.yardstick_info['container'] - stdout = docker_env.docker_exec_cmd(yardstick_container, cmd) + stdout = runner_yardstick.yardstick_image_prepare() LOG.debug(stdout) def do_test(): func_name = sys._getframe().f_code.co_name out_file = ("/tmp/yardstick_" + str(uuid.uuid4()) + ".out") + parameter_info = {} yardstick_container = docker_env.yardstick_info['container'] - cmd = ('yardstick task start /home/opnfv/repos/yardstick/' - 'samples/ping_bottlenecks.yaml --output-file ' + out_file) + cmd = runner_yardstick.yardstick_command_parser(debug=runner_DEBUG, + cidr=cidr, + outfile=out_file, + parameter=parameter_info) stdout = docker_env.docker_exec_cmd(yardstick_container, cmd) LOG.info(stdout) out_value = 0 @@ -75,11 +79,11 @@ def do_test(): loop_value = loop_value + 1 with open(out_file) as f: data = json.load(f) - if data["status"] == 1: + if data["result"]["criteria"] == "PASS": LOG.info("yardstick run success") out_value = 1 break - elif data["status"] == 2: + else: LOG.error("yardstick error exit") out_value = 0 break diff --git a/testsuites/posca/testcase_script/posca_feature_testpmd_scale_up.py b/testsuites/posca/testcase_script/posca_feature_testpmd_scale_up.py index 830ff73f..08c4cbe9 100644 --- a/testsuites/posca/testcase_script/posca_feature_testpmd_scale_up.py +++ b/testsuites/posca/testcase_script/posca_feature_testpmd_scale_up.py @@ -81,14 +81,10 @@ def do_test(test_config, Use_Dashboard, context_conf): elif data["status"] == 2: LOG.error("yardstick error exit") exit() - # data = json.load(output) save_data = config_to_result(test_config, data) if Use_Dashboard is True: print("use dashboard") - # DashBoard.dashboard_send_data(context_conf, save_data) - - # return save_data["data_body"] return save_data @@ -108,7 +104,6 @@ def run(test_config): conf_parser.ip_parser("dashboard") LOG.info("Create Dashboard data") Use_Dashboard = True - # DashBoard.dashboard_system_bandwidth(test_config["contexts"]) cpus = conf_parser.str_to_list(scenarios_conf["cpus"]) mems = conf_parser.str_to_list(scenarios_conf["mems"]) diff --git a/testsuites/posca/testcase_script/posca_feature_vnf_scale_out.py b/testsuites/posca/testcase_script/posca_feature_vnf_scale_out.py index 6d53515f..417cf2b9 100644 --- a/testsuites/posca/testcase_script/posca_feature_vnf_scale_out.py +++ b/testsuites/posca/testcase_script/posca_feature_vnf_scale_out.py @@ -46,12 +46,9 @@ def env_pre(test_config): print(test_yardstick) stack_prepare._prepare_env_daemon(test_yardstick) quota_prepare.quota_env_prepare() - cmd = ('yardstick env prepare') LOG.info("yardstick environment prepare!") - print docker_env.yardstick_info['container'] if(test_config["contexts"]['yardstick_envpre']): - yardstick_container = docker_env.yardstick_info['container'] - stdout = docker_env.docker_exec_cmd(yardstick_container, cmd) + stdout = yardstick_task.yardstick_image_prepare() LOG.debug(stdout) @@ -99,16 +96,11 @@ def do_test(test_config, Use_Dashboard, context_conf): elif data["status"] == 2: LOG.error("yardstick error exit") exit() - # data = json.load(output) save_data = config_to_result(test_config, data) - print("^^^^^^^^^^^^^^^^^^^^^^^^^") - print save_data if Use_Dashboard is True: print("use dashboard") - # DashBoard.dashboard_send_data(context_conf, save_data) - # return save_data["data_body"] return save_data diff --git a/testsuites/run_testsuite.py b/testsuites/run_testsuite.py index 2e82b205..e0f46248 100644 --- a/testsuites/run_testsuite.py +++ b/testsuites/run_testsuite.py @@ -107,10 +107,11 @@ def testsuite_run(test_level, test_name, REPORT="False"): conf_parser.Parser.testcase_out_dir(testcase) start_date = datetime.datetime.now() docker_env_prepare(config[testcase]) - try: - posca_testcase_run(tester_parser[0], testcase, config[testcase]) - except Exception, e: - LOG.warning('e.message:\t%s', e.message) + #try: + # posca_testcase_run(tester_parser[0], testcase, config[testcase]) + #except Exception, e: + # LOG.warning('e.message:\t%s', e.message) + posca_testcase_run(tester_parser[0], testcase, config[testcase]) stop_date = datetime.datetime.now() LOG.info("End of %s testcase in POSCA testsuite", testcase) criteria = "FAIL" -- cgit 1.2.3-korg