From 56e56b8860cf6e7ad70dc65134e8fd87eaf01123 Mon Sep 17 00:00:00 2001 From: ojasdubey Date: Tue, 6 Mar 2018 12:01:54 +0530 Subject: VLAN tagging - VFC Instance Group 1. Create VFC instance group per sub-interface network role 2. Refactored PortTemplateConsolidationData and its references based on review comments 3. Updated test data after rebase 4. Updated to flatMap based on review comments Change-Id: I423593c5156ecae5eff3a4f2ce8591c85db727cc Issue-ID: SDC-1073 Signed-off-by: ojasdubey --- .../sdc/tosca/datatypes/ToscaNodeType.java | 5 +++- .../sdc/tosca/services/DataModelUtil.java | 30 ++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) (limited to 'openecomp-be/lib/openecomp-tosca-lib/src') diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaNodeType.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaNodeType.java index 91a33ed9f7..d48fe6f44b 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaNodeType.java +++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaNodeType.java @@ -98,7 +98,10 @@ public class ToscaNodeType { + "MultiDeploymentFlavor.CVFC"; public static final String COMPUTE_TYPE_PREFIX = "org.openecomp.resource.vfc.compute.nodes.heat"; public static final String VFC_TYPE_PREFIX = "org.openecomp.resource.vfc.nodes.heat"; + public static final String GROUP_TYPE_PREFIX = "org.openecomp.groups"; + public static final String VFC_INSTANCE_GROUP = ".VfcInstanceGroup"; - private ToscaNodeType() {} + private ToscaNodeType() { + } } diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java index 97932289b9..39240ebe05 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java +++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java @@ -202,6 +202,16 @@ public class DataModelUtil { return serviceTemplate.getTopology_template().getNode_templates(); } + public static Map getGroups(ServiceTemplate serviceTemplate) { + if (Objects.isNull(serviceTemplate) + || Objects.isNull(serviceTemplate.getTopology_template()) + || MapUtils.isEmpty(serviceTemplate.getTopology_template().getGroups())) { + return new HashMap<>(); + } + + return serviceTemplate.getTopology_template().getGroups(); + } + /** * Add node template. * @@ -481,6 +491,26 @@ public class DataModelUtil { serviceTemplate.getTopology_template().getGroups().put(groupName, group); } + public static void addGroupMember(ServiceTemplate serviceTemplate, + String groupName, + String groupMemberId) { + TopologyTemplate topologyTemplate = serviceTemplate.getTopology_template(); + if (Objects.isNull(topologyTemplate) + || topologyTemplate.getGroups() == null + || topologyTemplate.getGroups().get(groupName) == null) { + return; + } + + GroupDefinition groupDefinition = topologyTemplate.getGroups().get(groupName); + if (CollectionUtils.isEmpty(groupDefinition.getMembers())) { + groupDefinition.setMembers(new ArrayList<>()); + } + + if(!groupDefinition.getMembers().contains(groupMemberId)) { + groupDefinition.getMembers().add(groupMemberId); + } + } + /** * Create parameter definition property definition. * -- cgit 1.2.3-korg