Map topology inputs to properties in substitution mapping
[sdc.git] / catalog-be / src / main / java / org / openecomp / sdc / be / tosca / ToscaExportHandler.java
index 45db4f7..b59930e 100644 (file)
@@ -367,6 +367,9 @@ public class ToscaExportHandler {
         }
         substitutionMapping = requirements.left().value();
 
+        final Optional<Map<String, ToscaProperty>> proxyInputProperties = getProxyNodeTypeInputProperties(component, dataTypes);
+        proxyInputProperties.ifPresent(substitutionMapping::setProperties);
+
         topologyTemplate.setSubstitution_mappings(substitutionMapping);
 
         toscaNode.setTopology_template(topologyTemplate);
@@ -1726,6 +1729,16 @@ public class ToscaExportHandler {
 
     }
 
+    private Optional<Map<String, ToscaProperty>> getProxyNodeTypeInputProperties(final Component proxyComponent,
+                                                                                 final Map<String, DataTypeDefinition> dataTypes) {
+        if (Objects.isNull(proxyComponent)) {
+            return Optional.empty();
+        }
+        final Map<String, ToscaProperty> proxyInputProperties = new HashMap<>();
+        addInputsToProperties(dataTypes, proxyComponent.getInputs(), proxyInputProperties);
+        return MapUtils.isNotEmpty(proxyInputProperties) ? Optional.of(proxyInputProperties) : Optional.empty();
+    }
+
     Optional<Map<String, ToscaProperty>> getProxyNodeTypeProperties(Component proxyComponent,
                                                                     Map<String, DataTypeDefinition>
                                                                         dataTypes) {