diff options
Diffstat (limited to 'src/onaptests/configuration')
14 files changed, 155 insertions, 96 deletions
diff --git a/src/onaptests/configuration/basic_clamp_settings.py b/src/onaptests/configuration/basic_clamp_settings.py index c26c4e9..3eaad2d 100644 --- a/src/onaptests/configuration/basic_clamp_settings.py +++ b/src/onaptests/configuration/basic_clamp_settings.py @@ -1,5 +1,5 @@ -import sys -from yaml import load +from yaml import load, SafeLoader +from onaptests.utils.resources import get_resource_location from .settings import * # pylint: disable=W0614 @@ -39,14 +39,13 @@ OPERATIONAL_POLICIES = [ # if a yaml file is define, retrieve info from this yaml files # if not declare the parameters in the settings -SERVICE_YAML_TEMPLATE = (sys.path[-1] + "/onaptests/templates/vnf-services/" + - "basic_clamp-service.yaml") -CONFIGURATION_PATH = sys.path[-1] + "/onaptests/configuration/" +SERVICE_YAML_TEMPLATE = get_resource_location("templates/vnf-services/basic_clamp-service.yaml") +CONFIGURATION_PATH = get_resource_location("configuration/") try: # Try to retrieve the SERVICE NAME from the yaml file with open(SERVICE_YAML_TEMPLATE, "r") as yaml_template: - yaml_config_file = load(yaml_template) + yaml_config_file = load(yaml_template, SafeLoader) SERVICE_NAME = next(iter(yaml_config_file.keys())) VF_NAME = SERVICE_NAME except ValueError: diff --git a/src/onaptests/configuration/basic_cnf_macro_settings.py b/src/onaptests/configuration/basic_cnf_macro_settings.py new file mode 100644 index 0000000..4433bf2 --- /dev/null +++ b/src/onaptests/configuration/basic_cnf_macro_settings.py @@ -0,0 +1,78 @@ +import os +from pathlib import Path +from uuid import uuid4 +from yaml import load, SafeLoader + +from onaptests.utils.resources import get_resource_location +import onaptests.utils.exceptions as onap_test_exceptions +from .settings import * # pylint: disable=W0614 + +""" Specific basic_cnf_macro with multicloud-k8s and yaml config scenario.""" +SERVICE_DETAILS = ("Onboarding, distribution and instantiation of a Apache CNF" + + "using macro and native CNF path: cnf-adapter + K8sPlugin") +SERVICE_COMPONENTS = "SDC, DMAAP, AAI, SO, SDNC, CDS, Multicloud K8S" + +CLEANUP_FLAG = True + +# CDS_DD_FILE = Path(get_resource_location("templates/artifacts/dd.json")) +CDS_CBA_UNENRICHED = Path("no_such_file") +CDS_CBA_ENRICHED = Path(get_resource_location("templates/artifacts/basic_cnf_cba_enriched.zip")) + +# This scenario uses multicloud-k8s and not multicloud +# (no registration requested) +USE_MULTICLOUD = False +# Set ONLY_INSTANTIATE to true to run an instantiation without repeating +# onboarding and related AAI configuration (Cloud config) +ONLY_INSTANTIATE = False + +# Relative path to config file to set k8s connectivity information +K8S_CONFIG = get_resource_location("templates/artifacts/config") + +VENDOR_NAME = "basiccnf_macro_vendor" + +CLOUD_REGION_CLOUD_OWNER = "basiccnf-cloud-owner" # must not contain _ +CLOUD_REGION_ID = "k8sregion" +CLOUD_REGION_TYPE = "k8s" +CLOUD_REGION_VERSION = "1.0" +CLOUD_DOMAIN = "Default" +CLOUD_OWNER_DEFINED_TYPE = "t1" + +COMPLEX_PHYSICAL_LOCATION_ID = "lannion" +COMPLEX_DATA_CENTER_CODE = "1234-5" +AVAILABILITY_ZONE_NAME = "basiccnf-availability-zone" +AVAILABILITY_ZONE_TYPE = "nova" + +GLOBAL_CUSTOMER_ID = "basiccnf-macro-customer" + +OWNING_ENTITY = "basicnf_macro_owning_entity" +PROJECT = "basicnf_macro_project" +LINE_OF_BUSINESS = "basicnf_macro_lob" +PLATFORM = "basicnf_macro_platform" + +# The cloud Part +# Assuming a cloud.yaml is available, use the openstack client +# to retrieve cloud info and avoid data duplication +# For basic_cnf, no tenant information is required but some dummy +# information shall be provided by default +# So it is not requested to set OS_TEST_CLOUD +TEST_CLOUD = os.getenv('OS_TEST_CLOUD') +VIM_USERNAME = 'dummy' +VIM_PASSWORD = 'dummy123' +VIM_SERVICE_URL = 'http://10.12.25.2:5000/v3' +TENANT_ID = '123456' +TENANT_NAME = 'dummy_test' + + +SERVICE_YAML_TEMPLATE = Path(get_resource_location("templates/vnf-services/basic_cnf_macro-service.yaml")) + +try: + # Try to retrieve the SERVICE NAME from the yaml file + with open(SERVICE_YAML_TEMPLATE, "r") as yaml_template: + yaml_config_file = load(yaml_template, SafeLoader) + SERVICE_NAME = next(iter(yaml_config_file.keys())) +except (FileNotFoundError, ValueError): + raise onap_test_exceptions.TestConfigurationException + +SERVICE_INSTANCE_NAME = f"basic_cnf_macro_{str(uuid4())}" + +MODEL_YAML_TEMPLATE = None diff --git a/src/onaptests/configuration/basic_cnf_yaml_settings.py b/src/onaptests/configuration/basic_cnf_yaml_settings.py index 38e551c..36b0c3f 100644 --- a/src/onaptests/configuration/basic_cnf_yaml_settings.py +++ b/src/onaptests/configuration/basic_cnf_yaml_settings.py @@ -1,31 +1,28 @@ import os -import openstack -import sys -from yaml import load - +from yaml import load, SafeLoader +from onaptests.utils.resources import get_resource_location import onaptests.utils.exceptions as onap_test_exceptions from .settings import * # pylint: disable=W0614 """ Specific basic_cnf with multicloud-k8s and yaml config scenario.""" SERVICE_DETAILS = ("Onboarding, distribution and instantiation of a CNF" + "using à la carte and Multicloud K8S module") -SERVICE_COMPONENTS="SDC, DMAAP, AAI, SO, SDNC, Multicloud K8S" +SERVICE_COMPONENTS = "SDC, DMAAP, AAI, SO, SDNC, Multicloud K8S" # This scenario uses multicloud-k8s and not multicloud # (no registration requested) USE_MULTICLOUD = False # Set ONLY_INSTANTIATE to true to run an instantiation without repeating # onboarding and related AAI configuration (Cloud config) -ONLY_INSTANTIATE= False +ONLY_INSTANTIATE = False # if a yaml file is define, retrieve info from this yaml files # if not declare the parameters in the settings -SERVICE_YAML_TEMPLATE = (sys.path[-1] + "/onaptests/templates/vnf-services/" + - "basic_cnf-service.yaml") +SERVICE_YAML_TEMPLATE = get_resource_location("templates/vnf-services/basic_cnf-service.yaml") try: # Try to retrieve the SERVICE NAME from the yaml file with open(SERVICE_YAML_TEMPLATE, "r") as yaml_template: - yaml_config_file = load(yaml_template) + yaml_config_file = load(yaml_template, SafeLoader) SERVICE_NAME = next(iter(yaml_config_file.keys())) except (FileNotFoundError, ValueError): raise onap_test_exceptions.TestConfigurationException @@ -37,15 +34,13 @@ CLEANUP_ACTIVITY_TIMER = 10 # Definition of k8s profile version K8S_PROFILE_K8S_VERSION = "1.0" # Relative path to k8s profile artifact in the python package (so under /src) -K8S_PROFILE_ARTIFACT_PATH = (sys.path[-1] + - "/onaptests/templates/artifacts/k8sprof.tar.gz") +K8S_PROFILE_ARTIFACT_PATH = get_resource_location("templates/artifacts/k8sprof.tar.gz") # Relative path to config file to set k8s connectivity information -K8S_CONFIG = (sys.path[-1] + - "/onaptests/templates/artifacts/config") +K8S_CONFIG = get_resource_location("templates/artifacts/config") VENDOR_NAME = "basicnf_vendor" -CLOUD_REGION_CLOUD_OWNER = "basicnf-owner" # must not contain _ +CLOUD_REGION_CLOUD_OWNER = "basicnf-owner" # must not contain _ CLOUD_REGION_ID = "k8sregion" CLOUD_REGION_TYPE = "k8s" CLOUD_REGION_VERSION = "1.0" @@ -73,11 +68,10 @@ SERVICE_INSTANCE_NAME = "basic_cnf_service_instance" # information shall be provided by default # So it is not requested to set OS_TEST_CLOUD TEST_CLOUD = os.getenv('OS_TEST_CLOUD') -cloud = openstack.connect(cloud=TEST_CLOUD) -VIM_USERNAME = cloud.config.auth.get('username','dummy') -VIM_PASSWORD = cloud.config.auth.get('password','dummy123') -VIM_SERVICE_URL = cloud.config.auth.get('auth_url','http://10.12.25.2:5000/v3') -TENANT_ID = cloud.config.auth.get('project_id','123456') -TENANT_NAME = cloud.config.auth.get('project_name','dummy_test') +VIM_USERNAME = 'dummy' +VIM_PASSWORD = 'dummy123' +VIM_SERVICE_URL = 'http://10.12.25.2:5000/v3' +TENANT_ID = '123456' +TENANT_NAME = 'dummy_test' MODEL_YAML_TEMPLATE = None diff --git a/src/onaptests/configuration/basic_network_nomulticloud_settings.py b/src/onaptests/configuration/basic_network_nomulticloud_settings.py index ab9e5ab..add6175 100644 --- a/src/onaptests/configuration/basic_network_nomulticloud_settings.py +++ b/src/onaptests/configuration/basic_network_nomulticloud_settings.py @@ -1,8 +1,7 @@ import os import openstack -import sys -from yaml import load - +from yaml import load, SafeLoader +from onaptests.utils.resources import get_resource_location import onaptests.utils.exceptions as onap_test_exceptions from .settings import * # pylint: disable=W0614 @@ -19,13 +18,12 @@ ONLY_INSTANTIATE= False # if a yaml file is define, retrieve info from this yaml files # if not declare the parameters in the settings -SERVICE_YAML_TEMPLATE = (sys.path[-1] + "/onaptests/templates/vnf-services/" + - "basic_network-service.yaml") +SERVICE_YAML_TEMPLATE = get_resource_location("templates/vnf-services/basic_network-service.yaml") try: # Try to retrieve the SERVICE NAME from the yaml file with open(SERVICE_YAML_TEMPLATE, "r") as yaml_template: - yaml_config_file = load(yaml_template) + yaml_config_file = load(yaml_template, SafeLoader) SERVICE_NAME = next(iter(yaml_config_file.keys())) except (FileNotFoundError, ValueError): raise onap_test_exceptions.TestConfigurationException diff --git a/src/onaptests/configuration/basic_onboard_settings.py b/src/onaptests/configuration/basic_onboard_settings.py index 2fa1820..8975fa8 100644 --- a/src/onaptests/configuration/basic_onboard_settings.py +++ b/src/onaptests/configuration/basic_onboard_settings.py @@ -1,14 +1,16 @@ -import sys import random import string -from yaml import load +from yaml import load, SafeLoader from jinja2 import Environment, PackageLoader + import onaptests.utils.exceptions as onap_test_exceptions +from onaptests.utils.resources import get_resource_location from .settings import * # pylint: disable=W0614 """ Creation of service to onboard""" + # We need to create a service file with a random service name, # to be sure that we force onboarding def generate_service_config_yaml_file(): @@ -28,10 +30,7 @@ def generate_service_config_yaml_file(): rendered_template = template.render(service_name=service_name) - file_name = (sys.path[-1] + "/onaptests/templates/vnf-services/" + - "basic-onboard-service.yaml") - - with open(file_name, 'w+') as file_to_write: + with open(SERVICE_YAML_TEMPLATE, 'w+') as file_to_write: file_to_write.write(rendered_template) """Basic onboard service to only onboard a service in SDC""" @@ -48,14 +47,14 @@ SERVICE_COMPONENTS="SDC" # if a yaml file is define, retrieve info from this yaml files # if not declare the parameters in the settings + +SERVICE_YAML_TEMPLATE = get_resource_location("templates/vnf-services/basic-onboard-service.yaml") generate_service_config_yaml_file() -SERVICE_YAML_TEMPLATE = (sys.path[-1] + "/onaptests/templates/vnf-services/" + - "basic-onboard-service.yaml") try: # Try to retrieve the SERVICE NAME from the yaml file with open(SERVICE_YAML_TEMPLATE, "r") as yaml_template: - yaml_config_file = load(yaml_template) + yaml_config_file = load(yaml_template, SafeLoader) SERVICE_NAME = next(iter(yaml_config_file.keys())) except (FileNotFoundError, ValueError): raise onap_test_exceptions.TestConfigurationException diff --git a/src/onaptests/configuration/basic_vm_macro_settings.py b/src/onaptests/configuration/basic_vm_macro_settings.py index 2784f86..522c66a 100644 --- a/src/onaptests/configuration/basic_vm_macro_settings.py +++ b/src/onaptests/configuration/basic_vm_macro_settings.py @@ -2,18 +2,18 @@ import os import openstack from pathlib import Path from uuid import uuid4 - -from yaml import load +from yaml import load, SafeLoader import onaptests.utils.exceptions as onap_test_exceptions +from onaptests.utils.resources import get_resource_location from .settings import * # pylint: disable=W0614 CLEANUP_FLAG = True -CDS_DD_FILE = Path(Path(__file__).parent.parent, "templates/artifacts/dd.json") -CDS_CBA_UNENRICHED = Path(Path(__file__).parent.parent, "templates/artifacts/basic_vm_cba.zip") -CDS_CBA_ENRICHED = "/tmp/BASIC_VM_enriched.zip" +CDS_DD_FILE = Path(get_resource_location("templates/artifacts/dd.json")) +CDS_CBA_UNENRICHED = Path(get_resource_location("templates/artifacts/basic_vm_cba.zip")) +CDS_CBA_ENRICHED = Path("/tmp/BASIC_VM_enriched.zip") ONLY_INSTANTIATE = False USE_MULTICLOUD = False @@ -47,13 +47,12 @@ PROJECT = "basicvm-project" LINE_OF_BUSINESS = "basicvm-lob" PLATFORM = "basicvm-platform" CLOUD_DOMAIN = "Default" -SERVICE_YAML_TEMPLATE = Path(Path(__file__).parent.parent, "templates/vnf-services/" + - "basic_vm_macro-service.yaml") +SERVICE_YAML_TEMPLATE = Path(get_resource_location("templates/vnf-services/basic_vm_macro-service.yaml")) try: # Try to retrieve the SERVICE NAME from the yaml file with open(SERVICE_YAML_TEMPLATE, "r") as yaml_template: - yaml_config_file = load(yaml_template) + yaml_config_file = load(yaml_template, SafeLoader) SERVICE_NAME = next(iter(yaml_config_file.keys())) except (FileNotFoundError, ValueError): raise onap_test_exceptions.TestConfigurationException diff --git a/src/onaptests/configuration/basic_vm_macro_stability_settings.py b/src/onaptests/configuration/basic_vm_macro_stability_settings.py index b2fe037..67a423c 100644 --- a/src/onaptests/configuration/basic_vm_macro_stability_settings.py +++ b/src/onaptests/configuration/basic_vm_macro_stability_settings.py @@ -1,5 +1,4 @@ from .basic_vm_macro_settings import * # pylint: disable=W0614 -SERVICE_YAML_TEMPLATE = Path(Path(__file__).parent.parent, "templates/vnf-services/" + - "basic_vm_macro_stability-service.yaml") +SERVICE_YAML_TEMPLATE = Path(get_resource_location("templates/vnf-services/basic_vm_macro_stability-service.yaml")) MODEL_YAML_TEMPLATE = None diff --git a/src/onaptests/configuration/basic_vm_multicloud_yaml_settings.py b/src/onaptests/configuration/basic_vm_multicloud_yaml_settings.py index 51c74e5..cb16d81 100644 --- a/src/onaptests/configuration/basic_vm_multicloud_yaml_settings.py +++ b/src/onaptests/configuration/basic_vm_multicloud_yaml_settings.py @@ -1,4 +1,4 @@ -import sys +from onaptests.utils.resources import get_resource_location from .settings import * # pylint: disable=W0614 """ Specific Basic VM with multicloud and yaml config scenario.""" @@ -40,5 +40,5 @@ PLATFORM = "sdktests_platform" SERVICE_INSTANCE_NAME = "sdktests_service_instance_name" -SERVICE_YAML_TEMPLATE = sys.path[-1] + "/onaptests/templates/vnf-services/basic_vm-service.yaml" +SERVICE_YAML_TEMPLATE = get_resource_location("templates/vnf-services/basic_vm-service.yaml") MODEL_YAML_TEMPLATE = None diff --git a/src/onaptests/configuration/basic_vm_settings.py b/src/onaptests/configuration/basic_vm_settings.py index 2c7d85f..0b33ec1 100644 --- a/src/onaptests/configuration/basic_vm_settings.py +++ b/src/onaptests/configuration/basic_vm_settings.py @@ -1,8 +1,7 @@ import os import openstack -import sys -from yaml import load - +from yaml import load, SafeLoader +from onaptests.utils.resources import get_resource_location import onaptests.utils.exceptions as onap_test_exceptions from .settings import * # pylint: disable=W0614 @@ -20,13 +19,12 @@ ONLY_INSTANTIATE= False # if a yaml file is define, retrieve info from this yaml files # if not declare the parameters in the settings -SERVICE_YAML_TEMPLATE = (sys.path[-1] + "/onaptests/templates/vnf-services/" + - "basic_vm-service.yaml") +SERVICE_YAML_TEMPLATE = get_resource_location("templates/vnf-services/basic_vm-service.yaml") try: # Try to retrieve the SERVICE NAME from the yaml file with open(SERVICE_YAML_TEMPLATE, "r") as yaml_template: - yaml_config_file = load(yaml_template) + yaml_config_file = load(yaml_template, SafeLoader) SERVICE_NAME = next(iter(yaml_config_file.keys())) except (FileNotFoundError, ValueError): raise onap_test_exceptions.TestConfigurationException diff --git a/src/onaptests/configuration/cba_enrichment_settings.py b/src/onaptests/configuration/cba_enrichment_settings.py index 0770d8d..2d05cd2 100644 --- a/src/onaptests/configuration/cba_enrichment_settings.py +++ b/src/onaptests/configuration/cba_enrichment_settings.py @@ -1,11 +1,12 @@ from pathlib import Path +from onaptests.utils.resources import get_resource_location from .settings import * # pylint: disable=W0614 SERVICE_NAME = "CDS blueprint enrichment" CLEANUP_FLAG = True -CDS_DD_FILE = Path(Path(__file__).parent.parent, "templates/artifacts/dd.json") -CDS_CBA_UNENRICHED = Path(Path(__file__).parent.parent, "templates/artifacts/PNF_DEMO.zip") +CDS_DD_FILE = Path(get_resource_location("templates/artifacts/dd.json")) +CDS_CBA_UNENRICHED = Path(get_resource_location("templates/artifacts/PNF_DEMO.zip")) CDS_CBA_ENRICHED = "/tmp/PNF_DEMO_enriched.zip" diff --git a/src/onaptests/configuration/cds_resource_resolution_settings.py b/src/onaptests/configuration/cds_resource_resolution_settings.py index 16e23a6..b18d2ac 100644 --- a/src/onaptests/configuration/cds_resource_resolution_settings.py +++ b/src/onaptests/configuration/cds_resource_resolution_settings.py @@ -1,6 +1,7 @@ from pathlib import Path from uuid import uuid4 +from onaptests.utils.resources import get_resource_location from .settings import * # pylint: disable=W0614 CLEANUP_FLAG = True @@ -12,15 +13,15 @@ CLOUD_REGION_VERSION = "1.0" CLOUD_OWNER_DEFINED_TYPE = "N/A" COMPLEX_PHYSICAL_LOCATION_ID = "sdktests" -MSB_K8S_DEFINITION_ATRIFACT_FILE_PATH = Path(Path(__file__).parent.parent, - "templates/artifacts/cds-resource-resolution/cds-mock-server.tar.gz") +MSB_K8S_DEFINITION_ATRIFACT_FILE_PATH = Path(get_resource_location( + "templates/artifacts/cds-resource-resolution/cds-mock-server.tar.gz")) MSB_K8S_RB_NAME = f"cds-ms-rb-{str(uuid4())}" MSB_K8S_RB_VERSION = "v1" -MSB_K8S_PROFILE_ARTIFACT_FILE_PATH = Path(Path(__file__).parent.parent, - "templates/artifacts/profile.tar.gz") +MSB_K8S_PROFILE_ARTIFACT_FILE_PATH = Path(get_resource_location( + "templates/artifacts/profile.tar.gz")) MSB_K8S_PROFILE_NAME = f"cds-ms-prof-{str(uuid4())}" K8S_VERSION = "1.0" -K8S_CONFIG = str(Path(Path(__file__).parent.parent, "templates/artifacts/config")) +K8S_CONFIG = get_resource_location("templates/artifacts/config") K8S_ADDITIONAL_RESOURCES_NAMESPACE = "onap-tests" CDS_MOCKSERVER_EXPECTATIONS = [ { @@ -55,9 +56,9 @@ CDS_MOCKSERVER_EXPECTATIONS = [ } ] -CDS_DD_FILE = Path(Path(__file__).parent.parent, "templates/artifacts/cds-resource-resolution/dd.json") -CDS_CBA_UNENRICHED = Path(Path(__file__).parent.parent, "templates/artifacts/cds-resource-resolution/resource-resolution.zip") -CDS_CBA_ENRICHED = "/tmp/resource-resolution-enriched.zip" +CDS_DD_FILE = Path(get_resource_location("templates/artifacts/cds-resource-resolution/dd.json")) +CDS_CBA_UNENRICHED = Path(get_resource_location("templates/artifacts/cds-resource-resolution/resource-resolution.zip")) +CDS_CBA_ENRICHED = Path("/tmp/resource-resolution-enriched.zip") CDS_WORKFLOW_NAME = "resource-resolution" CDS_WORKFLOW_INPUT = { "template-prefix": [ diff --git a/src/onaptests/configuration/clearwater_ims_nomulticloud_settings.py b/src/onaptests/configuration/clearwater_ims_nomulticloud_settings.py index d20d9ff..5803df3 100644 --- a/src/onaptests/configuration/clearwater_ims_nomulticloud_settings.py +++ b/src/onaptests/configuration/clearwater_ims_nomulticloud_settings.py @@ -1,8 +1,7 @@ import os -import sys import openstack -from yaml import load - +from yaml import load, SafeLoader +from onaptests.utils.resources import get_resource_location from .settings import * # pylint: disable=W0614 """ Specific clearwater IMS without multicloud.""" @@ -21,13 +20,12 @@ VF_NAME = "clearwater-ims_ubuntu_vf" VSP_NAME = "clearwater-ims_ubuntu_vsp" # if a yaml file is define, retrieve info from this yaml files # if not declare the parameters in the settings -SERVICE_YAML_TEMPLATE = (sys.path[-1] + "/onaptests/templates/vnf-services/" + - "clearwater-ims-service.yaml") +SERVICE_YAML_TEMPLATE = get_resource_location("templates/vnf-services/clearwater-ims-service.yaml") try: # Try to retrieve the SERVICE NAME from the yaml file with open(SERVICE_YAML_TEMPLATE, "r") as yaml_template: - yaml_config_file = load(yaml_template) + yaml_config_file = load(yaml_template, SafeLoader) SERVICE_NAME = next(iter(yaml_config_file.keys())) except ValueError: SERVICE_NAME = "" # Fill me diff --git a/src/onaptests/configuration/multi_vnf_ubuntu_settings.py b/src/onaptests/configuration/multi_vnf_ubuntu_settings.py index 47795fd..bb7b8b5 100644 --- a/src/onaptests/configuration/multi_vnf_ubuntu_settings.py +++ b/src/onaptests/configuration/multi_vnf_ubuntu_settings.py @@ -1,9 +1,9 @@ import uuid import os -import sys from pathlib import Path import openstack from jinja2 import Environment, PackageLoader +from onaptests.utils.resources import get_resource_location from .settings import * # pylint: disable=W0614 VNF_FILENAME_PREFIX = "multi-vnf-ubuntu" @@ -23,8 +23,7 @@ def generate_service_config_yaml_file(filename): rendered_template = template.render(service_name=SERVICE_NAME) - file_name = (sys.path[-1] + "/onaptests/templates/vnf-services/" + - f"{filename}.yaml") + file_name = get_resource_location(f"templates/vnf-services/{filename}.yaml") with open(file_name, 'w+') as file_to_write: file_to_write.write(rendered_template) @@ -32,8 +31,8 @@ def generate_service_config_yaml_file(filename): CLEANUP_FLAG = True -CDS_DD_FILE = Path(Path(__file__).parent.parent, "templates/artifacts/dd_nso_ubuntu.json") -CDS_CBA_UNENRICHED = Path(Path(__file__).parent.parent, "templates/artifacts/nso_ubuntuvnf.zip") +CDS_DD_FILE = Path(get_resource_location("templates/artifacts/dd_nso_ubuntu.json")) +CDS_CBA_UNENRICHED = Path(get_resource_location("templates/artifacts/nso_ubuntuvnf.zip")) CDS_CBA_ENRICHED = "/tmp/UBUNTUVNF_enriched.zip" ONLY_INSTANTIATE = False @@ -69,11 +68,11 @@ CLOUD_DOMAIN = "Default" VENDOR_NAME = 'ubuntu_xtesting_vendor' -SERVICE_YAML_TEMPLATE = Path(Path(__file__).parent.parent, "templates/vnf-services/" + - f"{VNF_FILENAME_PREFIX}-service.yaml") +SERVICE_YAML_TEMPLATE = Path(get_resource_location("templates/vnf-services/" + + f"{VNF_FILENAME_PREFIX}-service.yaml")) -MODEL_YAML_TEMPLATE = Path(Path(__file__).parent.parent, "templates/vnf-services/" + - f"{VNF_FILENAME_PREFIX}-model.yaml") +MODEL_YAML_TEMPLATE = Path(get_resource_location("templates/vnf-services/" + + f"{VNF_FILENAME_PREFIX}-model.yaml")) generate_service_config_yaml_file(f"{VNF_FILENAME_PREFIX}-service") diff --git a/src/onaptests/configuration/pnf_macro_settings.py b/src/onaptests/configuration/pnf_macro_settings.py index eaca93a..5f2b98c 100644 --- a/src/onaptests/configuration/pnf_macro_settings.py +++ b/src/onaptests/configuration/pnf_macro_settings.py @@ -1,6 +1,7 @@ from pathlib import Path from uuid import uuid4 +from onaptests.utils.resources import get_resource_location from .settings import * # pylint: disable=W0614 ONLY_INSTANTIATE = False @@ -10,13 +11,10 @@ USE_MULTICLOUD = False VENDOR_NAME = "pnf_macro_vendor" SERVICE_NAME = "test_pnf_macro" SERVICE_INSTANCE_NAME = "TestPNFMacroInstantiation" -SERVICE_YAML_TEMPLATE = Path(Path(__file__).parent.parent, - "templates/vnf-services/pnf-service.yaml") +SERVICE_YAML_TEMPLATE = Path(get_resource_location("templates/vnf-services/pnf-service.yaml")) -CDS_DD_FILE = Path(Path(__file__).parent.parent, - "templates/artifacts/dd.json") -CDS_CBA_UNENRICHED = Path(Path(__file__).parent.parent, - "templates/artifacts/PNF_DEMO.zip") +CDS_DD_FILE = Path(get_resource_location("templates/artifacts/dd.json")) +CDS_CBA_UNENRICHED = Path(get_resource_location("templates/artifacts/PNF_DEMO.zip")) CDS_CBA_ENRICHED = "/tmp/PNF_DEMO_enriched.zip" CLOUD_REGION_CLOUD_OWNER = "basicnf-owner" # must not contain _ @@ -33,18 +31,16 @@ PLATFORM = "pnf_macro_platform" INSTANTIATION_TIMEOUT = 600 -MSB_K8S_DEFINITION_ATRIFACT_FILE_PATH = Path(Path(__file__).parent.parent, - "templates/artifacts/pnf-simulator.tar.gz") +MSB_K8S_DEFINITION_ATRIFACT_FILE_PATH = Path(get_resource_location("templates/artifacts/pnf-simulator.tar.gz")) MSB_K8S_RB_NAME = f"pnf-cnf-rb-{str(uuid4())}" MSB_K8S_RB_VERSION = "v1" -MSB_K8S_PROFILE_ARTIFACT_FILE_PATH = Path(Path(__file__).parent.parent, - "templates/artifacts/profile.tar.gz") +MSB_K8S_PROFILE_ARTIFACT_FILE_PATH = Path(get_resource_location("templates/artifacts/profile.tar.gz")) MSB_K8S_PROFILE_NAME = f"pnf-cnf-profile-{str(uuid4())}" K8S_VERSION = "1.0" -K8S_CONFIG = str(Path(Path(__file__).parent.parent, "templates/artifacts/config")) +K8S_CONFIG = get_resource_location("templates/artifacts/config") K8S_ADDITIONAL_RESOURCES_NAMESPACE = "onap-tests" -SERVICE_INSTANCE_NAME = "TestPNFMacroInstantiation" +SERVICE_INSTANCE_NAME = f"TestPNFMacroInstantiation_{str(uuid4())}" DCAE_VES_COLLECTOR_POD_NAME = "dcae-ves-collector" PNF_WAIT_TIME = 60.0 |