summaryrefslogtreecommitdiffstats
path: root/catalog-be/src
diff options
context:
space:
mode:
authorMichaelMorris <michael.morris@est.tech>2021-12-23 09:48:55 +0000
committerAndr� Schmid <andre.schmid@est.tech>2022-01-04 12:00:23 +0000
commitaf6601d0d61abafec80f1835959d1f67fe0d46b7 (patch)
treeee42a359c8575b394d8779ad085593da274e019f /catalog-be/src
parente783b8215a44dd18a4262e597fc24b99d345d11a (diff)
Fix inputs created incorrectly.
Signed-off-by: MichaelMorris <michael.morris@est.tech> Issue-ID: SDC-3822 Change-Id: I6ea226fe3f0e18c41700b79f6fa96907a1d81709
Diffstat (limited to 'catalog-be/src')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/YamlTemplateParsingHandler.java6
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java9
2 files changed, 12 insertions, 3 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/YamlTemplateParsingHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/YamlTemplateParsingHandler.java
index 5120834b1e..a991f7e0d4 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/YamlTemplateParsingHandler.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/YamlTemplateParsingHandler.java
@@ -36,6 +36,7 @@ import static org.openecomp.sdc.be.utils.TypeUtils.ToscaTagNamesEnum.DESCRIPTION
import static org.openecomp.sdc.be.utils.TypeUtils.ToscaTagNamesEnum.FILE;
import static org.openecomp.sdc.be.utils.TypeUtils.ToscaTagNamesEnum.GET_INPUT;
import static org.openecomp.sdc.be.utils.TypeUtils.ToscaTagNamesEnum.GROUPS;
+import static org.openecomp.sdc.be.utils.TypeUtils.ToscaTagNamesEnum.INPUTS;
import static org.openecomp.sdc.be.utils.TypeUtils.ToscaTagNamesEnum.IS_PASSWORD;
import static org.openecomp.sdc.be.utils.TypeUtils.ToscaTagNamesEnum.MEMBERS;
import static org.openecomp.sdc.be.utils.TypeUtils.ToscaTagNamesEnum.NODE;
@@ -137,8 +138,9 @@ public class YamlTemplateParsingHandler {
log.debug("#parseResourceInfoFromYAML - Going to parse yaml {} ", fileName);
Map<String, Object> mappedToscaTemplate = getMappedToscaTemplate(fileName, resourceYml, nodeTypesInfo, nodeName);
ParsedToscaYamlInfo parsedToscaYamlInfo = new ParsedToscaYamlInfo();
- findToscaElement(mappedToscaTemplate, TOPOLOGY_TEMPLATE, ToscaElementTypeEnum.ALL).left().on(err -> failIfNotTopologyTemplate(fileName));
- parsedToscaYamlInfo.setInputs(getInputs(mappedToscaTemplate));
+ Map<String, Object> mappedTopologyTemplate = (Map<String, Object>) findToscaElement(mappedToscaTemplate, TOPOLOGY_TEMPLATE, ToscaElementTypeEnum.ALL).left().on(err -> failIfNotTopologyTemplate(fileName));
+ Map<String, Object> mappedTopologyTemplateInputs = mappedTopologyTemplate.entrySet().stream().filter(entry -> entry.getKey().equals(INPUTS.getElementName())).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
+ parsedToscaYamlInfo.setInputs(getInputs(mappedTopologyTemplateInputs));
parsedToscaYamlInfo.setInstances(getInstances(fileName, mappedToscaTemplate, createdNodesToscaResourceNames));
parsedToscaYamlInfo.setGroups(getGroups(fileName, mappedToscaTemplate, component.getModel()));
if (component instanceof Resource) {
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java
index db03c72778..8a003623c4 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java
@@ -22,6 +22,7 @@
package org.openecomp.sdc.be.components.impl;
import static org.openecomp.sdc.common.log.enums.EcompLoggerErrorCode.BUSINESS_PROCESS_ERROR;
+import static org.openecomp.sdc.common.log.enums.EcompLoggerErrorCode.DATA_ERROR;
import com.google.gson.JsonElement;
import fj.data.Either;
@@ -106,6 +107,7 @@ public abstract class BaseBusinessLogic {
private static final String PROPERTY_IN_SCHEMA_DEFINITION_INSIDE_PROPERTY_OF_TYPE_DOESN_T_EXIST = "Property in Schema Definition inside property of type {} doesn't exist";
private static final String ADD_PROPERTY_VALUE = "Add property value";
private static final String THE_VALUE_OF_PROPERTY_FROM_TYPE_IS_INVALID = "The value {} of property from type {} is invalid";
+ private static final String INVALID_PROPERTY_TYPE = "The property type {} is invalid";
protected IGroupTypeOperation groupTypeOperation;
protected InterfaceOperation interfaceOperation;
protected IElementOperation elementDao;
@@ -527,7 +529,8 @@ public abstract class BaseBusinessLogic {
if (isValid.isRight()) {
Boolean res = isValid.right().value();
if (Boolean.FALSE.equals(res)) {
- throw new StorageException(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(JanusGraphOperationStatus.ILLEGAL_ARGUMENT));
+ log.error(DATA_ERROR, this.getClass().getName(), "Dropping invalid value for property: {} , value: ", property, value);
+ return "";
}
} else {
Object object = isValid.left().value();
@@ -574,6 +577,10 @@ public abstract class BaseBusinessLogic {
if (isValidate) {
if (type == null) {
DataTypeDefinition dataTypeDefinition = dataTypes.get(propertyType);
+ if (dataTypeDefinition == null) {
+ log.debug(INVALID_PROPERTY_TYPE, propertyType);
+ return Either.right(false);
+ }
ImmutablePair<JsonElement, Boolean> validateResult = dataTypeValidatorConverter
.validateAndUpdate(value, dataTypeDefinition, dataTypes);
if (Boolean.FALSE.equals(validateResult.right)) {