aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-translator-lib
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-translator-lib')
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationService.java13
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationServiceTest.java10
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/subinterface/vlantagging/pattern1c2/differentNetwork/out/MainServiceTemplate.yaml60
3 files changed, 29 insertions, 54 deletions
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 28b265663e..b99bcf8bb8 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
@@ -494,7 +494,18 @@ public class ConsolidationService {
return true;
}
return !CommonUtil.isMultimapEmpty(firstEntityMap) && !CommonUtil.isMultimapEmpty(secondEntityMap)
- && firstEntityMap.keySet().equals(secondEntityMap.keySet());
+ && equalsIgnoreSuffix(new HashSet<>(firstEntityMap.keySet()),new HashSet<>(secondEntityMap.keySet()));
+ }
+
+ private boolean equalsIgnoreSuffix(Set<String> firstKeySet, Set<String> secondKeySet){
+ Set<String> firstKeySetTrimmed = firstKeySet.stream().map(this::trimSuffix).collect(Collectors.toSet());
+ Set<String> secondKeySetTrimmed = secondKeySet.stream().map(this::trimSuffix).collect(Collectors.toSet());
+ return firstKeySetTrimmed.equals(secondKeySetTrimmed);
+ }
+
+ private String trimSuffix(String volumeName){
+ int suffixPosition = volumeName.lastIndexOf("_");
+ return volumeName.substring(0, suffixPosition);
}
private boolean checkGroupIdsRelations(EntityConsolidationData startingEntity,
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 ed8d0a7e73..a9e1dbe3bf 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
@@ -981,7 +981,7 @@ public class ConsolidationServiceTest {
translationContext.setConsolidationData(consolidationData);
List<UnifiedCompositionMode> expectedUnifiedModes =
- Collections.singletonList(UnifiedCompositionMode.CatalogInstance);
+ Collections.singletonList(UnifiedCompositionMode.ScalingInstances);
verifyMainServiceTemplateConsolidation(1, expectedUnifiedModes, toscaServiceModel);
}
@@ -1283,7 +1283,7 @@ public class ConsolidationServiceTest {
translationContext.setConsolidationData(consolidationData);
List<UnifiedCompositionMode> expectedUnifiedModes =
- Collections.singletonList(UnifiedCompositionMode.CatalogInstance);
+ Collections.singletonList(UnifiedCompositionMode.ScalingInstances);
verifyMainServiceTemplateConsolidation(1, expectedUnifiedModes, toscaServiceModel);
}
@@ -1351,7 +1351,7 @@ public class ConsolidationServiceTest {
translationContext.setConsolidationData(consolidationData);
List<UnifiedCompositionMode> expectedUnifiedModes =
- Collections.singletonList(UnifiedCompositionMode.CatalogInstance);
+ Collections.singletonList(UnifiedCompositionMode.ScalingInstances);
verifyMainServiceTemplateConsolidation(1, expectedUnifiedModes, toscaServiceModel);
}
@@ -2441,7 +2441,7 @@ public class ConsolidationServiceTest {
"role_1", "interface_2", Collections.singletonList("node_2"), null, null, null,
consolidationData));
- testConsolidation(1, toscaServiceModel, consolidationData, Collections.singletonList(UnifiedCompositionMode.CatalogInstance));
+ testConsolidation(1, toscaServiceModel, consolidationData, Collections.singletonList(UnifiedCompositionMode.ScalingInstances));
}
@Test
@@ -2467,7 +2467,7 @@ public class ConsolidationServiceTest {
"role_1", "interface_2", null, Collections.singletonList("node_2"), null, null,
consolidationData));
- testConsolidation(1, toscaServiceModel, consolidationData, Collections.singletonList(UnifiedCompositionMode.CatalogInstance));
+ testConsolidation(1, toscaServiceModel, consolidationData, Collections.singletonList(UnifiedCompositionMode.ScalingInstances));
}
@Test
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/subinterface/vlantagging/pattern1c2/differentNetwork/out/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/subinterface/vlantagging/pattern1c2/differentNetwork/out/MainServiceTemplate.yaml
index 98d3d8e56e..b7aff2681c 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/subinterface/vlantagging/pattern1c2/differentNetwork/out/MainServiceTemplate.yaml
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/subinterface/vlantagging/pattern1c2/differentNetwork/out/MainServiceTemplate.yaml
@@ -703,7 +703,7 @@ topology_template:
shared: true
network_name:
get_input: jsa_net_name
- abstract_pd_server_0:
+ abstract_pd_server:
type: org.openecomp.resource.abstract.nodes.pd_server
directives:
- substitutable
@@ -711,18 +711,25 @@ topology_template:
port_pd_server_port_1_network_role_tag: oam
port_pd_server_port_1_network:
- get_input: oam_net_name
+ - get_input: oam_net_name
compute_pd_server_availability_zone:
- get_input: availabilityzone_name
+ - get_input: availabilityzone_name
compute_pd_server_name:
- get_input:
- pd_server_names
- 1
+ - get_input:
+ - pd_server_names
+ - 0
subinterface_nested_service_template_filter_count:
- 9
+ - 9
vm_flavor_name:
get_input: pd_flavor_name
subinterface_nested_p1:
- pd_server_1_port_1
+ - pd_server_port_1
port_pd_server_port_1_mac_requirements:
mac_count_required:
is_required: false
@@ -730,6 +737,7 @@ topology_template:
get_input: pd_image_name
subinterface_nested_net1:
- test_net2
+ - test_net1
port_pd_server_port_1_ip_requirements:
- ip_version: 4
ip_count_required:
@@ -738,9 +746,10 @@ topology_template:
is_required: false
compute_pd_server_user_data_format:
- RAW
+ - RAW
service_template_filter:
substitute_service_template: Nested_pd_serverServiceTemplate.yaml
- count: 1
+ count: 2
index_value:
get_property:
- SELF
@@ -751,50 +760,6 @@ topology_template:
capability: tosca.capabilities.network.Linkable
node: test_net2
relationship: tosca.relationships.network.LinksTo
- abstract_pd_server_1:
- type: org.openecomp.resource.abstract.nodes.pd_server
- directives:
- - substitutable
- properties:
- port_pd_server_port_1_network_role_tag: oam
- port_pd_server_port_1_network:
- - get_input: oam_net_name
- compute_pd_server_availability_zone:
- - get_input: availabilityzone_name
- compute_pd_server_name:
- - get_input:
- - pd_server_names
- - 0
- subinterface_nested_service_template_filter_count:
- - 9
- vm_flavor_name:
- get_input: pd_flavor_name
- subinterface_nested_p1:
- - pd_server_port_1
- port_pd_server_port_1_mac_requirements:
- mac_count_required:
- is_required: false
- vm_image_name:
- get_input: pd_image_name
- subinterface_nested_net1:
- - test_net1
- port_pd_server_port_1_ip_requirements:
- - ip_version: 4
- ip_count_required:
- is_required: false
- floating_ip_count_required:
- is_required: false
- compute_pd_server_user_data_format:
- - RAW
- service_template_filter:
- substitute_service_template: Nested_pd_serverServiceTemplate.yaml
- count: 1
- index_value:
- get_property:
- - SELF
- - service_template_filter
- - index_value
- requirements:
- subinterface_link_template_Vlan_vmi_1_pd_server_pd_server_port_1_nested:
capability: tosca.capabilities.network.Linkable
node: test_net1
@@ -808,5 +773,4 @@ topology_template:
members:
- test_net2
- test_net1
- - abstract_pd_server_0
- - abstract_pd_server_1
+ - abstract_pd_server \ No newline at end of file