diff options
author | JvD_Ericsson <jeff.van.dam@est.tech> | 2022-01-18 10:17:58 +0000 |
---|---|---|
committer | Michael Morris <michael.morris@est.tech> | 2022-01-21 22:20:14 +0000 |
commit | 3c33df0dc2d58d8e8bdbb52c0ca1ce8f93bce415 (patch) | |
tree | e99b61aaef35ea06b312eab1375c5c61903cf297 /catalog-be/src/main/java | |
parent | a5362c70a2dc989a5cbc7ac2e4129b12b8bde53f (diff) |
Support node template artifact properties
Add properties variable to relevant classes and update functions to set these vaules
Added properties to an artifact in ETSI-VNF-SAMPLE.csar
Issue-ID: SDC-3847
Signed-off-by: JvD_Ericsson <jeff.van.dam@est.tech>
Change-Id: Id4f835826be7556cd97403da2018644c6dfea95b
Diffstat (limited to 'catalog-be/src/main/java')
4 files changed, 19 insertions, 0 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/YamlTemplateParsingHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/YamlTemplateParsingHandler.java index a991f7e0d4..3faf750a73 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/YamlTemplateParsingHandler.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/YamlTemplateParsingHandler.java @@ -832,6 +832,13 @@ public class YamlTemplateParsingHandler { if (nodeTemplateJsonMap.containsKey(FILE.getElementName())) { artifactTemplateInfo.setFile((String) nodeTemplateJsonMap.get(FILE.getElementName())); } + if (nodeTemplateJsonMap.containsKey(PROPERTIES.getElementName())) { + Map<String, List<UploadPropInfo>> props = buildPropModuleFromYaml(nodeTemplateJsonMap); + if (!props.isEmpty()) { + List<UploadPropInfo> properties = props.values().stream().flatMap(Collection::stream).collect(toList()); + artifactTemplateInfo.setProperties(properties); + } + } } @SuppressWarnings("unchecked") diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java index 666529986c..8c97a04a74 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java @@ -3409,6 +3409,14 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { ToscaArtifactDataDefinition to = new ToscaArtifactDataDefinition(); to.setFile(entry.getValue().getFile()); to.setType(entry.getValue().getType()); + if(isNotEmpty(entry.getValue().getProperties())) { + Map<String, Object> newPropertiesMap = new HashMap<>(); + List<UploadPropInfo> artifactPropsInfo = entry.getValue().getProperties(); + for(UploadPropInfo propInfo: artifactPropsInfo) { + newPropertiesMap.put(propInfo.getName(), propInfo.getValue()); + } + to.setProperties(newPropertiesMap); + } toscaArtifacts.put(entry.getKey(), to); } componentInstance.setToscaArtifacts(toscaArtifacts); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java index cdd5d60ed4..b6bd2a3967 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java @@ -1548,6 +1548,7 @@ public class ToscaExportHandler { ToscaTemplateArtifact artifact = new ToscaTemplateArtifact(); artifact.setFile(entry.getValue().getFile()); artifact.setType(entry.getValue().getType()); + artifact.setProperties(entry.getValue().getProperties()); arts.put(entry.getKey(), artifact); } return arts; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaTemplateArtifact.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaTemplateArtifact.java index 894a806de0..9824552f6f 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaTemplateArtifact.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaTemplateArtifact.java @@ -22,10 +22,13 @@ package org.openecomp.sdc.be.tosca.model; import lombok.Getter; import lombok.Setter; +import java.util.Map; + @Getter @Setter public class ToscaTemplateArtifact { private String file; private String type; + private Map<String, Object> properties; } |