Bugfix - interface_types missing from tosca 21/66621/2
authorojasdubey <ojas.dubey@amdocs.com>
Fri, 14 Sep 2018 11:25:00 +0000 (16:55 +0530)
committerOren Kleks <orenkle@amdocs.com>
Mon, 17 Sep 2018 10:33:17 +0000 (10:33 +0000)
1.Fix for interface_types missing from the tosca
model for a resource/service
2. Interface name should not contain spaces to make
the behavior consistent with tosca node type component naming

Change-Id: I8e135a87d659d3fb17d284247bcf222a8be7ccde
Issue-ID: SDC-1760
Signed-off-by: ojasdubey <ojas.dubey@amdocs.com>
catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java
catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtil.java
catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/utils/InterfaceUtils.java

index d62c2c6..41b29e3 100644 (file)
@@ -550,7 +550,7 @@ public class ToscaExportHandler {
             Map<String, ToscaNodeType> nodeTypes) {
         log.debug("start convert node type for {}", component.getUniqueId());
         ToscaNodeType toscaNodeType = createNodeType(component);
-
+        toscaNode.setInterface_types(addInterfaceTypeElement(component));
         Either<Map<String, DataTypeDefinition>, TitanOperationStatus> dataTypesEither = dataTypeCache.getAll();
         if (dataTypesEither.isRight()) {
             log.debug("Failed to fetch all data types :", dataTypesEither.right().value());
index 5370a78..70fd257 100644 (file)
@@ -64,6 +64,9 @@ public class InterfacesOperationsToscaUtil {
             return null;
         }
         final Map<String, InterfaceDefinition> interfaces = component.getInterfaces();
+        if (MapUtils.isEmpty(interfaces)) {
+            return null;
+        }
         Map<String, Object> toscaInterfaceTypes = new HashMap<>();
         for (InterfaceDefinition interfaceDefinition : interfaces.values()) {
             ToscaInterfaceNodeType toscaInterfaceType = new ToscaInterfaceNodeType();
index a3ec3f2..7a36d92 100644 (file)
@@ -28,6 +28,7 @@ import org.openecomp.sdc.be.datatypes.elements.OperationOutputDefinition;
 import org.openecomp.sdc.be.model.InputDefinition;
 import org.openecomp.sdc.be.model.InterfaceDefinition;
 import org.openecomp.sdc.be.model.Operation;
+import org.openecomp.sdc.common.util.ValidationUtils;
 
 public class InterfaceUtils {
 
@@ -61,7 +62,7 @@ public class InterfaceUtils {
     public static String createInterfaceToscaResourceName(String resourceName) {
         StringBuilder sb = new StringBuilder();
         try(Formatter formatter = new Formatter(sb)){
-            return formatter.format(INTERFACE_TOSCA_RESOURCE_NAME, resourceName).toString();
+            return formatter.format(INTERFACE_TOSCA_RESOURCE_NAME, ValidationUtils.convertToSystemName(resourceName)).toString();
         }
     }