From e3de4c9d214983d38a7d66e89dae5d4bba170ca3 Mon Sep 17 00:00:00 2001 From: Joanna Jeremicz Date: Wed, 21 Apr 2021 13:59:12 +0200 Subject: Integrate helm validator with SDC-BE - Read helm validator configuration - Add call to helm validator during Helm validation - Add JUnit tests - Fix display message when CNF upload is unsuccessful - Show warning messages from validation after CNF upload Issue-ID: SDC-3185 Signed-off-by: Joanna Jeremicz Change-Id: If197d557e6ddef4a07bef986d7cf133aedcb2cc5 Signed-off-by: Piotr Marcinkiewicz --- .../OrchestrationTemplateCandidateImpl.java | 24 ++- .../validation/impl/validators/HelmValidator.java | 33 ++++ .../onboarding/OnboardingPackageProcessor.java | 11 +- .../onboarding/validation/CnfPackageValidator.java | 15 +- .../onboarding/OnboardingPackageProcessorTest.java | 5 +- .../OnboardingPackageProcessorUnitTest.java | 10 +- .../csar/validation/CsarSecurityValidatorTest.java | 10 +- .../recipes/ON_5_setup_configuration.rb | 16 ++ .../default/helmvalidator-configuration.yaml.erb | 6 + .../src/main/resources/config-validaton.json | 6 +- .../openecomp-sdc-validation-impl/pom.xml | 8 +- .../impl/util/HelmValidatorConfigReader.java | 78 +++++++++ .../impl/util/HelmValidatorHttpClient.java | 73 ++++++++ .../impl/validators/GlobalContextUtil.java | 14 +- .../validation/impl/validators/HeatValidator.java | 11 +- .../validation/impl/validators/HelmValidator.java | 106 ++++++++++++ .../impl/validators/PmDictionaryValidator.java | 3 +- .../validation/impl/validators/YamlValidator.java | 3 +- .../type/helmvalidator/HelmValidatorConfig.java | 78 +++++++++ .../helmvalidator/HelmValidatorErrorResponse.java | 34 ++++ .../type/helmvalidator/HelmValidatorResponse.java | 66 ++++++++ .../impl/util/HelmValidatorConfigReaderTest.java | 113 +++++++++++++ .../impl/util/HelmValidatorHttpClientTest.java | 185 +++++++++++++++++++++ .../impl/validators/GlobalContextUtilTest.java | 10 +- .../impl/validators/HelmValidatorTest.java | 141 ++++++++++++++++ .../helm_validator/valid_chart/MANIFEST.json | 11 ++ .../helm_validator/valid_chart/chart.tgz | Bin 0 -> 259 bytes .../helm_validator/valid_two_charts/MANIFEST.json | 16 ++ .../helm_validator/valid_two_charts/chart1.tgz | Bin 0 -> 259 bytes .../helm_validator/valid_two_charts/chart2.tgz | Bin 0 -> 258 bytes 30 files changed, 1042 insertions(+), 44 deletions(-) create mode 100644 openecomp-be/backend/openecomp-sdc-validation-manager/src/test/java/org/openecomp/sdc/validation/impl/validators/HelmValidator.java create mode 100644 openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/templates/default/helmvalidator-configuration.yaml.erb create mode 100644 openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/util/HelmValidatorConfigReader.java create mode 100644 openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/util/HelmValidatorHttpClient.java create mode 100644 openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/HelmValidator.java create mode 100644 openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/type/helmvalidator/HelmValidatorConfig.java create mode 100644 openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/type/helmvalidator/HelmValidatorErrorResponse.java create mode 100644 openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/type/helmvalidator/HelmValidatorResponse.java create mode 100644 openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/util/HelmValidatorConfigReaderTest.java create mode 100644 openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/util/HelmValidatorHttpClientTest.java create mode 100644 openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/HelmValidatorTest.java create mode 100644 openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/helm_validator/valid_chart/MANIFEST.json create mode 100644 openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/helm_validator/valid_chart/chart.tgz create mode 100644 openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/helm_validator/valid_two_charts/MANIFEST.json create mode 100644 openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/helm_validator/valid_two_charts/chart1.tgz create mode 100644 openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/helm_validator/valid_two_charts/chart2.tgz (limited to 'openecomp-be') diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/OrchestrationTemplateCandidateImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/OrchestrationTemplateCandidateImpl.java index 48ad75d09c..cd18cf973b 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/OrchestrationTemplateCandidateImpl.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/OrchestrationTemplateCandidateImpl.java @@ -52,6 +52,7 @@ import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductManager; import org.openecomp.sdc.vendorsoftwareproduct.VspManagerFactory; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; import org.openecomp.sdc.vendorsoftwareproduct.impl.onboarding.OnboardingPackageProcessor; +import org.openecomp.sdc.vendorsoftwareproduct.impl.onboarding.validation.CnfPackageValidator; import org.openecomp.sdc.vendorsoftwareproduct.types.OnboardPackageInfo; import org.openecomp.sdc.vendorsoftwareproduct.types.OrchestrationTemplateActionResponse; import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse; @@ -98,10 +99,12 @@ public class OrchestrationTemplateCandidateImpl implements OrchestrationTemplate final byte[] fileToUploadBytes = fileToUpload.getObject(byte[].class); final DataHandler dataHandler = fileToUpload.getDataHandler(); final String filename = ValidationUtils.sanitizeInputString(dataHandler.getName()); - final OnboardingPackageProcessor onboardingPackageProcessor = new OnboardingPackageProcessor(filename, fileToUploadBytes); + final OnboardingPackageProcessor onboardingPackageProcessor = + new OnboardingPackageProcessor(filename, fileToUploadBytes, new CnfPackageValidator()); + final ErrorMessage[] errorMessages = onboardingPackageProcessor.getErrorMessages().toArray(new ErrorMessage[0]); if (onboardingPackageProcessor.hasErrors()) { final UploadFileResponseDto uploadFileResponseDto = buildUploadResponseWithError( - onboardingPackageProcessor.getErrorMessages().toArray(new ErrorMessage[0])); + errorMessages); return Response.status(Status.NOT_ACCEPTABLE).entity(uploadFileResponseDto).build(); } final OnboardPackageInfo onboardPackageInfo = onboardingPackageProcessor.getOnboardPackageInfo().orElse(null); @@ -112,23 +115,30 @@ public class OrchestrationTemplateCandidateImpl implements OrchestrationTemplate } final VspDetails vspDetails = new VspDetails(ValidationUtils.sanitizeInputString(vspId), new Version(ValidationUtils.sanitizeInputString(versionId))); - return processOnboardPackage(onboardPackageInfo, vspDetails); + return processOnboardPackage(onboardPackageInfo, vspDetails, errorMessages); } - private Response processOnboardPackage(final OnboardPackageInfo onboardPackageInfo, final VspDetails vspDetails) { + private Response processOnboardPackage(final OnboardPackageInfo onboardPackageInfo, final VspDetails vspDetails, final ErrorMessage... errorMessages) { final UploadFileResponse uploadFileResponse = candidateManager.upload(vspDetails, onboardPackageInfo); final UploadFileResponseDto uploadFileResponseDto = new MapUploadFileResponseToUploadFileResponseDto() .applyMapping(uploadFileResponse, UploadFileResponseDto.class); + if (errorMessages.length > 0) { + uploadFileResponseDto.setErrors(getErrorMap(errorMessages)); + } return Response.ok(uploadFileResponseDto).build(); } - private UploadFileResponseDto buildUploadResponseWithError(final ErrorMessage... errorMessages) { - final UploadFileResponseDto uploadFileResponseDto = new UploadFileResponseDto(); + private Map> getErrorMap(ErrorMessage[] errorMessages) { final Map> errorMap = new HashMap<>(); final List errorMessageList = new ArrayList<>(); Collections.addAll(errorMessageList, errorMessages); errorMap.put(SdcCommon.UPLOAD_FILE, errorMessageList); - uploadFileResponseDto.setErrors(errorMap); + return errorMap; + } + + private UploadFileResponseDto buildUploadResponseWithError(final ErrorMessage... errorMessages) { + final UploadFileResponseDto uploadFileResponseDto = new UploadFileResponseDto(); + uploadFileResponseDto.setErrors(getErrorMap(errorMessages)); return uploadFileResponseDto; } diff --git a/openecomp-be/backend/openecomp-sdc-validation-manager/src/test/java/org/openecomp/sdc/validation/impl/validators/HelmValidator.java b/openecomp-be/backend/openecomp-sdc-validation-manager/src/test/java/org/openecomp/sdc/validation/impl/validators/HelmValidator.java new file mode 100644 index 0000000000..2246ca52ea --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-validation-manager/src/test/java/org/openecomp/sdc/validation/impl/validators/HelmValidator.java @@ -0,0 +1,33 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2021 Nokia. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.openecomp.sdc.validation.impl.validators; + +import org.openecomp.core.validation.types.GlobalValidationContext; +import org.openecomp.sdc.validation.Validator; + +/** + * Stub required for class creation in test scope + */ +public class HelmValidator implements Validator { + + @Override + public void validate(GlobalValidationContext globalContext) { + } +} 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 640a15735f..0446103491 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 @@ -75,10 +75,11 @@ public class OnboardingPackageProcessor { private final CnfPackageValidator cnfPackageValidator; private FileContentHandler packageContent; - public OnboardingPackageProcessor(final String packageFileName, final byte[] packageFileContent) { + public OnboardingPackageProcessor(final String packageFileName, final byte[] packageFileContent, + final CnfPackageValidator cnfPackageValidator) { this.packageFileName = packageFileName; this.packageFileContent = packageFileContent; - this.cnfPackageValidator = new CnfPackageValidator(); + this.cnfPackageValidator = cnfPackageValidator; onboardPackageInfo = processPackage(); } @@ -87,11 +88,13 @@ public class OnboardingPackageProcessor { } public boolean hasErrors() { - return !errorMessages.isEmpty(); + return errorMessages.stream() + .anyMatch(error -> error.getLevel() == ErrorLevel.ERROR); } public boolean hasNoErrors() { - return errorMessages.isEmpty(); + return errorMessages.stream() + .noneMatch(error -> error.getLevel() == ErrorLevel.ERROR); } public Set getErrorMessages() { diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/validation/CnfPackageValidator.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/validation/CnfPackageValidator.java index 50f1fd8d06..6c886f8e74 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/validation/CnfPackageValidator.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/validation/CnfPackageValidator.java @@ -42,7 +42,7 @@ public class CnfPackageValidator { Stats stats = new Stats(); for (FileData mod : modules) { if (mod.getBase() == null) { - stats.without++; + stats.withoutBase++; } else if (mod.getBase()) { stats.base++; } @@ -50,14 +50,14 @@ public class CnfPackageValidator { return stats; } - private List createErrorMessages(Stats stats) { + private List createErrorMessages(Stats result) { List messages = new ArrayList<>(); - if (stats.without > 0) { - messages.add(MANIFEST_VALIDATION_HELM_IS_BASE_MISSING.formatMessage(stats.without)); + if (result.withoutBase > 0) { + messages.add(MANIFEST_VALIDATION_HELM_IS_BASE_MISSING.formatMessage(result.withoutBase)); } - if (stats.base == 0) { + if (result.base == 0) { messages.add(MANIFEST_VALIDATION_HELM_IS_BASE_NOT_SET.getErrorMessage()); - } else if (stats.base > 1) { + } else if (result.base > 1) { messages.add(MANIFEST_VALIDATION_HELM_IS_BASE_NOT_UNIQUE.getErrorMessage()); } return messages; @@ -66,6 +66,7 @@ public class CnfPackageValidator { private static class Stats { private int base = 0; - private int without = 0; + private int withoutBase = 0; } + } diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/OnboardingPackageProcessorTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/OnboardingPackageProcessorTest.java index d6327866f4..6c847a713e 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/OnboardingPackageProcessorTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/OnboardingPackageProcessorTest.java @@ -49,6 +49,7 @@ import org.junit.runners.Parameterized.Parameters; import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum; import org.openecomp.sdc.datatypes.error.ErrorLevel; import org.openecomp.sdc.datatypes.error.ErrorMessage; +import org.openecomp.sdc.vendorsoftwareproduct.impl.onboarding.validation.CnfPackageValidator; import org.openecomp.sdc.vendorsoftwareproduct.types.OnboardPackageInfo; @RunWith(Parameterized.class) @@ -59,6 +60,7 @@ public class OnboardingPackageProcessorTest { private final byte[] packageBytes; private final Set expectedErrorSet; private final OnboardingTypesEnum expectedPackageType; + private final CnfPackageValidator cnfPackageValidator; public OnboardingPackageProcessorTest(final String packageName, final byte[] packageBytes, final Set expectedErrorSet, @@ -67,6 +69,7 @@ public class OnboardingPackageProcessorTest { this.packageBytes = packageBytes; this.expectedErrorSet = expectedErrorSet; this.expectedPackageType = expectedPackageType; + this.cnfPackageValidator = new CnfPackageValidator(); } @Parameters(name = "Run {index} for {0}") @@ -115,7 +118,7 @@ public class OnboardingPackageProcessorTest { @Test public void processPackage() { final OnboardingPackageProcessor onboardingPackageProcessor = new OnboardingPackageProcessor(packageName, - packageBytes); + packageBytes, cnfPackageValidator); assertThat("Should contains errors", onboardingPackageProcessor.hasErrors(), is(!expectedErrorSet.isEmpty())); assertThat("Should have the same number of errors", onboardingPackageProcessor.getErrorMessages().size(), equalTo(expectedErrorSet.size())); diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/OnboardingPackageProcessorUnitTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/OnboardingPackageProcessorUnitTest.java index a97a0f639a..795da7780f 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/OnboardingPackageProcessorUnitTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/onboarding/OnboardingPackageProcessorUnitTest.java @@ -19,6 +19,9 @@ package org.openecomp.sdc.vendorsoftwareproduct.impl.onboarding; +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertThat; + import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -26,14 +29,13 @@ import org.junit.Test; 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; - -import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; +import org.openecomp.sdc.vendorsoftwareproduct.impl.onboarding.validation.CnfPackageValidator; public class OnboardingPackageProcessorUnitTest { - private OnboardingPackageProcessor processor = new OnboardingPackageProcessor("unitTestPackage", null); + private OnboardingPackageProcessor processor = new OnboardingPackageProcessor("unitTestPackage", + null, new CnfPackageValidator()); @Test public void shouldValidateZipPackage_helmWithoutHeat() { diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/CsarSecurityValidatorTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/CsarSecurityValidatorTest.java index 0fce606052..27d80412bf 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/CsarSecurityValidatorTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/CsarSecurityValidatorTest.java @@ -34,6 +34,7 @@ import org.junit.Before; import org.junit.Test; import org.mockito.Mock; import org.openecomp.sdc.vendorsoftwareproduct.impl.onboarding.OnboardingPackageProcessor; +import org.openecomp.sdc.vendorsoftwareproduct.impl.onboarding.validation.CnfPackageValidator; import org.openecomp.sdc.vendorsoftwareproduct.security.SecurityManager; import org.openecomp.sdc.vendorsoftwareproduct.security.SecurityManagerException; import org.openecomp.sdc.vendorsoftwareproduct.types.OnboardPackageInfo; @@ -56,7 +57,7 @@ public class CsarSecurityValidatorTest { public void isSignatureValidTestCorrectStructureAndValidSignatureExists() throws SecurityManagerException { final byte[] packageBytes = getFileBytesOrFail("signing/signed-package.zip"); final OnboardSignedPackage onboardSignedPackage = loadSignedPackage("signed-package.zip", - packageBytes); + packageBytes, null); when(securityManager.verifySignedData(any(), any(), any())).thenReturn(true); final boolean isSignatureValid = csarSecurityValidator.verifyPackageSignature(onboardSignedPackage); assertThat("Signature should be valid", isSignatureValid, is(true)); @@ -66,7 +67,7 @@ public class CsarSecurityValidatorTest { public void isSignatureValidTestCorrectStructureAndNotValidSignatureExists() throws SecurityManagerException { final byte[] packageBytes = getFileBytesOrFail("signing/signed-package-tampered-data.zip"); final OnboardSignedPackage onboardSignedPackage = loadSignedPackage("signed-package-tampered-data.zip", - packageBytes); + packageBytes, null); //no mocked securityManager csarSecurityValidator = new CsarSecurityValidator(); csarSecurityValidator.verifyPackageSignature(onboardSignedPackage); @@ -86,9 +87,10 @@ public class CsarSecurityValidatorTest { CsarSecurityValidatorTest.class.getResource(BASE_DIR + path).toURI())); } - private OnboardSignedPackage loadSignedPackage(final String packageName, final byte[] packageBytes) { + private OnboardSignedPackage loadSignedPackage(final String packageName, final byte[] packageBytes, + CnfPackageValidator cnfPackageValidator) { final OnboardingPackageProcessor onboardingPackageProcessor = - new OnboardingPackageProcessor(packageName, packageBytes); + new OnboardingPackageProcessor(packageName, packageBytes, cnfPackageValidator); final OnboardPackageInfo onboardPackageInfo = onboardingPackageProcessor.getOnboardPackageInfo().orElse(null); if (onboardPackageInfo == null) { fail("Unexpected error. Could not load original package"); diff --git a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_5_setup_configuration.rb b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_5_setup_configuration.rb index e7048427c7..17495687c8 100644 --- a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_5_setup_configuration.rb +++ b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_5_setup_configuration.rb @@ -42,6 +42,22 @@ template "VnfrepoConfiguration" do end +template "HelmValidatorConfiguration" do + path "#{ENV['JETTY_BASE']}/config/onboarding-be/config-helmvalidator.yaml" + source "helmvalidator-configuration.yaml.erb" + owner "jetty" + group "jetty" + mode "0755" + variables({ + :HVALIDATOR_ENABLED => node['HelmValidator']['validator_enabled'], + :HVALIDATOR_URL => node['HelmValidator']['validator_url'], + :HVALIDATOR_HELM_VERSION => node['HelmValidator']['helm_version'], + :HVALIDATOR_DEPLOYABLE => node['HelmValidator']['deployable'], + :HVALIDATOR_LINTABLE => node['HelmValidator']['lintable'], + :HVALIDATOR_STRICT_LINTABLE => node['HelmValidator']['strict_lintable'] + }) +end + template "ExternalTestingConfiguration" do path "#{ENV['JETTY_BASE']}/config/onboarding-be/externaltesting-configuration.yaml" diff --git a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/templates/default/helmvalidator-configuration.yaml.erb b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/templates/default/helmvalidator-configuration.yaml.erb new file mode 100644 index 0000000000..37021c7a9a --- /dev/null +++ b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/templates/default/helmvalidator-configuration.yaml.erb @@ -0,0 +1,6 @@ +hValidatorEnabled: <%= @HVALIDATOR_ENABLED %> +hValidatorUrl: <%= @HVALIDATOR_URL %> +hValidatorVersion: <%= @HVALIDATOR_HELM_VERSION %> +hValidatorDeployable: <%= @HVALIDATOR_DEPLOYABLE %> +hValidatorLintable: <%= @HVALIDATOR_LINTABLE %> +hValidatorStrictLintable: <%= @HVALIDATOR_STRICT_LINTABLE %> diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/main/resources/config-validaton.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/main/resources/config-validaton.json index 75fd84c574..46e3f8441f 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/main/resources/config-validaton.json +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/main/resources/config-validaton.json @@ -23,6 +23,10 @@ "enable": true, "implementationClass": "org.openecomp.sdc.validation.impl.validators.ContrailValidator" }, + "helmValidator": { + "enable": true, + "implementationClass": "org.openecomp.sdc.validation.impl.validators.HelmValidator" + }, "resourceHeatValidator": { "enable": true, "implementationClass": "org.openecomp.sdc.validation.impl.validators.HeatResourceValidator", @@ -96,4 +100,4 @@ "_config":{ "namespace": "validation" } -} \ No newline at end of file +} diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/pom.xml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/pom.xml index a34e4daa10..d88e3f7431 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/pom.xml @@ -1,6 +1,6 @@