summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortalio <tali.orenbach@amdocs.com>2017-11-02 14:45:02 +0200
committertalio <tali.orenbach@amdocs.com>2017-11-02 14:45:02 +0200
commitc01e02538c7e2ccfcbc9f9b22e33875176c0dbf5 (patch)
tree6fc70e57df7b3c58c1b0eb3d41d4eb29445ed3fc
parent925963725a69700137c755bd007de7ff8e096f94 (diff)
dynamic ports
ignore "depends_on" from / to nested entities Issue - Id : SDC-576 Change-Id: Id96e57a7826638b0c5b582d35417d6369fb9f607 Signed-off-by: talio <tali.orenbach@amdocs.com>
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationTypesConnectivity.java64
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/HeatToToscaUtil.java41
2 files changed, 65 insertions, 40 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationTypesConnectivity.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationTypesConnectivity.java
new file mode 100644
index 0000000000..4e219dae4d
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationTypesConnectivity.java
@@ -0,0 +1,64 @@
+package org.openecomp.sdc.translator.services.heattotosca;
+
+import org.apache.commons.collections.CollectionUtils;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+public class ConsolidationTypesConnectivity {
+
+ private static Map<ConsolidationEntityType, Set<ConsolidationEntityType>>
+ entityToEntitiesWithoutRelationship;
+
+ static {
+ entityToEntitiesWithoutRelationship = new HashMap<>();
+ entityToEntitiesWithoutRelationship
+ .put(ConsolidationEntityType.COMPUTE, getIgnoredComputeRelationships());
+ entityToEntitiesWithoutRelationship
+ .put(ConsolidationEntityType.PORT,getIgnoredPortRelationships());
+ entityToEntitiesWithoutRelationship
+ .put(ConsolidationEntityType.VOLUME, getIgnoredVolumeRelationships());
+ entityToEntitiesWithoutRelationship
+ .put(ConsolidationEntityType.VFC_NESTED, getIgnoredVfcNestedRelationships());
+ }
+
+ private static Set<ConsolidationEntityType> getIgnoredComputeRelationships(){
+ return Stream.of(ConsolidationEntityType.COMPUTE,
+ ConsolidationEntityType.VOLUME,
+ ConsolidationEntityType.PORT,
+ ConsolidationEntityType.VFC_NESTED).collect(Collectors.toSet());
+ }
+
+ private static Set<ConsolidationEntityType> getIgnoredPortRelationships(){
+ return Stream.of(ConsolidationEntityType.COMPUTE,
+ ConsolidationEntityType.VOLUME,
+ ConsolidationEntityType.PORT,
+ ConsolidationEntityType.VFC_NESTED).collect(Collectors.toSet());
+ }
+
+ private static Set<ConsolidationEntityType> getIgnoredVolumeRelationships(){
+ return Stream.of(ConsolidationEntityType.COMPUTE,
+ ConsolidationEntityType.VOLUME,
+ ConsolidationEntityType.PORT,
+ ConsolidationEntityType.VFC_NESTED).collect(Collectors.toSet());
+ }
+
+ private static Set<ConsolidationEntityType> getIgnoredVfcNestedRelationships(){
+ return Stream.of(ConsolidationEntityType.COMPUTE,
+ ConsolidationEntityType.VOLUME,
+ ConsolidationEntityType.PORT,
+ ConsolidationEntityType.VFC_NESTED).collect(Collectors.toSet());
+ }
+
+ public static boolean isDependsOnRelationshipValid(ConsolidationEntityType source,
+ ConsolidationEntityType target) {
+ Set<ConsolidationEntityType> consolidationEntityTypes =
+ entityToEntitiesWithoutRelationship.get(source);
+ return CollectionUtils.isEmpty(consolidationEntityTypes) ||
+ !consolidationEntityTypes.contains(target);
+
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/HeatToToscaUtil.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/HeatToToscaUtil.java
index 4e1a60fff8..d401e4930b 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/HeatToToscaUtil.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/HeatToToscaUtil.java
@@ -1164,46 +1164,7 @@ public class HeatToToscaUtil {
ConsolidationEntityType sourceEntityType = dependencyEntity.getSourceEntityType();
ConsolidationEntityType targetEntityType = dependencyEntity.getTargetEntityType();
- //Ignore Compute->Port, Compute->volume, Compute->Compute and Compute->VFC Nested relationships
- if (sourceEntityType == ConsolidationEntityType.COMPUTE) {
- if (targetEntityType == ConsolidationEntityType.COMPUTE
- || targetEntityType == ConsolidationEntityType.VOLUME
- || targetEntityType == ConsolidationEntityType.PORT
- || targetEntityType == ConsolidationEntityType.VFC_NESTED) {
- return false;
- }
- }
- //Ignore Port->Compute, Port->volume, Port->Port and Port->VFC Nested relationships
- if (sourceEntityType == ConsolidationEntityType.PORT) {
- if (targetEntityType == ConsolidationEntityType.COMPUTE
- || targetEntityType == ConsolidationEntityType.VOLUME
- || targetEntityType == ConsolidationEntityType.PORT
- || targetEntityType == ConsolidationEntityType.VFC_NESTED) {
- return false;
- }
- }
-
- //Ignore Volume->Compute, Volume->Volume, Volume->Port and Volume->VFC Nested relationships
- if (sourceEntityType == ConsolidationEntityType.VOLUME) {
- if (targetEntityType == ConsolidationEntityType.COMPUTE
- || targetEntityType == ConsolidationEntityType.VOLUME
- || targetEntityType == ConsolidationEntityType.PORT
- || targetEntityType == ConsolidationEntityType.VFC_NESTED) {
- return false;
- }
- }
-
- //Ignore VFC Nested->Compute, VFC Nested->Volume, VFC Nested->Port and
- // VFC Nested->VFC Nested relationships
- if (sourceEntityType == ConsolidationEntityType.VFC_NESTED) {
- if (targetEntityType == ConsolidationEntityType.COMPUTE
- || targetEntityType == ConsolidationEntityType.VOLUME
- || targetEntityType == ConsolidationEntityType.PORT
- || targetEntityType == ConsolidationEntityType.VFC_NESTED) {
- return false;
- }
- }
- return true;
+ return ConsolidationTypesConnectivity.isDependsOnRelationshipValid(sourceEntityType, targetEntityType);
}
private static Map<String, Object> managerSubstitutionNodeTemplateProperties(