aboutsummaryrefslogtreecommitdiffstats
path: root/src/onaptests/steps/onboard/service.py
diff options
context:
space:
mode:
authorMichal Jagiello <michal.jagiello@t-mobile.pl>2021-05-11 07:56:34 +0000
committerMorgan Richomme <morgan.richomme@orange.com>2021-05-17 16:39:04 +0000
commit1aeb51c2501c863bbea2e1332e878795f264df5a (patch)
tree19b5988f739b5d98dc5ca46040920195457c9352 /src/onaptests/steps/onboard/service.py
parent44c4437d52355a4ba371f80ce68a12a7967b2cb4 (diff)
[TEST] Do not try to recreate already created SDC resources
When try to recreate SDC resources like VF, PNF or Service it's API returns errors. Check before onboarding if resource we want to create already exists. Issue-ID: TEST-333 Signed-off-by: Michal Jagiello <michal.jagiello@t-mobile.pl> Change-Id: Idcedfa18331ec898fa446d6d7689885a485a1a86 (cherry picked from commit 060210803b263b681e696bc40bdbe9f254d729db)
Diffstat (limited to 'src/onaptests/steps/onboard/service.py')
-rw-r--r--src/onaptests/steps/onboard/service.py34
1 files changed, 18 insertions, 16 deletions
diff --git a/src/onaptests/steps/onboard/service.py b/src/onaptests/steps/onboard/service.py
index 6300a43..8a7303b 100644
--- a/src/onaptests/steps/onboard/service.py
+++ b/src/onaptests/steps/onboard/service.py
@@ -55,16 +55,17 @@ class ServiceOnboardStep(BaseStep):
"""
super().execute()
service: Service = Service(name=settings.SERVICE_NAME, instantiation_type=settings.SERVICE_INSTANTIATION_TYPE)
- service.create()
- if settings.VL_NAME != "":
- vl: Vl = Vl(name=settings.VL_NAME)
- service.add_resource(vl)
- if settings.VF_NAME != "":
- vf: Vf = Vf(name=settings.VF_NAME)
- service.add_resource(vf)
- if settings.PNF_NAME != "":
- pnf: Pnf = Pnf(name=settings.PNF_NAME)
- service.add_resource(pnf)
+ if not service.created():
+ service.create()
+ if settings.VL_NAME != "":
+ vl: Vl = Vl(name=settings.VL_NAME)
+ service.add_resource(vl)
+ if settings.VF_NAME != "":
+ vf: Vf = Vf(name=settings.VF_NAME)
+ service.add_resource(vf)
+ if settings.PNF_NAME != "":
+ pnf: Pnf = Pnf(name=settings.PNF_NAME)
+ service.add_resource(pnf)
# If the service is already distributed, do not try to checkin/onboard (replay of tests)
# checkin is done if needed
# If service is replayed, no need to try to re-onboard the model
@@ -141,12 +142,13 @@ class YamlTemplateServiceOnboardStep(YamlTemplateBaseStep):
else:
instantiation_type: ServiceInstantiationType = ServiceInstantiationType.A_LA_CARTE
service: Service = Service(name=self.service_name, instantiation_type=instantiation_type)
- service.create()
- self.declare_resources(service)
- self.assign_properties(service)
- # If the service is already distributed, do not try to checkin/onboard (replay of tests)
- # checkin is done if needed
- # If service is replayed, no need to try to re-onboard the model
+ if not service.created():
+ service.create()
+ self.declare_resources(service)
+ self.assign_properties(service)
+ # If the service is already distributed, do not try to checkin/onboard (replay of tests)
+ # checkin is done if needed
+ # If service is replayed, no need to try to re-onboard the model
if not service.distributed:
try:
service.checkin()