diff options
author | 2023-01-16 15:17:01 +0000 | |
---|---|---|
committer | 2023-03-15 10:18:22 +0000 | |
commit | d6d052a5f1ce0ae0f0debcbb11220fce1c1dfdc5 (patch) | |
tree | 13c6f43901458af1e66c1e149e43c324f2e19043 /src/onaptests/steps/onboard/vf.py | |
parent | ef50809c847aca4a198c89fb846eb44046036032 (diff) |
Add cleanup to sdc resources ondboarding step
Delete SDC resources on cleanup
Bump onapsdk requirements to 10.4.2
Issue-ID: INT-2193
Signed-off-by: Michal Jagiello <michal.jagiello@t-mobile.pl>
Change-Id: Id9e51f07a9c91a02b67a87eb897a2a4d19fa6738
Diffstat (limited to 'src/onaptests/steps/onboard/vf.py')
-rw-r--r-- | src/onaptests/steps/onboard/vf.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/onaptests/steps/onboard/vf.py b/src/onaptests/steps/onboard/vf.py index 852cb82..f77f9af 100644 --- a/src/onaptests/steps/onboard/vf.py +++ b/src/onaptests/steps/onboard/vf.py @@ -47,6 +47,12 @@ class VfOnboardStep(BaseStep): if not vf.created(): vf.onboard() + @BaseStep.store_state(cleanup=True) + def cleanup(self): + vf: Vf = Vf(name=settings.VF_NAME) + vf.delete() + super().cleanup() + class YamlTemplateVfOnboardStep(YamlTemplateBaseStep): """Vf onboard using YAML template step.""" @@ -122,3 +128,11 @@ class YamlTemplateVfOnboardStep(YamlTemplateBaseStep): ) time.sleep(10) vf.onboard() + + @YamlTemplateBaseStep.store_state(cleanup=True) + def cleanup(self): + if "vnfs" in self.yaml_template: + for vnf in self.yaml_template["vnfs"]: + vf_obj: Vf = Vf(name=vnf["vnf_name"]) + vf_obj.delete() + super().cleanup() |