aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be
diff options
context:
space:
mode:
authorsebdet <sebastien.determe@intl.att.com>2021-06-04 17:56:49 +0200
committersebdet <sebastien.determe@intl.att.com>2021-06-10 18:23:54 +0200
commitda5e2b085b5eb072e318fcf239b4b79bb30c83b8 (patch)
treedcf3cde72c696b64a710fcd09c45e501834016b2 /openecomp-be
parent3fdd800133ad5f07aadc90f9731cca28e96896d9 (diff)
Add parameter for Zip Validation
Add a onboarding config parameter to enable or disable the Zip Validation Issue-ID: SDC-3603 Signed-off-by: sebdet <sebastien.determe@intl.att.com> Change-Id: I83f539caccd29799f613d4e0bb65c7d7e6b97b45
Diffstat (limited to 'openecomp-be')
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/OnboardingPackageProcessor.java17
-rw-r--r--openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/templates/default/configuration.yaml.erb5
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/GlobalContextUtil.java3
3 files changed, 19 insertions, 6 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 0446103491..e5b68cb917 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.common.CommonConfigurationManager;
import org.openecomp.sdc.common.utils.CommonUtil;
import org.openecomp.sdc.common.utils.SdcCommon;
import org.openecomp.sdc.common.zip.exception.ZipException;
@@ -145,19 +146,27 @@ public class OnboardingPackageProcessor {
return new OnboardPackageInfo(onboardPackage, OnboardingTypesEnum.CSAR);
}
+ private OnboardPackageInfo createOnboardPackageInfoForZip(String packageName, String packageExtension) {
+ return new OnboardPackageInfo(
+ new OnboardPackage(packageName, packageExtension, ByteBuffer.wrap(packageFileContent),
+ packageContent), OnboardingTypesEnum.ZIP);
+ }
+
private OnboardPackageInfo processOnapNativeZipPackage(String packageName, String packageExtension) {
+ if (CommonConfigurationManager.getInstance().getConfigValue("zipValidation", "ignoreManifest", false)) {
+ return createOnboardPackageInfoForZip(packageName, packageExtension);
+ }
ManifestContent manifest = getManifest();
if (manifest != null) {
List<String> errors = validateZipPackage(manifest);
if (errors.isEmpty()) {
- final OnboardPackage onboardPackage = new OnboardPackage(packageName, packageExtension, ByteBuffer.wrap(packageFileContent),
- packageContent);
- return new OnboardPackageInfo(onboardPackage, OnboardingTypesEnum.ZIP);
+ return createOnboardPackageInfoForZip(packageName, packageExtension);
} else {
errors.forEach(message -> reportError(ErrorLevel.ERROR, message));
}
} else {
- reportError(ErrorLevel.ERROR, COULD_NOT_READ_MANIFEST_FILE.formatMessage(SdcCommon.MANIFEST_NAME, packageFileName));
+ reportError(ErrorLevel.ERROR,
+ COULD_NOT_READ_MANIFEST_FILE.formatMessage(SdcCommon.MANIFEST_NAME, packageFileName));
}
return null;
}
diff --git a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/templates/default/configuration.yaml.erb b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/templates/default/configuration.yaml.erb
index 853fcf7ab6..474dd48326 100644
--- a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/templates/default/configuration.yaml.erb
+++ b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/templates/default/configuration.yaml.erb
@@ -49,4 +49,7 @@ basicAuth:
enabled: <%= @basic_auth_enabled %>
userName: <%= @basic_auth_username %>
userPass: <%= @basic_auth_password %>
- excludedUrls: "/v1.0/healthcheck" \ No newline at end of file
+ excludedUrls: "/v1.0/healthcheck"
+
+zipValidation:
+ ignoreManifest: false \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/GlobalContextUtil.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/GlobalContextUtil.java
index b490f4b35f..c104085c4d 100644
--- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/GlobalContextUtil.java
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/GlobalContextUtil.java
@@ -24,6 +24,7 @@ import java.util.Set;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import org.openecomp.core.validation.types.GlobalValidationContext;
+import org.openecomp.sdc.common.utils.SdcCommon;
import org.openecomp.sdc.heat.datatypes.manifest.FileData;
import org.openecomp.sdc.heat.datatypes.manifest.FileData.Type;
import org.openecomp.sdc.heat.datatypes.manifest.ManifestContent;
@@ -44,7 +45,7 @@ class GlobalContextUtil {
}
private static boolean isManifestMissing(GlobalValidationContext globalContext) {
- return globalContext.getFileContent("MANIFEST.json").isEmpty();
+ return globalContext.getFileContent(SdcCommon.MANIFEST_NAME).isEmpty();
}
private static Set<String> filterFilesByType(Map<String, FileData.Type> filesWithTypes,