aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap
diff options
context:
space:
mode:
authorSheshukov, Natalia (ns019t) <ns019t@intl.att.com>2018-04-09 15:03:06 +0300
committerSheshukov, Natalia (ns019t) <ns019t@intl.att.com>2018-04-09 16:53:45 +0300
commita5a24ad0f22bdb06e3194f392df322b48b1b2316 (patch)
tree940d9aeb7f6c43616447d396280649406fe139af /src/main/java/org/onap
parentb0ed12f587f7f87dedb0b838664800662bc4ca8e (diff)
vLAN Tagging
Support Tosca Groups - TOSCA parser (refactoring) Change-Id: I10c6b8e5356bea0e85e8b448c23d9f05ac3ab837 Issue-ID: SDC-1199 Signed-off-by: Sheshukov, Natalia (ns019t) <ns019t@intl.att.com>
Diffstat (limited to 'src/main/java/org/onap')
-rw-r--r--src/main/java/org/onap/sdc/tosca/parser/api/ISdcCsarHelper.java34
-rw-r--r--src/main/java/org/onap/sdc/tosca/parser/impl/SdcCsarHelperImpl.java282
-rw-r--r--src/main/java/org/onap/sdc/tosca/parser/impl/SdcPropertyNames.java3
3 files changed, 128 insertions, 191 deletions
diff --git a/src/main/java/org/onap/sdc/tosca/parser/api/ISdcCsarHelper.java b/src/main/java/org/onap/sdc/tosca/parser/api/ISdcCsarHelper.java
index b5eed35..4f2ef29 100644
--- a/src/main/java/org/onap/sdc/tosca/parser/api/ISdcCsarHelper.java
+++ b/src/main/java/org/onap/sdc/tosca/parser/api/ISdcCsarHelper.java
@@ -19,6 +19,7 @@
package org.onap.sdc.tosca.parser.api;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -455,21 +456,21 @@ public interface ISdcCsarHelper {
* Get all the policies of the main topology template (either VF or service)
* @return the list of the policies
*/
- public List<Map<String, Map<String, Object>>> getPoliciesOfTopologyTemplate();
+ public List<Policy> getPoliciesOfTopologyTemplate();
/**
* Get all the policies of the main topology template (either VF or service) specified by policy type
* @param policyTypeName the name of the policy type
* @return the list of the policies
*/
- public List<Map<String, Map<String, Object>>> getPoliciesOfTopologyTemplateByToscaPolicyType(String policyTypeName);
+ public List<Policy> getPoliciesOfTopologyTemplateByToscaPolicyType(String policyTypeName);
/**
* Get all the policies of the origin component (nested topology template) of the node template
* @param nodeTemplate the node template
* @return the list of the policies
*/
- public List<Map<String,Object>> getPoliciesOfOriginOfNodeTemplate(NodeTemplate nodeTemplate);
+ public List<Policy> getPoliciesOfOriginOfNodeTemplate(NodeTemplate nodeTemplate);
/**
* Get all the policies of the origin component (nested topology template) of the node template specified by policy type
@@ -477,7 +478,7 @@ public interface ISdcCsarHelper {
* @param policyTypeName the name of the policy type
* @return the list of the policies
*/
- public List<Map<String, Object>> getPoliciesOfOriginOfNodeTemplateByToscaPolicyType(NodeTemplate nodeTemplate, String policyTypeName);
+ public List<Policy> getPoliciesOfOriginOfNodeTemplateByToscaPolicyType(NodeTemplate nodeTemplate, String policyTypeName);
/**
* Get all the node templates of the topology template, which are the targets of the policy specified by name
@@ -492,7 +493,7 @@ public interface ISdcCsarHelper {
* @param policyName the name of the policy
* @return the list of the node templates
*/
- public List<Map<String, Object>> getPolicyTargetsFromOrigin(NodeTemplate nodeTemplate, String policyName);
+ public List<NodeTemplate> getPolicyTargetsFromOrigin(NodeTemplate nodeTemplate, String policyName);
/**
* Get the node template of the topology template specified by name
@@ -506,7 +507,7 @@ public interface ISdcCsarHelper {
* @param targetNode the node template
* @return the list of the policies
*/
- public List<Map<String, Map<String, Object>>> getPoliciesOfTarget(NodeTemplate targetNode);
+ public List<Policy> getPoliciesOfTarget(NodeTemplate targetNode);
/**
* Get all the policies of the specified type, which contain the specified node template as a target
@@ -514,28 +515,27 @@ public interface ISdcCsarHelper {
* @param policyTypeName the name of the policy type
* @return the list of the policies
*/
- public List<Map<String, Map<String, Object>>> getPoliciesOfTargetByToscaPolicyType(NodeTemplate nodeTemplate, String policyTypeName);
-
- /**
- * Get all groups of this of the main topology template (either VF or service)
- * @return the list of the groups
- */
- public List<Map<String, Map<String, Object>>> getGroupsOfTopologyTemplate();
+ public List<Policy> getPoliciesOfTargetByToscaPolicyType(NodeTemplate nodeTemplate, String policyTypeName);
/**
* Get all the groups of the origin component (nested topology template) of the node template
* @param nodeTemplate the node template
* @return the list of the groups
*/
- public List<Map<String,Object>> getGroupsOfOriginOfNodeTemplate(NodeTemplate nodeTemplate);
+ public ArrayList<Group> getGroupsOfOriginOfNodeTemplate(NodeTemplate nodeTemplate);
/**
* Get all groups of this of the main topology template (either VF or service) by specified tosca group type
* @param groupType the group type
* @return the list of the groups
*/
- public List<Map<String, Map<String, Object>>> getGroupsOfTopologyTemplateByToscaGroupType(String groupType);
+ public ArrayList<Group> getGroupsOfTopologyTemplateByToscaGroupType(String groupType);
+ /**
+ * Get all groups of this of the main topology template (either VF or service)
+ * @return the list of the groups
+ */
+ public ArrayList<Group> getGroupsOfTopologyTemplate();
/**
* Get all groups of this of the origin component (nested topology template) of the node template by specified tosca group type
@@ -543,7 +543,7 @@ public interface ISdcCsarHelper {
* @param groupType the group type
* @return the list of the groups
*/
- public List<Map<String, Object>> getGroupsOfOriginOfNodeTemplateByToscaGroupType(NodeTemplate nodeTemplate, String groupType);
+ public ArrayList<Group> getGroupsOfOriginOfNodeTemplateByToscaGroupType(NodeTemplate nodeTemplate, String groupType);
/**
* Get members of the group belongs to the main topology template (either VF or service) by group name
@@ -558,6 +558,6 @@ public interface ISdcCsarHelper {
* @param groupName the name of the group
* @return the list of the node templates
*/
- public List<Map<String, Object>> getGroupMembersOfOriginOfNodeTemplate(NodeTemplate nodeTemplate, String groupName);
+ public List<NodeTemplate> getGroupMembersOfOriginOfNodeTemplate(NodeTemplate nodeTemplate, String groupName);
} \ No newline at end of file
diff --git a/src/main/java/org/onap/sdc/tosca/parser/impl/SdcCsarHelperImpl.java b/src/main/java/org/onap/sdc/tosca/parser/impl/SdcCsarHelperImpl.java
index 8675d5e..8e16c14 100644
--- a/src/main/java/org/onap/sdc/tosca/parser/impl/SdcCsarHelperImpl.java
+++ b/src/main/java/org/onap/sdc/tosca/parser/impl/SdcCsarHelperImpl.java
@@ -20,16 +20,34 @@
package org.onap.sdc.tosca.parser.impl;
-import java.util.*;
-import java.util.Map.Entry;
import static java.util.stream.Collectors.toList;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
import org.onap.sdc.tosca.parser.config.ConfigurationManager;
import org.onap.sdc.tosca.parser.utils.GeneralUtility;
import org.onap.sdc.tosca.parser.utils.SdcToscaUtility;
-import org.onap.sdc.toscaparser.api.*;
+import org.onap.sdc.toscaparser.api.CapabilityAssignment;
+import org.onap.sdc.toscaparser.api.CapabilityAssignments;
+import org.onap.sdc.toscaparser.api.Group;
+import org.onap.sdc.toscaparser.api.NodeTemplate;
+import org.onap.sdc.toscaparser.api.Policy;
+import org.onap.sdc.toscaparser.api.Property;
+import org.onap.sdc.toscaparser.api.RequirementAssignment;
+import org.onap.sdc.toscaparser.api.RequirementAssignments;
+import org.onap.sdc.toscaparser.api.SubstitutionMappings;
+import org.onap.sdc.toscaparser.api.TopologyTemplate;
+import org.onap.sdc.toscaparser.api.ToscaTemplate;
import org.onap.sdc.toscaparser.api.elements.Metadata;
import org.onap.sdc.toscaparser.api.elements.NodeType;
import org.onap.sdc.toscaparser.api.functions.Function;
@@ -37,8 +55,6 @@ import org.onap.sdc.toscaparser.api.parameters.Input;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import static org.onap.sdc.tosca.parser.impl.SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID;
-
public class SdcCsarHelperImpl implements ISdcCsarHelper {
private static final String PATH_DELIMITER = "#";
@@ -57,47 +73,36 @@ public class SdcCsarHelperImpl implements ISdcCsarHelper {
}
@Override
- public List<Map<String, Map<String, Object>>> getPoliciesOfTarget(NodeTemplate nodeTemplate) {
+ public List<Policy> getPoliciesOfTarget(NodeTemplate nodeTemplate) {
return getPoliciesOfNodeTemplate(nodeTemplate.getName())
.stream()
.sorted(Policy::compareTo)
- .map(this::convertPolicyToMap)
.collect(toList());
}
@Override
- public List<Map<String,Object>> getPoliciesOfOriginOfNodeTemplate(NodeTemplate nodeTemplate) {
- List<Map<String,Object>> policies = new ArrayList<>();
- if(toscaTemplate.getNestedTopologyTemplates() != null && !toscaTemplate.getNestedTopologyTemplates().isEmpty()){
- String invariantUUID = nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID);
- Optional<Object> nestedTopTmpl = toscaTemplate.getNestedTopologyTemplates()
- .values()
- .stream()
- .filter(nt->invariantUuidEqualsTo(invariantUUID, nt))
- .findFirst();
- if(nestedTopTmpl.isPresent()){
- policies = getPoliciesSection(nestedTopTmpl.get());
- }
- }
- return policies;
+ public List<Policy> getPoliciesOfOriginOfNodeTemplate(NodeTemplate nodeTemplate) {
+ if(StringUtils.isNotEmpty(nodeTemplate.getName())){
+ return getNodeTemplateByName(nodeTemplate.getName()).getOriginComponentTemplate().getPolicies();
+ }
+ return new ArrayList<>();
}
@Override
- public List<Map<String, Map<String, Object>>> getPoliciesOfTargetByToscaPolicyType(NodeTemplate nodeTemplate, String policyTypeName) {
+ public List<Policy> getPoliciesOfTargetByToscaPolicyType(NodeTemplate nodeTemplate, String policyTypeName) {
return getPoliciesOfNodeTemplate(nodeTemplate.getName())
.stream()
.filter(p->p.getType().equals(policyTypeName))
.sorted(Policy::compareTo)
- .map(this::convertPolicyToMap)
.collect(toList());
}
@Override
- public List<Map<String, Object>> getPoliciesOfOriginOfNodeTemplateByToscaPolicyType(NodeTemplate nodeTemplate, String policyTypeName) {
+ public List<Policy> getPoliciesOfOriginOfNodeTemplateByToscaPolicyType(NodeTemplate nodeTemplate, String policyTypeName) {
return getPoliciesOfOriginOfNodeTemplate(nodeTemplate)
.stream()
- .filter(p->typeEqualsTo(p, policyTypeName))
- .sorted(this::comparePolicyMapObjects)
+ .filter(p->p.getType().equals(policyTypeName))
+ .sorted(Policy::compareTo)
.collect(toList());
}
@@ -113,63 +118,40 @@ public class SdcCsarHelperImpl implements ISdcCsarHelper {
}
@Override
- public List<Map<String, Object>> getPolicyTargetsFromOrigin(NodeTemplate nodeTemplate, String policyName) {
- List<String> targets = getTargetsOfPolicyOfNestedTopologyTemplate(nodeTemplate, policyName);
- if(targets.isEmpty()){
- return new ArrayList<>();
+ public List<NodeTemplate> getPolicyTargetsFromOrigin(NodeTemplate nodeTemplate, String policyName) {
+ Optional<Policy> policyOpt = null;
+ if(StringUtils.isNotEmpty(nodeTemplate.getName())){
+ policyOpt = getNodeTemplateByName(nodeTemplate.getName()).getOriginComponentTemplate().getPolicies().stream().filter(p -> p.getName().equals(policyName)).findFirst();
}
- return toscaTemplate.getNestedTopologyTemplates()
- .values()
- .stream()
- .map(this::getNodeTemplatesSection)
- .filter(nt->targets.contains(nt.keySet().iterator().next()))
- .collect(toList());
+ if(policyOpt.isPresent()){
+ List<String> targets = policyOpt.get().getTargets();
+ return nodeTemplate.getOriginComponentTemplate().getNodeTemplates()
+ .stream()
+ .filter(nt -> targets.contains(nt.getName())).collect(Collectors.toList());
+ }
+ return new ArrayList<>();
}
@Override
- public List<Map<String, Map<String, Object>>> getPoliciesOfTopologyTemplate(){
+ public List<Policy> getPoliciesOfTopologyTemplate(){
if(toscaTemplate.getPolicies() == null)
return new ArrayList<>();
return toscaTemplate.getPolicies()
.stream()
.sorted(Policy::compareTo)
- .map(this::convertPolicyToMap)
.collect(toList());
}
@Override
- public List<Map<String, Map<String, Object>>> getPoliciesOfTopologyTemplateByToscaPolicyType(String policyTypeName){
+ public List<Policy> getPoliciesOfTopologyTemplateByToscaPolicyType(String policyTypeName){
if(toscaTemplate.getPolicies() == null)
return new ArrayList<>();
return toscaTemplate.getPolicies()
.stream()
.filter(p->p.getType().equals(policyTypeName))
.sorted(Policy::compareTo)
- .map(this::convertPolicyToMap)
.collect(toList());
}
-
-
- private List<String> getTargetsOfPolicyOfNestedTopologyTemplate(NodeTemplate nodeTemplate, String policyName) {
- if(toscaTemplate.getNodeTemplates() == null){
- return new ArrayList<>();
- }
- Optional<Map<String, Object>> policy = getPolicyOfNestedTopologyTemplateByName(nodeTemplate, policyName);
- if(!policy.isPresent()){
- return new ArrayList<>();
- }
- return getTargetsSection(policy.get());
- }
-
- private Optional<Map<String, Object>> getPolicyOfNestedTopologyTemplateByName(NodeTemplate nodeTemplate, String policyName) {
- return getPoliciesOfOriginOfNodeTemplate(nodeTemplate).stream()
- .filter(p->policyNameEqualsTo(p, policyName))
- .findFirst();
- }
-
- private boolean policyNameEqualsTo(Map<String, Object> policy, String policyName) {
- return policy != null && !policy.isEmpty() && policy.keySet().iterator().next().equals(policyName);
- }
public NodeTemplate getNodeTemplateByName(String nodeTemplateName) {
if(toscaTemplate.getNodeTemplates() == null)
@@ -180,86 +162,6 @@ public class SdcCsarHelperImpl implements ISdcCsarHelper {
.findFirst().orElse(null);
}
-
- private int comparePolicyMapObjects(Map<String,Object> policy, Map<String,Object> otherPolicy){
- if(policy.equals(otherPolicy))
- return 0;
- return getTypeSection(policy).compareTo(getTypeSection(otherPolicy)) == 0 ? getNameSection(policy).compareTo(getNameSection(otherPolicy)) : getTypeSection(policy).compareTo(getTypeSection(otherPolicy));
- }
-
- @SuppressWarnings("unchecked")
- private List<String> getTargetsSection(Map<String, Object> policy) {
- if(policy == null || policy.isEmpty()){
- return new ArrayList<>();
- }
- List<String> targets = (List<String>) ((Map<String, Object>)policy.values().iterator().next()).get(SdcPropertyNames.PROPERTY_NAME_TARGETS);
- if(targets == null){
- return new ArrayList<>();
- }
- return targets;
- }
- @SuppressWarnings("unchecked")
- private boolean typeEqualsTo(Map<String, Object> policy, String policyTypeName) {
- if(policy.values().iterator().hasNext()){
- return ((Map<String, Object>)policy.values().iterator().next()).get(SdcPropertyNames.PROPERTY_NAME_TYPE).equals(policyTypeName);
- }
- return false;
- }
-
- private String getNameSection(Map<String, Object> policy) {
- Object name = policy.get(SdcPropertyNames.PROPERTY_NAME_NAME);
- if(name == null)
- return "";
- return (String)name;
- }
-
- private String getTypeSection(Map<String, Object> policy) {
- Object type = policy.get(SdcPropertyNames.PROPERTY_NAME_TYPE);
- if(type == null)
- return "";
- return (String)type;
- }
-
- @SuppressWarnings("unchecked")
- private List<Map<String,Object>> getPoliciesSection(Object nestedTopTmpl) {
- List<Map<String,Object>> policies = (List<Map<String,Object>>)getTopologyTemplateSection(nestedTopTmpl).get(SdcPropertyNames.PROPERTY_NAME_POLICIES);
- if(policies == null || policies.isEmpty())
- return new ArrayList<>();
- return policies;
- }
-
- @SuppressWarnings("unchecked")
- private Map<String,Object> getNodeTemplatesSection(Object topologyTemplate) {
- Map<String,Object> nodeTemplates = (Map<String,Object>)getTopologyTemplateSection(topologyTemplate).get(SdcPropertyNames.PROPERTY_NAME_NODE_TEMPLATES);
- if(nodeTemplates == null || nodeTemplates.isEmpty())
- return new HashMap<>();
- return nodeTemplates;
- }
-
- @SuppressWarnings("unchecked")
- private Map<String,Object> getTopologyTemplateSection(Object topologyTemplate) {
- Map<String,Object> topologyTemplateSection = (Map<String,Object>)((Map<String,Object>)topologyTemplate).get(SdcPropertyNames.PROPERTY_NAME_TOPOLOGY_TEMPLATE);
- if(topologyTemplateSection == null || topologyTemplateSection.isEmpty())
- return new HashMap<>();
- return topologyTemplateSection;
- }
-
- @SuppressWarnings("unchecked")
- private boolean invariantUuidEqualsTo(String invariantUUID, Object nt) {
- return ((Map<String,Object>)((Map<String,Object>)nt).get(SdcPropertyNames.PROPERTY_NAME_METADATA)).get(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID).equals(invariantUUID);
- }
-
- private Map<String, Map<String, Object>> convertPolicyToMap(Policy policy){
- Map<String, Map<String, Object>> policyMap = new HashMap<>();
- Map<String, Object> policyValue = new HashMap<>();
- policyMap.put(policy.getName(), policyValue);
- policyValue.put(SdcPropertyNames.PROPERTY_NAME_TYPE, policy.getType());
- policyValue.put(SdcPropertyNames.PROPERTY_NAME_METADATA, policy.getmetadata());
- policyValue.put(SdcPropertyNames.PROPERTY_NAME_TARGETS, policy.getTargets());
- policyValue.put(SdcPropertyNames.PROPERTY_NAME_PROPERTIES, policy.getPolicyProperties());
- return policyMap;
- }
-
private List<Policy> getPoliciesOfNodeTemplate(String nodeTemplateName) {
if(toscaTemplate.getPolicies() == null)
return new ArrayList<>();
@@ -273,6 +175,10 @@ public class SdcCsarHelperImpl implements ISdcCsarHelper {
return getPolicyByName(policyName).map(Policy::getTargets).orElse(new ArrayList<>());
}
+ private List<String> getGroupMembers(String groupName) {
+ return getGroupByName(groupName).map(Group::getMembers).orElse(new ArrayList<>());
+ }
+
private Optional<Policy> getPolicyByName(String policyName) {
if(toscaTemplate.getPolicies() == null)
return Optional.empty();
@@ -281,6 +187,14 @@ public class SdcCsarHelperImpl implements ISdcCsarHelper {
.filter(p -> p.getName().equals(policyName)).findFirst();
}
+ private Optional<Group> getGroupByName(String groupName) {
+ if(toscaTemplate.getGroups() == null)
+ return Optional.empty();
+ return toscaTemplate.getGroups()
+ .stream()
+ .filter(g -> g.getName().equals(groupName)).findFirst();
+ }
+
@Override
//Sunny flow - covered with UT, flat and nested
public String getNodeTemplatePropertyLeafValue(NodeTemplate nodeTemplate, String leafValuePath) {
@@ -1029,44 +943,75 @@ public class SdcCsarHelperImpl implements ISdcCsarHelper {
}
@Override
- public List<Map<String, Map<String, Object>>> getGroupsOfTopologyTemplate() {
- // TODO Auto-generated method stub
- return null;
+ public ArrayList<Group> getGroupsOfOriginOfNodeTemplate(NodeTemplate nodeTemplate) {
+ if(StringUtils.isNotEmpty(nodeTemplate.getName())){
+ return getNodeTemplateByName(nodeTemplate.getName()).getSubMappingToscaTemplate().getGroups();
+ }
+ return new ArrayList<>();
}
-
+
@Override
- public List<Map<String, Object>> getGroupsOfOriginOfNodeTemplate(NodeTemplate nodeTemplate) {
- // TODO Auto-generated method stub
- return null;
+ public ArrayList<Group> getGroupsOfTopologyTemplateByToscaGroupType(String groupType) {
+ if(toscaTemplate.getGroups() == null)
+ return new ArrayList<>();
+ return (ArrayList<Group>) toscaTemplate.getGroups()
+ .stream()
+ .filter(g->g.getType().equals(groupType))
+ .sorted(Group::compareTo)
+ .collect(toList());
}
-
+
@Override
- public List<Map<String, Map<String, Object>>> getGroupsOfTopologyTemplateByToscaGroupType(String groupType) {
- // TODO Auto-generated method stub
- return null;
+ public ArrayList<Group> getGroupsOfTopologyTemplate() {
+ return toscaTemplate.getGroups() == null ? new ArrayList<>() : toscaTemplate.getGroups();
}
@Override
- public List<Map<String, Object>> getGroupsOfOriginOfNodeTemplateByToscaGroupType(NodeTemplate nodeTemplate, String groupType) {
- // TODO Auto-generated method stub
- return null;
+ public ArrayList<Group> getGroupsOfOriginOfNodeTemplateByToscaGroupType(NodeTemplate nodeTemplate, String groupType) {
+ return (ArrayList<Group>) getGroupsOfOriginOfNodeTemplate(nodeTemplate)
+ .stream()
+ .filter(g->g.getType().equals(groupType))
+ .sorted(Group::compareTo)
+ .collect(toList());
}
@Override
public List<NodeTemplate> getGroupMembersFromTopologyTemplate(String groupName) {
- // TODO Auto-generated method stub
- return null;
+ if(toscaTemplate.getNodeTemplates() == null){
+ return new ArrayList<>();
+ }
+ List<String> membersNames = getGroupMembers(groupName);
+ return toscaTemplate.getNodeTemplates().stream()
+ .filter(nt->membersNames.contains(nt.getName()))
+ .collect(toList());
}
@Override
- public List<Map<String, Object>> getGroupMembersOfOriginOfNodeTemplate(NodeTemplate nodeTemplate, String groupName) {
- // TODO Auto-generated method stub
- return null;
+ public List<NodeTemplate> getGroupMembersOfOriginOfNodeTemplate(NodeTemplate nodeTemplate, String groupName) {
+ ArrayList<Group> groups = getGroupsOfOriginOfNodeTemplate(nodeTemplate);
+ if(!groups.isEmpty()){
+ Optional<Group> group = groups.stream().filter(g -> g.getName().equals(groupName)).findFirst();
+ if(group.isPresent()){
+ return nodeTemplate.getSubMappingToscaTemplate().getNodeTemplates().stream()
+ .filter(nt -> group.get().getMembers().contains(nt.getName()))
+ .collect(toList());
+ }
+ }
+ return new ArrayList<>();
+ }
+
+ public List<NodeTemplate> getServiceNodeTemplateBySdcType(SdcTypes sdcType) {
+ if (sdcType == null) {
+ log.error("getServiceNodeTemplateBySdcType - sdcType is null or empty");
+ return new ArrayList<>();
+ }
+
+ TopologyTemplate topologyTemplate = toscaTemplate.getTopologyTemplate();
+ return getNodeTemplateBySdcType(topologyTemplate, sdcType);
}
-
- /************************************* helper functions ***********************************/
+ /************************************* helper functions ***********************************/
private boolean isVNFType(NodeTemplate nt) {
return nt.getType().endsWith("VnfConfiguration");
}
@@ -1091,18 +1036,7 @@ public class SdcCsarHelperImpl implements ISdcCsarHelper {
return filterMap;
}
-
- public List<NodeTemplate> getServiceNodeTemplateBySdcType(SdcTypes sdcType) {
- if (sdcType == null) {
- log.error("getServiceNodeTemplateBySdcType - sdcType is null or empty");
- return new ArrayList<>();
- }
-
- TopologyTemplate topologyTemplate = toscaTemplate.getTopologyTemplate();
- return getNodeTemplateBySdcType(topologyTemplate, sdcType);
- }
-
/************************************* helper functions ***********************************/
private List<NodeTemplate> getNodeTemplateBySdcType(TopologyTemplate topologyTemplate, SdcTypes sdcType) {
if (sdcType == null) {
diff --git a/src/main/java/org/onap/sdc/tosca/parser/impl/SdcPropertyNames.java b/src/main/java/org/onap/sdc/tosca/parser/impl/SdcPropertyNames.java
index db4d167..6f7e568 100644
--- a/src/main/java/org/onap/sdc/tosca/parser/impl/SdcPropertyNames.java
+++ b/src/main/java/org/onap/sdc/tosca/parser/impl/SdcPropertyNames.java
@@ -111,7 +111,10 @@ public class SdcPropertyNames {
public static String PROPERTY_NAME_TOPOLOGY_TEMPLATE = "topology_template";
public static String PROPERTY_NAME_NODE_TEMPLATES = "node_templates";
public static String PROPERTY_NAME_POLICIES = "policies";
+ public static String PROPERTY_NAME_GROUPS = "groups";
public static String PROPERTY_NAME_METADATA = "metadata";
public static String PROPERTY_NAME_PROPERTIES = "properties";
public static String PROPERTY_NAME_TARGETS = "targets";
+ public static String PROPERTY_NAME_MEMBERS = "members";
+ public static String PROPERTY_NAME_CAPABILITIES = "capabilities";
}