summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYu Yang (Gabriel) <Gabriel.yuyang@huawei.com>2018-03-12 02:51:26 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-03-12 02:51:26 +0000
commit75bf3ebba105798ce450b321a5d770fcee985896 (patch)
treef06384343e86d96e6b25bf99df07eea14d280c1e
parent952db3aa4d1fe889c524d1d70bde0479e638f53e (diff)
parentadf6a02bae295455f584ebab762592dd57e2422c (diff)
Merge "bottlenecks offiline support"
-rw-r--r--config/config.yaml5
-rw-r--r--testsuites/posca/testcase_cfg/posca_factor_multistack_storage.yaml3
-rw-r--r--testsuites/posca/testcase_cfg/posca_factor_multistack_storage_parallel.yaml5
-rw-r--r--testsuites/posca/testcase_script/posca_factor_multistack_storage.py12
-rw-r--r--testsuites/posca/testcase_script/posca_factor_multistack_storage_parallel.py12
-rw-r--r--testsuites/posca/testcase_script/posca_factor_ping.py18
-rw-r--r--testsuites/posca/testcase_script/posca_feature_testpmd_scale_up.py5
-rw-r--r--testsuites/posca/testcase_script/posca_feature_vnf_scale_out.py10
-rw-r--r--testsuites/run_testsuite.py9
-rw-r--r--utils/env_prepare/stack_prepare.py38
-rw-r--r--utils/infra_setup/heat/manager.py2
-rw-r--r--utils/infra_setup/runner/docker_env.py2
-rw-r--r--utils/infra_setup/runner/yardstick.py15
-rw-r--r--utils/parser.py5
14 files changed, 88 insertions, 53 deletions
diff --git a/config/config.yaml b/config/config.yaml
index 76e42b30..f85599c1 100644
--- a/config/config.yaml
+++ b/config/config.yaml
@@ -13,4 +13,7 @@ common_config:
pod_info: '/tmp/pod.yaml'
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
+ fetch_os_file: 'utils/fetch_os_creds.sh'
+ yardstick_image_dir: '/tmp/yardstick.img'
+ image_url: 'http://artifacts.opnfv.org/yardstick/image/yardstick-nsb-image.img'
+ yardstick_image_name: 'bottlenecks_yardstick'
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"
diff --git a/utils/env_prepare/stack_prepare.py b/utils/env_prepare/stack_prepare.py
index c1604f4d..c1ac395a 100644
--- a/utils/env_prepare/stack_prepare.py
+++ b/utils/env_prepare/stack_prepare.py
@@ -14,6 +14,7 @@ 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
+import utils.infra_setup.heat.manager as client_manager
LOG = Logger(__name__).getLogger()
@@ -37,16 +38,6 @@ def _prepare_env_daemon(test_yardstick):
config.bottlenecks_config["yardstick_rc_dir"])
docker_env.docker_exec_cmd(yardstick_contain,
cmd)
- file_orig = ("/home/opnfv/repos/yardstick/etc"
- "/yardstick/yardstick.conf.sample")
- file_after = "/etc/yardstick/yardstick.conf"
- cmd = "cp %s %s" % (file_orig,
- file_after)
- docker_env.docker_exec_cmd(yardstick_contain,
- cmd)
- cmd = "sed -i '12s/http/file/g' /etc/yardstick/yardstick.conf"
- docker_env.docker_exec_cmd(yardstick_contain,
- cmd)
# update the external_network
_source_file(rc_file)
@@ -104,3 +95,30 @@ def _append_external_network(rc_file):
except OSError as e:
if e.errno != errno.EEXIST:
raise
+
+
+def prepare_image(image_name, image_dir):
+ glance_client = client_manager._get_glance_client()
+ if not os.path.isfile(image_dir):
+ LOG.error("Error: file %s does not exist.", image_dir)
+ return None
+ try:
+ images = glance_client.images.list()
+ image_id = next((i.id for i in images if i.name == image_name), None)
+ if image_id is not None:
+ LOG.info("Image %s already exists.", image_name)
+ else:
+ LOG.info("Creating image '%s' from '%s'...", image_name, image_dir)
+
+ image = glance_client.images.create(
+ name=image_name, visibility="public", disk_format="qcow2",
+ container_format="bare")
+ image_id = image.id
+ with open(image_dir) as image_data:
+ glance_client.images.upload(image_id, image_data)
+ return image_id
+ except Exception: # pylint: disable=broad-except
+ LOG.error(
+ "Error [create_glance_image(glance_client, '%s', '%s')]",
+ image_name, image_dir)
+ return None
diff --git a/utils/infra_setup/heat/manager.py b/utils/infra_setup/heat/manager.py
index 5c181ae6..1a360b78 100644
--- a/utils/infra_setup/heat/manager.py
+++ b/utils/infra_setup/heat/manager.py
@@ -35,7 +35,7 @@ def _get_neutron_client():
return neutron_client
-def stack_create_images(
+def create_images(
imagefile=None,
image_name="bottlenecks_image"):
print "========== Create image in OS =========="
diff --git a/utils/infra_setup/runner/docker_env.py b/utils/infra_setup/runner/docker_env.py
index 54478ffc..438d3d19 100644
--- a/utils/infra_setup/runner/docker_env.py
+++ b/utils/infra_setup/runner/docker_env.py
@@ -45,7 +45,7 @@ def env_yardstick(docker_name):
volume = get_self_volume()
yardstick_tag = os.getenv("Yardstick_TAG")
if yardstick_tag is None:
- yardstick_tag = "danube.3.1"
+ yardstick_tag = "latest"
env_docker = client.containers.run(image="opnfv/yardstick:%s"
% yardstick_tag,
privileged=True,
diff --git a/utils/infra_setup/runner/yardstick.py b/utils/infra_setup/runner/yardstick.py
index 559b9c10..616bcc52 100644
--- a/utils/infra_setup/runner/yardstick.py
+++ b/utils/infra_setup/runner/yardstick.py
@@ -15,15 +15,27 @@ At present, This file contain the following function:
4.how the process of task.'''
import sys
+import os
import time
import requests
import json
+import urllib
import utils.logger as logger
+from utils.parser import Parser as config
+import utils.env_prepare.stack_prepare as env
headers = {"Content-Type": "application/json"}
LOG = logger.Logger(__name__).getLogger()
+def yardstick_image_prepare():
+ if not os.path.exists(config.bottlenecks_config["yardstick_image_dir"]):
+ urllib.urlretrieve(config.bottlenecks_config["image_url"],
+ config.bottlenecks_config["yardstick_image_dir"])
+ env.prepare_image(config.bottlenecks_config["yardstick_image_name"],
+ config.bottlenecks_config["yardstick_image_dir"])
+
+
def yardstick_command_parser(debug, cidr, outfile, parameter):
cmd = "yardstick"
if debug:
@@ -31,6 +43,9 @@ def yardstick_command_parser(debug, cidr, outfile, parameter):
cmd += " task start "
cmd += str(cidr)
cmd += " --output-file " + outfile
+ image_name = config.bottlenecks_config["yardstick_image_name"]
+ parameter["image_name"] = image_name
+ print parameter
if parameter is not None:
cmd += " --task-args " + '"' + str(parameter) + '"'
return cmd
diff --git a/utils/parser.py b/utils/parser.py
index b46a3b91..c0c10721 100644
--- a/utils/parser.py
+++ b/utils/parser.py
@@ -45,6 +45,11 @@ class Parser():
cls.bottlenecks_config["pod_info"] = common_config['pod_info']
cls.bottlenecks_config["yardstick_rc_dir"] = \
common_config['yardstick_rc_dir']
+ cls.bottlenecks_config["yardstick_image_dir"] = \
+ common_config['yardstick_image_dir']
+ cls.bottlenecks_config["image_url"] = common_config['image_url']
+ cls.bottlenecks_config["yardstick_image_name"] = \
+ common_config['yardstick_image_name']
cls.config_dir_check(cls.bottlenecks_config["log_dir"])
@classmethod