summaryrefslogtreecommitdiffstats
path: root/catalog-be-plugins/etsi-nfv-nsd-csar-plugin/src/main
diff options
context:
space:
mode:
authorMichaelMorris <michael.morris@est.tech>2021-03-31 21:53:05 +0100
committerChristophe Closset <christophe.closset@intl.att.com>2021-04-12 08:36:21 +0000
commit49e74d3a9d5f77af3e2aa321a863fd83a1ca6f73 (patch)
treea7f9f2eb62e28419d44f8b428a50bd6c99f77b6d /catalog-be-plugins/etsi-nfv-nsd-csar-plugin/src/main
parent597e80af47aeec1d8306f23d32b8c114192f94d8 (diff)
Fix NSD properties
Signed-off-by: MichaelMorris <michael.morris@est.tech> Issue-ID: SDC-3545 Change-Id: I090bdcc85e85f1ec86851de3f957ad2ccd148ed5
Diffstat (limited to 'catalog-be-plugins/etsi-nfv-nsd-csar-plugin/src/main')
-rw-r--r--catalog-be-plugins/etsi-nfv-nsd-csar-plugin/src/main/java/org/openecomp/sdc/be/plugins/etsi/nfv/nsd/generator/NsDescriptorGeneratorImpl.java18
1 files changed, 12 insertions, 6 deletions
diff --git a/catalog-be-plugins/etsi-nfv-nsd-csar-plugin/src/main/java/org/openecomp/sdc/be/plugins/etsi/nfv/nsd/generator/NsDescriptorGeneratorImpl.java b/catalog-be-plugins/etsi-nfv-nsd-csar-plugin/src/main/java/org/openecomp/sdc/be/plugins/etsi/nfv/nsd/generator/NsDescriptorGeneratorImpl.java
index f024d8f52a..fc3dac2e31 100644
--- a/catalog-be-plugins/etsi-nfv-nsd-csar-plugin/src/main/java/org/openecomp/sdc/be/plugins/etsi/nfv/nsd/generator/NsDescriptorGeneratorImpl.java
+++ b/catalog-be-plugins/etsi-nfv-nsd-csar-plugin/src/main/java/org/openecomp/sdc/be/plugins/etsi/nfv/nsd/generator/NsDescriptorGeneratorImpl.java
@@ -71,6 +71,8 @@ public class NsDescriptorGeneratorImpl implements NsDescriptorGenerator {
.getDefaultImports();
private static final List<String> PROPERTIES_TO_EXCLUDE_FROM_ETSI_SOL_NSD_NS_NODE_TYPE = Arrays
.asList("cds_model_name", "cds_model_version", "skip_post_instantiation_configuration", "controller_actor");
+ private static final List<String> ETSI_SOL_NSD_NS_NODE_TYPE_PROPERTIES = Arrays
+ .asList("descriptor_id", "designer", "version", "name", "invariant_id", "flavour_id", "ns_profile", "service_availability_level");
private static final List<String> PROPERTIES_TO_EXCLUDE_FROM_ETSI_SOL_NSD_NS_NODE_TEMPLATE = Arrays
.asList("nf_function", "nf_role", "nf_naming_code", "nf_type", "nf_naming", "availability_zone_max_count", "min_instances", "max_instances",
"multi_stage_design", "sdnc_model_name", "sdnc_model_version", "sdnc_artifact_name", "skip_post_instantiation_configuration",
@@ -175,7 +177,7 @@ public class NsDescriptorGeneratorImpl implements NsDescriptorGenerator {
componentToscaTemplate.getNode_types().putAll(nodeTypeMap);
}
handleNodeTemplates(componentToscaTemplate);
- removeOnapPropertiesFromInputs(componentToscaTemplate);
+ removeOnapAndEtsiNsdPropertiesFromInputs(componentToscaTemplate);
handleSubstitutionMappings(componentToscaTemplate, nsNodeTypeName);
final Map<String, ToscaNodeTemplate> nodeTemplates = new HashMap<>();
nodeTemplates.put(nsNodeTypeName,
@@ -248,7 +250,7 @@ public class NsDescriptorGeneratorImpl implements NsDescriptorGenerator {
for (final Entry<String, Object> property : propertyMap.entrySet()) {
if (!PROPERTIES_TO_EXCLUDE_FROM_ETSI_SOL_NSD_NS_NODE_TEMPLATE.contains(property.getKey()) && propertyIsDefinedInNodeType(
property.getKey())) {
- editedPropertyMap.put(property.getKey().substring(property.getKey().indexOf('_') + 1), property.getValue());
+ editedPropertyMap.put(property.getKey(), property.getValue());
}
}
if (editedPropertyMap.isEmpty()) {
@@ -276,11 +278,13 @@ public class NsDescriptorGeneratorImpl implements NsDescriptorGenerator {
nodeTemplate.getValue().setCapabilities(null);
}
- private void removeOnapPropertiesFromInputs(final ToscaTemplate template) {
+ private void removeOnapAndEtsiNsdPropertiesFromInputs(final ToscaTemplate template) {
final ToscaTopolgyTemplate topologyTemplate = template.getTopology_template();
final Map<String, ToscaProperty> inputMap = topologyTemplate.getInputs();
+
+
if (MapUtils.isNotEmpty(inputMap)) {
- inputMap.entrySet().removeIf(entry -> PROPERTIES_TO_EXCLUDE_FROM_ETSI_SOL_NSD_NS_NODE_TYPE.contains(entry.getKey()));
+ inputMap.entrySet().removeIf(entry -> PROPERTIES_TO_EXCLUDE_FROM_ETSI_SOL_NSD_NS_NODE_TYPE.contains(entry.getKey()) || ETSI_SOL_NSD_NS_NODE_TYPE_PROPERTIES.contains(entry.getKey()));
}
if (MapUtils.isEmpty(inputMap)) {
topologyTemplate.setInputs(null);
@@ -324,7 +328,7 @@ public class NsDescriptorGeneratorImpl implements NsDescriptorGenerator {
final Map<String, ToscaProperty> propertiesInNsNodeType = nsNodeType.getProperties();
for (final Entry<String, ToscaProperty> property : propertiesInNsNodeType.entrySet()) {
final ToscaProperty toscaProperty = property.getValue();
- if (toscaProperty.getDefaultp() != null) {
+ if (toscaProperty.getDefaultp() != null && ETSI_SOL_NSD_NS_NODE_TYPE_PROPERTIES.contains(property.getKey())) {
final ToscaPropertyConstraintValidValues constraint = new ToscaPropertyConstraintValidValues(
Collections.singletonList(toscaProperty.getDefaultp().toString()));
toscaProperty.setConstraints(Collections.singletonList(constraint));
@@ -370,7 +374,9 @@ public class NsDescriptorGeneratorImpl implements NsDescriptorGenerator {
final Map<String, ToscaProperty> properties = toscaNodeType.getProperties();
final Map<String, Object> nodeTemplateProperties = new HashMap<>();
for (final Entry<String, ToscaProperty> property : properties.entrySet()) {
- nodeTemplateProperties.put(property.getKey(), property.getValue().getDefaultp());
+ if (property.getValue().getDefaultp() != null) {
+ nodeTemplateProperties.put(property.getKey(), property.getValue().getDefaultp());
+ }
}
if (!nodeTemplateProperties.isEmpty()) {
nodeTemplate.setProperties(nodeTemplateProperties);