aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukasz Rajewski <lukasz.rajewski@t-mobile.pl>2024-02-08 16:27:34 +0100
committerLukasz Rajewski <lukasz.rajewski@t-mobile.pl>2024-02-08 16:28:17 +0100
commita032fbea3cdd556243bd1bb4e92c2a77baef316f (patch)
treee8dacfafec271b6fbc4cfcb6c1795d722101c99b
parent6dc28a85e25b81bada36a1c21ba501e81a1e02c8 (diff)
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 <lukasz.rajewski@t-mobile.pl> Change-Id: Ib32763b8e5922c71bbd10f680e5a00d52fddcda2
-rw-r--r--src/onaptests/configuration/pnf_macro_settings.py13
1 files changed, 12 insertions, 1 deletions
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"