summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJvD_Ericsson <jeff.van.dam@est.tech>2022-01-18 10:17:58 +0000
committerMichael Morris <michael.morris@est.tech>2022-01-21 22:20:14 +0000
commit3c33df0dc2d58d8e8bdbb52c0ca1ce8f93bce415 (patch)
treee99b61aaef35ea06b312eab1375c5c61903cf297
parenta5362c70a2dc989a5cbc7ac2e4129b12b8bde53f (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
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/YamlTemplateParsingHandler.java7
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java8
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java1
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaTemplateArtifact.java3
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/UploadArtifactInfo.java1
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ToscaArtifactDataDefinition.java3
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ArtifactDefinition.java3
-rw-r--r--integration-tests/src/test/resources/Files/ETSI/ETSI-VNF-SAMPLE.csarbin2765 -> 2806 bytes
8 files changed, 26 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;
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/UploadArtifactInfo.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/UploadArtifactInfo.java
index 183f18c0b4..33fbc4aa0d 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/UploadArtifactInfo.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/UploadArtifactInfo.java
@@ -33,4 +33,5 @@ public class UploadArtifactInfo extends UploadInfo {
private List<String> validSourceTypes;
private String file;
private String type;
+ private List<UploadPropInfo> properties;
}
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ToscaArtifactDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ToscaArtifactDataDefinition.java
index 554d37e13a..64c7bf00b3 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ToscaArtifactDataDefinition.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ToscaArtifactDataDefinition.java
@@ -22,10 +22,13 @@ package org.openecomp.sdc.be.datatypes.elements;
import lombok.Getter;
import lombok.Setter;
+import java.util.Map;
+
@Getter
@Setter
public class ToscaArtifactDataDefinition {
private String file;
private String type;
+ private Map<String, Object> properties;
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ArtifactDefinition.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ArtifactDefinition.java
index 90809f0304..ee6bbd092a 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ArtifactDefinition.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ArtifactDefinition.java
@@ -22,6 +22,8 @@ package org.onap.sdc.tosca.datatypes.model;
import lombok.Getter;
import lombok.Setter;
+import java.util.Map;
+
@Getter
@Setter
public class ArtifactDefinition {
@@ -31,4 +33,5 @@ public class ArtifactDefinition {
private String repository;
private String description;
private String deploy_path;
+ private Map<String, Object> properties;
}
diff --git a/integration-tests/src/test/resources/Files/ETSI/ETSI-VNF-SAMPLE.csar b/integration-tests/src/test/resources/Files/ETSI/ETSI-VNF-SAMPLE.csar
index 20ea03ba1e..85ce2c6418 100644
--- a/integration-tests/src/test/resources/Files/ETSI/ETSI-VNF-SAMPLE.csar
+++ b/integration-tests/src/test/resources/Files/ETSI/ETSI-VNF-SAMPLE.csar
Binary files differ