diff options
Diffstat (limited to 'openecomp-be/lib')
3 files changed, 35 insertions, 13 deletions
diff --git a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/Messages.java b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/Messages.java index ab088a4dda..d9186bc3b2 100644 --- a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/Messages.java +++ b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/Messages.java @@ -92,6 +92,10 @@ public enum Messages { INCORRECT_SW_INFORMATION_NON_MANO_ERROR( "Incorrect software information non-mano artifact. The software version information is missing " + "or it has one or more incorrect software version entries: '%s'"), + EMPTY_ONAP_CNF_HELM_NON_MANO_ERROR( + "Non-mano onap_cnf_helm artifact was declared in the manifest, but not provided"), + UNIQUE_ONAP_CNF_HELM_NON_MANO_ERROR("Only one onap_cnf_helm non-mano artifact is allowed. " + + "Found %s."), FAILED_TO_VALIDATE_METADATA("Failed to validate metadata file"), ARTIFACT_INVALID_SIGNATURE("Invalid signature '%s' provided for artifact '%s'"), ARTIFACT_SIGNATURE_VALIDATION_ERROR( diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/etsi/ETSIService.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/etsi/ETSIService.java index 7332505b25..8b56b3fbc0 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/etsi/ETSIService.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/etsi/ETSIService.java @@ -92,4 +92,10 @@ public interface ETSIService { * @return Semver representing highest compatible specification version */ Semver getHighestCompatibleSpecificationVersion(final FileContentHandler handler); + + /** + * Verifies if SOL004 3.3.1 manifest file has onap_cnf_helm non mano entry + * @return true if manifest files has onap_cnf_helm non mano entry + */ + boolean hasCnfEnhancements(final FileContentHandler fileContentHandler) throws IOException; } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/etsi/ETSIServiceImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/etsi/ETSIServiceImpl.java index 8ec76fe14b..951cfc7d1f 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/etsi/ETSIServiceImpl.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/etsi/ETSIServiceImpl.java @@ -21,6 +21,7 @@ package org.openecomp.sdc.vendorsoftwareproduct.services.impl.etsi; import static org.openecomp.sdc.tosca.csar.CSARConstants.ARTIFACTS_FOLDER; +import static org.openecomp.sdc.tosca.csar.CSARConstants.ETSI_VERSION_2_6_1; import static org.openecomp.sdc.tosca.csar.CSARConstants.MAIN_SERVICE_TEMPLATE_MF_FILE_NAME; import static org.openecomp.sdc.tosca.csar.CSARConstants.MANIFEST_PNF_METADATA; import static org.openecomp.sdc.tosca.csar.CSARConstants.TOSCA_META_ORIG_PATH_FILE_NAME; @@ -29,8 +30,8 @@ import static org.openecomp.sdc.tosca.csar.ToscaMetaEntry.ENTRY_DEFINITIONS; import static org.openecomp.sdc.tosca.csar.ToscaMetaEntry.ETSI_ENTRY_CHANGE_LOG; import static org.openecomp.sdc.tosca.csar.ToscaMetaEntry.ETSI_ENTRY_MANIFEST; import static org.openecomp.sdc.tosca.csar.ToscaMetadataFileInfo.TOSCA_META_PATH_FILE_NAME; -import static org.openecomp.sdc.tosca.csar.CSARConstants.ETSI_VERSION_2_6_1; +import com.vdurmont.semver4j.Semver; import java.io.IOException; import java.io.InputStream; import java.nio.file.Path; @@ -42,11 +43,11 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; import java.util.stream.Collectors; - import org.apache.commons.collections.MapUtils; import org.onap.sdc.tosca.datatypes.model.ServiceTemplate; import org.onap.sdc.tosca.services.YamlUtil; import org.openecomp.core.utilities.file.FileContentHandler; +import org.openecomp.sdc.be.config.NonManoArtifactType; import org.openecomp.sdc.be.config.NonManoConfiguration; import org.openecomp.sdc.be.config.NonManoConfigurationManager; import org.openecomp.sdc.be.config.NonManoFolderType; @@ -59,8 +60,6 @@ import org.openecomp.sdc.tosca.csar.SOL004ManifestOnboarding; import org.openecomp.sdc.tosca.csar.ToscaMetadata; import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; -import com.vdurmont.semver4j.Semver; - public class ETSIServiceImpl implements ETSIService { private static final Logger LOGGER = LoggerFactory.getLogger(ETSIServiceImpl.class); @@ -83,15 +82,7 @@ public class ETSIServiceImpl implements ETSIService { @Override public Optional<Map<String, Path>> moveNonManoFileToArtifactFolder(final FileContentHandler handler) throws IOException { - final Manifest manifest; - try { - manifest = getManifest(handler); - } catch (final IOException ex) { - if (LOGGER.isErrorEnabled()) { - LOGGER.error("An error occurred while getting the manifest file", ex); - } - throw ex; - } + final Manifest manifest = loadManifest(handler); final Path originalManifestPath; try { originalManifestPath = getOriginalManifestPath(handler); @@ -224,6 +215,27 @@ public class ETSIServiceImpl implements ETSIService { } + @Override + public boolean hasCnfEnhancements(final FileContentHandler fileContentHandler) throws IOException { + final Manifest manifest = loadManifest(fileContentHandler); + return manifest.getNonManoSources().entrySet().stream() + .filter(manifestNonManoSourceEntry -> NonManoArtifactType.ONAP_CNF_HELM.getType() + .equalsIgnoreCase(manifestNonManoSourceEntry.getKey())).findFirst().isPresent(); + } + + private Manifest loadManifest(final FileContentHandler handler) throws IOException { + final Manifest manifest; + try { + manifest = getManifest(handler); + } catch (final IOException ex) { + if (LOGGER.isErrorEnabled()) { + LOGGER.error("An error occurred while getting the manifest file", ex); + } + throw ex; + } + return manifest; + } + private boolean isMetaFilePresent(Map<String, byte[]> handler) { return handler.containsKey(TOSCA_META_PATH_FILE_NAME) || handler.containsKey(TOSCA_META_ORIG_PATH_FILE_NAME); } |