diff options
author | bilal.iqbal <bilal.iqbal@est.tech> | 2019-03-25 14:31:14 +0000 |
---|---|---|
committer | bilal.iqbal <bilal.iqbal@est.tech> | 2019-03-25 14:31:14 +0000 |
commit | 62f5ad6b806d0bda1bb918061a5aa4b5b4dbe8b8 (patch) | |
tree | 75d0c2d82c6be3b71d79b4174aca009681e9c0b1 /openecomp-be/lib/openecomp-tosca-lib/src/main/java/org | |
parent | 53903f1d96affe2c21e3ffbdd45aea8f7af0714d (diff) |
Change SOL004 baseline from v2.5.1 to v2.6.1
Change-Id: Ic524e25a5f0a9952dd0a2c578034c60e51c7a290
Issue-ID: SDC-2190
Signed-off-by: bilal.iqbal <bilal.iqbal@est.tech>
Diffstat (limited to 'openecomp-be/lib/openecomp-tosca-lib/src/main/java/org')
4 files changed, 32 insertions, 5 deletions
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/AbstractOnboardingManifest.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/AbstractOnboardingManifest.java index 50c2c106ff..00eb46183a 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/AbstractOnboardingManifest.java +++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/AbstractOnboardingManifest.java @@ -19,6 +19,7 @@ package org.openecomp.sdc.tosca.csar; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; +import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.common.errors.Messages; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; @@ -33,18 +34,22 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Optional; import static org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder.getErrorWithParameters; +import static org.openecomp.sdc.tosca.csar.CSARConstants.MANIFEST_PNF_METADATA; import static org.openecomp.sdc.tosca.csar.CSARConstants.METADATA_MF_ATTRIBUTE; import static org.openecomp.sdc.tosca.csar.CSARConstants.SEPERATOR_MF_ATTRIBUTE; abstract class AbstractOnboardingManifest implements Manifest{ private static final Logger LOGGER = LoggerFactory.getLogger(AbstractOnboardingManifest.class); + private static final int MAX_ALLOWED_MANIFEST_META_ENTRIES = 4; protected Map<String, String> metadata; protected List<String> sources; protected List<String> errors; protected Map<String, List<String>> nonManoSources; + protected ResourceTypeEnum type; protected AbstractOnboardingManifest() { errors = new ArrayList<>(); @@ -54,6 +59,19 @@ import static org.openecomp.sdc.tosca.csar.CSARConstants.SEPERATOR_MF_ATTRIBUTE; } @Override + public Optional<ResourceTypeEnum> getType(){ + if(errors.isEmpty() && !metadata.isEmpty() && metadata.size() == MAX_ALLOWED_MANIFEST_META_ENTRIES) { + for (String key : metadata.keySet()) { + if (MANIFEST_PNF_METADATA.stream().anyMatch(key::equals)) { + return Optional.of(ResourceTypeEnum.PNF); + } + return Optional.of(ResourceTypeEnum.VF); + } + } + return Optional.empty(); + } + + @Override public void parse(InputStream is) { try { ImmutableList<String> lines = readAllLines(is); diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/CSARConstants.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/CSARConstants.java index 826a72b6fd..d7dd3d450f 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/CSARConstants.java +++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/CSARConstants.java @@ -32,10 +32,11 @@ public class CSARConstants { public static final String TOSCA_META_CSAR_VERSION_ENTRY = "CSAR-Version"; public static final String TOSCA_META_CREATED_BY_ENTRY = "Created-by"; public static final String TOSCA_META_ENTRY_DEFINITIONS="Entry-Definitions"; - public static final String TOSCA_META_ENTRY_MANIFEST="Entry-Manifest"; - public static final String TOSCA_META_ENTRY_CHANGE_LOG="Entry-Change-Log"; - public static final String TOSCA_META_ENTRY_TESTS = "Entry-Tests"; - public static final String TOSCA_META_ENTRY_LICENSES= "Entry-Licenses"; + public static final String TOSCA_META_ETSI_ENTRY_MANIFEST ="ETSI-Entry-Manifest"; + public static final String TOSCA_META_ETSI_ENTRY_CHANGE_LOG ="ETSI-Entry-Change-Log"; + public static final String TOSCA_META_ETSI_ENTRY_TESTS = "ETSI-Entry-Tests"; + public static final String TOSCA_META_ETSI_ENTRY_LICENSES = "ETSI-Entry-Licenses"; + public static final String TOSCA_META_ETSI_ENTRY_CERTIFICATE = "ETSI-Entry-Certificate"; public static final ImmutableSet<String> ELIGIBLE_FILES = of(MAIN_SERVICE_TEMPLATE_MF_FILE_NAME,MAIN_SERVICE_TEMPLATE_YAML_FILE_NAME); public static final ImmutableSet<String> MANIFEST_PNF_METADATA = diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/Manifest.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/Manifest.java index 1a11ecf6f6..c11f4a3ddc 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/Manifest.java +++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/Manifest.java @@ -20,9 +20,11 @@ package org.openecomp.sdc.tosca.csar; +import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import java.io.InputStream; import java.util.List; import java.util.Map; +import java.util.Optional; public interface Manifest { @@ -62,4 +64,10 @@ public interface Manifest { * @return */ Map<String, List<String>> getNonManoSources(); + + /** + * Gets the type based on the metadata of manifest file (VF/PNF) + * @return enum for type values + */ + Optional<ResourceTypeEnum> getType(); } diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/SOL004ManifestOnboarding.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/SOL004ManifestOnboarding.java index 267729596b..1ee1c1b1ae 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/SOL004ManifestOnboarding.java +++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/SOL004ManifestOnboarding.java @@ -32,7 +32,7 @@ import static org.openecomp.sdc.tosca.csar.CSARConstants.NON_MANO_MF_ATTRIBUTE; import static org.openecomp.sdc.tosca.csar.CSARConstants.SEPERATOR_MF_ATTRIBUTE; import static org.openecomp.sdc.tosca.csar.CSARConstants.SOURCE_MF_ATTRIBUTE; -public class SOL004ManifestOnboarding extends AbstractOnboardingManifest implements Manifest { +public class SOL004ManifestOnboarding extends AbstractOnboardingManifest { @Override protected void processMetadata(Iterator<String> iterator) { |