diff options
Diffstat (limited to 'src/onaptests/steps/onboard')
-rw-r--r-- | src/onaptests/steps/onboard/pnf.py | 13 | ||||
-rw-r--r-- | src/onaptests/steps/onboard/vsp.py | 9 |
2 files changed, 18 insertions, 4 deletions
diff --git a/src/onaptests/steps/onboard/pnf.py b/src/onaptests/steps/onboard/pnf.py index 547e0c0..6250d7e 100644 --- a/src/onaptests/steps/onboard/pnf.py +++ b/src/onaptests/steps/onboard/pnf.py @@ -3,8 +3,9 @@ from onapsdk.configuration import settings from onapsdk.sdc.pnf import Pnf from onapsdk.sdc.vendor import Vendor +from onapsdk.sdc.vsp import Vsp from ..base import BaseStep, YamlTemplateBaseStep -from .vendor import VendorOnboardStep +from .vsp import VspOnboardStep, YamlTemplateVspOnboardStep class PnfOnboardStep(BaseStep): @@ -21,7 +22,7 @@ class PnfOnboardStep(BaseStep): """ super().__init__(cleanup=cleanup) - self.add_step(VendorOnboardStep(cleanup=cleanup)) + self.add_step(VspOnboardStep(cleanup=cleanup)) @property def description(self) -> str: @@ -73,7 +74,7 @@ class YamlTemplatePnfOnboardStep(YamlTemplateBaseStep): """ super().__init__(cleanup=cleanup) - self.add_step(VendorOnboardStep(cleanup=cleanup)) + self.add_step(YamlTemplateVspOnboardStep(cleanup=cleanup)) @property def description(self) -> str: @@ -104,7 +105,11 @@ 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) + 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) pnf_obj.create() pnf_obj.add_deployment_artifact( artifact_type=pnf["pnf_artifact_type"], diff --git a/src/onaptests/steps/onboard/vsp.py b/src/onaptests/steps/onboard/vsp.py index 18f73d8..6f8fbf6 100644 --- a/src/onaptests/steps/onboard/vsp.py +++ b/src/onaptests/steps/onboard/vsp.py @@ -96,3 +96,12 @@ class YamlTemplateVspOnboardStep(YamlTemplateBaseStep): vendor=vendor, package=package) vsp.onboard() + elif "pnfs" in self.yaml_template: + for pnf in self.yaml_template["pnfs"]: + if "heat_files_to_upload" in pnf: + with open( + sys.path[-1] + "/" + pnf["heat_files_to_upload"], "rb") as package: + vsp: Vsp = Vsp(name=f"{pnf['pnf_name']}_VSP", + vendor=vendor, + package=package) + vsp.onboard() |