aboutsummaryrefslogtreecommitdiffstats
path: root/src/onaptests/steps/instantiate
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/instantiate
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/instantiate')
-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
3 files changed, 23 insertions, 7 deletions
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)