From b92822da4bdc3646fcd73ed0a4c6a43ae3786b79 Mon Sep 17 00:00:00 2001 From: vempo Date: Thu, 1 Feb 2018 17:08:23 +0200 Subject: Removed passing unnecessary logging info Change-Id: Ie5cbfad67798b3e0827155078bd0797c7b824efe Issue-ID: SDC-772 Signed-off-by: vempo --- .../OrchestrationTemplateCandidateManagerImpl.java | 11 +--- .../sdc/heat/services/HeatStructureUtil.java | 11 ++-- .../heat/services/tree/HeatTreeManagerUtil.java | 11 +--- .../validation/types/GlobalValidationContext.java | 7 +-- .../impl/util/HeatValidationService.java | 14 +---- .../impl/validators/ContrailValidator.java | 12 +--- .../ForbiddenResourceGuideLineValidator.java | 9 +-- .../validation/impl/validators/HeatValidator.java | 68 +++++++--------------- .../impl/validators/ManifestValidator.java | 32 +++------- .../SharedResourceGuideLineValidator.java | 24 +++----- .../validation/impl/validators/YamlValidator.java | 10 +--- .../ContrailNetworkPolicyResourceValidator.java | 10 +--- .../heatresource/NestedResourceValidator.java | 9 +-- .../heatresource/NeutronPortResourceValidator.java | 15 ++--- .../NeutronSecurityGroupResourceValidator.java | 6 +- .../NovaServerGroupResourceValidator.java | 18 ++---- .../heatresource/NovaServerResourceValidator.java | 13 ++--- .../ResourceGroupResourceValidator.java | 13 +---- ...ilServiceInstanceNamingConventionValidator.java | 13 ++--- ...ilServiceTemplateNamingConventionValidator.java | 17 ++---- .../NeutronPortNamingConventionValidator.java | 30 ++++------ ...vaServerNamingConventionGuideLineValidator.java | 54 +++++------------ .../sdc/validation/base/ResourceBaseValidator.java | 11 ++-- .../sdc/validation/util/ValidationUtil.java | 10 +--- 24 files changed, 121 insertions(+), 307 deletions(-) (limited to 'openecomp-be') diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImpl.java index 3a17e453af..aa90b5dee6 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImpl.java @@ -30,7 +30,6 @@ import org.openecomp.sdc.datatypes.error.ErrorMessage; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.logging.api.annotations.Metrics; -import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.vendorsoftwareproduct.OrchestrationTemplateCandidateManager; import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateCandidateData; @@ -49,7 +48,6 @@ import org.openecomp.sdc.versioning.dao.types.Version; import java.io.IOException; import java.io.InputStream; import java.util.Collections; -import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; @@ -62,7 +60,6 @@ public class OrchestrationTemplateCandidateManagerImpl LoggerFactory.getLogger(OrchestrationTemplateCandidateManagerImpl.class); private final VendorSoftwareProductInfoDao vspInfoDao; private final CandidateService candidateService; - private static final String VSP_ID = "VSP id"; public OrchestrationTemplateCandidateManagerImpl(VendorSoftwareProductInfoDao vspInfoDao, CandidateService candidateService @@ -100,13 +97,7 @@ public class OrchestrationTemplateCandidateManagerImpl @Override public Optional getFilesDataStructure(String vspId, Version version) { - Optional candidateFileDataStructure = - candidateService.getOrchestrationTemplateCandidateFileDataStructure(vspId, version); - if (candidateFileDataStructure.isPresent()) { - return candidateFileDataStructure; - } else { - return Optional.empty(); - } + return candidateService.getOrchestrationTemplateCandidateFileDataStructure(vspId, version); } @Override diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/HeatStructureUtil.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/HeatStructureUtil.java index 513b185236..ef09841727 100644 --- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/HeatStructureUtil.java +++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/HeatStructureUtil.java @@ -26,7 +26,6 @@ import org.openecomp.core.validation.types.GlobalValidationContext; import org.openecomp.sdc.common.errors.Messages; import org.openecomp.sdc.datatypes.error.ErrorLevel; import org.openecomp.sdc.heat.datatypes.model.ResourceReferenceFunctions; -import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import java.util.HashSet; import java.util.List; @@ -39,6 +38,10 @@ import java.util.Set; */ public class HeatStructureUtil { + private HeatStructureUtil() { + // prevent instantiation + } + /** * Gets referenced values by function name. * @@ -59,9 +62,9 @@ public class HeatStructureUtil { if (!(getFunctionValue instanceof String) && functionName.equals( ResourceReferenceFunctions.GET_RESOURCE.getFunction())) { globalContext.addMessage(filename, ErrorLevel.ERROR, ErrorMessagesFormatBuilder - .getErrorWithParameters(globalContext.getMessageCode(), Messages.INVALID_GET_RESOURCE_SYNTAX.getErrorMessage(), - getFunctionValue == null ? "null" : getFunctionValue.toString()), - LoggerTragetServiceName.VALIDATE_GET_RESOURCE, "Invalid get_resource syntax"); + .getErrorWithParameters(globalContext.getMessageCode(), + Messages.INVALID_GET_RESOURCE_SYNTAX.getErrorMessage(), + getFunctionValue == null ? "null" : getFunctionValue.toString())); return valuesNames; } if (getFunctionValue instanceof String) { diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerUtil.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerUtil.java index 607319906d..87022f4e37 100644 --- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerUtil.java +++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerUtil.java @@ -29,7 +29,6 @@ import org.openecomp.sdc.heat.datatypes.model.HeatResourcesTypes; import org.openecomp.sdc.heat.datatypes.model.PropertiesMapKeyTypes; import org.openecomp.sdc.heat.datatypes.model.Resource; import org.openecomp.sdc.heat.services.HeatStructureUtil; -import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import java.util.Collection; import java.util.HashSet; @@ -175,8 +174,7 @@ public class HeatTreeManagerUtil { .getErrorWithParameters( globalContext.getMessageCode(), Messages.INVALID_RESOURCE_GROUP_TYPE.getErrorMessage(), - resourceName, resourceDefType.toString()), - LoggerTragetServiceName.VALIDATE_RESOURCE_GROUP_TYPE, "Invalid resource group type"); + resourceName, resourceDefType.toString())); } } } @@ -194,8 +192,7 @@ public class HeatTreeManagerUtil { globalContext.addMessage(filename, ErrorLevel.WARNING, ErrorMessagesFormatBuilder .getErrorWithParameters( globalContext.getMessageCode(), Messages.INVALID_RESOURCE_TYPE.getErrorMessage(), - "null", resourceName), LoggerTragetServiceName.VALIDATE_RESOURCE_GROUP_TYPE, - "Invalid resource type"); + "null", resourceName)); } } } @@ -219,9 +216,7 @@ public class HeatTreeManagerUtil { .getErrorWithParameters( globalContext.getMessageCode(), Messages.INVALID_RESOURCE_GROUP_TYPE.getErrorMessage(), - resourceName, resourceDefType.toString()), - LoggerTragetServiceName.VALIDATE_RESOURCE_GROUP_TYPE, - "Invalid resource group type"); + resourceName, resourceDefType.toString())); return true; } } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-api/src/main/java/org/openecomp/core/validation/types/GlobalValidationContext.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-api/src/main/java/org/openecomp/core/validation/types/GlobalValidationContext.java index b2b901a016..42ea681b1b 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-api/src/main/java/org/openecomp/core/validation/types/GlobalValidationContext.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-api/src/main/java/org/openecomp/core/validation/types/GlobalValidationContext.java @@ -52,13 +52,10 @@ public class GlobalValidationContext { * @param fileName the file name * @param level the level * @param message the message - * @param targetService the target service name - * @param description validation event details */ - public void addMessage(String fileName, ErrorLevel level, String message, - String targetService, String description) { + public void addMessage(String fileName, ErrorLevel level, String message) { - LOGGER.debug("{}: {} [{}]. Target: {}. Description: {}", fileName, message, level, targetService, description); + LOGGER.debug("'{}' [{}] in file '{}' ", message, level, fileName); if (fileContextMap.containsKey(fileName)) { fileContextMap.get(fileName).getMessageContainer().getMessageBuilder() diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/util/HeatValidationService.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/util/HeatValidationService.java index 932e60a991..469bfad3af 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/util/HeatValidationService.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/util/HeatValidationService.java @@ -28,8 +28,6 @@ import org.openecomp.sdc.heat.datatypes.model.Parameter; import org.openecomp.sdc.heat.datatypes.model.Resource; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; -import org.openecomp.sdc.logging.types.LoggerErrorDescription; -import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.tosca.services.YamlUtil; import org.openecomp.sdc.validation.impl.validators.HeatValidator; @@ -68,9 +66,7 @@ public class HeatValidationService { ErrorLevel.ERROR, ErrorMessagesFormatBuilder .getErrorWithParameters( globalContext.getMessageCode(), - Messages.MISSING_ARTIFACT.getErrorMessage(), artifactName), - LoggerTragetServiceName.VALIDATE_ARTIFACTS_EXISTENCE, - LoggerErrorDescription.MISSING_FILE)); + Messages.MISSING_ARTIFACT.getErrorMessage(), artifactName))); } /** @@ -189,9 +185,7 @@ public class HeatValidationService { .getErrorWithParameters( globalContext.getMessageCode(), Messages.MISSING_PARAMETER_IN_NESTED.getErrorMessage(), - nestedFileName, resourceName, propertyName), - LoggerTragetServiceName.VALIDATE_PROPERTIES_MATCH_NESTED_PARAMETERS, - LoggerErrorDescription.MISSING_PARAMETER_IN_NESTED)); + nestedFileName, resourceName, propertyName))); } } @@ -232,9 +226,7 @@ public class HeatValidationService { globalContext.addMessage(parentFileName, ErrorLevel.WARNING, ErrorMessagesFormatBuilder .getErrorWithParameters(globalContext.getMessageCode(), Messages.WRONG_VALUE_TYPE_ASSIGNED_NESTED_INPUT.getErrorMessage(), - resourceName, parameterName, nestedFileName), - LoggerTragetServiceName.VALIDATE_PROPERTIES_MATCH_NESTED_PARAMETERS, - LoggerErrorDescription.WRONG_VALUE_ASSIGNED_NESTED_PARAMETER); + resourceName, parameterName, nestedFileName)); } } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ContrailValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ContrailValidator.java index 4615f7be45..1bdde24253 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ContrailValidator.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ContrailValidator.java @@ -30,8 +30,6 @@ import org.openecomp.sdc.heat.services.HeatConstants; import org.openecomp.sdc.heat.services.manifest.ManifestUtil; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; -import org.openecomp.sdc.logging.types.LoggerErrorDescription; -import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.tosca.services.YamlUtil; import org.openecomp.sdc.validation.Validator; import org.openecomp.sdc.validation.tos.ContrailResourcesMappingTo; @@ -97,9 +95,7 @@ public class ContrailValidator implements Validator { ErrorLevel.WARNING, ErrorMessagesFormatBuilder.getErrorWithParameters( ERROR_CODE_CTL_2, Messages.MERGE_OF_CONTRAIL2_AND_CONTRAIL3_RESOURCES.getErrorMessage(), contrailResourcesMappingTo.fetchContrailV1Resources(), - contrailResourcesMappingTo.fetchContrailV2Resources()), - LoggerTragetServiceName.MERGE_OF_CONTRAIL_2_AND_3, - LoggerErrorDescription.MERGE_CONTRAIL_2_AND_3); + contrailResourcesMappingTo.fetchContrailV2Resources())); } } @@ -110,8 +106,7 @@ public class ContrailValidator implements Validator { globalContext.addMessage(fileName, ErrorLevel.ERROR, ErrorMessagesFormatBuilder .getErrorWithParameters(ERROR_CODE_CTL_1, Messages.INVALID_HEAT_FORMAT_REASON .getErrorMessage(), - "The file '" + fileName + "' has no content"), - LoggerTragetServiceName.VALIDATE_HEAT_FORMAT, LoggerErrorDescription.INVALID_HEAT_FORMAT); + "The file '" + fileName + "' has no content")); return Optional.empty(); } return fetchContrailResourcesMapping(fileName, fileContent.get()); @@ -165,8 +160,7 @@ public class ContrailValidator implements Validator { if (Objects.nonNull(type) && type.startsWith(HeatConstants.CONTRAIL_RESOURCE_PREFIX)) { globalContext.addMessage(fileName, ErrorLevel.WARNING, ErrorMessagesFormatBuilder .getErrorWithParameters(ERROR_CODE_CTL_3, Messages.CONTRAIL_2_IN_USE.getErrorMessage(), - resourceEntry.getKey()), LoggerTragetServiceName.CONTRAIL_2_IN_USE, - LoggerErrorDescription.CONTRAIL_2_IN_USE); + resourceEntry.getKey())); } } } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ForbiddenResourceGuideLineValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ForbiddenResourceGuideLineValidator.java index bbd81e1327..0f4dbf4d1c 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ForbiddenResourceGuideLineValidator.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ForbiddenResourceGuideLineValidator.java @@ -29,8 +29,6 @@ import org.openecomp.sdc.heat.datatypes.model.Resource; import org.openecomp.sdc.heat.services.manifest.ManifestUtil; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; -import org.openecomp.sdc.logging.types.LoggerErrorDescription; -import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.validation.Validator; import org.openecomp.sdc.validation.util.ValidationUtil; @@ -115,8 +113,7 @@ public class ForbiddenResourceGuideLineValidator implements Validator { globalContext.addMessage(fileName, ErrorLevel.WARNING, ErrorMessagesFormatBuilder .getErrorWithParameters(ERROR_CODE_FRG_1, Messages.INVALID_RESOURCE_TYPE.getErrorMessage(),"null", - resourceEntry.getKey()), LoggerTragetServiceName.VALIDATE_RESOURCE_TYPE, - LoggerErrorDescription.INVALID_RESOURCE_TYPE); + resourceEntry.getKey())); } else { if (isResourceForbidden(resourceType)) { globalContext.addMessage( @@ -125,9 +122,7 @@ public class ForbiddenResourceGuideLineValidator implements Validator { ErrorMessagesFormatBuilder .getErrorWithParameters(ERROR_CODE_FRG_2, Messages.FORBIDDEN_RESOURCE_IN_USE .getErrorMessage(), - resourceType, resourceEntry.getKey()), - LoggerTragetServiceName.VALIDATE_FORBIDDEN_RESOURCE, - LoggerErrorDescription.FLOATING_IP_IN_USE); + resourceType, resourceEntry.getKey())); } } } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/HeatValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/HeatValidator.java index 4df4c7efae..0c4371439b 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/HeatValidator.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/HeatValidator.java @@ -38,8 +38,6 @@ import org.openecomp.sdc.heat.services.HeatStructureUtil; import org.openecomp.sdc.heat.services.manifest.ManifestUtil; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; -import org.openecomp.sdc.logging.types.LoggerErrorDescription; -import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.tosca.services.YamlUtil; import org.openecomp.sdc.validation.Validator; import org.openecomp.sdc.validation.impl.util.HeatValidationService; @@ -187,9 +185,7 @@ public class HeatValidator implements Validator { globalContext.addMessage(fileName, ErrorLevel.ERROR, ErrorMessagesFormatBuilder .getErrorWithParameters(ERROR_CODE_HOT_16,Messages - .REFERENCED_RESOURCE_NOT_FOUND.getErrorMessage(), referencedResource), - LoggerTragetServiceName.VALIDATE_RESOURCE_REFERENCE_EXISTENCE, - LoggerErrorDescription.RESOURCE_NOT_FOUND)); + .REFERENCED_RESOURCE_NOT_FOUND.getErrorMessage(), referencedResource))); } /* validation 16 */ @@ -242,9 +238,7 @@ public class HeatValidator implements Validator { globalContext.addMessage(fileName, ErrorLevel.ERROR, ErrorMessagesFormatBuilder .getErrorWithParameters(ERROR_CODE_HOT_1,Messages .REFERENCED_PARAMETER_NOT_FOUND.getErrorMessage(), - parameterName, resourceName), - LoggerTragetServiceName.VALIDATE_PARAMETER_REFERENCE_EXITENCE, - LoggerErrorDescription.PARAMETER_NOT_FOUND); + parameterName, resourceName)); } } } @@ -292,8 +286,8 @@ public class HeatValidator implements Validator { GlobalValidationContext globalContext) { if (!CollectionUtils.isEmpty(getAttrValue)) { String resourceName = getAttrValue.get(0); - Object attNameObject = getAttrValue.get(1); - if (!(attNameObject instanceof String)) { + String attNameObject = getAttrValue.get(1); + if (attNameObject == null) { return; } String attName = getAttrValue.get(1); @@ -331,9 +325,7 @@ public class HeatValidator implements Validator { globalContext.addMessage(fileName, ErrorLevel.ERROR, ErrorMessagesFormatBuilder .getErrorWithParameters(ERROR_CODE_HOT_17,Messages .GET_ATTR_NOT_FOUND.getErrorMessage(), - attName, resourceName), - LoggerTragetServiceName.VALIDATE_GET_ATTR_FROM_NESTED, - LoggerErrorDescription.GET_ATTR_NOT_FOUND); + attName, resourceName)); } } @@ -352,8 +344,7 @@ public class HeatValidator implements Validator { if (!envFileName.contains(".env")) { globalContext.addMessage(envFileName, ErrorLevel.ERROR, ErrorMessagesFormatBuilder .getErrorWithParameters(ERROR_CODE_HOT_2,Messages - .WRONG_ENV_FILE_EXTENSION.getErrorMessage(), envFileName), - LoggerTragetServiceName.VALIDATE_ENV_FILE, LoggerErrorDescription.WRONG_FILE_EXTENSION); + .WRONG_ENV_FILE_EXTENSION.getErrorMessage(), envFileName)); } envContent = HeatValidationService.validateEnvContent(fileName, envFileName, globalContext); @@ -387,8 +378,7 @@ public class HeatValidator implements Validator { globalContext.addMessage(envFile, ErrorLevel.ERROR, ErrorMessagesFormatBuilder .getErrorWithParameters(ERROR_CODE_HOT_3,Messages .ENV_INCLUDES_PARAMETER_NOT_IN_HEAT.getErrorMessage(), - envFile, envEntry.getKey()), LoggerTragetServiceName.VALIDATE_ENV_FILE, - LoggerErrorDescription.ENV_PARAMETER_NOT_IN_HEAT); + envFile, envEntry.getKey())); } } } @@ -405,8 +395,7 @@ public class HeatValidator implements Validator { .getErrorWithParameters( ERROR_CODE_HOT_3,Messages .ENV_INCLUDES_PARAMETER_NOT_IN_HEAT.getErrorMessage(), envFile, - envParameter), LoggerTragetServiceName.VALIDATE_ENV_FILE, - LoggerErrorDescription.ENV_PARAMETER_NOT_IN_HEAT); + envParameter)); } } private static void validateParameterDefaultTypeAlignWithType(String fileName, @@ -438,9 +427,7 @@ public class HeatValidator implements Validator { .getErrorWithParameters( ERROR_CODE_HOT_4,Messages .PARAMETER_DEFAULT_VALUE_NOT_ALIGN_WITH_TYPE.getErrorMessage(), - parameterEntry.getKey(), parameterType), - LoggerTragetServiceName.VALIDATE_PARAMTER_DEFAULT_MATCH_TYPE, - LoggerErrorDescription.PARAMETER_DEFAULT_VALUE_NOT_ALIGNED_WITH_TYPE); + parameterEntry.getKey(), parameterType)); } } } @@ -477,8 +464,7 @@ public class HeatValidator implements Validator { .getErrorWithParameters( ERROR_CODE_HOT_5,Messages .PARAMETER_ENV_VALUE_NOT_ALIGN_WITH_TYPE.getErrorMessage(), - parameterName), LoggerTragetServiceName.VALIDATE_ENV_PARAMETER_MATCH_TYPE, - LoggerErrorDescription.PARAMETER_DEFAULT_VALUE_NOT_ALIGNED_WITH_TYPE); + parameterName)); } } } @@ -512,9 +498,7 @@ public class HeatValidator implements Validator { .forEach(fileName -> globalContext.addMessage(fileName, ErrorLevel.WARNING, ErrorMessagesFormatBuilder .getErrorWithParameters(ERROR_CODE_HOT_11, - Messages.ARTIFACT_FILE_NOT_REFERENCED.getErrorMessage()), - LoggerTragetServiceName.CHECK_FOR_ORPHAN_ARTIFACTS, - LoggerErrorDescription.ARTIFACT_NOT_REFERENCED)); + Messages.ARTIFACT_FILE_NOT_REFERENCED.getErrorMessage()))); } private boolean isManifestArtifact(Set manifestArtifacts, String fileName) { @@ -538,9 +522,7 @@ public class HeatValidator implements Validator { if (!(fileName.contains(".yaml") || fileName.contains(".yml"))) { globalContext.addMessage(fileName, ErrorLevel.ERROR, ErrorMessagesFormatBuilder .getErrorWithParameters(ERROR_CODE_HOT_6,Messages - .WRONG_HEAT_FILE_EXTENSION.getErrorMessage(), fileName), - LoggerTragetServiceName.CHECK_FOR_VALID_FILE_EXTENTION, - LoggerErrorDescription.WRONG_FILE_EXTENSION); + .WRONG_HEAT_FILE_EXTENSION.getErrorMessage(), fileName)); } validateHeatBaseStructure(fileName, heatOrchestrationTemplate, globalContext); @@ -584,16 +566,12 @@ public class HeatValidator implements Validator { .filter(resourceId -> !resourcesNames.contains(resourceId)) .forEach(resourceId -> globalContext.addMessage(fileName, ErrorLevel.ERROR, ErrorMessagesFormatBuilder - .getErrorWithParameters(ERROR_CODE_HOT_7,Messages - .MISSING_RESOURCE_IN_DEPENDS_ON.getErrorMessage(), - (String) resourceId), LoggerTragetServiceName.CHECK_RESOURCE_DEPENDS_ON, - LoggerErrorDescription.MISSING_RESOURCE_DEPENDS_ON)); + .getErrorWithParameters(ERROR_CODE_HOT_7, + Messages.MISSING_RESOURCE_IN_DEPENDS_ON.getErrorMessage(), resourceId))); } else if (dependencies instanceof String && !resourcesNames.contains(dependencies)) { globalContext.addMessage(fileName, ErrorLevel.ERROR, ErrorMessagesFormatBuilder - .getErrorWithParameters(ERROR_CODE_HOT_8,Messages - .MISSING_RESOURCE_IN_DEPENDS_ON.getErrorMessage(), - (String) dependencies), LoggerTragetServiceName.CHECK_RESOURCE_DEPENDS_ON, - LoggerErrorDescription.MISSING_RESOURCE_DEPENDS_ON); + .getErrorWithParameters(ERROR_CODE_HOT_8, + Messages.MISSING_RESOURCE_IN_DEPENDS_ON.getErrorMessage(), String.valueOf(dependencies))); } } @@ -603,18 +581,16 @@ public class HeatValidator implements Validator { GlobalValidationContext globalContext) { if (heatOrchestrationTemplate.getHeat_template_version() == null) { globalContext.addMessage(fileName, ErrorLevel.ERROR, ErrorMessagesFormatBuilder - .getErrorWithParameters(ERROR_CODE_HOT_9,Messages - .INVALID_HEAT_FORMAT_REASON.getErrorMessage(), - "missing template version"), LoggerTragetServiceName.VALIDATE_HEAT_FORMAT, - LoggerErrorDescription.INVALID_HEAT_FORMAT); + .getErrorWithParameters(ERROR_CODE_HOT_9, + Messages.INVALID_HEAT_FORMAT_REASON.getErrorMessage(), + "missing template version")); } if (heatOrchestrationTemplate.getResources() == null || heatOrchestrationTemplate.getResources().size() == 0) { globalContext.addMessage(fileName, ErrorLevel.WARNING, ErrorMessagesFormatBuilder - .getErrorWithParameters(ERROR_CODE_HOT_10,Messages - .INVALID_HEAT_FORMAT_REASON.getErrorMessage(), - "The heat file does not contain any resources"), - LoggerTragetServiceName.VALIDATE_HEAT_FORMAT, LoggerErrorDescription.INVALID_HEAT_FORMAT); + .getErrorWithParameters(ERROR_CODE_HOT_10, + Messages.INVALID_HEAT_FORMAT_REASON.getErrorMessage(), + "The heat file does not contain any resources")); } } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ManifestValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ManifestValidator.java index 0b1e37ba06..e2db44e7b6 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ManifestValidator.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ManifestValidator.java @@ -27,8 +27,6 @@ import org.openecomp.sdc.heat.datatypes.manifest.FileData; import org.openecomp.sdc.heat.datatypes.manifest.ManifestContent; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; -import org.openecomp.sdc.logging.types.LoggerErrorDescription; -import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.validation.Validator; import java.io.InputStream; @@ -64,9 +62,7 @@ public class ManifestValidator implements Validator { globalContext.addMessage(SdcCommon.MANIFEST_NAME, ErrorLevel.ERROR, ErrorMessagesFormatBuilder .getErrorWithParameters(ERROR_CODE_MNF_6, - Messages.INVALID_MANIFEST_FILE.getErrorMessage()), - LoggerTragetServiceName.VALIDATE_MANIFEST_CONTENT, - LoggerErrorDescription.INVALID_MANIFEST); + Messages.INVALID_MANIFEST_FILE.getErrorMessage())); return; } @@ -76,8 +72,7 @@ public class ManifestValidator implements Validator { ).forEach(name -> globalContext .addMessage(name, ErrorLevel.ERROR,ErrorMessagesFormatBuilder .getErrorWithParameters(ERROR_CODE_MNF_4, - Messages.MISSING_FILE_IN_ZIP.getErrorMessage()), - LoggerTragetServiceName.VALIDATE_FILE_IN_ZIP, LoggerErrorDescription.MISSING_FILE)); + Messages.MISSING_FILE_IN_ZIP.getErrorMessage()))); globalContext.getFileContextMap().keySet().stream().filter(name -> isNotManifestFiles(manifestFiles, name) && isNotManifestName(name) @@ -85,9 +80,7 @@ public class ManifestValidator implements Validator { globalContext.addMessage(name, ErrorLevel.WARNING, ErrorMessagesFormatBuilder .getErrorWithParameters(ERROR_CODE_MNF_5, - Messages.MISSING_FILE_IN_MANIFEST.getErrorMessage()), - LoggerTragetServiceName.VALIDATE_FILE_IN_MANIFEST, LoggerErrorDescription.MISSING_FILE) - ); + Messages.MISSING_FILE_IN_MANIFEST.getErrorMessage()))); } private boolean isNotManifestFiles(List manifestFiles, String name) { @@ -108,7 +101,7 @@ public class ManifestValidator implements Validator { private class ManifestScanner { - private List fileList = new ArrayList<>(); + private final List fileList = new ArrayList<>(); public void scan(FileData fileData, List data, GlobalValidationContext globalContext) { @@ -139,8 +132,7 @@ public class ManifestValidator implements Validator { if (type == null) { globalValidationContext.addMessage(fileName, ErrorLevel.ERROR, ErrorMessagesFormatBuilder.getErrorWithParameters(ERROR_CODE_MNF_8, - Messages.INVALID_FILE_TYPE.getErrorMessage()), - LoggerTragetServiceName.VALIDATE_FILE_TYPE_AND_NAME, "Invalid file type"); + Messages.INVALID_FILE_TYPE.getErrorMessage())); } else if (type.equals(FileData.Type.HEAT_NET) || type.equals(FileData.Type.HEAT_VOL) || type.equals(FileData.Type.HEAT)) { validateIfFileHasYamlExtenstion(globalValidationContext,fileName); @@ -156,9 +148,7 @@ public class ManifestValidator implements Validator { globalContext.addMessage(childFileData.getFile(), ErrorLevel.ERROR, ErrorMessagesFormatBuilder .getErrorWithParameters(ERROR_CODE_MNF_1, - Messages.ENV_NOT_ASSOCIATED_TO_HEAT.getErrorMessage()), - LoggerTragetServiceName.SCAN_MANIFEST_STRUCTURE, - "env file is not associated to HEAT file"); + Messages.ENV_NOT_ASSOCIATED_TO_HEAT.getErrorMessage())); } } @@ -169,8 +159,7 @@ public class ManifestValidator implements Validator { ErrorMessagesFormatBuilder .getErrorWithParameters(ERROR_CODE_MNF_3, Messages.WRONG_ENV_FILE_EXTENSION.getErrorMessage(), - fileName), LoggerTragetServiceName.VALIDATE_FILE_TYPE_AND_NAME, - "Wrong env file extention"); + fileName)); } } @@ -181,8 +170,7 @@ public class ManifestValidator implements Validator { ErrorMessagesFormatBuilder .getErrorWithParameters(ERROR_CODE_MNF_2, Messages.WRONG_HEAT_FILE_EXTENSION.getErrorMessage(), - fileName), LoggerTragetServiceName.VALIDATE_FILE_TYPE_AND_NAME, - "Wrong HEAT file extention"); + fileName)); } } @@ -192,9 +180,7 @@ public class ManifestValidator implements Validator { globalValidationContext.addMessage(SdcCommon.MANIFEST_NAME, ErrorLevel.ERROR, ErrorMessagesFormatBuilder .getErrorWithParameters(ERROR_CODE_MNF_7, - Messages.MISSING_FILE_NAME_IN_MANIFEST.getErrorMessage()), - LoggerTragetServiceName.VALIDATE_FILE_TYPE_AND_NAME, - "Missing file name in manifest"); + Messages.MISSING_FILE_NAME_IN_MANIFEST.getErrorMessage())); } } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/SharedResourceGuideLineValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/SharedResourceGuideLineValidator.java index 05f94df76b..9be5f61f25 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/SharedResourceGuideLineValidator.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/SharedResourceGuideLineValidator.java @@ -33,8 +33,6 @@ import org.openecomp.sdc.heat.services.HeatStructureUtil; import org.openecomp.sdc.heat.services.manifest.ManifestUtil; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; -import org.openecomp.sdc.logging.types.LoggerErrorDescription; -import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.validation.Validator; import org.openecomp.sdc.validation.util.ValidationUtil; @@ -83,9 +81,7 @@ public class SharedResourceGuideLineValidator implements Validator { ErrorLevel.WARNING, ErrorMessagesFormatBuilder .getErrorWithParameters(ERROR_CODE_SRG_3,Messages - .MISSIN_BASE_HEAT_FILE.getErrorMessage()), - LoggerTragetServiceName.VALIDATE_BASE_FILE, - LoggerErrorDescription.MISSING_BASE_HEAT); + .MISSIN_BASE_HEAT_FILE.getErrorMessage())); } else if (baseFiles.size() > 1) { String baseFileList = getElementListAsString(baseFiles); globalContext.addMessage( @@ -94,9 +90,7 @@ public class SharedResourceGuideLineValidator implements Validator { ErrorMessagesFormatBuilder .getErrorWithParameters(ERROR_CODE_SRG_4,Messages .MULTI_BASE_HEAT_FILE.getErrorMessage(), - baseFileList), - LoggerTragetServiceName.VALIDATE_BASE_FILE, - LoggerErrorDescription.MULTI_BASE_HEAT); + baseFileList)); } return baseFiles; } @@ -165,11 +159,9 @@ public class SharedResourceGuideLineValidator implements Validator { .forEach(name -> globalContext.addMessage( fileName, ErrorLevel.WARNING, ErrorMessagesFormatBuilder - .getErrorWithParameters(ERROR_CODE_SRG_1,Messages - .RESOURCE_NOT_DEFINED_IN_OUTPUT.getErrorMessage(), - name), - LoggerTragetServiceName.VALIDATE_BASE_FILE, - LoggerErrorDescription.RESOURCE_NOT_DEFINED_AS_OUTPUT)); + .getErrorWithParameters(ERROR_CODE_SRG_1, + Messages.RESOURCE_NOT_DEFINED_IN_OUTPUT.getErrorMessage(), + name))); } } @@ -215,10 +207,8 @@ public class SharedResourceGuideLineValidator implements Validator { .forEach(name -> globalContext.addMessage( fileName, ErrorLevel.WARNING, ErrorMessagesFormatBuilder - .getErrorWithParameters(ERROR_CODE_SRG_2,Messages - .VOLUME_HEAT_NOT_EXPOSED.getErrorMessage(), name), - LoggerTragetServiceName.VALIDATE_VOLUME_FILE, - LoggerErrorDescription.VOLUME_FILE_NOT_EXPOSED)); + .getErrorWithParameters(ERROR_CODE_SRG_2, + Messages.VOLUME_HEAT_NOT_EXPOSED.getErrorMessage(), name))); } } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/YamlValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/YamlValidator.java index bf89d69893..b542c5d1a4 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/YamlValidator.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/YamlValidator.java @@ -21,8 +21,6 @@ import org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder; import org.openecomp.core.validation.types.GlobalValidationContext; import org.openecomp.sdc.common.errors.Messages; import org.openecomp.sdc.datatypes.error.ErrorLevel; -import org.openecomp.sdc.logging.types.LoggerErrorDescription; -import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.tosca.services.YamlUtil; import org.openecomp.sdc.validation.Validator; import org.openecomp.sdc.validation.impl.util.YamlValidatorUtil; @@ -51,9 +49,7 @@ public class YamlValidator implements Validator { globalContext.addMessage(fileName, ErrorLevel.ERROR, ErrorMessagesFormatBuilder .getErrorWithParameters(ERROR_CODE_YML_1, Messages .INVALID_YAML_FORMAT_REASON.getErrorMessage(), - Messages.EMPTY_YAML_FILE.getErrorMessage()), - LoggerTragetServiceName.VALIDATE_YAML_CONTENT, - LoggerErrorDescription.INVALID_YAML_FORMAT); + Messages.EMPTY_YAML_FILE.getErrorMessage())); return; /* no need to continue validation */ } @@ -64,9 +60,7 @@ public class YamlValidator implements Validator { globalContext.addMessage(fileName, ErrorLevel.ERROR, ErrorMessagesFormatBuilder .getErrorWithParameters(ERROR_CODE_YML_2, Messages .INVALID_YAML_FORMAT_REASON.getErrorMessage(), - YamlValidatorUtil.getParserExceptionReason(exception)), - LoggerTragetServiceName.VALIDATE_YAML_CONTENT, - LoggerErrorDescription.INVALID_YAML_FORMAT); + YamlValidatorUtil.getParserExceptionReason(exception))); } } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/ContrailNetworkPolicyResourceValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/ContrailNetworkPolicyResourceValidator.java index 9f202e3b4a..2d7b5ada48 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/ContrailNetworkPolicyResourceValidator.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/ContrailNetworkPolicyResourceValidator.java @@ -8,8 +8,6 @@ import org.openecomp.sdc.common.errors.Messages; import org.openecomp.sdc.datatypes.error.ErrorLevel; import org.openecomp.sdc.heat.datatypes.model.HeatResourcesTypes; import org.openecomp.sdc.heat.datatypes.model.Resource; -import org.openecomp.sdc.logging.types.LoggerErrorDescription; -import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.validation.ResourceValidator; import org.openecomp.sdc.validation.ValidationContext; import org.openecomp.sdc.validation.type.HeatResourceValidationContext; @@ -49,9 +47,7 @@ public class ContrailNetworkPolicyResourceValidator implements ResourceValidator ErrorMessagesFormatBuilder .getErrorWithParameters(ERROR_CODE_HNP1, Messages.RESOURCE_NOT_IN_USE.getErrorMessage(), - ValidatorConstants.Network_Policy, resourceEntry.getKey()), - LoggerTragetServiceName.VALIDATE_ATTACH_POLICY_IN_USE, - LoggerErrorDescription.NETWORK_ATTACH_POLICY_NOT_IN_USE); + ValidatorConstants.Network_Policy, resourceEntry.getKey())); return; } @@ -74,9 +70,7 @@ public class ContrailNetworkPolicyResourceValidator implements ResourceValidator ErrorMessagesFormatBuilder .getErrorWithParameters(ERROR_CODE_HNP2, Messages.RESOURCE_NOT_IN_USE.getErrorMessage(), - ValidatorConstants.Network_Policy, resourceEntry.getKey()), - LoggerTragetServiceName.VALIDATE_ATTACH_POLICY_IN_USE, - LoggerErrorDescription.NETWORK_ATTACH_POLICY_NOT_IN_USE); + ValidatorConstants.Network_Policy, resourceEntry.getKey())); } } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/NestedResourceValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/NestedResourceValidator.java index 84899d1967..da6f201de6 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/NestedResourceValidator.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/NestedResourceValidator.java @@ -23,8 +23,6 @@ import org.openecomp.core.validation.types.GlobalValidationContext; import org.openecomp.sdc.common.errors.Messages; import org.openecomp.sdc.datatypes.error.ErrorLevel; import org.openecomp.sdc.heat.datatypes.model.Resource; -import org.openecomp.sdc.logging.types.LoggerErrorDescription; -import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.validation.ResourceValidator; import org.openecomp.sdc.validation.ValidationContext; import org.openecomp.sdc.validation.impl.util.HeatValidationService; @@ -86,9 +84,7 @@ public class NestedResourceValidator implements ResourceValidator { globalContext.addMessage(resourceType, ErrorLevel.ERROR, ErrorMessagesFormatBuilder .getErrorWithParameters(ERROR_CODE_HNR1, Messages.MISSING_NESTED_FILE.getErrorMessage(), - resourceType), - LoggerTragetServiceName.VALIDATE_PROPERTIES_MATCH_NESTED_PARAMETERS, - LoggerErrorDescription.MISSING_FILE); + resourceType)); } } @@ -99,8 +95,7 @@ public class NestedResourceValidator implements ResourceValidator { .isNestedLoopExistInFile(fileName, resourceType, filesInLoop, globalContext)) { globalContext.addMessage(fileName, ErrorLevel.ERROR, ErrorMessagesFormatBuilder .getErrorWithParameters(ERROR_CODE_HNR2, Messages.NESTED_LOOP.getErrorMessage(), - HeatValidationService.drawFilesLoop(filesInLoop)), - LoggerTragetServiceName.VALIDATE_NESTING_LOOPS, LoggerErrorDescription.NESTED_LOOP); + HeatValidationService.drawFilesLoop(filesInLoop))); } } } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/NeutronPortResourceValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/NeutronPortResourceValidator.java index 2568f40416..ac1d8e62ed 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/NeutronPortResourceValidator.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/NeutronPortResourceValidator.java @@ -27,8 +27,6 @@ import org.openecomp.sdc.heat.datatypes.model.HeatResourcesTypes; import org.openecomp.sdc.heat.datatypes.model.Resource; import org.openecomp.sdc.heat.datatypes.model.ResourceReferenceFunctions; import org.openecomp.sdc.heat.services.HeatStructureUtil; -import org.openecomp.sdc.logging.types.LoggerErrorDescription; -import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.validation.ResourceValidator; import org.openecomp.sdc.validation.ValidationContext; import org.openecomp.sdc.validation.type.HeatResourceValidationContext; @@ -70,8 +68,7 @@ public class NeutronPortResourceValidator implements ResourceValidator { ErrorMessagesFormatBuilder .getErrorWithParameters( ERROR_HPRODE_HPR1, Messages.PORT_NO_BIND_TO_ANY_NOVA_SERVER.getErrorMessage(), - portResourceId), LoggerTragetServiceName.CHECK_FOR_ORPHAN_PORTS, - LoggerErrorDescription.NO_BIND_FROM_PORT_TO_NOVA); + portResourceId)); return; } @@ -105,10 +102,9 @@ public class NeutronPortResourceValidator implements ResourceValidator { .addMessage(fileName, ErrorLevel.ERROR, ErrorMessagesFormatBuilder .getErrorWithParameters( - ERROR_HPRODE_HPR2, Messages.MORE_THAN_ONE_BIND_FROM_NOVA_TO_PORT.getErrorMessage(), - portResourceId), - LoggerTragetServiceName.VALIDATE_NOVA_SERVER_PORT_BINDING, - LoggerErrorDescription.PORT_BINDS_MORE_THAN_ONE_NOVA); + ERROR_HPRODE_HPR2, + Messages.MORE_THAN_ONE_BIND_FROM_NOVA_TO_PORT.getErrorMessage(), + portResourceId)); } if (isNoNovaPointingToPort(pointingNovaServers)) { @@ -117,8 +113,7 @@ public class NeutronPortResourceValidator implements ResourceValidator { ErrorMessagesFormatBuilder .getErrorWithParameters( ERROR_HPRODE_HPR3, Messages.PORT_NO_BIND_TO_ANY_NOVA_SERVER.getErrorMessage(), - portResourceId), LoggerTragetServiceName.CHECK_FOR_ORPHAN_PORTS, - LoggerErrorDescription.NO_BIND_FROM_PORT_TO_NOVA); + portResourceId)); } } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/NeutronSecurityGroupResourceValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/NeutronSecurityGroupResourceValidator.java index 0a066f5c38..5e973b5cb6 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/NeutronSecurityGroupResourceValidator.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/NeutronSecurityGroupResourceValidator.java @@ -8,8 +8,6 @@ import org.openecomp.sdc.common.errors.Messages; import org.openecomp.sdc.datatypes.error.ErrorLevel; import org.openecomp.sdc.heat.datatypes.model.HeatResourcesTypes; import org.openecomp.sdc.heat.datatypes.model.Resource; -import org.openecomp.sdc.logging.types.LoggerErrorDescription; -import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.validation.ResourceValidator; import org.openecomp.sdc.validation.ValidationContext; import org.openecomp.sdc.validation.type.HeatResourceValidationContext; @@ -58,9 +56,7 @@ public class NeutronSecurityGroupResourceValidator implements ResourceValidator ErrorMessagesFormatBuilder .getErrorWithParameters( ERROR_CODE_HSG1, Messages.RESOURCE_NOT_IN_USE.getErrorMessage(), - ValidatorConstants.Security_Group, resourceEntry.getKey()), - LoggerTragetServiceName.VALIDATE_ALL_SERVER_GROUP_OR_SECURITY_GROUP_IN_USE, - LoggerErrorDescription.SERVER_GROUP_SECURITY_GROUP_NOT_IN_USE); + ValidatorConstants.Security_Group, resourceEntry.getKey())); } } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerGroupResourceValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerGroupResourceValidator.java index afc9e3cef6..72226d96f4 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerGroupResourceValidator.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerGroupResourceValidator.java @@ -25,8 +25,6 @@ import org.openecomp.sdc.datatypes.error.ErrorLevel; import org.openecomp.sdc.heat.datatypes.model.HeatResourcesTypes; import org.openecomp.sdc.heat.datatypes.model.PolicyTypes; import org.openecomp.sdc.heat.datatypes.model.Resource; -import org.openecomp.sdc.logging.types.LoggerErrorDescription; -import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.validation.ResourceValidator; import org.openecomp.sdc.validation.ValidationContext; import org.openecomp.sdc.validation.type.HeatResourceValidationContext; @@ -65,17 +63,13 @@ public class NovaServerGroupResourceValidator implements ResourceValidator { globalContext.addMessage(fileName, ErrorLevel.ERROR, ErrorMessagesFormatBuilder .getErrorWithParameters( ERROR_CODE_HNG1, Messages.WRONG_POLICY_IN_SERVER_GROUP.getErrorMessage(), - resourceEntry.getKey()), - LoggerTragetServiceName.VALIDATE_NOVA_SEVER_GROUP_POLICY, - LoggerErrorDescription.WRONG_POLICY_SERVER_GROUP); + resourceEntry.getKey())); } } else { globalContext.addMessage(fileName, ErrorLevel.ERROR, ErrorMessagesFormatBuilder .getErrorWithParameters(ERROR_CODE_HNG1, Messages.WRONG_POLICY_IN_SERVER_GROUP.getErrorMessage(), - resourceEntry.getKey()), - LoggerTragetServiceName.VALIDATE_NOVA_SEVER_GROUP_POLICY, - LoggerErrorDescription.WRONG_POLICY_SERVER_GROUP); + resourceEntry.getKey())); } } } @@ -107,9 +101,7 @@ public class NovaServerGroupResourceValidator implements ResourceValidator { ErrorMessagesFormatBuilder .getErrorWithParameters( ERROR_CODE_HNG2, Messages.RESOURCE_NOT_IN_USE.getErrorMessage(), - ValidatorConstants.Server_Group, resourceEntry.getKey()), - LoggerTragetServiceName.VALIDATE_ALL_SERVER_GROUP_OR_SECURITY_GROUP_IN_USE, - LoggerErrorDescription.SERVER_GROUP_SECURITY_GROUP_NOT_IN_USE); + ValidatorConstants.Server_Group, resourceEntry.getKey())); return; } @@ -130,9 +122,7 @@ public class NovaServerGroupResourceValidator implements ResourceValidator { ErrorMessagesFormatBuilder .getErrorWithParameters( ERROR_CODE_HNG3, Messages.RESOURCE_NOT_IN_USE.getErrorMessage(), - ValidatorConstants.Server_Group, resourceEntry.getKey()), - LoggerTragetServiceName.VALIDATE_ALL_SERVER_GROUP_OR_SECURITY_GROUP_IN_USE, - LoggerErrorDescription.SERVER_GROUP_SECURITY_GROUP_NOT_IN_USE); + ValidatorConstants.Server_Group, resourceEntry.getKey())); } } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerResourceValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerResourceValidator.java index b6bbeb5172..4f4091f506 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerResourceValidator.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerResourceValidator.java @@ -27,8 +27,6 @@ import org.openecomp.sdc.heat.datatypes.model.HeatResourcesTypes; import org.openecomp.sdc.heat.datatypes.model.PropertiesMapKeyTypes; import org.openecomp.sdc.heat.datatypes.model.Resource; import org.openecomp.sdc.heat.datatypes.model.ResourceReferenceFunctions; -import org.openecomp.sdc.logging.types.LoggerErrorDescription; -import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.validation.ResourceValidator; import org.openecomp.sdc.validation.ValidationContext; import org.openecomp.sdc.validation.type.HeatResourceValidationContext; @@ -69,9 +67,7 @@ public class NovaServerResourceValidator implements ResourceValidator { && propertiesMap.get(PropertiesMapKeyTypes.FLAVOR.getKeyMap()) == null) { globalContext.addMessage(fileName, ErrorLevel.ERROR, ErrorMessagesFormatBuilder .getErrorWithParameters(ERROR_CODE_HNS1, Messages.MISSING_IMAGE_AND_FLAVOR.getErrorMessage(), - resourceEntry.getKey()), - LoggerTragetServiceName.VALIDATE_ASSIGNED_VALUES_FOR_NOVA_IMAGE_FLAVOR, - LoggerErrorDescription.MISSING_NOVA_PROPERTIES); + resourceEntry.getKey())); } } @@ -111,10 +107,9 @@ public class NovaServerResourceValidator implements ResourceValidator { if (serverResource != null && !serverResource.getType() .equals(HeatResourcesTypes.NOVA_SERVER_GROUP_RESOURCE_TYPE.getHeatResource())) { globalContext.addMessage(fileName, ErrorLevel.ERROR, ErrorMessagesFormatBuilder - .getErrorWithParameters(ERROR_CODE_HNS2, Messages.SERVER_NOT_DEFINED_FROM_NOVA.getErrorMessage(), - serverResourceName, resourceEntry.getKey()), - LoggerTragetServiceName.VALIDATE_SERVER_GROUP_EXISTENCE, - LoggerErrorDescription.SERVER_NOT_DEFINED_NOVA); + .getErrorWithParameters(ERROR_CODE_HNS2, + Messages.SERVER_NOT_DEFINED_FROM_NOVA.getErrorMessage(), + serverResourceName, resourceEntry.getKey())); } } } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/ResourceGroupResourceValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/ResourceGroupResourceValidator.java index a8e1ea5b40..5efb5d38e0 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/ResourceGroupResourceValidator.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/ResourceGroupResourceValidator.java @@ -25,8 +25,6 @@ import org.openecomp.sdc.datatypes.error.ErrorLevel; import org.openecomp.sdc.heat.datatypes.model.Resource; import org.openecomp.sdc.heat.services.HeatConstants; import org.openecomp.sdc.heat.services.tree.HeatTreeManagerUtil; -import org.openecomp.sdc.logging.types.LoggerErrorDescription; -import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.validation.ResourceValidator; import org.openecomp.sdc.validation.ValidationContext; import org.openecomp.sdc.validation.impl.util.HeatValidationService; @@ -100,9 +98,7 @@ public class ResourceGroupResourceValidator implements ResourceValidator { globalContext.addMessage(fileName, ErrorLevel.ERROR, ErrorMessagesFormatBuilder .getErrorWithParameters( ERROR_CODE_HRR1, Messages.RESOURCE_GROUP_INVALID_INDEX_VAR.getErrorMessage(), - resourceEntry.getKey()), - LoggerTragetServiceName.VALIDATE_RESOURCE_GROUP_TYPE, - LoggerErrorDescription.INVALID_INDEX_VAR); + resourceEntry.getKey())); return Optional.empty(); } } @@ -140,9 +136,7 @@ public class ResourceGroupResourceValidator implements ResourceValidator { globalContext.addMessage(resourceType, ErrorLevel.ERROR, ErrorMessagesFormatBuilder .getErrorWithParameters( ERROR_CODE_HRR2, Messages.MISSING_NESTED_FILE.getErrorMessage(), - resourceType), - LoggerTragetServiceName.VALIDATE_PROPERTIES_MATCH_NESTED_PARAMETERS, - LoggerErrorDescription.MISSING_FILE); + resourceType)); } } @@ -154,8 +148,7 @@ public class ResourceGroupResourceValidator implements ResourceValidator { globalContext.addMessage(fileName, ErrorLevel.ERROR, ErrorMessagesFormatBuilder .getErrorWithParameters( ERROR_CODE_HRR3, Messages.NESTED_LOOP.getErrorMessage(), - HeatValidationService.drawFilesLoop(filesInLoop)), - LoggerTragetServiceName.VALIDATE_NESTING_LOOPS, LoggerErrorDescription.NESTED_LOOP); + HeatValidationService.drawFilesLoop(filesInLoop))); } } } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/ContrailServiceInstanceNamingConventionValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/ContrailServiceInstanceNamingConventionValidator.java index 28de94350c..4223a322f3 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/ContrailServiceInstanceNamingConventionValidator.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/ContrailServiceInstanceNamingConventionValidator.java @@ -16,7 +16,6 @@ package org.openecomp.sdc.validation.impl.validators.namingconvention; -import static java.util.Objects.nonNull; import org.apache.commons.collections4.MapUtils; import org.openecomp.core.validation.ErrorMessageCode; import org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder; @@ -24,14 +23,14 @@ import org.openecomp.core.validation.types.GlobalValidationContext; import org.openecomp.sdc.common.errors.Messages; import org.openecomp.sdc.datatypes.error.ErrorLevel; import org.openecomp.sdc.heat.datatypes.model.Resource; -import org.openecomp.sdc.logging.types.LoggerErrorDescription; -import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.validation.ResourceValidator; import org.openecomp.sdc.validation.ValidationContext; import org.openecomp.sdc.validation.util.ValidationUtil; import java.util.Map; +import static java.util.Objects.nonNull; + public class ContrailServiceInstanceNamingConventionValidator implements ResourceValidator { private static final String AVAILABILITY_ZONE = "availability_zone"; @@ -69,18 +68,14 @@ public class ContrailServiceInstanceNamingConventionValidator implements Resourc Messages.PARAMETER_NAME_NOT_ALIGNED_WITH_GUIDELINES.getErrorMessage(), ValidationUtil.getMessagePartAccordingToResourceType(resourceEntry), "Availability Zone", - availabilityZoneName, resourceEntry.getKey()), - LoggerTragetServiceName.VALIDATE_AVAILABILITY_ZONE_NAME, - LoggerErrorDescription.NAME_NOT_ALIGNED_WITH_GUIDELINES); + availabilityZoneName, resourceEntry.getKey())); } } else { globalContext.addMessage( fileName, ErrorLevel.WARNING, ErrorMessagesFormatBuilder .getErrorWithParameters(ERROR_CODE_NSI2, Messages.MISSING_GET_PARAM.getErrorMessage(), - AVAILABILITY_ZONE, resourceEntry.getKey()), - LoggerTragetServiceName.VALIDATE_AVAILABILITY_ZONE_NAME, - LoggerErrorDescription.MISSING_GET_PARAM); + AVAILABILITY_ZONE, resourceEntry.getKey())); } } } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/ContrailServiceTemplateNamingConventionValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/ContrailServiceTemplateNamingConventionValidator.java index f0c5011d9f..d85c0c6abc 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/ContrailServiceTemplateNamingConventionValidator.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/ContrailServiceTemplateNamingConventionValidator.java @@ -16,7 +16,6 @@ package org.openecomp.sdc.validation.impl.validators.namingconvention; -import static java.util.Objects.nonNull; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.tuple.ImmutablePair; @@ -27,8 +26,6 @@ import org.openecomp.core.validation.types.GlobalValidationContext; import org.openecomp.sdc.common.errors.Messages; import org.openecomp.sdc.datatypes.error.ErrorLevel; import org.openecomp.sdc.heat.datatypes.model.Resource; -import org.openecomp.sdc.logging.types.LoggerErrorDescription; -import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.validation.ResourceValidator; import org.openecomp.sdc.validation.ValidationContext; import org.openecomp.sdc.validation.util.ValidationUtil; @@ -40,6 +37,8 @@ import java.util.Objects; import java.util.Optional; import java.util.regex.Pattern; +import static java.util.Objects.nonNull; + public class ContrailServiceTemplateNamingConventionValidator implements ResourceValidator { private static final ErrorMessageCode ERROR_CODE_NST1 = new ErrorMessageCode("NST1"); @@ -126,9 +125,7 @@ public class ContrailServiceTemplateNamingConventionValidator implements Resourc .getErrorWithParameters( ERROR_CODE_NST1, Messages.CONTRAIL_VM_TYPE_NAME_NOT_ALIGNED_WITH_NAMING_CONVENSION .getErrorMessage(), - resourceEntry.getKey()), - LoggerTragetServiceName.VALIDATE_CONTRAIL_VM_NAME, - LoggerErrorDescription.NAME_NOT_ALIGNED_WITH_GUIDELINES); + resourceEntry.getKey())); return true; } @@ -158,9 +155,7 @@ public class ContrailServiceTemplateNamingConventionValidator implements Resourc .getErrorWithParameters( ERROR_CODE_NST2, Messages.MISSING_GET_PARAM.getErrorMessage(), propertyName, - resourceEntry.getKey()), - LoggerTragetServiceName.VALIDATE_IMAGE_AND_FLAVOR_NAME, - LoggerErrorDescription.MISSING_GET_PARAM); + resourceEntry.getKey())); return true; } @@ -192,9 +187,7 @@ public class ContrailServiceTemplateNamingConventionValidator implements Resourc .getErrorWithParameters( ERROR_CODE_NST2, Messages.MISSING_GET_PARAM.getErrorMessage(), propertyName, - resourceEntry.getKey()), - LoggerTragetServiceName.VALIDATE_VM_SYNC_IN_IMAGE_FLAVOR, - LoggerErrorDescription.MISSING_GET_PARAM); + resourceEntry.getKey())); return Optional.empty(); } } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NeutronPortNamingConventionValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NeutronPortNamingConventionValidator.java index c142ef4ec8..78c01cfdfc 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NeutronPortNamingConventionValidator.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NeutronPortNamingConventionValidator.java @@ -16,7 +16,6 @@ package org.openecomp.sdc.validation.impl.validators.namingconvention; -import static java.util.Objects.nonNull; import org.apache.commons.collections4.MapUtils; import org.openecomp.core.validation.ErrorMessageCode; import org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder; @@ -26,8 +25,6 @@ import org.openecomp.sdc.datatypes.error.ErrorLevel; import org.openecomp.sdc.heat.datatypes.model.HeatOrchestrationTemplate; import org.openecomp.sdc.heat.datatypes.model.HeatResourcesTypes; import org.openecomp.sdc.heat.datatypes.model.Resource; -import org.openecomp.sdc.logging.types.LoggerErrorDescription; -import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.validation.ResourceValidator; import org.openecomp.sdc.validation.ValidationContext; import org.openecomp.sdc.validation.type.NamingConventionValidationContext; @@ -36,6 +33,8 @@ import org.openecomp.sdc.validation.util.ValidationUtil; import java.util.List; import java.util.Map; +import static java.util.Objects.nonNull; + public class NeutronPortNamingConventionValidator implements ResourceValidator { private static final ErrorMessageCode ERROR_CODE_NNP1 = new ErrorMessageCode("NNP1"); private static final ErrorMessageCode ERROR_CODE_NNP2 = new ErrorMessageCode("NNP2"); @@ -47,8 +46,10 @@ public class NeutronPortNamingConventionValidator implements ResourceValidator { NamingConventionValidationContext namingConventionValidationContext = (NamingConventionValidationContext)validationContext; - validatePortNetworkNamingConvention(fileName, namingConventionValidationContext.getHeatOrchestrationTemplate(), globalContext); - validateFixedIpsNamingConvention(fileName, namingConventionValidationContext.getHeatOrchestrationTemplate(), globalContext); + validatePortNetworkNamingConvention(fileName, namingConventionValidationContext.getHeatOrchestrationTemplate(), + globalContext); + validateFixedIpsNamingConvention(fileName, namingConventionValidationContext.getHeatOrchestrationTemplate(), + globalContext); } private void validatePortNetworkNamingConvention(String fileName, @@ -134,9 +135,7 @@ public class NeutronPortNamingConventionValidator implements ResourceValidator { ErrorLevel.WARNING, ErrorMessagesFormatBuilder.getErrorWithParameters( ERROR_CODE_NNP1, Messages.PARAMETER_NAME_NOT_ALIGNED_WITH_GUIDELINES.getErrorMessage(), - "Port", "Fixed_IPS", fixedIpsName, resourceEntry.getKey()), - LoggerTragetServiceName.VALIDATE_FIXED_IPS_NAME, - LoggerErrorDescription.NAME_NOT_ALIGNED_WITH_GUIDELINES); + "Port", "Fixed_IPS", fixedIpsName, resourceEntry.getKey())); } @@ -146,9 +145,7 @@ public class NeutronPortNamingConventionValidator implements ResourceValidator { ErrorLevel.WARNING, ErrorMessagesFormatBuilder .getErrorWithParameters( ERROR_CODE_NNP2, Messages.MISSING_GET_PARAM.getErrorMessage(), - "fixed_ips", resourceEntry.getKey()), - LoggerTragetServiceName.VALIDATE_FIXED_IPS_NAME, - LoggerErrorDescription.MISSING_GET_PARAM); + "fixed_ips", resourceEntry.getKey())); } } } @@ -161,15 +158,12 @@ public class NeutronPortNamingConventionValidator implements ResourceValidator { Object paramName; if (propertyValue instanceof Map) { paramName = ((Map) propertyValue).get("get_param"); - if (paramName instanceof String && !ValidationUtil - .evalPattern((String) paramName, regexList)) { + if (paramName instanceof String && !ValidationUtil.evalPattern(paramName, regexList)) { globalContext.addMessage( fileName, ErrorLevel.WARNING, ErrorMessagesFormatBuilder .getErrorWithParameters(ERROR_CODE_NNP3, message.getErrorMessage(), "Port", - "Network", (String) paramName, resourceId), - LoggerTragetServiceName.VALIDATE_PORT_NETWORK_NAME, - LoggerErrorDescription.NAME_NOT_ALIGNED_WITH_GUIDELINES); + "Network", (String) paramName, resourceId)); } } else { @@ -179,9 +173,7 @@ public class NeutronPortNamingConventionValidator implements ResourceValidator { ErrorMessagesFormatBuilder .getErrorWithParameters( ERROR_CODE_NNP2, Messages.MISSING_GET_PARAM.getErrorMessage(), - "network or network_id", resourceId), - LoggerTragetServiceName.VALIDATE_PORT_NETWORK_NAME, - LoggerErrorDescription.MISSING_GET_PARAM); + "network or network_id", resourceId)); } } } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidator.java index 663f8fdccc..4de0f6ddbc 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidator.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidator.java @@ -31,8 +31,6 @@ import org.openecomp.sdc.heat.datatypes.model.HeatResourcesTypes; import org.openecomp.sdc.heat.datatypes.model.Resource; import org.openecomp.sdc.heat.datatypes.model.ResourceReferenceFunctions; import org.openecomp.sdc.heat.services.HeatStructureUtil; -import org.openecomp.sdc.logging.types.LoggerErrorDescription; -import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.validation.ResourceValidator; import org.openecomp.sdc.validation.ValidationContext; import org.openecomp.sdc.validation.type.NamingConventionValidationContext; @@ -128,9 +126,7 @@ public class NovaServerNamingConventionGuideLineValidator implements ResourceVal ErrorMessagesFormatBuilder .getErrorWithParameters( ERROR_CODE_NNS1, Messages.MISSING_NOVA_SERVER_METADATA.getErrorMessage(), - resourceId), - LoggerTragetServiceName.VALIDATE_NOVA_META_DATA_NAME, - LoggerErrorDescription.MISSING_NOVA_PROPERTIES); + resourceId)); } else if (novaServerPropMetadata instanceof Map) { TreeMap propertyMap = new TreeMap((Comparator) String::compareToIgnoreCase); propertyMap.putAll((Map) novaServerPropMetadata); @@ -140,9 +136,7 @@ public class NovaServerNamingConventionGuideLineValidator implements ResourceVal ErrorLevel.WARNING, ErrorMessagesFormatBuilder.getErrorWithParameters( ERROR_CODE_NNS2, Messages.MISSING_NOVA_SERVER_VF_MODULE_ID.getErrorMessage(), - resourceId), - LoggerTragetServiceName.VALIDATE_NOVA_META_DATA_NAME, - LoggerErrorDescription.MISSING_NOVA_PROPERTIES); + resourceId)); } if (!propertyMap.containsKey("vnf_id")) { globalValidationContext.addMessage( @@ -150,9 +144,7 @@ public class NovaServerNamingConventionGuideLineValidator implements ResourceVal ErrorMessagesFormatBuilder .getErrorWithParameters( ERROR_CODE_NNS3, Messages.MISSING_NOVA_SERVER_VNF_ID.getErrorMessage(), - resourceId), - LoggerTragetServiceName.VALIDATE_NOVA_META_DATA_NAME, - LoggerErrorDescription.MISSING_NOVA_PROPERTIES); + resourceId)); } } } @@ -203,9 +195,7 @@ public class NovaServerNamingConventionGuideLineValidator implements ResourceVal ErrorLevel.WARNING, ErrorMessagesFormatBuilder.getErrorWithParameters( ERROR_CODE_NNS12, Messages.RESOURCE_CONNECTED_TO_TWO_EXTERNAL_NETWORKS_WITH_SAME_ROLE - .getErrorMessage(), resourceId, role), - LoggerTragetServiceName.VALIDATE_RESOURCE_NETWORK_UNIQUE_ROLW, - LoggerErrorDescription.RESOURCE_UNIQUE_NETWORK_ROLE); + .getErrorMessage(), resourceId, role)); } else { uniqueResourcePortNetworkRole.put(role, portResourceId); } @@ -257,9 +247,7 @@ public class NovaServerNamingConventionGuideLineValidator implements ResourceVal ErrorMessagesFormatBuilder .getErrorWithParameters( ERROR_CODE_NNS4, Messages.MISSING_GET_PARAM.getErrorMessage(), - "network or network_id", resourceId), - LoggerTragetServiceName.VALIDATE_RESOURCE_NETWORK_UNIQUE_ROLW, - LoggerErrorDescription.MISSING_GET_PARAM); + "network or network_id", resourceId)); return null; } return (Map) portNetwork; @@ -289,9 +277,7 @@ public class NovaServerNamingConventionGuideLineValidator implements ResourceVal ErrorLevel.WARNING, ErrorMessagesFormatBuilder.getErrorWithParameters( ERROR_CODE_NNS5, Messages.PARAMETER_NAME_NOT_ALIGNED_WITH_GUIDELINES.getErrorMessage(), ValidationUtil.getMessagePartAccordingToResourceType(resourceEntry), - "Availability Zone", availabilityZoneName, resourceEntry.getKey()), - LoggerTragetServiceName.VALIDATE_AVAILABILITY_ZONE_NAME, - LoggerErrorDescription.NAME_NOT_ALIGNED_WITH_GUIDELINES); + "Availability Zone", availabilityZoneName, resourceEntry.getKey())); } } else { globalContext.addMessage( @@ -299,9 +285,7 @@ public class NovaServerNamingConventionGuideLineValidator implements ResourceVal ErrorLevel.WARNING, ErrorMessagesFormatBuilder .getErrorWithParameters( ERROR_CODE_NNS6, Messages.MISSING_GET_PARAM.getErrorMessage(), - AVAILABILITY_ZONE, resourceEntry.getKey()), - LoggerTragetServiceName.VALIDATE_AVAILABILITY_ZONE_NAME, - LoggerErrorDescription.MISSING_GET_PARAM); + AVAILABILITY_ZONE, resourceEntry.getKey())); } } } @@ -379,9 +363,7 @@ public class NovaServerNamingConventionGuideLineValidator implements ResourceVal ErrorLevel.WARNING, ErrorMessagesFormatBuilder .getErrorWithParameters( ERROR_CODE_NNS7, Messages.MISSING_GET_PARAM.getErrorMessage(), - "nova server name", resourceEntry.getKey()), - LoggerTragetServiceName.VALIDATE_NOVA_SERVER_NAME, - LoggerErrorDescription.MISSING_GET_PARAM); + "nova server name", resourceEntry.getKey())); } return novaName; @@ -411,9 +393,7 @@ public class NovaServerNamingConventionGuideLineValidator implements ResourceVal ErrorLevel.WARNING, ErrorMessagesFormatBuilder .getErrorWithParameters( ERROR_CODE_NNS8, Messages.MISSING_GET_PARAM.getErrorMessage(), - propertyName, resourceEntry.getKey()), - LoggerTragetServiceName.VALIDATE_IMAGE_AND_FLAVOR_NAME, - LoggerErrorDescription.MISSING_GET_PARAM); + propertyName, resourceEntry.getKey())); return true; } @@ -469,9 +449,7 @@ public class NovaServerNamingConventionGuideLineValidator implements ResourceVal ErrorLevel.WARNING, ErrorMessagesFormatBuilder.getErrorWithParameters( ERROR_CODE_NNS9, Messages.PARAMETER_NAME_NOT_ALIGNED_WITH_GUIDELINES.getErrorMessage(), SERVER, "Name", - novaServerNameEnvValue.toString(), resourceEntry.getKey()), - LoggerTragetServiceName.VALIDATE_NOVA_SERVER_NAME, - LoggerErrorDescription.NAME_NOT_ALIGNED_WITH_GUIDELINES); + novaServerNameEnvValue.toString(), resourceEntry.getKey())); } } } @@ -491,9 +469,7 @@ public class NovaServerNamingConventionGuideLineValidator implements ResourceVal ErrorMessagesFormatBuilder.getErrorWithParameters( ERROR_CODE_NNS10, Messages.PARAMETER_NAME_NOT_ALIGNED_WITH_GUIDELINES.getErrorMessage(), SERVER, - "name", getParamNameList.toString(), resourceEntry.getKey()), - LoggerTragetServiceName.VALIDATE_NOVA_SERVER_NAME, - LoggerErrorDescription.NAME_NOT_ALIGNED_WITH_GUIDELINES); + "name", getParamNameList.toString(), resourceEntry.getKey())); return null; } @@ -512,9 +488,7 @@ public class NovaServerNamingConventionGuideLineValidator implements ResourceVal ErrorMessagesFormatBuilder.getErrorWithParameters( ERROR_CODE_NNS10, Messages.PARAMETER_NAME_NOT_ALIGNED_WITH_GUIDELINES.getErrorMessage(), SERVER, - "name", novaName, resourceEntry.getKey()), - LoggerTragetServiceName.VALIDATE_NOVA_SERVER_NAME, - LoggerErrorDescription.NAME_NOT_ALIGNED_WITH_GUIDELINES); + "name", novaName, resourceEntry.getKey())); return null; } return novaName; @@ -538,9 +512,7 @@ public class NovaServerNamingConventionGuideLineValidator implements ResourceVal ErrorLevel.WARNING, ErrorMessagesFormatBuilder.getErrorWithParameters( ERROR_CODE_NNS11, Messages.NOVA_NAME_IMAGE_FLAVOR_NOT_CONSISTENT.getErrorMessage(), - resourceEntry.getKey()), - LoggerTragetServiceName.VALIDATE_IMAGE_AND_FLAVOR_NAME, - LoggerErrorDescription.NAME_NOT_ALIGNED_WITH_GUIDELINES); + resourceEntry.getKey())); } } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/base/ResourceBaseValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/base/ResourceBaseValidator.java index 5013283c8f..76b63d5498 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/base/ResourceBaseValidator.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/base/ResourceBaseValidator.java @@ -16,8 +16,6 @@ import org.openecomp.sdc.heat.services.HeatStructureUtil; import org.openecomp.sdc.heat.services.manifest.ManifestUtil; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; -import org.openecomp.sdc.logging.types.LoggerErrorDescription; -import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.validation.ResourceValidator; import org.openecomp.sdc.validation.ValidationContext; import org.openecomp.sdc.validation.Validator; @@ -33,8 +31,8 @@ import java.util.Objects; */ public class ResourceBaseValidator implements Validator { - protected Map resourceTypeToImpl = new HashMap<>(); - private static Logger logger = LoggerFactory.getLogger(ResourceBaseValidator.class); + protected final Map resourceTypeToImpl = new HashMap<>(); + private static final Logger LOGGER = LoggerFactory.getLogger(ResourceBaseValidator.class); private static final ErrorMessageCode ERROR_CODE_RBV_1 = new ErrorMessageCode("RBV1"); private static final ErrorMessageCode ERROR_CODE_RBV_2 = new ErrorMessageCode("RBV2"); @@ -56,7 +54,7 @@ public class ResourceBaseValidator implements Validator { try { manifestContent = ValidationUtil.validateManifest(globalContext); } catch (Exception exception) { - logger.debug("",exception); + LOGGER.debug("",exception); return; } @@ -94,8 +92,7 @@ public class ResourceBaseValidator implements Validator { globalContext.addMessage(fileName, ErrorLevel.WARNING, ErrorMessagesFormatBuilder .getErrorWithParameters(ERROR_CODE_RBV_1, Messages.INVALID_RESOURCE_TYPE.getErrorMessage(),"null", - resourceEntry.getKey()), LoggerTragetServiceName.VALIDATE_RESOURCE_TYPE, - LoggerErrorDescription.INVALID_RESOURCE_TYPE); + resourceEntry.getKey())); } else { ResourceValidator resourceValidatorImpl = getResourceValidatorInstance(resourceType, resourceTypeToImpl); diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/util/ValidationUtil.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/util/ValidationUtil.java index db1d9eac88..a2826e4871 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/util/ValidationUtil.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/util/ValidationUtil.java @@ -18,8 +18,6 @@ import org.openecomp.sdc.heat.datatypes.model.ResourceReferenceFunctions; import org.openecomp.sdc.heat.services.HeatStructureUtil; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; -import org.openecomp.sdc.logging.types.LoggerErrorDescription; -import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.tosca.services.YamlUtil; import java.io.InputStream; @@ -147,9 +145,7 @@ public class ValidationUtil { ErrorMessagesFormatBuilder.getErrorWithParameters(globalContext.getMessageCode(), Messages.PARAMETER_NAME_NOT_ALIGNED_WITH_GUIDELINES.getErrorMessage(), getMessagePartAccordingToResourceType(resourceEntry), propertyName, propertyValue, - resourceEntry.getKey()), - LoggerTragetServiceName.VALIDATE_IMAGE_AND_FLAVOR_NAME, - LoggerErrorDescription.NAME_NOT_ALIGNED_WITH_GUIDELINES); + resourceEntry.getKey())); return true; } return false; @@ -199,9 +195,7 @@ public class ValidationUtil { globalContext.addMessage(fileName, ErrorLevel.ERROR, ErrorMessagesFormatBuilder .getErrorWithParameters(globalContext.getMessageCode(), Messages.INVALID_HEAT_FORMAT_REASON.getErrorMessage() - , getParserExceptionReason(exception)), - LoggerTragetServiceName.VALIDATE_HEAT_FORMAT, - LoggerErrorDescription.INVALID_HEAT_FORMAT); + , getParserExceptionReason(exception))); return null; } return heatOrchestrationTemplate; -- cgit 1.2.3-korg