aboutsummaryrefslogtreecommitdiffstats
path: root/src/onaptests/steps
diff options
context:
space:
mode:
authorandreasgeissler <andreas-geissler@telekom.de>2020-09-09 18:01:12 +0200
committerandreasgeissler <andreas-geissler@telekom.de>2020-09-10 17:49:24 +0200
commita5c39a3409a795fb0709b952e15ac2746364358b (patch)
treefb887c560ce1699543d54572279207830c92ef31 /src/onaptests/steps
parent80e8e99d9b33fc5929c253aba84d330ae68f01de (diff)
Updated yaml-based instantiation and MultiCloud registry
Correction for linter and updated run script Issue-ID: TEST-256 Signed-off-by: andreasgeissler <andreas-geissler@telekom.de> Change-Id: Ia1f6f41f8fc6ed74c836ea7aa987f10487f377a6
Diffstat (limited to 'src/onaptests/steps')
-rw-r--r--src/onaptests/steps/cloud/register_cloud_to_multicloud.py22
-rw-r--r--src/onaptests/steps/instantiate/service_ala_carte.py13
-rw-r--r--src/onaptests/steps/instantiate/vf_module_ala_carte.py10
-rw-r--r--src/onaptests/steps/instantiate/vnf_ala_carte.py7
-rw-r--r--src/onaptests/steps/onboard/vsp.py9
5 files changed, 50 insertions, 11 deletions
diff --git a/src/onaptests/steps/cloud/register_cloud_to_multicloud.py b/src/onaptests/steps/cloud/register_cloud_to_multicloud.py
index c3a001c..4a1b577 100644
--- a/src/onaptests/steps/cloud/register_cloud_to_multicloud.py
+++ b/src/onaptests/steps/cloud/register_cloud_to_multicloud.py
@@ -1,3 +1,4 @@
+import time
from uuid import uuid4
from onapsdk.aai.cloud_infrastructure import CloudRegion
@@ -25,11 +26,11 @@ class RegisterCloudRegionToMulticloudStep(BaseStep):
Use settings values:
- CLOUD_REGION_CLOUD_OWNER,
- CLOUD_REGION_ID,
- - CLOUD_REGION_TYPE,
- CLOUD_DOMAIN,
- VIM_USERNAME,
- VIM_PASSWORD,
- - VIM_SERVICE_URL.
+ - VIM_SERVICE_URL,
+ - TENANT_NAME.
"""
super().execute()
cloud_region = CloudRegion.get_by_id(
@@ -40,8 +41,21 @@ class RegisterCloudRegionToMulticloudStep(BaseStep):
esr_system_info_id=str(uuid4()),
user_name=settings.VIM_USERNAME,
password=settings.VIM_PASSWORD,
- system_type=settings.CLOUD_REGION_TYPE,
+ system_type="VIM",
service_url=settings.VIM_SERVICE_URL,
- cloud_domain=settings.CLOUD_DOMAIN
+ ssl_insecure=False,
+ system_status="active",
+ cloud_domain=settings.CLOUD_DOMAIN,
+ default_tenant=settings.TENANT_NAME
)
cloud_region.register_to_multicloud()
+
+ time.sleep(20)
+ nb_try = 0
+ nb_try_max = 3
+ while nb_try < nb_try_max:
+ if not cloud_region.tenants:
+ time.sleep(20)
+ else:
+ break
+ nb_try += 1
diff --git a/src/onaptests/steps/instantiate/service_ala_carte.py b/src/onaptests/steps/instantiate/service_ala_carte.py
index 011528d..4742d61 100644
--- a/src/onaptests/steps/instantiate/service_ala_carte.py
+++ b/src/onaptests/steps/instantiate/service_ala_carte.py
@@ -83,6 +83,7 @@ class YamlTemplateServiceAlaCarteInstantiateStep(YamlTemplateBaseStep):
"""
super().__init__(cleanup=cleanup)
self._yaml_template: dict = None
+ self._service_instance_name: str = None
self.add_step(YamlTemplateServiceOnboardStep(cleanup))
self.add_step(ConnectServiceSubToCloudRegionStep(cleanup))
@@ -129,7 +130,9 @@ class YamlTemplateServiceAlaCarteInstantiateStep(YamlTemplateBaseStep):
"""
if self.is_root:
- return f"{self.service_name}-{str(uuid4())}"
+ if not self._service_instance_name:
+ self._service_instance_name: str = f"{self.service_name}-{str(uuid4())}"
+ return self._service_instance_name
return self.parent.service_instance_name
def execute(self):
@@ -155,9 +158,13 @@ class YamlTemplateServiceAlaCarteInstantiateStep(YamlTemplateBaseStep):
cloud_region_id=settings.CLOUD_REGION_ID,
)
tenant: Tenant = cloud_region.get_tenant(settings.TENANT_ID)
- owning_entity = AaiOwningEntity.get_by_owning_entity_name(settings.OWNING_ENTITY)
+ try:
+ owning_entity = AaiOwningEntity.get_by_owning_entity_name(
+ settings.OWNING_ENTITY)
+ except ValueError:
+ self._logger.info("Owning entity not found, create it")
+ owning_entity = AaiOwningEntity.create(settings.OWNING_ENTITY)
vid_project = Project.create(settings.PROJECT)
-
service_instantiation = ServiceInstantiation.instantiate_so_ala_carte(
service,
cloud_region,
diff --git a/src/onaptests/steps/instantiate/vf_module_ala_carte.py b/src/onaptests/steps/instantiate/vf_module_ala_carte.py
index fd4b368..b4ff002 100644
--- a/src/onaptests/steps/instantiate/vf_module_ala_carte.py
+++ b/src/onaptests/steps/instantiate/vf_module_ala_carte.py
@@ -22,6 +22,7 @@ class YamlTemplateVfModuleAlaCarteInstantiateStep(YamlTemplateBaseStep):
"""
super().__init__(cleanup=cleanup)
self._yaml_template: dict = None
+ self._service_instance_name: str = None
self.add_step(YamlTemplateVnfAlaCarteInstantiateStep(cleanup))
@property
@@ -67,7 +68,9 @@ class YamlTemplateVfModuleAlaCarteInstantiateStep(YamlTemplateBaseStep):
"""
if self.is_root:
- return f"{self.service_name}-{str(uuid4())}"
+ if not self._service_instance_name:
+ self._service_instance_name: str = f"{self.service_name}-{str(uuid4())}"
+ return self._service_instance_name
return self.parent.service_instance_name
def get_vnf_parameters(self, vnf_name: str) -> Iterable[VnfParameter]:
@@ -80,6 +83,9 @@ class YamlTemplateVfModuleAlaCarteInstantiateStep(YamlTemplateBaseStep):
Iterator[Iterable[VnfParameter]]: VNF parameter
"""
+
+ # workaround, as VNF name differs from model name (added " 0")
+ vnf_name=vnf_name.split()[0]
for vnf in self.yaml_template[self.service_name]["vnfs"]:
if vnf["vnf_name"] == vnf_name:
for vnf_parameter in vnf["vnf_parameters"]:
@@ -105,7 +111,7 @@ class YamlTemplateVfModuleAlaCarteInstantiateStep(YamlTemplateBaseStep):
for vnf_instance in service_instance.vnf_instances:
vf_module_instantiation = vnf_instance.add_vf_module(
vnf_instance.vnf.vf_module,
- vnf_parameters= self.get_vnf_parameters(vnf_instance.vnf.vnf_name))
+ vnf_parameters= self.get_vnf_parameters(vnf_instance.vnf.name))
while not vf_module_instantiation.finished:
time.sleep(10)
if vf_module_instantiation.failed:
diff --git a/src/onaptests/steps/instantiate/vnf_ala_carte.py b/src/onaptests/steps/instantiate/vnf_ala_carte.py
index 116b574..7701630 100644
--- a/src/onaptests/steps/instantiate/vnf_ala_carte.py
+++ b/src/onaptests/steps/instantiate/vnf_ala_carte.py
@@ -22,6 +22,7 @@ class YamlTemplateVnfAlaCarteInstantiateStep(YamlTemplateBaseStep):
"""
super().__init__(cleanup=cleanup)
self._yaml_template: dict = None
+ self._service_instance_name: str = None
self.add_step(YamlTemplateServiceAlaCarteInstantiateStep(cleanup))
@property
@@ -67,7 +68,9 @@ class YamlTemplateVnfAlaCarteInstantiateStep(YamlTemplateBaseStep):
"""
if self.is_root:
- return f"{self.service_name}-{str(uuid4())}"
+ if not self._service_instance_name:
+ self._service_instance_name: str = f"{self.service_name}-{str(uuid4())}"
+ return self._service_instance_name
return self.parent.service_instance_name
def execute(self):
@@ -88,7 +91,7 @@ class YamlTemplateVnfAlaCarteInstantiateStep(YamlTemplateBaseStep):
service_instance: ServiceInstance = service_subscription.get_service_instance_by_name(self.service_instance_name)
line_of_business: LineOfBusiness = LineOfBusiness(settings.LINE_OF_BUSINESS)
platform: Platform = Platform(settings.PLATFORM)
- for idx, vnf in service.vnfs:
+ for idx, vnf in enumerate(service.vnfs):
vnf_instantiation = service_instance.add_vnf(vnf, line_of_business, platform, f"{self.service_instance_name}_vnf_{idx}")
while not vnf_instantiation.finished:
time.sleep(10)
diff --git a/src/onaptests/steps/onboard/vsp.py b/src/onaptests/steps/onboard/vsp.py
index 75055de..50f1dfc 100644
--- a/src/onaptests/steps/onboard/vsp.py
+++ b/src/onaptests/steps/onboard/vsp.py
@@ -36,6 +36,15 @@ class VspOnboardStep(BaseStep):
class YamlTemplateVspOnboardStep(YamlTemplateBaseStep):
"""Vsp onboard using YAML template step."""
+ def __init__(self, cleanup=False):
+ """Initialize step.
+
+ Substeps:
+ - VendorOnboardStep.
+ """
+ super().__init__(cleanup=cleanup)
+ self.add_step(VendorOnboardStep(cleanup=cleanup))
+
@property
def yaml_template(self) -> dict:
"""YAML template.