diff options
author | 2024-01-31 08:30:41 +0100 | |
---|---|---|
committer | 2024-02-02 08:30:15 +0100 | |
commit | 440df5e3af8446ddaf1e7ab9ed5abbbe439f9a06 (patch) | |
tree | 13ee8f0a3839b18eff32a1bcab25a6c5baf00364 /src/onaptests/steps/onboard | |
parent | 6a3e189d7fac6ec562f8785c71ed87663ef0c311 (diff) |
Refactor tests to use SDC v2 onapsdk module
Refactored SDC allows to archive and delete SDC resources
Remove unmaintained test basic_clamp
Issue-ID: TEST-404
Signed-off-by: Michal Jagiello <michal.jagiello@t-mobile.pl>
Change-Id: I11e4be6f4567098b20733879e393c689766a9c6e
Diffstat (limited to 'src/onaptests/steps/onboard')
-rw-r--r-- | src/onaptests/steps/onboard/clamp.py | 91 | ||||
-rw-r--r-- | src/onaptests/steps/onboard/pnf.py | 70 | ||||
-rw-r--r-- | src/onaptests/steps/onboard/service.py | 106 | ||||
-rw-r--r-- | src/onaptests/steps/onboard/vendor.py | 86 | ||||
-rw-r--r-- | src/onaptests/steps/onboard/vf.py | 44 | ||||
-rw-r--r-- | src/onaptests/steps/onboard/vsp.py | 9 |
6 files changed, 210 insertions, 196 deletions
diff --git a/src/onaptests/steps/onboard/clamp.py b/src/onaptests/steps/onboard/clamp.py deleted file mode 100644 index 4d64ee4..0000000 --- a/src/onaptests/steps/onboard/clamp.py +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/python -# http://www.apache.org/licenses/LICENSE-2.0 -"""Clamp Onboard service class.""" -from onapsdk.configuration import settings -from onapsdk.sdc.service import Service -from onapsdk.sdc.vf import Vf -from yaml import SafeLoader, load - -from ..base import BaseStep, YamlTemplateBaseStep -from .service import YamlTemplateVfOnboardStep - - -class OnboardClampStep(YamlTemplateBaseStep): - """Onboard class to create CLAMP templates.""" - - def __init__(self): - """Initialize Clamp Onboard object.""" - super().__init__(cleanup=BaseStep.HAS_NO_CLEANUP) - self._yaml_template: dict = None - self.add_step(YamlTemplateVfOnboardStep()) - # if "service_name" in kwargs: - # self.service_name = kwargs['service_name'] - # else: - # raise ValueError("Service Name to define") - # self.vf_list = [] - # self.vsp_list = [] - # self.set_logger() - - @property - def description(self) -> str: - """Step description.""" - return "Onboard service in SDC including a TCA blueprint for CLAMP." - - @property - def component(self) -> str: - """Component name.""" - return "SDC" - - @property - def yaml_template(self) -> dict: - """Step YAML template. - - Load from file if it's a root step, get from parent otherwise. - - Returns: - dict: Step YAML template - - """ - if self.is_root: - if not self._yaml_template: - with open(settings.SERVICE_YAML_TEMPLATE, "r", encoding="utf-8") as yaml_template: - self._yaml_template: dict = load(yaml_template, SafeLoader) - return self._yaml_template - return self.parent.yaml_template - - @property - def model_yaml_template(self) -> dict: - return {} - - @YamlTemplateBaseStep.store_state - def execute(self): - """Onboard service.""" - super().execute() - # retrieve the Vf - vf = None - for sdc_vf in Vf.get_all(): - if sdc_vf.name == settings.VF_NAME: - vf = sdc_vf - self._logger.debug("Vf retrieved %s", vf) - - service: Service = Service(name=self.service_name, - resources=[vf]) - service.create() - self._logger.info(" Service %s created", service) - - if not service.distributed: - service.add_resource(vf) - - # we add the artifact to the first VNF - self._logger.info("Try to add blueprint to %s", vf.name) - with open(settings.CONFIGURATION_PATH + 'tca-microservice.yaml', - 'rb') as payload_file: - data = payload_file.read() - self._logger.info("DCAE INVENTORY BLUEPRINT file retrieved") - service.add_artifact_to_vf(vnf_name=vf.name, - artifact_type="DCAE_INVENTORY_BLUEPRINT", - artifact_name="tca-microservice.yaml", - artifact=data) - service.checkin() - service.onboard() - self._logger.info("DCAE INVENTORY BLUEPRINT ADDED") diff --git a/src/onaptests/steps/onboard/pnf.py b/src/onaptests/steps/onboard/pnf.py index 9b8119a..2f538ec 100644 --- a/src/onaptests/steps/onboard/pnf.py +++ b/src/onaptests/steps/onboard/pnf.py @@ -1,10 +1,16 @@ """PNF onboarding step module.""" +import time +from pathlib import Path + from onapsdk.configuration import settings -from onapsdk.sdc.pnf import Pnf +from onapsdk.exceptions import ResourceNotFound +from onapsdk.sdc2.pnf import Pnf +from onapsdk.sdc2.sdc_resource import LifecycleOperation, LifecycleState from onapsdk.sdc.vendor import Vendor from onapsdk.sdc.vsp import Vsp +from onaptests.utils.resources import get_resource_location from ..base import BaseStep, YamlTemplateBaseStep from .vsp import VspOnboardStep, YamlTemplateVspOnboardStep @@ -56,24 +62,29 @@ class PnfOnboardStep(BaseStep): """ super().execute() - vendor: Vendor = Vendor(name=settings.VENDOR_NAME) - pnf: Pnf = Pnf(name=settings.PNF_NAME, vendor=vendor) - if not pnf.created(): - pnf.create() + try: + pnf: Pnf = Pnf.get_by_name(name=settings.PNF_NAME) + if pnf.lifecycle_state == LifecycleState.CERTIFIED: + return + except ResourceNotFound: + vsp: Vsp = Vsp(name=settings.VSP_NAME) + pnf = Pnf.create(settings.PNF_NAME, vsp=vsp, vendor=vsp.vendor) 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 + artifact_file_path=settings.PNF_ARTIFACT_FILE_PATH ) - pnf.onboard() + pnf.lifecycle_operation(LifecycleOperation.CERTIFY) @BaseStep.store_state(cleanup=True) def cleanup(self): - pnf: Pnf = Pnf(name=settings.PNF_NAME) - if pnf.exists(): + try: + pnf = Pnf.get_by_name(settings.PNF_NAME) pnf.archive() pnf.delete() + except ResourceNotFound: + self._logger.warning("VF not created") super().cleanup() @@ -131,29 +142,44 @@ class YamlTemplatePnfOnboardStep(YamlTemplateBaseStep): """Onboard PNFs from YAML template.""" super().execute() if "pnfs" in self.yaml_template: - vendor: Vendor = Vendor(name=settings.VENDOR_NAME) for pnf in self.yaml_template["pnfs"]: 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() + try: + pnf_obj: Pnf = Pnf.get_by_name(name=pnf["pnf_name"]) + if pnf_obj.lifecycle_state == LifecycleState.CERTIFIED: + self._logger.info("PNF already created") + return + except ResourceNotFound: + pnf_obj: Pnf = Pnf.create(name=pnf["pnf_name"], + vsp=vsp, + vendor=Vendor(name=pnf["pnf_name"])) + if all(x in pnf for x in ["pnf_artifact_type", + "pnf_artifact_name", + "pnf_artifact_label", + "pnf_artifact_file_path"]): + artifact_file_path: Path = Path(pnf["pnf_artifact_file_path"]) + if not artifact_file_path.exists(): + artifact_file_path = Path(get_resource_location(artifact_file_path)) + pnf_obj.add_deployment_artifact( + artifact_type=pnf["pnf_artifact_type"], + artifact_name=pnf["pnf_artifact_name"], + artifact_label=pnf["pnf_artifact_label"], + artifact_file_path=str(artifact_file_path) + ) + time.sleep(10) + pnf_obj.lifecycle_operation(LifecycleOperation.CERTIFY) @YamlTemplateBaseStep.store_state(cleanup=True) def cleanup(self): if "pnfs" in self.yaml_template: for pnf in self.yaml_template["pnfs"]: - pnf_obj: Pnf = Pnf(name=pnf["pnf_name"]) - if pnf_obj.exists(): + try: + pnf_obj: Pnf = Pnf.get_by_name(name=pnf["pnf_name"]) pnf_obj.archive() pnf_obj.delete() + except ResourceNotFound: + self._logger.warning(f"PNF {pnf['pnf_name']} does not exist") super().cleanup() diff --git a/src/onaptests/steps/onboard/service.py b/src/onaptests/steps/onboard/service.py index 738454f..a9a3b14 100644 --- a/src/onaptests/steps/onboard/service.py +++ b/src/onaptests/steps/onboard/service.py @@ -1,16 +1,14 @@ -import time from typing import Any, Dict +from yaml import SafeLoader, load -import onapsdk.constants as onapsdk_const from onapsdk.configuration import settings -from onapsdk.exceptions import APIError, ResourceNotFound -from onapsdk.sdc.component import Component -from onapsdk.sdc.pnf import Pnf -from onapsdk.sdc.properties import ComponentProperty -from onapsdk.sdc.service import Service, ServiceInstantiationType -from onapsdk.sdc.vf import Vf -from onapsdk.sdc.vl import Vl -from yaml import SafeLoader, load +from onapsdk.exceptions import ResourceNotFound +from onapsdk.sdc2.pnf import Pnf +from onapsdk.sdc2.component_instance import ComponentInstance, ComponentInstanceInput +from onapsdk.sdc2.sdc_resource import LifecycleOperation, LifecycleState +from onapsdk.sdc2.service import Service, ServiceInstantiationType +from onapsdk.sdc2.vf import Vf +from onapsdk.sdc2.vl import Vl from ..base import BaseStep, YamlTemplateBaseStep from .pnf import PnfOnboardStep, YamlTemplatePnfOnboardStep @@ -62,10 +60,13 @@ class ServiceOnboardStep(BaseStep): """ super().execute() - service: Service = Service(name=settings.SERVICE_NAME, - instantiation_type=settings.SERVICE_INSTANTIATION_TYPE) - if not service.created(): - service.create() + try: + service: Service = Service.get_by_name(name=settings.SERVICE_NAME) + if service.distributed: + return + except ResourceNotFound: + service = Service.create(name=settings.SERVICE_NAME, + instantiation_type=settings.SERVICE_INSTANTIATION_TYPE) if settings.VL_NAME != "": vl: Vl = Vl(name=settings.VL_NAME) service.add_resource(vl) @@ -75,29 +76,19 @@ class ServiceOnboardStep(BaseStep): 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 - # Double check because of: - # https://gitlab.com/Orange-OpenSource/lfn/onap/python-onapsdk/-/issues/176 - if not service.distributed and service.status != onapsdk_const.DISTRIBUTED: - if service.status == onapsdk_const.DRAFT: - try: - service.checkin() - except (APIError, ResourceNotFound): - # Retry as checkin may be a bit long - # Temp workaround to avoid internal race in SDC - time.sleep(10) - service.checkin() - service.onboard() + if service.lifecycle_state != LifecycleState.CERTIFIED: + service.lifecycle_operation(LifecycleOperation.CERTIFY) + service.distribute() @BaseStep.store_state def cleanup(self) -> None: """Cleanup service onboard step.""" - service: Service = Service(name=settings.SERVICE_NAME) - if service.exists(): + try: + service: Service = Service.get_by_name(name=settings.SERVICE_NAME) service.archive() service.delete() + except ResourceNotFound: + self._logger.info(f"Service {settings.SERVICE_NAME} not found") super().cleanup() @@ -181,26 +172,17 @@ class YamlTemplateServiceOnboardStep(YamlTemplateBaseStep): self.yaml_template[self.service_name]["instantiation_type"]) else: instantiation_type: ServiceInstantiationType = ServiceInstantiationType.A_LA_CARTE - service: Service = Service(name=self.service_name, instantiation_type=instantiation_type) - if not service.created(): - service.create() + try: + service: Service = Service.get_by_name(name=self.service_name) + if service.distributed: + return + except ResourceNotFound: + service = Service.create(name=self.service_name, instantiation_type=instantiation_type) 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 - # Double check because of: - # https://gitlab.com/Orange-OpenSource/lfn/onap/python-onapsdk/-/issues/176 - if not service.distributed and service.status != onapsdk_const.DISTRIBUTED: - if service.status == onapsdk_const.DRAFT: - try: - service.checkin() - except (APIError, ResourceNotFound): - # Retry as checkin may be a bit long - # Temp workaround to avoid internal race in SDC - time.sleep(10) - service.checkin() - service.onboard() + if service.lifecycle_state != LifecycleState.CERTIFIED: + service.lifecycle_operation(LifecycleOperation.CERTIFY) + service.distribute() def declare_resources(self, service: Service) -> None: """Declare resources. @@ -213,15 +195,15 @@ class YamlTemplateServiceOnboardStep(YamlTemplateBaseStep): """ if "networks" in self.yaml_template[self.service_name]: for net in self.yaml_template[self.service_name]["networks"]: - vl: Vl = Vl(name=net['vl_name']) + vl: Vl = Vl.get_by_name(name=net['vl_name']) service.add_resource(vl) if "vnfs" in self.yaml_template[self.service_name]: for vnf in self.yaml_template[self.service_name]["vnfs"]: - vf: Vf = Vf(name=vnf["vnf_name"]) + vf: Vf = Vf.get_by_name(name=vnf["vnf_name"]) service.add_resource(vf) if "pnfs" in self.yaml_template[self.service_name]: for pnf in self.yaml_template[self.service_name]["pnfs"]: - pnf_obj: Pnf = Pnf(name=pnf["pnf_name"]) + pnf_obj: Pnf = Pnf.get_by_name(name=pnf["pnf_name"]) service.add_resource(pnf_obj) def assign_properties(self, service: Service) -> None: @@ -237,24 +219,22 @@ class YamlTemplateServiceOnboardStep(YamlTemplateBaseStep): if "networks" in self.yaml_template[self.service_name]: for net in self.yaml_template[self.service_name]["networks"]: if "properties" in net: - vl: Vl = Vl(name=net['vl_name']) - vl_component: Component = service.get_component(vl) + vl_component: ComponentInstance = service.get_component_by_name(net['vl_name']) self.assign_properties_to_component(vl_component, net["properties"]) if "vnfs" in self.yaml_template[self.service_name]: for vnf in self.yaml_template[self.service_name]["vnfs"]: if "properties" in vnf: - vf: Vf = Vf(name=vnf["vnf_name"]) - vf_component: Component = service.get_component(vf) + vf_component: ComponentInstance = service.get_component_by_name(vnf["vnf_name"]) self.assign_properties_to_component(vf_component, vnf["properties"]) if "pnfs" in self.yaml_template[self.service_name]: for pnf in self.yaml_template[self.service_name]["pnfs"]: if "properties" in pnf: - pnf_obj: Pnf = Pnf(name=pnf["pnf_name"]) - pnf_component: Component = service.get_component(pnf_obj) + pnf_component: ComponentInstance = \ + service.get_component_by_name(pnf["pnf_name"]) self.assign_properties_to_component(pnf_component, pnf["properties"]) def assign_properties_to_component(self, - component: Component, + component: ComponentInstance, component_properties: Dict[str, Any]) -> None: """Assign properties to component. @@ -264,14 +244,16 @@ class YamlTemplateServiceOnboardStep(YamlTemplateBaseStep): """ for property_name, property_value in component_properties.items(): - prop: ComponentProperty = component.get_property(property_name) + prop: ComponentInstanceInput = component.get_input_by_name(property_name) prop.value = property_value @YamlTemplateBaseStep.store_state(cleanup=True) def cleanup(self) -> None: """Cleanup service onboard step.""" - service: Service = Service(name=self.service_name) - if service.exists(): + try: + service: Service = Service.get_by_name(name=self.service_name) service.archive() service.delete() + except ResourceNotFound: + self._logger.info(f"Service {self.service_name} not found") super().cleanup() diff --git a/src/onaptests/steps/onboard/vendor.py b/src/onaptests/steps/onboard/vendor.py index ae93738..5be358b 100644 --- a/src/onaptests/steps/onboard/vendor.py +++ b/src/onaptests/steps/onboard/vendor.py @@ -1,7 +1,7 @@ from onapsdk.configuration import settings from onapsdk.sdc.vendor import Vendor -from ..base import BaseStep +from ..base import BaseStep, YamlTemplateBaseStep class VendorOnboardStep(BaseStep): @@ -47,3 +47,87 @@ class VendorOnboardStep(BaseStep): vendor.archive() vendor.delete() super().cleanup() + + +class YamlTemplateVendorOnboardStep(YamlTemplateBaseStep): + """Vendor onboard using YAML template step.""" + + def __init__(self): + """Initialize step. """ + super().__init__(cleanup=settings.CLEANUP_FLAG) + + @property + def description(self) -> str: + """Step description.""" + return "Onboard vendor described in YAML file in SDC." + + @property + def component(self) -> str: + """Component name.""" + return "SDC" + + def check_preconditions(self, cleanup=False) -> bool: + if not super().check_preconditions(cleanup): + return False + if cleanup: + return settings.SDC_CLEANUP + return True + + @property + def yaml_template(self) -> dict: + """YAML template. + + Get YAML template from parent. + + Returns: + dict: YAML template + + """ + if settings.MODEL_YAML_TEMPLATE: + return self.model_yaml_template + return self.parent.yaml_template + + @property + def model_yaml_template(self) -> dict: + """Model YAML template. + + Get model YAML template from parent. + + Returns: + dict: YAML template + + """ + return self.parent.model_yaml_template + + @YamlTemplateBaseStep.store_state + def execute(self): + """Onboard Vsps from YAML template. + + Use settings values: + - VENDOR_NAME. + """ + super().execute() + if "vnfs" in self.yaml_template: + for vnf in self.yaml_template["vnfs"]: + vendor: Vendor = Vendor(name=f"{vnf['vnf_name']}") + vendor.onboard() + elif "pnfs" in self.yaml_template: + for pnf in self.yaml_template["pnfs"]: + vendor: Vendor = Vendor(name=f"{pnf['pnf_name']}") + vendor.onboard() + + @YamlTemplateBaseStep.store_state(cleanup=True) + def cleanup(self) -> None: + if "vnfs" in self.yaml_template: + for vnf in self.yaml_template["vnfs"]: + vendor: Vendor = Vendor(name=f"{vnf['vnf_name']}") + if vendor.exists(): + vendor.archive() + vendor.delete() + elif "pnfs" in self.yaml_template: + for pnf in self.yaml_template["pnfs"]: + vendor: Vendor = Vendor(name=f"{pnf['pnf_name']}") + 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 e3a4cf8..3e286d9 100644 --- a/src/onaptests/steps/onboard/vf.py +++ b/src/onaptests/steps/onboard/vf.py @@ -2,7 +2,9 @@ import time from pathlib import Path from onapsdk.configuration import settings -from onapsdk.sdc.vf import Vf +from onapsdk.exceptions import ResourceNotFound +from onapsdk.sdc2.vf import Vf +from onapsdk.sdc2.sdc_resource import LifecycleOperation, LifecycleState from onapsdk.sdc.vsp import Vsp from onaptests.utils.resources import get_resource_location @@ -50,17 +52,23 @@ class VfOnboardStep(BaseStep): """ super().execute() - vsp: Vsp = Vsp(name=settings.VSP_NAME) - vf: Vf = Vf(name=settings.VF_NAME, vsp=vsp) - if not vf.created(): - vf.onboard() + try: + vf: Vf = Vf.get_by_name(name=settings.VF_NAME) + if vf.lifecycle_state == LifecycleState.CERTIFIED: + return + except ResourceNotFound: + vsp: Vsp = Vsp(name=settings.VSP_NAME) + vf = Vf.create(settings.VF_NAME, vsp=vsp) + vf.lifecycle_operation(LifecycleOperation.CERTIFY) @BaseStep.store_state(cleanup=True) def cleanup(self): - vf: Vf = Vf(name=settings.VF_NAME) - if vf.exists(): + try: + vf = Vf.get_by_name(settings.VF_NAME) vf.archive() vf.delete() + except ResourceNotFound: + self._logger.warning("VF not created") super().cleanup() @@ -126,13 +134,17 @@ class YamlTemplateVfOnboardStep(YamlTemplateBaseStep): if "vnfs" in self.yaml_template: 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 not vf.created(): + try: + vf: Vf = Vf.get_by_name(name=vnf['vnf_name']) + if vf.lifecycle_state == LifecycleState.CERTIFIED: + self._logger.info("VF already certified") + return + except ResourceNotFound: + vf: Vf = Vf.create(name=vnf['vnf_name'], vsp=vsp, vendor=vsp.vendor) if all(x in vnf for x in ["vnf_artifact_type", "vnf_artifact_name", "vnf_artifact_label", "vnf_artifact_file_path"]): - vf.create() artifact_file_path: Path = Path(vnf["vnf_artifact_file_path"]) if not artifact_file_path.exists(): artifact_file_path = Path(get_resource_location(artifact_file_path)) @@ -140,17 +152,19 @@ class YamlTemplateVfOnboardStep(YamlTemplateBaseStep): artifact_type=vnf["vnf_artifact_type"], artifact_name=vnf["vnf_artifact_name"], artifact_label=vnf["vnf_artifact_label"], - artifact=str(artifact_file_path) + artifact_file_path=str(artifact_file_path) ) - time.sleep(10) - vf.onboard() + time.sleep(10) + vf.lifecycle_operation(LifecycleOperation.CERTIFY) @YamlTemplateBaseStep.store_state(cleanup=True) def cleanup(self): if "vnfs" in self.yaml_template: for vnf in self.yaml_template["vnfs"]: - vf_obj: Vf = Vf(name=vnf["vnf_name"]) - if vf_obj.exists(): + try: + vf_obj: Vf = Vf.get_by_name(name=vnf["vnf_name"]) vf_obj.archive() vf_obj.delete() + except ResourceNotFound: + self._logger.warning(f"VF {vnf['vnf_name']} does not exist") super().cleanup() diff --git a/src/onaptests/steps/onboard/vsp.py b/src/onaptests/steps/onboard/vsp.py index 24bae77..4d279c8 100644 --- a/src/onaptests/steps/onboard/vsp.py +++ b/src/onaptests/steps/onboard/vsp.py @@ -5,7 +5,7 @@ from onapsdk.sdc.vsp import Vsp from onaptests.utils.resources import get_resource_location from ..base import BaseStep, YamlTemplateBaseStep -from .vendor import VendorOnboardStep +from .vendor import VendorOnboardStep, YamlTemplateVendorOnboardStep class VspOnboardStep(BaseStep): @@ -74,7 +74,7 @@ class YamlTemplateVspOnboardStep(YamlTemplateBaseStep): - VendorOnboardStep. """ super().__init__(cleanup=settings.CLEANUP_FLAG) - self.add_step(VendorOnboardStep()) + self.add_step(YamlTemplateVendorOnboardStep()) @property def description(self) -> str: @@ -127,12 +127,11 @@ class YamlTemplateVspOnboardStep(YamlTemplateBaseStep): - VENDOR_NAME. """ super().execute() - vendor: Vendor = Vendor(name=settings.VENDOR_NAME) if "vnfs" in self.yaml_template: for vnf in self.yaml_template["vnfs"]: with open(get_resource_location(vnf["heat_files_to_upload"]), "rb") as package: vsp: Vsp = Vsp(name=f"{vnf['vnf_name']}_VSP", - vendor=vendor, + vendor=Vendor(name=f"{vnf['vnf_name']}"), package=package) vsp.onboard() elif "pnfs" in self.yaml_template: @@ -140,7 +139,7 @@ class YamlTemplateVspOnboardStep(YamlTemplateBaseStep): if "heat_files_to_upload" in pnf: with open(get_resource_location(pnf["heat_files_to_upload"]), "rb") as package: vsp: Vsp = Vsp(name=f"{pnf['pnf_name']}_VSP", - vendor=vendor, + vendor=Vendor(name=f"{pnf['pnf_name']}"), package=package) vsp.onboard() |