diff options
Diffstat (limited to 'src/onaptests/steps/onboard/pnf.py')
-rw-r--r-- | src/onaptests/steps/onboard/pnf.py | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/src/onaptests/steps/onboard/pnf.py b/src/onaptests/steps/onboard/pnf.py index 547e0c0..01f2248 100644 --- a/src/onaptests/steps/onboard/pnf.py +++ b/src/onaptests/steps/onboard/pnf.py @@ -49,14 +49,15 @@ class PnfOnboardStep(BaseStep): super().execute() vendor: Vendor = Vendor(name=settings.VENDOR_NAME) pnf: Pnf = Pnf(name=settings.PNF_NAME, vendor=vendor) - pnf.create() - pnf.add_deployment_artifact( - artifact_type=settings.PNF_ARTIFACT_TYPE, - artifact_name=settings.PNF_ARTIFACT_NAME, - artifact_label=settings.PNF_ARTIFACT_LABEL, - artifact=settings.PNF_ARTIFACT_FILE_PATH - ) - pnf.onboard() + if not pnf.created(): + pnf.create() + pnf.add_deployment_artifact( + artifact_type=settings.PNF_ARTIFACT_TYPE, + artifact_name=settings.PNF_ARTIFACT_NAME, + artifact_label=settings.PNF_ARTIFACT_LABEL, + artifact=settings.PNF_ARTIFACT_FILE_PATH + ) + pnf.onboard() class YamlTemplatePnfOnboardStep(YamlTemplateBaseStep): @@ -104,12 +105,17 @@ class YamlTemplatePnfOnboardStep(YamlTemplateBaseStep): if "pnfs" in self.yaml_template: vendor: Vendor = Vendor(name=settings.VENDOR_NAME) for pnf in self.yaml_template["pnfs"]: - pnf_obj: Pnf = Pnf(name=pnf["pnf_name"], vendor=vendor) - pnf_obj.create() - pnf_obj.add_deployment_artifact( - artifact_type=pnf["pnf_artifact_type"], - artifact_name=pnf["pnf_artifact_name"], - artifact_label=pnf["pnf_artifact_label"], - artifact=pnf["pnf_artifact_file_path"] - ) - pnf_obj.onboard() + if "heat_files_to_upload" in pnf: + vsp: Vsp = Vsp(name=f"{pnf['pnf_name']}_VSP") + else: + vsp = None + pnf_obj: Pnf = Pnf(name=pnf["pnf_name"], vendor=vendor, vsp=vsp) + if not pnf_obj.created(): + pnf_obj.create() + pnf_obj.add_deployment_artifact( + artifact_type=pnf["pnf_artifact_type"], + artifact_name=pnf["pnf_artifact_name"], + artifact_label=pnf["pnf_artifact_label"], + artifact=pnf["pnf_artifact_file_path"] + ) + pnf_obj.onboard() |