diff options
author | Michal Jagiello <michal.jagiello@t-mobile.pl> | 2021-05-11 07:56:34 +0000 |
---|---|---|
committer | Michal Jagiello <michal.jagiello@t-mobile.pl> | 2021-05-17 07:56:03 +0000 |
commit | 060210803b263b681e696bc40bdbe9f254d729db (patch) | |
tree | 974d86b4bbafd93ec2ad19e9108700951587fd32 /src/onaptests/steps/onboard/vf.py | |
parent | 5833341a74e7002bb7131aa848cd0eafbfc6c82d (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
Diffstat (limited to 'src/onaptests/steps/onboard/vf.py')
-rw-r--r-- | src/onaptests/steps/onboard/vf.py | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/onaptests/steps/onboard/vf.py b/src/onaptests/steps/onboard/vf.py index 5f5fc4d..c6582dd 100644 --- a/src/onaptests/steps/onboard/vf.py +++ b/src/onaptests/steps/onboard/vf.py @@ -40,7 +40,8 @@ class VfOnboardStep(BaseStep): super().execute() vsp: Vsp = Vsp(name=settings.VSP_NAME) vf: Vf = Vf(name=settings.VF_NAME, vsp=vsp) - vf.onboard() + if not vf.created(): + vf.onboard() class YamlTemplateVfOnboardStep(YamlTemplateBaseStep): @@ -85,15 +86,16 @@ class YamlTemplateVfOnboardStep(YamlTemplateBaseStep): for vnf in self.yaml_template["vnfs"]: vsp: Vsp = Vsp(name=f"{vnf['vnf_name']}_VSP") vf: Vf = Vf(name=vnf['vnf_name'], vsp=vsp) - if all([x in vnf for x in ["vnf_artifact_type", - "vnf_artifact_name", - "vnf_artifact_label", - "vnf_artifact_file_path"]]): - vf.create() - vf.add_deployment_artifact( - artifact_type=vnf["vnf_artifact_type"], - artifact_name=vnf["vnf_artifact_name"], - artifact_label=vnf["vnf_artifact_label"], - artifact=vnf["vnf_artifact_file_path"] - ) - vf.onboard() + if not vf.created(): + if all([x in vnf for x in ["vnf_artifact_type", + "vnf_artifact_name", + "vnf_artifact_label", + "vnf_artifact_file_path"]]): + vf.create() + vf.add_deployment_artifact( + artifact_type=vnf["vnf_artifact_type"], + artifact_name=vnf["vnf_artifact_name"], + artifact_label=vnf["vnf_artifact_label"], + artifact=vnf["vnf_artifact_file_path"] + ) + vf.onboard() |