aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--asdctool/src/main/resources/config/error-configuration.yaml3
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/CsarArtifactsAndGroupsBusinessLogic.java60
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CsarValidationUtils.java122
-rw-r--r--catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts12
4 files changed, 95 insertions, 102 deletions
diff --git a/asdctool/src/main/resources/config/error-configuration.yaml b/asdctool/src/main/resources/config/error-configuration.yaml
index 23170b55b7..b9f1858bdd 100644
--- a/asdctool/src/main/resources/config/error-configuration.yaml
+++ b/asdctool/src/main/resources/config/error-configuration.yaml
@@ -1325,9 +1325,10 @@ errors:
}
#---------SVC4605------------------------------
# %1 - csar file name
+ # %2 - error message
CSAR_INVALID_FORMAT: {
code: 400,
- message: "Error: TOSCA CSAR '%1' is invalid. Invalid 'TOSCA-Metadata/Tosca.meta' file format.",
+ message: "Error: TOSCA CSAR '%1' is invalid. Invalid 'TOSCA-Metadata/Tosca.meta' file format.\n%2",
messageId: "SVC4605"
}
#---------SVC4606------------------------------
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/CsarArtifactsAndGroupsBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/CsarArtifactsAndGroupsBusinessLogic.java
index 448077b6b5..93a55aebc8 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/CsarArtifactsAndGroupsBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/CsarArtifactsAndGroupsBusinessLogic.java
@@ -474,20 +474,22 @@ public class CsarArtifactsAndGroupsBusinessLogic extends BaseBusinessLogic {
jsonElement = gson.fromJson(artifactsMetaFile, jsonElement.getClass());
JsonElement importStructureElement = jsonElement.get(Constants.IMPORT_STRUCTURE);
if (importStructureElement == null || importStructureElement.isJsonNull()) {
- log.debug(ARTIFACT_FILE_IS_NOT_IN_EXPECTED_FORMAT_FILE_NAME, artifactFileName);
+ log.error(ARTIFACT_FILE_IS_NOT_IN_EXPECTED_FORMAT_FILE_NAME, artifactFileName);
BeEcompErrorManager.getInstance()
.logInternalDataError(ARTIFACT_FILE_IS_NOT_IN_EXPECTED_FORMAT_FILE_NAME + artifactFileName, ARTIFACT_INTERNALS_ARE_INVALID,
ErrorSeverity.ERROR);
- return Either.right(componentsUtils.getResponseFormat(ActionStatus.CSAR_INVALID_FORMAT, artifactFileName));
+ return Either.right(componentsUtils.getResponseFormat(ActionStatus.CSAR_INVALID_FORMAT, artifactFileName,
+ ARTIFACT_FILE_IS_NOT_IN_EXPECTED_FORMAT_FILE_NAME, artifactFileName));
}
Map<String, List<Map<String, Object>>> artifactTemplateMap;
artifactTemplateMap = ComponentsUtils.parseJsonToObject(importStructureElement.toString(), HashMap.class);
if (artifactTemplateMap.isEmpty()) {
- log.debug(ARTIFACT_FILE_IS_NOT_IN_EXPECTED_FORMAT_FILE_NAME, artifactFileName);
+ log.error(ARTIFACT_FILE_IS_NOT_IN_EXPECTED_FORMAT_FILE_NAME, artifactFileName);
BeEcompErrorManager.getInstance()
.logInternalDataError(ARTIFACT_FILE_IS_NOT_IN_EXPECTED_FORMAT_FILE_NAME + artifactFileName, ARTIFACT_INTERNALS_ARE_INVALID,
ErrorSeverity.ERROR);
- return Either.right(componentsUtils.getResponseFormat(ActionStatus.CSAR_INVALID_FORMAT, artifactFileName));
+ return Either.right(componentsUtils.getResponseFormat(ActionStatus.CSAR_INVALID_FORMAT, artifactFileName,
+ ARTIFACT_FILE_IS_NOT_IN_EXPECTED_FORMAT_FILE_NAME, artifactFileName));
}
Set<String> artifactsTypeKeys = artifactTemplateMap.keySet();
Map<String, List<ArtifactTemplateInfo>> artifactsMap = new HashMap<>();
@@ -508,12 +510,13 @@ public class CsarArtifactsAndGroupsBusinessLogic extends BaseBusinessLogic {
}
return Either.left(artifactsMap);
} catch (Exception e) {
- log.debug(ARTIFACT_FILE_IS_NOT_IN_EXPECTED_FORMAT_FILE_NAME, artifactFileName);
- log.debug("failed with exception.", e);
+ log.error(ARTIFACT_FILE_IS_NOT_IN_EXPECTED_FORMAT_FILE_NAME, artifactFileName);
+ log.error("failed with exception.", e);
BeEcompErrorManager.getInstance()
.logInternalDataError(ARTIFACT_FILE_IS_NOT_IN_EXPECTED_FORMAT_FILE_NAME + artifactFileName, ARTIFACT_INTERNALS_ARE_INVALID,
ErrorSeverity.ERROR);
- return Either.right(componentsUtils.getResponseFormat(ActionStatus.CSAR_INVALID_FORMAT, artifactFileName));
+ return Either.right(componentsUtils.getResponseFormat(ActionStatus.CSAR_INVALID_FORMAT, artifactFileName,
+ ARTIFACT_FILE_IS_NOT_IN_EXPECTED_FORMAT_FILE_NAME, artifactFileName));
}
}
@@ -524,7 +527,7 @@ public class CsarArtifactsAndGroupsBusinessLogic extends BaseBusinessLogic {
List<Map<String, Object>> o = artifactTemplateMap.get(artifactsTypeKey);
Either<List<ArtifactTemplateInfo>, ResponseFormat> artifactTemplateInfoListPairStatus = createArtifactTemplateInfoModule(artifactsTypeKey, o);
if (artifactTemplateInfoListPairStatus.isRight()) {
- log.debug(ARTIFACT_FILE_IS_NOT_IN_EXPECTED_FORMAT_FILE_NAME, artifactFileName);
+ log.error(ARTIFACT_FILE_IS_NOT_IN_EXPECTED_FORMAT_FILE_NAME, artifactFileName);
BeEcompErrorManager.getInstance()
.logInternalDataError(ARTIFACT_FILE_IS_NOT_IN_EXPECTED_FORMAT_FILE_NAME + artifactFileName, ARTIFACT_INTERNALS_ARE_INVALID,
ErrorSeverity.ERROR);
@@ -532,11 +535,12 @@ public class CsarArtifactsAndGroupsBusinessLogic extends BaseBusinessLogic {
}
List<ArtifactTemplateInfo> artifactTemplateInfoList = artifactTemplateInfoListPairStatus.left().value();
if (artifactTemplateInfoList == null) {
- log.debug(ARTIFACT_FILE_IS_NOT_IN_EXPECTED_FORMAT_FILE_NAME, artifactFileName);
+ log.error(ARTIFACT_FILE_IS_NOT_IN_EXPECTED_FORMAT_FILE_NAME, artifactFileName);
BeEcompErrorManager.getInstance()
.logInternalDataError(ARTIFACT_FILE_IS_NOT_IN_EXPECTED_FORMAT_FILE_NAME + artifactFileName, ARTIFACT_INTERNALS_ARE_INVALID,
ErrorSeverity.ERROR);
- return Either.right(componentsUtils.getResponseFormat(ActionStatus.CSAR_INVALID_FORMAT, artifactFileName));
+ return Either.right(componentsUtils.getResponseFormat(ActionStatus.CSAR_INVALID_FORMAT, artifactFileName,
+ ARTIFACT_FILE_IS_NOT_IN_EXPECTED_FORMAT_FILE_NAME, artifactFileName));
}
if (!artifactsTypeKey.equalsIgnoreCase(ArtifactTemplateInfo.CSAR_ARTIFACT)) {
allGroups.addAll(artifactTemplateInfoList);
@@ -707,7 +711,7 @@ public class CsarArtifactsAndGroupsBusinessLogic extends BaseBusinessLogic {
if (op.isPresent()) {
res = op.get();
if (!res.getArtifactType().equalsIgnoreCase(artifactTemplateInfo.getType())) {
- log.debug(ARTIFACT_WITH_NAME_AND_TYPE_ALREADY_EXIST_WITH_TYPE, artifactFileName, artifactTemplateInfo.getType(),
+ log.error(ARTIFACT_WITH_NAME_AND_TYPE_ALREADY_EXIST_WITH_TYPE, artifactFileName, artifactTemplateInfo.getType(),
res.getArtifactType());
BeEcompErrorManager.getInstance()
.logInternalDataError(ARTIFACT_FILE_IS_NOT_IN_EXPECTED_FORMAT_FILE_NAME + artifactFileName, ARTIFACT_INTERNALS_ARE_INVALID,
@@ -784,7 +788,7 @@ public class CsarArtifactsAndGroupsBusinessLogic extends BaseBusinessLogic {
Either<ArtifactDefinition, StorageOperationStatus> updateArtifactOnResource = artifactToscaOperation
.updateArtifactOnResource(artifactInfoHeatEnv, updatedResource, artifactInfoHeatEnv.getUniqueId(), null, null, true);
if (updateArtifactOnResource.isRight()) {
- log.debug("Failed to update heat env on CSAR flow for component {} artifact {} label {}", updatedResource.getUniqueId(),
+ log.error("Failed to update heat env on CSAR flow for component {} artifact {} label {}", updatedResource.getUniqueId(),
artifactInfoHeatEnv.getUniqueId(), artifactInfoHeatEnv.getArtifactLabel());
return Either.right(
componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(updateArtifactOnResource.right().value())));
@@ -804,7 +808,7 @@ public class CsarArtifactsAndGroupsBusinessLogic extends BaseBusinessLogic {
Either<List<HeatParameterDefinition>, ResultStatusEnum> heatParameters = ImportUtils
.getHeatParamsWithoutImplicitTypes(heatDecodedPayload, artifactType);
if (heatParameters.isRight()) {
- log.debug("File {} is not in expected key-value form in csar ", fileName);
+ log.error("File {} is not in expected key-value form in csar ", fileName);
BeEcompErrorManager.getInstance()
.logInternalDataError("File " + fileName + " is not in expected key-value form in csar ", "CSAR internals are invalid",
ErrorSeverity.ERROR);
@@ -844,7 +848,7 @@ public class CsarArtifactsAndGroupsBusinessLogic extends BaseBusinessLogic {
Either<ArtifactDefinition, StorageOperationStatus> updateArtifactOnResource = artifactToscaOperation
.updateArtifactOnResource(currentInfo, resource, currentInfo.getUniqueId(), null, null, true);
if (updateArtifactOnResource.isRight()) {
- log.debug("Failed to update heat parameters of heat on CSAR flow for component {} artifact {} label {}", resource.getUniqueId(),
+ log.error("Failed to update heat parameters of heat on CSAR flow for component {} artifact {} label {}", resource.getUniqueId(),
currentInfo.getUniqueId(), currentInfo.getArtifactLabel());
return Either
.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(updateArtifactOnResource.right().value())));
@@ -865,11 +869,11 @@ public class CsarArtifactsAndGroupsBusinessLogic extends BaseBusinessLogic {
result = artifactsBusinessLogic
.handleLoadedArtifact(component, user, operation, false, true, component.getComponentType(), artifactDefinitionFromJson);
} catch (ComponentException e) {
- log.debug(FAILED_UPLOAD_ARTIFACT_TO_COMPONENT, component.getComponentType(), component.getName());
+ log.error(FAILED_UPLOAD_ARTIFACT_TO_COMPONENT, component.getComponentType(), component.getName());
return Either.right(componentsUtils.getResponseFormat(e));
} catch (Exception e) {
ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR);
- log.debug("Exception occurred when createOrUpdateCsarArtifactFromJson, error is:{}", e.getMessage(), e);
+ log.error("Exception occurred when createOrUpdateCsarArtifactFromJson, error is:{}", e.getMessage(), e);
return Either.right(responseFormat);
}
return Either.left(result);
@@ -1239,7 +1243,7 @@ public class CsarArtifactsAndGroupsBusinessLogic extends BaseBusinessLogic {
artifactUid = artifactFromResource.getUniqueId();
artifactUUID = artifactFromResource.getArtifactUUID();
if (!artifactFromResource.getArtifactType().equalsIgnoreCase(artifactTemplateInfo.getType())) {
- log.debug(ARTIFACT_WITH_NAME_AND_TYPE_ALREADY_EXIST_WITH_TYPE, artifactFileName, artifactTemplateInfo.getType(),
+ log.error(ARTIFACT_WITH_NAME_AND_TYPE_ALREADY_EXIST_WITH_TYPE, artifactFileName, artifactTemplateInfo.getType(),
artifactFromResource.getArtifactType());
BeEcompErrorManager.getInstance().logInternalDataError(ARTIFACT_FILE_IS_NOT_IN_EXPECTED_FORMAT_FILE_NAME + artifactFileName,
ARTIFACT_INTERNALS_ARE_INVALID, ErrorSeverity.ERROR);
@@ -1259,7 +1263,7 @@ public class CsarArtifactsAndGroupsBusinessLogic extends BaseBusinessLogic {
artifactUid = createdArtifact.getUniqueId();
artifactUUID = createdArtifact.getArtifactUUID();
if (!createdArtifact.getArtifactType().equalsIgnoreCase(artifactTemplateInfo.getType())) {
- log.debug(ARTIFACT_WITH_NAME_AND_TYPE_ALREADY_EXIST_WITH_TYPE, artifactFileName, artifactTemplateInfo.getType(),
+ log.error(ARTIFACT_WITH_NAME_AND_TYPE_ALREADY_EXIST_WITH_TYPE, artifactFileName, artifactTemplateInfo.getType(),
createdArtifact.getArtifactType());
BeEcompErrorManager.getInstance().logInternalDataError(ARTIFACT_FILE_IS_NOT_IN_EXPECTED_FORMAT_FILE_NAME + artifactFileName,
ARTIFACT_INTERNALS_ARE_INVALID, ErrorSeverity.ERROR);
@@ -1374,17 +1378,7 @@ public class CsarArtifactsAndGroupsBusinessLogic extends BaseBusinessLogic {
List<ArtifactTemplateInfo> associatedArtifact = associateEntry.getValue();
Set<String> arifactsUids = new HashSet<>();
Set<String> arifactsUuids = new HashSet<>();
- for (ArtifactTemplateInfo artifactTemplate : associatedArtifact) { // try
-
- // to
-
- // find
-
- // artifact
-
- // in
-
- // resource
+ for (ArtifactTemplateInfo artifactTemplate : associatedArtifact) { // try to find artifact in resource
boolean isCreate = true;
for (ArtifactDefinition createdArtifact : createdDeploymentArtifactsAfterDelete) {
if (artifactTemplate.getFileName().equalsIgnoreCase(createdArtifact.getArtifactName())) {
@@ -1474,7 +1468,7 @@ public class CsarArtifactsAndGroupsBusinessLogic extends BaseBusinessLogic {
for (ArtifactDefinition updatedArtifact : updatedArtifacts) {
if (updatedArtifact.getArtifactName().equals(artifactFileName)) {
if (!updatedArtifact.getArtifactType().equalsIgnoreCase(artifactTemplateInfo.getType())) {
- log.debug("Artifact with name {} and type {} already updated with type {}", artifactFileName, artifactTemplateInfo.getType(),
+ log.error("Artifact with name {} and type {} already updated with type {}", artifactFileName, artifactTemplateInfo.getType(),
updatedArtifact.getArtifactType());
BeEcompErrorManager.getInstance()
.logInternalDataError(ARTIFACT_FILE_IS_NOT_IN_EXPECTED_FORMAT_FILE_NAME + artifactFileName, ARTIFACT_INTERNALS_ARE_INVALID,
@@ -1507,7 +1501,7 @@ public class CsarArtifactsAndGroupsBusinessLogic extends BaseBusinessLogic {
Either<ArtifactDefinition, ResponseFormat> updateEnvEither = updateHeatParamsFromCsar(resource, csarInfo, artifactTemplateInfo, currentInfo,
true);
if (updateEnvEither.isRight()) {
- log.debug("failed to update parameters to artifact {}", artifactFileName);
+ log.error("failed to update parameters to artifact {}", artifactFileName);
return Either.right(updateEnvEither.right().value());
}
artifactsBusinessLogic.updateGroupForHeat(previousInfo, updateEnvEither.left().value(), resource);
@@ -1529,7 +1523,7 @@ public class CsarArtifactsAndGroupsBusinessLogic extends BaseBusinessLogic {
.handleDelete(updatedResource.getUniqueId(), artifactId, csarInfo.getModifier(), updatedResource, shouldLock,
inTransaction);
if (handleDelete.isRight()) {
- log.debug("Couldn't delete artifact {}", artifactId);
+ log.error("Couldn't delete artifact {}", artifactId);
return Either.right(handleDelete.right().value());
}
}
@@ -1574,7 +1568,7 @@ public class CsarArtifactsAndGroupsBusinessLogic extends BaseBusinessLogic {
Either<ArtifactDefinition, ResponseFormat> handleDelete = artifactsBusinessLogic
.handleDelete(resource.getUniqueId(), artifactId, csarInfo.getModifier(), resource, shouldLock, inTransaction);
if (handleDelete.isRight()) {
- log.debug("Couldn't delete artifact {}", artifactId);
+ log.error("Couldn't delete artifact {}", artifactId);
return Either.right(handleDelete.right().value());
}
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CsarValidationUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CsarValidationUtils.java
index 1f7d9493d4..539b6b8536 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CsarValidationUtils.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CsarValidationUtils.java
@@ -50,9 +50,9 @@ public class CsarValidationUtils {
private static final String CSAR_VERSION = "CSAR-Version";
private static final String CREATED_BY = "Created-By";
private static final String NEW_LINE_DELM = "\n";
- public static final String TOSCA_METADATA = "TOSCA-Metadata";
- public static final String TOSCA_FILE = "TOSCA.meta";
- public static final String DEL_PATTERN = "([/\\\\]+)";
+ private static final String TOSCA_METADATA = "TOSCA-Metadata";
+ private static final String TOSCA_FILE = "TOSCA.meta";
+ private static final String DEL_PATTERN = "([/\\\\]+)";
public static final String TOSCA_METADATA_PATH_PATTERN = TOSCA_METADATA +
// Artifact Group (i.e Deployment/Informational)
DEL_PATTERN + TOSCA_FILE;
@@ -86,13 +86,13 @@ public class CsarValidationUtils {
public static Either<Boolean, ResponseFormat> validateCsar(Map<String, byte[]> csar, String csarUUID, ComponentsUtils componentsUtils) {
Either<Boolean, ResponseFormat> validateStatus = validateIsTOSCAMetadataExist(csar, csarUUID, componentsUtils);
if (validateStatus.isRight()) {
- return Either.right(validateStatus.right().value());
+ return validateStatus;
}
removeNonUniqueArtifactsFromCsar(csar);
log.trace("TOSCA-Metadata/TOSCA.meta file found, CSAR id {}", csarUUID);
validateStatus = validateTOSCAMetadataFile(csar, csarUUID, componentsUtils);
if (validateStatus.isRight()) {
- return Either.right(validateStatus.right().value());
+ return validateStatus;
}
return Either.left(true);
}
@@ -148,51 +148,50 @@ public class CsarValidationUtils {
Pattern pattern = Pattern.compile(TOSCA_METADATA_PATH_PATTERN);
Optional<String> keyOp = csar.keySet().stream().filter(k -> pattern.matcher(k).matches()).findAny();
if (keyOp.isEmpty()) {
- log.debug(TOSCA_METADATA_TOSCA_META_FILE_IS_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_CSAR_ID, csarUUID);
+ log.error(TOSCA_METADATA_TOSCA_META_FILE_IS_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_CSAR_ID, csarUUID);
BeEcompErrorManager.getInstance()
- .logInternalDataError(TOSCA_METADATA_TOSCA_META_FILE_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_WITH_ID + csarUUID,
- CSAR_INTERNALS_ARE_INVALID, ErrorSeverity.ERROR);
- return Either.right(componentsUtils.getResponseFormat(ActionStatus.CSAR_INVALID_FORMAT, csarUUID));
+ .logInternalDataError(TOSCA_METADATA_TOSCA_META_FILE_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_WITH_ID + csarUUID,
+ CSAR_INTERNALS_ARE_INVALID, ErrorSeverity.ERROR);
+ return Either.right(componentsUtils.getResponseFormat(ActionStatus.CSAR_INVALID_FORMAT, csarUUID,
+ TOSCA_METADATA_TOSCA_META_FILE_IS_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_CSAR_ID, csarUUID));
}
Properties props = new Properties();
try {
props.load(new StringReader(new String(csar.get(keyOp.get())).replace("\\", "\\\\")));
} catch (IOException e) {
- log.debug(TOSCA_METADATA_TOSCA_META_FILE_IS_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_CSAR_ID, csarUUID, e);
+ log.error(TOSCA_METADATA_TOSCA_META_FILE_IS_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_CSAR_ID, csarUUID, e);
BeEcompErrorManager.getInstance()
- .logInternalDataError(TOSCA_METADATA_TOSCA_META_FILE_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_WITH_ID + csarUUID,
- CSAR_INTERNALS_ARE_INVALID, ErrorSeverity.ERROR);
- return Either.right(componentsUtils.getResponseFormat(ActionStatus.CSAR_INVALID_FORMAT, csarUUID));
+ .logInternalDataError(TOSCA_METADATA_TOSCA_META_FILE_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_WITH_ID + csarUUID,
+ CSAR_INTERNALS_ARE_INVALID, ErrorSeverity.ERROR);
+ return Either.right(componentsUtils.getResponseFormat(ActionStatus.CSAR_INVALID_FORMAT, csarUUID,
+ TOSCA_METADATA_TOSCA_META_FILE_IS_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_CSAR_ID, csarUUID));
}
String yamlFileName = props.getProperty(TOSCA_META_ENTRY_DEFINITIONS);
- String[] ops = yamlFileName.split(DEL_PATTERN);
- List<String> list = Arrays.asList(ops);
- String result = list.stream().map(x -> x).collect(Collectors.joining(DEL_PATTERN));
+ String result = Arrays.asList(yamlFileName.split(DEL_PATTERN)).stream().map(x -> x).collect(Collectors.joining(DEL_PATTERN));
keyOp = csar.keySet().stream().filter(k -> Pattern.compile(result).matcher(k).matches()).findAny();
- if (!keyOp.isPresent()) {
- log.debug(ENTRY_DEFINITIONS_ENTRY_NOT_FOUND_IN_TOSCA_METADATA_TOSCA_META_FILE_CSAR_ID, csarUUID);
+ if (keyOp.isEmpty()) {
+ log.error(ENTRY_DEFINITIONS_ENTRY_NOT_FOUND_IN_TOSCA_METADATA_TOSCA_META_FILE_CSAR_ID, csarUUID);
BeEcompErrorManager.getInstance()
- .logInternalDataError(ENTRY_DEFINITIONS_ENTRY_NOT_FOUND_IN_TOSCA_METADATA_TOSCA_META_FILE_CSAR_ID + csarUUID,
- CSAR_INTERNALS_ARE_INVALID, ErrorSeverity.ERROR);
+ .logInternalDataError(ENTRY_DEFINITIONS_ENTRY_NOT_FOUND_IN_TOSCA_METADATA_TOSCA_META_FILE_CSAR_ID + csarUUID,
+ CSAR_INTERNALS_ARE_INVALID, ErrorSeverity.ERROR);
return Either.right(componentsUtils.getResponseFormat(ActionStatus.YAML_NOT_FOUND_IN_CSAR, csarUUID, yamlFileName));
}
log.trace("Found Entry-Definitions property in TOSCA-Metadata/TOSCA.meta, Entry-Definitions: {}, CSAR id: {}", yamlFileName, csarUUID);
byte[] yamlFileBytes = csar.get(yamlFileName);
if (yamlFileBytes == null) {
- log.debug("Entry-Definitions {} file not found in csar, csar ID {}", yamlFileName, csarUUID);
+ log.error("Entry-Definitions {} file not found in csar, csar ID {}", yamlFileName, csarUUID);
BeEcompErrorManager.getInstance()
- .logInternalDataError(ENTRY_DEFINITIONS + yamlFileName + FILE_NOT_FOUND_IN_CSAR_WITH_ID + csarUUID, CSAR_STRUCTURE_IS_INVALID,
- ErrorSeverity.ERROR);
+ .logInternalDataError(ENTRY_DEFINITIONS + yamlFileName + FILE_NOT_FOUND_IN_CSAR_WITH_ID + csarUUID, CSAR_STRUCTURE_IS_INVALID,
+ ErrorSeverity.ERROR);
return Either.right(componentsUtils.getResponseFormat(ActionStatus.YAML_NOT_FOUND_IN_CSAR, csarUUID, yamlFileName));
}
- String yamlFileContents = new String(yamlFileBytes);
- return Either.left(new ImmutablePair<>(yamlFileName, yamlFileContents));
+ return Either.left(new ImmutablePair<>(yamlFileName, new String(yamlFileBytes)));
}
public static Either<ImmutablePair<String, String>, ResponseFormat> getArtifactsMeta(Map<String, byte[]> csar, String csarUUID,
ComponentsUtils componentsUtils) {
if (!csar.containsKey(CsarUtils.ARTIFACTS_PATH + ARTIFACTS_METADATA_FILE)) {
- log.debug(ENTRY_DEFINITIONS_ENTRY_NOT_FOUND_IN_TOSCA_METADATA_TOSCA_META_FILE_CSAR_ID, csarUUID);
+ log.error(ENTRY_DEFINITIONS_ENTRY_NOT_FOUND_IN_TOSCA_METADATA_TOSCA_META_FILE_CSAR_ID, csarUUID);
BeEcompErrorManager.getInstance()
.logInternalDataError(ENTRY_DEFINITIONS_ENTRY_NOT_FOUND_IN_TOSCA_METADATA_TOSCA_META_FILE_CSAR_ID + csarUUID,
CSAR_INTERNALS_ARE_INVALID, ErrorSeverity.ERROR);
@@ -202,22 +201,21 @@ public class CsarValidationUtils {
csarUUID);
byte[] artifactsMetaBytes = csar.get(CsarUtils.ARTIFACTS_PATH + ARTIFACTS_METADATA_FILE);
if (artifactsMetaBytes == null) {
- log.debug("Entry-Definitions {}{} file not found in csar, csar ID {}", CsarUtils.ARTIFACTS_PATH, ARTIFACTS_METADATA_FILE, csarUUID);
+ log.error("Entry-Definitions {}{} file not found in csar, csar ID {}", CsarUtils.ARTIFACTS_PATH, ARTIFACTS_METADATA_FILE, csarUUID);
BeEcompErrorManager.getInstance().logInternalDataError(
ENTRY_DEFINITIONS + CsarUtils.ARTIFACTS_PATH + ARTIFACTS_METADATA_FILE + FILE_NOT_FOUND_IN_CSAR_WITH_ID + csarUUID,
CSAR_STRUCTURE_IS_INVALID, ErrorSeverity.ERROR);
return Either.right(
componentsUtils.getResponseFormat(ActionStatus.YAML_NOT_FOUND_IN_CSAR, csarUUID, CsarUtils.ARTIFACTS_PATH + ARTIFACTS_METADATA_FILE));
}
- String artifactsFileContents = new String(artifactsMetaBytes);
- return Either.left(new ImmutablePair<>(CsarUtils.ARTIFACTS_PATH + ARTIFACTS_METADATA_FILE, artifactsFileContents));
+ return Either.left(new ImmutablePair<>(CsarUtils.ARTIFACTS_PATH + ARTIFACTS_METADATA_FILE, new String(artifactsMetaBytes)));
}
public static Either<ImmutablePair<String, byte[]>, ResponseFormat> getArtifactContent(String csarUUID, Map<String, byte[]> csar,
String artifactPath, String artifactName,
ComponentsUtils componentsUtils) {
if (!csar.containsKey(artifactPath)) {
- log.debug("Entry-Definitions entry not found in Artifacts/HEAT.meta file, csar ID {}", csarUUID);
+ log.error("Entry-Definitions entry not found in Artifacts/HEAT.meta file, csar ID {}", csarUUID);
BeEcompErrorManager.getInstance()
.logInternalDataError(ENTRY_DEFINITIONS_ENTRY_NOT_FOUND_IN_TOSCA_METADATA_TOSCA_META_FILE_CSAR_ID + csarUUID,
CSAR_INTERNALS_ARE_INVALID, ErrorSeverity.ERROR);
@@ -227,7 +225,7 @@ public class CsarValidationUtils {
log.trace("Found Entry-Definitions property in Artifacts/HEAT.meta, Entry-Definitions: {}, CSAR id: {}", artifactPath, csarUUID);
byte[] artifactFileBytes = csar.get(artifactPath);
if (artifactFileBytes == null) {
- log.debug("Entry-Definitions {}{} file not found in csar, csar ID {}", CsarUtils.ARTIFACTS_PATH, artifactName, csarUUID);
+ log.error("Entry-Definitions {}{} file not found in csar, csar ID {}", CsarUtils.ARTIFACTS_PATH, artifactName, csarUUID);
BeEcompErrorManager.getInstance()
.logInternalDataError(ENTRY_DEFINITIONS + artifactPath + FILE_NOT_FOUND_IN_CSAR_WITH_ID + csarUUID, CSAR_STRUCTURE_IS_INVALID,
ErrorSeverity.ERROR);
@@ -240,26 +238,27 @@ public class CsarValidationUtils {
ComponentsUtils componentsUtils) {
Pattern pattern = Pattern.compile(TOSCA_METADATA_PATH_PATTERN);
Optional<String> keyOp = csar.keySet().stream().filter(k -> pattern.matcher(k).matches()).findAny();
- if (!keyOp.isPresent()) {
- log.debug(TOSCA_METADATA_TOSCA_META_FILE_IS_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_CSAR_ID, csarUUID);
+ if (keyOp.isEmpty()) {
+ log.error(TOSCA_METADATA_TOSCA_META_FILE_IS_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_CSAR_ID, csarUUID);
BeEcompErrorManager.getInstance()
.logInternalDataError(TOSCA_METADATA_TOSCA_META_FILE_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_WITH_ID + csarUUID,
CSAR_INTERNALS_ARE_INVALID, ErrorSeverity.ERROR);
- return Either.right(componentsUtils.getResponseFormat(ActionStatus.CSAR_INVALID_FORMAT, csarUUID));
+ return Either.right(componentsUtils.getResponseFormat(ActionStatus.CSAR_INVALID_FORMAT, csarUUID,
+ TOSCA_METADATA_TOSCA_META_FILE_IS_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_CSAR_ID, csarUUID));
}
- byte[] toscaMetaBytes = csar.get(keyOp.get());
- String toscaMetadata = new String(toscaMetaBytes);
+ String toscaMetadata = new String(csar.get(keyOp.get()));
String[] splited = toscaMetadata.split(NEW_LINE_DELM);
if (splited == null || splited.length < TOSCA_METADATA_FIELDS.length) {
- log.debug(TOSCA_METADATA_TOSCA_META_FILE_IS_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_CSAR_ID, csarUUID);
+ log.error(TOSCA_METADATA_TOSCA_META_FILE_IS_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_CSAR_ID, csarUUID);
BeEcompErrorManager.getInstance()
.logInternalDataError(TOSCA_METADATA_TOSCA_META_FILE_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_WITH_ID + csarUUID,
CSAR_INTERNALS_ARE_INVALID, ErrorSeverity.ERROR);
- return Either.right(componentsUtils.getResponseFormat(ActionStatus.CSAR_INVALID_FORMAT, csarUUID));
+ return Either.right(componentsUtils.getResponseFormat(ActionStatus.CSAR_INVALID_FORMAT, csarUUID,
+ TOSCA_METADATA_TOSCA_META_FILE_IS_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_CSAR_ID, csarUUID));
}
Either<Boolean, ResponseFormat> blockStatus = validateBlock(csarUUID, splited, componentsUtils);
if (blockStatus.isRight()) {
- return Either.right(blockStatus.right().value());
+ return blockStatus;
}
return Either.left(true);
}
@@ -271,36 +270,38 @@ public class CsarValidationUtils {
try {
props.load(new ByteArrayInputStream(splited[index].getBytes()));
} catch (IOException e) {
- log.debug(TOSCA_METADATA_TOSCA_META_FILE_IS_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_CSAR_ID, csarUUID, e);
+ log.error(TOSCA_METADATA_TOSCA_META_FILE_IS_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_CSAR_ID, csarUUID, e);
BeEcompErrorManager.getInstance()
.logInternalDataError(TOSCA_METADATA_TOSCA_META_FILE_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_WITH_ID + csarUUID,
CSAR_INTERNALS_ARE_INVALID, ErrorSeverity.ERROR);
- return Either.right(componentsUtils.getResponseFormat(ActionStatus.CSAR_INVALID_FORMAT, csarUUID));
+ return Either.right(componentsUtils.getResponseFormat(ActionStatus.CSAR_INVALID_FORMAT, csarUUID,
+ TOSCA_METADATA_TOSCA_META_FILE_IS_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_CSAR_ID, csarUUID));
}
if (!props.containsKey(toscaField)) {
- log.debug("TOSCA.meta file format is invalid: No new line after block_0 as expected in csar, csar ID {}", csarUUID);
+ final String msg = "TOSCA.meta file format is invalid: No new line after block_0 as expected in csar, csar ID {}";
+ log.error(msg, csarUUID);
BeEcompErrorManager.getInstance()
.logInternalDataError(TOSCA_METADATA_TOSCA_META_FILE_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_WITH_ID + csarUUID,
CSAR_INTERNALS_ARE_INVALID, ErrorSeverity.ERROR);
- return Either.right(componentsUtils.getResponseFormat(ActionStatus.CSAR_INVALID_FORMAT, csarUUID));
+ return Either.right(componentsUtils.getResponseFormat(ActionStatus.CSAR_INVALID_FORMAT, csarUUID, msg, csarUUID));
}
- String value = props.getProperty(toscaField);
+ final String value = props.getProperty(toscaField);
if (value == null || value.isEmpty()) {
- log.debug(TOSCA_METADATA_TOSCA_META_FILE_IS_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_CSAR_ID, csarUUID);
+ log.error(TOSCA_METADATA_TOSCA_META_FILE_IS_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_CSAR_ID, csarUUID);
BeEcompErrorManager.getInstance()
.logInternalDataError(TOSCA_METADATA_TOSCA_META_FILE_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_WITH_ID + csarUUID,
CSAR_INTERNALS_ARE_INVALID, ErrorSeverity.ERROR);
- return Either.right(componentsUtils.getResponseFormat(ActionStatus.CSAR_INVALID_FORMAT, csarUUID));
+ return Either.right(componentsUtils.getResponseFormat(ActionStatus.CSAR_INVALID_FORMAT, csarUUID,
+ TOSCA_METADATA_TOSCA_META_FILE_IS_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_CSAR_ID, csarUUID));
}
- // TOSCA-Meta-File-Version & CSAR-Version : digit.digit - format
-
- // validation
+ // TOSCA-Meta-File-Version & CSAR-Version : digit.digit - format validation
if ((toscaField.equals(TOSCA_META_FILE_VERSION) || toscaField.equals(CSAR_VERSION)) && !validateTOSCAMetaProperty(value)) {
- log.debug("TOSCA-Metadata/TOSCA.meta file contains {} in wrong format (digit.digit), csar ID {}", toscaField, csarUUID);
+ final String msg = "TOSCA-Metadata/TOSCA.meta file contains {} in wrong format (digit.digit), csar ID {}";
+ log.error(msg, toscaField, csarUUID);
BeEcompErrorManager.getInstance()
.logInternalDataError(TOSCA_METADATA_TOSCA_META_FILE_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_WITH_ID + csarUUID,
CSAR_INTERNALS_ARE_INVALID, ErrorSeverity.ERROR);
- return Either.right(componentsUtils.getResponseFormat(ActionStatus.CSAR_INVALID_FORMAT, csarUUID));
+ return Either.right(componentsUtils.getResponseFormat(ActionStatus.CSAR_INVALID_FORMAT, csarUUID, msg, toscaField, csarUUID));
}
index++;
}
@@ -308,22 +309,20 @@ public class CsarValidationUtils {
}
private static boolean validateTOSCAMetaProperty(String toscaProperty) {
- Matcher floatMatcher = floatPattern.matcher(toscaProperty);
- return floatMatcher.matches();
+ return floatPattern.matcher(toscaProperty).matches();
}
private static Either<Boolean, ResponseFormat> validateIsTOSCAMetadataExist(Map<String, byte[]> csar, String csarUUID,
ComponentsUtils componentsUtils) {
if (csar == null || csar.isEmpty()) {
- log.debug("Error when fetching csar with ID {}", csarUUID);
+ log.error("Error when fetching csar with ID {}", csarUUID);
BeEcompErrorManager.getInstance().logBeDaoSystemError("Creating resource from CSAR: fetching CSAR with id " + csarUUID + " failed");
- ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.CSAR_INVALID, csarUUID);
- return Either.right(responseFormat);
+ return Either.right(componentsUtils.getResponseFormat(ActionStatus.CSAR_INVALID, csarUUID));
}
Pattern pattern = Pattern.compile(TOSCA_METADATA_PATH_PATTERN);
Optional<String> keyOp = csar.keySet().stream().filter(k -> pattern.matcher(k).matches()).findAny();
- if (!keyOp.isPresent()) {
- log.debug("TOSCA-Metadata/TOSCA.meta file not found in csar, csar ID {}", csarUUID);
+ if (keyOp.isEmpty()) {
+ log.error("TOSCA-Metadata/TOSCA.meta file not found in csar, csar ID {}", csarUUID);
BeEcompErrorManager.getInstance()
.logInternalDataError("TOSCA-Metadata/TOSCA.meta file not found in CSAR with id " + csarUUID, CSAR_STRUCTURE_IS_INVALID,
ErrorSeverity.ERROR);
@@ -331,7 +330,7 @@ public class CsarValidationUtils {
}
byte[] toscaMetaBytes = csar.get(keyOp.get());
if (toscaMetaBytes == null || toscaMetaBytes.length == 0) {
- log.debug("TOSCA-Metadata/TOSCA.meta file not found in csar, csar ID {}", csarUUID);
+ log.error("TOSCA-Metadata/TOSCA.meta file not found in csar, csar ID {}", csarUUID);
BeEcompErrorManager.getInstance()
.logInternalDataError("TOSCA-Metadata/TOSCA.meta file not found in CSAR with id " + csarUUID, CSAR_STRUCTURE_IS_INVALID,
ErrorSeverity.ERROR);
@@ -343,11 +342,10 @@ public class CsarValidationUtils {
public static Either<String, ResponseFormat> getToscaYamlChecksum(Map<String, byte[]> csar, String csarUUID, ComponentsUtils componentsUtils) {
Either<ImmutablePair<String, String>, ResponseFormat> toscaYamlRes = getToscaYaml(csar, csarUUID, componentsUtils, AuditingActionEnum.GET_TOSCA_MODEL);
if (toscaYamlRes.isRight() || toscaYamlRes.left().value() == null || toscaYamlRes.left().value().getRight() == null) {
- log.debug("Faild to create toscaYamlChecksum for csar, csar ID {}", csarUUID);
+ log.error("Faild to create toscaYamlChecksum for csar, csar ID {}", csarUUID);
return Either.right(toscaYamlRes.right().value());
}
- String newCheckSum = GeneralUtility.calculateMD5Base64EncodedByByteArray(toscaYamlRes.left().value().getRight().getBytes());
- return Either.left(newCheckSum);
+ return Either.left(GeneralUtility.calculateMD5Base64EncodedByByteArray(toscaYamlRes.left().value().getRight().getBytes()));
}
public static boolean isCsarPayloadName(String payloadName) {
diff --git a/catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts b/catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts
index 685f564f27..5065023cb4 100644
--- a/catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts
+++ b/catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts
@@ -304,8 +304,8 @@ export class GeneralViewModel {
const errorMsg = this.$filter('translate')('IMPORT_FAILURE_MESSAGE_TEXT');
console.error(errorMsg, error);
const errorDetails = {
- 'Error': error.reason,
- 'Details': error.message
+ 'Error': this.capitalize(error.reason),
+ 'Details': this.capitalize(error.message)
};
this.modalServiceSdcUI.openErrorDetailModal('Error', this.$filter('translate')('IMPORT_FAILURE_MESSAGE_TEXT'),
'error-modal', errorDetails);
@@ -339,7 +339,6 @@ export class GeneralViewModel {
this.$scope.isShowOnboardingSelectionBrowse = false;
}
-
//init file extensions based on the file that was imported.
if (this.$scope.component.isResource() && (<Resource>this.$scope.component).importedFile) {
let fileName:string = (<Resource>this.$scope.component).importedFile.filename;
@@ -357,8 +356,6 @@ export class GeneralViewModel {
//(<Resource>this.$scope.component).importedFile.filetype="csar";
}
-
-
this.$scope.setValidState(true);
this.$scope.calculateUnique = (mainCategory:string, subCategory:string):string => {
@@ -375,7 +372,6 @@ export class GeneralViewModel {
this.$scope.originComponent.contactId = this.$scope.component.contactId;
}
-
this.$scope.$on('$destroy', () => {
this.EventListenerService.unRegisterObserver(EVENTS.ON_LIFECYCLE_CHANGE_WITH_SAVE);
this.EventListenerService.unRegisterObserver(EVENTS.ON_LIFECYCLE_CHANGE);
@@ -383,6 +379,10 @@ export class GeneralViewModel {
};
+ private capitalize(s) {
+ return s && s[0].toUpperCase() + s.slice(1);
+ }
+
// Convert category string MainCategory_#_SubCategory to Array with one item (like the server except)
private convertCategoryStringToOneArray = ():IMainCategory[] => {
let tmp = this.$scope.component.selectedCategory.split("_#_");