1 package org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation;
3 import org.openecomp.sdc.tosca.datatypes.model.RequirementAssignment;
5 import java.util.ArrayList;
6 import java.util.HashMap;
11 * The type Compute template consolidation data.
13 public class ComputeTemplateConsolidationData extends EntityConsolidationData {
14 // key - volume node template id
15 // List of requirement id and the requirement assignment on the
16 // compute node which connect to this volume
17 private Map<String,List<RequirementAssignmentData>> volumes;
19 // key - port type (port id excluding index),
20 // value - List of connected port node template ids, with this port type
21 private Map<String, List<String>> ports;
28 public Map<String,List<RequirementAssignmentData>> getVolumes() {
35 * @param volumes the volumes
37 public void setVolumes(Map<String,List<RequirementAssignmentData>> volumes) {
38 this.volumes = volumes;
46 public Map<String, List<String>> getPorts() {
53 * @param ports the ports
55 public void setPorts(Map<String, List<String>> ports) {
62 * @param portType the port type
63 * @param portNodeTemplateId the port node template id
65 public void addPort(String portType, String portNodeTemplateId) {
66 if (this.ports == null) {
67 this.ports = new HashMap<>();
69 this.ports.putIfAbsent(portType, new ArrayList<>());
70 this.ports.get(portType).add(portNodeTemplateId);
77 * @param requirementId the requirement id
78 * @param requirementAssignment the requirement assignment
80 public void addVolume(String requirementId, RequirementAssignment requirementAssignment) {
81 if (this.volumes == null) {
82 this.volumes = new HashMap<>();
84 this.volumes.computeIfAbsent(requirementAssignment.getNode(), k -> new ArrayList<>())
85 .add(new RequirementAssignmentData(requirementId,
86 requirementAssignment));