diff options
Diffstat (limited to 'src/onaptests/steps/onboard/pnf.py')
-rw-r--r-- | src/onaptests/steps/onboard/pnf.py | 26 |
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. |