diff options
Diffstat (limited to 'src/onaptests')
-rw-r--r-- | src/onaptests/steps/onboard/pnf.py | 8 | ||||
-rw-r--r-- | src/onaptests/steps/onboard/service.py | 8 | ||||
-rw-r--r-- | src/onaptests/steps/onboard/vendor.py | 5 | ||||
-rw-r--r-- | src/onaptests/steps/onboard/vf.py | 8 | ||||
-rw-r--r-- | src/onaptests/steps/onboard/vsp.py | 15 |
5 files changed, 30 insertions, 14 deletions
diff --git a/src/onaptests/steps/onboard/pnf.py b/src/onaptests/steps/onboard/pnf.py index 75fdbcf..1c76202 100644 --- a/src/onaptests/steps/onboard/pnf.py +++ b/src/onaptests/steps/onboard/pnf.py @@ -63,7 +63,9 @@ class PnfOnboardStep(BaseStep): @BaseStep.store_state(cleanup=True) def cleanup(self): pnf: Pnf = Pnf(name=settings.PNF_NAME) - pnf.delete() + if pnf.exists(): + pnf.archive() + pnf.delete() super().cleanup() @@ -136,5 +138,7 @@ class YamlTemplatePnfOnboardStep(YamlTemplateBaseStep): if "pnfs" in self.yaml_template: for pnf in self.yaml_template["pnfs"]: pnf_obj: Pnf = Pnf(name=pnf["pnf_name"]) - pnf_obj.delete() + if pnf_obj.exists(): + pnf_obj.archive() + pnf_obj.delete() super().cleanup() diff --git a/src/onaptests/steps/onboard/service.py b/src/onaptests/steps/onboard/service.py index 60ac279..d176697 100644 --- a/src/onaptests/steps/onboard/service.py +++ b/src/onaptests/steps/onboard/service.py @@ -86,7 +86,9 @@ class ServiceOnboardStep(BaseStep): def cleanup(self) -> None: """Cleanup service onboard step.""" service: Service = Service(name=settings.SERVICE_NAME) - service.delete() + if service.exists(): + service.archive() + service.delete() super().cleanup() @@ -265,5 +267,7 @@ class YamlTemplateServiceOnboardStep(YamlTemplateBaseStep): def cleanup(self) -> None: """Cleanup service onboard step.""" service: Service = Service(name=self.service_name) - service.delete() + if service.exists(): + service.archive() + service.delete() super().cleanup() diff --git a/src/onaptests/steps/onboard/vendor.py b/src/onaptests/steps/onboard/vendor.py index 980a245..b3761d2 100644 --- a/src/onaptests/steps/onboard/vendor.py +++ b/src/onaptests/steps/onboard/vendor.py @@ -32,6 +32,7 @@ class VendorOnboardStep(BaseStep): @BaseStep.store_state(cleanup=True) def cleanup(self) -> None: vendor: Vendor = Vendor(name=settings.VENDOR_NAME) - vendor.archive() - vendor.delete() + if vendor.exists(): + vendor.archive() + vendor.delete() super().cleanup() diff --git a/src/onaptests/steps/onboard/vf.py b/src/onaptests/steps/onboard/vf.py index f77f9af..b614fd5 100644 --- a/src/onaptests/steps/onboard/vf.py +++ b/src/onaptests/steps/onboard/vf.py @@ -50,7 +50,9 @@ class VfOnboardStep(BaseStep): @BaseStep.store_state(cleanup=True) def cleanup(self): vf: Vf = Vf(name=settings.VF_NAME) - vf.delete() + if vf.exists(): + vf.archive() + vf.delete() super().cleanup() @@ -134,5 +136,7 @@ class YamlTemplateVfOnboardStep(YamlTemplateBaseStep): if "vnfs" in self.yaml_template: for vnf in self.yaml_template["vnfs"]: vf_obj: Vf = Vf(name=vnf["vnf_name"]) - vf_obj.delete() + if vf_obj.exists(): + vf_obj.archive() + vf_obj.delete() super().cleanup() diff --git a/src/onaptests/steps/onboard/vsp.py b/src/onaptests/steps/onboard/vsp.py index a7fcf9f..49b766b 100644 --- a/src/onaptests/steps/onboard/vsp.py +++ b/src/onaptests/steps/onboard/vsp.py @@ -47,8 +47,9 @@ class VspOnboardStep(BaseStep): @BaseStep.store_state(cleanup=True) def cleanup(self): vsp: Vsp = Vsp(name=settings.VSP_NAME) - vsp.archive() - vsp.delete() + if vsp.exists(): + vsp.archive() + vsp.delete() super().cleanup() @@ -131,11 +132,13 @@ class YamlTemplateVspOnboardStep(YamlTemplateBaseStep): if "vnfs" in self.yaml_template: for vnf in self.yaml_template["vnfs"]: vsp: Vsp = Vsp(name=f"{vnf['vnf_name']}_VSP") - vsp.archive() - vsp.delete() + if vsp.exists(): + vsp.archive() + vsp.delete() elif "pnfs" in self.yaml_template: for pnf in self.yaml_template["pnfs"]: vsp: Vsp = Vsp(name=f"{pnf['pnf_name']}_VSP") - vsp.archive() - vsp.delete() + if vsp.exists(): + vsp.archive() + vsp.delete() super().cleanup() |