aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Jagiello <michal.jagiello@t-mobile.pl>2023-03-16 13:43:57 +0000
committerMichal Jagiello <michal.jagiello@t-mobile.pl>2023-03-17 11:06:08 +0000
commit066e6c39c2a5133f89d1f00f25a247f7ce402f10 (patch)
treeb2d7eb9b67ee7ec53da8ad2aa2aa8dff0b4758fd
parentd6d052a5f1ce0ae0f0debcbb11220fce1c1dfdc5 (diff)
Fix tests regression
Delete SDC resources only if exists and archive all before delete Bump onapsdk requirements Issue-ID: INT-2193 Signed-off-by: Michal Jagiello <michal.jagiello@t-mobile.pl> Change-Id: I1c116b93ab1dc4be2501df57b2a7d2d97354cfa5
-rw-r--r--requirements.txt2
-rw-r--r--src/onaptests/steps/onboard/pnf.py8
-rw-r--r--src/onaptests/steps/onboard/service.py8
-rw-r--r--src/onaptests/steps/onboard/vendor.py5
-rw-r--r--src/onaptests/steps/onboard/vf.py8
-rw-r--r--src/onaptests/steps/onboard/vsp.py15
6 files changed, 31 insertions, 15 deletions
diff --git a/requirements.txt b/requirements.txt
index ed997bd..91c5ebc 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -2,6 +2,6 @@ cryptography==38.0.4
xtesting==0.91.0
avionix>=0.4.5
openstacksdk>=0.61.0
-onapsdk==10.4.2
+onapsdk==10.4.3
jinja2>3
kubernetes>=22.6.0
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()