aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-tosca-lib/src/main
diff options
context:
space:
mode:
authorojasdubey <ojas.dubey@amdocs.com>2018-03-06 12:01:54 +0530
committerojasdubey <ojas.dubey@amdocs.com>2018-03-27 12:30:06 +0530
commit56e56b8860cf6e7ad70dc65134e8fd87eaf01123 (patch)
tree5a45b1199db9a1ce840c2c454e470674daf4e63c /openecomp-be/lib/openecomp-tosca-lib/src/main
parent6cc3acdc6d3140a8f702939568ab4c7cda06beaa (diff)
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 <ojas.dubey@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-tosca-lib/src/main')
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaNodeType.java5
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java30
2 files changed, 34 insertions, 1 deletions
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<String, GroupDefinition> 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.
*