aboutsummaryrefslogtreecommitdiffstats
path: root/functest/opnfv_tests
diff options
context:
space:
mode:
authorLinda Wang <wangwulin@huawei.com>2017-11-13 04:20:47 +0000
committerLinda Wang <wangwulin@huawei.com>2017-11-13 09:36:46 +0000
commit98311932d448f21a872ac0cd5f46258ecddd89e0 (patch)
tree89ae58d9274aa17c8ab4788ff12861d687ffbaa9 /functest/opnfv_tests
parent9e72ad1edd88aada55a0328cd72d4941c4e6fc60 (diff)
Move rally and tempest out of functest-core
JIRA: FUNCTEST-889 Change-Id: I96776da7af50b2c33c34dd731b5500b891d263d6 Signed-off-by: Linda Wang <wangwulin@huawei.com>
Diffstat (limited to 'functest/opnfv_tests')
-rw-r--r--functest/opnfv_tests/openstack/rally/rally.py2
-rw-r--r--functest/opnfv_tests/openstack/tempest/conf_utils.py62
2 files changed, 63 insertions, 1 deletions
diff --git a/functest/opnfv_tests/openstack/rally/rally.py b/functest/opnfv_tests/openstack/rally/rally.py
index fd251899..a4970fc2 100644
--- a/functest/opnfv_tests/openstack/rally/rally.py
+++ b/functest/opnfv_tests/openstack/rally/rally.py
@@ -26,6 +26,7 @@ import yaml
from functest.core import testcase
from functest.energy import energy
from functest.opnfv_tests.openstack.snaps import snaps_utils
+from functest.opnfv_tests.openstack.tempest import conf_utils
from functest.utils.constants import CONST
from snaps.openstack.create_flavor import FlavorSettings, OpenStackFlavor
@@ -621,6 +622,7 @@ class RallyBase(testcase.TestCase):
"""Run testcase."""
self.start_time = time.time()
try:
+ conf_utils.create_rally_deployment()
self._prepare_env()
self._run_tests()
self._generate_report()
diff --git a/functest/opnfv_tests/openstack/tempest/conf_utils.py b/functest/opnfv_tests/openstack/tempest/conf_utils.py
index 7f7db35e..a361c506 100644
--- a/functest/opnfv_tests/openstack/tempest/conf_utils.py
+++ b/functest/opnfv_tests/openstack/tempest/conf_utils.py
@@ -8,7 +8,9 @@
# http://www.apache.org/licenses/LICENSE-2.0
#
import ConfigParser
+import json
import logging
+import fileinput
import os
import pkg_resources
import shutil
@@ -23,6 +25,9 @@ import functest.utils.openstack_utils as os_utils
IMAGE_ID_ALT = None
FLAVOR_ID_ALT = None
+RALLY_CONF_PATH = "/etc/rally/rally.conf"
+RALLY_AARCH64_PATCH_PATH = pkg_resources.resource_filename(
+ 'functest', 'ci/rally_aarch64_patch.conf')
GLANCE_IMAGE_PATH = os.path.join(
CONST.__getattribute__('dir_functest_images'),
CONST.__getattribute__('openstack_image_file_name'))
@@ -52,12 +57,67 @@ CI_INSTALLER_IP = CONST.__getattribute__('INSTALLER_IP')
logger = logging.getLogger(__name__)
+def create_rally_deployment():
+ # set the architecture to default
+ pod_arch = os.getenv("POD_ARCH", None)
+ arch_filter = ['aarch64']
+
+ if pod_arch and pod_arch in arch_filter:
+ logger.info("Apply aarch64 specific to rally config...")
+ with open(RALLY_AARCH64_PATCH_PATH, "r") as f:
+ rally_patch_conf = f.read()
+
+ for line in fileinput.input(RALLY_CONF_PATH, inplace=1):
+ print line,
+ if "cirros|testvm" in line:
+ print rally_patch_conf
+
+ logger.info("Creating Rally environment...")
+
+ cmd = "rally deployment destroy opnfv-rally"
+ ft_utils.execute_command(cmd, error_msg=(
+ "Deployment %s does not exist."
+ % CONST.__getattribute__('rally_deployment_name')),
+ verbose=False)
+
+ rally_conf = os_utils.get_credentials_for_rally()
+ with open('rally_conf.json', 'w') as fp:
+ json.dump(rally_conf, fp)
+ cmd = ("rally deployment create "
+ "--file=rally_conf.json --name={0}"
+ .format(CONST.__getattribute__('rally_deployment_name')))
+ error_msg = "Problem while creating Rally deployment"
+ ft_utils.execute_command_raise(cmd, error_msg=error_msg)
+
+ cmd = "rally deployment check"
+ error_msg = "OpenStack not responding or faulty Rally deployment."
+ ft_utils.execute_command_raise(cmd, error_msg=error_msg)
+
+
+def create_verifier():
+ logger.info("Create verifier from existing repo...")
+ cmd = ("rally verify delete-verifier --id '{0}' --force").format(
+ CONST.__getattribute__('tempest_verifier_name'))
+ ft_utils.execute_command(cmd, error_msg=(
+ "Verifier %s does not exist."
+ % CONST.__getattribute__('tempest_verifier_name')),
+ verbose=False)
+ cmd = ("rally verify create-verifier --source {0} "
+ "--name {1} --type tempest --system-wide"
+ .format(CONST.__getattribute__('dir_repo_tempest'),
+ CONST.__getattribute__('tempest_verifier_name')))
+ ft_utils.execute_command_raise(cmd,
+ error_msg='Problem while creating verifier')
+
+
def get_verifier_id():
"""
Returns verifier id for current Tempest
"""
+ create_rally_deployment()
+ create_verifier()
cmd = ("rally verify list-verifiers | awk '/" +
- CONST.__getattribute__('tempest_deployment_name') +
+ CONST.__getattribute__('tempest_verifier_name') +
"/ {print $2}'")
p = subprocess.Popen(cmd, shell=True,
stdout=subprocess.PIPE,