2 * Copyright © 2016-2018 European Support Limited
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation;
19 import java.util.ArrayList;
20 import java.util.HashMap;
21 import java.util.List;
24 import org.onap.sdc.tosca.datatypes.model.RequirementAssignment;
26 public class ComputeTemplateConsolidationData extends EntityConsolidationData {
27 // key - volume node template id
28 // value - List of requirement id and the requirement assignment on the
29 // compute node which connect to this volume
30 private Map<String,List<RequirementAssignmentData>> volumes;
32 // key - port type (port id excluding index),
33 // value - List of connected port node template ids, with this port type
34 private Map<String, List<String>> ports;
36 public Map<String,List<RequirementAssignmentData>> getVolumes() {
40 public void setVolumes(Map<String,List<RequirementAssignmentData>> volumes) {
41 this.volumes = volumes;
44 public Map<String, List<String>> getPorts() {
48 public void setPorts(Map<String, List<String>> ports) {
52 public void addPort(String portType, String portNodeTemplateId) {
53 if (this.ports == null) {
54 this.ports = new HashMap<>();
56 this.ports.putIfAbsent(portType, new ArrayList<>());
57 this.ports.get(portType).add(portNodeTemplateId);
60 public void addVolume(String requirementId, RequirementAssignment requirementAssignment) {
61 if (this.volumes == null) {
62 this.volumes = new HashMap<>();
64 this.volumes.computeIfAbsent(requirementAssignment.getNode(), k -> new ArrayList<>())
65 .add(new RequirementAssignmentData(requirementId,
66 requirementAssignment));