From bde702f95563cf953c32f9bfd0587083a3fea26d Mon Sep 17 00:00:00 2001 From: liyin Date: Thu, 13 Jul 2017 11:54:08 +0800 Subject: Add frame support of elk one docker support JIRA: BOTTLENECK-171 Add support of Bottlenecks docker frame refact, After this patch we will provide the ability of several installer. Add Yardstick_TAG to adjust yardstick docker version Change-Id: Ib431f8acf4a76b59f9d5e8783bcc7d2e5be208ae Signed-off-by: liyin --- config/config.yaml | 1 + run_tests.sh | 2 +- testsuites/posca/run_posca.py | 109 ----------------- .../posca/testcase_cfg/posca_factor_ping.yaml | 10 +- .../posca/testcase_script/posca_factor_ping.py | 70 ++++++----- testsuites/run_testsuite.py | 129 +++++++++++++++++++++ utils/env_prepare/quota_prepare.py | 3 +- utils/env_prepare/stack_prepare.py | 30 +++-- utils/infra_setup/runner/docker_env.py | 121 +++++++++++++++++++ utils/infra_setup/runner/docker_usage.py | 91 --------------- utils/parser.py | 12 ++ 11 files changed, 335 insertions(+), 243 deletions(-) delete mode 100755 testsuites/posca/run_posca.py create mode 100644 testsuites/run_testsuite.py create mode 100644 utils/infra_setup/runner/docker_env.py delete mode 100644 utils/infra_setup/runner/docker_usage.py diff --git a/config/config.yaml b/config/config.yaml index 19ffa4ce..14a44be7 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -10,5 +10,6 @@ common_config: log_dir: '/tmp/' rc_dir: '/tmp/admin_rc.sh' + yardstick_rc_dir: '/etc/yardstick/openstack.creds' releng_dir: '/home/opnfv/releng' fetch_os_file: 'utils/fetch_os_creds.sh' \ No newline at end of file diff --git a/run_tests.sh b/run_tests.sh index 41104208..b92e9f29 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -109,7 +109,7 @@ function run_test(){ docker pull tutum/influxdb:0.13 sleep 5 info "Running posca $test_level: $test_exec" - docker exec bottleneckcompose_bottlenecks_1 python ${POSCA_SUITE}/run_posca.py $test_level $test_exec $REPORT + docker exec bottleneckcompose_bottlenecks_1 python ${POSCA_SUITE}/../run_testsuite.py $test_level $test_exec $REPORT ;; esac } diff --git a/testsuites/posca/run_posca.py b/testsuites/posca/run_posca.py deleted file mode 100755 index b1dba140..00000000 --- a/testsuites/posca/run_posca.py +++ /dev/null @@ -1,109 +0,0 @@ -#!/usr/bin/env python -############################################################################## -# Copyright (c) 2016 Huawei Technologies Co.,Ltd and others. -# -# 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 -############################################################################## -'''This file realize the function of how to run posca. -In this file, The first thing is to read testcase config -for example: you could run this by use -posca_run('testcase', "Which testcase you will run") -posca_run('teststory', "Which story you will run") -and if you run "python run_posca", this will run testcase, -posca_factor_system_bandwidth by default.''' - -import importlib -import sys -import os - -from oslo_serialization import jsonutils -import json -import requests -import datetime - -import utils.parser as conf_parser -import utils.logger as log -INTERPRETER = "/usr/bin/python" - -LOG = log.Logger(__name__).getLogger() -# ------------------------------------------------------ -# run testcase in posca -# ------------------------------------------------------ - - -def posca_testcase_run(testcase_script, test_config): - - module_string = "testsuites.posca.testcase_script.%s" % (testcase_script) - module = importlib.import_module(module_string) - module.run(test_config) - - -def report(testcase, start_date, stop_date, criteria, details_doc): - headers = {'Content-type': 'application/json'} - results = { - "project_name": "bottlenecks", - "case_name": testcase, - "description": ("test results for " + testcase), - "pod_name": os.environ.get('NODE_NAME', 'unknown'), - "installer": os.environ.get('INSTALLER_TYPE', 'unknown'), - "version": os.environ.get('BRANCH', 'unknown'), - "build_tag": os.environ.get('BUILD_TAG', 'unknown'), - "stop_date": str(stop_date), - "start_date": str(start_date), - "criteria": criteria, - "scenario": os.environ.get('DEPLOY_SCENARIO', 'unknown') - } - results['details'] = {"test_results": details_doc} - - target = "http://testresults.opnfv.org/test/api/v1/results" - timeout = 5 - - try: - LOG.debug('Test result : %s', jsonutils.dump_as_bytes(results)) - res = requests.post(target, - data=jsonutils.dump_as_bytes(results), - headers=headers, - timeout=timeout) - LOG.debug('Test result posting finished with status code' - ' %d.' % res.status_code) - except Exception as err: - LOG.exception('Failed to record result data: %s', err) - - -def posca_run(test_level, test_name, REPORT="False"): - if test_level == "testcase": - config = conf_parser.Parser.testcase_read("posca", test_name) - elif test_level == "teststory": - config = conf_parser.Parser.story_read("posca", test_name) - for testcase in config: - LOG.info("Begin to run %s testcase in POSCA testsuite", testcase) - config[testcase]['out_file'] =\ - conf_parser.Parser.testcase_out_dir(testcase) - start_date = datetime.datetime.now() - posca_testcase_run(testcase, config[testcase]) - stop_date = datetime.datetime.now() - LOG.info("End of %s testcase in POSCA testsuite", testcase) - - criteria = "FAIL" - if REPORT == "True": - details_doc = [] - if os.path.exists(config[testcase]['out_file']): - with open(config[testcase]['out_file']) as details_result: - details_doc =[json.loads(data) for data in details_result.readlines()] # noqa - if len(details_doc): - criteria = "PASS" - report(testcase, start_date, stop_date, criteria, details_doc) - - -def main(): - test_level = sys.argv[1] - test_name = sys.argv[2] - REPORT = sys.argv[3] - posca_run(test_level, test_name, REPORT) - - -if __name__ == '__main__': - main() diff --git a/testsuites/posca/testcase_cfg/posca_factor_ping.yaml b/testsuites/posca/testcase_cfg/posca_factor_ping.yaml index 7e6bf027..ed1e3475 100644 --- a/testsuites/posca/testcase_cfg/posca_factor_ping.yaml +++ b/testsuites/posca/testcase_cfg/posca_factor_ping.yaml @@ -19,13 +19,13 @@ load_manager: num_stack: 5, 10, 20 package_loss: 10% - contexts: + runners: stack_create: yardstick flavor: - yardstick_test_ip: yardstick_test_dir: "samples" yardstick_testcase: "ping_bottlenecks" -dashboard: - dashboard: "y" - dashboard_ip: +contexts: + dashboard: "Bottlenecks-ELK" + yardstick: "Bottlenecks-Yardstick" + yardstick_envpre: True diff --git a/testsuites/posca/testcase_script/posca_factor_ping.py b/testsuites/posca/testcase_script/posca_factor_ping.py index 732422ea..5f56cdae 100644 --- a/testsuites/posca/testcase_script/posca_factor_ping.py +++ b/testsuites/posca/testcase_script/posca_factor_ping.py @@ -15,13 +15,15 @@ import utils.logger as log import uuid import json import os +import time import multiprocessing -import docker import datetime 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 testsuites.posca.testcase_dashboard.posca_stress_ping as DashBoard +import utils.infra_setup.runner.docker_env as docker_env # -------------------------------------------------- # logging configuration # -------------------------------------------------- @@ -40,34 +42,44 @@ testfile = os.path.basename(__file__) testcase, file_format = os.path.splitext(testfile) -def env_pre(con_dic): - stack_prepare._prepare_env_daemon() +def env_pre(test_config): + test_yardstick = False + if "yardstick" in test_config["contexts"].keys(): + test_yardstick = True + stack_prepare._prepare_env_daemon(test_yardstick) quota_prepare.quota_env_prepare() - client = docker.from_env() - con = client.containers.get('bottleneckcompose_yardstick_1') cmd = ('yardstick env prepare') LOG.info("yardstick envrionment prepare!") - stdout = con.exec_run(cmd) - LOG.debug(stdout) + if(test_config["contexts"]['yardstick_envpre']): + yardstick_container = docker_env.yardstick_info['container'] + stdout = docker_env.docker_exec_cmd(yardstick_container, cmd) + LOG.debug(stdout) def do_test(test_config, con_dic): out_file = ("/tmp/yardstick_" + str(uuid.uuid4()) + ".out") - client = docker.from_env() - con = client.containers.get('bottleneckcompose_yardstick_1') + yardstick_container = docker_env.yardstick_info['container'] cmd = ('yardstick task start /home/opnfv/repos/yardstick/' 'samples/ping_bottlenecks.yaml --output-file ' + out_file) - stdout = con.exec_run(cmd) - LOG.debug(stdout) - with open(out_file) as f: - data = json.load(f) - if data["status"] == 1: - LOG.info("yardstick run success") - out_value = 1 - else: - LOG.error("yardstick error exit") - out_value = 0 - os.remove(out_file) + stdout = docker_env.docker_exec_cmd(yardstick_container, cmd) + LOG.info(stdout) + out_value = 0 + loop_walue = 0 + while loop_walue < 150: + time.sleep(2) + with open(out_file) as f: + loop_walue = loop_walue + 1 + data = json.load(f) + if data["status"] == 1: + if data["result"]["criteria"] == "PASS": + LOG.info("yardstick run success") + out_value = 1 + else: + LOG.error("task error exit") + out_value = 0 + break + elif data["status"] == 2: + LOG.error("yardstick error exit") return out_value @@ -92,19 +104,19 @@ def func_run(condic): def run(test_config): con_dic = test_config["load_manager"] test_num = con_dic['scenarios']['num_stack'].split(',') - if con_dic["contexts"]["yardstick_test_ip"] is None: - con_dic["contexts"]["yardstick_test_ip"] =\ + if test_config["contexts"]["yardstick_ip"] is None: + con_dic["contexts"]["yardstick_ip"] =\ conf_parser.ip_parser("yardstick_test_ip") - if test_config["dashboard"]["dashboard"] == 'y': - if test_config["dashboard"]["dashboard_ip"] is None: - test_config["dashboard"]["dashboard_ip"] =\ + if "dashboard" in test_config["contexts"].keys(): + if test_config["contexts"]["dashboard_ip"] is None: + test_config["contexts"]["dashboard_ip"] =\ conf_parser.ip_parser("dashboard") LOG.info("Create Dashboard data") - DashBoard.posca_stress_ping(test_config["dashboard"]) + DashBoard.posca_stress_ping(test_config["contexts"]) LOG.info("bottlenecks envrionment prepare!") - env_pre(con_dic) + env_pre(test_config) LOG.info("yardstick envrionment prepare done!") for value in test_num: @@ -127,8 +139,8 @@ def run(test_config): during_date = (endtime - starttime).seconds data_reply = config_to_result(num, out_num, during_date) - if test_config['dashboard']['dashboard'] == 'y': - DashBoard.dashboard_send_data(test_config['dashboard'], data_reply) + if "dashboard" in test_config["contexts"].keys(): + DashBoard.dashboard_send_data(test_config['contexts'], data_reply) conf_parser.result_to_file(data_reply, test_config["out_file"]) if out_num < num: diff --git a/testsuites/run_testsuite.py b/testsuites/run_testsuite.py new file mode 100644 index 00000000..7ec67eff --- /dev/null +++ b/testsuites/run_testsuite.py @@ -0,0 +1,129 @@ +#!/usr/bin/env python +############################################################################## +# Copyright (c) 2016 Huawei Technologies Co.,Ltd and others. +# +# 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 +############################################################################## +'''This file realize the function of how to run testsuite. +In this file, The first thing is to read testcase config +for example: you could run this by use +posca_run('testcase', "Which testcase you will run") +posca_run('teststory', "Which story you will run") +and if you run "python run_posca", this will run testcase, +posca_factor_system_bandwidth by default.''' + +import importlib +import sys +import os + +from oslo_serialization import jsonutils +import json +import time +import requests +import datetime + +import utils.parser as conf_parser +import utils.logger as log +import utils.infra_setup.runner.docker_env as docker_env +INTERPRETER = "/usr/bin/python" + +LOG = log.Logger(__name__).getLogger() +# ------------------------------------------------------ +# run testcase in posca +# ------------------------------------------------------ + + +def posca_testcase_run(testsuite, testcase_script, test_config): + + module_string = "testsuites.%s.testcase_script.%s" % (testsuite, + testcase_script) + module = importlib.import_module(module_string) + module.run(test_config) + + +def report(testcase, start_date, stop_date, criteria, details_doc): + headers = {'Content-type': 'application/json'} + results = { + "project_name": "bottlenecks", + "case_name": testcase, + "description": ("test results for " + testcase), + "pod_name": os.environ.get('NODE_NAME', 'unknown'), + "installer": os.environ.get('INSTALLER_TYPE', 'unknown'), + "version": os.environ.get('BRANCH', 'unknown'), + "build_tag": os.environ.get('BUILD_TAG', 'unknown'), + "stop_date": str(stop_date), + "start_date": str(start_date), + "criteria": criteria, + "scenario": os.environ.get('DEPLOY_SCENARIO', 'unknown') + } + results['details'] = {"test_results": details_doc} + + target = "http://testresults.opnfv.org/test/api/v1/results" + timeout = 5 + + try: + LOG.debug('Test result : %s', jsonutils.dump_as_bytes(results)) + res = requests.post(target, + data=jsonutils.dump_as_bytes(results), + headers=headers, + timeout=timeout) + LOG.debug('Test result posting finished with status code' + ' %d.' % res.status_code) + except Exception as err: + LOG.exception('Failed to record result data: %s', err) + + +def docker_env_prepare(config): + if 'contexts' in config.keys() and config["contexts"] is not None: + context_config = config["contexts"] + if 'yardstick' in context_config.keys() and \ + context_config["yardstick"] is not None: + docker_env.env_yardstick(context_config['yardstick']) + conf_parser.Parser.convert_docker_env(config, "yardstick") + if 'dashboard' in context_config.keys() and \ + context_config["dashboard"] is not None: + docker_env.env_elk(context_config['dashboard']) + conf_parser.Parser.convert_docker_env(config, "dashboard") + LOG.debug('Waiting for ELK init') + time.sleep(15) + return + + +def testsuite_run(test_level, test_name, REPORT="False"): + tester_parser = test_name.split("_") + if test_level == "testcase": + config = conf_parser.Parser.testcase_read(tester_parser[0], test_name) + elif test_level == "teststory": + config = conf_parser.Parser.story_read(tester_parser[0], test_name) + for testcase in config: + LOG.info("Begin to run %s testcase in POSCA testsuite", testcase) + config[testcase]['out_file'] =\ + conf_parser.Parser.testcase_out_dir(testcase) + start_date = datetime.datetime.now() + docker_env_prepare(config[testcase]) + 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" + if REPORT == "True": + details_doc = [] + if os.path.exists(config[testcase]['out_file']): + with open(config[testcase]['out_file']) as details_result: + details_doc =[json.loads(data) for data in details_result.readlines()] # noqa + if len(details_doc): + criteria = "PASS" + report(testcase, start_date, stop_date, criteria, details_doc) + + +def main(): + test_level = sys.argv[1] + test_name = sys.argv[2] + REPORT = sys.argv[3] + testsuite_run(test_level, test_name, REPORT) + + +if __name__ == '__main__': + main() diff --git a/utils/env_prepare/quota_prepare.py b/utils/env_prepare/quota_prepare.py index e52a3e32..850a46a4 100644 --- a/utils/env_prepare/quota_prepare.py +++ b/utils/env_prepare/quota_prepare.py @@ -21,7 +21,8 @@ neutron_quota = {"subnet": -1, "floatingip": -1, "subnetpool": -1, "router": -1, - "port": -1} + "port": -1, + "security_group": -1} nova_quota = {"ram": -1, "cores": -1, diff --git a/utils/env_prepare/stack_prepare.py b/utils/env_prepare/stack_prepare.py index 3c706fad..ce8da619 100644 --- a/utils/env_prepare/stack_prepare.py +++ b/utils/env_prepare/stack_prepare.py @@ -13,25 +13,41 @@ import errno from utils.logger import Logger from utils.parser import Parser as config import utils.infra_setup.heat.manager as utils +import utils.infra_setup.runner.docker_env as docker_env LOG = Logger(__name__).getLogger() -def _prepare_env_daemon(): - - installer_ip = os.environ.get('INSTALLER_IP', 'undefined') - installer_type = os.environ.get('INSTALLER_TYPE', 'undefined') +def _prepare_env_daemon(test_yardstick): rc_file = config.bottlenecks_config["rc_dir"] - _get_remote_rc_file(rc_file, installer_ip, installer_type) + if not os.path.exists(rc_file): + installer_ip = os.environ.get('INSTALLER_IP', 'undefined') + installer_type = os.environ.get('INSTALLER_TYPE', 'undefined') + _get_remote_rc_file(rc_file, installer_ip, installer_type) _source_file(rc_file) - # _append_external_network(rc_file) + if not os.environ.get("EXTERNAL_NETWORK"): + _append_external_network(rc_file) + if test_yardstick: + cmd = "cp %s %s" % (rc_file, + config.bottlenecks_config["yardstick_rc_dir"]) + yardstick_contain = docker_env.yardstick_info["container"] + docker_env.docker_exec_cmd(yardstick_contain, + cmd) # update the external_network - # _source_file(rc_file) + _source_file(rc_file) + + +def file_copy(src_file, dest_file): + src = file(src_file, "r+") + des = file(dest_file, "w+") + des.writelines(src.read()) + src.close() + des.close() def _get_remote_rc_file(rc_file, installer_ip, installer_type): diff --git a/utils/infra_setup/runner/docker_env.py b/utils/infra_setup/runner/docker_env.py new file mode 100644 index 00000000..1e8728eb --- /dev/null +++ b/utils/infra_setup/runner/docker_env.py @@ -0,0 +1,121 @@ +#!/usr/bin/env python +############################################################################## +# Copyright (c) 2017 Huawei Technologies Co.,Ltd and others. +# +# 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 +############################################################################## +'''This file contain some function about docker API. +At present, This file contain the following function: +1.Ask Docker service to create a docker(yardstick or ELK). +2.get a docker ip. +3.Remove a docker.''' + +import docker +import os +import socket + +yardstick_info = {} +ELK_info = {} + + +def get_client(): + client = docker.from_env() + return client + + +def docker_find(docker_name): + client = get_client() + docker_client = client.containers.get(docker_name) + return docker_client + + +def env_yardstick(docker_name): + client = get_client() + yardstick_info["name"] = docker_name + try: + env_docker = docker_find(docker_name) + yardstick_info["container"] = env_docker + yardstick_info["ip"] = get_docker_ip(docker_name) + return env_docker + except docker.errors.NotFound: + pass + volume = get_self_volume() + yardstick_tag = os.getenv("Yardstick_TAG") + if yardstick_tag is None: + yardstick_tag = "latest" + env_docker = client.containers.run(image="opnfv/yardstick:%s" + % yardstick_tag, + privileged=True, + tty=True, + detach=True, + ports={'5000': '8888'}, + volumes=volume, + name=docker_name) + yardstick_info["container"] = env_docker + yardstick_info["ip"] = get_docker_ip(docker_name) + return env_docker + + +def env_bottlenecks(docker_name): + client = get_client() + volume = get_self_volume() + env_docker = client.containers.run(image="opnfv/bottlenecks:latest", + privileged=True, + detach=True, + ports={'8888': '5000'}, + volumes=volume, + name=docker_name) + return env_docker + + +def env_elk(docker_name): + client = get_client() + ELK_info["name"] = docker_name + try: + env_docker = docker_find(docker_name) + ELK_info["container"] = env_docker + ELK_info["ip"] = get_docker_ip(docker_name) + return env_docker + except docker.errors.NotFound: + pass + env_docker = client.containers.run(image="sebp/elk:es241_l240_k461", + privileged=True, + detach=True, + ports={'5044': '5044', + '5601': '5601', + '9200': '9200'}, + name=docker_name) + ELK_info["container"] = env_docker + ELK_info["ip"] = get_docker_ip(docker_name) + return env_docker + + +def get_docker_ip(docker_name): + env_docker = docker_find(docker_name) + client = docker.APIClient(base_url='unix://var/run/docker.sock') + docker_inspect = client.inspect_container(env_docker.id) + ip_address = docker_inspect["NetworkSettings"]["IPAddress"] + return ip_address + + +def docker_exec_cmd(docker, cmd): + return docker.exec_run(cmd) + + +def get_self_volume(): + self_volume = {} + hostname = socket.gethostname() + client = docker.APIClient(base_url='unix://var/run/docker.sock') + volume = client.inspect_container(hostname)["Mounts"] + for i in volume: + self_volume[i['Source']] = i['Destination'] + return self_volume + + +def remove_docker(docker_name): + docker = docker_find(docker_name) + docker.kill() + docker.remove() diff --git a/utils/infra_setup/runner/docker_usage.py b/utils/infra_setup/runner/docker_usage.py deleted file mode 100644 index 63dc6e7a..00000000 --- a/utils/infra_setup/runner/docker_usage.py +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env python -############################################################################## -# Copyright (c) 2017 Huawei Technologies Co.,Ltd and others. -# -# 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 -############################################################################## -'''This file contain some function about docker API. -At present, This file contain the following function: -1.Ask Docker service to create a docker(yardstick or ELK). -2.get a docker ip. -3.Remove a docker.''' - -import docker - -yardstick_info = None -ELK_info = None - - -def get_client(): - client = docker.from_env() - return client - - -def docker_find(docker_name): - client = get_client() - docker_client = client.containers.get(docker_name) - return docker_client - - -def env_yardstick(docker_name): - client = get_client() - yardstick_info["name"] = docker_name - try: - env_docker = docker_find(docker_name) - yardstick_info["containner"] = env_docker - yardstick_info["ip"] = get_docker_ip(docker_name) - return env_docker - except docker.errors.NotFound: - pass - env_docker = client.containers.run(image="opnfv/yardstick:latest", - privileged=True, - detach=True, - ports={'8888': '5000'}, - volumes={'/var/run/docker.sock': - '/var/run/docker.sock'}, - name=docker_name) - yardstick_info["containner"] = env_docker - yardstick_info["ip"] = get_docker_ip(docker_name) - return env_docker - - -def env_elk(docker_name): - client = get_client() - ELK_info["name"] = docker_name - try: - env_docker = docker_find(docker_name) - ELK_info["container"] = env_docker - ELK_info["ip"] = get_docker_ip(docker_name) - return env_docker - except docker.errors.NotFound: - pass - env_docker = client.containers.run(image="sebp/elk:es241_l240_k461", - privileged=True, - detach=True, - ports={'5044': '5044', - '5601': '5601', - '9200': '9200'}, - name=docker_name) - ELK_info["container"] = env_docker - ELK_info["ip"] = get_docker_ip(docker_name) - return env_docker - - -def get_docker_ip(docker_name): - env_docker = docker_find(docker_name) - client = docker.APIClient(base_url='unix://var/run/docker.sock') - ip_address = client.inspect_container(env_docker.id) - return ip_address - - -def docker_exec_cmd(docker, cmd): - return docker.exec_cmd(cmd) - - -def remove_docker(docker_name): - docker = docker_find(docker_name) - docker.kill() - docker.remove() diff --git a/utils/parser.py b/utils/parser.py index ad141acb..65072c06 100644 --- a/utils/parser.py +++ b/utils/parser.py @@ -17,6 +17,7 @@ import yaml import json import time from pyroute2 import IPDB +import utils.infra_setup.runner.docker_env as docker_env class Parser(): @@ -41,6 +42,8 @@ class Parser(): cls.bottlenecks_config["fetch_os"] = common_config["fetch_os_file"] cls.bottlenecks_config["log_dir"] = common_config['log_dir'] cls.bottlenecks_config["rc_dir"] = common_config['rc_dir'] + cls.bottlenecks_config["yardstick_rc_dir"] = \ + common_config['yardstick_rc_dir'] cls.config_dir_check(cls.bottlenecks_config["log_dir"]) @classmethod @@ -92,6 +95,15 @@ class Parser(): # TO-DO add cli parameters to stack_config. return test_cfg, stack_cfg + @staticmethod + def convert_docker_env(config, ip_type): + if ip_type is "dashboard": + config["contexts"]["dashboard_ip"] = \ + docker_env.ELK_info["ip"] + ":9200" + elif ip_type is "yardstick": + config["contexts"]["yardstick_ip"] = \ + docker_env.yardstick_info["ip"] + ":8888" + @staticmethod def ip_parser(ip_type): with IPDB() as ip: -- cgit 1.2.3-korg