aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be
diff options
context:
space:
mode:
authorsiddharth0905 <siddharth.singh4@amdocs.com>2018-05-15 19:55:34 +0530
committerOren Kleks <orenkle@amdocs.com>2018-05-16 07:34:14 +0000
commit991e8cdeb0f49573d7e849da741251027ea4de6c (patch)
tree3560f6582485dba3fff40a5792706914041c396f /openecomp-be
parentbedf1ad331ac7a19339197fef19c5f7c096e28d3 (diff)
Nested Dependency issues
Remove nested depends On connectivity Change-Id: Ic140e88fac74c31200cdd662dcbf6e296183ade3 Issue-ID: SDC-1315 Signed-off-by: siddharth0905 <siddharth.singh4@amdocs.com>
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/services/heattotosca/ConsolidationEntityType.java14
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationTypesConnectivity.java10
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationBase.java10
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/buildconsolidationdata/ConsolidationDataTestUtil.java23
4 files changed, 16 insertions, 41 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationEntityType.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationEntityType.java
index d4b85605d2..790be7cd54 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationEntityType.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationEntityType.java
@@ -20,12 +20,14 @@ import static org.openecomp.sdc.translator.services.heattotosca.ConsolidationDat
import static org.openecomp.sdc.translator.services.heattotosca.ConsolidationDataUtil.isPortResource;
import static org.openecomp.sdc.translator.services.heattotosca.ConsolidationDataUtil.isVolumeResource;
-import java.util.*;
-import java.util.stream.Collectors;
-
import org.openecomp.sdc.heat.datatypes.model.Resource;
import org.openecomp.sdc.translator.datatypes.heattotosca.TranslationContext;
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.Set;
+import java.util.stream.Collectors;
+
/**
* The enum Entity type.
*/
@@ -76,6 +78,8 @@ public enum ConsolidationEntityType {
consolidationEntityType = ConsolidationEntityType.COMPUTE;
} else if (isPortResource(resource)) {
consolidationEntityType = ConsolidationEntityType.PORT;
+ } else if (HeatToToscaUtil.isSubInterfaceResource(resource, context)) {
+ consolidationEntityType = ConsolidationEntityType.SUB_INTERFACE;
} else if (isVolumeResource(resource)) {
consolidationEntityType = ConsolidationEntityType.VOLUME;
} else if (HeatToToscaUtil.isNestedResource(resource)) {
@@ -87,8 +91,4 @@ public enum ConsolidationEntityType {
}
return consolidationEntityType;
}
-
- public static boolean isEntityTypeNested(ConsolidationEntityType entityType) {
- return NESTED == entityType || VFC_NESTED == entityType;
- }
} \ 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/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
index 7b258d651f..628f204da5 100644
--- 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
@@ -27,13 +27,7 @@ public class ConsolidationTypesConnectivity {
}
static boolean isDependsOnRelationshipValid(ConsolidationEntityType source, ConsolidationEntityType target) {
- return !eitherSourceOrTargetIsNested(source, target)
- && (!entityToEntitiesWithoutRelationship.containsKey(source)
- || !entityToEntitiesWithoutRelationship.containsEntry(source, target));
- }
-
- private static boolean eitherSourceOrTargetIsNested(ConsolidationEntityType source,
- ConsolidationEntityType target) {
- return ConsolidationEntityType.isEntityTypeNested(source) || ConsolidationEntityType.isEntityTypeNested(target);
+ return !entityToEntitiesWithoutRelationship.containsKey(source)
+ || !entityToEntitiesWithoutRelationship.containsEntry(source, target);
}
}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationBase.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationBase.java
index 92ce4c19ae..f93d3714ca 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationBase.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationBase.java
@@ -276,9 +276,7 @@ public abstract class ResourceTranslationBase {
Resource targetResource = HeatToToscaUtil
.getResource(heatOrchestrationTemplate, dependsOnResourceId,
translateTo.getHeatFileName());
- if (HeatToToscaUtil
- .isValidDependsOnCandidate(sourceResource, targetResource,
- ConsolidationEntityType.OTHER, translateTo.getContext())) {
+ if (isValidDependency(sourceResource, targetResource, translateTo)) {
requirementAssignment.setNode(resourceTranslatedId.get());
requirementAssignment.setCapability(ToscaCapabilityType.NATIVE_NODE);
requirementAssignment.setRelationship(ToscaRelationshipType.NATIVE_DEPENDS_ON);
@@ -293,6 +291,12 @@ public abstract class ResourceTranslationBase {
}
}
+ private boolean isValidDependency(Resource sourceResource, Resource targetResource, TranslateTo translateTo) {
+ return !(HeatToToscaUtil.isNestedResource(sourceResource) || HeatToToscaUtil.isNestedResource(targetResource))
+ && HeatToToscaUtil.isValidDependsOnCandidate(sourceResource, targetResource,
+ ConsolidationEntityType.OTHER, translateTo.getContext());
+ }
+
Optional<List<Map.Entry<String, Resource>>> getResourceByTranslatedResourceId(
String heatFileName,
HeatOrchestrationTemplate heatOrchestrationTemplate,
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/buildconsolidationdata/ConsolidationDataTestUtil.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/buildconsolidationdata/ConsolidationDataTestUtil.java
index b32e30e615..4381b37912 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/buildconsolidationdata/ConsolidationDataTestUtil.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/buildconsolidationdata/ConsolidationDataTestUtil.java
@@ -33,9 +33,7 @@ import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidati
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.collections4.CollectionUtils;
import org.junit.Assert;
-import org.openecomp.sdc.tosca.datatypes.ToscaCapabilityType;
import org.openecomp.sdc.tosca.datatypes.ToscaNodeType;
-import org.openecomp.sdc.tosca.datatypes.ToscaRelationshipType;
import org.onap.sdc.tosca.datatypes.model.GroupDefinition;
import org.onap.sdc.tosca.datatypes.model.NodeTemplate;
import org.onap.sdc.tosca.datatypes.model.NodeType;
@@ -957,27 +955,6 @@ public class ConsolidationDataTestUtil {
nestedTemplateConsolidationData) {
Assert.assertNull(nestedTemplateConsolidationData.getGroupIds());
Assert.assertNull(nestedTemplateConsolidationData.getNodesConnectedOut());
- //Assert.assertNull(nestedTemplateConsolidationData.getNodesGetAttrOut());
- }
-
- private static void validateNestedNodesConnectedInDependency(Map<String,
- List<RequirementAssignmentData>> nodesConnectedIn,
- String nestedNodeTemplateId,
- List<String> dependentNodeTemplateIds) {
- Assert.assertNotNull(nodesConnectedIn);
- for (String dependentNodeTemplateId : dependentNodeTemplateIds) {
- List<RequirementAssignmentData> requirementAssignmentData =
- nodesConnectedIn.get(dependentNodeTemplateId);
- Assert.assertNotNull(requirementAssignmentData);
- for (RequirementAssignmentData data : requirementAssignmentData) {
- Assert.assertEquals(data.getRequirementId(), ToscaConstants.DEPENDS_ON_REQUIREMENT_ID);
- Assert.assertEquals(data.getRequirementAssignment().getCapability(), ToscaCapabilityType
- .NATIVE_NODE);
- Assert.assertEquals(data.getRequirementAssignment().getNode(), nestedNodeTemplateId);
- Assert.assertEquals(data.getRequirementAssignment().getRelationship(),
- ToscaRelationshipType.NATIVE_DEPENDS_ON);
- }
- }
}
public static void validateNestedNodesConnectedInSecurityRuleToPort(String testName,