diff options
author | Jose Lausuch <jose.lausuch@ericsson.com> | 2017-02-28 08:51:37 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2017-02-28 08:51:37 +0000 |
commit | 796fe74892bfdf29469b836a807d2a53d69337f3 (patch) | |
tree | 7cc76ce60fdc09ca80d64c6712135d4172388dc2 /functest | |
parent | fd459c00eb681f7f917fccd474d49aaad1bae1f1 (diff) | |
parent | adbcb25389612d86d446d5f34787b1b2519c3b83 (diff) |
Merge "Add aarch64 custom config"
Diffstat (limited to 'functest')
-rw-r--r-- | functest/ci/config_aarch64_patch.yaml | 20 | ||||
-rwxr-xr-x | functest/ci/prepare_env.py | 99 | ||||
-rw-r--r-- | functest/ci/rally_aarch64_patch.conf | 5 |
3 files changed, 88 insertions, 36 deletions
diff --git a/functest/ci/config_aarch64_patch.yaml b/functest/ci/config_aarch64_patch.yaml new file mode 100644 index 00000000..9a345e3f --- /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 5a9f99cb..f5bae6a0 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 00000000..a49588bf --- /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 |