aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib
diff options
context:
space:
mode:
authorbilal.iqbal <bilal.iqbal@est.tech>2019-03-25 14:31:14 +0000
committerbilal.iqbal <bilal.iqbal@est.tech>2019-03-25 14:31:14 +0000
commit62f5ad6b806d0bda1bb918061a5aa4b5b4dbe8b8 (patch)
tree75d0c2d82c6be3b71d79b4174aca009681e9c0b1 /openecomp-be/lib
parent53903f1d96affe2c21e3ffbdd45aea8f7af0714d (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')
-rw-r--r--openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/Messages.java18
-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.java8
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/etsi/ETSIServiceImplTest.java4
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaSolConverterImpl.java21
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/impl/ToscaSolConverterImplTest.java4
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/pom.xml6
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/AbstractOnboardingManifest.java18
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/CSARConstants.java9
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/Manifest.java8
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/SOL004ManifestOnboarding.java2
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/csar/ManifestParsingTest.java6
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/csar/MetadataParsingTest.java8
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/metadata/ValidETSItosca.meta4
13 files changed, 84 insertions, 32 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 8c62cfc0d0..2111f6d547 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
@@ -33,10 +33,11 @@ public enum Messages {
MANIFEST_NO_METADATA("Manifest must contain metadata"),
MANIFEST_NO_SOURCES("Manifest must contain Source"),
MANIFEST_METADATA_MISSING_ENTRY("Manifest metadata missing entry %s"),
- MANIFEST_INVALID_NAME("Manifest file has a different name than main TOSCA definitions file"),
- MANIFEST_INVALID_EXT("Manifest file does not have extension \".mf\" "),
+ MANIFEST_INVALID_NAME("Manifest file %s and TOSCA definitions file %s must have the same name"),
+ MANIFEST_INVALID_EXT("Manifest file must have extension \".mf\" "),
MANIFEST_METADATA_INVALID_ENTRY("Manifest metadata should only have pnf or vnf entries"),
- MANIFEST_METADATA_DOES_NOT_MATCH_LIMIT("Manifest metadata must only have the required number of values [%s]"),
+ MANIFEST_INVALID_PNF_METADATA("%s TOSCA.meta file is applicable for VF only"),
+ MANIFEST_METADATA_DOES_NOT_MATCH_LIMIT("Manifest metadata must only have the required number [%s] of values"),
MANIFEST_EMPTY("Manifest must contain data"),
MANIFEST_PARSER_INTERNAL("Invalid manifest file"),
METADATA_PARSER_INTERNAL("Invalid Metadata file"),
@@ -44,7 +45,7 @@ public enum Messages {
METADATA_UNSUPPORTED_ENTRY("Following entry not supported in TOSCA.meta %s"),
METADATA_INVALID_VERSION("Invalid entry %s value %s"),
METADATA_INVALID_VALUE("Invalid value %s in TOSCA.meta file"),
- METADATA_MISSING_ENTRY("TOSCA.meta file missing entry %s"),
+ METADATA_MISSING_ENTRY("TOSCA.meta file in TOSCA-metadata directory missing entry %s"),
METADATA_NO_ENTRY_DEFINITIONS("TOSCA.meta must contain Entry Definitions"),
METADATA_INVALID_ENTRY_DEFINITIONS("TOSCA.meta must contain key:value entries"),
FAILED_TO_VALIDATE_METADATA("Failed to validate metadata file"),
@@ -68,6 +69,7 @@ public enum Messages {
"Wrong VES EVENT Artifact was uploaded - all files contained in Artifact must be YAML files" +
" (using .yaml/.yml extensions)"),
MANIFEST_NOT_EXIST("Manifest doesn't exist"),
+ MANIFEST_NOT_FOUND("Manifest file %s referenced in TOSCA.meta does not exist"),
FILE_TYPE_NOT_LEGAL("File type not legal as data for other file"),
MODULE_IN_MANIFEST_NO_YAML("Module '%s', has no yaml file reference"),
NO_MODULES_IN_MANIFEST("At least one Base/Module must be defined \n"),
@@ -95,6 +97,8 @@ public enum Messages {
MISSING_FILE_NAME_IN_MANIFEST("Missing file name in manifest"),
MISSING_NESTED_FILE("Missing nested file - %s"),
MISSING_ARTIFACT("Missing artifact - %s"),
+ MISSING_MANIFEST_SOURCE("%s artifact %s referenced in manifest file does not exist"),
+ MISSING_METADATA_FILES("%s file referenced in TOSCA.meta does not exist"),
WRONG_HEAT_FILE_EXTENSION("Wrong HEAT file extension - %s"),
WRONG_ENV_FILE_EXTENSION("Wrong ENV file extension - %s"),
INVALID_MANIFEST_FILE("invalid manifest file"),
@@ -105,9 +109,9 @@ public enum Messages {
TOSCA_PARSING_FAILURE("Invalid tosca file. Error code : %s, Error message : %s/"),
/*definition errors*/
- MISSING_DEFINITION_FILE("Definition file %s does not exist"),
- MISSING_IMPORT_FILE("Package must contain the referenced import file %s"),
- INVALID_IMPORT_STATEMENT("Definition file contains an invalid import statement"),
+ MISSING_DEFINITION_FILE("Definition file %s referenced in TOSCA.meta does not exist"),
+ MISSING_IMPORT_FILE("Package must contain the referenced import file %s in %s directory"),
+ INVALID_IMPORT_STATEMENT("Definition file contains an invalid import statement in %s"),
/* content errors*/
INVALID_YAML_FORMAT("Invalid YAML format - %s"),
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 9984df1ccc..6dac3c8f60 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
@@ -35,9 +35,9 @@ import org.openecomp.sdc.tosca.csar.Manifest;
import org.openecomp.sdc.tosca.csar.OnboardingToscaMetadata;
import org.openecomp.sdc.tosca.csar.ToscaMetadata;
-import static org.openecomp.sdc.tosca.csar.CSARConstants.TOSCA_META_ENTRY_CHANGE_LOG;
+import static org.openecomp.sdc.tosca.csar.CSARConstants.TOSCA_META_ETSI_ENTRY_CHANGE_LOG;
import static org.openecomp.sdc.tosca.csar.CSARConstants.TOSCA_META_ENTRY_DEFINITIONS;
-import static org.openecomp.sdc.tosca.csar.CSARConstants.TOSCA_META_ENTRY_MANIFEST;
+import static org.openecomp.sdc.tosca.csar.CSARConstants.TOSCA_META_ETSI_ENTRY_MANIFEST;
import static org.openecomp.sdc.tosca.csar.CSARConstants.TOSCA_META_ORIG_PATH_FILE_NAME;
import static org.openecomp.sdc.tosca.csar.CSARConstants.TOSCA_META_PATH_FILE_NAME;
@@ -116,8 +116,8 @@ public class ETSIServiceImpl implements ETSIService {
ToscaMetadata toscaMetadata = OnboardingToscaMetadata.parseToscaMetadataFile(metadataInputStream);
Map<String, String> metaDataEntries = toscaMetadata.getMetaEntries();
- return metaDataEntries.containsKey(TOSCA_META_ENTRY_DEFINITIONS) && metaDataEntries.containsKey(TOSCA_META_ENTRY_MANIFEST)
- && metaDataEntries.containsKey(TOSCA_META_ENTRY_CHANGE_LOG);
+ return metaDataEntries.containsKey(TOSCA_META_ENTRY_DEFINITIONS) && metaDataEntries.containsKey(TOSCA_META_ETSI_ENTRY_MANIFEST)
+ && metaDataEntries.containsKey(TOSCA_META_ETSI_ENTRY_CHANGE_LOG);
}
private boolean isMetaFilePresent(Map<String, byte[]> handler) {
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/etsi/ETSIServiceImplTest.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/etsi/ETSIServiceImplTest.java
index 2dc37f17e4..b3eaf30eb1 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/etsi/ETSIServiceImplTest.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/etsi/ETSIServiceImplTest.java
@@ -25,8 +25,8 @@ public class ETSIServiceImplTest {
"CSAR-Version: 1.0\n" +
"Created-By: Kuku\n" +
"Entry-Definitions: MainServiceTemplate.yaml\n" +
- "Entry-Manifest: MainServiceTemplate.mf\n" +
- "Entry-Change-Log: MainServiceTemplate.log";
+ "ETSI-Entry-Manifest: MainServiceTemplate.mf\n" +
+ "ETSI-Entry-Change-Log: MainServiceTemplate.log";
private String metaFile = "TOSCA-Meta-Version: 1.0\n" +
"CSAR-Version: 1.0\n" +
"Created-By: Kuku\n" +
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaSolConverterImpl.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaSolConverterImpl.java
index 78a23f43ea..46a5904299 100644
--- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaSolConverterImpl.java
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaSolConverterImpl.java
@@ -55,19 +55,21 @@ public class ToscaSolConverterImpl extends AbstractToscaConverter {
Map<String, ServiceTemplate> serviceTemplates = new HashMap<>();
FileContentHandler artifacts = new FileContentHandler();
GlobalSubstitutionServiceTemplate gsst = new GlobalSubstitutionServiceTemplate();
- String mServiceDefinitionFileName = getMainServiceDefinitionFileName(fileContentHandler);
- handleMainServiceTemplate(csarFiles, serviceTemplates, gsst, mServiceDefinitionFileName);
+ String mServiceDefinitionPath = getMainServiceDefinitionFileName(fileContentHandler);
+ handleMainServiceTemplate(csarFiles, serviceTemplates, gsst, mServiceDefinitionPath);
handleExternalArtifacts(csarFiles, serviceTemplates, artifacts);
handleMetadataFile(csarFiles);
- updateToscaServiceModel(toscaServiceModel, serviceTemplates, artifacts, gsst, csarFiles, mServiceDefinitionFileName);
+ updateToscaServiceModel(toscaServiceModel, serviceTemplates, artifacts, gsst, csarFiles, getSimpleName(mServiceDefinitionPath));
return toscaServiceModel;
}
private void handleMainServiceTemplate(Map<String, byte[]> csarFiles, Map<String, ServiceTemplate> serviceTemplates,
GlobalSubstitutionServiceTemplate gsst, String mServiceDefinitionFileName) {
- handleServiceTemplate(mServiceDefinitionFileName, mServiceDefinitionFileName, csarFiles, serviceTemplates);
- handleImportDefinitions(mServiceDefinitionFileName, csarFiles, mServiceDefinitionFileName.substring(0,
- mServiceDefinitionFileName.lastIndexOf("/")), gsst);
+ if(mServiceDefinitionFileName != null){
+ handleServiceTemplate(getSimpleName(mServiceDefinitionFileName), mServiceDefinitionFileName, csarFiles, serviceTemplates);
+ String parentDir = mServiceDefinitionFileName.substring(0, mServiceDefinitionFileName.lastIndexOf("/"));
+ handleImportDefinitions(mServiceDefinitionFileName, csarFiles, parentDir, gsst);
+ }
}
private void handleExternalArtifacts(Map<String, byte[]> csarFiles, Map<String, ServiceTemplate> serviceTemplates, FileContentHandler artifacts) {
@@ -128,4 +130,11 @@ public class ToscaSolConverterImpl extends AbstractToscaConverter {
throw new IOException(e.getMessage());
}
}
+
+ private String getSimpleName(String path){
+ if(path != null && path.contains("/")){
+ path = path.substring(path.lastIndexOf("/") + 1);
+ }
+ return path;
+ }
} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/impl/ToscaSolConverterImplTest.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/impl/ToscaSolConverterImplTest.java
index ad2e61523f..45d6332e06 100644
--- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/impl/ToscaSolConverterImplTest.java
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/impl/ToscaSolConverterImplTest.java
@@ -71,9 +71,9 @@ public class ToscaSolConverterImplTest {
Map<String, ServiceTemplate> serviceTemplateMap = toscaServiceModel.getServiceTemplates();
String entryDefinitionTemplateName = toscaServiceModel.getEntryDefinitionServiceTemplate();
Assert.assertTrue("Artifacts should contain external files", contentHandler.containsFile("Main.mf"));
- Assert.assertTrue("Main service template should exist", serviceTemplateMap.containsKey("Definitions/Main.yaml"));
+ Assert.assertTrue("Main service template should exist", serviceTemplateMap.containsKey("Main.yaml"));
Assert.assertEquals("Entry Definition name should be same as passed in TOSCA.meta",
- "Definitions/Main.yaml", entryDefinitionTemplateName);
+ "Main.yaml", entryDefinitionTemplateName);
}
@Test(expected = IOException.class)
diff --git a/openecomp-be/lib/openecomp-tosca-lib/pom.xml b/openecomp-be/lib/openecomp-tosca-lib/pom.xml
index 834e8e36b2..6b7ca2fa17 100644
--- a/openecomp-be/lib/openecomp-tosca-lib/pom.xml
+++ b/openecomp-be/lib/openecomp-tosca-lib/pom.xml
@@ -97,6 +97,12 @@
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc.be</groupId>
+ <artifactId>common-be</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
</dependencies>
<properties>
<useSystemClassLoader>false</useSystemClassLoader>
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) {
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/csar/ManifestParsingTest.java b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/csar/ManifestParsingTest.java
index 2e8a1ecbd0..b083cfad3a 100644
--- a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/csar/ManifestParsingTest.java
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/csar/ManifestParsingTest.java
@@ -18,9 +18,11 @@ package org.openecomp.sdc.tosca.csar;
import org.junit.Before;
import org.junit.Test;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.common.errors.Messages;
import java.io.IOException;
import java.io.InputStream;
+import java.util.Optional;
import static junit.framework.TestCase.assertTrue;
import static org.junit.Assert.assertEquals;
@@ -44,6 +46,10 @@ public class ManifestParsingTest {
assertTrue(manifest.isValid());
assertEquals(manifest.getMetadata().size(), 4);
assertEquals(manifest.getSources().size(), 5);
+ Optional<ResourceTypeEnum> resourceTypeEnum = manifest.getType();
+ if(resourceTypeEnum.isPresent()){
+ assertTrue(resourceTypeEnum.get() == ResourceTypeEnum.VF);
+ }
}
}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/csar/MetadataParsingTest.java b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/csar/MetadataParsingTest.java
index 5e32820bc3..4519ee7bd3 100644
--- a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/csar/MetadataParsingTest.java
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/csar/MetadataParsingTest.java
@@ -4,9 +4,9 @@ package org.openecomp.sdc.tosca.csar;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
-import static org.openecomp.sdc.tosca.csar.CSARConstants.TOSCA_META_ENTRY_CHANGE_LOG;
+import static org.openecomp.sdc.tosca.csar.CSARConstants.TOSCA_META_ETSI_ENTRY_CHANGE_LOG;
import static org.openecomp.sdc.tosca.csar.CSARConstants.TOSCA_META_ENTRY_DEFINITIONS;
-import static org.openecomp.sdc.tosca.csar.CSARConstants.TOSCA_META_ENTRY_MANIFEST;
+import static org.openecomp.sdc.tosca.csar.CSARConstants.TOSCA_META_ETSI_ENTRY_MANIFEST;
import java.io.IOException;
import java.io.InputStream;
@@ -61,8 +61,8 @@ public class MetadataParsingTest {
.getResourceAsStream("/vspmanager.csar/metadata/ValidETSItosca.meta")) {
ToscaMetadata onboardingToscaMetadata = OnboardingToscaMetadata.parseToscaMetadataFile(is);
assertEquals(onboardingToscaMetadata.getMetaEntries().get(TOSCA_META_ENTRY_DEFINITIONS), "Definitions/MainServiceTemplate.yaml");
- assertEquals(onboardingToscaMetadata.getMetaEntries().get(TOSCA_META_ENTRY_MANIFEST), "MainServiceTemplate.mf");
- assertEquals(onboardingToscaMetadata.getMetaEntries().get(TOSCA_META_ENTRY_CHANGE_LOG), "change.log");
+ assertEquals(onboardingToscaMetadata.getMetaEntries().get(TOSCA_META_ETSI_ENTRY_MANIFEST), "MainServiceTemplate.mf");
+ assertEquals(onboardingToscaMetadata.getMetaEntries().get(TOSCA_META_ETSI_ENTRY_CHANGE_LOG), "change.log");
}
}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/metadata/ValidETSItosca.meta b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/metadata/ValidETSItosca.meta
index 0d74a150b1..8a51a625f2 100644
--- a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/metadata/ValidETSItosca.meta
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/metadata/ValidETSItosca.meta
@@ -2,5 +2,5 @@ TOSCA-Meta-File-Version: 1.0
CSAR-Version: 1.1
Created-By: Sergey Sachkov
Entry-Definitions: Definitions/MainServiceTemplate.yaml
-Entry-Manifest: MainServiceTemplate.mf
-Entry-Change-Log: change.log
+ETSI-Entry-Manifest: MainServiceTemplate.mf
+ETSI-Entry-Change-Log: change.log