diff options
Diffstat (limited to 'openecomp-be/lib/openecomp-tosca-lib')
2 files changed, 25 insertions, 1 deletions
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaCapabilityType.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaCapabilityType.java index 9ef0a8de93..9037270000 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaCapabilityType.java +++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaCapabilityType.java @@ -50,7 +50,6 @@ public class ToscaCapabilityType { public static final String METRIC_CEILOMETER = CAPABILITY_PREFIX + "metric.Ceilometer"; public static final String METRIC_SNMP_TRAP = CAPABILITY_PREFIX + "metric.SnmpTrap"; public static final String METRIC_SNMP_POLLING = CAPABILITY_PREFIX + "metric.SnmpPolling"; - public static final String FABRIC_CONFIGURATION = CAPABILITY_PREFIX + "FabricConfiguration"; } 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 ac2f5da44a..64b0006acd 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 @@ -215,6 +215,31 @@ public class DataModelUtil { if (MapUtils.isEmpty(nodeType.getCapabilities())) { nodeType.setCapabilities(new HashMap<>()); } + + for (Map.Entry<String, CapabilityDefinition> entry : capabilities.entrySet()) { + nodeType.getCapabilities().put(entry.getKey(), entry.getValue()); + } + } + + /** + * Set capabilities def to node type. + * + * @param nodeType the node type + * @param capabilities the capability definitions + */ + public static void setNodeTypeCapabilitiesDef(NodeType nodeType, Map<String, CapabilityDefinition> capabilities) { + if (MapUtils.isEmpty(capabilities) || capabilities.entrySet().isEmpty()) { + return; + } + + if (nodeType == null) { + throw new CoreException(new InvalidAddActionNullEntityErrorBuilder("Capability Definition", NODE_TYPE) + .build()); + } + + if (MapUtils.isEmpty(nodeType.getCapabilities())) { + nodeType.setCapabilities(new HashMap<>()); + } if (capabilities.size() > 0) { nodeType.setCapabilities(new HashMap<>()); } |