From 100491b13595ffeb8f847fc25b46192b607118af Mon Sep 17 00:00:00 2001 From: talio Date: Mon, 2 Oct 2017 13:54:55 +0300 Subject: Change node template prefix Add "".compute" to nested compute node types in substitution service templates Issue - Id : SDC-425 Change-Id: I00902576a3adf8d0463ef1352961629663efd96c Signed-off-by: talio --- .../openecomp/sdc/tosca/datatypes/ToscaNodeType.java | 2 ++ .../org/openecomp/sdc/tosca/services/DataModelUtil.java | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) (limited to 'openecomp-be/lib/openecomp-tosca-lib/src/main') 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 952a9cf9c9..411b7c0e07 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 @@ -94,5 +94,7 @@ public class ToscaNodeType { public static final String MULTIFLAVOR_VFC_NODE_TYPE = ABSTRACT_NODE_TYPE_PREFIX + "MultiFlavorVFC"; public static final String MULTIDEPLOYMENTFLAVOR_NODE_TYPE = ABSTRACT_NODE_TYPE_PREFIX + "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"; } 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 d223b5f01e..26596b994f 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 @@ -351,6 +351,23 @@ public class DataModelUtil { mdcDataDebugMessage.debugExitMessage(null, null); } + public static void removeNodeType(ServiceTemplate serviceTemplate, + String nodeTypeId){ + if (serviceTemplate == null) { + MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, + LoggerTragetServiceName.ADD_ENTITIES_TO_TOSCA, ErrorLevel.ERROR.name(), + LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.INVALID_ADD_ACTION); + throw new CoreException( + new InvalidAddActionNullEntityErrorBuilder("Node Type", "Service Template").build()); + } + if (serviceTemplate.getNode_types() == null) { + serviceTemplate.setNode_types(new HashMap<>()); + } + serviceTemplate.getNode_types().remove(nodeTypeId); + + mdcDataDebugMessage.debugExitMessage(null, null); + } + /** * Add relationship template. * -- cgit 1.2.3-korg