From a032fbea3cdd556243bd1bb4e92c2a77baef316f Mon Sep 17 00:00:00 2001 From: Lukasz Rajewski Date: Thu, 8 Feb 2024 16:27:34 +0100 Subject: Fixed issue of subscription name for pnf macro Fixed issue of subscription name for pnf macro Issue-ID: TEST-404 Signed-off-by: Lukasz Rajewski Change-Id: Ib32763b8e5922c71bbd10f680e5a00d52fddcda2 --- src/onaptests/configuration/pnf_macro_settings.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/onaptests/configuration/pnf_macro_settings.py b/src/onaptests/configuration/pnf_macro_settings.py index e568ec3..7ce67a0 100644 --- a/src/onaptests/configuration/pnf_macro_settings.py +++ b/src/onaptests/configuration/pnf_macro_settings.py @@ -1,6 +1,9 @@ from pathlib import Path from uuid import uuid4 +from yaml import SafeLoader, load + +import onaptests.utils.exceptions as onap_test_exceptions from onaptests.utils.resources import get_resource_location from .settings import * # noqa @@ -10,14 +13,22 @@ CLEANUP_FLAG = True USE_MULTICLOUD = False VENDOR_NAME = "pnf_macro_vendor" -SERVICE_NAME = "test_pnf_macro" SERVICE_DETAILS = "Onboarding, distribution and registration of PNF using macro" SERVICE_INSTANCE_NAME = "TestPNFMacroInstantiation" + SERVICE_YAML_TEMPLATE = Path(get_resource_location("templates/vnf-services/pnf-service.yaml")) generate_service_config_yaml_file(service_name="pnf_macro", # noqa service_template="pnf-service.yaml.j2", service_config=SERVICE_YAML_TEMPLATE) +try: + # Try to retrieve the SERVICE NAME from the yaml file + with open(SERVICE_YAML_TEMPLATE, "r", encoding="utf-8") as yaml_template: + yaml_config_file = load(yaml_template, SafeLoader) + SERVICE_NAME = next(iter(yaml_config_file.keys())) +except (FileNotFoundError, ValueError) as exc: + raise onap_test_exceptions.TestConfigurationException from exc + 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" -- cgit 1.2.3-korg