From e69190cc9b0763c9a72b654df56fb3ed5f27430f Mon Sep 17 00:00:00 2001 From: Cédric Ollivier Date: Fri, 7 Sep 2018 23:15:25 +0200 Subject: Stop cloning when running vyos_vrouter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It moves the clone operation into docker build instead. Change-Id: I296005d8638510a999665d383a26c4fcd48897a6 Signed-off-by: Cédric Ollivier (cherry picked from commit 2e7f66734394dc5e749ef9ac95e46a8ded9fb2c9) --- docker/vnf/Dockerfile | 3 +++ functest/ci/config_functest.yaml | 2 +- .../opnfv_tests/vnf/router/cloudify_vrouter.yaml | 3 --- .../router/test_controller/function_test_exec.py | 11 +++++---- functest/opnfv_tests/vnf/router/utilvnf.py | 27 ---------------------- functest/opnfv_tests/vnf/router/vrouter_base.py | 3 --- requirements.txt | 1 - 7 files changed, 10 insertions(+), 40 deletions(-) diff --git a/docker/vnf/Dockerfile b/docker/vnf/Dockerfile index 07aeca0aa..55a48a6a8 100644 --- a/docker/vnf/Dockerfile +++ b/docker/vnf/Dockerfile @@ -33,6 +33,9 @@ RUN apk --no-cache add --update \ (cd /src/cloudify_vims && git fetch --depth 1 --tags origin $CLOUDIFY_VIMS_TAG && git checkout FETCH_HEAD) && \ git clone --depth 1 -b $VROUTER_TAG https://github.com/oolorg/opnfv-vnf-vyos-blueprint.git /src/opnfv-vnf-vyos-blueprint && \ (cd /src/opnfv-vnf-vyos-blueprint && git fetch --depth 1 --tags origin $VROUTER_TAG && git checkout FETCH_HEAD) && \ + mkdir -p /home/opnfv/functest/data/router && \ + git clone --depth 1 -b $VROUTER_TAG https://github.com/oolorg/opnfv-vnf-data.git /home/opnfv/functest/data/router/opnfv-vnf-data && \ + (cd /home/opnfv/functest/data/router/opnfv-vnf-data && git fetch --depth 1 --tags origin $VROUTER_TAG && git checkout FETCH_HEAD) && \ git clone --depth 1 https://github.com/RebacaInc/abot_charm.git /src/epc-requirements/abot_charm && \ (cd /src/epc-requirements/abot_charm && git fetch --depth 1 --tags origin $ABOT_CHARM && git checkout FETCH_HEAD) && \ python3 -m pip install --no-cache-dir --src /src -cupper-constraints.txt \ diff --git a/functest/ci/config_functest.yaml b/functest/ci/config_functest.yaml index 2ce14b410..c99d49d09 100644 --- a/functest/ci/config_functest.yaml +++ b/functest/ci/config_functest.yaml @@ -12,7 +12,7 @@ general: functest_data: /home/opnfv/functest/data ims_data: /home/opnfv/functest/data/ims/ refstack_data: /home/opnfv/functest/data/refstack - router_data: /home/opnfv/functest/data/router/ + router_data: /home/opnfv/functest/data/router/opnfv-vnf-data functest_images: /home/opnfv/functest/images rally_inst: /root/.rally diff --git a/functest/opnfv_tests/vnf/router/cloudify_vrouter.yaml b/functest/opnfv_tests/vnf/router/cloudify_vrouter.yaml index 649cd6ccd..2d98dffa5 100644 --- a/functest/opnfv_tests/vnf/router/cloudify_vrouter.yaml +++ b/functest/opnfv_tests/vnf/router/cloudify_vrouter.yaml @@ -3,9 +3,6 @@ tenant_images: cloudify_manager_4.0: /home/opnfv/functest/images/cloudify-manager-premium-4.0.1.qcow2 vyos1.1.7: /home/opnfv/functest/images/vyos-1.1.7.img -test_data: - url: 'https://github.com/oolorg/opnfv-vnf-data.git' - branch: 'fraser' orchestrator: name: cloudify version: '4.0' diff --git a/functest/opnfv_tests/vnf/router/test_controller/function_test_exec.py b/functest/opnfv_tests/vnf/router/test_controller/function_test_exec.py index 9d484cb56..0b8a69b73 100644 --- a/functest/opnfv_tests/vnf/router/test_controller/function_test_exec.py +++ b/functest/opnfv_tests/vnf/router/test_controller/function_test_exec.py @@ -12,6 +12,7 @@ """vrouter function test execution module""" import logging +import os import time import yaml @@ -31,11 +32,11 @@ class FunctionTestExec(object): credentials = util_info["credentials"] self.vnf_ctrl = VnfController(util_info) - test_cmd_map_file = open(self.util.vnf_data_dir + - self.util.opnfv_vnf_data_dir + - self.util.command_template_dir + - self.util.test_cmd_map_yaml_file, - 'r') + test_cmd_map_file = open( + os.path.join( + self.util.vnf_data_dir, self.util.command_template_dir, + self.util.test_cmd_map_yaml_file), + 'r') self.test_cmd_map_yaml = yaml.safe_load(test_cmd_map_file) test_cmd_map_file.close() diff --git a/functest/opnfv_tests/vnf/router/utilvnf.py b/functest/opnfv_tests/vnf/router/utilvnf.py index 4bb277a8d..a54f6cb0b 100644 --- a/functest/opnfv_tests/vnf/router/utilvnf.py +++ b/functest/opnfv_tests/vnf/router/utilvnf.py @@ -14,12 +14,9 @@ import json import logging import os -import pkg_resources import requests import yaml -from git import Repo - from functest.utils import config RESULT_SPRIT_INDEX = { @@ -53,14 +50,12 @@ class Utilvnf(object): # pylint: disable=too-many-instance-attributes def __init__(self): self.vnf_data_dir = getattr(config.CONF, 'dir_router_data') - self.opnfv_vnf_data_dir = "opnfv-vnf-data/" self.command_template_dir = "command_template/" self.test_scenario_yaml = "test_scenario.yaml" test_env_config_yaml_file = "test_env_config.yaml" self.test_cmd_map_yaml_file = "test_cmd_map.yaml" self.test_env_config_yaml = os.path.join( self.vnf_data_dir, - self.opnfv_vnf_data_dir, test_env_config_yaml_file) self.blueprint_dir = "opnfv-vnf-vyos-blueprint/" @@ -69,28 +64,6 @@ class Utilvnf(object): # pylint: disable=too-many-instance-attributes if not os.path.exists(self.vnf_data_dir): os.makedirs(self.vnf_data_dir) - case_dir = pkg_resources.resource_filename( - 'functest', 'opnfv_tests/vnf/router') - - config_file_name = getattr( - config.CONF, 'vnf_{}_config'.format("vyos_vrouter")) - - config_file = os.path.join(case_dir, config_file_name) - - with open(config_file) as file_fd: - vrouter_config_yaml = yaml.safe_load(file_fd) - file_fd.close() - - test_data = vrouter_config_yaml.get("test_data") - - self.logger.debug("Downloading the test data.") - vrouter_data_path = self.vnf_data_dir + self.opnfv_vnf_data_dir - - if not os.path.exists(vrouter_data_path): - Repo.clone_from(test_data['url'], - vrouter_data_path, - branch=test_data['branch']) - with open(self.test_env_config_yaml) as file_fd: test_env_config_yaml = yaml.safe_load(file_fd) file_fd.close() diff --git a/functest/opnfv_tests/vnf/router/vrouter_base.py b/functest/opnfv_tests/vnf/router/vrouter_base.py index fe3058f01..e8a933ff5 100644 --- a/functest/opnfv_tests/vnf/router/vrouter_base.py +++ b/functest/opnfv_tests/vnf/router/vrouter_base.py @@ -32,15 +32,12 @@ class VrouterOnBoardingBase(object): self.logger = logging.getLogger(__name__) self.case_dir = pkg_resources.resource_filename( 'functest', 'opnfv_tests/vnf/router') - self.data_dir = getattr(config.CONF, 'dir_router_data') self.result_dir = os.path.join( getattr(config.CONF, 'dir_results'), case_name) self.util = util self.util_info = util_info self.vnf_list = [] - if not os.path.exists(self.data_dir): - os.makedirs(self.data_dir) if not os.path.exists(self.result_dir): os.makedirs(self.result_dir) diff --git a/requirements.txt b/requirements.txt index 493282c82..db8d6a188 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,6 @@ # process, which may cause wedges in the gate later. pbr!=2.1.0,>=2.0.0 # Apache-2.0 PyYAML>=3.10.0 # MIT -GitPython>=1.0.1 # BSD License (3 clause) requests>=2.14.2 # Apache-2.0 robotframework>=3.0 scp -- cgit 1.2.3-korg