diff options
Diffstat (limited to 'openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors')
12 files changed, 480 insertions, 9 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ComponentErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ComponentErrorBuilder.java new file mode 100644 index 0000000000..78d2ef866a --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ComponentErrorBuilder.java @@ -0,0 +1,21 @@ +package org.openecomp.sdc.vendorsoftwareproduct.errors; + +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; + + +public class ComponentErrorBuilder { + + private static final String VFC_INVALID_MISSING_IMAGE_MSG = + "All VFC need to have atleast a single Image specified. Please fix the VFC Images and re-submit the VSP"; + + + public static ErrorCode VfcMissingImageErrorBuilder() { + ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + builder.withId(VendorSoftwareProductErrorCodes.VFC_INVALID); + builder.withCategory(ErrorCategory.APPLICATION); + builder + .withMessage(String.format(VFC_INVALID_MISSING_IMAGE_MSG)); + return builder.build(); + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DeleteNicErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DeleteNicErrorBuilder.java new file mode 100644 index 0000000000..3ecf6f1a2e --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DeleteNicErrorBuilder.java @@ -0,0 +1,18 @@ +package org.openecomp.sdc.vendorsoftwareproduct.errors; + +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; + +public class DeleteNicErrorBuilder { + private static final String DELETE_NIC_NOT_ALLOWED_MSG = + "NIC cannot be deleted for VSPs onboarded with HEAT."; + + public static ErrorCode getDeleteNicForHeatOnboardedVspErrorBuilder(){ + ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + builder.withId(VendorSoftwareProductErrorCodes.DELETE_NIC_NOT_ALLOWED); + builder.withCategory(ErrorCategory.APPLICATION); + builder.withMessage(String.format(DELETE_NIC_NOT_ALLOWED_MSG)); + return builder.build(); + } + +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DeploymentFlavorErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DeploymentFlavorErrorBuilder.java new file mode 100644 index 0000000000..63d716504b --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DeploymentFlavorErrorBuilder.java @@ -0,0 +1,95 @@ +package org.openecomp.sdc.vendorsoftwareproduct.errors; + + +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; +import org.openecomp.sdc.versioning.dao.types.Version; + +public class DeploymentFlavorErrorBuilder { + private static final String CREATE_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING_MSG= + "Deployment Flavor cannot be added for VSPs onboarded with HEAT."; + private static final String FEATURE_GROUP_NOT_EXIST_FOR_VSP_MSG= + "Invalid request,Feature Group with Id %s does not exist for Vsp with Id %s and version " + + "%s."; + private static final String INVALID_COMPONENT_COMPUTE_ASSOCIATION_MSG + ="Invalid request,for valid association please provide ComponentId for Compute Flavor"; + private static final String SAME_VFC_ASSOCIATION_MORE_THAN_ONCE_NOT_ALLOWED_MSG= + "Invalid Request,Same Vfc cannot be associated more than once."; + private static final String DUPLICATE_DEPLOYMENT_FLAVOR_MODEL_NOT_ALLOWED_MSG = + "Invalid request, Deployment Flavor with model %s already exists for Vsp with Id %s."; + private static final String INVALID_COMPUTE_FLAVOR_ID_MSG = + "Invalid request, Compute Flavor with Id %s does not exist for VFC with Id %s."; + private static final String INVALID_COMPONENT_COMPUTE_ASSOCIATION_ERROR_MSG="VSP cannot be " + + "submitted with an invalid Deployment Flavor. All Deployment Flavor should have atleast a VFC included with it's required Compute needs. Please fix the Deployment Flavor and re-submit the VSP."; + + private static final String FEATUREGROUP_REQUIRED_IN_DEPLOYMENT_FLAVOR_MSG = "VSP cannot be " + + "submitted with an invalid Deployment Flavor. All Deployment Flavor should have " + + "FeatureGroup. Please fix the Deployment Flavor and re-submit the VSP."; + + public static ErrorCode getAddDeploymentNotSupportedHeatOnboardErrorBuilder(){ + ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + builder.withId(VendorSoftwareProductErrorCodes.CREATE_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING); + builder.withCategory(ErrorCategory.APPLICATION); + builder.withMessage(String.format(CREATE_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING_MSG)); + return builder.build(); + } + + public static ErrorCode getFeatureGroupNotexistErrorBuilder( String featureGroupId, String + VspId, Version activeVersion){ + ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + builder.withId(VendorSoftwareProductErrorCodes.FEATURE_GROUP_NOT_EXIST_FOR_VSP); + builder.withCategory(ErrorCategory.APPLICATION); + builder.withMessage(String.format(FEATURE_GROUP_NOT_EXIST_FOR_VSP_MSG,featureGroupId, + VspId,activeVersion.toString())); + return builder.build(); + } + + public static ErrorCode getDuplicateVfcAssociationErrorBuilder(){ + ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + builder.withId(VendorSoftwareProductErrorCodes.SAME_VFC_ASSOCIATION_MORE_THAN_ONCE_NOT_ALLOWED); + builder.withCategory(ErrorCategory.APPLICATION); + builder.withMessage(String.format(SAME_VFC_ASSOCIATION_MORE_THAN_ONCE_NOT_ALLOWED_MSG)); + return builder.build(); + } + + public static ErrorCode getInvalidAssociationErrorBuilder(){ + ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + builder.withId(VendorSoftwareProductErrorCodes.INVALID_COMPONENT_COMPUTE_ASSOCIATION); + builder.withCategory(ErrorCategory.APPLICATION); + builder.withMessage(String.format(INVALID_COMPONENT_COMPUTE_ASSOCIATION_MSG)); + return builder.build(); + } + + public static ErrorCode getDuplicateDeploymentFlavorModelErrorBuilder(String name, String vspId){ + ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + builder.withId(VendorSoftwareProductErrorCodes.DUPLICATE_DEPLOYMENT_FLAVOR_MODEL_NOT_ALLOWED); + builder.withCategory(ErrorCategory.APPLICATION); + builder.withMessage(String.format(DUPLICATE_DEPLOYMENT_FLAVOR_MODEL_NOT_ALLOWED_MSG,name,vspId)); + return builder.build(); + } + public static ErrorCode getInvalidComputeIdErrorBuilder( String computeFlavorId, String + vfcId){ + ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + builder.withId(VendorSoftwareProductErrorCodes.INVALID_COMPUTE_FLAVOR_ID); + builder.withCategory(ErrorCategory.APPLICATION); + builder.withMessage(String.format(INVALID_COMPUTE_FLAVOR_ID_MSG,computeFlavorId, + vfcId)); + return builder.build(); + } + + public static ErrorCode getInvalidComponentComputeAssociationErrorBuilder(){ + ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + builder.withId(VendorSoftwareProductErrorCodes.INVALID_COMPONENT_COMPUTE_ASSOCIATION); + builder.withCategory(ErrorCategory.APPLICATION); + builder.withMessage(String.format(INVALID_COMPONENT_COMPUTE_ASSOCIATION_ERROR_MSG)); + return builder.build(); + } + + public static ErrorCode getFeatureGroupMandatoryErrorBuilder(){ + ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + builder.withId(VendorSoftwareProductErrorCodes.FEATUREGROUP_REQUIRED_IN_DEPLOYMENT_FLAVOR); + builder.withCategory(ErrorCategory.APPLICATION); + builder.withMessage(String.format(FEATUREGROUP_REQUIRED_IN_DEPLOYMENT_FLAVOR_MSG)); + return builder.build(); + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DuplicateComputeInComponentErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DuplicateComputeInComponentErrorBuilder.java new file mode 100644 index 0000000000..b242b7169c --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DuplicateComputeInComponentErrorBuilder.java @@ -0,0 +1,52 @@ +package org.openecomp.sdc.vendorsoftwareproduct.errors; + +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; +import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.UPDATE_COMPUTE_NOT_ALLOWED; + + +public class DuplicateComputeInComponentErrorBuilder { + + private static final String DUPLICATE_COMPUTE_NAME_NOT_ALLOWED_MSG = + "Invalid request, Compute with name %s already exists for component with ID %s."; + private static final String COMPUTE_HEAT_READONLY_ATTR_MSG = "Update of attribute %s not allowed " + + "for VSP onboarded via HEAT."; + private static final String COMPUTE_MANUAL_READONLY_ATTR_MSG = "Update of attribute %s not allowed " + + "for VSP onboarded manually."; + + + private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + + public DuplicateComputeInComponentErrorBuilder(String computeName, String componentId ){ + builder.withId(VendorSoftwareProductErrorCodes.DUPLICATE_COMPUTE_NAME_NOT_ALLOWED); + builder.withCategory(ErrorCategory.APPLICATION); + builder.withMessage(String.format(DUPLICATE_COMPUTE_NAME_NOT_ALLOWED_MSG,computeName, + componentId)); + } + + /** + * Gets duplicate compute name error builder. + * + * @return the duplicate compute name error builder + */ + public static ErrorCode getDuplicateComputeNameErrorBuilder(String computeName, String componenetId) { + ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + builder.withId(VendorSoftwareProductErrorCodes.DUPLICATE_COMPUTE_NAME_NOT_ALLOWED); + builder.withCategory(ErrorCategory.APPLICATION); + builder.withMessage(String.format(DUPLICATE_COMPUTE_NAME_NOT_ALLOWED_MSG, computeName, componenetId )); + return builder.build(); + } + + public static ErrorCode getComputeHeatReadOnlyErrorBuilder(String name) { + ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + builder.withId(UPDATE_COMPUTE_NOT_ALLOWED); + builder.withCategory(ErrorCategory.APPLICATION); + builder.withMessage(String.format(COMPUTE_HEAT_READONLY_ATTR_MSG, name)); + return builder.build(); + } + + + public ErrorCode build() { + return builder.build(); + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DuplicateNicInComponentErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DuplicateNicInComponentErrorBuilder.java new file mode 100644 index 0000000000..741dddb4f5 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DuplicateNicInComponentErrorBuilder.java @@ -0,0 +1,22 @@ +package org.openecomp.sdc.vendorsoftwareproduct.errors; + +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; + +public class DuplicateNicInComponentErrorBuilder { + + private static final String DUPLICATE_NIC_NAME_NOT_ALLOWED_MSG = + "Invalid request, NIC with name %s already exist for component with ID %s."; + + private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + + public DuplicateNicInComponentErrorBuilder(String nicName, String componentId ){ + builder.withId(VendorSoftwareProductErrorCodes.DUPLICATE_NIC_NAME_NOT_ALLOWED); + builder.withCategory(ErrorCategory.APPLICATION); + builder.withMessage(String.format(DUPLICATE_NIC_NAME_NOT_ALLOWED_MSG,nicName,componentId)); + } + public ErrorCode build() { + return builder.build(); + } + +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ImageErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ImageErrorBuilder.java new file mode 100644 index 0000000000..95bff60479 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ImageErrorBuilder.java @@ -0,0 +1,59 @@ +package org.openecomp.sdc.vendorsoftwareproduct.errors; + +import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.DUPLICATE_IMAGE_NAME_NOT_ALLOWED; + +import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.UPDATE_IMAGE_NOT_ALLOWED; +import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.VFC_IMAGE_INVALID_FORMAT; + +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; + +/** + * The Image error builder. + */ +public class ImageErrorBuilder { + + private static final String VFC_IMAGE_DUPLICATE_NAME_MSG = "Invalid request, Image with name %s" + + " already exists for component with ID %s."; + + private static final String IMAGE_INVALID_FORMAT_MSG = "The format value doesn't meet the " + + "expected attribute value."; + + private static final String IMAGE_HEAT_READONLY_ATTR_MSG = "Update of attribute %s not allowed " + + "for VSP onboarded via HEAT."; + + + /** + * Gets duplicate image name error builder. + * + * @return the duplicate image name error builder + */ + public static ErrorCode getDuplicateImageNameErrorBuilder(String imageName, String componenetId) { + ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + builder.withId(DUPLICATE_IMAGE_NAME_NOT_ALLOWED); + builder.withCategory(ErrorCategory.APPLICATION); + builder.withMessage(String.format(VFC_IMAGE_DUPLICATE_NAME_MSG, imageName, componenetId )); + return builder.build(); + } + + /** + * Gets invalid image format error builder. + * + * @return the invalid image format error builder + */ + public static ErrorCode getInvalidImageFormatErrorBuilder() { + ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + builder.withId(VFC_IMAGE_INVALID_FORMAT); + builder.withCategory(ErrorCategory.APPLICATION); + builder.withMessage(String.format(IMAGE_INVALID_FORMAT_MSG)); + return builder.build(); + } + + public static ErrorCode getImageHeatReadOnlyErrorBuilder(String name) { + ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + builder.withId(UPDATE_IMAGE_NOT_ALLOWED); + builder.withCategory(ErrorCategory.APPLICATION); + builder.withMessage(String.format(IMAGE_HEAT_READONLY_ATTR_MSG, name)); + return builder.build(); + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/MibUploadErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/MonitoringUploadErrorBuilder.java index bffe805618..5fc29d5a4f 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/MibUploadErrorBuilder.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/MonitoringUploadErrorBuilder.java @@ -24,11 +24,12 @@ import org.openecomp.sdc.common.errors.BaseErrorBuilder; import org.openecomp.sdc.common.errors.ErrorCategory; import org.openecomp.sdc.versioning.dao.types.Version; -import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.MIB_UPLOAD_INVALID; +import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.MONITORING_UPLOAD_INVALID; -public class MibUploadErrorBuilder extends BaseErrorBuilder { +public class MonitoringUploadErrorBuilder extends BaseErrorBuilder { private static final String UPLOAD_INVALID_DETAILED_MSG = - "MIB uploaded for vendor software product with Id %s and version %s is invalid: %s"; + "Monitoring file uploaded for vendor software product with Id %s and version %s is invalid:" + + " %s"; /** @@ -38,8 +39,9 @@ public class MibUploadErrorBuilder extends BaseErrorBuilder { * @param version the version * @param error the error */ - public MibUploadErrorBuilder(String vendorSoftwareProductId, Version version, String error) { - getErrorCodeBuilder().withId(MIB_UPLOAD_INVALID); + public MonitoringUploadErrorBuilder(String vendorSoftwareProductId, Version version, + String error) { + getErrorCodeBuilder().withId(MONITORING_UPLOAD_INVALID); getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION); getErrorCodeBuilder().withMessage(String.format(UPLOAD_INVALID_DETAILED_MSG, vendorSoftwareProductId, version == null ? null : version.toString(), error)); @@ -50,8 +52,8 @@ public class MibUploadErrorBuilder extends BaseErrorBuilder { * * @param errorMessage the error message */ - public MibUploadErrorBuilder(String errorMessage) { - getErrorCodeBuilder().withId(MIB_UPLOAD_INVALID); + public MonitoringUploadErrorBuilder(String errorMessage) { + getErrorCodeBuilder().withId(MONITORING_UPLOAD_INVALID); getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION); getErrorCodeBuilder().withMessage(errorMessage); } diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NicInternalNetworkErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NicInternalNetworkErrorBuilder.java new file mode 100644 index 0000000000..0850d2e704 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NicInternalNetworkErrorBuilder.java @@ -0,0 +1,46 @@ +package org.openecomp.sdc.vendorsoftwareproduct.errors; + +import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.NETWORK_DESCRIPTION_NOT_ALLOWED_FOR_INTERNAL_NETWORK; +import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.NETWORK_TYPE_UPDATE_NOT_ALLOWED; + +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; + +public class NicInternalNetworkErrorBuilder { + private static final String NULL_NETWORKID_NOT_ALLOWED_MSG = + "Internal Networks are currently not supported for VSP created Manually, so please fix all the NIC to be of Type External and re-submit the VSP."; + + private static final String NETWORK_DESCRIPTION_NOT_ALLOWED_FOR_INTERNAL_NETWORK_MSG = + "Invalid request, Network Description not allowed for Internal Networks"; + private static final String NETWORK_TYPE_UPDATE_NOT_ALLOWED_MSG = + "Invalid request, Network Type Update not allowed for a Nic"; + + + public static ErrorCode getNicNullNetworkIdInternalNetworkIdErrorBuilder(){ + ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + builder.withId(VendorSoftwareProductErrorCodes.NULL_NETWORKID_NOT_ALLOWED); + builder.withCategory(ErrorCategory.APPLICATION); + builder.withMessage(String.format(NULL_NETWORKID_NOT_ALLOWED_MSG)); + return builder.build(); + } + + + public static ErrorCode getNetworkDescriptionInternalNetworkErrorBuilder(){ + ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + builder.withId(NETWORK_DESCRIPTION_NOT_ALLOWED_FOR_INTERNAL_NETWORK); + builder.withCategory(ErrorCategory.APPLICATION); + builder.withMessage(String.format(NETWORK_DESCRIPTION_NOT_ALLOWED_FOR_INTERNAL_NETWORK_MSG)); + return builder.build(); + } + + + public static ErrorCode getNetworkTypeErrorBuilder(){ + ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + builder.withId(NETWORK_TYPE_UPDATE_NOT_ALLOWED); + builder.withCategory(ErrorCategory.APPLICATION); + builder.withMessage(String.format(NETWORK_TYPE_UPDATE_NOT_ALLOWED_MSG)); + return builder.build(); + } + + +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NicNetworkIdNotAllowedExternalNetworkErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NicNetworkIdNotAllowedExternalNetworkErrorBuilder.java new file mode 100644 index 0000000000..2d75f81fcd --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NicNetworkIdNotAllowedExternalNetworkErrorBuilder.java @@ -0,0 +1,19 @@ +package org.openecomp.sdc.vendorsoftwareproduct.errors; + +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; + +public class NicNetworkIdNotAllowedExternalNetworkErrorBuilder { + private static final String NETWORKID_NOT_ALLOWED_FOR_EXTERNAL_NETWORK_MSG = + "Invalid request,NetworkId not allowed for External Networks"; + private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + public NicNetworkIdNotAllowedExternalNetworkErrorBuilder(){ + builder.withId(VendorSoftwareProductErrorCodes.NETWORKID_NOT_ALLOWED_FOR_EXTERNAL_NETWORK); + builder.withCategory(ErrorCategory.APPLICATION); + builder.withMessage(String.format(NETWORKID_NOT_ALLOWED_FOR_EXTERNAL_NETWORK_MSG)); + } + + public ErrorCode build() { + return builder.build(); + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NotSupportedHeatOnboardMethodErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NotSupportedHeatOnboardMethodErrorBuilder.java new file mode 100644 index 0000000000..7801df8fd7 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NotSupportedHeatOnboardMethodErrorBuilder.java @@ -0,0 +1,76 @@ +package org.openecomp.sdc.vendorsoftwareproduct.errors; + +import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.ADD_COMPUTE_NOT_ALLOWED_IN_HEAT_ONBOARDING; +import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.ADD_IMAGE_NOT_ALLOWED_IN_HEAT_ONBOARDING; +import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.ADD_NIC_NOT_ALLOWED_IN_HEAT_ONBOARDING; +import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.DELETE_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING; +import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.DELETE_IMAGE_NOT_ALLOWED; +import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.EDIT_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING; + +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; + +public class NotSupportedHeatOnboardMethodErrorBuilder { + private static final String ADD_NIC_NOT_ALLOWED_IN_HEAT_ONBOARDING_MSG = + "NIC cannot be added for VSPs onboarded with HEAT."; + private static final String ADD_COMPUTE_NOT_ALLOWED_IN_HEAT_ONBOARDING_MSG = + "Compute flavor cannot be added for VSPs onboarded with HEAT."; + private static final String IMAGE_ADD_NOT_ALLOWED_IN_HEAT_ONBOARDING_MSG = + "Image cannot be added for VSPs onboarded with HEAT."; + private static final String DELETE_IMAGE_NOT_ALLOWED_MSG = + "Image cannot be deleted for VSPs onboarded with HEAT."; + private static final String DELETE_DEPLOYMENT_FLAVOR_NOT_ALLOWED_MSG = + "Deployment Flavor cannot be deleted for VSPs onboarded with HEAT."; + private static final String EDIT_DEPLOYMENT_FLAVOR_NOT_ALLOWED_MSG = + "Deployment Flavor cannot be edited for VSPs onboarded with HEAT."; + + + public static ErrorCode getAddNicNotSupportedHeatOnboardMethodErrorBuilder() { + ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + builder.withId(ADD_NIC_NOT_ALLOWED_IN_HEAT_ONBOARDING); + builder.withCategory(ErrorCategory.APPLICATION); + builder.withMessage(String.format(ADD_NIC_NOT_ALLOWED_IN_HEAT_ONBOARDING_MSG)); + return builder.build(); + } + + public static ErrorCode getAddComputeNotSupportedHeatOnboardMethodErrorBuilder() { + ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + builder.withId(ADD_COMPUTE_NOT_ALLOWED_IN_HEAT_ONBOARDING); + builder.withCategory(ErrorCategory.APPLICATION); + builder.withMessage(String.format(ADD_COMPUTE_NOT_ALLOWED_IN_HEAT_ONBOARDING_MSG)); + return builder.build(); + } + + public static ErrorCode getAddImageNotSupportedHeatOnboardMethodErrorBuilder() { + ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + builder.withId(ADD_IMAGE_NOT_ALLOWED_IN_HEAT_ONBOARDING); + builder.withCategory(ErrorCategory.APPLICATION); + builder.withMessage(String.format(IMAGE_ADD_NOT_ALLOWED_IN_HEAT_ONBOARDING_MSG)); + return builder.build(); + } + + public static ErrorCode getDelImageNotSupportedHeatOnboardMethodErrorBuilder() { + ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + builder.withId(DELETE_IMAGE_NOT_ALLOWED); + builder.withCategory(ErrorCategory.APPLICATION); + builder.withMessage(String.format(DELETE_IMAGE_NOT_ALLOWED_MSG)); + return builder.build(); + } + + public static ErrorCode getDelDeploymentFlavorNotSupportedHeatOnboardMethodErrorBuilder() { + ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + builder.withId(DELETE_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING); + builder.withCategory(ErrorCategory.APPLICATION); + builder.withMessage(String.format(DELETE_DEPLOYMENT_FLAVOR_NOT_ALLOWED_MSG)); + return builder.build(); + } + + public static ErrorCode getUpdateDfNotSupportedHeatOnboardMethodErrorBuilder() { + ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + builder.withId(EDIT_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING); + builder.withCategory(ErrorCategory.APPLICATION); + builder.withMessage(String.format(EDIT_DEPLOYMENT_FLAVOR_NOT_ALLOWED_MSG)); + return builder.build(); + } + +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/OnboardingMethodErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/OnboardingMethodErrorBuilder.java new file mode 100644 index 0000000000..8aad900102 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/OnboardingMethodErrorBuilder.java @@ -0,0 +1,46 @@ +package org.openecomp.sdc.vendorsoftwareproduct.errors; + +import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes + .VSP_INVALID_ONBOARDING_METHOD; +import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes + .VSP_ONBOARD_METHOD_UPDATE_NOT_ALLOWED; + +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; + +/** + * The type Onboarding method error builder. + */ +public class OnboardingMethodErrorBuilder { + + private static final String VSP_ONBOARD_METHOD_UPDATE_NOT_ALLOWED_MSG = + "onboardingMethod update is not allowed."; + private static final String VSP_INVALID_ONBOARDING_METHOD_MSG = + "The onboardingMethod value doesn't meet the expected attribute value."; + + /** + * Gets onboarding update error. + * + * @return the onboarding update error + */ + public static ErrorCode getOnboardingUpdateError() { + ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + builder.withId(VSP_ONBOARD_METHOD_UPDATE_NOT_ALLOWED); + builder.withCategory(ErrorCategory.APPLICATION); + builder.withMessage(String.format(VSP_ONBOARD_METHOD_UPDATE_NOT_ALLOWED_MSG)); + return builder.build(); + } + + /** + * Get invalid onboarding method error builder error code. + * + * @return the error code + */ + public static ErrorCode getInvalidOnboardingMethodErrorBuilder() { + ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + builder.withId(VSP_INVALID_ONBOARDING_METHOD); + builder.withCategory(ErrorCategory.APPLICATION); + builder.withMessage(String.format(VSP_INVALID_ONBOARDING_METHOD_MSG)); + return builder.build(); + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductInvalidErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductInvalidErrorBuilder.java index 8fe2bfc396..4a84c83338 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductInvalidErrorBuilder.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductInvalidErrorBuilder.java @@ -28,6 +28,8 @@ public class VendorSoftwareProductInvalidErrorBuilder { private static final String VSP_INVALID_MSG = "Vendor software product with Id %s and version %s is invalid - does not contain " + "service model."; + private static final String VSP_INVALID_MISSING_DEPLOYMENT_FLAVOR_MSG ="VSP has to have a " + + "minimum of one Deployment Flavor defined for being able to be instantiated.Please add a Deployment Flavor and re-submit the VSP."; private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); /** @@ -36,14 +38,27 @@ public class VendorSoftwareProductInvalidErrorBuilder { * @param vendorSoftwareProductId the vendor software product id * @param version the version */ - public VendorSoftwareProductInvalidErrorBuilder(String vendorSoftwareProductId, Version version) { + public static ErrorCode VendorSoftwareProductMissingServiceModelErrorBuilder(String + vendorSoftwareProductId, + Version version) { + ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); builder.withId(VendorSoftwareProductErrorCodes.VSP_INVALID); builder.withCategory(ErrorCategory.APPLICATION); builder .withMessage(String.format(VSP_INVALID_MSG, vendorSoftwareProductId, version.toString())); + return builder.build(); } - public ErrorCode build() { + /** + * Instantiates a new Vendor software product invalid error builder. + */ + public static ErrorCode VspMissingDeploymentFlavorErrorBuilder() { + ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + builder.withId(VendorSoftwareProductErrorCodes.VSP_INVALID); + builder.withCategory(ErrorCategory.APPLICATION); + builder + .withMessage(String.format(VSP_INVALID_MISSING_DEPLOYMENT_FLAVOR_MSG)); return builder.build(); } + } |