diff options
author | vasraz <vasyl.razinkov@est.tech> | 2021-07-08 18:54:19 +0100 |
---|---|---|
committer | Michael Morris <michael.morris@est.tech> | 2021-07-21 14:01:01 +0000 |
commit | 8278b79c92f5149813f0161670a0eb76c33db322 (patch) | |
tree | c70bc2078111faa5cc5e29c071598ed1e11a5898 /openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main | |
parent | 5cb26d5eb1ab5d04319624f1ffb49f7f26d55315 (diff) |
Support handling of 'Large CSARs'
If artifact storage is enabled, stores original onboarded package,
leaving a reference in the VSP, instead of the original onboarded
package itself. Strips files from configured folders in order to reduce
the package size and onboard it. To retrieve the package, one needs to
read the reference and go to the artifact storage to retrieve.
If disabled, it just goes through the current onboarding process.
Change-Id: I3dce0ab8422ea736c8a1ffaeb1136cf8b12a2af4
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech>
Signed-off-by: André Schmid <andre.schmid@est.tech>
Issue-ID: SDC-3635
Diffstat (limited to 'openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main')
4 files changed, 17 insertions, 7 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/OnboardingPackageProcessor.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/OnboardingPackageProcessor.java index e5b68cb917..14b839e3af 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/OnboardingPackageProcessor.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/OnboardingPackageProcessor.java @@ -49,6 +49,7 @@ import org.apache.commons.io.FilenameUtils; import org.openecomp.core.utilities.file.FileContentHandler; import org.openecomp.core.utilities.json.JsonUtil; import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum; +import org.openecomp.sdc.be.csar.storage.ArtifactInfo; import org.openecomp.sdc.common.CommonConfigurationManager; import org.openecomp.sdc.common.utils.CommonUtil; import org.openecomp.sdc.common.utils.SdcCommon; @@ -76,12 +77,15 @@ public class OnboardingPackageProcessor { private final CnfPackageValidator cnfPackageValidator; private FileContentHandler packageContent; - public OnboardingPackageProcessor(final String packageFileName, final byte[] packageFileContent, - final CnfPackageValidator cnfPackageValidator) { + public OnboardingPackageProcessor(final String packageFileName, final byte[] packageFileContent, final CnfPackageValidator cnfPackageValidator, + final ArtifactInfo artifactInfo) { this.packageFileName = packageFileName; this.packageFileContent = packageFileContent; this.cnfPackageValidator = cnfPackageValidator; onboardPackageInfo = processPackage(); + if (onboardPackageInfo != null) { + onboardPackageInfo.setArtifactInfo(artifactInfo); + } } public Optional<OnboardPackageInfo> getOnboardPackageInfo() { diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateCSARHandler.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateCSARHandler.java index e7367c2a49..f1062395af 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateCSARHandler.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateCSARHandler.java @@ -42,7 +42,7 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.OnboardPackageInfo; import org.openecomp.sdc.vendorsoftwareproduct.types.OnboardSignedPackage; import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse; -public class OrchestrationTemplateCSARHandler extends BaseOrchestrationTemplateHandler implements OrchestrationTemplateFileHandler { +public class OrchestrationTemplateCSARHandler extends BaseOrchestrationTemplateHandler { @Override public UploadFileResponse validate(final OnboardPackageInfo onboardPackageInfo) { @@ -100,9 +100,10 @@ public class OrchestrationTemplateCSARHandler extends BaseOrchestrationTemplateH final OnboardPackage csarPackage = onboardPackageInfo.getOnboardPackage(); final OnboardPackage originalOnboardPackage = onboardPackageInfo.getOriginalOnboardPackage(); try { - candidateService.updateCandidateUploadData(vspDetails.getId(), vspDetails.getVersion(), - new OrchestrationTemplateCandidateData(csarPackage.getFileContent(), "", csarPackage.getFileExtension(), csarPackage.getFilename(), - originalOnboardPackage.getFilename(), originalOnboardPackage.getFileExtension(), originalOnboardPackage.getFileContent())); + final var candidateData = new OrchestrationTemplateCandidateData(csarPackage.getFileContent(), csarPackage.getFileExtension(), + csarPackage.getFilename(), originalOnboardPackage.getFilename(), originalOnboardPackage.getFileExtension(), + originalOnboardPackage.getFileContent(), onboardPackageInfo.getArtifactInfo()); + candidateService.updateCandidateUploadData(vspDetails.getId(), vspDetails.getVersion(), candidateData); } catch (final Exception exception) { logger.error(getErrorWithParameters(Messages.FILE_LOAD_CONTENT_ERROR.getErrorMessage(), getHandlerType().toString()), exception); uploadFileResponse.addStructureError(SdcCommon.UPLOAD_FILE, new ErrorMessage(ErrorLevel.ERROR, exception.getMessage())); diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateZipHandler.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateZipHandler.java index 65ce2f5397..e534eded02 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateZipHandler.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateZipHandler.java @@ -34,7 +34,7 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.OnboardPackage; import org.openecomp.sdc.vendorsoftwareproduct.types.OnboardPackageInfo; import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse; -public class OrchestrationTemplateZipHandler extends BaseOrchestrationTemplateHandler implements OrchestrationTemplateFileHandler { +public class OrchestrationTemplateZipHandler extends BaseOrchestrationTemplateHandler { @Override public UploadFileResponse validate(final OnboardPackageInfo onboardPackageInfo) { @@ -55,6 +55,7 @@ public class OrchestrationTemplateZipHandler extends BaseOrchestrationTemplateHa uploadFileResponse.getErrors()); candidateData.setFileName(zipPackage.getFilename()); candidateData.setFileSuffix(zipPackage.getFileExtension()); + candidateData.setArtifactInfo(onboardPackageInfo.getArtifactInfo()); candidateService.updateCandidateUploadData(vspDetails.getId(), vspDetails.getVersion(), candidateData); } catch (final Exception exception) { logger.error(getErrorWithParameters(Messages.FILE_LOAD_CONTENT_ERROR.getErrorMessage(), getHandlerType().toString()), exception); diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/OnboardPackageInfo.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/OnboardPackageInfo.java index a78185e89f..4bb1d98f3f 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/OnboardPackageInfo.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/OnboardPackageInfo.java @@ -20,7 +20,9 @@ package org.openecomp.sdc.vendorsoftwareproduct.types; import java.nio.ByteBuffer; import lombok.Getter; +import lombok.Setter; import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum; +import org.openecomp.sdc.be.csar.storage.ArtifactInfo; import org.openecomp.sdc.vendorsoftwareproduct.exception.OnboardPackageException; @Getter @@ -29,6 +31,8 @@ public class OnboardPackageInfo { private final OnboardingTypesEnum packageType; private final OnboardPackage originalOnboardPackage; private final OnboardPackage onboardPackage; + @Setter + private ArtifactInfo artifactInfo; public OnboardPackageInfo(final OnboardPackage onboardPackage, final OnboardingTypesEnum packageType) { this(onboardPackage, onboardPackage, packageType); |