summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--asdctool/src/main/resources/config/error-configuration.yaml8
-rw-r--r--catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/files/default/error-configuration.yaml8
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogic.java21
-rw-r--r--catalog-be/src/main/resources/config/error-configuration.yaml8
-rw-r--r--catalog-be/src/test/resources/config/catalog-be/error-configuration.yaml8
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/api/ActionStatus.java2
6 files changed, 44 insertions, 11 deletions
diff --git a/asdctool/src/main/resources/config/error-configuration.yaml b/asdctool/src/main/resources/config/error-configuration.yaml
index d3c637bcd3..3e31fa35b1 100644
--- a/asdctool/src/main/resources/config/error-configuration.yaml
+++ b/asdctool/src/main/resources/config/error-configuration.yaml
@@ -2901,3 +2901,11 @@ errors:
message: "Error: Missing metadata in Service",
messageId: "SVC4020"
}
+
+ #---------SVC4021-----------------------------
+ # %1 - missing properties list
+ MISSING_PROPERTIES_ERROR: {
+ code: 402,
+ message: "Error: Following properties are missing in CSAR:\n%1",
+ messageId: "SVC4021"
+ }
diff --git a/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/files/default/error-configuration.yaml b/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/files/default/error-configuration.yaml
index b91e378239..4a9b5d34f4 100644
--- a/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/files/default/error-configuration.yaml
+++ b/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/files/default/error-configuration.yaml
@@ -2918,3 +2918,11 @@ errors:
message: "Error: Missing metadata in Service",
messageId: "SVC4020"
}
+
+ #---------SVC4021-----------------------------
+ # %1 - missing properties list
+ MISSING_PROPERTIES_ERROR: {
+ code: 402,
+ message: "Error: Following properties are missing in CSAR:\n%1",
+ messageId: "SVC4021"
+ }
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogic.java
index ac14a3c683..c022304d8b 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogic.java
@@ -20,7 +20,6 @@ import static java.util.stream.Collectors.joining;
import static java.util.stream.Collectors.toList;
import static java.util.stream.Collectors.toMap;
import static org.apache.commons.collections.CollectionUtils.isNotEmpty;
-import static org.apache.hc.core5.http.HttpStatus.SC_BAD_REQUEST;
import static org.openecomp.sdc.be.components.impl.ImportUtils.findFirstToscaMapElement;
import static org.openecomp.sdc.be.components.impl.ImportUtils.findFirstToscaStringElement;
import static org.openecomp.sdc.be.components.impl.ImportUtils.getPropertyJsonStringValue;
@@ -31,8 +30,6 @@ import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import fj.data.Either;
-import java.io.IOException;
-import java.io.InputStream;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
@@ -53,7 +50,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
-import javax.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.collections.CollectionUtils;
@@ -61,8 +57,6 @@ import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.ImmutablePair;
-import org.janusgraph.core.JanusGraph;
-import org.janusgraph.core.JanusGraphTransaction;
import org.json.simple.JSONObject;
import org.openecomp.sdc.be.components.csar.CsarArtifactsAndGroupsBusinessLogic;
import org.openecomp.sdc.be.components.csar.CsarBusinessLogic;
@@ -175,8 +169,6 @@ import org.openecomp.sdc.common.datastructure.Wrapper;
import org.openecomp.sdc.common.kpi.api.ASDCKpiApi;
import org.openecomp.sdc.common.log.wrappers.Logger;
import org.openecomp.sdc.common.util.ValidationUtils;
-import org.openecomp.sdc.common.zip.ZipUtils;
-import org.openecomp.sdc.common.zip.exception.ZipException;
import org.openecomp.sdc.exception.ResponseFormat;
import org.springframework.beans.factory.annotation.Autowired;
import org.yaml.snakeyaml.Yaml;
@@ -852,6 +844,7 @@ public class ServiceImportBusinessLogic {
if (CollectionUtils.isNotEmpty(inputs)) {
final List<ComponentInstance> componentInstances = component.getComponentInstances();
final String componentUniqueId = component.getUniqueId();
+ List<String> propertyMissingNames = new ArrayList<>();
for (final InputDefinition input : inputs) {
boolean isSubMapProp = false;
if (substitutionMappingProperties != null && !substitutionMappingProperties.isEmpty()) {
@@ -861,9 +854,15 @@ public class ServiceImportBusinessLogic {
if (!isSubMapProp && isInputFromComponentInstanceProperty(input.getName(), componentInstances)) {
associateInputToComponentInstanceProperty(userId, input, componentInstances, componentUniqueId);
} else {
- associateInputToServiceProperty(userId, input, component, substitutionMappingProperties);
+ String propertyName = associateInputToServiceProperty(userId, input, component, substitutionMappingProperties);
+ if (StringUtils.isNotBlank(propertyName)) {
+ propertyMissingNames.add(propertyName);
+ }
}
}
+ if (CollectionUtils.isNotEmpty(propertyMissingNames)) {
+ throw new ComponentException(componentsUtils.getResponseFormat(ActionStatus.MISSING_PROPERTIES_ERROR, propertyMissingNames.toString()));
+ }
Either<List<InputDefinition>, StorageOperationStatus> either = toscaOperationFacade.updateInputsToComponent(inputs, componentUniqueId);
if (either.isRight()) {
throw new ComponentException(ActionStatus.GENERAL_ERROR);
@@ -930,7 +929,7 @@ public class ServiceImportBusinessLogic {
}
}
- private void associateInputToServiceProperty(final String userId,
+ private String associateInputToServiceProperty(final String userId,
final InputDefinition input, final Service component,
final Map<String, List<String>> substitutionMappingProperties) {
final List<PropertyDefinition> properties = component.getProperties();
@@ -962,8 +961,10 @@ public class ServiceImportBusinessLogic {
}
} else {
input.setMappedToComponentProperty(false);
+ return propertyNameFromInput.get();
}
}
+ return "";
}
private void updateProperty(final PropertyDefinition propertyDefinition, final InputDefinition input, final String componentUniqueId) {
diff --git a/catalog-be/src/main/resources/config/error-configuration.yaml b/catalog-be/src/main/resources/config/error-configuration.yaml
index ad8adce5fc..395d1ca031 100644
--- a/catalog-be/src/main/resources/config/error-configuration.yaml
+++ b/catalog-be/src/main/resources/config/error-configuration.yaml
@@ -2910,3 +2910,11 @@ errors:
message: "Error: Missing metadata in Service",
messageId: "SVC4020"
}
+
+ #---------SVC4021-----------------------------
+ # %1 - missing properties list
+ MISSING_PROPERTIES_ERROR: {
+ code: 402,
+ message: "Error: Following properties are missing in CSAR:\n%1",
+ messageId: "SVC4021"
+ }
diff --git a/catalog-be/src/test/resources/config/catalog-be/error-configuration.yaml b/catalog-be/src/test/resources/config/catalog-be/error-configuration.yaml
index 11ce71d488..b4c2c7aa81 100644
--- a/catalog-be/src/test/resources/config/catalog-be/error-configuration.yaml
+++ b/catalog-be/src/test/resources/config/catalog-be/error-configuration.yaml
@@ -2896,3 +2896,11 @@ errors:
message: "Error: Missing metadata in Service",
messageId: "SVC4020"
}
+
+ #---------SVC4021-----------------------------
+ # %1 - missing properties list
+ MISSING_PROPERTIES_ERROR: {
+ code: 402,
+ message: "Error: Following properties are missing in CSAR:\n%1",
+ messageId: "SVC4021"
+ }
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/api/ActionStatus.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/api/ActionStatus.java
index 4d6d552c63..52162fc272 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/api/ActionStatus.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/api/ActionStatus.java
@@ -84,7 +84,7 @@ public enum ActionStatus {
ANNOTATION_TYPE_ALREADY_EXIST,
// CSAR
MISSING_CSAR_UUID, CSAR_INVALID, CSAR_INVALID_FORMAT, CSAR_NOT_FOUND, YAML_NOT_FOUND_IN_CSAR, VSP_ALREADY_EXISTS, RESOURCE_LINKED_TO_DIFFERENT_VSP, RESOURCE_FROM_CSAR_NOT_FOUND, AAI_ARTIFACT_GENERATION_FAILED, ASSET_NOT_FOUND_DURING_CSAR_CREATION, ARTIFACT_PAYLOAD_NOT_FOUND_DURING_CSAR_CREATION, TOSCA_SCHEMA_FILES_NOT_FOUND, ARTIFACT_NAME_INVALID, ARTIFACT_PAYLOAD_EMPTY, ERROR_DURING_CSAR_CREATION, SERVICE_LINKED_TO_DIFFERENT_VSP,
- VSP_NOT_FOUND, VSP_FIND_ERROR, VSP_MODEL_NOT_ALLOWED, MISSING_SERVICE_METADATA,
+ VSP_NOT_FOUND, VSP_FIND_ERROR, VSP_MODEL_NOT_ALLOWED, MISSING_SERVICE_METADATA, MISSING_PROPERTIES_ERROR,
// Group
GROUP_HAS_CYCLIC_DEPENDENCY, GROUP_ALREADY_EXIST, GROUP_TYPE_IS_INVALID, GROUP_MISSING_GROUP_TYPE, GROUP_INVALID_COMPONENT_INSTANCE, GROUP_INVALID_TOSCA_NAME_OF_COMPONENT_INSTANCE, GROUP_IS_MISSING, GROUP_ARTIFACT_ALREADY_ASSOCIATED, GROUP_ARTIFACT_ALREADY_DISSOCIATED, GROUP_PROPERTY_NOT_FOUND, INVALID_VF_MODULE_NAME, INVALID_VF_MODULE_NAME_MODIFICATION, INVALID_VF_MODULE_TYPE,
// Group instance