From a14016690cea1fe6f39c5ab0cd0359534c8966e0 Mon Sep 17 00:00:00 2001 From: George Paraskevopoulos Date: Thu, 16 Feb 2017 15:47:04 +0200 Subject: Get vnfd parameter file location from config.yaml Change-Id: Ide425e860ad219ec24765905666994390858cfdb Signed-off-by: George Paraskevopoulos --- sfc/lib/config.py | 2 ++ sfc/lib/utils.py | 8 ++++---- sfc/tests/functest/config.yaml | 1 + ...sfc_one_chain_two_service_functions_different_computes.py | 7 +++++++ sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py | 12 ++++++++++-- 5 files changed, 24 insertions(+), 6 deletions(-) diff --git a/sfc/lib/config.py b/sfc/lib/config.py index 3ef8514e..3a8247e3 100644 --- a/sfc/lib/config.py +++ b/sfc/lib/config.py @@ -31,6 +31,8 @@ class CommonConfig(object): self.sfc_test_dir = os.path.join( self.repo_path, "sfc", "tests", "functest") self.vnfd_dir = os.path.join(self.sfc_test_dir, "vnfd-templates") + self.vnfd_default_params_file = os.path.join( + self.sfc_test_dir, "vnfd-default-params-file") self.functest_results_dir = os.path.join( CONST.dir_results, "odl-sfc") self.config_file = os.path.join(self.sfc_test_dir, "config.yaml") diff --git a/sfc/lib/utils.py b/sfc/lib/utils.py index a7edef68..d1ae0844 100644 --- a/sfc/lib/utils.py +++ b/sfc/lib/utils.py @@ -78,10 +78,10 @@ def download_image(url, image_path): logger.info("Using old image") -def create_vnf_in_av_zone(tacker_client, vnf_name, vnfd_name, av_zone=None): - param_file = os.path.join(os.getcwd(), - 'vnfd-templates', - 'test-vnfd-default-params.yaml') +def create_vnf_in_av_zone( + tacker_client, vnf_name, vnfd_name, default_param_file, av_zone=None): + param_file = default_param_file + if av_zone is not None or av_zone != 'nova': param_file = os.path.join( '/tmp', diff --git a/sfc/tests/functest/config.yaml b/sfc/tests/functest/config.yaml index 618d69e1..bb32a7df 100644 --- a/sfc/tests/functest/config.yaml +++ b/sfc/tests/functest/config.yaml @@ -15,6 +15,7 @@ defaults: image_format: qcow2 url: "http://artifacts.opnfv.org/sfc/images" vnfd-dir: "vnfd-templates" + vnfd-default-params-file: "test-vnfd-default-params.yaml" testcases: sfc_two_chains_SSH_and_HTTP: diff --git a/sfc/tests/functest/sfc_one_chain_two_service_functions_different_computes.py b/sfc/tests/functest/sfc_one_chain_two_service_functions_different_computes.py index 72408897..357f08de 100644 --- a/sfc/tests/functest/sfc_one_chain_two_service_functions_different_computes.py +++ b/sfc/tests/functest/sfc_one_chain_two_service_functions_different_computes.py @@ -148,15 +148,22 @@ def main(): tacker_client, tosca_file=tosca_file) + default_param_file = os.path.join( + COMMON_CONFIG.sfc_test_dir, + COMMON_CONFIG.vnfd_dir, + COMMON_CONFIG.vnfd_default_params_file) + test_utils.create_vnf_in_av_zone( tacker_client, 'testVNF1', 'test-vnfd1', + default_param_file, av_zone=availability_zones[0]) test_utils.create_vnf_in_av_zone( tacker_client, 'testVNF2', 'test-vnfd2', + default_param_file, av_zone=availability_zones[1]) vnf1_id = os_tacker.wait_for_vnf(tacker_client, vnf_name='testVNF1') diff --git a/sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py b/sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py index 99e5d67e..fa549b16 100644 --- a/sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py +++ b/sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py @@ -139,10 +139,18 @@ def main(): COMMON_CONFIG.vnfd_dir, TESTCASE_CONFIG.test_vnfd_blue) os_tacker.create_vnfd(tacker_client, tosca_file=tosca_blue) + + default_param_file = os.path.join( + COMMON_CONFIG.sfc_test_dir, + COMMON_CONFIG.vnfd_dir, + COMMON_CONFIG.vnfd_default_params_file) + test_utils.create_vnf_in_av_zone( - tacker_client, vnfs[0], 'test-vnfd1', testTopology[vnfs[0]]) + tacker_client, vnfs[0], 'test-vnfd1', + default_param_file, testTopology[vnfs[0]]) test_utils.create_vnf_in_av_zone( - tacker_client, vnfs[1], 'test-vnfd2', testTopology[vnfs[1]]) + tacker_client, vnfs[1], 'test-vnfd2', + default_param_file, testTopology[vnfs[1]]) vnf1_id = os_tacker.wait_for_vnf(tacker_client, vnf_name='testVNF1') vnf2_id = os_tacker.wait_for_vnf(tacker_client, vnf_name='testVNF2') -- cgit 1.2.3-korg