summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-translator-lib
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-translator-lib')
-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
3 files changed, 60 insertions, 0 deletions
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 =