Esempio n. 1
0
    def add_vnf(
            self,  # pylint: disable=too-many-arguments
            vnf: "Vnf",
            line_of_business: "LineOfBusiness",
            platform: "Platform",
            vnf_instance_name: str = None) -> "VnfInstantiation":
        """Add vnf into service instance.

        Instantiate VNF.

        Args:
            vnf (Vnf): Vnf from service configuration to instantiate
            line_of_business (LineOfBusiness): LineOfBusiness to use in instantiation request
            platform (Platform): Platform to use in instantiation request
            vnf_instance_name (str, optional): VNF instantion name.
                If no value is provided it's going to be
                "Python_ONAP_SDK_vnf_instance_{str(uuid4())}".
                Defaults to None.

        Raises:
            AttributeError: Service orchestration status is not "Active"
            ValueError: Instantiation request error.

        Returns:
            VnfInstantiation: VnfInstantiation request object

        """
        if self.orchestration_status != "Active":
            raise AttributeError("Service has invalid orchestration status")
        return VnfInstantiation.instantiate_ala_carte(self, vnf,
                                                      line_of_business,
                                                      platform,
                                                      vnf_instance_name)
Esempio n. 2
0
    def add_vnf(
            self,  # pylint: disable=too-many-arguments
            vnf: "Vnf",
            line_of_business: "LineOfBusiness",
            platform: "Platform",
            cloud_region: "CloudRegion" = None,
            tenant: "Tenant" = None,
            vnf_instance_name: str = None) -> "VnfInstantiation":
        """Add vnf into service instance.

        Instantiate VNF.

        Args:
            vnf (Vnf): Vnf from service configuration to instantiate
            line_of_business (LineOfBusiness): LineOfBusiness to use in instantiation request
            platform (Platform): Platform to use in instantiation request
            cloud_region (CloudRegion, optional): Cloud region to use in instantiation request.
                Defaults to None.
                THAT PROPERTY WILL BE REQUIRED IN ONE OF THE FUTURE RELEASE. REFACTOR YOUR CODE
                TO USE IT!.
            tenant (Tenant, optional): Tenant to use in instnatiation request.
                Defaults to None.
                THAT PROPERTY WILL BE REQUIRED IN ONE OF THE FUTURE RELEASE. REFACTOR YOUR CODE
                TO USE IT!.
            vnf_instance_name (str, optional): VNF instantion name.
                If no value is provided it's going to be
                "Python_ONAP_SDK_vnf_instance_{str(uuid4())}".
                Defaults to None.

        Raises:
            AttributeError: Service orchestration status is not "Active"
            ValueError: Instantiation request error.

        Returns:
            VnfInstantiation: VnfInstantiation request object

        """
        if self.orchestration_status != "Active":
            raise AttributeError("Service has invalid orchestration status")
        return VnfInstantiation.instantiate_ala_carte(
            self,
            vnf,
            line_of_business,
            platform,
            cloud_region=cloud_region,
            tenant=tenant,
            vnf_instance_name=vnf_instance_name)
Esempio n. 3
0
    def add_vnf(
            self,  # pylint: disable=too-many-arguments
            vnf: "Vnf",
            line_of_business: "LineOfBusiness",
            platform: "Platform",
            cloud_region: "CloudRegion" = None,
            tenant: "Tenant" = None,
            vnf_instance_name: str = None,
            vnf_parameters: Iterable["InstantiationParameter"] = None,
            so_vnf: "SoServiceVnf" = None,
            a_la_carte: bool = True) -> "VnfInstantiation":
        """Add vnf into service instance.

        Instantiate VNF.

        Args:
            vnf (Vnf): Vnf from service configuration to instantiate
            line_of_business (LineOfBusiness): LineOfBusiness to use in instantiation request
            platform (Platform): Platform to use in instantiation request
            cloud_region (CloudRegion, optional): Cloud region to use in instantiation request.
                Defaults to None.
                THAT PROPERTY WILL BE REQUIRED IN ONE OF THE FUTURE RELEASE. REFACTOR YOUR CODE
                TO USE IT!.
            tenant (Tenant, optional): Tenant to use in instnatiation request.
                Defaults to None.
                THAT PROPERTY WILL BE REQUIRED IN ONE OF THE FUTURE RELEASE. REFACTOR YOUR CODE
                TO USE IT!.
            vnf_instance_name (str, optional): VNF instantion name.
                If no value is provided it's going to be
                "Python_ONAP_SDK_vnf_instance_{str(uuid4())}".
                Defaults to None.
            vnf_parameters (Iterable[InstantiationParameter], optional): InstantiationParameter to
                be passed as "userParams". Defaults to None.
            so_vnf: (SoServiceVnf, optional): object with vnf instance parameters. Defaults to None.
            a_la_carte (bool): instantiation type for vnf. Defaults to True.

        Raises:
            StatusError: Service orchestration status is not "Active".

        Returns:
            VnfInstantiation: VnfInstantiation request object

        """
        if not self.active:
            msg = f'Service orchestration status must be "Active"'
            raise StatusError(msg)

        if a_la_carte:
            return VnfInstantiation.instantiate_ala_carte(
                self,
                vnf,
                line_of_business,
                platform,
                cloud_region=cloud_region,
                tenant=tenant,
                vnf_instance_name=vnf_instance_name,
                vnf_parameters=vnf_parameters,
                sdc_service=self.sdc_service)

        return VnfInstantiation.instantiate_macro(
            self,
            vnf,
            line_of_business,
            platform,
            cloud_region=cloud_region,
            tenant=tenant,
            vnf_instance_name=vnf_instance_name,
            vnf_parameters=vnf_parameters,
            so_vnf=so_vnf,
            sdc_service=self.sdc_service)