summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/lib/openecomp-tosca-lib/src/main/java/org')
-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.
*