aboutsummaryrefslogtreecommitdiffstats
path: root/src/onaptests/steps/cloud
diff options
context:
space:
mode:
authorMichal Jagiello <michal.jagiello@t-mobile.pl>2021-03-23 18:23:48 +0000
committermorganrol <morgan.richomme@orange.com>2021-04-02 08:48:50 +0200
commit0a315a1b542a96d62fea12f49b353bca54464ee7 (patch)
tree9ec0f7d973c87e2aa79ec8db339b5fec07f76ddf /src/onaptests/steps/cloud
parent612848c7353ced7aa0f16ff90ad3afffa65e8aed (diff)
Basic VM macro
Issue-ID: INT-1894 Signed-off-by: Michal Jagiello <michal.jagiello@t-mobile.pl> Change-Id: Idd977cf3082587746fe27718a284197fda4afe5c
Diffstat (limited to 'src/onaptests/steps/cloud')
-rw-r--r--src/onaptests/steps/cloud/register_cloud.py62
1 files changed, 34 insertions, 28 deletions
diff --git a/src/onaptests/steps/cloud/register_cloud.py b/src/onaptests/steps/cloud/register_cloud.py
index 58c3e35..3065461 100644
--- a/src/onaptests/steps/cloud/register_cloud.py
+++ b/src/onaptests/steps/cloud/register_cloud.py
@@ -46,34 +46,37 @@ class RegisterCloudRegionStep(BaseStep):
- TENANT_NAME.
"""
super().execute()
- try:
- cloud_region: CloudRegion = CloudRegion.get_by_id(
- cloud_owner=settings.CLOUD_REGION_CLOUD_OWNER,
- cloud_region_id=settings.CLOUD_REGION_ID)
- except ResourceNotFound:
- cloud_region.add_esr_system_info(
- esr_system_info_id=str(uuid4()),
- user_name=settings.VIM_USERNAME,
- password=settings.VIM_PASSWORD,
- system_type="VIM",
- service_url=settings.VIM_SERVICE_URL,
- ssl_insecure=False,
- system_status="active",
- cloud_domain=settings.CLOUD_DOMAIN,
- default_tenant=settings.TENANT_NAME
- )
- if settings.USE_MULTICLOUD:
- self._logger.info("*Multicloud registration *")
- cloud_region.register_to_multicloud()
- time.sleep(20)
- nb_try = 0
- nb_try_max = 3
- while nb_try < nb_try_max:
+ cloud_region: CloudRegion = CloudRegion.get_by_id(
+ cloud_owner=settings.CLOUD_REGION_CLOUD_OWNER,
+ cloud_region_id=settings.CLOUD_REGION_ID)
+ cloud_region.add_esr_system_info(
+ esr_system_info_id=str(uuid4()),
+ user_name=settings.VIM_USERNAME,
+ password=settings.VIM_PASSWORD,
+ system_type="VIM",
+ service_url=settings.VIM_SERVICE_URL,
+ ssl_insecure=False,
+ system_status="active",
+ cloud_domain=settings.CLOUD_DOMAIN,
+ default_tenant=settings.TENANT_NAME
+ )
+ if settings.USE_MULTICLOUD:
+ self._logger.info("*Multicloud registration *")
+ cloud_region.register_to_multicloud()
+ time.sleep(20)
+ nb_try = 0
+ nb_try_max = 3
+ while nb_try < nb_try_max:
+ try:
if not cloud_region.tenants:
+ self._logger.debug("No tenats available, check one more time")
time.sleep(20)
else:
break
- nb_try += 1
+ except ResourceNotFound:
+ self._logger.debug("No tenats available, check one more time")
+ time.sleep(20)
+ nb_try += 1
# Retrieve the tenant, created by multicloud registration
# if it does not exist, create it
@@ -81,10 +84,13 @@ class RegisterCloudRegionStep(BaseStep):
cloud_region.get_tenant(settings.TENANT_ID)
except ResourceNotFound:
self._logger.warning("Impossible to retrieve the Specificed Tenant")
- self._logger.debug("If no multicloud selected, add the tenant")
- cloud_region.add_tenant(
- tenant_id=settings.TENANT_ID,
- tenant_name=settings.TENANT_NAME)
+ self._logger.debug("If no multicloud selected, add the tenant, reraise otherwise")
+ if not settings.USE_MULTICLOUD:
+ cloud_region.add_tenant(
+ tenant_id=settings.TENANT_ID,
+ tenant_name=settings.TENANT_NAME)
+ else:
+ raise
# be sure that an availability zone has been created
# if not, create it