aboutsummaryrefslogtreecommitdiffstats
path: root/src/onaptests/steps/onboard/pnf.py
diff options
context:
space:
mode:
authorMicha? Jagie??o <michal.jagiello@t-mobile.pl>2023-08-07 13:06:39 +0000
committerGerrit Code Review <gerrit@onap.org>2023-08-07 13:06:39 +0000
commitf79b8e825e0e3cbde157e29a3225f9357e4198bd (patch)
tree72494a6d436ce591b54cf621ccec4c68f8154ed7 /src/onaptests/steps/onboard/pnf.py
parentbe6ea937c20fb6ba83d6c7b35f6f5677f9a355cc (diff)
parent4bccbde3060931c8fcf61fbf8b61db4a85b3200e (diff)
Merge "Change cleanup process of tests"
Diffstat (limited to 'src/onaptests/steps/onboard/pnf.py')
-rw-r--r--src/onaptests/steps/onboard/pnf.py26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/onaptests/steps/onboard/pnf.py b/src/onaptests/steps/onboard/pnf.py
index 1c76202..8e0cd12 100644
--- a/src/onaptests/steps/onboard/pnf.py
+++ b/src/onaptests/steps/onboard/pnf.py
@@ -11,7 +11,7 @@ from .vsp import VspOnboardStep, YamlTemplateVspOnboardStep
class PnfOnboardStep(BaseStep):
"""PNF onboard step."""
- def __init__(self, cleanup: bool = False) -> None:
+ def __init__(self) -> None:
"""Step initialization.
Substeps:
@@ -21,8 +21,8 @@ class PnfOnboardStep(BaseStep):
cleanup(bool, optional): Determines if cleanup action should be called.
"""
- super().__init__(cleanup=cleanup)
- self.add_step(VspOnboardStep(cleanup=cleanup))
+ super().__init__(cleanup=settings.CLEANUP_FLAG)
+ self.add_step(VspOnboardStep())
@property
def description(self) -> str:
@@ -34,6 +34,13 @@ class PnfOnboardStep(BaseStep):
"""Component name."""
return "SDC"
+ def check_preconditions(self, cleanup=False) -> bool:
+ if not super().check_preconditions(cleanup):
+ return False
+ if cleanup:
+ return settings.SDC_CLEANUP
+ return True
+
@BaseStep.store_state
def execute(self) -> None:
"""Onboard PNF in SDC.
@@ -72,7 +79,7 @@ class PnfOnboardStep(BaseStep):
class YamlTemplatePnfOnboardStep(YamlTemplateBaseStep):
"""PNF onboard using YAML template step."""
- def __init__(self, cleanup: bool = False) -> None:
+ def __init__(self) -> None:
"""Step initialization.
Substeps:
@@ -82,8 +89,8 @@ class YamlTemplatePnfOnboardStep(YamlTemplateBaseStep):
cleanup(bool, optional): Determines if cleanup action should be called.
"""
- super().__init__(cleanup=cleanup)
- self.add_step(YamlTemplateVspOnboardStep(cleanup=cleanup))
+ super().__init__(cleanup=settings.CLEANUP_FLAG)
+ self.add_step(YamlTemplateVspOnboardStep())
@property
def description(self) -> str:
@@ -95,6 +102,13 @@ class YamlTemplatePnfOnboardStep(YamlTemplateBaseStep):
"""Component name."""
return "SDC"
+ def check_preconditions(self, cleanup=False) -> bool:
+ if not super().check_preconditions(cleanup):
+ return False
+ if cleanup:
+ return settings.SDC_CLEANUP
+ return True
+
@property
def yaml_template(self) -> dict:
"""YAML template.