aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkooper <sergey.sachkov@est.tech>2019-03-04 13:47:51 +0000
committerkooper <sergey.sachkov@est.tech>2019-03-04 13:47:51 +0000
commit11e9d33f2f50ad3990905fba184b7c10d255070a (patch)
tree32e1a0ba3d5da03a41202e9bf28c28f099601972
parent7deb4e0e5f6cf06b7fbb27c6bda4e91f847f4075 (diff)
Add manifest non mano set support
Issue-ID: SDC-2141 Change-Id: I056e8f7c1da8f17ce8583207660882f85a4d11a4 Signed-off-by: kooper <sergey.sachkov@est.tech>
-rw-r--r--catalog-be/src/test/resources/config/mock.txt0
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java15
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateCSARHandler.java11
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/OnboardingManifest.java171
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/OnboardingToscaMetadata.java4
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/resources/nonManoConfig.yaml19
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java2
-rw-r--r--openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/Messages.java1
-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.java42
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/pom.xml5
-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/Configuration.java10
-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.java115
-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/NonManoType.java29
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/resources/nonManoConfig.yaml19
-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.java133
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/resources/nonManoConfig.yaml7
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/CSARConstants.java (renamed from openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/CSARConstants.java)6
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/Manifest.java56
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/OnboardingManifest.java234
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/csar/ManifestParsingTest.java (renamed from openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/csar/ManifestParsingTest.java)58
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InValidNonManoTosca.mf36
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTocsaNonManoGarbadgeAtEnd.mf34
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTosca1.mf (renamed from openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca1.mf)0
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTosca2.mf (renamed from openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca2.mf)0
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTosca3.mf (renamed from openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca3.mf)0
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTosca4.mf (renamed from openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca4.mf)0
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/ValidNonManoTosca.mf33
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/ValidTosca.mf (renamed from openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/ValidTosca.mf)0
28 files changed, 849 insertions, 191 deletions
diff --git a/catalog-be/src/test/resources/config/mock.txt b/catalog-be/src/test/resources/config/mock.txt
deleted file mode 100644
index e69de29bb2..0000000000
--- a/catalog-be/src/test/resources/config/mock.txt
+++ /dev/null
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java
index 275aee646b..19d06ed493 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java
@@ -19,6 +19,7 @@ package org.openecomp.sdc.vendorsoftwareproduct.impl;
import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductInvalidErrorBuilder.candidateDataNotProcessedOrAbortedErrorBuilder;
import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductInvalidErrorBuilder.invalidProcessedCandidate;
import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductInvalidErrorBuilder.vspMissingDeploymentFlavorErrorBuilder;
+import static org.openecomp.sdc.tosca.csar.CSARConstants.MAIN_SERVICE_TEMPLATE_MF_FILE_NAME;
import java.io.BufferedOutputStream;
import java.io.ByteArrayInputStream;
@@ -106,8 +107,12 @@ import org.openecomp.sdc.vendorsoftwareproduct.errors.PackageInvalidErrorBuilder
import org.openecomp.sdc.vendorsoftwareproduct.errors.PackageNotFoundErrorBuilder;
import org.openecomp.sdc.vendorsoftwareproduct.errors.TranslationFileCreationErrorBuilder;
import org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductInvalidErrorBuilder;
+import org.openecomp.sdc.tosca.csar.Manifest;
+import org.openecomp.sdc.tosca.csar.OnboardingManifest;
import org.openecomp.sdc.vendorsoftwareproduct.informationArtifact.InformationArtifactGenerator;
+import org.openecomp.sdc.vendorsoftwareproduct.services.impl.etsi.ETSIService;
import org.openecomp.sdc.vendorsoftwareproduct.services.filedatastructuremodule.CandidateService;
+import org.openecomp.sdc.vendorsoftwareproduct.services.impl.etsi.ETSIServiceImpl;
import org.openecomp.sdc.vendorsoftwareproduct.services.schemagenerator.SchemaGenerator;
import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireValidationResult;
@@ -655,7 +660,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
}
@Override
- public PackageInfo createPackage(String vspId, Version version) {
+ public PackageInfo createPackage(String vspId, Version version) throws IOException {
ToscaServiceModel toscaServiceModel = enrichedServiceModelDao.getServiceModel(vspId, version);
VspDetails vspDetails = vspInfoDao.get(new VspDetails(vspId, version));
Version vlmVersion = vspDetails.getVlmVersion();
@@ -669,7 +674,13 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
FileContentHandler licenseArtifacts = licenseArtifactsService
.createLicenseArtifacts(vspDetails.getId(), vspDetails.getVendorId(), vlmVersion,
vspDetails.getFeatureGroups());
- //todo add tosca validation here
+ ETSIService etsiService = new ETSIServiceImpl();
+ if(etsiService.isSol004WithToscaMetaDirectory(toscaServiceModel.getArtifactFiles())){
+ FileContentHandler handler = toscaServiceModel.getArtifactFiles();
+ Manifest onboardingManifest = OnboardingManifest.parse(handler.getFileContent(MAIN_SERVICE_TEMPLATE_MF_FILE_NAME));
+ etsiService.moveNonManoFileToArtifactFolder(handler, onboardingManifest);
+
+ }
packageInfo.setTranslatedFile(ByteBuffer.wrap(
toscaServiceTemplateServiceCsar.createOutputFile(toscaServiceModel, licenseArtifacts)));
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateCSARHandler.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateCSARHandler.java
index 4047937059..bfe602b3ad 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateCSARHandler.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateCSARHandler.java
@@ -31,7 +31,8 @@ import org.openecomp.sdc.datatypes.error.ErrorLevel;
import org.openecomp.sdc.datatypes.error.ErrorMessage;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateCandidateData;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
-import org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.OnboardingManifest;
+import org.openecomp.sdc.tosca.csar.Manifest;
+import org.openecomp.sdc.tosca.csar.OnboardingManifest;
import org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.OnboardingToscaMetadata;
import org.openecomp.sdc.vendorsoftwareproduct.services.filedatastructuremodule.CandidateService;
import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse;
@@ -45,7 +46,11 @@ import java.util.Optional;
import java.util.stream.Collectors;
import static org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder.getErrorWithParameters;
-import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.CSARConstants.*;
+import static org.openecomp.sdc.tosca.csar.CSARConstants.ELIGBLE_FOLDERS;
+import static org.openecomp.sdc.tosca.csar.CSARConstants.ELIGIBLE_FILES;
+import static org.openecomp.sdc.tosca.csar.CSARConstants.MAIN_SERVICE_TEMPLATE_MF_FILE_NAME;
+import static org.openecomp.sdc.tosca.csar.CSARConstants.MAIN_SERVICE_TEMPLATE_YAML_FILE_NAME;
+import static org.openecomp.sdc.tosca.csar.CSARConstants.TOSCA_META_PATH_FILE_NAME;
public class OrchestrationTemplateCSARHandler extends BaseOrchestrationTemplateHandler
implements OrchestrationTemplateFileHandler {
@@ -114,7 +119,7 @@ public class OrchestrationTemplateCSARHandler extends BaseOrchestrationTemplateH
try (InputStream fileContent = contentMap.getFileContent(MAIN_SERVICE_TEMPLATE_MF_FILE_NAME)) {
- OnboardingManifest onboardingManifest = new OnboardingManifest(fileContent);
+ Manifest onboardingManifest = OnboardingManifest.parse(fileContent);
if (!onboardingManifest.isValid()) {
onboardingManifest.getErrors().forEach(error -> uploadFileResponse.addStructureError(
SdcCommon.UPLOAD_FILE, new ErrorMessage(ErrorLevel.ERROR, error)));
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/OnboardingManifest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/OnboardingManifest.java
deleted file mode 100644
index fd3d3c43f2..0000000000
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/OnboardingManifest.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright © 2016-2017 European Support Limited
- *
- * 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.
- */
-
-package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import org.apache.commons.lang.StringUtils;
-import org.openecomp.sdc.common.errors.Messages;
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
-
-import java.io.*;
-import java.nio.charset.StandardCharsets;
-import java.util.*;
-
-import static org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder.getErrorWithParameters;
-import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.CSARConstants.*;
-
-public class OnboardingManifest {
- private static final Logger LOGGER = LoggerFactory.getLogger(OnboardingManifest.class);
- private Map<String, String> metadata;
- private List<String> sources;
- private List<String> errors;
- private State state;
- private enum State {
- START, PROCESS_METADATA, PROCESS_SOURCES, ERROR
- }
-
- public OnboardingManifest(InputStream is) {
- errors = new ArrayList<>();
- sources = new ArrayList<>();
- metadata = new HashMap<>();
- parseManifest(is);
- }
-
- private void parseManifest(InputStream is) {
- try {
- ImmutableList<String> lines = readAllLines(is);
- state = State.START;
-
- for (String line : lines) {
- line = line.trim();
- if (!StringUtils.isEmpty(line.trim())) {
- state = processLine(state, line);
- }
- }
- if (errors.isEmpty()) {
- if (metadata.isEmpty()) {
- errors.add(Messages.MANIFEST_NO_METADATA.getErrorMessage());
- }
- if (sources.isEmpty()) {
- errors.add(Messages.MANIFEST_NO_SOURCES.getErrorMessage());
- }
- }
- } catch (IOException e){
- LOGGER.error(e.getMessage(),e);
- errors.add(Messages.MANIFEST_PARSER_INTERNAL.getErrorMessage());
- }
- }
-
- private State processLine(State state, String line) {
- State newState = state;
- switch (state) {
- case START:
- newState = startProcessLine(state, line);
- break;
- case PROCESS_METADATA:
- newState = processMetaData(state, line);
- break;
- case PROCESS_SOURCES:
- processSourceLine(line);
-
- break;
- case ERROR:
- break;
- default:
- }
- return newState;
- }
-
- private State startProcessLine(State state, String line) {
- State newState = state;
- if (line.trim().equals(METADATA_MF_ATTRIBUTE + SEPERATOR_MF_ATTRIBUTE)) {
- newState = State.PROCESS_METADATA;
- } else {
- reportError(line);
- }
- return newState;
- }
-
- private State processMetaData(State state, String line) {
- State newState = state;
- String[] metaSplit = line.split(SEPERATOR_MF_ATTRIBUTE);
- if (metaSplit.length < 2){
- reportError(line);
- return state;
- }
- if (!metaSplit[0].equals(SOURCE_MF_ATTRIBUTE)){
- String value = line.replace(metaSplit[0] + SEPERATOR_MF_ATTRIBUTE, "").trim();
- metadata.put(metaSplit[0],value);
- } else {
- newState = State.PROCESS_SOURCES;
- processSourceLine(line);
- }
- return newState;
- }
-
- private void processSourceLine(String line) {
- if (line.startsWith(SOURCE_MF_ATTRIBUTE+SEPERATOR_MF_ATTRIBUTE)){
- String value = line.replaceAll(SOURCE_MF_ATTRIBUTE + SEPERATOR_MF_ATTRIBUTE, "").trim();
- sources.add(value);
- }else {
- reportError(line);
- }
- }
-
- private void reportError(String line) {
- errors.add(getErrorWithParameters(Messages.MANIFEST_INVALID_LINE.getErrorMessage(), line));
- state = State.ERROR;
- }
-
- private ImmutableList<String> readAllLines(InputStream is) throws IOException {
- ImmutableList.Builder<String> builder = ImmutableList.<String> builder();
- try (Reader reader = new InputStreamReader(is, StandardCharsets.UTF_8.newDecoder());
- BufferedReader bufferedReader = new BufferedReader(reader);) {
- for (; ; ) {
- String line = bufferedReader.readLine();
- if (line == null)
- break;
- builder.add(line);
- }
- }
- return builder.build();
- }
-
- public Map<String, String> getMetadata() {
- if (!isValid()){
- return Collections.emptyMap();
- }
- return ImmutableMap.copyOf(metadata);
- }
-
- public List<String> getSources() {
- if (!isValid()){
- return Collections.emptyList();
- }
- return ImmutableList.copyOf(sources);
- }
-
- public List<String> getErrors() {
- return ImmutableList.copyOf(errors);
- }
-
- public boolean isValid() {
- return errors.isEmpty();
- }
-}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/OnboardingToscaMetadata.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/OnboardingToscaMetadata.java
index 037e76aa16..6f06289d96 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/OnboardingToscaMetadata.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/OnboardingToscaMetadata.java
@@ -27,8 +27,8 @@ import java.io.IOException;
import org.apache.commons.io.IOUtils;
import java.util.List;
-import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.CSARConstants.TOSCA_META_ENTRY_DEFINITIONS;
-import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.CSARConstants.SEPERATOR_MF_ATTRIBUTE;
+import static org.openecomp.sdc.tosca.csar.CSARConstants.TOSCA_META_ENTRY_DEFINITIONS;
+import static org.openecomp.sdc.tosca.csar.CSARConstants.SEPERATOR_MF_ATTRIBUTE;
public class OnboardingToscaMetadata {
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/resources/nonManoConfig.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/resources/nonManoConfig.yaml
new file mode 100644
index 0000000000..b7e4b5b502
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/resources/nonManoConfig.yaml
@@ -0,0 +1,19 @@
+nonManoKeyFolderMapping:
+ onap_ves_events:
+ location: VES_EVENTS
+ type: Deployment
+ onap_pm_dictionary:
+ location: PM_DICTIONARY
+ type: Deployment
+ onap_yang_modules:
+ location: YANG_MODULES
+ type: Deployment
+ onap_ansible_playbooks:
+ location: ANSIBLE_PLAYBOOK
+ type: Deployment
+ onap_scripts:
+ location: SCRIPTS
+ type: Deployment
+ onap_others:
+ location: OTHER
+ type: Informational \ No newline at end of file
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java
index a858e18aea..6e9d1ea83c 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java
@@ -409,7 +409,7 @@ public class VendorSoftwareProductManagerImplTest {
}
@Test
- public void testCreatePackage() {
+ public void testCreatePackage() throws IOException {
/*VspDetails vspDetailsMock = new VspDetails("vspId", new Version(1, 0));
doReturn(vspDetailsMock).when(vspInfoDaoMock).get(anyObject());*/
VersionInfo versionInfo = new VersionInfo();
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 f1f84231cd..adb8c5ff98 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
@@ -32,6 +32,7 @@ public enum Messages {
MANIFEST_INVALID_LINE("Manifest contains invalid line : %s"),
MANIFEST_NO_METADATA("Manifest must contain metadata"),
MANIFEST_NO_SOURCES("Manifest must contain Source"),
+ MANIFEST_EMPTY("Manifest must contain data"),
MANIFEST_PARSER_INTERNAL("Invalid manifest file"),
METADATA_PARSER_INTERNAL("Invalid Metadata file"),
METADATA_NO_ENTRY_DEFINITIONS("TOSCA.meta must contain Entry Definitions"),
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
new file mode 100644
index 0000000000..69ce97efc5
--- /dev/null
+++ 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
@@ -0,0 +1,42 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019, Nordix Foundation. 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.vendorsoftwareproduct.services.impl.etsi;
+
+import org.openecomp.core.utilities.file.FileContentHandler;
+import org.openecomp.sdc.tosca.csar.Manifest;
+
+
+public interface ETSIService {
+ /**
+ * Checks package structure is CSAR with TOSCA-Metadata directory according to SOL004 v2.5.1
+ * and contains mandatory Entries in Tosca.meta
+ * @param handler contains csar artifacts
+ * @return true if all condition matched, false otherwise
+ */
+ boolean isSol004WithToscaMetaDirectory(FileContentHandler handler);
+
+ /**
+ * Update file structure. Moves non mano files to Artifacts/Deployment/non mano key location
+ * @param handler
+ * @param manifest
+ */
+ void moveNonManoFileToArtifactFolder(FileContentHandler handler, Manifest manifest);
+}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/pom.xml b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/pom.xml
index 450acd6583..08e8a0881a 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/pom.xml
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/pom.xml
@@ -112,6 +112,11 @@
<artifactId>openecomp-sdc-vendor-license-api</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
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/Configuration.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/Configuration.java
new file mode 100644
index 0000000000..e2f9a4efaf
--- /dev/null
+++ 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/Configuration.java
@@ -0,0 +1,10 @@
+package org.openecomp.sdc.vendorsoftwareproduct.services.impl.etsi;
+
+import java.util.Map;
+
+import lombok.Data;
+
+@Data
+public class Configuration {
+ private Map<String, NonManoType> nonManoKeyFolderMapping;
+}
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
new file mode 100644
index 0000000000..b3002abf6e
--- /dev/null
+++ 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
@@ -0,0 +1,115 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019, Nordix Foundation. 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.vendorsoftwareproduct.services.impl.etsi;
+
+import org.apache.commons.io.IOUtils;
+import org.onap.sdc.tosca.parser.utils.YamlToObjectConverter;
+import org.openecomp.core.utilities.file.FileContentHandler;
+
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+import org.openecomp.sdc.tosca.csar.Manifest;
+
+import static org.openecomp.sdc.tosca.csar.CSARConstants.*;
+
+public class ETSIServiceImpl implements ETSIService {
+
+ private Configuration configuration;
+
+ public ETSIServiceImpl() throws IOException {
+ InputStream io = getClass().getClassLoader().getResourceAsStream("nonManoConfig.yaml");
+ if(io == null){
+ throw new IOException("Non Mano configuration not found");
+ }
+ String data = IOUtils.toString(io, StandardCharsets.UTF_8);
+ YamlToObjectConverter yamlToObjectConverter = new YamlToObjectConverter();
+ configuration = yamlToObjectConverter.convertFromString(data, Configuration.class);
+ }
+
+ public ETSIServiceImpl(Configuration configuration) {
+ this.configuration = configuration;
+ }
+
+ @Override
+ public boolean isSol004WithToscaMetaDirectory(FileContentHandler handler) {
+ Map<String, byte[]> templates = handler.getFiles();
+ return isMetaFilePresent(templates) && hasMetaMandatoryEntries(templates);
+ }
+
+ @Override
+ public void moveNonManoFileToArtifactFolder(FileContentHandler handler, Manifest manifest) {
+ for (Map.Entry<String, List<String>> entry : manifest.getNonManoSources().entrySet()) {
+ String e = entry.getKey();
+ List<String> k = entry.getValue();
+ updateNonManoLocation(handler, e, k);
+ }
+ }
+
+ private void updateNonManoLocation(FileContentHandler handler, String nonManoKey, List<String> sources) {
+ Map<String, byte[]> files = handler.getFiles();
+ for (String key : sources) {
+ if (files.containsKey(key)) {
+ updateLocation(key, nonManoKey, files);
+ }
+ }
+ }
+
+ private void updateLocation(String key, String nonManoKey, Map<String, byte[]> files){
+ if (nonManoKey == null || nonManoKey.isEmpty()) {
+ return;
+ }
+ Map<String, NonManoType> map = configuration.getNonManoKeyFolderMapping();
+ if (map.containsKey(nonManoKey)) {
+ NonManoType nonManoPair = map.get(nonManoKey);
+ String newLocation = nonManoPair.getType() + "/" +
+ nonManoPair.getLocation() + "/" + getFileName(key);
+ if (!files.containsKey(newLocation)) {
+ files.put(newLocation, files.remove(key));
+ }
+ }
+ }
+
+
+ private String getFileName(String key) {
+ return key.substring(key.lastIndexOf('/') + 1);
+ }
+
+ private boolean hasMetaMandatoryEntries(Map<String, byte[]> templates) {
+ Optional<byte[]> meta = templates.entrySet().stream().filter(e -> e.getKey().equals(TOSCA_META_PATH_FILE_NAME)
+ || e.getKey().equals(TOSCA_META_ORIG_PATH_FILE_NAME)).findFirst().map(Map.Entry::getValue);
+ if (!meta.isPresent()) {
+ return false;
+ }
+ String metaContent = new String(meta.get(), StandardCharsets.UTF_8);
+ return metaContent.contains(TOSCA_META_ENTRY_DEFINITIONS) && metaContent.contains(TOSCA_META_ENTRY_MANIFEST)
+ && metaContent.contains(TOSCA_META_ENTRY_CHANGE_LOG);
+ }
+
+ private boolean isMetaFilePresent(Map<String, byte[]> handler) {
+ return handler.containsKey(TOSCA_META_PATH_FILE_NAME) || handler.containsKey(TOSCA_META_ORIG_PATH_FILE_NAME);
+ }
+}
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/NonManoType.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/NonManoType.java
new file mode 100644
index 0000000000..e10c102593
--- /dev/null
+++ 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/NonManoType.java
@@ -0,0 +1,29 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019, Nordix Foundation. 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.vendorsoftwareproduct.services.impl.etsi;
+
+
+import lombok.Data;
+
+@Data
+public class NonManoType {
+ private String location;
+ private String type;
+}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/resources/nonManoConfig.yaml b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/resources/nonManoConfig.yaml
new file mode 100644
index 0000000000..c444e66c48
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/resources/nonManoConfig.yaml
@@ -0,0 +1,19 @@
+nonManoKeyFolderMapping:
+ onap_ves_events:
+ location: VES_EVENTS
+ type: Deployment
+ onap_pm_dictionary:
+ location: PM_DICTIONARY
+ type: Deployment
+ onap_yang_modules:
+ location: YANG_MODULES
+ type: Deployment
+ onap_ansible_playbooks:
+ location: ANSIBLE_PLAYBOOK
+ type: Deployment
+ onap_scripts:
+ location: SCRIPTS
+ type: Deployment
+ onap_others:
+ location: OTHER
+ type: Informational \ No newline at end of file
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
new file mode 100644
index 0000000000..ae69415f1d
--- /dev/null
+++ 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
@@ -0,0 +1,133 @@
+package org.openecomp.sdc.vendorsoftwareproduct.services.impl.etsi;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.sdc.tosca.parser.utils.YamlToObjectConverter;
+import org.openecomp.core.utilities.file.FileContentHandler;
+import org.openecomp.sdc.tosca.csar.Manifest;
+
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+public class ETSIServiceImplTest {
+ private ETSIService etsiService;
+ private String sol004MetaFile = "TOSCA-Meta-Version: 1.0\n" +
+ "CSAR-Version: 1.0\n" +
+ "Created-By: Kuku\n" +
+ "Entry-Definitions: MainServiceTemplate.yaml\n" +
+ "Entry-Manifest: MainServiceTemplate.mf\n" +
+ "Entry-Change-Log: MainServiceTemplate.log";
+ private String metaFile = "TOSCA-Meta-Version: 1.0\n" +
+ "CSAR-Version: 1.0\n" +
+ "Created-By: Kuku\n" +
+ "Entry-Definitions: MainServiceTemplate.yaml";
+
+ private String finalNonManoLocation = "Deployment/VES_EVENTS/test.xml";
+ private String finalOtherNonManoLocation = "Informational/OTHER/test.xml";
+
+ @Before
+ public void setUp() throws IOException {
+ YamlToObjectConverter yamlToObjectConverter = new YamlToObjectConverter();
+ Configuration configuration = yamlToObjectConverter.convert("src/test/resources",
+ Configuration.class, "nonManoConfig.yaml");
+ etsiService = new ETSIServiceImpl(configuration);
+ }
+
+ @After
+ public void tearDown() {
+ etsiService = null;
+ }
+
+ @Test
+ public void testIsSol004TrueOrigin() {
+ FileContentHandler fileContentHandler = new FileContentHandler();
+ fileContentHandler.addFile("TOSCA-Metadata/TOSCA.meta.original", sol004MetaFile.getBytes(StandardCharsets.UTF_8));
+ assertTrue(etsiService.isSol004WithToscaMetaDirectory(fileContentHandler));
+ }
+
+ @Test
+ public void testIsSol004True() {
+ FileContentHandler fileContentHandler = new FileContentHandler();
+ fileContentHandler.addFile("TOSCA-Metadata/TOSCA.meta", sol004MetaFile.getBytes(StandardCharsets.UTF_8));
+ assertTrue(etsiService.isSol004WithToscaMetaDirectory(fileContentHandler));
+ }
+
+ @Test
+ public void testIsSol004False() {
+ FileContentHandler fileContentHandler = new FileContentHandler();
+ fileContentHandler.addFile("TOSCA-Metadata/TOSCA.meta.original", metaFile.getBytes(StandardCharsets.UTF_8));
+ assertFalse(etsiService.isSol004WithToscaMetaDirectory(fileContentHandler));
+ }
+
+ @Test
+ public void testIsSol004FalseWithNull() {
+ FileContentHandler fileContentHandler = new FileContentHandler();
+ assertFalse(etsiService.isSol004WithToscaMetaDirectory(fileContentHandler));
+ }
+
+ @Test
+ public void testMoveNonManoFileToArtifactFolder() throws IOException {
+ Map<String, List<String>> nonManoSources = new HashMap<>();
+ List<String> sources = new ArrayList<>();
+ sources.add("Some/test.xml");
+ nonManoSources.put("Some", sources);
+ FileContentHandler fileContentHandler = new FileContentHandler();
+ fileContentHandler.addFile("Some/test.xml", new byte[1]);
+ Manifest manifest = mock(Manifest.class);
+ when(manifest.getNonManoSources()).thenReturn(nonManoSources);
+ etsiService.moveNonManoFileToArtifactFolder(fileContentHandler, manifest);
+ assertTrue(fileContentHandler.containsFile(finalNonManoLocation));
+ }
+
+ @Test
+ public void testMoveNonManoFileToArtifactFolderFileNotInFolder() throws IOException {
+ Map<String, List<String>> nonManoSources = new HashMap<>();
+ List<String> sources = new ArrayList<>();
+ sources.add("test.xml");
+ nonManoSources.put("foo", sources);
+ FileContentHandler fileContentHandler = new FileContentHandler();
+ fileContentHandler.addFile("test.xml", new byte[1]);
+ Manifest manifest = mock(Manifest.class);
+ when(manifest.getNonManoSources()).thenReturn(nonManoSources);
+ etsiService.moveNonManoFileToArtifactFolder(fileContentHandler, manifest);
+ assertFalse(fileContentHandler.containsFile(finalOtherNonManoLocation));
+ }
+
+ @Test
+ public void testMoveNonManoFileToArtifactFolderNoMove() throws IOException {
+ Map<String, List<String>> nonManoSources = new HashMap<>();
+ List<String> sources = new ArrayList<>();
+ sources.add(finalNonManoLocation);
+ nonManoSources.put("Some", sources);
+ FileContentHandler fileContentHandler = new FileContentHandler();
+ fileContentHandler.addFile(finalNonManoLocation, new byte[1]);
+ Manifest manifest = mock(Manifest.class);
+ when(manifest.getNonManoSources()).thenReturn(nonManoSources);
+ etsiService.moveNonManoFileToArtifactFolder(fileContentHandler, manifest);
+ assertTrue(fileContentHandler.containsFile(finalNonManoLocation));
+ }
+
+ @Test
+ public void testMoveNonManoFileToArtifactFolderMoveToKeyFolder() throws IOException {
+ Map<String, List<String>> nonManoSources = new HashMap<>();
+ List<String> sources = new ArrayList<>();
+ sources.add("Artifacts/Deployment/test.xml");
+ nonManoSources.put("Some", sources);
+ FileContentHandler fileContentHandler = new FileContentHandler();
+ fileContentHandler.addFile("Artifacts/Deployment/test.xml", new byte[1]);
+ Manifest manifest = mock(Manifest.class);
+ when(manifest.getNonManoSources()).thenReturn(nonManoSources);
+ etsiService.moveNonManoFileToArtifactFolder(fileContentHandler, manifest);
+ assertTrue(fileContentHandler.containsFile(finalNonManoLocation));
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/resources/nonManoConfig.yaml b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/resources/nonManoConfig.yaml
new file mode 100644
index 0000000000..32c6b1ce57
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/resources/nonManoConfig.yaml
@@ -0,0 +1,7 @@
+nonManoKeyFolderMapping:
+ Some:
+ location: VES_EVENTS
+ type: Deployment
+ Other:
+ location: VES_EVENTS
+ type: Informational \ No newline at end of file
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/CSARConstants.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/CSARConstants.java
index ee81527a18..94786fe0df 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/CSARConstants.java
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/CSARConstants.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar;
+package org.openecomp.sdc.tosca.csar;
import com.google.common.collect.ImmutableSet;
@@ -28,12 +28,16 @@ public class CSARConstants {
public static final String MAIN_SERVICE_TEMPLATE_YAML_FILE_NAME = "MainServiceTemplate.yaml";
public static final String TOSCA_META_PATH_FILE_NAME="TOSCA-Metadata/TOSCA.meta";
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 ImmutableSet<String> ELIGIBLE_FILES =
of(MAIN_SERVICE_TEMPLATE_MF_FILE_NAME,MAIN_SERVICE_TEMPLATE_YAML_FILE_NAME);
public static final String METADATA_MF_ATTRIBUTE = "metadata";
public static final String SOURCE_MF_ATTRIBUTE = "Source";
public static final String SEPERATOR_MF_ATTRIBUTE = ":";
+ public static final String NON_MANO_MF_ATTRIBUTE = "non_mano_artifact_sets";
+ public static final String TOSCA_META_ORIG_PATH_FILE_NAME="TOSCA-Metadata/TOSCA.meta.original";
private CSARConstants() {
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
new file mode 100644
index 0000000000..2aac3a7be5
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/Manifest.java
@@ -0,0 +1,56 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019, Nordix Foundation. 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.tosca.csar;
+
+import java.util.List;
+import java.util.Map;
+
+public interface Manifest {
+ /**
+ * Returns if manifest is valid
+ * @return true/false
+ */
+ boolean isValid();
+
+ /**
+ * Metadata section of manifest
+ * @return
+ */
+ Map<String, String> getMetadata();
+
+ /**
+ * Source section of manifest
+ * @return
+ */
+ List<String> getSources();
+
+ /**
+ * Validation errors of manifest
+ * @return
+ */
+ List<String> getErrors();
+
+ /**
+ * non mano section of manifest sol004 #4.3.7
+ * @return
+ */
+ Map<String, List<String>> getNonManoSources();
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/OnboardingManifest.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/OnboardingManifest.java
new file mode 100644
index 0000000000..8858128b38
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/OnboardingManifest.java
@@ -0,0 +1,234 @@
+/*
+ * Copyright © 2016-2017 European Support Limited
+ *
+ * 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.
+ */
+
+package org.openecomp.sdc.tosca.csar;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import org.openecomp.sdc.common.errors.Messages;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import static org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder.getErrorWithParameters;
+import static org.openecomp.sdc.tosca.csar.CSARConstants.METADATA_MF_ATTRIBUTE;
+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 OnboardingManifest implements Manifest{
+ private static final Logger LOGGER = LoggerFactory.getLogger(OnboardingManifest.class);
+ private Map<String, String> metadata;
+ private List<String> sources;
+ private List<String> errors;
+ private Map<String, List<String>> nonManoSources;
+
+ private OnboardingManifest() {
+ errors = new ArrayList<>();
+ sources = new ArrayList<>();
+ metadata = new HashMap<>();
+ nonManoSources = new HashMap<>();
+ }
+
+ /**
+ * This Method will parse manifest, extracting fields mandatory/non-mandatory,
+ * if error occurred it's recorded and will be used for deciding if manifest is valid
+ * @param is manifest file input stream
+ * @return Manifest object
+ */
+ public static Manifest parse(InputStream is) {
+ OnboardingManifest manifest = new OnboardingManifest();
+ try {
+ ImmutableList<String> lines = manifest.readAllLines(is);
+ manifest.processManifest(lines);
+ } catch (IOException e){
+ LOGGER.error(e.getMessage(),e);
+ manifest.errors.add(Messages.MANIFEST_PARSER_INTERNAL.getErrorMessage());
+ }
+ return manifest;
+ }
+
+ private void processManifest(ImmutableList<String> lines) {
+ if(lines == null || lines.isEmpty()){
+ errors.add(Messages.MANIFEST_EMPTY.getErrorMessage());
+ return;
+ }
+ Iterator<String> iterator = lines.iterator();
+ //SOL004 #4.3.2: The manifest file shall start with the package metadata
+ String line = iterator.next();
+ if(!line.trim().equals(METADATA_MF_ATTRIBUTE + SEPERATOR_MF_ATTRIBUTE)){
+ reportError(line);
+ return;
+ }
+ //handle metadata
+ processMetadata(iterator);
+
+ if (errors.isEmpty()) {
+ if (metadata.isEmpty()) {
+ errors.add(Messages.MANIFEST_NO_METADATA.getErrorMessage());
+ }
+ if (sources.isEmpty()) {
+ errors.add(Messages.MANIFEST_NO_SOURCES.getErrorMessage());
+ }
+ }
+ }
+
+ private void processSourcesAndNonManoSources(Iterator<String> iterator, String prevLine) {
+ if(prevLine.isEmpty()){
+ if(iterator.hasNext()){
+ processSourcesAndNonManoSources(iterator, iterator.next());
+ }
+ }else if(prevLine.startsWith(SOURCE_MF_ATTRIBUTE+SEPERATOR_MF_ATTRIBUTE)){
+ processSource(iterator, prevLine);
+ } else if(prevLine.startsWith(NON_MANO_MF_ATTRIBUTE+SEPERATOR_MF_ATTRIBUTE)){
+ //non mano should be the last bit in manifest file,
+ // all sources after non mano will be placed to the last non mano
+ // key, if any other structure met error reported
+ processNonManoInputs(iterator, iterator.next());
+ }else{
+ reportError(prevLine);
+ }
+ }
+
+ private void processSource(Iterator<String> iterator, String prevLine) {
+ String value = prevLine.substring((SOURCE_MF_ATTRIBUTE + SEPERATOR_MF_ATTRIBUTE).length()).trim();
+ sources.add(value);
+ if(iterator.hasNext()) {
+ processSourcesAndNonManoSources(iterator, iterator.next());
+ }
+ }
+
+ private void processMetadata(Iterator<String> iterator) {
+ if(!iterator.hasNext()){
+ return;
+ }
+ String line = iterator.next();
+ if(line.isEmpty()){
+ processMetadata(iterator);
+ return;
+ }
+ String[] metaSplit = line.split(SEPERATOR_MF_ATTRIBUTE);
+ if (metaSplit.length < 2){
+ return;
+ }
+ if (!metaSplit[0].equals(SOURCE_MF_ATTRIBUTE) && !metaSplit[0].equals(NON_MANO_MF_ATTRIBUTE)){
+ String value = line.substring((metaSplit[0] + SEPERATOR_MF_ATTRIBUTE).length()).trim();
+ metadata.put(metaSplit[0],value);
+ processMetadata(iterator);
+ }
+ else {
+ processSourcesAndNonManoSources(iterator, line);
+ }
+ }
+
+ private void processNonManoInputs(Iterator<String> iterator, String prevLine) {
+ //Non Mano input should always start with key, if no key available report an error
+ if(prevLine.trim().equals(SOURCE_MF_ATTRIBUTE + SEPERATOR_MF_ATTRIBUTE)){
+ reportError(prevLine);
+ return;
+ }
+ //key should contain : separator
+ if(!prevLine.contains(SEPERATOR_MF_ATTRIBUTE)){
+ reportError(prevLine);
+ return;
+ }
+ //key shouldn't have value in the same line
+ String[] metaSplit = prevLine.trim().split(SEPERATOR_MF_ATTRIBUTE);
+ if (metaSplit.length > 1){
+ reportError(prevLine);
+ return;
+ }
+ int index = prevLine.indexOf(':');
+ if(index > 0){
+ prevLine = prevLine.substring(0, index);
+ }
+ processNonManoSource(iterator, prevLine, new ArrayList<>());
+
+ }
+
+ private void processNonManoSource(Iterator<String> iterator, String key, List<String> sources) {
+ if(!iterator.hasNext()){
+ return;
+ }
+ String line = iterator.next();
+ if(line.isEmpty()){
+ processNonManoSource(iterator, key, sources);
+ }else if(line.trim().startsWith(SOURCE_MF_ATTRIBUTE + SEPERATOR_MF_ATTRIBUTE)){
+ String value = line.replace(SOURCE_MF_ATTRIBUTE + SEPERATOR_MF_ATTRIBUTE, "").trim();
+ sources.add(value);
+ processNonManoSource(iterator, key, sources);
+ }else {
+ processNonManoInputs(iterator, line);
+ }
+ nonManoSources.put(key.trim(), sources);
+ }
+
+ private void reportError(String line) {
+ errors.add(getErrorWithParameters(Messages.MANIFEST_INVALID_LINE.getErrorMessage(), line));
+ }
+
+ private ImmutableList<String> readAllLines(InputStream is) throws IOException {
+ if(is == null){
+ throw new IOException("Input Stream cannot be null!");
+ }
+ ImmutableList.Builder<String> builder = ImmutableList.<String> builder();
+ try (BufferedReader bufferedReader = new BufferedReader(
+ new InputStreamReader(is, StandardCharsets.UTF_8.newDecoder()))) {
+ bufferedReader.lines().forEach(builder::add);
+ }
+ return builder.build();
+ }
+
+ public Map<String, String> getMetadata() {
+ if (!isValid()){
+ return Collections.emptyMap();
+ }
+ return ImmutableMap.copyOf(metadata);
+ }
+
+ public List<String> getSources() {
+ if (!isValid()){
+ return Collections.emptyList();
+ }
+ return ImmutableList.copyOf(sources);
+ }
+
+ public List<String> getErrors() {
+ return ImmutableList.copyOf(errors);
+ }
+
+ public boolean isValid() {
+ return errors.isEmpty();
+ }
+
+ public Map<String, List<String>> getNonManoSources() {
+ if (!isValid()){
+ return Collections.emptyMap();
+ }
+ return ImmutableMap.copyOf(nonManoSources);
+ }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/csar/ManifestParsingTest.java b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/csar/ManifestParsingTest.java
index 687ddc18c4..c6008f03d7 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/csar/ManifestParsingTest.java
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/csar/ManifestParsingTest.java
@@ -14,18 +14,17 @@
* limitations under the License.
*/
-package org.openecomp.sdc.vendorsoftwareproduct.upload.csar;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
+package org.openecomp.sdc.tosca.csar;
+import org.junit.Test;
import org.openecomp.sdc.common.errors.Messages;
-import org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.OnboardingManifest;
import java.io.IOException;
import java.io.InputStream;
-import org.testng.annotations.Test;
+
+import static junit.framework.TestCase.assertTrue;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
public class ManifestParsingTest {
@@ -34,7 +33,7 @@ public class ManifestParsingTest {
public void testSuccessfulParsing() throws IOException {
try (InputStream is = getClass()
.getResourceAsStream("/vspmanager.csar/manifest/ValidTosca.mf")) {
- OnboardingManifest onboardingManifest = new OnboardingManifest(is);
+ Manifest onboardingManifest = OnboardingManifest.parse(is);
assertTrue(onboardingManifest.isValid());
assertEquals(onboardingManifest.getMetadata().size(), 4);
assertEquals(onboardingManifest.getSources().size(), 5);
@@ -45,7 +44,7 @@ public class ManifestParsingTest {
public void testNoMetadataParsing() throws IOException {
try (InputStream is = getClass()
.getResourceAsStream("/vspmanager.csar/manifest/InvalidTosca1.mf")) {
- OnboardingManifest onboardingManifest = new OnboardingManifest(is);
+ Manifest onboardingManifest = OnboardingManifest.parse(is);
assertFalse(onboardingManifest.isValid());
assertTrue(onboardingManifest.getErrors().stream().anyMatch(error -> error
.contains(Messages.MANIFEST_INVALID_LINE.getErrorMessage().substring(0, 10))));
@@ -56,7 +55,7 @@ public class ManifestParsingTest {
public void testBrokenMDParsing() throws IOException {
try (InputStream is = getClass()
.getResourceAsStream("/vspmanager.csar/manifest/InvalidTosca2.mf")) {
- OnboardingManifest onboardingManifest = new OnboardingManifest(is);
+ Manifest onboardingManifest = OnboardingManifest.parse(is);
assertFalse(onboardingManifest.isValid());
assertTrue(onboardingManifest.getErrors().stream().anyMatch(error -> error
.contains(Messages.MANIFEST_INVALID_LINE.getErrorMessage().substring(0, 10))));
@@ -67,12 +66,49 @@ public class ManifestParsingTest {
public void testNoMetaParsing() throws IOException {
try (InputStream is = getClass()
.getResourceAsStream("/vspmanager.csar/manifest/InvalidTosca4.mf")) {
- OnboardingManifest onboardingManifest = new OnboardingManifest(is);
+ Manifest onboardingManifest = OnboardingManifest.parse(is);
assertFalse(onboardingManifest.isValid());
assertTrue(onboardingManifest.getErrors().stream().anyMatch(error -> error
.contains(Messages.MANIFEST_NO_METADATA.getErrorMessage().substring(0, 10))));
}
}
+ @Test
+ public void testSuccessfulNonManoParsing() throws IOException {
+ try (InputStream is = getClass()
+ .getResourceAsStream("/vspmanager.csar/manifest/ValidNonManoTosca.mf")) {
+ Manifest onboardingManifest = OnboardingManifest.parse(is);
+ assertTrue(onboardingManifest.isValid());
+ assertEquals(onboardingManifest.getMetadata().size(), 4);
+ assertEquals(onboardingManifest.getSources().size(), 5);
+ assertEquals(onboardingManifest.getNonManoSources().size(), 2);
+ }
+ }
+
+ @Test
+ public void testFailfulNonManoParsing() throws IOException {
+ try (InputStream is = getClass()
+ .getResourceAsStream("/vspmanager.csar/manifest/InValidNonManoTosca.mf")) {
+ Manifest onboardingManifest = OnboardingManifest.parse(is);
+ assertFalse(onboardingManifest.isValid());
+ }
+ }
+
+ @Test
+ public void testFailfulNonManoParsingWithGarbadge() throws IOException {
+ try (InputStream is = getClass()
+ .getResourceAsStream("/vspmanager.csar/manifest/InvalidTocsaNonManoGarbadgeAtEnd.mf")) {
+ Manifest onboardingManifest = OnboardingManifest.parse(is);
+ assertFalse(onboardingManifest.isValid());
+ }
+ }
+ @Test
+ public void testParseManifestWithNoFile() throws IOException {
+ try (InputStream is = getClass()
+ .getResourceAsStream("/vspmanager.csar/manifest/SOME_WRONG_FILE")) {
+ Manifest onboardingManifest = OnboardingManifest.parse(is);
+ assertFalse(onboardingManifest.isValid());
+ }
+ }
}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InValidNonManoTosca.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InValidNonManoTosca.mf
new file mode 100644
index 0000000000..9cced6b371
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InValidNonManoTosca.mf
@@ -0,0 +1,36 @@
+metadata:
+ vnf_product_name: Mock
+ vnf_provider_id: ZTE
+ vnf_package_version: 1.0
+ vnf_release_data_time: 2017.01.01T10:00+03:00
+
+Source: MainServiceTemplate.yaml
+
+Source: Definitions/GlobalSubstitutionTypesServiceTemplate.yaml
+
+Source: Artifacts/install.sh
+
+Source: Artifacts/create_stack.sh
+
+Source: Licenses/license.xml
+
+non_mano_artifact_sets:
+ foo_bar:
+ Source: foobar/foo/foo.yaml
+
+ Source: foobar/foo/foo.script
+
+ Source: foobar/bar/descriptor.xml
+
+ prv.happy-nfv.cool:
+
+ Source: happy/cool/123.html
+
+ Source: happy/cool/cool.json
+
+ Source: happy/cool/hot/hot_or_cool.json
+
+
+vnf_product_name: Mock
+vnf_provider_id: ZTE
+vnf_package_version: 1.0 \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTocsaNonManoGarbadgeAtEnd.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTocsaNonManoGarbadgeAtEnd.mf
new file mode 100644
index 0000000000..cfe6bc48da
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTocsaNonManoGarbadgeAtEnd.mf
@@ -0,0 +1,34 @@
+metadata:
+ vnf_product_name: Mock
+ vnf_provider_id: ZTE
+ vnf_package_version: 1.0
+ vnf_release_data_time: 2017.01.01T10:00+03:00
+
+Source: MainServiceTemplate.yaml
+
+Source: Definitions/GlobalSubstitutionTypesServiceTemplate.yaml
+
+Source: Artifacts/install.sh
+
+Source: Artifacts/create_stack.sh
+
+Source: Licenses/license.xml
+
+non_mano_artifact_sets:
+ foo_bar:
+ Source: foobar/foo/foo.yaml
+
+ Source: foobar/foo/foo.script
+
+ Source: foobar/bar/descriptor.xml
+
+ prv.happy-nfv.cool:
+
+ Source: happy/cool/123.html
+
+ Source: happy/cool/cool.json
+
+ Source: happy/cool/hot/hot_or_cool.json
+
+
+some garbadge \ No newline at end of file
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca1.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTosca1.mf
index ebdec213d3..ebdec213d3 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca1.mf
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTosca1.mf
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca2.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTosca2.mf
index 057f54867b..057f54867b 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca2.mf
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTosca2.mf
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca3.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTosca3.mf
index 64e9445f7f..64e9445f7f 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca3.mf
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTosca3.mf
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca4.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTosca4.mf
index d8e291c4a3..d8e291c4a3 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca4.mf
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTosca4.mf
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/ValidNonManoTosca.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/ValidNonManoTosca.mf
new file mode 100644
index 0000000000..25ec14c7cc
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/ValidNonManoTosca.mf
@@ -0,0 +1,33 @@
+metadata:
+ vnf_product_name: Mock
+ vnf_provider_id: ZTE
+ vnf_package_version: 1.0
+ vnf_release_data_time: 2017.01.01T10:00+03:00
+
+Source: MainServiceTemplate.yaml
+
+Source: Definitions/GlobalSubstitutionTypesServiceTemplate.yaml
+
+Source: Artifacts/install.sh
+
+Source: Artifacts/create_stack.sh
+
+Source: Licenses/license.xml
+
+non_mano_artifact_sets:
+ foo_bar:
+ Source: foobar/foo/foo.yaml
+
+ Source: foobar/foo/foo.script
+
+ Source: foobar/bar/descriptor.xml
+
+ prv.happy-nfv.cool:
+
+ Source: happy/cool/123.html
+
+ Source: happy/cool/cool.json
+
+ Source: happy/cool/hot/hot_or_cool.json
+
+
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/ValidTosca.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/ValidTosca.mf
index b2accb7a1c..b2accb7a1c 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/ValidTosca.mf
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/ValidTosca.mf