diff options
Diffstat (limited to 'ice_validator')
-rw-r--r-- | ice_validator/app_tests/preload_tests/test_environment.py | 4 | ||||
-rw-r--r-- | 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): |