From 7f3b8aae571dcc83a55779cb14c9ee9d5b18e2d0 Mon Sep 17 00:00:00 2001 From: "stark, steven" Date: Wed, 15 Jul 2020 12:35:52 -0700 Subject: [VVP] preload generation enhancements Add "0" digit to end of VNF type If "module" has file extension, remove extension before parsing CSAR for module information. Issue-ID: VVP-440 Signed-off-by: stark, steven Change-Id: I9dae8643e4c602867cbbbfec1416ca67a0a1ad4f --- ice_validator/app_tests/preload_tests/test_environment.py | 4 +++- ice_validator/preload/environment.py | 9 ++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ice_validator/app_tests/preload_tests/test_environment.py b/ice_validator/app_tests/preload_tests/test_environment.py index 8d06a92..dacbd37 100644 --- a/ice_validator/app_tests/preload_tests/test_environment.py +++ b/ice_validator/app_tests/preload_tests/test_environment.py @@ -76,7 +76,7 @@ def test_csar_get_vf_module_resource_name(csar): def test_csar_get_vnf_type(csar): - assert csar.get_vnf_type("vdns") == "stark_0917_vlb_svc/stark_0917_vlb_vf" + assert csar.get_vnf_type("vdns") == "stark_0917_vlb_svc/stark_0917_vlb_vf 0" def test_csar_get_vf_module_resource_name_not_found(csar): @@ -176,6 +176,8 @@ def test_preload_environment_defaults_in_module_env(env): "common": "ABC", "custom_env_3": "default", "my_ip": "default", + "vf-module-model-name": "Starkmultimodule2A9463fd82915..base..module-0", + "vnf-type": "StarkMultiModule2_43550/StarkMultiModule2 a9463fd8-2915 0" } mod = env.get_environment("env_one").get_module("base") assert mod == { diff --git a/ice_validator/preload/environment.py b/ice_validator/preload/environment.py index 0477e66..6d8d7c3 100644 --- a/ice_validator/preload/environment.py +++ b/ice_validator/preload/environment.py @@ -1,3 +1,4 @@ +import os import re import tempfile from pathlib import Path @@ -50,6 +51,12 @@ class CloudServiceArchive: :param vf_module: name of Heat module (no path or file extension) :return: The definition of the module as a dict or None if not found """ + if( + vf_module.endswith(".env") + or vf_module.endswith(".yaml") + or vf_module.endswith(".yml") + ): + vf_module = os.path.splitext(vf_module)[0] groups = self._service.get("topology_template", {}).get("groups", {}) for props in groups.values(): module_label = props.get("properties", {}).get("vf_module_label", "") @@ -102,7 +109,7 @@ class CloudServiceArchive: service_name = self.service_name instance_name = self.get_vf_module_resource_name(module) if service_name and instance_name: - return "{}/{}".format(service_name, instance_name) + return "{}/{} 0".format(service_name, instance_name) @property def vf_module_resource_names(self): -- cgit 1.2.3-korg 76bceb'>refslogtreecommitdiffstats
blob: e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 (plain)