summaryrefslogtreecommitdiffstats
path: root/openecomp-be
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be')
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/unifiedmodel/consolidation/PortTemplateConsolidationData.java71
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/unifiedmodel/consolidation/SubInterfaceTemplateConsolidationData.java51
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationService.java316
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/SubInterfaceConsolidationDataTestInfo.java86
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/TestUtils.java195
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationServiceTest.java1057
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java6
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/different_subinterface_types/MainServiceTemplate.yaml207
8 files changed, 1536 insertions, 453 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/unifiedmodel/consolidation/PortTemplateConsolidationData.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/unifiedmodel/consolidation/PortTemplateConsolidationData.java
index c9b59f99db..0eacd4de3c 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/unifiedmodel/consolidation/PortTemplateConsolidationData.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/unifiedmodel/consolidation/PortTemplateConsolidationData.java
@@ -1,5 +1,24 @@
+/*
+ * Copyright © 2016-2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation;
+import com.google.common.collect.ArrayListMultimap;
+import com.google.common.collect.ListMultimap;
+import com.google.common.collect.Multimaps;
import java.util.List;
@@ -8,23 +27,45 @@ import java.util.List;
*/
public class PortTemplateConsolidationData extends EntityConsolidationData {
- private List<String> subPortIds; //sub ports which point to this port
+ // key - subport type - for ResourceGroup it is the nested file name
+ // value - List of subports of that type in the port
+ private final ListMultimap<String, SubInterfaceTemplateConsolidationData> subInterfaceConsolidationData =
+ Multimaps.synchronizedListMultimap(ArrayListMultimap.create());
+
+ public void addSubInterfaceConsolidationData(String subPortType,
+ SubInterfaceTemplateConsolidationData
+ subInterfaceTemplateConsolidationData) {
+ this.subInterfaceConsolidationData.put(subPortType, subInterfaceTemplateConsolidationData);
+ }
+
+ public boolean hasSameSubInterfaceTypes(PortTemplateConsolidationData other) {
+ return other != null && this.subInterfaceConsolidationData.keySet().equals(
+ other.subInterfaceConsolidationData.keySet());
+ }
+
+ public void copyMappedInto(ListMultimap<String, SubInterfaceTemplateConsolidationData> subInterfaceTypeToEntity) {
+ subInterfaceTypeToEntity.putAll(this.subInterfaceConsolidationData);
+ }
+
+ public void copyFlatInto(List<SubInterfaceTemplateConsolidationData> subInterfaceTemplateConsolidationDataList) {
+ subInterfaceTemplateConsolidationDataList.addAll(subInterfaceConsolidationData.values());
+ }
+
+ public boolean isNumberOfSubInterfacesPerTypeSimilar(PortTemplateConsolidationData other) {
+
+ if (this.subInterfaceConsolidationData.isEmpty() &&
+ other.subInterfaceConsolidationData.isEmpty()) {
+ return true;
+ }
- /**
- * Gets sub port ids.
- *
- * @return the sub port ids
- */
- public List<String> getSubPortIds() {
- return subPortIds;
+ return !this.subInterfaceConsolidationData.isEmpty()
+ && !other.subInterfaceConsolidationData.isEmpty()
+ && this.subInterfaceConsolidationData.keySet().stream().allMatch(subInterfaceType ->
+ calculateSize(other.subInterfaceConsolidationData.get(subInterfaceType)) ==
+ calculateSize(this.subInterfaceConsolidationData.get(subInterfaceType)));
}
- /**
- * Sets sub port ids.
- *
- * @param subPortIds the sub port ids
- */
- public void setSubPortIds(List<String> subPortIds) {
- this.subPortIds = subPortIds;
+ private int calculateSize(List<SubInterfaceTemplateConsolidationData> subInterfaces) {
+ return subInterfaces == null ? 0 : subInterfaces.size();
}
} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/unifiedmodel/consolidation/SubInterfaceTemplateConsolidationData.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/unifiedmodel/consolidation/SubInterfaceTemplateConsolidationData.java
new file mode 100644
index 0000000000..9a6826d644
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/unifiedmodel/consolidation/SubInterfaceTemplateConsolidationData.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright © 2016-2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation;
+
+public class SubInterfaceTemplateConsolidationData extends EntityConsolidationData {
+
+ //Value of the property count in the resource group representing the sub-interface
+ private Object resourceGroupCount;
+ //Network role of the sub-interface
+ private String networkRole;
+ //Parent port node template id
+ private String parentPortNodeTemplateId;
+
+ public Object getResourceGroupCount() {
+ return resourceGroupCount;
+ }
+
+ public void setResourceGroupCount(Object resourceGroupCount) {
+ this.resourceGroupCount = resourceGroupCount;
+ }
+
+ public String getNetworkRole() {
+ return networkRole;
+ }
+
+ public void setNetworkRole(String networkRole) {
+ this.networkRole = networkRole;
+ }
+
+ public String getParentPortNodeTemplateId() {
+ return parentPortNodeTemplateId;
+ }
+
+ public void setParentPortNodeTemplateId(String parentPortNodeTemplateId) {
+ this.parentPortNodeTemplateId = parentPortNodeTemplateId;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationService.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationService.java
index 3fef3f91a1..bc5a3c7e3a 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationService.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationService.java
@@ -1,7 +1,26 @@
+/*
+ * Copyright © 2016-2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.openecomp.sdc.translator.services.heattotosca;
+import com.google.common.collect.ArrayListMultimap;
+import com.google.common.collect.ListMultimap;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
+import org.apache.commons.lang3.StringUtils;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.tosca.datatypes.model.NodeTemplate;
import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate;
@@ -21,6 +40,7 @@ import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolida
import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.NestedTemplateConsolidationData;
import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.PortTemplateConsolidationData;
import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.RequirementAssignmentData;
+import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.SubInterfaceTemplateConsolidationData;
import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.TypeComputeConsolidationData;
import org.openecomp.sdc.translator.services.heattotosca.errors.DuplicateResourceIdsInDifferentFilesErrorBuilder;
@@ -34,7 +54,9 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
+import java.util.function.Function;
import java.util.function.Predicate;
+import java.util.stream.Collectors;
public class ConsolidationService {
@@ -165,7 +187,8 @@ public class ConsolidationService {
consolidationData);
if (!(checkGetAttrOutFromEntityToPortIsLegal(portTemplateConsolidationDataList, portTypeToIds)
- && checkGetAttrOutFromPortToComputeIsLegal(portTemplateConsolidationDataList,
+ && checkGetAttrOutFromConsolidationEntityToEntityNotFromSameTypeIsLegal(
+ portTemplateConsolidationDataList,
computeNodeTemplateIds))) {
return false;
}
@@ -178,6 +201,9 @@ public class ConsolidationService {
Map<String, List<String>> portTypeToIds) {
for (String portType : portTypeToIds.keySet()) {
+ if (CollectionUtils.isEmpty(entities)) {
+ continue;
+ }
Set<GetAttrFuncData> startingGetAttrFunc =
getEntityGetAttrFuncAsSet(portType,
(EntityConsolidationData) entities.iterator().next());
@@ -194,24 +220,27 @@ public class ConsolidationService {
return true;
}
- private boolean checkGetAttrOutFromPortToComputeIsLegal(
- List<PortTemplateConsolidationData> portTemplateConsolidationDataList,
- Collection<String> computeNodeTemplateIds) {
- PortTemplateConsolidationData startingPortTemplate =
- portTemplateConsolidationDataList.get(0);
- Map<String, Set<GetAttrFuncData>> startingComputeGetAttrOutFuncData =
- getComputeGetAttrOutFuncData(startingPortTemplate.getNodesGetAttrOut(),
- computeNodeTemplateIds);
-
- for (int i = 1; i < portTemplateConsolidationDataList.size(); i++) {
- PortTemplateConsolidationData currentPortTemplate =
- portTemplateConsolidationDataList.get(i);
- Map<String, Set<GetAttrFuncData>> currentComputeGetAttrOutFuncData =
- getComputeGetAttrOutFuncData(currentPortTemplate.getNodesGetAttrOut(),
- computeNodeTemplateIds);
-
- if (!isGetAttrRelationToComputeSimilarBetweenEntities(startingComputeGetAttrOutFuncData,
- currentComputeGetAttrOutFuncData)) {
+ private boolean checkGetAttrOutFromConsolidationEntityToEntityNotFromSameTypeIsLegal(
+ List entityConsolidationDataList,
+ Collection<String> consolidationEntityNodeTemplateIds) {
+ if (CollectionUtils.isEmpty(entityConsolidationDataList)) {
+ return true;
+ }
+ EntityConsolidationData startingEntityTemplate =
+ (EntityConsolidationData) entityConsolidationDataList.get(0);
+ Map<String, Set<GetAttrFuncData>> startingGetAttrOutFuncData =
+ getConsolidationEntityGetAttrOutFuncData(startingEntityTemplate.getNodesGetAttrOut(),
+ consolidationEntityNodeTemplateIds);
+
+ for (int i = 1; i < entityConsolidationDataList.size(); i++) {
+ EntityConsolidationData currentEntityTemplate =
+ (EntityConsolidationData) entityConsolidationDataList.get(i);
+ Map<String, Set<GetAttrFuncData>> currentGetAttrOutFuncData =
+ getConsolidationEntityGetAttrOutFuncData(currentEntityTemplate.getNodesGetAttrOut(),
+ consolidationEntityNodeTemplateIds);
+
+ if (!isGetAttrRelationToEntitySimilarBetweenEntities(startingGetAttrOutFuncData,
+ currentGetAttrOutFuncData)) {
return false;
}
}
@@ -219,7 +248,7 @@ public class ConsolidationService {
return true;
}
- private boolean isGetAttrRelationToComputeSimilarBetweenEntities(
+ private boolean isGetAttrRelationToEntitySimilarBetweenEntities(
Map<String, Set<GetAttrFuncData>> firstMap,
Map<String, Set<GetAttrFuncData>> secondMap) {
if (MapUtils.isEmpty(firstMap) != MapUtils.isEmpty(secondMap)) {
@@ -231,6 +260,90 @@ public class ConsolidationService {
}
+ private boolean checkSubInterfaceConsolidationPreCondition(ServiceTemplate serviceTemplate,
+ ConsolidationData consolidationData,
+ TypeComputeConsolidationData typeComputeConsolidationData) {
+ FilePortConsolidationData filePortConsolidationData =
+ consolidationData.getPortConsolidationData()
+ .getFilePortConsolidationData(ToscaUtil.getServiceTemplateFileName(serviceTemplate));
+
+ if (Objects.isNull(filePortConsolidationData)) {
+ return true;
+ }
+
+ Map<String, List<String>> portTypeToPortIds = UnifiedCompositionUtil
+ .collectAllPortsFromEachTypesFromComputes(
+ typeComputeConsolidationData.getAllComputeTemplateConsolidationData());
+
+ Collection<String> computeNodeTemplateIds =
+ typeComputeConsolidationData.getAllComputeNodeTemplateIds();
+
+ for (List<String> portIdsFromSameType : portTypeToPortIds.values()) {
+ List<PortTemplateConsolidationData> portTemplateConsolidationDataList =
+ getAllPortTemplateConsolidationData(portIdsFromSameType, filePortConsolidationData);
+
+ if (!areSubInterfacePreConditionRulesValid(portTypeToPortIds, computeNodeTemplateIds,
+ portTemplateConsolidationDataList, portTemplateConsolidationDataList.get(0))) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private boolean areSubInterfacePreConditionRulesValid(Map<String, List<String>> portTypeToPortIds,
+ Collection<String> computeNodeTemplateIds,
+ List<PortTemplateConsolidationData> portTemplateConsolidationDataList,
+ PortTemplateConsolidationData subInterfaceConsolidationData) {
+ return areSubInterfaceTypesSimilarBetweenPorts(portTemplateConsolidationDataList,
+ subInterfaceConsolidationData)
+ && isNumberOfSubInterfacesPerTypeSimilar(portTemplateConsolidationDataList,
+ subInterfaceConsolidationData)
+ && isGetAttrFromSubInterfaceToOtherEntitiesLegal(computeNodeTemplateIds,
+ portTypeToPortIds, portTemplateConsolidationDataList);
+ }
+
+ private boolean isGetAttrFromSubInterfaceToOtherEntitiesLegal(
+ Collection<String> computeNodeTemplateIds,
+ Map<String, List<String>> portTypeToPortIds,
+ List<PortTemplateConsolidationData> portTemplateConsolidationDataList) {
+
+ ListMultimap<String, SubInterfaceTemplateConsolidationData> subInterfacesFromSameTypeFromPorts =
+ collectAllSubInterfacesFromSameTypeFromPorts(portTemplateConsolidationDataList);
+
+ List<SubInterfaceTemplateConsolidationData> subInterfaceList = new ArrayList<>(subInterfacesFromSameTypeFromPorts
+ .values());
+ return areGetAttrRelationshipsBetweenSubInterfaceToConsolidationEntitiesValid(
+ computeNodeTemplateIds, portTypeToPortIds, portTemplateConsolidationDataList, subInterfaceList);
+ }
+
+ private boolean areGetAttrRelationshipsBetweenSubInterfaceToConsolidationEntitiesValid(
+ Collection<String> computeNodeTemplateIds, Map<String, List<String>> portTypeToPortIds,
+ List<PortTemplateConsolidationData> portTemplateConsolidationDataList,
+ List<SubInterfaceTemplateConsolidationData> subInterfaceList) {
+ return checkGetAttrOutFromEntityToPortIsLegal(subInterfaceList, portTypeToPortIds)
+ && checkGetAttrOutFromConsolidationEntityToEntityNotFromSameTypeIsLegal(
+ portTemplateConsolidationDataList, getSubInterfaceIdsFromSameType(subInterfaceList))
+ && checkGetAttrOutFromConsolidationEntityToEntityNotFromSameTypeIsLegal(
+ subInterfaceList, computeNodeTemplateIds);
+ }
+
+ private boolean areSubInterfaceTypesSimilarBetweenPorts(
+ List<PortTemplateConsolidationData> portTemplateConsolidationDataList,
+ PortTemplateConsolidationData subInterfaceConsolidationData) {
+
+ return portTemplateConsolidationDataList.stream().allMatch(
+ element -> element.hasSameSubInterfaceTypes(subInterfaceConsolidationData));
+ }
+
+ private boolean isNumberOfSubInterfacesPerTypeSimilar(
+ List<PortTemplateConsolidationData> portTemplateConsolidationDataList,
+ PortTemplateConsolidationData subInterfaceConsolidationData) {
+
+ return portTemplateConsolidationDataList.stream()
+ .allMatch(element -> element.isNumberOfSubInterfacesPerTypeSimilar(subInterfaceConsolidationData));
+ }
+
+
private Set<GetAttrFuncData> getEntityGetAttrFuncAsSet(
String portType,
EntityConsolidationData entityConsolidationData) {
@@ -252,7 +365,7 @@ public class ConsolidationService {
return getAttrFuncDataFromPortsWithSameType;
}
- private Map<String, Set<GetAttrFuncData>> getComputeGetAttrOutFuncData(
+ private Map<String, Set<GetAttrFuncData>> getConsolidationEntityGetAttrOutFuncData(
Map<String, List<GetAttrFuncData>> nodesGetAttrOut,
Collection<String> computeNodeTemplateIds) {
Map<String, Set<GetAttrFuncData>> computeGetAttrFuncData = new HashMap<>();
@@ -275,13 +388,13 @@ public class ConsolidationService {
ServiceTemplate serviceTemplate,
TypeComputeConsolidationData typeComputeConsolidationData,
ConsolidationData consolidationData) {
- return checkGetAttrRelationsBetweenComputesOfSameType(typeComputeConsolidationData)
- || checkGetAttrRelationsBetweenPortsOfTheSameType(serviceTemplate,
+ return areThereGetAttrRelationsBetweenComputesOfSameType(typeComputeConsolidationData)
+ || areThereGetAttrRelationsBetweenPortsOfTheSameType(serviceTemplate,
typeComputeConsolidationData, consolidationData);
}
- private boolean checkGetAttrRelationsBetweenComputesOfSameType(
+ private boolean areThereGetAttrRelationsBetweenComputesOfSameType(
TypeComputeConsolidationData typeComputeConsolidationData) {
Collection<ComputeTemplateConsolidationData> computeTemplateConsolidationEntities =
@@ -290,10 +403,11 @@ public class ConsolidationService {
typeComputeConsolidationData.getAllComputeNodeTemplateIds();
return checkGetAttrRelationsForEntityConsolidationData(
- computeTemplateConsolidationEntities, computeNodeTemplateIds);
+ computeTemplateConsolidationEntities, computeNodeTemplateIds,
+ EntityConsolidationData::getNodesGetAttrIn);
}
- private boolean checkGetAttrRelationsBetweenPortsOfTheSameType(
+ private boolean areThereGetAttrRelationsBetweenPortsOfTheSameType(
ServiceTemplate serviceTemplate,
TypeComputeConsolidationData typeComputeConsolidationData,
ConsolidationData consolidationData) {
@@ -311,7 +425,7 @@ public class ConsolidationService {
List<PortTemplateConsolidationData> portTemplateConsolidationDataOfSameType =
getAllPortTemplateConsolidationData(portsOfTheSameTypeIds, filePortConsolidationData);
if (!checkGetAttrRelationsForEntityConsolidationData(portTemplateConsolidationDataOfSameType,
- portsOfTheSameTypeIds)) {
+ portsOfTheSameTypeIds, EntityConsolidationData::getNodesGetAttrIn)) {
return false;
}
}
@@ -319,6 +433,17 @@ public class ConsolidationService {
return true;
}
+ private boolean areThereGetAttrRelationsBetweenSubInterfacesOfSameType(
+ List<String> subInterfacesIdsFromSameType,
+ List<SubInterfaceTemplateConsolidationData> subInterfaceList) {
+
+ return checkGetAttrRelationsForEntityConsolidationData(subInterfaceList,
+ subInterfacesIdsFromSameType, EntityConsolidationData::getNodesGetAttrIn)
+ || checkGetAttrRelationsForEntityConsolidationData(subInterfaceList,
+ subInterfacesIdsFromSameType, EntityConsolidationData::getNodesGetAttrOut);
+
+ }
+
private List<PortTemplateConsolidationData> getAllPortTemplateConsolidationData(
List<String> portsIds,
FilePortConsolidationData filePortConsolidationData) {
@@ -335,21 +460,19 @@ public class ConsolidationService {
return portTemplateConsolidationDataOfSameType;
}
- private boolean checkGetAttrRelationsForEntityConsolidationData(
- Collection entities,
- Collection<String> nodeTemplateIdsOfTheSameType) {
+ private boolean checkGetAttrRelationsForEntityConsolidationData(Collection entities,
+ Collection<String> nodeTemplateIdsOfTheSameType,
+ Function<EntityConsolidationData, Map<String, List<GetAttrFuncData>>> getAttrValuesMethod) {
for (Object entity : entities) {
- EntityConsolidationData currentEntity = (EntityConsolidationData) entity;
- Set<String> getAttrInNodeIds =
- currentEntity.getNodesGetAttrIn() == null ? new HashSet<>()
- : currentEntity.getNodesGetAttrIn().keySet();
- for (String nodeId : getAttrInNodeIds) {
- if (nodeTemplateIdsOfTheSameType.contains(nodeId)) {
- return true;
- }
+ Map<String, List<GetAttrFuncData>> getAttrValue =
+ getAttrValuesMethod.apply((EntityConsolidationData) entity);
+ Set<String> getAttrNodeIds =
+ getAttrValue == null ? new HashSet<>()
+ : getAttrValue.keySet();
+ if (getAttrNodeIds.stream().anyMatch(nodeTemplateIdsOfTheSameType::contains)) {
+ return true;
}
}
-
return false;
}
@@ -404,22 +527,20 @@ public class ConsolidationService {
private boolean compareNodeConnectivity(
Map<String, List<RequirementAssignmentData>> firstEntityMap,
Map<String, List<RequirementAssignmentData>> secondEntityMap) {
+
if (MapUtils.isEmpty(firstEntityMap)
&& MapUtils.isEmpty(secondEntityMap)) {
return true;
}
- if (!MapUtils.isEmpty(firstEntityMap)
- && !MapUtils.isEmpty(secondEntityMap)) {
- return firstEntityMap.keySet().equals(secondEntityMap.keySet());
- }
- return false;
+ return !MapUtils.isEmpty(firstEntityMap) && !MapUtils.isEmpty(secondEntityMap)
+ && firstEntityMap.keySet().equals(secondEntityMap.keySet());
}
private boolean checkGroupIdsRelations(EntityConsolidationData startingEntity,
EntityConsolidationData currentEntity) {
- return CollectionUtils.isEmpty(startingEntity.getGroupIds()) &&
- CollectionUtils.isEmpty(currentEntity.getGroupIds()) ||
- startingEntity.getGroupIds().equals(currentEntity.getGroupIds());
+ return CollectionUtils.isEmpty(startingEntity.getGroupIds())
+ && CollectionUtils.isEmpty(currentEntity.getGroupIds())
+ || startingEntity.getGroupIds().equals(currentEntity.getGroupIds());
}
@@ -507,7 +628,8 @@ public class ConsolidationService {
collectAllPortsTemplateConsolidationData(
portIds, serviceTemplateName, consolidationData);
- if (!checkEntityConsolidationDataRelations(portTemplateConsolidationDataList)) {
+ if (!checkEntityConsolidationDataRelations(portTemplateConsolidationDataList)
+ || !checkSubInterfaceRules(portTemplateConsolidationDataList)) {
return false;
}
}
@@ -515,10 +637,68 @@ public class ConsolidationService {
return true;
}
- private List<PortTemplateConsolidationData>
- collectAllPortsTemplateConsolidationData(List<String> portIds,
- String serviceTemplateName,
- ConsolidationData consolidationData) {
+ private boolean checkSubInterfaceRules(List<PortTemplateConsolidationData>
+ portTemplateConsolidationDataList) {
+ ListMultimap<String, SubInterfaceTemplateConsolidationData> subInterfaceTypeToEntity =
+ collectAllSubInterfacesFromSameTypeFromPorts(portTemplateConsolidationDataList);
+ List<SubInterfaceTemplateConsolidationData> subInterfaceList = new ArrayList<>(subInterfaceTypeToEntity.values());
+ return areSubInterfacePropertiesAndRelationsValid(subInterfaceList);
+ }
+
+ private boolean areSubInterfacePropertiesAndRelationsValid(
+ List<SubInterfaceTemplateConsolidationData> subInterfaceList) {
+ return isResourceGroupPropertiesSimilarBetweenSubPorts(subInterfaceList)
+ && checkSubInterfaceRelations(subInterfaceList)
+ && !areThereGetAttrRelationsBetweenSubInterfacesOfSameType(
+ getSubInterfaceIdsFromSameType(subInterfaceList), subInterfaceList);
+ }
+
+ private boolean checkSubInterfaceRelations(List<SubInterfaceTemplateConsolidationData>
+ subInterfaceList) {
+ return CollectionUtils.isEmpty(subInterfaceList)
+ || checkEntityConsolidationDataRelations(subInterfaceList);
+ }
+
+ private boolean isResourceGroupPropertiesSimilarBetweenSubPorts(
+ List<SubInterfaceTemplateConsolidationData> subInterfaceList) {
+ if (CollectionUtils.isEmpty(subInterfaceList)) {
+ return true;
+ }
+
+ SubInterfaceTemplateConsolidationData startingSubInterface = subInterfaceList.get(0);
+ for (SubInterfaceTemplateConsolidationData subInterface : subInterfaceList) {
+ if (!startingSubInterface.getResourceGroupCount().equals(subInterface.getResourceGroupCount())
+ || !StringUtils.equals(startingSubInterface.getNetworkRole(), subInterface.getNetworkRole())) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ private List<String> getSubInterfaceIdsFromSameType(List<SubInterfaceTemplateConsolidationData>
+ subInterfaceList) {
+ if (CollectionUtils.isEmpty(subInterfaceList)) {
+ return new ArrayList<>();
+ }
+
+ return subInterfaceList.stream().map(SubInterfaceTemplateConsolidationData::getNodeTemplateId)
+ .collect(Collectors.toList());
+ }
+
+ private ListMultimap<String, SubInterfaceTemplateConsolidationData> collectAllSubInterfacesFromSameTypeFromPorts(
+ List<PortTemplateConsolidationData> portTemplateConsolidationDataList) {
+ ListMultimap<String, SubInterfaceTemplateConsolidationData> subInterfaceTypeToEntity = ArrayListMultimap.create();
+ for (PortTemplateConsolidationData portTemplateConsolidationData : portTemplateConsolidationDataList) {
+ portTemplateConsolidationData.copyMappedInto(subInterfaceTypeToEntity);
+ }
+
+ return subInterfaceTypeToEntity;
+ }
+
+ private List<PortTemplateConsolidationData> collectAllPortsTemplateConsolidationData(List<String> portIds,
+ String serviceTemplateName,
+ ConsolidationData consolidationData) {
FilePortConsolidationData filePortConsolidationData =
consolidationData.getPortConsolidationData()
@@ -580,8 +760,7 @@ public class ConsolidationService {
new DuplicateResourceIdsInDifferentFilesErrorBuilder(entityNodeTemplateIds.get(i))
.build());
}
- if (propertyExistCondition !=
- isPropertyExistInNodeTemplate(propertyToCheck, currentNodeTemplate)) {
+ if (propertyExistCondition != isPropertyExistInNodeTemplate(propertyToCheck, currentNodeTemplate)) {
return false;
}
}
@@ -628,8 +807,8 @@ public class ConsolidationService {
}
private boolean isPropertyExistInNodeTemplate(String propertyToCheck, NodeTemplate nodeTemplate) {
- return !(nodeTemplate.getProperties() == null ||
- nodeTemplate.getProperties().get(propertyToCheck) == null);
+ return !(nodeTemplate.getProperties() == null
+ || nodeTemplate.getProperties().get(propertyToCheck) == null);
}
void substitutionServiceTemplateConsolidation(String substituteNodeTemplateId,
@@ -727,12 +906,17 @@ public class ConsolidationService {
FilePortConsolidationData filePortConsolidationData =
consolidationData.getPortConsolidationData().getFilePortConsolidationData(ToscaUtil
.getServiceTemplateFileName(serviceTemplate));
-
+ List<SubInterfaceTemplateConsolidationData> subInterfaceTemplateConsolidationDataList =
+ new ArrayList<>();
for (List<String> portList : portCollection) {
for (String portId : portList) {
if (!Objects.isNull(filePortConsolidationData)) {
- unifiedCompositionData.addPortTemplateConsolidationData(
- (filePortConsolidationData.getPortTemplateConsolidationData(portId)));
+ PortTemplateConsolidationData portTemplateConsolidationData =
+ filePortConsolidationData.getPortTemplateConsolidationData(portId);
+ unifiedCompositionData.addPortTemplateConsolidationData(portTemplateConsolidationData);
+ if (portTemplateConsolidationData != null) {
+ portTemplateConsolidationData.copyFlatInto(subInterfaceTemplateConsolidationDataList);
+ }
}
}
}
@@ -773,7 +957,9 @@ public class ConsolidationService {
&& isNumberOfPortFromEachTypeLegal(typeComputeConsolidationData)
&& isPortTypesEqualsBetweenComputeNodes(typeComputeConsolidationData)
&& checkGetAttrBetweenConsolidationDataEntitiesNotFromSameType(serviceTemplate,
- typeComputeConsolidationData, consolidationData));
+ typeComputeConsolidationData, consolidationData)
+ && checkSubInterfaceConsolidationPreCondition(serviceTemplate, consolidationData,
+ typeComputeConsolidationData));
}
@@ -788,7 +974,8 @@ public class ConsolidationService {
getNumberOfPortsPerCompute(typeComputeConsolidationData
.getAllComputeTemplateConsolidationData().iterator().next());
- for (ComputeTemplateConsolidationData compute : typeComputeConsolidationData.getAllComputeTemplateConsolidationData()) {
+ for (ComputeTemplateConsolidationData compute : typeComputeConsolidationData
+ .getAllComputeTemplateConsolidationData()) {
if (getNumberOfPortsPerCompute(compute) != startingNumberOfPorts) {
return false;
}
@@ -821,9 +1008,11 @@ public class ConsolidationService {
private boolean isPortTypesEqualsBetweenComputeNodes(
TypeComputeConsolidationData typeComputeConsolidationData) {
- Set<String> staringPortIds = getPortsIds(typeComputeConsolidationData.getAllComputeTemplateConsolidationData().iterator().next());
+ Set<String> staringPortIds = getPortsIds(
+ typeComputeConsolidationData.getAllComputeTemplateConsolidationData().iterator().next());
- for (ComputeTemplateConsolidationData compute : typeComputeConsolidationData.getAllComputeTemplateConsolidationData()) {
+ for (ComputeTemplateConsolidationData compute : typeComputeConsolidationData
+ .getAllComputeTemplateConsolidationData()) {
Set<String> currentPortIds = getPortsIds(compute);
if (!currentPortIds.equals(staringPortIds)) {
return false;
@@ -887,5 +1076,6 @@ public class ConsolidationService {
return propertiesThatNeedToHaveSameUsage;
}
+
}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/SubInterfaceConsolidationDataTestInfo.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/SubInterfaceConsolidationDataTestInfo.java
new file mode 100644
index 0000000000..2092eb7cc7
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/SubInterfaceConsolidationDataTestInfo.java
@@ -0,0 +1,86 @@
+package org.openecomp.sdc.translator;
+
+import org.apache.commons.lang3.tuple.Pair;
+import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.ConsolidationData;
+import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.GetAttrFuncData;
+
+import java.util.List;
+
+public class SubInterfaceConsolidationDataTestInfo {
+ private final String serviceTemplateFileName;
+ private final String portNodeTemplateId;
+ private final String subInterfaceType;
+ private final int resourceGroupCount;
+ private final String networkRole;
+ private final String subInterfaceId;
+ private final List<String> nodesConnectedIn;
+ private final List<String> nodesConnectedOut;
+ private final List<String> nodesGetAttrIn;
+ private final List<Pair<String, GetAttrFuncData>> nodesGetAttrOut;
+ private final ConsolidationData consolidationData;
+
+ public SubInterfaceConsolidationDataTestInfo(String serviceTemplateFileName,
+ String portNodeTemplateId, String subInterfaceType,
+ int resourceGroupCount, String networkRole,
+ String subInterfaceId, List<String> nodesConnectedIn,
+ List<String> nodesConnectedOut,
+ List<String> nodesGetAttrIn,
+ List<Pair<String, GetAttrFuncData>> nodesGetAttrOut,
+ ConsolidationData consolidationData) {
+ this.serviceTemplateFileName = serviceTemplateFileName;
+ this.portNodeTemplateId = portNodeTemplateId;
+ this.subInterfaceType = subInterfaceType;
+ this.resourceGroupCount = resourceGroupCount;
+ this.networkRole = networkRole;
+ this.subInterfaceId = subInterfaceId;
+ this.nodesConnectedIn = nodesConnectedIn;
+ this.nodesConnectedOut = nodesConnectedOut;
+ this.nodesGetAttrIn = nodesGetAttrIn;
+ this.nodesGetAttrOut = nodesGetAttrOut;
+ this.consolidationData = consolidationData;
+ }
+
+ public String getServiceTemplateFileName() {
+ return serviceTemplateFileName;
+ }
+
+ public String getPortNodeTemplateId() {
+ return portNodeTemplateId;
+ }
+
+ public String getSubInterfaceType() {
+ return subInterfaceType;
+ }
+
+ public int getResourceGroupCount() {
+ return resourceGroupCount;
+ }
+
+ public String getNetworkRole() {
+ return networkRole;
+ }
+
+ public String getSubInterfaceId() {
+ return subInterfaceId;
+ }
+
+ public List<String> getNodesConnectedIn() {
+ return nodesConnectedIn;
+ }
+
+ public List<String> getNodesConnectedOut() {
+ return nodesConnectedOut;
+ }
+
+ public List<String> getNodesGetAttrIn() {
+ return nodesGetAttrIn;
+ }
+
+ public List<Pair<String, GetAttrFuncData>> getNodesGetAttrOut() {
+ return nodesGetAttrOut;
+ }
+
+ public ConsolidationData getConsolidationData() {
+ return consolidationData;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/TestUtils.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/TestUtils.java
index c7d3931961..1f7167c522 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/TestUtils.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/TestUtils.java
@@ -1,21 +1,17 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
+/*
+ * Copyright © 2016-2017 European Support Limited
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END=========================================================
*/
package org.openecomp.sdc.translator;
@@ -48,6 +44,7 @@ import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolida
import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.NestedTemplateConsolidationData;
import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.PortTemplateConsolidationData;
import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.RequirementAssignmentData;
+import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.SubInterfaceTemplateConsolidationData;
import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.TypeComputeConsolidationData;
import java.io.File;
@@ -103,13 +100,14 @@ public class TestUtils {
/**
* Get tosca service template models for the files in a directory
+ *
* @param baseDirPath base directory for the tosca file
* @return Map of <ServiceTemplateFilename, ServiceTemplate> for the files in this directory
*/
- public static Map<String, ServiceTemplate> getServiceTemplates(String baseDirPath){
+ private static Map<String, ServiceTemplate> getServiceTemplates(String baseDirPath) {
Map<String, ServiceTemplate> serviceTemplateMap = new HashMap<>();
ToscaExtensionYamlUtil toscaExtensionYamlUtil = new ToscaExtensionYamlUtil();
- baseDirPath = "."+baseDirPath+"/";
+ baseDirPath = "." + baseDirPath + "/";
try {
String[] fileList = {};
URL filesDirUrl = TestUtils.class.getClassLoader().getResource(baseDirPath);
@@ -118,16 +116,16 @@ public class TestUtils {
} else {
Assert.fail("Invalid expected output files directory");
}
- for (int i = 0; i < fileList.length; i++) {
+ for (String fileName : fileList) {
- URL resource = TestUtils.class.getClassLoader().getResource(baseDirPath + fileList[i]);
+ URL resource = TestUtils.class.getClassLoader().getResource(baseDirPath + fileName);
ServiceTemplate serviceTemplate = FileUtils.readViaInputStream(resource,
- stream -> toscaExtensionYamlUtil.yamlToObject(stream, ServiceTemplate.class));
+ stream -> toscaExtensionYamlUtil.yamlToObject(stream, ServiceTemplate.class));
- serviceTemplateMap.put(fileList[i], serviceTemplate);
+ serviceTemplateMap.put(fileName, serviceTemplate);
}
} catch (Exception e) {
- logger.debug("",e);
+ logger.debug("", e);
Assert.fail(e.getMessage());
}
return serviceTemplateMap;
@@ -135,14 +133,15 @@ public class TestUtils {
/**
* Get tosca service template models
+ *
* @param expectedResultMap Map of filename and payload of the expected result files
* @return Map of <ServiceTemplateFilename, ServiceTemplate> for the files in this directory
*/
public static Map<String, ServiceTemplate> getServiceTemplates(Map<String, byte[]>
- expectedResultMap){
+ expectedResultMap) {
Map<String, ServiceTemplate> serviceTemplateMap = new HashMap<>();
ToscaExtensionYamlUtil toscaExtensionYamlUtil = new ToscaExtensionYamlUtil();
- for(String fileName : expectedResultMap.keySet()){
+ for (String fileName : expectedResultMap.keySet()) {
ServiceTemplate serviceTemplate = toscaExtensionYamlUtil.yamlToObject
(new String(expectedResultMap.get(fileName)), ServiceTemplate.class);
serviceTemplateMap.put(fileName, serviceTemplate);
@@ -181,11 +180,12 @@ public class TestUtils {
try (InputStream yamlFile = new FileInputStream(file)) {
serviceTemplateFromYaml =
toscaExtensionYamlUtil.yamlToObject(yamlFile, ServiceTemplate.class);
- createConcreteRequirementObjectsInServiceTemplate(serviceTemplateFromYaml, toscaExtensionYamlUtil);
+ createConcreteRequirementObjectsInServiceTemplate(serviceTemplateFromYaml,
+ toscaExtensionYamlUtil);
try {
yamlFile.close();
} catch (IOException ignore) {
- logger.debug("",ignore);
+ logger.debug("", ignore);
}
} catch (FileNotFoundException e) {
throw e;
@@ -226,12 +226,13 @@ public class TestUtils {
try (InputStream yamlFile = new FileInputStream(file)) {
ServiceTemplate serviceTemplateFromYaml =
toscaExtensionYamlUtil.yamlToObject(yamlFile, ServiceTemplate.class);
- createConcreteRequirementObjectsInServiceTemplate(serviceTemplateFromYaml, toscaExtensionYamlUtil);
+ createConcreteRequirementObjectsInServiceTemplate(serviceTemplateFromYaml,
+ toscaExtensionYamlUtil);
serviceTemplates.put(file.getName(), serviceTemplateFromYaml);
try {
yamlFile.close();
} catch (IOException ignore) {
- logger.debug("",ignore);
+ logger.debug("", ignore);
}
} catch (FileNotFoundException e) {
throw e;
@@ -242,9 +243,9 @@ public class TestUtils {
}
private static void createConcreteRequirementObjectsInServiceTemplate(ServiceTemplate
- serviceTemplateFromYaml,
- ToscaExtensionYamlUtil
- toscaExtensionYamlUtil) {
+ serviceTemplateFromYaml,
+ ToscaExtensionYamlUtil
+ toscaExtensionYamlUtil) {
if (serviceTemplateFromYaml == null
|| serviceTemplateFromYaml.getTopology_template() == null
@@ -262,7 +263,7 @@ public class TestUtils {
if (requirements != null) {
ListIterator<Map<String, RequirementAssignment>> reqListIterator = requirements
.listIterator();
- while (reqListIterator.hasNext()){
+ while (reqListIterator.hasNext()) {
Map<String, RequirementAssignment> requirement = reqListIterator.next();
Map<String, RequirementAssignment> concreteRequirement = new HashMap<>();
for (Map.Entry<String, RequirementAssignment> reqEntry : requirement.entrySet()) {
@@ -290,14 +291,39 @@ public class TestUtils {
List<List<String>> groupIds,
List<List<String>> getAttrInIds,
List<List<Pair<String, GetAttrFuncData>>> getAttrOutFuncDataList,
- ConsolidationData consolidationData){
- for(int i = 0; i < portNodeTemplateIds.size(); i++){
+ ConsolidationData consolidationData) {
+ for (int i = 0; i < portNodeTemplateIds.size(); i++) {
updatePortConsolidationData(serviceTemplateName, portNodeTemplateIds.get(i),
nodesConnectedInIds.get(i), nodesConnectedOutIds.get(i),
- groupIds.get(i), getAttrInIds.get(i),getAttrOutFuncDataList.get(i), consolidationData);
+ groupIds.get(i), getAttrInIds.get(i), getAttrOutFuncDataList.get(i), consolidationData);
}
}
+ public static void addPortSubInterface(
+ SubInterfaceConsolidationDataTestInfo subInterfaceConsolidationDataTestInfo) {
+ PortTemplateConsolidationData portTemplateConsolidationData =
+ subInterfaceConsolidationDataTestInfo.getConsolidationData().getPortConsolidationData().getFilePortConsolidationData
+ (subInterfaceConsolidationDataTestInfo.getServiceTemplateFileName()).getPortTemplateConsolidationData(
+ subInterfaceConsolidationDataTestInfo.getPortNodeTemplateId());
+
+ SubInterfaceTemplateConsolidationData subInterface =
+ new SubInterfaceTemplateConsolidationData();
+ subInterface.setNodeTemplateId(subInterfaceConsolidationDataTestInfo.getSubInterfaceId());
+ subInterface.setNetworkRole(subInterfaceConsolidationDataTestInfo.getNetworkRole());
+ subInterface.setResourceGroupCount(
+ subInterfaceConsolidationDataTestInfo.getResourceGroupCount());
+
+ updateRelationsForEntityConsolidationData(
+ subInterfaceConsolidationDataTestInfo.getNodesConnectedIn(),
+ subInterfaceConsolidationDataTestInfo.getNodesConnectedOut(), null,
+ subInterfaceConsolidationDataTestInfo.getNodesGetAttrIn(),
+ subInterfaceConsolidationDataTestInfo.getNodesGetAttrOut(), subInterface);
+
+ portTemplateConsolidationData.addSubInterfaceConsolidationData(
+ subInterfaceConsolidationDataTestInfo.getSubInterfaceType(), subInterface);
+
+ }
+
public static void updatePortConsolidationData(String serviceTemplateFileName,
String portNodeTemplateId,
List<String> nodesConnectedInIds,
@@ -309,8 +335,9 @@ public class TestUtils {
PortTemplateConsolidationData portTemplateConsolidationData =
createPortTemplateConsolidationData(portNodeTemplateId);
- updateRelationsForEntityConsolidationData(portNodeTemplateId, nodesConnectedInIds,
- nodesConnectedOutIds, groupIds, getAttrInIds, getAttrOutFuncDataList, portTemplateConsolidationData);
+ updateRelationsForEntityConsolidationData(nodesConnectedInIds,
+ nodesConnectedOutIds, groupIds, getAttrInIds, getAttrOutFuncDataList,
+ portTemplateConsolidationData);
consolidationData.getPortConsolidationData()
.getFilePortConsolidationData(serviceTemplateFileName)
@@ -355,8 +382,9 @@ public class TestUtils {
ComputeTemplateConsolidationData computeTemplateConsolidationData =
createComputeTemplateConsolidationData(computeNodeTemplateId, portTypeToIdList, volumes);
- updateRelationsForEntityConsolidationData(computeNodeTemplateId, nodeIdsConnectedIn,
- nodeIdsConnectedOut, groupIds, getAttrInIds, getAttrOutIds, computeTemplateConsolidationData);
+ updateRelationsForEntityConsolidationData(nodeIdsConnectedIn,
+ nodeIdsConnectedOut, groupIds, getAttrInIds, getAttrOutIds,
+ computeTemplateConsolidationData);
updateVolumes(computeTemplateConsolidationData, volumeIds);
@@ -367,27 +395,27 @@ public class TestUtils {
computeTemplateConsolidationData);
}
- private static void updateRelationsForEntityConsolidationData(String entityNodeTemplateId,
- List<String> nodeIdsConnectedIn,
+ private static void updateRelationsForEntityConsolidationData(List<String> nodeIdsConnectedIn,
List<String> nodeIdsConnectedOut,
List<String> groupIds,
List<String> getAttrInIds,
List<Pair<String, GetAttrFuncData>> getAttrOutFuncDataList,
EntityConsolidationData entity) {
updateRelationsIn(entity, nodeIdsConnectedIn);
- updateRelationsOut(entity, entityNodeTemplateId, nodeIdsConnectedOut);
+ updateRelationsOut(entity, nodeIdsConnectedOut);
updateGetAttrIn(entity, getAttrInIds);
updateGetAttrOut(entity, getAttrOutFuncDataList);
entity.setGroupIds(groupIds);
}
public static void initComputeNodeTemplateIdInConsolidationData(String serviceTemplateFileName,
- String computeNodeTypeName,
- String computeNodeTemplateId,
- ConsolidationData consolidationData) {
+ String computeNodeTypeName,
+ String computeNodeTemplateId,
+ ConsolidationData consolidationData) {
- if(Objects.isNull(consolidationData.getComputeConsolidationData().getFileComputeConsolidationData
- (serviceTemplateFileName))) {
+ if (Objects
+ .isNull(consolidationData.getComputeConsolidationData().getFileComputeConsolidationData
+ (serviceTemplateFileName))) {
consolidationData.getComputeConsolidationData().setFileComputeConsolidationData
(serviceTemplateFileName, new FileComputeConsolidationData());
}
@@ -395,36 +423,42 @@ public class TestUtils {
consolidationData.getComputeConsolidationData().getFileComputeConsolidationData
(serviceTemplateFileName).getTypeComputeConsolidationData(computeNodeTypeName);
- if(
- typeComputeConsolidationData.getComputeTemplateConsolidationData(computeNodeTemplateId) == null) {
+ if (
+ typeComputeConsolidationData.getComputeTemplateConsolidationData(computeNodeTemplateId) ==
+ null) {
consolidationData.getComputeConsolidationData()
.getFileComputeConsolidationData(serviceTemplateFileName)
.getTypeComputeConsolidationData(computeNodeTypeName)
- .setComputeTemplateConsolidationData(computeNodeTemplateId, new ComputeTemplateConsolidationData());
+ .setComputeTemplateConsolidationData(computeNodeTemplateId,
+ new ComputeTemplateConsolidationData());
}
}
public static void updateNestedConsolidationData(String serviceTemplateName,
List<String> substitutionNodeTemplateIds,
- ConsolidationData consolidationData){
- if(Objects.isNull(consolidationData.getNestedConsolidationData())){
+ ConsolidationData consolidationData) {
+ if (Objects.isNull(consolidationData.getNestedConsolidationData())) {
consolidationData.setNestedConsolidationData(new NestedConsolidationData());
}
FileNestedConsolidationData fileNestedConsolidationData = new FileNestedConsolidationData();
- for(String substitutionNodeTemplateId : substitutionNodeTemplateIds) {
- NestedTemplateConsolidationData nestedTemplateConsolidationData = new NestedTemplateConsolidationData();
+ for (String substitutionNodeTemplateId : substitutionNodeTemplateIds) {
+ NestedTemplateConsolidationData nestedTemplateConsolidationData =
+ new NestedTemplateConsolidationData();
nestedTemplateConsolidationData.setNodeTemplateId(substitutionNodeTemplateId);
- fileNestedConsolidationData.setNestedTemplateConsolidationData(substitutionNodeTemplateId, nestedTemplateConsolidationData);
+ fileNestedConsolidationData.setNestedTemplateConsolidationData(substitutionNodeTemplateId,
+ nestedTemplateConsolidationData);
}
- consolidationData.getNestedConsolidationData().setFileNestedConsolidationData(serviceTemplateName, fileNestedConsolidationData);
+ consolidationData.getNestedConsolidationData()
+ .setFileNestedConsolidationData(serviceTemplateName, fileNestedConsolidationData);
}
- public static ComputeTemplateConsolidationData createComputeTemplateConsolidationData(String computeNodeTemplateId,
- List<Pair<String, String>> portTypeToIdList,
- Map<String,List<RequirementAssignmentData>> volumes) {
+ public static ComputeTemplateConsolidationData createComputeTemplateConsolidationData(
+ String computeNodeTemplateId,
+ List<Pair<String, String>> portTypeToIdList,
+ Map<String, List<RequirementAssignmentData>> volumes) {
ComputeTemplateConsolidationData compute = new ComputeTemplateConsolidationData();
compute.setNodeTemplateId(computeNodeTemplateId);
if (portTypeToIdList != null) {
@@ -436,58 +470,58 @@ public class TestUtils {
return compute;
}
- public static void updateRelationsIn(EntityConsolidationData entity,
- List<String> idsPontingTome){
- if(CollectionUtils.isEmpty(idsPontingTome)){
+ private static void updateRelationsIn(EntityConsolidationData entity,
+ List<String> idsPontingTome) {
+ if (CollectionUtils.isEmpty(idsPontingTome)) {
return;
}
- for(String pointingId : idsPontingTome){
- entity.addNodesConnectedIn(pointingId, entity.getNodeTemplateId(), new RequirementAssignment());
+ for (String pointingId : idsPontingTome) {
+ entity
+ .addNodesConnectedIn(pointingId, entity.getNodeTemplateId(), new RequirementAssignment());
}
}
- public static void updateRelationsOut(EntityConsolidationData entity,
- String nodeTemplateId,
- List<String> idsToUpdate){
- if(CollectionUtils.isEmpty(idsToUpdate)){
+ private static void updateRelationsOut(EntityConsolidationData entity,
+ List<String> idsToUpdate) {
+ if (CollectionUtils.isEmpty(idsToUpdate)) {
return;
}
- for(String id : idsToUpdate){
+ for (String id : idsToUpdate) {
entity.addNodesConnectedOut(id, id, new RequirementAssignment());
}
}
- public static void updateGetAttrIn(EntityConsolidationData entity,
- List<String> idsToUpdate){
- if(CollectionUtils.isEmpty(idsToUpdate)){
+ private static void updateGetAttrIn(EntityConsolidationData entity,
+ List<String> idsToUpdate) {
+ if (CollectionUtils.isEmpty(idsToUpdate)) {
return;
}
- for(String id : idsToUpdate){
+ for (String id : idsToUpdate) {
entity.addNodesGetAttrIn(id, new GetAttrFuncData());
}
}
- public static void updateGetAttrOut(EntityConsolidationData entity,
- List<Pair<String, GetAttrFuncData>> getAttrOutIds){
- if(CollectionUtils.isEmpty(getAttrOutIds)){
+ private static void updateGetAttrOut(EntityConsolidationData entity,
+ List<Pair<String, GetAttrFuncData>> getAttrOutIds) {
+ if (CollectionUtils.isEmpty(getAttrOutIds)) {
return;
}
- for(Pair<String, GetAttrFuncData> getAttrOutFunc : getAttrOutIds){
+ for (Pair<String, GetAttrFuncData> getAttrOutFunc : getAttrOutIds) {
entity.addNodesGetAttrOut(getAttrOutFunc.getLeft(), getAttrOutFunc.getRight());
}
}
- public static void updateVolumes(ComputeTemplateConsolidationData compute,
- List<String> volumeIds){
- if(CollectionUtils.isEmpty(volumeIds)){
+ private static void updateVolumes(ComputeTemplateConsolidationData compute,
+ List<String> volumeIds) {
+ if (CollectionUtils.isEmpty(volumeIds)) {
return;
}
- for(String id : volumeIds){
+ for (String id : volumeIds) {
RequirementAssignment requirementAssignment = new RequirementAssignment();
requirementAssignment.setNode(id);
compute.addVolume(id, requirementAssignment);
@@ -552,9 +586,9 @@ public class TestUtils {
public static void updatePortsInComputeTemplateConsolidationData(
List<Pair<String, String>> portIdToTypeList, ComputeTemplateConsolidationData
- compute){
+ compute) {
compute.setPorts(new HashMap<>());
- for(Pair<String, String> portIdToType : portIdToTypeList){
+ for (Pair<String, String> portIdToType : portIdToTypeList) {
compute.getPorts().putIfAbsent(portIdToType.getLeft(), new ArrayList<>());
compute.getPorts().get(portIdToType.getLeft()).add(portIdToType.getRight());
}
@@ -607,12 +641,14 @@ public class TestUtils {
for (Map.Entry<String, GroupDefinition> entry : groups.entrySet()) {
String groupId = entry.getKey();
GroupDefinition groupDefinition = entry.getValue();
- if (groupDefinition.getType().contains("HeatStack"))
+ if (groupDefinition.getType().contains("HeatStack")) {
continue;
+ }
List<String> groupMembers = groupDefinition.getMembers();
for (String member : groupMembers) {
- if (groups.containsKey(member))
+ if (groups.containsKey(member)) {
continue;
+ }
if (member.equals(nodeTemplateId)) {
entityGroups.add(groupId);
}
@@ -656,5 +692,4 @@ public class TestUtils {
}
-
}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationServiceTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationServiceTest.java
index 4af2415381..63ce6b5682 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationServiceTest.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationServiceTest.java
@@ -1,11 +1,44 @@
package org.openecomp.sdc.translator.services.heattotosca;
-/**
- * Created by TALIO on 3/7/2017.
- */
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.apache.commons.lang3.tuple.Pair;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.ArgumentCaptor;
+import org.mockito.Captor;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.mockito.Spy;
+import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
+import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate;
+import org.openecomp.sdc.tosca.services.ToscaConstants;
+import org.openecomp.sdc.translator.SubInterfaceConsolidationDataTestInfo;
+import org.openecomp.sdc.translator.TestUtils;
+import org.openecomp.sdc.translator.datatypes.heattotosca.TranslationContext;
+import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.composition.UnifiedCompositionData;
+import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.composition.UnifiedCompositionMode;
+import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.ConsolidationData;
+import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.GetAttrFuncData;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
public class ConsolidationServiceTest {
- /*
+
@Spy
private TranslationContext translationContext = new TranslationContext();
private static String mainST = "MainServiceTemplate.yaml";
@@ -65,7 +98,7 @@ public class ConsolidationServiceTest {
translationContext.setConsolidationData(consolidationData);
List<UnifiedCompositionMode> expectedUnifiedModes =
- Arrays.asList(UnifiedCompositionMode.ScalingInstances);
+ Collections.singletonList(UnifiedCompositionMode.ScalingInstances);
verifyMainServiceTemplateConsolidation(1, expectedUnifiedModes, toscaServiceModel);
}
@@ -101,7 +134,7 @@ public class ConsolidationServiceTest {
translationContext.setConsolidationData(consolidationData);
List<UnifiedCompositionMode> expectedUnifiedModes =
- Arrays.asList(UnifiedCompositionMode.SingleSubstitution);
+ Collections.singletonList(UnifiedCompositionMode.SingleSubstitution);
verifyMainServiceTemplateConsolidation(1, expectedUnifiedModes, toscaServiceModel);
}
@@ -137,7 +170,7 @@ public class ConsolidationServiceTest {
translationContext.setConsolidationData(consolidationData);
List<UnifiedCompositionMode> expectedUnifiedModes =
- Arrays.asList(UnifiedCompositionMode.SingleSubstitution);
+ Collections.singletonList(UnifiedCompositionMode.SingleSubstitution);
verifyMainServiceTemplateConsolidation(1, expectedUnifiedModes, toscaServiceModel);
}
@@ -181,7 +214,7 @@ public class ConsolidationServiceTest {
translationContext.setConsolidationData(consolidationData);
List<UnifiedCompositionMode> expectedUnifiedModes =
- Arrays.asList(UnifiedCompositionMode.SingleSubstitution);
+ Collections.singletonList(UnifiedCompositionMode.SingleSubstitution);
verifyMainServiceTemplateConsolidation(1, expectedUnifiedModes, toscaServiceModel);
}
@@ -230,7 +263,7 @@ public class ConsolidationServiceTest {
translationContext.setConsolidationData(consolidationData);
List<UnifiedCompositionMode> expectedUnifiedModes =
- Arrays.asList(UnifiedCompositionMode.ScalingInstances);
+ Collections.singletonList(UnifiedCompositionMode.ScalingInstances);
verifyMainServiceTemplateConsolidation(1, expectedUnifiedModes, toscaServiceModel);
}
@@ -279,7 +312,7 @@ public class ConsolidationServiceTest {
translationContext.setConsolidationData(consolidationData);
List<UnifiedCompositionMode> expectedUnifiedModes =
- Arrays.asList(UnifiedCompositionMode.SingleSubstitution);
+ Collections.singletonList(UnifiedCompositionMode.SingleSubstitution);
verifyMainServiceTemplateConsolidation(1, expectedUnifiedModes, toscaServiceModel);
}
@@ -376,8 +409,8 @@ public class ConsolidationServiceTest {
translationContext.setConsolidationData(consolidationData);
List<UnifiedCompositionMode> expectedUnifiedModes =
- Arrays.asList(
- UnifiedCompositionMode.ScalingInstances, UnifiedCompositionMode.SingleSubstitution);
+ Arrays.asList(UnifiedCompositionMode.ScalingInstances,
+ UnifiedCompositionMode.SingleSubstitution);
verifyMainServiceTemplateConsolidation(2, expectedUnifiedModes, toscaServiceModel);
}
@@ -424,7 +457,7 @@ public class ConsolidationServiceTest {
translationContext.setConsolidationData(consolidationData);
List<UnifiedCompositionMode> expectedUnifiedModes =
- Arrays.asList(UnifiedCompositionMode.ScalingInstances);
+ Collections.singletonList(UnifiedCompositionMode.ScalingInstances);
verifyMainServiceTemplateConsolidation(1, expectedUnifiedModes, toscaServiceModel);
}
@@ -540,7 +573,7 @@ public class ConsolidationServiceTest {
translationContext.setConsolidationData(consolidationData);
List<UnifiedCompositionMode> expectedUnifiedModes =
- Arrays.asList(UnifiedCompositionMode.CatalogInstance);
+ Collections.singletonList(UnifiedCompositionMode.CatalogInstance);
verifyMainServiceTemplateConsolidation(1, expectedUnifiedModes, toscaServiceModel);
}
@@ -584,7 +617,7 @@ public class ConsolidationServiceTest {
translationContext.setConsolidationData(consolidationData);
List<UnifiedCompositionMode> expectedUnifiedModes =
- Arrays.asList(UnifiedCompositionMode.CatalogInstance);
+ Collections.singletonList(UnifiedCompositionMode.CatalogInstance);
verifyMainServiceTemplateConsolidation(1, expectedUnifiedModes, toscaServiceModel);
}
@@ -596,7 +629,8 @@ public class ConsolidationServiceTest {
("/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/one_exCP_naming_diff",
null, null);
- TestUtils.initComputeNodeTypeInConsolidationData(mainST, computeNodeTypeName, consolidationData);
+ TestUtils
+ .initComputeNodeTypeInConsolidationData(mainST, computeNodeTypeName, consolidationData);
List<Pair<String, String>> portTypeToIdList = new ArrayList<>();
portTypeToIdList.add(new ImmutablePair<>("cm01_port", "cm01_port_1"));
@@ -626,12 +660,12 @@ public class ConsolidationServiceTest {
translationContext.setConsolidationData(consolidationData);
List<UnifiedCompositionMode> expectedUnifiedModes =
- Arrays.asList(UnifiedCompositionMode.CatalogInstance);
+ Collections.singletonList(UnifiedCompositionMode.CatalogInstance);
verifyMainServiceTemplateConsolidation(1, expectedUnifiedModes, toscaServiceModel);
}
@Test
- public void testFalsePortConsolidationForOneDiffExpcNaming(){
+ public void testFalsePortConsolidationForOneDiffExpcNaming() {
}
@@ -674,7 +708,7 @@ public class ConsolidationServiceTest {
translationContext.setConsolidationData(consolidationData);
List<UnifiedCompositionMode> expectedUnifiedModes =
- Arrays.asList(UnifiedCompositionMode.CatalogInstance);
+ Collections.singletonList(UnifiedCompositionMode.CatalogInstance);
verifyMainServiceTemplateConsolidation(1, expectedUnifiedModes, toscaServiceModel);
}
@@ -717,7 +751,7 @@ public class ConsolidationServiceTest {
translationContext.setConsolidationData(consolidationData);
List<UnifiedCompositionMode> expectedUnifiedModes =
- Arrays.asList(UnifiedCompositionMode.CatalogInstance);
+ Collections.singletonList(UnifiedCompositionMode.CatalogInstance);
verifyMainServiceTemplateConsolidation(1, expectedUnifiedModes, toscaServiceModel);
}
@@ -760,7 +794,7 @@ public class ConsolidationServiceTest {
translationContext.setConsolidationData(consolidationData);
List<UnifiedCompositionMode> expectedUnifiedModes =
- Arrays.asList(UnifiedCompositionMode.CatalogInstance);
+ Collections.singletonList(UnifiedCompositionMode.CatalogInstance);
verifyMainServiceTemplateConsolidation(1, expectedUnifiedModes, toscaServiceModel);
}
@@ -799,21 +833,24 @@ public class ConsolidationServiceTest {
TestUtils.initPortConsolidationData(mainST, consolidationData);
TestUtils.updatePortConsolidationData(mainST, "cm01_port_1",
- Arrays.asList("node_in_1"), Arrays.asList("net_id_1"), Arrays.asList("group_id_1"), null,
+ Collections.singletonList("node_in_1"), Collections.singletonList("net_id_1"),
+ Collections.singletonList("group_id_1"), null,
null,
consolidationData);
TestUtils.updatePortConsolidationData(mainST, "cm01_port_2",
- Arrays.asList("node_in_1"), Arrays.asList("net_id_1"), Arrays.asList("group_id_1"), null,
+ Collections.singletonList("node_in_1"), Collections.singletonList("net_id_1"),
+ Collections.singletonList("group_id_1"), null,
null,
consolidationData);
TestUtils.updatePortConsolidationData(mainST, "cm01_port_3",
- Arrays.asList("node_in_1"), Arrays.asList("net_id_1"), Arrays.asList("group_id_1"), null,
+ Collections.singletonList("node_in_1"), Collections.singletonList("net_id_1"),
+ Collections.singletonList("group_id_1"), null,
null,
consolidationData);
translationContext.setConsolidationData(consolidationData);
List<UnifiedCompositionMode> expectedUnifiedModes =
- Arrays.asList(UnifiedCompositionMode.ScalingInstances);
+ Collections.singletonList(UnifiedCompositionMode.ScalingInstances);
verifyMainServiceTemplateConsolidation(1, expectedUnifiedModes, toscaServiceModel);
}
@@ -832,8 +869,9 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("cm01_port", "cm01_port_1"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps01", Arrays.asList("cm01_port_1"),
- Arrays.asList("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id1"),
+ computeNodeTypeName, "server_ps01", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id1"),
null, null,
portTypeToIdList,
consolidationData);
@@ -842,8 +880,9 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("cm01_port", "cm01_port_2"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps02", Arrays.asList("cm01_port_1"),
- Arrays.asList("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id1"),
+ computeNodeTypeName, "server_ps02", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id1"),
null, null,
portTypeToIdList,
consolidationData);
@@ -852,30 +891,34 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("cm01_port", "cm01_port_3"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps03", Arrays.asList("cm01_port_1"),
- Arrays.asList("cmaui_volume"),
- Arrays.asList("cmaui_volume"), Arrays.asList("group_id1"), null, null,
+ computeNodeTypeName, "server_ps03", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("cmaui_volume"), Collections.singletonList("group_id1"), null,
+ null,
portTypeToIdList,
consolidationData);
TestUtils.initPortConsolidationData(mainST, consolidationData);
TestUtils.updatePortConsolidationData(mainST, "cm01_port_1",
- Arrays.asList("node_in_1"), Arrays.asList("net_id_1"), Arrays.asList("group_id_1"), null,
+ Collections.singletonList("node_in_1"), Collections.singletonList("net_id_1"),
+ Collections.singletonList("group_id_1"), null,
null,
consolidationData);
TestUtils.updatePortConsolidationData(mainST, "cm01_port_2",
- Arrays.asList("node_in_1"), Arrays.asList("net_id_1"), Arrays.asList("group_id_1"), null,
+ Collections.singletonList("node_in_1"), Collections.singletonList("net_id_1"),
+ Collections.singletonList("group_id_1"), null,
null,
consolidationData);
TestUtils.updatePortConsolidationData(mainST, "cm01_port_3",
- Arrays.asList("node_in_1"), Arrays.asList("net_id_1"), Arrays.asList("group_id_1"), null,
+ Collections.singletonList("node_in_1"), Collections.singletonList("net_id_1"),
+ Collections.singletonList("group_id_1"), null,
null,
consolidationData);
translationContext.setConsolidationData(consolidationData);
List<UnifiedCompositionMode> expectedUnifiedModes =
- Arrays.asList(UnifiedCompositionMode.ScalingInstances);
+ Collections.singletonList(UnifiedCompositionMode.ScalingInstances);
verifyMainServiceTemplateConsolidation(1, expectedUnifiedModes, toscaServiceModel);
}
@@ -894,8 +937,10 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("cm01_port", "cm01_port_1"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps01", Arrays.asList("cm01_port_1"), Arrays.asList
- ("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id1"), null, null,
+ computeNodeTypeName, "server_ps01", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList
+ ("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id1"), null, null,
portTypeToIdList,
consolidationData);
@@ -903,8 +948,9 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("cm01_port", "cm01_port_2"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps02", Arrays.asList("cm01_port_1"),
- Arrays.asList("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id1"),
+ computeNodeTypeName, "server_ps02", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id1"),
null, null,
portTypeToIdList,
consolidationData);
@@ -913,8 +959,10 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("cm01_port", "cm01_port_3"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps03", Arrays.asList("cm01_port_2"), Arrays.asList
- ("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id1"), null, null,
+ computeNodeTypeName, "server_ps03", Collections.singletonList("cm01_port_2"),
+ Collections.singletonList
+ ("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id1"), null, null,
portTypeToIdList,
consolidationData);
@@ -925,7 +973,7 @@ public class ConsolidationServiceTest {
translationContext.setConsolidationData(consolidationData);
List<UnifiedCompositionMode> expectedUnifiedModes =
- Arrays.asList(UnifiedCompositionMode.CatalogInstance);
+ Collections.singletonList(UnifiedCompositionMode.CatalogInstance);
verifyMainServiceTemplateConsolidation(1, expectedUnifiedModes, toscaServiceModel);
}
@@ -944,8 +992,10 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("cm01_port", "cm01_port_1"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps01", Arrays.asList("cm01_port_1"), Arrays.asList
- ("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id1"), null, null,
+ computeNodeTypeName, "server_ps01", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList
+ ("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id1"), null, null,
portTypeToIdList,
consolidationData);
@@ -953,8 +1003,9 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("cm01_port", "cm01_port_2"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps02", Arrays.asList("cm01_port_1"),
- Arrays.asList("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id1"),
+ computeNodeTypeName, "server_ps02", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id1"),
null, null,
portTypeToIdList,
consolidationData);
@@ -963,8 +1014,9 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("cm01_port", "cm01_port_3"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps03", Arrays.asList("cm01_port_1"),
- Arrays.asList("cmaui_volume_1"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id1"),
+ computeNodeTypeName, "server_ps03", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList("cmaui_volume_1"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id1"),
null, null,
portTypeToIdList,
consolidationData);
@@ -976,7 +1028,7 @@ public class ConsolidationServiceTest {
translationContext.setConsolidationData(consolidationData);
List<UnifiedCompositionMode> expectedUnifiedModes =
- Arrays.asList(UnifiedCompositionMode.CatalogInstance);
+ Collections.singletonList(UnifiedCompositionMode.CatalogInstance);
verifyMainServiceTemplateConsolidation(1, expectedUnifiedModes, toscaServiceModel);
}
@@ -995,8 +1047,10 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("cm01_port", "cm01_port_1"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps01", Arrays.asList("cm01_port_1"), Arrays.asList
- ("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id1"), null, null,
+ computeNodeTypeName, "server_ps01", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList
+ ("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id1"), null, null,
portTypeToIdList,
consolidationData);
@@ -1004,8 +1058,9 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("cm01_port", "cm01_port_2"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps02", Arrays.asList("cm01_port_1"),
- Arrays.asList("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id1"),
+ computeNodeTypeName, "server_ps02", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id1"),
null, null,
portTypeToIdList,
consolidationData);
@@ -1014,8 +1069,9 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("cm01_port", "cm01_port_3"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps03", Arrays.asList("cm01_port_1"),
- Arrays.asList("cmaui_volume"), Arrays.asList("cmaui_volume_1"), Arrays.asList("group_id1"),
+ computeNodeTypeName, "server_ps03", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList("cmaui_volume"), Collections.singletonList("cmaui_volume_1"),
+ Collections.singletonList("group_id1"),
null, null,
portTypeToIdList,
consolidationData);
@@ -1027,7 +1083,7 @@ public class ConsolidationServiceTest {
translationContext.setConsolidationData(consolidationData);
List<UnifiedCompositionMode> expectedUnifiedModes =
- Arrays.asList(UnifiedCompositionMode.CatalogInstance);
+ Collections.singletonList(UnifiedCompositionMode.CatalogInstance);
verifyMainServiceTemplateConsolidation(1, expectedUnifiedModes, toscaServiceModel);
}
@@ -1046,8 +1102,10 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("cm01_port", "cm01_port_1"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps01", Arrays.asList("cm01_port_1"), Arrays.asList
- ("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id_1"), null,
+ computeNodeTypeName, "server_ps01", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList
+ ("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id_1"), null,
null,
portTypeToIdList,
consolidationData);
@@ -1056,8 +1114,9 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("cm01_port", "cm01_port_2"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps02", Arrays.asList("cm01_port_1"),
- Arrays.asList("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id_1"),
+ computeNodeTypeName, "server_ps02", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id_1"),
null, null,
portTypeToIdList,
consolidationData);
@@ -1066,8 +1125,9 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("cm01_port", "cm01_port_3"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps03", Arrays.asList("cm01_port_1"),
- Arrays.asList("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id_2"),
+ computeNodeTypeName, "server_ps03", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id_2"),
null, null,
portTypeToIdList,
consolidationData);
@@ -1079,7 +1139,7 @@ public class ConsolidationServiceTest {
translationContext.setConsolidationData(consolidationData);
List<UnifiedCompositionMode> expectedUnifiedModes =
- Arrays.asList(UnifiedCompositionMode.CatalogInstance);
+ Collections.singletonList(UnifiedCompositionMode.CatalogInstance);
verifyMainServiceTemplateConsolidation(1, expectedUnifiedModes, toscaServiceModel);
}
@@ -1098,8 +1158,10 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("cm01_port", "cm01_port_1"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps01", Arrays.asList("cm01_port_1"), Arrays.asList
- ("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id_1"), null,
+ computeNodeTypeName, "server_ps01", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList
+ ("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id_1"), null,
null,
portTypeToIdList,
consolidationData);
@@ -1108,8 +1170,9 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("cm01_port", "cm01_port_2"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps02", Arrays.asList("cm01_port_1"),
- Arrays.asList("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id_1"),
+ computeNodeTypeName, "server_ps02", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id_1"),
null, null,
portTypeToIdList,
consolidationData);
@@ -1118,29 +1181,33 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("cm01_port", "cm01_port_3"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps03", Arrays.asList("cm01_port_1"),
- Arrays.asList("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id_1"),
+ computeNodeTypeName, "server_ps03", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id_1"),
null, null,
portTypeToIdList,
consolidationData);
TestUtils.initPortConsolidationData(mainST, consolidationData);
TestUtils.updatePortConsolidationData(mainST, "cm01_port_1",
- Arrays.asList("node_in_1"), Arrays.asList("net_id_1"), Arrays.asList("group_id_1"), null,
+ Collections.singletonList("node_in_1"), Collections.singletonList("net_id_1"),
+ Collections.singletonList("group_id_1"), null,
null,
consolidationData);
TestUtils.updatePortConsolidationData(mainST, "cm01_port_2",
- Arrays.asList("node_in_1"), Arrays.asList("net_id_1"), Arrays.asList("group_id_1"), null,
+ Collections.singletonList("node_in_1"), Collections.singletonList("net_id_1"),
+ Collections.singletonList("group_id_1"), null,
null,
consolidationData);
TestUtils.updatePortConsolidationData(mainST, "cm01_port_3",
- Arrays.asList("node_in_1"), Arrays.asList("net_id_1"), Arrays.asList("group_id_1"), null,
+ Collections.singletonList("node_in_1"), Collections.singletonList("net_id_1"),
+ Collections.singletonList("group_id_1"), null,
null,
consolidationData);
translationContext.setConsolidationData(consolidationData);
List<UnifiedCompositionMode> expectedUnifiedModes =
- Arrays.asList(UnifiedCompositionMode.ScalingInstances);
+ Collections.singletonList(UnifiedCompositionMode.ScalingInstances);
verifyMainServiceTemplateConsolidation(1, expectedUnifiedModes, toscaServiceModel);
}
@@ -1159,8 +1226,10 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("cm01_port", "cm01_port_1"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps01", Arrays.asList("cm01_port_1"), Arrays.asList
- ("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id_1"), null,
+ computeNodeTypeName, "server_ps01", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList
+ ("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id_1"), null,
null,
portTypeToIdList,
consolidationData);
@@ -1169,8 +1238,9 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("cm01_port", "cm01_port_2"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps02", Arrays.asList("cm01_port_1"),
- Arrays.asList("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id_1"),
+ computeNodeTypeName, "server_ps02", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id_1"),
null, null,
portTypeToIdList,
consolidationData);
@@ -1179,29 +1249,33 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("cm01_port", "cm01_port_3"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps03", Arrays.asList("cm01_port_1"),
- Arrays.asList("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id_1"),
+ computeNodeTypeName, "server_ps03", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id_1"),
null, null,
portTypeToIdList,
consolidationData);
TestUtils.initPortConsolidationData(mainST, consolidationData);
TestUtils.updatePortConsolidationData(mainST, "cm01_port_1",
- Arrays.asList("node_in_1"), Arrays.asList("net_id_1"), Arrays.asList("group_id_1"), null,
+ Collections.singletonList("node_in_1"), Collections.singletonList("net_id_1"),
+ Collections.singletonList("group_id_1"), null,
null,
consolidationData);
TestUtils.updatePortConsolidationData(mainST, "cm01_port_2",
- Arrays.asList("node_in_1"), Arrays.asList("net_id_1"), Arrays.asList("group_id_1"), null,
+ Collections.singletonList("node_in_1"), Collections.singletonList("net_id_1"),
+ Collections.singletonList("group_id_1"), null,
null,
consolidationData);
TestUtils.updatePortConsolidationData(mainST, "cm01_port_3",
- Arrays.asList("node_in_2"), Arrays.asList("net_id_1"), Arrays.asList("group_id_1"), null,
+ Collections.singletonList("node_in_2"), Collections.singletonList("net_id_1"),
+ Collections.singletonList("group_id_1"), null,
null,
consolidationData);
translationContext.setConsolidationData(consolidationData);
List<UnifiedCompositionMode> expectedUnifiedModes =
- Arrays.asList(UnifiedCompositionMode.CatalogInstance);
+ Collections.singletonList(UnifiedCompositionMode.CatalogInstance);
verifyMainServiceTemplateConsolidation(1, expectedUnifiedModes, toscaServiceModel);
}
@@ -1220,8 +1294,10 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("cm01_port", "cm01_port_1"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps01", Arrays.asList("cm01_port_1"), Arrays.asList
- ("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id_1"), null,
+ computeNodeTypeName, "server_ps01", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList
+ ("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id_1"), null,
null,
portTypeToIdList,
consolidationData);
@@ -1230,8 +1306,9 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("cm01_port", "cm01_port_2"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps02", Arrays.asList("cm01_port_1"),
- Arrays.asList("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id_1"),
+ computeNodeTypeName, "server_ps02", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id_1"),
null, null,
portTypeToIdList,
consolidationData);
@@ -1240,29 +1317,33 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("cm01_port", "cm01_port_3"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps03", Arrays.asList("cm01_port_1"),
- Arrays.asList("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id_1"),
+ computeNodeTypeName, "server_ps03", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id_1"),
null, null,
portTypeToIdList,
consolidationData);
TestUtils.initPortConsolidationData(mainST, consolidationData);
TestUtils.updatePortConsolidationData(mainST, "cm01_port_1",
- Arrays.asList("node_in_1"), Arrays.asList("net_id_1"), Arrays.asList("group_id_1"), null,
+ Collections.singletonList("node_in_1"), Collections.singletonList("net_id_1"),
+ Collections.singletonList("group_id_1"), null,
null,
consolidationData);
TestUtils.updatePortConsolidationData(mainST, "cm01_port_2",
- Arrays.asList("node_in_1"), Arrays.asList("net_id_1"), Arrays.asList("group_id_1"), null,
+ Collections.singletonList("node_in_1"), Collections.singletonList("net_id_1"),
+ Collections.singletonList("group_id_1"), null,
null,
consolidationData);
TestUtils.updatePortConsolidationData(mainST, "cm01_port_3",
- Arrays.asList("node_in_1"), Arrays.asList("net_id_2"), Arrays.asList("group_id_1"), null,
+ Collections.singletonList("node_in_1"), Collections.singletonList("net_id_2"),
+ Collections.singletonList("group_id_1"), null,
null,
consolidationData);
translationContext.setConsolidationData(consolidationData);
List<UnifiedCompositionMode> expectedUnifiedModes =
- Arrays.asList(UnifiedCompositionMode.CatalogInstance);
+ Collections.singletonList(UnifiedCompositionMode.CatalogInstance);
verifyMainServiceTemplateConsolidation(1, expectedUnifiedModes, toscaServiceModel);
}
@@ -1281,8 +1362,10 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("cm01_port", "cm01_port_1"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps01", Arrays.asList("cm01_port_1"), Arrays.asList
- ("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id_1"), null,
+ computeNodeTypeName, "server_ps01", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList
+ ("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id_1"), null,
null,
portTypeToIdList,
consolidationData);
@@ -1291,8 +1374,9 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("cm01_port", "cm01_port_2"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps02", Arrays.asList("cm01_port_1"),
- Arrays.asList("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id_1"),
+ computeNodeTypeName, "server_ps02", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id_1"),
null, null,
portTypeToIdList,
consolidationData);
@@ -1301,29 +1385,30 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("cm01_port", "cm01_port_3"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps03", Arrays.asList("cm01_port_1"),
- Arrays.asList("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id_1"),
+ computeNodeTypeName, "server_ps03", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id_1"),
null, null,
portTypeToIdList,
consolidationData);
TestUtils.initPortConsolidationData(mainST, consolidationData);
TestUtils.updatePortConsolidationData(mainST, "cm01_port_1",
- Arrays.asList("node_in_1"), Arrays.asList("net_id_1"),
+ Collections.singletonList("node_in_1"), Collections.singletonList("net_id_1"),
Arrays.asList("group_id_1", "group_id_2"), null, null,
consolidationData);
TestUtils.updatePortConsolidationData(mainST, "cm01_port_2",
- Arrays.asList("node_in_1"), Arrays.asList("net_id_1"),
+ Collections.singletonList("node_in_1"), Collections.singletonList("net_id_1"),
Arrays.asList("group_id_1", "group_id_2"), null, null,
consolidationData);
TestUtils.updatePortConsolidationData(mainST, "cm01_port_3",
- Arrays.asList("node_in_1"), Arrays.asList("net_id_1"),
+ Collections.singletonList("node_in_1"), Collections.singletonList("net_id_1"),
Arrays.asList("group_id_1", "group_id_3"), null, null,
consolidationData);
translationContext.setConsolidationData(consolidationData);
List<UnifiedCompositionMode> expectedUnifiedModes =
- Arrays.asList(UnifiedCompositionMode.CatalogInstance);
+ Collections.singletonList(UnifiedCompositionMode.CatalogInstance);
verifyMainServiceTemplateConsolidation(1, expectedUnifiedModes, toscaServiceModel);
}
@@ -1343,9 +1428,11 @@ public class ConsolidationServiceTest {
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps01", Arrays.asList("cm01_port_1"), Arrays.asList
- ("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id_1"),
- Arrays.asList("node_1"), null,
+ computeNodeTypeName, "server_ps01", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList
+ ("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id_1"),
+ Collections.singletonList("node_1"), null,
portTypeToIdList,
consolidationData);
@@ -1353,9 +1440,10 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("cm01_port", "cm01_port_2"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps02", Arrays.asList("cm01_port_1"),
- Arrays.asList("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id_1"),
- Arrays.asList("node_2"), null,
+ computeNodeTypeName, "server_ps02", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id_1"),
+ Collections.singletonList("node_2"), null,
portTypeToIdList,
consolidationData);
@@ -1363,29 +1451,30 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("cm01_port", "cm01_port_3"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps03", Arrays.asList("cm01_port_1"),
- Arrays.asList("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id_1"),
- Arrays.asList("node_3"), null,
+ computeNodeTypeName, "server_ps03", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id_1"),
+ Collections.singletonList("node_3"), null,
portTypeToIdList,
consolidationData);
TestUtils.initPortConsolidationData(mainST, consolidationData);
TestUtils.updatePortConsolidationData(mainST, "cm01_port_1",
- Arrays.asList("node_in_1"), Arrays.asList("net_id_1"),
+ Collections.singletonList("node_in_1"), Collections.singletonList("net_id_1"),
Arrays.asList("group_id_1", "group_id_2"), null, null,
consolidationData);
TestUtils.updatePortConsolidationData(mainST, "cm01_port_2",
- Arrays.asList("node_in_1"), Arrays.asList("net_id_1"),
+ Collections.singletonList("node_in_1"), Collections.singletonList("net_id_1"),
Arrays.asList("group_id_1", "group_id_2"), null, null,
consolidationData);
TestUtils.updatePortConsolidationData(mainST, "cm01_port_3",
- Arrays.asList("node_in_1"), Arrays.asList("net_id_1"),
+ Collections.singletonList("node_in_1"), Collections.singletonList("net_id_1"),
Arrays.asList("group_id_1", "group_id_2"), null, null,
consolidationData);
translationContext.setConsolidationData(consolidationData);
List<UnifiedCompositionMode> expectedUnifiedModes =
- Arrays.asList(UnifiedCompositionMode.ScalingInstances);
+ Collections.singletonList(UnifiedCompositionMode.ScalingInstances);
verifyMainServiceTemplateConsolidation(1, expectedUnifiedModes, toscaServiceModel);
}
@@ -1405,9 +1494,11 @@ public class ConsolidationServiceTest {
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps01", Arrays.asList("cm01_port_1"), Arrays.asList
- ("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id_1"),
- Arrays.asList("server_ps02"), null,
+ computeNodeTypeName, "server_ps01", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList
+ ("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id_1"),
+ Collections.singletonList("server_ps02"), null,
portTypeToIdList,
consolidationData);
@@ -1415,9 +1506,10 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("cm01_port", "cm01_port_2"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps02", Arrays.asList("cm01_port_1"),
- Arrays.asList("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id_1"),
- Arrays.asList("node_1"), null,
+ computeNodeTypeName, "server_ps02", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id_1"),
+ Collections.singletonList("node_1"), null,
portTypeToIdList,
consolidationData);
@@ -1425,29 +1517,30 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("cm01_port", "cm01_port_3"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps03", Arrays.asList("cm01_port_1"),
- Arrays.asList("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id_1"),
- Arrays.asList("node_2"), null,
+ computeNodeTypeName, "server_ps03", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id_1"),
+ Collections.singletonList("node_2"), null,
portTypeToIdList,
consolidationData);
TestUtils.initPortConsolidationData(mainST, consolidationData);
TestUtils.updatePortConsolidationData(mainST, "cm01_port_1",
- Arrays.asList("node_in_1"), Arrays.asList("net_id_1"),
+ Collections.singletonList("node_in_1"), Collections.singletonList("net_id_1"),
Arrays.asList("group_id_1", "group_id_2"), null, null,
consolidationData);
TestUtils.updatePortConsolidationData(mainST, "cm01_port_2",
- Arrays.asList("node_in_1"), Arrays.asList("net_id_1"),
+ Collections.singletonList("node_in_1"), Collections.singletonList("net_id_1"),
Arrays.asList("group_id_1", "group_id_2"), null, null,
consolidationData);
TestUtils.updatePortConsolidationData(mainST, "cm01_port_3",
- Arrays.asList("node_in_1"), Arrays.asList("net_id_1"),
+ Collections.singletonList("node_in_1"), Collections.singletonList("net_id_1"),
Arrays.asList("group_id_1", "group_id_2"), null, null,
consolidationData);
translationContext.setConsolidationData(consolidationData);
List<UnifiedCompositionMode> expectedUnifiedModes =
- Arrays.asList(UnifiedCompositionMode.CatalogInstance);
+ Collections.singletonList(UnifiedCompositionMode.CatalogInstance);
verifyMainServiceTemplateConsolidation(1, expectedUnifiedModes, toscaServiceModel);
}
@@ -1467,8 +1560,10 @@ public class ConsolidationServiceTest {
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps01", Arrays.asList("cm01_port_1"), Arrays.asList
- ("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id_1"), null,
+ computeNodeTypeName, "server_ps01", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList
+ ("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id_1"), null,
null,
portTypeToIdList,
consolidationData);
@@ -1477,8 +1572,9 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("cm01_port", "cm01_port_2"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps02", Arrays.asList("cm01_port_1"),
- Arrays.asList("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id_1"),
+ computeNodeTypeName, "server_ps02", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id_1"),
null, null,
portTypeToIdList,
consolidationData);
@@ -1487,8 +1583,9 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("cm01_port", "cm01_port_3"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps03", Arrays.asList("cm01_port_1"),
- Arrays.asList("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id_1"),
+ computeNodeTypeName, "server_ps03", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id_1"),
null, null,
portTypeToIdList,
consolidationData);
@@ -1497,18 +1594,22 @@ public class ConsolidationServiceTest {
List<String> portNodeTemplateIds =
Arrays.asList("cm01_port_1", "cm01_port_2", "cm01_port_3");
List<List<String>> nodesConnectedInIds =
- Arrays.asList(Arrays.asList("node_in_1"), Arrays.asList("node_in_1"),
- Arrays.asList("node_in_1"));
+ Arrays.asList(Collections.singletonList("node_in_1"),
+ Collections.singletonList("node_in_1"),
+ Collections.singletonList("node_in_1"));
List<List<String>> nodesConnectedOutIds =
- Arrays.asList(Arrays.asList("node_out_1"), Arrays.asList("node_out_1"),
- Arrays.asList("node_out_1"));
+ Arrays.asList(Collections.singletonList("node_out_1"),
+ Collections.singletonList("node_out_1"),
+ Collections.singletonList("node_out_1"));
List<List<String>> getAttrInIds =
- Arrays.asList(Arrays.asList("get_attr_1"), Arrays.asList("get_attr_2"),
- Arrays.asList("get_attr_3"));
+ Arrays.asList(Collections.singletonList("get_attr_1"),
+ Collections.singletonList("get_attr_2"),
+ Collections.singletonList("get_attr_3"));
List<List<String>> groupIds =
- Arrays.asList(Arrays.asList("group_id_1", "group_id_2"), Arrays.asList("group_id_1",
- "group_id_2"), Arrays.asList("group_id_1", "group_id_2"));
- List<List<Pair<String, GetAttrFuncData>>> getAttrOut = Arrays.asList(null, null, null);
+ Arrays.asList(Arrays.asList("group_id_1", "group_id_2"),
+ Arrays.asList("group_id_1", "group_id_2"), Arrays.asList("group_id_1", "group_id_2"));
+ List<List<Pair<String, GetAttrFuncData>>> getAttrOut =
+ Arrays.asList(null, null, null);
TestUtils.updateMultiplePortConsolidationDatas(
mainST, portNodeTemplateIds, nodesConnectedInIds, nodesConnectedOutIds, groupIds,
@@ -1516,7 +1617,7 @@ public class ConsolidationServiceTest {
translationContext.setConsolidationData(consolidationData);
List<UnifiedCompositionMode> expectedUnifiedModes =
- Arrays.asList(UnifiedCompositionMode.ScalingInstances);
+ Collections.singletonList(UnifiedCompositionMode.ScalingInstances);
verifyMainServiceTemplateConsolidation(1, expectedUnifiedModes, toscaServiceModel);
}
@@ -1537,9 +1638,11 @@ public class ConsolidationServiceTest {
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps01", Arrays.asList("cm01_port_1"), Arrays.asList
- ("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id_1"),
- Arrays.asList("node_1"), null,
+ computeNodeTypeName, "server_ps01", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList
+ ("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id_1"),
+ Collections.singletonList("node_1"), null,
portTypeToIdList,
consolidationData);
@@ -1547,9 +1650,10 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("cm01_port", "cm01_port_2"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps02", Arrays.asList("cm01_port_1"),
- Arrays.asList("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id_1"),
- Arrays.asList("node_2"), null,
+ computeNodeTypeName, "server_ps02", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id_1"),
+ Collections.singletonList("node_2"), null,
portTypeToIdList,
consolidationData);
@@ -1557,9 +1661,10 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("cm01_port", "cm01_port_3"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps03", Arrays.asList("cm01_port_1"),
- Arrays.asList("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id_1"),
- Arrays.asList("node_3"), null,
+ computeNodeTypeName, "server_ps03", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id_1"),
+ Collections.singletonList("node_3"), null,
portTypeToIdList,
consolidationData);
@@ -1567,18 +1672,22 @@ public class ConsolidationServiceTest {
List<String> portNodeTemplateIds =
Arrays.asList("cm01_port_1", "cm01_port_2", "cm01_port_3");
List<List<String>> nodesConnectedInIds =
- Arrays.asList(Arrays.asList("node_in_1"), Arrays.asList("node_in_1"),
- Arrays.asList("node_in_1"));
+ Arrays.asList(Collections.singletonList("node_in_1"),
+ Collections.singletonList("node_in_1"),
+ Collections.singletonList("node_in_1"));
List<List<String>> nodesConnectedOutIds =
- Arrays.asList(Arrays.asList("node_out_1"), Arrays.asList("node_out_1"),
- Arrays.asList("node_out_1"));
+ Arrays.asList(Collections.singletonList("node_out_1"),
+ Collections.singletonList("node_out_1"),
+ Collections.singletonList("node_out_1"));
List<List<String>> getAttrInIds =
- Arrays.asList(Arrays.asList("get_attr_1"), Arrays.asList("get_attr_2"),
- Arrays.asList("cm01_port_1"));
+ Arrays.asList(Collections.singletonList("get_attr_1"),
+ Collections.singletonList("get_attr_2"),
+ Collections.singletonList("cm01_port_1"));
List<List<String>> groupIds =
- Arrays.asList(Arrays.asList("group_id_1", "group_id_2"), Arrays.asList("group_id_1",
- "group_id_2"), Arrays.asList("group_id_1", "group_id_2"));
- List<List<Pair<String, GetAttrFuncData>>> getAttrOut = Arrays.asList(null, null, null);
+ Arrays.asList(Arrays.asList("group_id_1", "group_id_2"),
+ Arrays.asList("group_id_1", "group_id_2"), Arrays.asList("group_id_1", "group_id_2"));
+ List<List<Pair<String, GetAttrFuncData>>> getAttrOut =
+ Arrays.asList(null, null, null);
TestUtils.updateMultiplePortConsolidationDatas(
mainST, portNodeTemplateIds, nodesConnectedInIds, nodesConnectedOutIds, groupIds,
@@ -1586,7 +1695,7 @@ public class ConsolidationServiceTest {
translationContext.setConsolidationData(consolidationData);
List<UnifiedCompositionMode> expectedUnifiedModes =
- Arrays.asList(UnifiedCompositionMode.CatalogInstance);
+ Collections.singletonList(UnifiedCompositionMode.CatalogInstance);
verifyMainServiceTemplateConsolidation(1, expectedUnifiedModes, toscaServiceModel);
}
@@ -1607,9 +1716,11 @@ public class ConsolidationServiceTest {
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps01", Arrays.asList("cm01_port_1"), Arrays.asList
- ("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id_1"),
- Arrays.asList("cm01_port_1"), null,
+ computeNodeTypeName, "server_ps01", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList
+ ("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id_1"),
+ Collections.singletonList("cm01_port_1"), null,
portTypeToIdList,
consolidationData);
@@ -1617,9 +1728,10 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("cm01_port", "cm01_port_2"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps02", Arrays.asList("cm01_port_1"),
- Arrays.asList("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id_1"),
- Arrays.asList("cm01_port_2"), null,
+ computeNodeTypeName, "server_ps02", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id_1"),
+ Collections.singletonList("cm01_port_2"), null,
portTypeToIdList,
consolidationData);
@@ -1627,9 +1739,10 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("cm01_port", "cm01_port_3"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps03", Arrays.asList("cm01_port_1"),
- Arrays.asList("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id_1"),
- Arrays.asList("cm01_port_3"), null,
+ computeNodeTypeName, "server_ps03", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id_1"),
+ Collections.singletonList("cm01_port_3"), null,
portTypeToIdList,
consolidationData);
@@ -1637,18 +1750,22 @@ public class ConsolidationServiceTest {
List<String> portNodeTemplateIds =
Arrays.asList("cm01_port_1", "cm01_port_2", "cm01_port_3");
List<List<String>> nodesConnectedInIds =
- Arrays.asList(Arrays.asList("node_in_1"), Arrays.asList("node_in_1"),
- Arrays.asList("node_in_1"));
+ Arrays.asList(Collections.singletonList("node_in_1"),
+ Collections.singletonList("node_in_1"),
+ Collections.singletonList("node_in_1"));
List<List<String>> nodesConnectedOutIds =
- Arrays.asList(Arrays.asList("node_out_1"), Arrays.asList("node_out_1"),
- Arrays.asList("node_out_1"));
+ Arrays.asList(Collections.singletonList("node_out_1"),
+ Collections.singletonList("node_out_1"),
+ Collections.singletonList("node_out_1"));
List<List<String>> getAttrInIds =
- Arrays.asList(Arrays.asList("get_attr_1"), Arrays.asList("get_attr_2"),
- Arrays.asList("get_attr_3"));
+ Arrays.asList(Collections.singletonList("get_attr_1"),
+ Collections.singletonList("get_attr_2"),
+ Collections.singletonList("get_attr_3"));
List<List<String>> groupIds =
- Arrays.asList(Arrays.asList("group_id_1", "group_id_2"), Arrays.asList("group_id_1",
- "group_id_2"), Arrays.asList("group_id_1", "group_id_2"));
- List<List<Pair<String, GetAttrFuncData>>> getAttrOut = Arrays.asList(null, null, null);
+ Arrays.asList(Arrays.asList("group_id_1", "group_id_2"),
+ Arrays.asList("group_id_1", "group_id_2"), Arrays.asList("group_id_1", "group_id_2"));
+ List<List<Pair<String, GetAttrFuncData>>> getAttrOut =
+ Arrays.asList(null, null, null);
TestUtils.updateMultiplePortConsolidationDatas(
mainST, portNodeTemplateIds, nodesConnectedInIds, nodesConnectedOutIds, groupIds,
@@ -1656,7 +1773,7 @@ public class ConsolidationServiceTest {
translationContext.setConsolidationData(consolidationData);
List<UnifiedCompositionMode> expectedUnifiedModes =
- Arrays.asList(UnifiedCompositionMode.ScalingInstances);
+ Collections.singletonList(UnifiedCompositionMode.ScalingInstances);
verifyMainServiceTemplateConsolidation(1, expectedUnifiedModes, toscaServiceModel);
}
@@ -1676,10 +1793,13 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("cm01_port", "cm01_port_1"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps01", Arrays.asList("cm01_port_1"), Arrays.asList
- ("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id_1"),
- Arrays.asList("cm01_port_1"),
- Arrays.asList(new ImmutablePair<String, GetAttrFuncData>("cm01_port_1", getAttrFuncData)),
+ computeNodeTypeName, "server_ps01", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList
+ ("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id_1"),
+ Collections.singletonList("cm01_port_1"),
+ Collections.singletonList(
+ new ImmutablePair<>("cm01_port_1", getAttrFuncData)),
portTypeToIdList,
consolidationData);
@@ -1687,10 +1807,12 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("cm01_port", "cm01_port_2"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps02", Arrays.asList("cm01_port_1"),
- Arrays.asList("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id_1"),
- Arrays.asList("cm01_port_1"),
- Arrays.asList(new ImmutablePair<String, GetAttrFuncData>("cm01_port_1", getAttrFuncData)),
+ computeNodeTypeName, "server_ps02", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id_1"),
+ Collections.singletonList("cm01_port_1"),
+ Collections.singletonList(
+ new ImmutablePair<>("cm01_port_1", getAttrFuncData)),
portTypeToIdList,
consolidationData);
@@ -1698,30 +1820,35 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("cm01_port", "cm01_port_3"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps03", Arrays.asList("cm01_port_1"),
- Arrays.asList("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id_1"),
- Arrays.asList("cm01_port_1"),
- Arrays.asList(new ImmutablePair<String, GetAttrFuncData>("cm01_port_1", getAttrFuncData)),
+ computeNodeTypeName, "server_ps03", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id_1"),
+ Collections.singletonList("cm01_port_1"),
+ Collections.singletonList(
+ new ImmutablePair<>("cm01_port_1", getAttrFuncData)),
portTypeToIdList,
consolidationData);
TestUtils.initPortConsolidationData(mainST, consolidationData);
TestUtils.updatePortConsolidationData(mainST, "cm01_port_1",
- Arrays.asList("node_in_1"), Arrays.asList("net_id_1"),
- Arrays.asList("group_id_1", "group_id_2"), Arrays.asList("sm01_port_2"), null,
+ Collections.singletonList("node_in_1"), Collections.singletonList("net_id_1"),
+ Arrays.asList("group_id_1", "group_id_2"),
+ Collections.singletonList("sm01_port_2"), null,
consolidationData);
TestUtils.updatePortConsolidationData(mainST, "cm01_port_2",
- Arrays.asList("node_in_1"), Arrays.asList("net_id_1"),
- Arrays.asList("group_id_1", "group_id_2"), Arrays.asList("sm01_port_1"), null,
+ Collections.singletonList("node_in_1"), Collections.singletonList("net_id_1"),
+ Arrays.asList("group_id_1", "group_id_2"),
+ Collections.singletonList("sm01_port_1"), null,
consolidationData);
TestUtils.updatePortConsolidationData(mainST, "cm01_port_3",
- Arrays.asList("node_in_1"), Arrays.asList("net_id_1"),
- Arrays.asList("group_id_1", "group_id_2"), Arrays.asList("rm01_port_1"), null,
+ Collections.singletonList("node_in_1"), Collections.singletonList("net_id_1"),
+ Arrays.asList("group_id_1", "group_id_2"),
+ Collections.singletonList("rm01_port_1"), null,
consolidationData);
translationContext.setConsolidationData(consolidationData);
List<UnifiedCompositionMode> expectedUnifiedModes =
- Arrays.asList(UnifiedCompositionMode.ScalingInstances);
+ Collections.singletonList(UnifiedCompositionMode.ScalingInstances);
verifyMainServiceTemplateConsolidation(1, expectedUnifiedModes, toscaServiceModel);
}
@@ -1742,10 +1869,13 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("sm01_port", "sm01_port_1"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps01", Arrays.asList("cm01_port_1"), Arrays.asList
- ("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id_1"),
- Arrays.asList("cm01_port_1"),
- Arrays.asList(new ImmutablePair<String, GetAttrFuncData>("cm01_port_1", getAttrFuncData)),
+ computeNodeTypeName, "server_ps01", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList
+ ("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id_1"),
+ Collections.singletonList("cm01_port_1"),
+ Collections.singletonList(
+ new ImmutablePair<>("cm01_port_1", getAttrFuncData)),
portTypeToIdList,
consolidationData);
@@ -1754,10 +1884,12 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("sm01_port", "sm01_port_2"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps02", Arrays.asList("cm01_port_1"),
- Arrays.asList("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id_1"),
- Arrays.asList("cm01_port_1"),
- Arrays.asList(new ImmutablePair<String, GetAttrFuncData>("cm01_port_1", getAttrFuncData)),
+ computeNodeTypeName, "server_ps02", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id_1"),
+ Collections.singletonList("cm01_port_1"),
+ Collections.singletonList(
+ new ImmutablePair<>("cm01_port_1", getAttrFuncData)),
portTypeToIdList,
consolidationData);
@@ -1766,37 +1898,49 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("sm01_port", "sm01_port_3"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps03", Arrays.asList("cm01_port_1"),
- Arrays.asList("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id_1"),
- Arrays.asList("cm01_port_1"),
- Arrays.asList(new ImmutablePair<String, GetAttrFuncData>("sm01_port_1", getAttrFuncData)),
+ computeNodeTypeName, "server_ps03", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id_1"),
+ Collections.singletonList("cm01_port_1"),
+ Collections.singletonList(
+ new ImmutablePair<>("sm01_port_1", getAttrFuncData)),
portTypeToIdList,
consolidationData);
TestUtils.initPortConsolidationData(mainST, consolidationData);
List<String> portNodeTemplateIds =
- Arrays.asList("cm01_port_1", "cm01_port_2", "cm01_port_3", "sm01_port_1", "sm01_port_2",
+ Arrays.asList("cm01_port_1", "cm01_port_2", "cm01_port_3", "sm01_port_1",
+ "sm01_port_2",
"sm01_port_3");
List<List<String>> nodesConnectedInIds =
- Arrays.asList(Arrays.asList("node_in_1"), Arrays.asList("node_in_1"), Arrays.asList
- ("node_in_1"), Arrays.asList("node_in_1"), Arrays.asList("node_in_1"),
- Arrays.asList("node_in_1"));
+ Arrays.asList(Collections.singletonList("node_in_1"),
+ Collections.singletonList("node_in_1"), Collections.singletonList
+ ("node_in_1"), Collections.singletonList("node_in_1"),
+ Collections.singletonList("node_in_1"),
+ Collections.singletonList("node_in_1"));
List<List<String>> nodesConnectedOutIds =
- Arrays.asList(Arrays.asList("node_out_1"), Arrays.asList("node_out_1"), Arrays.asList
- ("node_out_1"), Arrays.asList("node_out_1"), Arrays.asList("node_out_1"),
- Arrays.asList("node_out_1"));
+ Arrays.asList(Collections.singletonList("node_out_1"),
+ Collections.singletonList("node_out_1"), Collections.singletonList
+ ("node_out_1"), Collections.singletonList("node_out_1"),
+ Collections.singletonList("node_out_1"),
+ Collections.singletonList("node_out_1"));
List<List<String>> getAttrInIds =
- Arrays.asList(Arrays.asList("get_attr_1"), Arrays.asList("get_attr_2"), Arrays.asList
- ("get_attr_3"), Arrays.asList("get_attr_1"), Arrays.asList("get_attr_2"),
- Arrays.asList("get_attr_3"));
+ Arrays.asList(Collections.singletonList("get_attr_1"),
+ Collections.singletonList("get_attr_2"), Collections.singletonList
+ ("get_attr_3"), Collections.singletonList("get_attr_1"),
+ Collections.singletonList("get_attr_2"),
+ Collections.singletonList("get_attr_3"));
List<List<String>> groupIds =
- Arrays.asList(Arrays.asList("group_id_1", "group_id_2"), Arrays.asList("group_id_1",
- "group_id_2"), Arrays.asList("group_id_1", "group_id_2"),
- Arrays.asList("group_id_1", "group_id_2"), Arrays.asList("group_id_1",
+ Arrays.asList(Arrays.asList("group_id_1", "group_id_2"),
+ Arrays.asList("group_id_1",
+ "group_id_2"), Arrays.asList("group_id_1", "group_id_2"),
+ Arrays.asList("group_id_1", "group_id_2"),
+ Arrays.asList("group_id_1",
"group_id_2"), Arrays.asList("group_id_1", "group_id_2"));
- List<List<Pair<String, GetAttrFuncData>>> getAttrOut = Arrays.asList(null, null, null, null,
- null, null);
+ List<List<Pair<String, GetAttrFuncData>>> getAttrOut =
+ Arrays.asList(null, null, null, null,
+ null, null);
TestUtils.updateMultiplePortConsolidationDatas(mainST, portNodeTemplateIds,
nodesConnectedInIds, nodesConnectedOutIds, groupIds, getAttrInIds, getAttrOut,
@@ -1804,7 +1948,7 @@ public class ConsolidationServiceTest {
translationContext.setConsolidationData(consolidationData);
List<UnifiedCompositionMode> expectedUnifiedModes =
- Arrays.asList(UnifiedCompositionMode.SingleSubstitution);
+ Collections.singletonList(UnifiedCompositionMode.SingleSubstitution);
verifyMainServiceTemplateConsolidation(1, expectedUnifiedModes, toscaServiceModel);
}
@@ -1824,9 +1968,11 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("sm01_port", "sm01_port_1"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps01", Arrays.asList("cm01_port_1"), Arrays.asList
- ("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id_1"),
- Arrays.asList("cm01_port_1"), null,
+ computeNodeTypeName, "server_ps01", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList
+ ("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id_1"),
+ Collections.singletonList("cm01_port_1"), null,
portTypeToIdList,
consolidationData);
@@ -1835,9 +1981,10 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("sm01_port", "sm01_port_2"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps02", Arrays.asList("cm01_port_1"),
- Arrays.asList("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id_1"),
- Arrays.asList("cm01_port_1"), null,
+ computeNodeTypeName, "server_ps02", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id_1"),
+ Collections.singletonList("cm01_port_1"), null,
portTypeToIdList,
consolidationData);
@@ -1846,9 +1993,10 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("sm01_port", "sm01_port_3"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps03", Arrays.asList("cm01_port_1"),
- Arrays.asList("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id_1"),
- Arrays.asList("cm01_port_1"), null,
+ computeNodeTypeName, "server_ps03", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id_1"),
+ Collections.singletonList("cm01_port_1"), null,
portTypeToIdList,
consolidationData);
@@ -1856,30 +2004,43 @@ public class ConsolidationServiceTest {
GetAttrFuncData getAttrFuncData = new GetAttrFuncData("name", "s1_name");
List<String> portNodeTemplateIds =
- Arrays.asList("cm01_port_1", "cm01_port_2", "cm01_port_3", "sm01_port_1", "sm01_port_2",
+ Arrays.asList("cm01_port_1", "cm01_port_2", "cm01_port_3", "sm01_port_1",
+ "sm01_port_2",
"sm01_port_3");
List<List<String>> nodesConnectedInIds =
- Arrays.asList(Arrays.asList("node_in_1"), Arrays.asList("node_in_1"), Arrays.asList
- ("node_in_1"), Arrays.asList("node_in_1"), Arrays.asList("node_in_1"),
- Arrays.asList("node_in_1"));
+ Arrays.asList(Collections.singletonList("node_in_1"),
+ Collections.singletonList("node_in_1"), Collections.singletonList
+ ("node_in_1"), Collections.singletonList("node_in_1"),
+ Collections.singletonList("node_in_1"),
+ Collections.singletonList("node_in_1"));
List<List<String>> nodesConnectedOutIds =
- Arrays.asList(Arrays.asList("node_out_1"), Arrays.asList("node_out_1"), Arrays.asList
- ("node_out_1"), Arrays.asList("node_out_1"), Arrays.asList("node_out_1"),
- Arrays.asList("node_out_1"));
+ Arrays.asList(Collections.singletonList("node_out_1"),
+ Collections.singletonList("node_out_1"), Collections.singletonList
+ ("node_out_1"), Collections.singletonList("node_out_1"),
+ Collections.singletonList("node_out_1"),
+ Collections.singletonList("node_out_1"));
List<List<String>> getAttrInIds =
Arrays.asList(null, null, null, null, null, null);
List<List<String>> groupIds =
- Arrays.asList(Arrays.asList("group_id_1", "group_id_2"), Arrays.asList("group_id_1",
- "group_id_2"), Arrays.asList("group_id_1", "group_id_2"),
- Arrays.asList("group_id_1", "group_id_2"), Arrays.asList("group_id_1",
+ Arrays.asList(Arrays.asList("group_id_1", "group_id_2"),
+ Arrays.asList("group_id_1",
+ "group_id_2"), Arrays.asList("group_id_1", "group_id_2"),
+ Arrays.asList("group_id_1", "group_id_2"),
+ Arrays.asList("group_id_1",
"group_id_2"), Arrays.asList("group_id_1", "group_id_2"));
List<List<Pair<String, GetAttrFuncData>>> getAttrOut = Arrays.asList(
- Arrays.asList(new ImmutablePair<String, GetAttrFuncData>("sm01_port_1", getAttrFuncData)),
- Arrays.asList(new ImmutablePair<String, GetAttrFuncData>("sm01_port_2", getAttrFuncData)),
- Arrays.asList(new ImmutablePair<String, GetAttrFuncData>("sm01_port_3", getAttrFuncData)),
- Arrays.asList(new ImmutablePair<String, GetAttrFuncData>("cm01_port_1", getAttrFuncData)),
- Arrays.asList(new ImmutablePair<String, GetAttrFuncData>("cm01_port_2", getAttrFuncData)),
- Arrays.asList(new ImmutablePair<String, GetAttrFuncData>("cm01_port_3", getAttrFuncData)));
+ Collections.singletonList(
+ new ImmutablePair<>("sm01_port_1", getAttrFuncData)),
+ Collections.singletonList(
+ new ImmutablePair<>("sm01_port_2", getAttrFuncData)),
+ Collections.singletonList(
+ new ImmutablePair<>("sm01_port_3", getAttrFuncData)),
+ Collections.singletonList(
+ new ImmutablePair<>("cm01_port_1", getAttrFuncData)),
+ Collections.singletonList(
+ new ImmutablePair<>("cm01_port_2", getAttrFuncData)),
+ Collections.singletonList(
+ new ImmutablePair<>("cm01_port_3", getAttrFuncData)));
TestUtils.updateMultiplePortConsolidationDatas(mainST, portNodeTemplateIds,
nodesConnectedInIds, nodesConnectedOutIds, groupIds, getAttrInIds, getAttrOut,
@@ -1887,7 +2048,7 @@ public class ConsolidationServiceTest {
translationContext.setConsolidationData(consolidationData);
List<UnifiedCompositionMode> expectedUnifiedModes =
- Arrays.asList(UnifiedCompositionMode.ScalingInstances);
+ Collections.singletonList(UnifiedCompositionMode.ScalingInstances);
verifyMainServiceTemplateConsolidation(1, expectedUnifiedModes, toscaServiceModel);
}
@@ -1907,9 +2068,11 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("sm01_port", "sm01_port_1"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps01", Arrays.asList("cm01_port_1"), Arrays.asList
- ("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id_1"),
- Arrays.asList("cm01_port_1"), null,
+ computeNodeTypeName, "server_ps01", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList
+ ("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id_1"),
+ Collections.singletonList("cm01_port_1"), null,
portTypeToIdList,
consolidationData);
@@ -1918,9 +2081,10 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("sm01_port", "sm01_port_2"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps02", Arrays.asList("cm01_port_1"),
- Arrays.asList("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id_1"),
- Arrays.asList("cm01_port_1"), null,
+ computeNodeTypeName, "server_ps02", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id_1"),
+ Collections.singletonList("cm01_port_1"), null,
portTypeToIdList,
consolidationData);
@@ -1929,9 +2093,10 @@ public class ConsolidationServiceTest {
portTypeToIdList.add(new ImmutablePair<>("sm01_port", "sm01_port_3"));
TestUtils.updateComputeTemplateConsolidationData(
mainST,
- computeNodeTypeName, "server_ps03", Arrays.asList("cm01_port_1"),
- Arrays.asList("cmaui_volume"), Arrays.asList("cmaui_volume"), Arrays.asList("group_id_1"),
- Arrays.asList("cm01_port_1"), null,
+ computeNodeTypeName, "server_ps03", Collections.singletonList("cm01_port_1"),
+ Collections.singletonList("cmaui_volume"), Collections.singletonList("cmaui_volume"),
+ Collections.singletonList("group_id_1"),
+ Collections.singletonList("cm01_port_1"), null,
portTypeToIdList,
consolidationData);
@@ -1939,30 +2104,42 @@ public class ConsolidationServiceTest {
GetAttrFuncData getAttrFuncData = new GetAttrFuncData("name", "s1_name");
List<String> portNodeTemplateIds =
- Arrays.asList("cm01_port_1", "cm01_port_2", "cm01_port_3", "sm01_port_1", "sm01_port_2",
+ Arrays.asList("cm01_port_1", "cm01_port_2", "cm01_port_3", "sm01_port_1",
+ "sm01_port_2",
"sm01_port_3");
List<List<String>> nodesConnectedInIds =
- Arrays.asList(Arrays.asList("node_in_1"), Arrays.asList("node_in_1"), Arrays.asList
- ("node_in_1"), Arrays.asList("node_in_1"), Arrays.asList("node_in_1"),
- Arrays.asList("node_in_1"));
+ Arrays.asList(Collections.singletonList("node_in_1"),
+ Collections.singletonList("node_in_1"), Collections.singletonList
+ ("node_in_1"), Collections.singletonList("node_in_1"),
+ Collections.singletonList("node_in_1"),
+ Collections.singletonList("node_in_1"));
List<List<String>> nodesConnectedOutIds =
- Arrays.asList(Arrays.asList("node_out_1"), Arrays.asList("node_out_1"), Arrays.asList
- ("node_out_1"), Arrays.asList("node_out_1"), Arrays.asList("node_out_1"),
- Arrays.asList("node_out_1"));
+ Arrays.asList(Collections.singletonList("node_out_1"),
+ Collections.singletonList("node_out_1"), Collections.singletonList
+ ("node_out_1"), Collections.singletonList("node_out_1"),
+ Collections.singletonList("node_out_1"),
+ Collections.singletonList("node_out_1"));
List<List<String>> getAttrInIds =
Arrays.asList(null, null, null, null, null, null);
List<List<String>> groupIds =
- Arrays.asList(Arrays.asList("group_id_1", "group_id_2"), Arrays.asList("group_id_1",
- "group_id_2"), Arrays.asList("group_id_1", "group_id_2"),
- Arrays.asList("group_id_1", "group_id_2"), Arrays.asList("group_id_1",
+ Arrays.asList(Arrays.asList("group_id_1", "group_id_2"),
+ Arrays.asList("group_id_1", "group_id_2"), Arrays.asList("group_id_1", "group_id_2"),
+ Arrays.asList("group_id_1", "group_id_2"),
+ Arrays.asList("group_id_1",
"group_id_2"), Arrays.asList("group_id_1", "group_id_2"));
List<List<Pair<String, GetAttrFuncData>>> getAttrOut = Arrays.asList(
- Arrays.asList(new ImmutablePair<String, GetAttrFuncData>("server_ps01", getAttrFuncData)),
- Arrays.asList(new ImmutablePair<String, GetAttrFuncData>("server_ps01", getAttrFuncData)),
- Arrays.asList(new ImmutablePair<String, GetAttrFuncData>("sm01_port_3", getAttrFuncData)),
- Arrays.asList(new ImmutablePair<String, GetAttrFuncData>("cm01_port_1", getAttrFuncData)),
- Arrays.asList(new ImmutablePair<String, GetAttrFuncData>("cm01_port_2", getAttrFuncData)),
- Arrays.asList(new ImmutablePair<String, GetAttrFuncData>("cm01_port_3", getAttrFuncData)));
+ Collections.singletonList(
+ new ImmutablePair<>("server_ps01", getAttrFuncData)),
+ Collections.singletonList(
+ new ImmutablePair<>("server_ps01", getAttrFuncData)),
+ Collections.singletonList(
+ new ImmutablePair<>("sm01_port_3", getAttrFuncData)),
+ Collections.singletonList(
+ new ImmutablePair<>("cm01_port_1", getAttrFuncData)),
+ Collections.singletonList(
+ new ImmutablePair<>("cm01_port_2", getAttrFuncData)),
+ Collections.singletonList(
+ new ImmutablePair<>("cm01_port_3", getAttrFuncData)));
TestUtils.updateMultiplePortConsolidationDatas(mainST, portNodeTemplateIds,
nodesConnectedInIds, nodesConnectedOutIds, groupIds, getAttrInIds, getAttrOut,
@@ -1970,7 +2147,7 @@ public class ConsolidationServiceTest {
translationContext.setConsolidationData(consolidationData);
List<UnifiedCompositionMode> expectedUnifiedModes =
- Arrays.asList(UnifiedCompositionMode.SingleSubstitution);
+ Collections.singletonList(UnifiedCompositionMode.SingleSubstitution);
verifyMainServiceTemplateConsolidation(1, expectedUnifiedModes, toscaServiceModel);
}
@@ -1981,7 +2158,7 @@ public class ConsolidationServiceTest {
String nestedServiceTemplateName = "nested-pcm_v0.1ServiceTemplate.yaml";
ConsolidationData consolidationData = new ConsolidationData();
- TestUtils.updateNestedConsolidationData(mainSTName, Arrays.asList("server_pcm_001"),
+ TestUtils.updateNestedConsolidationData(mainSTName, Collections.singletonList("server_pcm_001"),
consolidationData);
TestUtils.initComputeNodeTypeInConsolidationData(mainSTName,
"org.openecomp.resource.vfc.nodes.heat" +
@@ -2014,7 +2191,7 @@ public class ConsolidationServiceTest {
String nestedServiceTemplateName = "nested-pcm_v0.1ServiceTemplate.yaml";
ConsolidationData consolidationData = new ConsolidationData();
- TestUtils.updateNestedConsolidationData(mainSTName, Arrays.asList("server_pcm_001"),
+ TestUtils.updateNestedConsolidationData(mainSTName, Collections.singletonList("server_pcm_001"),
consolidationData);
TestUtils.initComputeNodeTypeInConsolidationData(mainSTName,
"org.openecomp.resource.vfc.nodes.heat" +
@@ -2026,7 +2203,7 @@ public class ConsolidationServiceTest {
"org.openecomp.resource.vfc.nodes.heat" +
".pcm_server", consolidationData);
- TestUtils.updateNestedConsolidationData(mainSTName, Arrays.asList("server_oam_001"),
+ TestUtils.updateNestedConsolidationData(mainSTName, Collections.singletonList("server_oam_001"),
consolidationData);
TestUtils.initComputeNodeTypeInConsolidationData(mainSTName,
"org.openecomp.resource.vfc.nodes.heat" +
@@ -2056,7 +2233,7 @@ public class ConsolidationServiceTest {
String nestedServiceTemplateName = "nested-pcm_v0.1ServiceTemplate.yaml";
ConsolidationData consolidationData = new ConsolidationData();
- TestUtils.updateNestedConsolidationData(mainSTName, Arrays.asList("server_pcm_001"),
+ TestUtils.updateNestedConsolidationData(mainSTName, Collections.singletonList("server_pcm_001"),
consolidationData);
TestUtils.initComputeNodeTypeInConsolidationData(nestedServiceTemplateName,
"org.openecomp.resource.vfc.nodes.heat" +
@@ -2069,7 +2246,8 @@ public class ConsolidationServiceTest {
".heat.pcm_server", "pcm_server_1", consolidationData);
TestUtils
- .updateNestedConsolidationData(nestedServiceTemplateName, Arrays.asList("server_pcm_002"),
+ .updateNestedConsolidationData(nestedServiceTemplateName,
+ Collections.singletonList("server_pcm_002"),
consolidationData);
TestUtils.initComputeNodeTemplateIdInConsolidationData(nestedServiceTemplateName,
"org.openecomp.resource.vfc.nodes" +
@@ -2081,7 +2259,8 @@ public class ConsolidationServiceTest {
addMockServiceTemplateToContext(nestedServiceTemplateName, "nested-pcm_v0.1");
Mockito.doNothing().when(consolidationService).serviceTemplateConsolidation
- (translationContext.getTranslatedServiceTemplates().get(nestedServiceTemplateName), translationContext);
+ (translationContext.getTranslatedServiceTemplates().get(nestedServiceTemplateName),
+ translationContext);
verifySubstitutionServiceTemplateConsolidation
(1, translationContext.getTranslatedServiceTemplates().get(mainSTName),
translationContext.getTranslatedServiceTemplates().get(nestedServiceTemplateName),
@@ -2095,7 +2274,7 @@ public class ConsolidationServiceTest {
String nestedServiceTemplateName = "nested-pcm_v0.1ServiceTemplate.yaml";
ConsolidationData consolidationData = new ConsolidationData();
- TestUtils.updateNestedConsolidationData(mainSTName, Arrays.asList("server_pcm_001"),
+ TestUtils.updateNestedConsolidationData(mainSTName, Collections.singletonList("server_pcm_001"),
consolidationData);
TestUtils.initComputeNodeTypeInConsolidationData(mainSTName,
"org.openecomp.resource.vfc.nodes.heat" +
@@ -2110,7 +2289,8 @@ public class ConsolidationServiceTest {
".heat.pcm_server", "pcm_server", consolidationData);
TestUtils
- .updateNestedConsolidationData(nestedServiceTemplateName, Arrays.asList("nested_resource"),
+ .updateNestedConsolidationData(nestedServiceTemplateName,
+ Collections.singletonList("nested_resource"),
consolidationData);
translationContext.setConsolidationData(consolidationData);
@@ -2124,6 +2304,300 @@ public class ConsolidationServiceTest {
UnifiedCompositionMode.SingleSubstitution);
}
+ @Test
+ public void testConsolidationPreConditionFalseDiffSubportTypes() throws IOException {
+ translationContext = new TranslationContext();
+ String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server";
+ ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel
+ ("/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/different_subinterface_types",
+ null, null);
+
+ ConsolidationData consolidationData = new ConsolidationData();
+ generateComputeAndPortConsolidationData(computeNodeTypeName, consolidationData);
+
+ TestUtils
+ .addPortSubInterface(
+ new SubInterfaceConsolidationDataTestInfo(mainST, "cm01_port_1", "nested1.yaml", 2,
+ "role_1", "interface_1", null, null, null, null, consolidationData));
+ TestUtils
+ .addPortSubInterface(
+ new SubInterfaceConsolidationDataTestInfo(mainST, "cm01_port_2", "nested2.yaml", 2,
+ "role_2", "interface_2", null, null, null, null, consolidationData));
+ testConsolidation(1, toscaServiceModel, consolidationData, Collections.singletonList(UnifiedCompositionMode.SingleSubstitution));
+ }
+
+ private void generateComputeAndPortConsolidationData(String computeNodeTypeName,
+ ConsolidationData consolidationData) {
+ TestUtils
+ .initComputeNodeTypeInConsolidationData(mainST, computeNodeTypeName, consolidationData);
+
+ updateComputeConsolidationData("server_ps01", computeNodeTypeName, "cm01_port",
+ "cm01_port_1", consolidationData);
+
+ updateComputeConsolidationData("server_ps02", computeNodeTypeName, "cm01_port",
+ "cm01_port_2", consolidationData);
+
+ TestUtils.initPortConsolidationData(mainST, consolidationData);
+ TestUtils.updatePortConsolidationData(mainST, "cm01_port_1",
+ null, null, null, null, null,
+ consolidationData);
+ TestUtils.updatePortConsolidationData(mainST, "cm01_port_2",
+ null, null, null, null, null,
+ consolidationData);
+ }
+
+ @Test
+ public void testConsolidationPreConditionFalseDiffSubportNumber() throws IOException {
+ translationContext = new TranslationContext();
+ String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server";
+ ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel
+ ("/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/different_subinterface_types",
+ null, null);
+
+ ConsolidationData consolidationData = new ConsolidationData();
+ generateComputeAndPortConsolidationData(computeNodeTypeName, consolidationData);
+
+ TestUtils
+ .addPortSubInterface(
+ new SubInterfaceConsolidationDataTestInfo(mainST, "cm01_port_1", "nested1.yaml", 2,
+ "role_1", "interface_1", null, null, null, null, consolidationData));
+ TestUtils
+ .addPortSubInterface(
+ new SubInterfaceConsolidationDataTestInfo(mainST, "cm01_port_2", "nested1.yaml", 2,
+ "role_2", "interface_2", null, null, null, null, consolidationData));
+ TestUtils
+ .addPortSubInterface(
+ new SubInterfaceConsolidationDataTestInfo(mainST, "cm01_port_2", "nested1.yaml", 2,
+ "role_3", "interface_3", null, null, null, null, consolidationData));
+
+ testConsolidation(1, toscaServiceModel,
+ consolidationData, Collections.singletonList(UnifiedCompositionMode.SingleSubstitution));
+ }
+
+ @Test
+ public void testConsolidationRuleFalseDifferentCountInResourceGroup() throws IOException {
+ translationContext = new TranslationContext();
+ String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server";
+ ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel
+ ("/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/different_subinterface_types",
+ null, null);
+
+ ConsolidationData consolidationData = new ConsolidationData();
+ generateComputeAndPortConsolidationData(computeNodeTypeName, consolidationData);
+
+ TestUtils
+ .addPortSubInterface(
+ new SubInterfaceConsolidationDataTestInfo(mainST, "cm01_port_1", "nested1.yaml", 2,
+ "role_1", "interface_1", null, null, null, null, consolidationData));
+ TestUtils
+ .addPortSubInterface(
+ new SubInterfaceConsolidationDataTestInfo(mainST, "cm01_port_2", "nested1.yaml", 3,
+ "role_1", "interface_2", null, null, null, null, consolidationData));
+
+ testConsolidation(1, toscaServiceModel,
+ consolidationData, Collections.singletonList(UnifiedCompositionMode.CatalogInstance));
+ }
+
+ @Test
+ public void testConsolidationRuleFalseDifferentNodesConnectedInToResourceGroup()
+ throws IOException {
+ translationContext = new TranslationContext();
+ String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server";
+ ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel
+ ("/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/different_subinterface_types",
+ null, null);
+
+ ConsolidationData consolidationData = new ConsolidationData();
+ generateComputeAndPortConsolidationData(computeNodeTypeName, consolidationData);
+
+ TestUtils
+ .addPortSubInterface(
+ new SubInterfaceConsolidationDataTestInfo(mainST, "cm01_port_1", "nested1.yaml", 2,
+ "role_1", "interface_1", Collections.singletonList("node_1"), null, null, null,
+ consolidationData));
+ TestUtils
+ .addPortSubInterface(
+ new SubInterfaceConsolidationDataTestInfo(mainST, "cm01_port_2", "nested1.yaml", 2,
+ "role_1", "interface_2", Collections.singletonList("node_2"), null, null, null,
+ consolidationData));
+
+ testConsolidation(1, toscaServiceModel, consolidationData, Collections.singletonList(UnifiedCompositionMode.CatalogInstance));
+ }
+
+ @Test
+ public void testConsolidationRuleFalseDifferentNodesConnectedOutFromResourceGroup()
+ throws IOException {
+ translationContext = new TranslationContext();
+ String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server";
+ ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel
+ ("/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/different_subinterface_types",
+ null, null);
+
+ ConsolidationData consolidationData = new ConsolidationData();
+ generateComputeAndPortConsolidationData(computeNodeTypeName, consolidationData);
+
+ TestUtils
+ .addPortSubInterface(
+ new SubInterfaceConsolidationDataTestInfo(mainST, "cm01_port_1", "nested1.yaml", 2,
+ "role_1", "interface_1", null, Collections.singletonList("node_1"), null, null,
+ consolidationData));
+ TestUtils
+ .addPortSubInterface(
+ new SubInterfaceConsolidationDataTestInfo(mainST, "cm01_port_2", "nested1.yaml", 2,
+ "role_1", "interface_2", null, Collections.singletonList("node_2"), null, null,
+ consolidationData));
+
+ testConsolidation(1, toscaServiceModel, consolidationData, Collections.singletonList(UnifiedCompositionMode.CatalogInstance));
+ }
+
+ @Test
+ public void testConsolidationRuleFalseGetAttrInBetweenSubInterfacesOfSameType()
+ throws IOException {
+ translationContext = new TranslationContext();
+ String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server";
+ ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel
+ ("/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/different_subinterface_types",
+ null, null);
+
+ ConsolidationData consolidationData = new ConsolidationData();
+ generateComputeAndPortConsolidationData(computeNodeTypeName, consolidationData);
+
+ TestUtils
+ .addPortSubInterface(
+ new SubInterfaceConsolidationDataTestInfo(mainST, "cm01_port_1", "nested1.yaml", 2,
+ "role_1", "interface_1", null, null, Collections.singletonList("in_node_1"), null,
+ consolidationData));
+ TestUtils
+ .addPortSubInterface(
+ new SubInterfaceConsolidationDataTestInfo(mainST, "cm01_port_2", "nested1.yaml", 2,
+ "role_1", "interface_2", null, null, Collections.singletonList("interface_1"), null,
+ consolidationData));
+
+ testConsolidation(1, toscaServiceModel, consolidationData, Collections.singletonList(UnifiedCompositionMode.CatalogInstance));
+ }
+
+ @Test
+ public void testConsolidationRuleFalseGetAttrOutBetweenSubInterfacesOfSameType()
+ throws IOException {
+ translationContext = new TranslationContext();
+ String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server";
+ ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel
+ ("/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/different_subinterface_types",
+ null, null);
+
+ ConsolidationData consolidationData = new ConsolidationData();
+ TestUtils
+ .initComputeNodeTypeInConsolidationData(mainST, computeNodeTypeName, consolidationData);
+
+ updateComputeConsolidationData("server_ps01", computeNodeTypeName, "cm01_port",
+ "cm01_port_1", consolidationData);
+ updateComputeConsolidationData("server_ps02", computeNodeTypeName, "cm01_port",
+ "cm01_port_2", consolidationData);
+
+ GetAttrFuncData getAttrFuncData = new GetAttrFuncData("name", "c1_name");
+ Pair<String, GetAttrFuncData> getAttrOutInvalid1 =
+ new ImmutablePair<>("interface_1", getAttrFuncData);
+ Pair<String, GetAttrFuncData> getAttrOutInvalid2 =
+ new ImmutablePair<>("interface_2", getAttrFuncData);
+
+ TestUtils.initPortConsolidationData(mainST, consolidationData);
+ TestUtils.updatePortConsolidationData(mainST, "cm01_port_1",
+ null, null, null, null, null,
+ consolidationData);
+ TestUtils.updatePortConsolidationData(mainST, "cm01_port_2",
+ null, null, null, null, null,
+ consolidationData);
+
+ TestUtils
+ .addPortSubInterface(
+ new SubInterfaceConsolidationDataTestInfo(mainST, "cm01_port_1", "nested1.yaml", 2,
+ "role_1", "interface_1", null, null, null,
+ Collections.singletonList(getAttrOutInvalid1), consolidationData));
+ TestUtils
+ .addPortSubInterface(
+ new SubInterfaceConsolidationDataTestInfo(mainST, "cm01_port_2", "nested1.yaml", 2,
+ "role_1", "interface_2", null, null, null,
+ Collections.singletonList(getAttrOutInvalid2), consolidationData));
+
+ testConsolidation(1, toscaServiceModel, consolidationData, Collections.singletonList(UnifiedCompositionMode.CatalogInstance));
+ }
+
+ @Test
+ public void testConsolidationRuleFalseDifferentRoleInResourceGroup() throws IOException {
+ translationContext = new TranslationContext();
+ String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server";
+ ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel
+ ("/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/different_subinterface_types",
+ null, null);
+
+ ConsolidationData consolidationData = new ConsolidationData();
+ generateComputeAndPortConsolidationData(computeNodeTypeName, consolidationData);
+
+ TestUtils
+ .addPortSubInterface(
+ new SubInterfaceConsolidationDataTestInfo(mainST, "cm01_port_1", "nested1.yaml", 2,
+ "role_1", "interface_1", null, null, null, null, consolidationData));
+ TestUtils
+ .addPortSubInterface(
+ new SubInterfaceConsolidationDataTestInfo(mainST, "cm01_port_2", "nested1.yaml", 2,
+ "role_2", "interface_2", null, null, null, null, consolidationData));
+
+ testConsolidation(1, toscaServiceModel, consolidationData, Collections.singletonList(UnifiedCompositionMode.CatalogInstance));
+ }
+
+ @Test
+ public void testConsolidationRuleTrueForSubInterfaces() throws IOException {
+ translationContext = new TranslationContext();
+ String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server";
+ ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel
+ ("/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/different_subinterface_types",
+ null, null);
+
+ ConsolidationData consolidationData = new ConsolidationData();
+ generateComputeAndPortConsolidationData(computeNodeTypeName, consolidationData);
+
+ TestUtils
+ .addPortSubInterface(
+ new SubInterfaceConsolidationDataTestInfo(mainST, "cm01_port_1", "nested1.yaml", 2,
+ "role_1", "interface_1", Collections.singletonList("node_1"),
+ Collections.singletonList("node_1"), null, null, consolidationData));
+ TestUtils
+ .addPortSubInterface(
+ new SubInterfaceConsolidationDataTestInfo(mainST, "cm01_port_2", "nested1.yaml", 2,
+ "role_1", "interface_2", Collections.singletonList("node_1"),
+ Collections.singletonList("node_1"), null, null, consolidationData));
+
+ testConsolidation(1, toscaServiceModel, consolidationData, Collections.singletonList(UnifiedCompositionMode.ScalingInstances));
+ }
+
+ private void testConsolidation(int times, ToscaServiceModel toscaServiceModel,
+ ConsolidationData consolidationData,
+ List<UnifiedCompositionMode> expectedUnifiedModes) {
+ Mockito.doNothing().when(unifiedCompositionServiceMock).createUnifiedComposition(
+ any(),
+ any(),
+ any(),
+ any(),
+ any());
+ translationContext.setConsolidationData(consolidationData);
+ verifyMainServiceTemplateConsolidation(times, expectedUnifiedModes, toscaServiceModel);
+ }
+
+ private void updateComputeConsolidationData(String computeNodeTemplateId,
+ String computeNodeTypeName,
+ String portType,
+ String portNodeTemplateId,
+ ConsolidationData consolidationData) {
+ List<Pair<String, String>> portTypeToIdList = new ArrayList<>();
+ portTypeToIdList.add(new ImmutablePair<>(portType, portNodeTemplateId));
+
+ TestUtils.updateComputeTemplateConsolidationData(
+ mainST,
+ computeNodeTypeName, computeNodeTemplateId,
+ null, null, null, null, null, null,
+ portTypeToIdList, consolidationData);
+ }
+
private void verifyMainServiceTemplateConsolidation(int times,
List<UnifiedCompositionMode> expectedUnifiedCompositionModes,
@@ -2176,5 +2650,4 @@ public class ConsolidationServiceTest {
.put(serviceTemplateFileName, serviceTemplate);
}
- */
}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java
index 19f4d59514..17383a9a10 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright © 2016-2017 European Support Limited
+ * Copyright © 2016-2018 European Support Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,6 +16,8 @@
package org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation;
+import static org.junit.Assert.assertEquals;
+
import org.apache.commons.collections4.MapUtils;
import org.junit.AfterClass;
import org.junit.Assert;
@@ -51,8 +53,6 @@ import java.util.Set;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
-import static org.junit.Assert.assertEquals;
-
public class BaseFullTranslationTest {
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/different_subinterface_types/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/different_subinterface_types/MainServiceTemplate.yaml
new file mode 100644
index 0000000000..d575e26ff9
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/different_subinterface_types/MainServiceTemplate.yaml
@@ -0,0 +1,207 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+metadata:
+ template_name: Main
+imports:
+- CommonGlobalTypes:
+ file: CommonGlobalTypesServiceTemplate.yaml
+- NovaServerGlobalTypes:
+ file: NovaServerGlobalTypesServiceTemplate.yaml
+- NeutronPortGlobalTypes:
+ file: NeutronPortGlobalTypesServiceTemplate.yaml
+- NeutronSecurityRulesGlobalTypes:
+ file: NeutronSecurityRulesGlobalTypesServiceTemplate.yaml
+- NeutronNetGlobalTypes:
+ file: NeutronNetGlobalTypesServiceTemplate.yaml
+- CinderVolumeGlobalTypes:
+ file: CinderVolumeGlobalTypesServiceTemplate.yaml
+- ContrailVirtualNetworkGlobalType:
+ file: ContrailVirtualNetworkGlobalTypeServiceTemplate.yaml
+- ContrailNetworkRuleGlobalType:
+ file: ContrailNetworkRuleGlobalTypeServiceTemplate.yaml
+- AbstractSubstituteGlobalTypes:
+ file: AbstractSubstituteGlobalTypesServiceTemplate.yaml
+- ContrailV2VirtualMachineInterfaceGlobalType:
+ file: ContrailV2VirtualMachineInterfaceGlobalTypeServiceTemplate.yaml
+- ContrailComputeGlobalTypes:
+ file: ContrailComputeGlobalTypesServiceTemplate.yaml
+- ContrailPortGlobalTypes:
+ file: ContrailPortGlobalTypesServiceTemplate.yaml
+- ContrailAbstractSubstituteGlobalTypes:
+ file: ContrailAbstractSubstituteGlobalTypesServiceTemplate.yaml
+- ContrailV2VirtualNetworkGlobalType:
+ file: ContrailV2VirtualNetworkGlobalTypeServiceTemplate.yaml
+- ContrailV2NetworkRuleGlobalType:
+ file: ContrailV2NetworkRuleGlobalTypeServiceTemplate.yaml
+- ContrailV2VLANSubInterfaceGlobalType:
+ file: ContrailV2VLANSubInterfaceGlobalTypeServiceTemplate.yaml
+node_types:
+ org.openecomp.resource.vfc.nodes.heat.ps_server:
+ derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server
+topology_template:
+ inputs:
+ availabilityzone_name:
+ label: availabilityzone name
+ hidden: false
+ immutable: false
+ type: string
+ description: availabilityzone name
+ default: nova
+ repl_net_ips:
+ label: repl network ips
+ hidden: false
+ immutable: false
+ type: list
+ description: ips of repl network
+ default:
+ - 107.239.33.57
+ - 107.239.33.58
+ entry_schema:
+ type: string
+ oam_net_name:
+ label: oam network name
+ hidden: false
+ immutable: false
+ type: string
+ description: name of the oam network
+ default: oam_protected_net_0
+ oam_net_ips:
+ label: internet network ips
+ hidden: false
+ immutable: false
+ type: list
+ description: ip of the OAM network
+ default:
+ - 107.250.172.213
+ - 107.250.172.214
+ - 107.250.172.215
+ - 107.250.172.216
+ - 107.250.172.217
+ entry_schema:
+ type: string
+ default: 169.254.1.4
+ ps_server_names:
+ label: PS server names
+ hidden: false
+ immutable: false
+ type: list
+ description: name of the PS instance
+ default:
+ - ZRDM1MOGX01MPS001
+ - ZRDM1MOGX01MPS002
+ - ZRDM1MOGX01MPS003
+ - ZRDM1MOGX01MPS004
+ entry_schema:
+ type: string
+ csb_net_ips:
+ hidden: false
+ immutable: false
+ type: list
+ description: mog_csb_net IP addresses
+ default:
+ - 172.26.0.10
+ - 172.26.0.11
+ - 172.26.0.12
+ - 172.26.0.13
+ - 172.26.0.14
+ - 172.26.0.15
+ - 172.26.0.16
+ - 172.26.0.17
+ - 172.26.0.18
+ - 172.26.0.19
+ - 172.26.0.20
+ entry_schema:
+ type: string
+ ps_flavor_name:
+ label: PS flavor name
+ hidden: false
+ immutable: false
+ type: string
+ description: flavor name of PS instance
+ default: m3.xlarge
+ ps_image_name:
+ label: PS image name
+ hidden: false
+ immutable: false
+ type: string
+ description: PS image name
+ default: MOG_BASE_8.0
+ repl_net_name:
+ label: Replication network name
+ hidden: false
+ immutable: false
+ type: string
+ description: name of the replication network
+ default: cor_direct_net_0
+ node_templates:
+ cm01_port_1:
+ type: org.openecomp.resource.cp.nodes.heat.network.neutron.Port
+ properties:
+ fixed_ips:
+ - ip_address:
+ get_input:
+ - oam_net_ips
+ - 4
+ allowed_address_pairs:
+ get_input:
+ - interface_list
+ - 2
+ - allowed_address_pairs
+ mac_address:
+ get_input: ncb1_internal1_mac_address
+ requirements:
+ - binding:
+ capability: tosca.capabilities.network.Bindable
+ node: server_cm01
+ relationship: tosca.relationships.network.BindsTo
+ cm01_port_2:
+ type: org.openecomp.resource.cp.nodes.heat.network.neutron.Port
+ properties:
+ fixed_ips:
+ - ip_address:
+ get_input:
+ - oam_net_ips
+ - 4
+ allowed_address_pairs:
+ get_input:
+ - interface_list
+ - 2
+ - allowed_address_pairs
+ mac_address:
+ get_input: ncb1_internal1_mac_address
+ requirements:
+ - link:
+ capability: tosca.capabilities.network.Linkable
+ node: csb_net
+ relationship: tosca.relationships.network.LinksTo
+ - binding:
+ capability: tosca.capabilities.network.Bindable
+ node: server_sm02
+ relationship: tosca.relationships.network.BindsTo
+ server_ps01:
+ type: org.openecomp.resource.vfc.nodes.heat.ps_server
+ properties:
+ flavor:
+ get_input: ps_flavor_name
+ availability_zone:
+ get_input: availabilityzone_name
+ image:
+ get_input: ps_image_name
+ user_data_format: RAW
+ name:
+ get_input:
+ - ps_server_names
+ - 3
+ server_ps02:
+ type: org.openecomp.resource.vfc.nodes.heat.ps_server
+ properties:
+ flavor:
+ get_input: ps_flavor_name
+ availability_zone:
+ get_input: availabilityzone_name
+ image:
+ get_input: ps_image_name
+ user_data_format: RAW
+ name:
+ get_input:
+ - ps_server_names
+ - 2 \ No newline at end of file