aboutsummaryrefslogtreecommitdiffstats
path: root/src/onaptests/configuration/basic_vm_macro_settings.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/onaptests/configuration/basic_vm_macro_settings.py')
-rw-r--r--src/onaptests/configuration/basic_vm_macro_settings.py33
1 files changed, 19 insertions, 14 deletions
diff --git a/src/onaptests/configuration/basic_vm_macro_settings.py b/src/onaptests/configuration/basic_vm_macro_settings.py
index 1aeea26..ce1a607 100644
--- a/src/onaptests/configuration/basic_vm_macro_settings.py
+++ b/src/onaptests/configuration/basic_vm_macro_settings.py
@@ -1,13 +1,17 @@
import os
-import openstack
from pathlib import Path
from uuid import uuid4
-from yaml import load, SafeLoader
+
+import openstack
+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
+from .settings import IF_VALIDATION
+SERVICE_DETAILS = "Onboarding, distribution and instanitation of an Ubuntu VM using macro"
CLEANUP_FLAG = True
@@ -32,15 +36,16 @@ COMPLEX_DATA_CENTER_CODE = "1234-5"
GLOBAL_CUSTOMER_ID = "basicvm-customer"
-TEST_CLOUD = os.getenv('OS_TEST_CLOUD')
-cloud = openstack.connect(cloud=TEST_CLOUD)
-VIM_USERNAME = cloud.config.auth.get('username', 'Fill me')
-VIM_PASSWORD = cloud.config.auth.get('password', 'Fill me')
-VIM_SERVICE_URL = cloud.config.auth.get('auth_url', 'Fill me')
-TENANT_ID = cloud.config.auth.get('project_id', 'Fill me')
-TENANT_NAME = cloud.config.auth.get('project_name', 'Fill me')
-CLOUD_REGION_ID = cloud.config.auth.get('region_name', 'RegionOne')
-CLOUD_DOMAIN = cloud.config.auth.get('project_domain_name', 'Default')
+if not IF_VALIDATION:
+ TEST_CLOUD = os.getenv('OS_TEST_CLOUD')
+ cloud = openstack.connect(cloud=TEST_CLOUD)
+ VIM_USERNAME = cloud.config.auth.get('username', 'Fill me')
+ VIM_PASSWORD = cloud.config.auth.get('password', 'Fill me')
+ VIM_SERVICE_URL = cloud.config.auth.get('auth_url', 'Fill me')
+ TENANT_ID = cloud.config.auth.get('project_id', 'Fill me')
+ TENANT_NAME = cloud.config.auth.get('project_name', 'Fill me')
+ CLOUD_REGION_ID = cloud.config.auth.get('region_name', 'RegionOne')
+ CLOUD_DOMAIN = cloud.config.auth.get('project_domain_name', 'Default')
OWNING_ENTITY = "basicvm-oe"
PROJECT = "basicvm-project"
@@ -52,11 +57,11 @@ SERVICE_YAML_TEMPLATE = Path(get_resource_location(
try:
# Try to retrieve the SERVICE NAME from the yaml file
- with open(SERVICE_YAML_TEMPLATE, "r") as yaml_template:
+ 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):
- raise onap_test_exceptions.TestConfigurationException
+except (FileNotFoundError, ValueError) as exc:
+ raise onap_test_exceptions.TestConfigurationException from exc
SERVICE_INSTANCE_NAME = f"basic_macro_{str(uuid4())}"