aboutsummaryrefslogtreecommitdiffstats
path: root/src/onaptests/steps/instantiate
diff options
context:
space:
mode:
Diffstat (limited to 'src/onaptests/steps/instantiate')
-rw-r--r--src/onaptests/steps/instantiate/k8s_profile_create.py6
-rw-r--r--src/onaptests/steps/instantiate/msb_k8s.py6
-rw-r--r--src/onaptests/steps/instantiate/sdnc_service.py56
-rw-r--r--src/onaptests/steps/instantiate/service_ala_carte.py8
-rw-r--r--src/onaptests/steps/instantiate/service_macro.py10
-rw-r--r--src/onaptests/steps/instantiate/vf_module_ala_carte.py8
-rw-r--r--src/onaptests/steps/instantiate/vl_ala_carte.py6
-rw-r--r--src/onaptests/steps/instantiate/vnf_ala_carte.py6
8 files changed, 51 insertions, 55 deletions
diff --git a/src/onaptests/steps/instantiate/k8s_profile_create.py b/src/onaptests/steps/instantiate/k8s_profile_create.py
index 27831c5..d3798e2 100644
--- a/src/onaptests/steps/instantiate/k8s_profile_create.py
+++ b/src/onaptests/steps/instantiate/k8s_profile_create.py
@@ -16,15 +16,15 @@ from .vnf_ala_carte import YamlTemplateVnfAlaCarteInstantiateStep
class K8SProfileStep(BaseStep):
"""CreateK8sProfileStep."""
- def __init__(self, cleanup=False):
+ def __init__(self):
"""Initialize step.
"""
- super().__init__(cleanup=cleanup)
+ super().__init__(cleanup=settings.CLEANUP_FLAG)
self._yaml_template: dict = None
self._service_instance_name: str = None
self._service_instance: ServiceInstance = None
- self.add_step(YamlTemplateVnfAlaCarteInstantiateStep(cleanup))
+ self.add_step(YamlTemplateVnfAlaCarteInstantiateStep())
@property
def description(self) -> str:
diff --git a/src/onaptests/steps/instantiate/msb_k8s.py b/src/onaptests/steps/instantiate/msb_k8s.py
index 724549c..9189282 100644
--- a/src/onaptests/steps/instantiate/msb_k8s.py
+++ b/src/onaptests/steps/instantiate/msb_k8s.py
@@ -9,14 +9,14 @@ from onaptests.steps.onboard.msb_k8s import CreateProfileStep
class CreateInstanceStep(BaseStep):
"""Create MSB k8s instance step."""
- def __init__(self, cleanup: bool = False) -> None:
+ def __init__(self) -> None:
"""Initialize step.
Substeps:
- CreateProfileStep.
"""
- super().__init__(cleanup=cleanup)
- self.add_step(CreateProfileStep(cleanup=cleanup))
+ super().__init__(cleanup=settings.CLEANUP_FLAG)
+ self.add_step(CreateProfileStep())
self.instance: Instance = None
@property
diff --git a/src/onaptests/steps/instantiate/sdnc_service.py b/src/onaptests/steps/instantiate/sdnc_service.py
index 7b6be14..1c2437f 100644
--- a/src/onaptests/steps/instantiate/sdnc_service.py
+++ b/src/onaptests/steps/instantiate/sdnc_service.py
@@ -3,10 +3,10 @@ from onapsdk.exceptions import APIError
from onapsdk.sdnc import VfModulePreload
from onapsdk.sdnc.preload import PreloadInformation
from onapsdk.sdnc.services import Service
+from onaptests.scenario.scenario_base import BaseScenarioStep
+from onaptests.steps.base import BaseStep
from onaptests.utils.exceptions import OnapTestException
-from ..base import BaseStep
-
class BaseSdncStep(BaseStep):
"""Basic SDNC step."""
@@ -32,9 +32,9 @@ class BaseSdncStep(BaseStep):
class ServiceCreateStep(BaseSdncStep):
"""Service creation step."""
- def __init__(self, service: Service = None, cleanup: bool = False):
+ def __init__(self, service: Service = None):
"""Initialize step."""
- super().__init__(cleanup=cleanup)
+ super().__init__(cleanup=settings.CLEANUP_FLAG)
self.service = service
@property
@@ -43,7 +43,7 @@ class ServiceCreateStep(BaseSdncStep):
return "Create SDNC service."
@BaseStep.store_state
- def execute(self):
+ def execute(self) -> None:
"""Create service at SDNC."""
super().execute()
self._logger.info("Create new service instance in SDNC by GR-API")
@@ -61,7 +61,7 @@ class ServiceCreateStep(BaseSdncStep):
else:
raise OnapTestException("SDNC service creation failed.")
- @BaseStep.store_state()
+ @BaseStep.store_state(cleanup=True)
def cleanup(self) -> None:
"""Cleanup Service."""
if self.service is not None:
@@ -76,14 +76,14 @@ class UpdateSdncService(BaseSdncStep):
The step needs in an existing SDNC service as a prerequisite.
"""
- def __init__(self, cleanup=False):
+ def __init__(self):
"""Initialize step.
Sub steps:
- ServiceCreateStep.
"""
- super().__init__(cleanup=cleanup)
- self.add_step(ServiceCreateStep(cleanup=cleanup))
+ super().__init__(cleanup=BaseStep.HAS_NO_CLEANUP)
+ self.add_step(ServiceCreateStep())
@property
def description(self) -> str:
@@ -97,8 +97,8 @@ class UpdateSdncService(BaseSdncStep):
"""
return "Update SDNC service"
- @BaseStep.store_state
- def execute(self):
+ @BaseSdncStep.store_state
+ def execute(self) -> None:
super().execute()
self._logger.info("Get existing SDNC service instance and update it over GR-API")
try:
@@ -117,9 +117,9 @@ class UploadVfModulePreloadStep(BaseSdncStep):
Upload preload information for VfModule over GR-API.
"""
- def __init__(self, cleanup=False):
+ def __init__(self):
"""Initialize step."""
- super().__init__(cleanup=cleanup)
+ super().__init__(cleanup=BaseStep.HAS_NO_CLEANUP)
@property
def description(self) -> str:
@@ -133,8 +133,8 @@ class UploadVfModulePreloadStep(BaseSdncStep):
"""
return "Upload Preload information for VfModule"
- @BaseStep.store_state
- def execute(self):
+ @BaseSdncStep.store_state
+ def execute(self) -> None:
super().execute()
self._logger.info("Upload VfModule preload information over GR-API")
VfModulePreload.upload_vf_module_preload(
@@ -153,14 +153,14 @@ class GetSdncPreloadStep(BaseSdncStep):
Get preload information from SDNC over GR-API.
"""
- def __init__(self, cleanup=False):
+ def __init__(self):
"""Initialize step.
Sub steps:
- UploadVfModulePreloadStep.
"""
- super().__init__(cleanup=cleanup)
- self.add_step(UploadVfModulePreloadStep(cleanup=cleanup))
+ super().__init__(cleanup=BaseStep.HAS_NO_CLEANUP)
+ self.add_step(UploadVfModulePreloadStep())
@property
def description(self) -> str:
@@ -174,8 +174,8 @@ class GetSdncPreloadStep(BaseSdncStep):
"""
return "Get Preload information"
- @BaseStep.store_state
- def execute(self):
+ @BaseSdncStep.store_state
+ def execute(self) -> None:
super().execute()
self._logger.info("Get existing SDNC service instance and update it over GR-API")
preloads = PreloadInformation.get_all()
@@ -183,22 +183,18 @@ class GetSdncPreloadStep(BaseSdncStep):
print(preload_information)
-class TestSdncStep(BaseStep):
+class TestSdncStep(BaseScenarioStep):
"""Top level step for SDNC tests."""
- def __init__(self, cleanup=False):
+ def __init__(self):
"""Initialize step.
Sub steps:
- UpdateSdncService.
"""
- super().__init__(cleanup=cleanup)
- self.add_step(
- UpdateSdncService(cleanup=cleanup)
- )
- self.add_step(
- GetSdncPreloadStep(cleanup=cleanup)
- )
+ super().__init__(cleanup=BaseStep.HAS_NO_CLEANUP)
+ self.add_step(UpdateSdncService())
+ self.add_step(GetSdncPreloadStep())
@property
def description(self) -> str:
@@ -223,4 +219,4 @@ class TestSdncStep(BaseStep):
str: Component name
"""
- return "PythonSDK-tests"
+ return "TEST"
diff --git a/src/onaptests/steps/instantiate/service_ala_carte.py b/src/onaptests/steps/instantiate/service_ala_carte.py
index 9908b6d..1773aa4 100644
--- a/src/onaptests/steps/instantiate/service_ala_carte.py
+++ b/src/onaptests/steps/instantiate/service_ala_carte.py
@@ -92,20 +92,20 @@ class ServiceAlaCarteInstantiateStep(BaseStep):
class YamlTemplateServiceAlaCarteInstantiateStep(YamlTemplateBaseStep):
"""Instantiate service a'la carte using YAML template."""
- def __init__(self, cleanup=False):
+ def __init__(self):
"""Initialize step.
Substeps:
- YamlTemplateServiceOnboardStep,
- ConnectServiceSubToCloudRegionStep.
"""
- super().__init__(cleanup=cleanup)
+ super().__init__(cleanup=settings.CLEANUP_FLAG)
self._yaml_template: dict = None
self._service_instance_name: str = None
self._service_instance: str = None
if not settings.ONLY_INSTANTIATE:
- self.add_step(YamlTemplateServiceOnboardStep(cleanup))
- self.add_step(ConnectServiceSubToCloudRegionStep(cleanup))
+ self.add_step(YamlTemplateServiceOnboardStep())
+ self.add_step(ConnectServiceSubToCloudRegionStep())
@property
def description(self) -> str:
diff --git a/src/onaptests/steps/instantiate/service_macro.py b/src/onaptests/steps/instantiate/service_macro.py
index d97a109..88eef4d 100644
--- a/src/onaptests/steps/instantiate/service_macro.py
+++ b/src/onaptests/steps/instantiate/service_macro.py
@@ -34,7 +34,7 @@ from onaptests.steps.cloud.connect_service_subscription_to_cloud_region import (
class YamlTemplateServiceMacroInstantiateStep(YamlTemplateBaseStep):
"""Instantiate service a'la carte using YAML template."""
- def __init__(self, cleanup=False):
+ def __init__(self):
"""Initialize step.
Substeps:
@@ -42,21 +42,21 @@ class YamlTemplateServiceMacroInstantiateStep(YamlTemplateBaseStep):
- ConnectServiceSubToCloudRegionStep,
- CustomerServiceSubscriptionCreateStep.
"""
- super().__init__(cleanup=cleanup)
+ super().__init__(cleanup=settings.CLEANUP_FLAG)
self._yaml_template: dict = None
self._model_yaml_template: dict = None
self._service_instance_name: str = None
self._service_instance: str = None
if not settings.ONLY_INSTANTIATE:
- self.add_step(YamlTemplateServiceOnboardStep(cleanup))
+ self.add_step(YamlTemplateServiceOnboardStep())
if any(
filter(lambda x: x in self.yaml_template[self.service_name].keys(),
["vnfs", "networks"])):
# can additionally contain "pnfs", no difference
- self.add_step(ConnectServiceSubToCloudRegionStep(cleanup))
+ self.add_step(ConnectServiceSubToCloudRegionStep())
else: # only pnfs
- self.add_step(CustomerServiceSubscriptionCreateStep(cleanup))
+ self.add_step(CustomerServiceSubscriptionCreateStep())
@property
def description(self) -> str:
diff --git a/src/onaptests/steps/instantiate/vf_module_ala_carte.py b/src/onaptests/steps/instantiate/vf_module_ala_carte.py
index b4a7c77..015e479 100644
--- a/src/onaptests/steps/instantiate/vf_module_ala_carte.py
+++ b/src/onaptests/steps/instantiate/vf_module_ala_carte.py
@@ -16,13 +16,13 @@ from .k8s_profile_create import K8SProfileStep
class YamlTemplateVfModuleAlaCarteInstantiateStep(YamlTemplateBaseStep):
"""Instantiate vf module a'la carte using YAML template."""
- def __init__(self, cleanup=False):
+ def __init__(self):
"""Initialize step.
Substeps:
- YamlTemplateVnfAlaCarteInstantiateStep.
"""
- super().__init__(cleanup=cleanup)
+ super().__init__(cleanup=settings.CLEANUP_FLAG)
self._yaml_template: dict = None
self._service_instance_name: str = None
@@ -30,9 +30,9 @@ class YamlTemplateVfModuleAlaCarteInstantiateStep(YamlTemplateBaseStep):
if settings.CLOUD_REGION_TYPE == settings.K8S_REGION_TYPE:
# K8SProfileStep creates the requested profile and then calls
# YamlTemplateVnfAlaCarteInstantiateStep step
- self.add_step(K8SProfileStep(cleanup))
+ self.add_step(K8SProfileStep())
else:
- self.add_step(YamlTemplateVnfAlaCarteInstantiateStep(cleanup))
+ self.add_step(YamlTemplateVnfAlaCarteInstantiateStep())
@property
def description(self) -> str:
diff --git a/src/onaptests/steps/instantiate/vl_ala_carte.py b/src/onaptests/steps/instantiate/vl_ala_carte.py
index 022a8b2..414615a 100644
--- a/src/onaptests/steps/instantiate/vl_ala_carte.py
+++ b/src/onaptests/steps/instantiate/vl_ala_carte.py
@@ -16,17 +16,17 @@ from .service_ala_carte import YamlTemplateServiceAlaCarteInstantiateStep
class YamlTemplateVlAlaCarteInstantiateStep(YamlTemplateBaseStep):
"""Instantiate vl a'la carte using YAML template."""
- def __init__(self, cleanup=False):
+ def __init__(self):
"""Initialize step.
Substeps:
- YamlTemplateServiceAlaCarteInstantiateStep.
"""
- super().__init__(cleanup=cleanup)
+ super().__init__(cleanup=settings.CLEANUP_FLAG)
self._yaml_template: dict = None
self._service_instance_name: str = None
self._service_instance: ServiceInstance = None
- self.add_step(YamlTemplateServiceAlaCarteInstantiateStep(cleanup))
+ self.add_step(YamlTemplateServiceAlaCarteInstantiateStep())
@property
def description(self) -> str:
diff --git a/src/onaptests/steps/instantiate/vnf_ala_carte.py b/src/onaptests/steps/instantiate/vnf_ala_carte.py
index 379e285..a7ac5c3 100644
--- a/src/onaptests/steps/instantiate/vnf_ala_carte.py
+++ b/src/onaptests/steps/instantiate/vnf_ala_carte.py
@@ -14,17 +14,17 @@ from .service_ala_carte import YamlTemplateServiceAlaCarteInstantiateStep
class YamlTemplateVnfAlaCarteInstantiateStep(YamlTemplateBaseStep):
"""Instantiate vnf a'la carte using YAML template."""
- def __init__(self, cleanup=False):
+ def __init__(self):
"""Initialize step.
Substeps:
- YamlTemplateServiceAlaCarteInstantiateStep.
"""
- super().__init__(cleanup=cleanup)
+ super().__init__(cleanup=settings.CLEANUP_FLAG)
self._yaml_template: dict = None
self._service_instance_name: str = None
self._service_instance: ServiceInstance = None
- self.add_step(YamlTemplateServiceAlaCarteInstantiateStep(cleanup))
+ self.add_step(YamlTemplateServiceAlaCarteInstantiateStep())
@property
def description(self) -> str: