aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be
diff options
context:
space:
mode:
authorSithara Nambiar <sitharav.aredath@huawei.com>2020-09-29 23:10:17 +0530
committerSithara Nambiar <sitharav.aredath@huawei.com>2020-10-03 15:03:26 +0530
commitc0cd58244635c610c604066e9542058b310a706d (patch)
treec9a2c2dd6608ce153549aa3b399ab4d952c60fe7 /openecomp-be
parent0fa53516c409ac136f654475c1e41c77cad9cf09 (diff)
sdc changes for identifying helm package as a vfm
Issue-ID: REQ-341 Signed-off-by: Sithara Nambiar <sitharav.aredath@huawei.com> Change-Id: Ide4736655c01dd25dae5afe1207a292a6bcd6951
Diffstat (limited to 'openecomp-be')
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/structure/HeatStructureTree.java9
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManager.java5
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/to/FileDataCollection.java12
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/HeatToToscaUtil.java13
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/TranslationService.java35
-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/types/candidateheat/Module.java2
-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/filedatastructuremodule/CandidateServiceImpl.java11
-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/filedatastructuremodule/ManifestCreatorNamingConventionImpl.java6
8 files changed, 90 insertions, 3 deletions
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/structure/HeatStructureTree.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/structure/HeatStructureTree.java
index 8d1b5912df..a65db6f2ea 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/structure/HeatStructureTree.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/structure/HeatStructureTree.java
@@ -50,6 +50,7 @@ public class HeatStructureTree implements Comparable<HeatStructureTree> {
private Set<HeatStructureTree> nested;
private Set<HeatStructureTree> other;
private Set<Artifact> artifacts;
+ private Set<HeatStructureTree> helm;
public HeatStructureTree() {
}
@@ -165,6 +166,14 @@ public class HeatStructureTree implements Comparable<HeatStructureTree> {
this.other.add(other);
}
+ public void addToHelmList(HeatStructureTree helm){
+ if (this.helm == null) {
+ this.helm = new TreeSet<>();
+ }
+
+ this.helm.add(helm);
+ }
+
/**
* Find item in set by name boolean.
*
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManager.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManager.java
index 4ac09fbddd..b441fc8660 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManager.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManager.java
@@ -251,7 +251,10 @@ public class HeatTreeManager {
}
parentHeatStructureTree.getOther().add(childHeatStructureTree);
}
- } else {
+ } else if (FileData.Type.HELM.equals(type)) {
+ parentHeatStructureTree.addToHelmList(childHeatStructureTree);
+ }
+ else {
artifact = new Artifact(fileName, type);
if (!artifactRef.keySet().contains(fileName)) {
artifactRef.put(fileName, artifact);
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/to/FileDataCollection.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/to/FileDataCollection.java
index a9147b838f..b156078430 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/to/FileDataCollection.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/to/FileDataCollection.java
@@ -32,11 +32,16 @@ public class FileDataCollection {
Collection<FileData> addOnFiles;
Collection<FileData> nestedFiles;
Collection<FileData> artifactFiles;
+ Collection<FileData> HelmFiles;
public Collection<FileData> getBaseFile() {
return baseFiles;
}
+ public Collection<FileData> getHelmFile() {
+ return HelmFiles;
+ }
+
public void setBaseFile(Collection<FileData> baseFiles) {
this.baseFiles = baseFiles;
}
@@ -109,6 +114,13 @@ public class FileDataCollection {
this.baseFiles.add(baseFile);
}
+ public void addHelmFiles(FileData helmFile) {
+ if (this.HelmFiles == null) {
+ this.HelmFiles = new ArrayList<>();
+ }
+ this.HelmFiles.add(helmFile);
+ }
+
/**
* Add artifact files.
*
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/HeatToToscaUtil.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/HeatToToscaUtil.java
index 6649c90adb..d204281d6b 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/HeatToToscaUtil.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/HeatToToscaUtil.java
@@ -220,6 +220,19 @@ public class HeatToToscaUtil {
return null;
}
+ static FileDataCollection getFileCollectionsByHelmFilter(List<FileData> fileDataList, Set<FileData.Type> typeFilter) {
+ FileDataCollection fileDataCollection = new FileDataCollection();
+ Map<String, FileData> filteredFiles = filterFileDataListByType(fileDataList, typeFilter);
+ for (FileData fileData : filteredFiles.values()) {
+ String fileName = fileData.getFile();
+ if((fileData.getType().equals(FileData.Type.HELM)))
+ {
+ fileDataCollection.addHelmFiles(fileData);
+ }
+ }
+ return fileDataCollection;
+ }
+
static FileDataCollection getFileCollectionsByFilter(List<FileData> fileDataList, Set<FileData.Type> typeFilter,
TranslationContext translationContext) {
FileDataCollection fileDataCollection = new FileDataCollection();
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/TranslationService.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/TranslationService.java
index 339d6ff023..6d22a3602c 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/TranslationService.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/TranslationService.java
@@ -70,6 +70,12 @@ public class TranslationService {
return types;
}
+ public static Set<FileData.Type> getTypesToProcessByHelmTranslator() {
+ Set<FileData.Type> types = new HashSet<>();
+ types.add(FileData.Type.HELM);
+ return types;
+ }
+
/**
* Translate heat files translator output.
*
@@ -81,6 +87,8 @@ public class TranslationService {
List<FileData> fileDataList = translationContext.getManifest().getContent().getData();
FileDataCollection fileDataCollection = HeatToToscaUtil.getFileCollectionsByFilter(fileDataList,
TranslationService.getTypesToProcessByTranslator(), translationContext);
+ FileDataCollection fileDataCollectionHelm = HeatToToscaUtil.getFileCollectionsByHelmFilter(fileDataList,
+ TranslationService.getTypesToProcessByHelmTranslator());
if (fileDataCollection.getBaseFile() != null) {
for (FileData fileData : fileDataCollection.getBaseFile()) {
@@ -93,6 +101,13 @@ public class TranslationService {
}
}
+ if (fileDataCollectionHelm.getHelmFile() !=null) {
+ for (FileData fileData : fileDataCollectionHelm.getHelmFile()) {
+ translateHelmFile(mainServiceTemplate, fileData, translationContext);
+
+ }
+ }
+
ToscaServiceModel toscaServiceModel =
HeatToToscaUtil.createToscaServiceModel(mainServiceTemplate, translationContext);
@@ -145,6 +160,26 @@ public class TranslationService {
}
}
+
+ public void translateHelmFile(ServiceTemplate serviceTemplate, FileData heatFileData,
+ TranslationContext context) {
+ String heatFileName = heatFileData.getFile();
+ Map<String, ParameterDefinition> inputs = serviceTemplate.getTopology_template().getInputs();
+ if (!Objects.isNull(inputs)) {
+
+ inputs.entrySet().forEach(
+ stringParameterDefinitionEntry -> {
+ List inputParamVFModuleList = getVFModulesList(
+ inputs.get(stringParameterDefinitionEntry.getKey()));
+ if (!inputParamVFModuleList.contains(FileUtils.getFileWithoutExtention(heatFileName)) ){
+ inputParamVFModuleList.add(FileUtils.getFileWithoutExtention(heatFileName));
+ }
+ }
+ );
+ }
+ inputs.putAll(inputs);
+ }
+
private void handleHeatPseudoParam(String heatFileName, ServiceTemplate serviceTemplate,
TranslationContext context) {
Map<String, String> translatedHeatPseudoParam =
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/types/candidateheat/Module.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/candidateheat/Module.java
index d25341469f..25a004e890 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/candidateheat/Module.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/candidateheat/Module.java
@@ -23,6 +23,7 @@ package org.openecomp.sdc.vendorsoftwareproduct.types.candidateheat;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
+import org.openecomp.sdc.heat.datatypes.manifest.FileData;
@Getter
@Setter
@@ -35,5 +36,6 @@ public class Module {
private String env;
private String vol;
private String volEnv;
+ private FileData.Type type;
}
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/filedatastructuremodule/CandidateServiceImpl.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/filedatastructuremodule/CandidateServiceImpl.java
index 5535416838..8bae5e8193 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/filedatastructuremodule/CandidateServiceImpl.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/filedatastructuremodule/CandidateServiceImpl.java
@@ -262,11 +262,20 @@ public class CandidateServiceImpl implements CandidateService {
if (Objects.nonNull(fileData.getType()) &&
fileData.getType().equals(FileData.Type.HEAT)) {
Module module = new Module();
+ module.setType(FileData.Type.HEAT);
module.setYaml(fileData.getFile());
module.setIsBase(fileData.getBase());
addHeatDependenciesToModule(module, fileData.getData());
structure.getModules().add(module);
- } else if (HeatFileAnalyzer.isYamlOrEnvFile(fileData.getFile()) &&
+ }else if (Objects.nonNull(fileData.getType()) &&
+ fileData.getType().equals(FileData.Type.HELM)) {
+ Module module = new Module();
+ module.setType(FileData.Type.HELM);
+ module.setYaml(fileData.getFile());
+ module.setIsBase(fileData.getBase());
+ structure.getModules().add(module);
+ }
+ else if (HeatFileAnalyzer.isYamlOrEnvFile(fileData.getFile()) &&
!FileData.Type.isArtifact(fileData.getType())) {
structure.getUnassigned().add(fileData.getFile());
} else {
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/filedatastructuremodule/ManifestCreatorNamingConventionImpl.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/filedatastructuremodule/ManifestCreatorNamingConventionImpl.java
index 539e98df5a..3f061b059c 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/filedatastructuremodule/ManifestCreatorNamingConventionImpl.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/filedatastructuremodule/ManifestCreatorNamingConventionImpl.java
@@ -184,7 +184,11 @@ public class ManifestCreatorNamingConventionImpl implements ManifestCreator {
FilesDataStructure filesDataStructure, List<FileData> fileDataList) {
if (CollectionUtils.isNotEmpty(filesDataStructure.getModules())) {
for (Module module : filesDataStructure.getModules()) {
- FileData fileData = createBaseFileData(FileData.Type.HEAT, module.getYaml());
+ FileData.Type type = module.getType();
+ if (type == null) {
+ type = FileData.Type.HEAT;
+ }
+ FileData fileData = createBaseFileData(type, module.getYaml());
fileData.setBase(module.getIsBase());
addEnv(module, fileData);
addVolume(module, fileData);