diff options
Diffstat (limited to 'src/onaptests/steps/onboard/vendor.py')
-rw-r--r-- | src/onaptests/steps/onboard/vendor.py | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/onaptests/steps/onboard/vendor.py b/src/onaptests/steps/onboard/vendor.py index 5be358b..6ea05cd 100644 --- a/src/onaptests/steps/onboard/vendor.py +++ b/src/onaptests/steps/onboard/vendor.py @@ -1,3 +1,4 @@ +import onapsdk.constants as const from onapsdk.configuration import settings from onapsdk.sdc.vendor import Vendor @@ -44,7 +45,8 @@ class VendorOnboardStep(BaseStep): def cleanup(self) -> None: vendor: Vendor = Vendor(name=settings.VENDOR_NAME) if vendor.exists(): - vendor.archive() + if vendor.status == const.CERTIFIED: + vendor.archive() vendor.delete() super().cleanup() @@ -116,18 +118,19 @@ class YamlTemplateVendorOnboardStep(YamlTemplateBaseStep): vendor: Vendor = Vendor(name=f"{pnf['pnf_name']}") vendor.onboard() + def _cleanup_vendor(self, name): + vendor: Vendor = Vendor(name=name) + if vendor.exists(): + if vendor.status == const.CERTIFIED: + vendor.archive() + vendor.delete() + @YamlTemplateBaseStep.store_state(cleanup=True) def cleanup(self) -> None: if "vnfs" in self.yaml_template: for vnf in self.yaml_template["vnfs"]: - vendor: Vendor = Vendor(name=f"{vnf['vnf_name']}") - if vendor.exists(): - vendor.archive() - vendor.delete() + self._cleanup_vendor(f"{vnf['vnf_name']}") elif "pnfs" in self.yaml_template: for pnf in self.yaml_template["pnfs"]: - vendor: Vendor = Vendor(name=f"{pnf['pnf_name']}") - if vendor.exists(): - vendor.archive() - vendor.delete() + self._cleanup_vendor(f"{pnf['pnf_name']}") super().cleanup() |