aboutsummaryrefslogtreecommitdiffstats
path: root/src/onaptests/configuration
diff options
context:
space:
mode:
authormrichomme <morgan.richomme@orange.com>2020-10-13 12:52:24 +0200
committermrichomme <morgan.richomme@orange.com>2020-10-14 11:27:35 +0200
commitb7b9796d16a2e53e0e58ae9888dade1e89a0cc19 (patch)
tree379944906ed2c5a837dc1e09810235fd03a37e8b /src/onaptests/configuration
parent6276bed4df9b8458c4b6805edab81652fb15de76 (diff)
Improve xtesting integration
All the exceptions shall be caught by the use case Issue-ID: TEST-257 Signed-off-by: mrichomme <morgan.richomme@orange.com> Change-Id: Ie2762ad869d8984ce2125db4a8ef4990ee50f82a Signed-off-by: mrichomme <morgan.richomme@orange.com>
Diffstat (limited to 'src/onaptests/configuration')
-rw-r--r--src/onaptests/configuration/clearwater_ims_nomulticloud_settings.py32
-rw-r--r--src/onaptests/configuration/ubuntu16_nomulticloud_settings.py38
2 files changed, 21 insertions, 49 deletions
diff --git a/src/onaptests/configuration/clearwater_ims_nomulticloud_settings.py b/src/onaptests/configuration/clearwater_ims_nomulticloud_settings.py
index 0b13762..1a1cb3c 100644
--- a/src/onaptests/configuration/clearwater_ims_nomulticloud_settings.py
+++ b/src/onaptests/configuration/clearwater_ims_nomulticloud_settings.py
@@ -31,7 +31,6 @@ try:
SERVICE_NAME = next(iter(yaml_config_file.keys()))
except ValueError:
SERVICE_NAME = "" # Fill me
- VSP_FILE_PATH = "" # Fill me
CLOUD_REGION_CLOUD_OWNER = "clearwater-ims-cloud-owner"
CLOUD_REGION_TYPE = "openstack"
@@ -55,26 +54,11 @@ SERVICE_INSTANCE_NAME = "clearwater-ims_service_instance"
# Assuming a cloud.yaml is available, use the openstack client
# to retrieve cloud info and avoid data duplication
TEST_CLOUD = os.getenv('OS_TEST_CLOUD')
-try:
- if TEST_CLOUD is not None:
- cloud = openstack.connect(cloud=TEST_CLOUD)
- VIM_USERNAME = cloud.config.auth['username']
- VIM_PASSWORD = cloud.config.auth['password']
- VIM_SERVICE_URL = cloud.config.auth['auth_url']
- TENANT_ID = cloud.config.auth['project_id']
- TENANT_NAME = cloud.config.auth['project_name']
- CLOUD_REGION_ID = cloud.config.region_name
- CLOUD_DOMAIN = cloud.config.auth['project_domain_name']
- else:
- raise KeyError
-except KeyError:
- # If you do not use the cloud.yaml as imput for your openstack
- # put the input data here
- # Note if 1 parameter is missing in the clouds.yaml, we fallback here
- TENANT_ID = "" # Fill me
- TENANT_NAME = "" # Fill me
- VIM_USERNAME = "" # Fill me
- VIM_PASSWORD = "" # Fill me
- VIM_SERVICE_URL = "" # Fill me
- CLOUD_REGION_ID = "RegionOne" # Update me if needed
- CLOUD_DOMAIN = "Default" # Update me if needed
+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.get('region_name','RegionOne')
+CLOUD_DOMAIN = cloud.config.auth.get('project_domain_name','Default')
diff --git a/src/onaptests/configuration/ubuntu16_nomulticloud_settings.py b/src/onaptests/configuration/ubuntu16_nomulticloud_settings.py
index 310fafc..21795ac 100644
--- a/src/onaptests/configuration/ubuntu16_nomulticloud_settings.py
+++ b/src/onaptests/configuration/ubuntu16_nomulticloud_settings.py
@@ -3,6 +3,7 @@ import openstack
import sys
from yaml import load
+import onaptests.utils.exceptions as onap_test_exceptions
from .settings import * # pylint: disable=W0614
""" Specific ubuntu16 without multicloud."""
@@ -11,6 +12,7 @@ from .settings import * # pylint: disable=W0614
# The ONAP part
SERVICE_DETAILS="Onboarding, distribution and instanitation of an Ubuntu VM using à la carte"
SERVICE_COMPONENTS="SDC, DMAAP, AAI, SO, SDNC"
+
USE_MULTICLOUD = False
# Set ONLY_INSTANTIATE to true to run an instantiation without repeating
# onboarding and related AAI configuration (Cloud config)
@@ -26,8 +28,8 @@ try:
with open(SERVICE_YAML_TEMPLATE, "r") as yaml_template:
yaml_config_file = load(yaml_template)
SERVICE_NAME = next(iter(yaml_config_file.keys()))
-except ValueError:
- SERVICE_NAME = "" # Fill me
+except (FileNotFoundError, ValueError):
+ raise onap_test_exceptions.TestConfigurationException
CLEANUP_FLAG = True
CLEANUP_ACTIVITY_TIMER = 10 # nb of seconds before cleanup in case cleanup option is set
@@ -58,26 +60,12 @@ SERVICE_INSTANCE_NAME = "basicvm_ubuntu16_service_instance"
# Assuming a cloud.yaml is available, use the openstack client
# to retrieve cloud info and avoid data duplication
TEST_CLOUD = os.getenv('OS_TEST_CLOUD')
-try:
- if TEST_CLOUD is not None:
- cloud = openstack.connect(cloud=TEST_CLOUD)
- VIM_USERNAME = cloud.config.auth['username']
- VIM_PASSWORD = cloud.config.auth['password']
- VIM_SERVICE_URL = cloud.config.auth['auth_url']
- TENANT_ID = cloud.config.auth['project_id']
- TENANT_NAME = cloud.config.auth['project_name']
- CLOUD_REGION_ID = cloud.config.region_name
- CLOUD_DOMAIN = cloud.config.auth['project_domain_name']
- else:
- raise KeyError
-except KeyError:
- # If you do not use the cloud.yaml as imput for your openstack
- # put the input data here
- # Note if 1 parameter is missing in the clouds.yaml, we fallback here
- TENANT_ID = "" # Fill me
- TENANT_NAME = "" # Fill me
- VIM_USERNAME = "" # Fill me
- VIM_PASSWORD = "" # Fill me
- VIM_SERVICE_URL = "" # Fill me
- CLOUD_REGION_ID = "RegionOne" # Update me if needed
- CLOUD_DOMAIN = "Default" # Update me if needed
+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')