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
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")
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);
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;
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;
}
private List<String> validSourceTypes;
private String file;
private String type;
+ private List<UploadPropInfo> properties;
}
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;
}
import lombok.Getter;
import lombok.Setter;
+import java.util.Map;
+
@Getter
@Setter
public class ArtifactDefinition {
private String repository;
private String description;
private String deploy_path;
+ private Map<String, Object> properties;
}