summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJose Lausuch <jose.lausuch@ericsson.com>2017-02-28 08:51:37 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-02-28 08:51:37 +0000
commit796fe74892bfdf29469b836a807d2a53d69337f3 (patch)
tree7cc76ce60fdc09ca80d64c6712135d4172388dc2
parentfd459c00eb681f7f917fccd474d49aaad1bae1f1 (diff)
parentadbcb25389612d86d446d5f34787b1b2519c3b83 (diff)
Merge "Add aarch64 custom config"
-rw-r--r--docker/Dockerfile4
-rw-r--r--docker/Dockerfile.aarch642
-rwxr-xr-xdocker/add_images.sh17
-rw-r--r--functest/ci/config_aarch64_patch.yaml20
-rwxr-xr-xfunctest/ci/prepare_env.py99
-rw-r--r--functest/ci/rally_aarch64_patch.conf5
6 files changed, 108 insertions, 39 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 1187fb95f..de47e157a 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -123,9 +123,7 @@ RUN find ${FUNCTEST_REPO_DIR} -name "*.py" \
RUN /bin/bash ${REPOS_DIR}/parser/tests/parser_install.sh ${REPOS_DIR}
RUN ${REPOS_DIR}/rally/install_rally.sh --yes
-ADD http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img ${FUNCTEST_BASE_DIR}/data/
-ADD http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-lxc.tar.gz ${FUNCTEST_BASE_DIR}/data/
-ADD http://205.177.226.237:9999/onosfw/firewall_block_image.img ${FUNCTEST_BASE_DIR}/data/
+RUN /bin/bash ${REPOS_DIR}/functest/docker/add_images.sh
RUN gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
RUN curl -L https://get.rvm.io | bash -s stable
diff --git a/docker/Dockerfile.aarch64 b/docker/Dockerfile.aarch64
index bf8e361f0..a469801f3 100644
--- a/docker/Dockerfile.aarch64
+++ b/docker/Dockerfile.aarch64
@@ -117,6 +117,8 @@ RUN find ${FUNCTEST_REPO_DIR} -name "*.py" \
RUN /bin/bash ${REPOS_DIR}/parser/tests/parser_install.sh ${REPOS_DIR}
RUN ${REPOS_DIR}/rally/install_rally.sh --yes
+RUN /bin/bash ${REPOS_DIR}/functest/docker/add_images.sh
+
RUN gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
RUN curl -L https://get.rvm.io | bash -s stable
diff --git a/docker/add_images.sh b/docker/add_images.sh
new file mode 100755
index 000000000..a43e0ba45
--- /dev/null
+++ b/docker/add_images.sh
@@ -0,0 +1,17 @@
+#!/usr/bin/env bash
+#
+# This script downloads the images that are used for testing
+# and places them in the functest docker image
+
+CIRROS_REPO_URL=http://download.cirros-cloud.net
+CIRROS_AARCH64_TAG=daily/20161201
+CIRROS_X86_64_TAG=0.3.5
+
+wget ${CIRROS_REPO_URL}/${CIRROS_X86_64_TAG}/cirros-${CIRROS_X86_64_TAG}-x86_64-disk.img
+wget ${CIRROS_REPO_URL}/${CIRROS_X86_64_TAG}/cirros-${CIRROS_X86_64_TAG}-x86_64-lxc.tar.gz -P ${FUNCTEST_BASE_DIR}/data/
+wget http://205.177.226.237:9999/onosfw/firewall_block_image.img -P ${FUNCTEST_BASE_DIR}/data/
+
+# Add the 3-part image for aarch64, since functest can be run from an x86 machine to test an aarch64 POD
+wget ${CIRROS_REPO_URL}/daily/${CIRROS_AARCH64_TAG}/cirros-$(basename ${CIRROS_AARCH64_TAG})-aarch64-disk.img -P ${FUNCTEST_BASE_DIR}/data/
+wget ${CIRROS_REPO_URL}/daily/${CIRROS_AARCH64_TAG}/cirros-$(basename ${CIRROS_AARCH64_TAG})-aarch64-initramfs -P ${FUNCTEST_BASE_DIR}/data/
+wget ${CIRROS_REPO_URL}/daily/${CIRROS_AARCH64_TAG}/cirros-$(basename ${CIRROS_AARCH64_TAG})-aarch64-kernel -P ${FUNCTEST_BASE_DIR}/data/
diff --git a/functest/ci/config_aarch64_patch.yaml b/functest/ci/config_aarch64_patch.yaml
new file mode 100644
index 000000000..9a345e3f7
--- /dev/null
+++ b/functest/ci/config_aarch64_patch.yaml
@@ -0,0 +1,20 @@
+os:
+ general:
+ openstack:
+ image_name: TestVM
+ image_file_name: cirros-d161201-aarch64-disk.img
+ image_password: gocubsgo
+
+ snaps_simple_healthcheck:
+ disk_image: /home/opnfv/functest/data/cirros-d161201-aarch64-disk.img
+ kernel_image: /home/opnfv/functest/data/cirros-d161201-aarch64-kernel
+ ramdisk_image: /home/opnfv/functest/data/cirros-d161201-aarch64-initramfs
+ extra_properties:
+ os_command_line: root=/dev/vdb1 rw rootwait console=tty0 console=ttyS0 console=ttyAMA0
+ hw_video_model: vga
+
+ vping:
+ image_name: TestVM
+
+ doctor:
+ image_name: TestVM
diff --git a/functest/ci/prepare_env.py b/functest/ci/prepare_env.py
index 5a9f99cb6..f5bae6a04 100755
--- a/functest/ci/prepare_env.py
+++ b/functest/ci/prepare_env.py
@@ -12,6 +12,7 @@ import os
import re
import subprocess
import sys
+import fileinput
import yaml
@@ -27,14 +28,18 @@ actions = ['start', 'check']
""" logging configuration """
logger = ft_logger.Logger("prepare_env").getLogger()
-
+handler = None
+# set the architecture to default
+pod_arch = None
CONFIG_FUNCTEST_PATH = CONST.CONFIG_FUNCTEST_YAML
CONFIG_PATCH_PATH = os.path.join(os.path.dirname(
CONFIG_FUNCTEST_PATH), "config_patch.yaml")
-
-with open(CONFIG_PATCH_PATH) as f:
- functest_patch_yaml = yaml.safe_load(f)
+CONFIG_AARCH64_PATCH_PATH = os.path.join(os.path.dirname(
+ CONFIG_FUNCTEST_PATH), "config_aarch64_patch.yaml")
+RALLY_CONF_PATH = os.path.join("/etc/rally/rally.conf")
+RALLY_AARCH64_PATCH_PATH = os.path.join(os.path.dirname(
+ CONFIG_FUNCTEST_PATH), "rally_aarch64_patch.conf")
class PrepareEnvParser(object):
@@ -102,6 +107,34 @@ def check_env_variables():
logger.info(" IS_CI_RUN=%s" % CONST.IS_CI_RUN)
+def get_deployment_handler():
+ global handler
+ global pod_arch
+
+ installer_params_yaml = os.path.join(CONST.dir_repo_functest,
+ 'functest/ci/installer_params.yaml')
+ if (CONST.INSTALLER_IP and CONST.INSTALLER_TYPE and
+ CONST.INSTALLER_TYPE in opnfv_constants.INSTALLERS):
+ installer_params = ft_utils.get_parameter_from_yaml(
+ CONST.INSTALLER_TYPE, installer_params_yaml)
+
+ user = installer_params.get('user', None)
+ password = installer_params.get('password', None)
+ pkey = installer_params.get('pkey', None)
+
+ try:
+ handler = factory.Factory.get_handler(
+ installer=CONST.INSTALLER_TYPE,
+ installer_ip=CONST.INSTALLER_IP,
+ installer_user=user,
+ installer_pwd=password,
+ pkey_file=pkey)
+ if handler:
+ pod_arch = handler.get_arch()
+ except Exception as e:
+ logger.debug("Cannot get deployment information. %s" % e)
+
+
def create_directories():
print_separator()
logger.info("Creating needed directories...")
@@ -177,12 +210,18 @@ def source_rc_file():
CONST.OS_PASSWORD = value
-def patch_config_file():
+def patch_config_file(patch_file_path, arch_filter=None):
+ if arch_filter and pod_arch not in arch_filter:
+ return
+
+ with open(patch_file_path) as f:
+ patch_file = yaml.safe_load(f)
+
updated = False
- for key in functest_patch_yaml:
+ for key in patch_file:
if key in CONST.DEPLOY_SCENARIO:
new_functest_yaml = dict(ft_utils.merge_dicts(
- ft_utils.get_functest_yaml(), functest_patch_yaml[key]))
+ ft_utils.get_functest_yaml(), patch_file[key]))
updated = True
if updated:
@@ -210,6 +249,17 @@ def verify_deployment():
def install_rally():
print_separator()
+
+ if 'aarch64' in pod_arch:
+ 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"
@@ -284,34 +334,9 @@ def check_environment():
def print_deployment_info():
- installer_params_yaml = os.path.join(CONST.dir_repo_functest,
- 'functest/ci/installer_params.yaml')
- if (CONST.INSTALLER_IP and CONST.INSTALLER_TYPE and
- CONST.INSTALLER_TYPE in opnfv_constants.INSTALLERS):
- try:
- installer_params = ft_utils.get_parameter_from_yaml(
- CONST.INSTALLER_TYPE, installer_params_yaml)
- except ValueError as e:
- logger.debug('Printing deployment info is not supported for %s' %
- CONST.INSTALLER_TYPE)
- logger.debug(e)
- else:
- user = installer_params.get('user', None)
- password = installer_params.get('password', None)
- pkey = installer_params.get('pkey', None)
-
- try:
- handler = factory.Factory.get_handler(
- installer=CONST.INSTALLER_TYPE,
- installer_ip=CONST.INSTALLER_IP,
- installer_user=user,
- installer_pwd=password,
- pkey_file=pkey)
- if handler:
- logger.info('\n\nDeployment information:\n%s' %
- handler.get_deployment_info())
- except Exception as e:
- logger.debug("Cannot get deployment information. %s" % e)
+ if handler:
+ logger.info('\n\nDeployment information:\n%s' %
+ handler.get_deployment_info())
def main(**kwargs):
@@ -322,9 +347,11 @@ def main(**kwargs):
elif kwargs['action'] == "start":
logger.info("######### Preparing Functest environment #########\n")
check_env_variables()
+ get_deployment_handler()
create_directories()
source_rc_file()
- patch_config_file()
+ patch_config_file(CONFIG_PATCH_PATH)
+ patch_config_file(CONFIG_AARCH64_PATCH_PATH, 'aarch64')
verify_deployment()
install_rally()
install_tempest()
diff --git a/functest/ci/rally_aarch64_patch.conf b/functest/ci/rally_aarch64_patch.conf
new file mode 100644
index 000000000..a49588bf8
--- /dev/null
+++ b/functest/ci/rally_aarch64_patch.conf
@@ -0,0 +1,5 @@
+img_name_regex = ^TestVM$
+img_url = http://download.cirros-cloud.net/daily/20161201/cirros-d161201-aarch64-disk.img
+flavor_ref_ram = 128
+flavor_ref_alt_ram = 256
+heat_instance_type_ram = 128