summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-vendor-software-product-lib')
-rw-r--r--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.java6
-rw-r--r--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.java38
2 files changed, 31 insertions, 13 deletions
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);
}