summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main/java/org
diff options
context:
space:
mode:
authoraribeiro <anderson.ribeiro@est.tech>2020-08-21 09:17:56 +0100
committerJulien Bertozzi <julien.bertozzi@intl.att.com>2020-09-07 09:24:34 +0000
commitad85080b06553bc37a7bfb9c2c89f51275706ce6 (patch)
treee77988f5eac0f67273d8c45e06686708d16ce3ce /catalog-be/src/main/java/org
parentbd36f4badbaa5dd1b76996a3e1f73cf4dcfeda01 (diff)
Map topology inputs to properties in substitution mapping
Allows to map properties of the node_type to inputs of the topology template for a service Issue-ID: SDC-3254 Signed-off-by: aribeiro <anderson.ribeiro@est.tech> Change-Id: Iee49fe0ac29a39b98d8dc8185401f4d1c4aeffbb
Diffstat (limited to 'catalog-be/src/main/java/org')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java13
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/SubstitutionMapping.java2
2 files changed, 14 insertions, 1 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java
index 45db4f7365..b59930e6c3 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java
@@ -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) {
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/SubstitutionMapping.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/SubstitutionMapping.java
index 376f211b70..13a28db038 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/SubstitutionMapping.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/SubstitutionMapping.java
@@ -38,5 +38,5 @@ public class SubstitutionMapping {
private Map<String, String[]> capabilities;
private Map<String, String[]> requirements;
private NodeFilter substitution_filter;
-
+ private Map<String, ToscaProperty> properties;
}