From 6beb446925c967aca92f5513adf36c5db77c00d6 Mon Sep 17 00:00:00 2001 From: TATTAVARADA Date: Thu, 27 Apr 2017 07:53:18 -0400 Subject: [PORTAL-7] Rebase This rebasing includes common libraries and common overlays projects abstraction of components Change-Id: Ia1efa4deacdc5701e6205104ac021a6c80ed60ba Signed-off-by: st782s --- .../core/logging/format/AlarmSeverityEnum.java | 28 +++ .../core/logging/format/AppMessagesEnum.java | 249 +++++++++++++++++++++ .../logging/format/ApplicationCodes.properties | 221 ++++++++++++++++++ .../core/logging/format/AuditLogFormatter.java | 106 +++++++++ .../core/logging/format/ErrorCodesEnum.java | 89 ++++++++ .../core/logging/format/ErrorSeverityEnum.java | 27 +++ .../core/logging/format/ErrorTypeEnum.java | 29 +++ 7 files changed, 749 insertions(+) create mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/logging/format/AlarmSeverityEnum.java create mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/logging/format/AppMessagesEnum.java create mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/logging/format/ApplicationCodes.properties create mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/logging/format/AuditLogFormatter.java create mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/logging/format/ErrorCodesEnum.java create mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/logging/format/ErrorSeverityEnum.java create mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/logging/format/ErrorTypeEnum.java (limited to 'ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/logging/format') diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/logging/format/AlarmSeverityEnum.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/logging/format/AlarmSeverityEnum.java new file mode 100644 index 00000000..360d8d81 --- /dev/null +++ b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/logging/format/AlarmSeverityEnum.java @@ -0,0 +1,28 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.logging.format; + +public enum AlarmSeverityEnum { + CRITICAL, + MAJOR, + MINOR, + INFORMATIONAL, + NONE, +} diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/logging/format/AppMessagesEnum.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/logging/format/AppMessagesEnum.java new file mode 100644 index 00000000..a6924ba0 --- /dev/null +++ b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/logging/format/AppMessagesEnum.java @@ -0,0 +1,249 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.logging.format; + +public enum AppMessagesEnum { + /* + 100-199 Security/Permission Related + - Authentication problems (from external client, to external server) + - Certification errors + - + + 200-299 Availability/Timeout Related + - connectivity error + - connection timeout + + 300-399 Data Access/Integrity Related + - Data in graph in invalid(E.g. no creator is found for service) + - Artifact is missing in ES, but exists in graph. + + 400-499 Schema Interface Type/Validation + - received Pay-load checksum is invalid + - received JSON is not valid + + 500-599 Business/Flow Processing Related + - check out to service is not allowed + - Roll-back is done + - failed to generate heat file + + + 600-899 Reserved - do not use + + 900-999 Unknown Errors + - Unexpected exception + */ + + BeUebAuthenticationError(ErrorCodesEnum.BEUEBAUTHENTICATIONERROR_ONE_ARGUMENT, ErrorTypeEnum.AUTHENTICATION_PROBLEM, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, + "ERR100E", "An Authentication failure occurred during access to UEB server", "Details: {0}.", "Please check UEB server list and keys configured under Portal.Properties file."), + + BeRestApiAuthenticationError(ErrorCodesEnum.BERESTAPIAUTHENTICATIONERROR, ErrorTypeEnum.AUTHENTICATION_PROBLEM, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, + "ERR101E", "Rejected an incoming REST API request due to invalid credentials", "", "Please check application credentials defined in Database or properties files."), + + InternalAuthenticationInfo(ErrorCodesEnum.INTERNALAUTHENTICATIONINFO_ONE_ARGUMENT, ErrorTypeEnum.AUTHENTICATION_PROBLEM, AlarmSeverityEnum.INFORMATIONAL, ErrorSeverityEnum.INFO, + "ERR199I", "Internal authentication problem", "Details: {0}.", "Please check the logs for more information."), + + InternalAuthenticationWarning(ErrorCodesEnum.INTERNALAUTHENTICATIONWARNING_ONE_ARGUMENT, ErrorTypeEnum.AUTHENTICATION_PROBLEM, AlarmSeverityEnum.MINOR, ErrorSeverityEnum.WARN, + "ERR199W", "Internal authentication problem", "Details: {0}.", "Please check the logs for more information."), + + InternalAuthenticationError(ErrorCodesEnum.INTERNALAUTHENTICATIONERROR_ONE_ARGUMENT, ErrorTypeEnum.AUTHENTICATION_PROBLEM, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, + "ERR199E", "Internal authentication problem", "Details: {0}.", "Please check the logs for more information."), + + InternalAuthenticationFatal(ErrorCodesEnum.INTERNALAUTHENTICATIONFATAL_ONE_ARGUMENT, ErrorTypeEnum.AUTHENTICATION_PROBLEM, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.FATAL, + "ERR199F", "Internal authentication problem", "Details: {0}.", "Please check the logs for more information."), + + BeHealthCheckError(ErrorCodesEnum.BeHEALTHCHECKERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.ERROR, + "ERR200E", "ECOMP-PORTAL Back-end probably lost connectivity to either one of the following components: MySQL DB, UEB Cluster", "", "Please check the logs for more information."), + + BeHealthCheckMySqlError(ErrorCodesEnum.BEHEALTHCHECKMYSQLERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.ERROR, + "ERR201E", "ECOMP-PORTAL Back-end probably lost connectivity to MySQL DB", "", "Check connectivity to MYSQL is configured correctly under system.properties file."), + + BeHealthCheckUebClusterError(ErrorCodesEnum.BEHEALTHCHECKUEBCLUSTERERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.ERROR, + "ERR203E", "ECOMP-PORTAL Back-end probably lost connectivity to UEB Cluster", "", "Check connectivity to UEB cluster which is configured under portal.properties file."), + + FeHealthCheckError(ErrorCodesEnum.FEHEALTHCHECKERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.ERROR, + "ERR204E", "Unable to connect to a valid ECOMP-PORTAL Back-end Server.", "", "Please check connectivity from this FE instance towards BE or BE Load Balancer."), + + BeHealthCheckRecovery(ErrorCodesEnum.BEHEALTHCHECKRECOVERY, ErrorTypeEnum.RECOVERY, AlarmSeverityEnum.INFORMATIONAL, ErrorSeverityEnum.INFO, + "ERR205I", "ECOMP-PORTAL Back-end Recovery to either one of the following components: MySQL DB, UEB Cluster", "", "Please check logs for more specific information about the problem."), + + BeHealthCheckMySqlRecovery(ErrorCodesEnum.BEHEALTHCHECKMYSQLRECOVERY, ErrorTypeEnum.RECOVERY, AlarmSeverityEnum.INFORMATIONAL, ErrorSeverityEnum.INFO, + "ERR206I", "ECOMP-PORTAL Back-end connection recovery to MySQL DB", "", "Please check logs for more specific information about the problem."), + + BeHealthCheckUebClusterRecovery(ErrorCodesEnum.BEHEALTHCHECKUEBCLUSTERRECOVERY, ErrorTypeEnum.RECOVERY, AlarmSeverityEnum.INFORMATIONAL, ErrorSeverityEnum.INFO, + "ERR208I", "ECOMP-PORTAL Back-end connection recovery to UEB Cluster", "", "Please check logs for more specific information about the problem."), + + FeHealthCheckRecovery(ErrorCodesEnum.FEHEALTHCHECKRECOVERY, ErrorTypeEnum.RECOVERY, AlarmSeverityEnum.INFORMATIONAL, ErrorSeverityEnum.INFO, + "ERR209I", "Connectivity to ECOMP-PORTAL Front-end Server is recovered", "", "Please check logs for more specific information about the problem."), + + BeUebConnectionError(ErrorCodesEnum.BEUEBCONNECTIONERROR_ONE_ARGUMENT, ErrorTypeEnum.CONNECTION_PROBLEM, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, + "ERR210E", "ECOMP-PORTAL Back-end probably lost connectivity to UEB Cluster", "Details: {0}.", "Please check UEB server list and keys configured under Portal.Properties file."), + + BeUebUnkownHostError(ErrorCodesEnum.BEUEBUNKOWNHOSTERROR_ONE_ARGUMENT, ErrorTypeEnum.CONNECTION_PROBLEM, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, + "ERR211E", "ECOMP-PORTAL Back-end probably lost connectivity to UEB Cluster", "Cannot reach host: {0}.", "Please check UEB server list and keys configured under Portal.Properties file."), + + BeUebRegisterOnboardingAppError(ErrorCodesEnum.BEUEBREGISTERONBOARDINGAPPERROR, ErrorTypeEnum.CONNECTION_PROBLEM, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, + "ERR212E", "Failed to register the On-boarding application with UEB Communication server", "Details: {0}.", "Please check UEB server list and keys configured under Portal.Properties file."), + + BeHttpConnectionError(ErrorCodesEnum.BEHTTPCONNECTIONERROR_ONE_ARGUMENT, ErrorTypeEnum.CONNECTION_PROBLEM, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, + "ERR213E", "It could be that communication to an external application might resulted an exception or failed to reach the external application", + "Details: {0}.", "Please check logs for more information."), + + InternalConnectionInfo(ErrorCodesEnum.INTERNALCONNECTIONINFO_ONE_ARGUMENT, ErrorTypeEnum.CONNECTION_PROBLEM, AlarmSeverityEnum.INFORMATIONAL, ErrorSeverityEnum.INFO, + "ERR299I", "Internal Connection problem", "Details: {0}.", "Please check logs for more information."), + + InternalConnectionWarning(ErrorCodesEnum.INTERNALCONNECTIONWARNING_ONE_ARGUMENT, ErrorTypeEnum.CONNECTION_PROBLEM, AlarmSeverityEnum.MINOR, ErrorSeverityEnum.WARN, + "ERR299W", "Internal Connection problem", "Details: {0}.", "Please check logs for more information."), + + InternalConnectionError(ErrorCodesEnum.INTERNALCONNECTIONERROR_ONE_ARGUMENT, ErrorTypeEnum.CONNECTION_PROBLEM, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, + "ERR299E", "Internal Connection problem", "Details: {0}.", "Please check logs for more information."), + + InternalConnectionFatal(ErrorCodesEnum.INTERNALCONNECTIONFATAL_ONE_ARGUMENT, ErrorTypeEnum.CONNECTION_PROBLEM, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.FATAL, + "ERR299F", "Internal Connection problem", "Details: {0}.", "Please check logs for more information."), + + BeUebObjectNotFoundError(ErrorCodesEnum.BEUEBOBJECTNOTFOUNDERROR_ONE_ARGUMENT, ErrorTypeEnum.DATA_ERROR, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, + "ERR303E", "Error occurred during access to U-EB Server.", "Data not found: {0}.", "An error occurred during access to UEB Server, {1} failed to either register or unregister to/from UEB topic."), + + BeUserMissingError(ErrorCodesEnum.BEUSERMISSINGERROR_ONE_ARGUMENT, ErrorTypeEnum.DATA_ERROR, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, + "ERR310E", "User is not found", "", "User {0} must be added to the corresponding application with proper user roles."), + + BeUserInactiveWarning(ErrorCodesEnum.BEUSERINACTIVEWARNING_ONE_ARGUMENT, ErrorTypeEnum.DATA_ERROR, AlarmSeverityEnum.MINOR, ErrorSeverityEnum.WARN, + "ERR313W", "User is found but in-active", "", "User {0} must be added to the corresponding application with proper user roles."), + + BeUserAdminPrivilegesInfo(ErrorCodesEnum.BEUSERADMINPRIVILEGESINFO_ONE_ARGUMENT, ErrorTypeEnum.DATA_ERROR, AlarmSeverityEnum.MINOR, ErrorSeverityEnum.WARN, + "ERR314W", "User is found but don't have administrative privileges", "", "User {0} should be given administrator role for the corresponding application to perform the necessary actions."), + + BeInvalidJsonInput(ErrorCodesEnum.BEINVALIDJSONINPUT, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, + "ERR405E", "Failed to convert JSON input to object", "", "Please check logs for more information."), + + BeIncorrectHttpStatusError(ErrorCodesEnum.BEINCORRECTHTTPSTATUSERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, + "ERR407E", "Communication to an external application is resulted in with Incorrect Http response code", "", "Please check logs for more information."), + + BeInitializationError(ErrorCodesEnum.BEINITIALIZATIONERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.ERROR, + "ERR500E", "ECOMP-PORTAL Back-end was not initialized properly", "", "Please check logs for more information."), + + BeUebSystemError(ErrorCodesEnum.BEUEBSYSTEMERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, + "ERR502E", "Error occurred during access to U-EB Server", "Details: {0}.", "An error occurred in {1} distribution mechanism. Please check the logs for more information."), + + BeDaoSystemError(ErrorCodesEnum.BEDAOSYSTEMERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.ERROR, + "ERR505E", "Performing DDL or DML operations on database might have failed", "", "Please check MySQL DB health or look at the logs for more details."), + + BeSystemError(ErrorCodesEnum.BESYSTEMERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.ERROR, + "ERR506E", "Unexpected error during operation", "", "Please check logs for more information."), + + BeExecuteRollbackError(ErrorCodesEnum.BEEXECUTEROLLBACKERROR, ErrorTypeEnum.DATA_ERROR, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, + "ERR507E", "Roll-back operation towards database has failed", "", "Please check MYSQL DB health or look at the logs for more details."), + + FeHttpLoggingError(ErrorCodesEnum.FEHTTPLOGGINGERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.MINOR, ErrorSeverityEnum.ERROR, + "ERR517E", "Error when logging FE HTTP request/response", "", "Please check MYSQL DB health or look at the logs for more details."), + + FePortalServletError(ErrorCodesEnum.FEPORTALSERVLETERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, + "ERR518E", "Error when trying to access FE Portal page.", "", "Please check logs for more information."), + + BeDaoCloseSessionError(ErrorCodesEnum.BEDAOCLOSESESSIONERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, + "ERR519E", "Close local session operation with database failed", "", "Please check MYSQL DB health or look at the logs form more details."), + + BeRestApiGeneralError(ErrorCodesEnum.BERESTAPIGENERALERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.ERROR, + "ERR900E", "Unexpected error during ECOMP-PORTAL Back-end REST API execution", "", "Please check error log for more information."), + + FeHealthCheckGeneralError(ErrorCodesEnum.FEHEALTHCHECKGENERALERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.ERROR, + "ERR901E", "General error during FE Health Check", "", "Please check error log for more information."), + + InternalUnexpectedInfo(ErrorCodesEnum.INTERNALUNEXPECTEDINFO_ONE_ARGUMENT, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.INFORMATIONAL, ErrorSeverityEnum.INFO, + "ERR999I", "Unexpected error", "Details: {0}.", "Please check logs for more information."), + + InternalUnexpectedWarning(ErrorCodesEnum.INTERNALUNEXPECTEDWARNING_ONE_ARGUMENT, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.MINOR, ErrorSeverityEnum.WARN, + "ERR999W", "Unexpected error", "Details: {0}.", "Please check logs for more information."), + + InternalUnexpectedError(ErrorCodesEnum.INTERNALUNEXPECTEDERROR_ONE_ARGUMENT, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, + "ERR999E", "Unexpected error", "Details: {0}.", "Please check logs for more information."), + + InternalUnexpectedFatal(ErrorCodesEnum.INTERNALUNEXPECTEDFATAL_ONE_ARGUMENT, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.FATAL, + "ERR999F", "Unexpected error", "Details: {0}.", "Please check logs for more information."), + + ; + + ErrorTypeEnum eType; + AlarmSeverityEnum alarmSeverity; + ErrorCodesEnum messageCode; + ErrorSeverityEnum errorSeverity; + String errorCode; + String errorDescription; + String details; + String resolution; + + AppMessagesEnum(ErrorCodesEnum messageCode, ErrorTypeEnum eType, AlarmSeverityEnum alarmSeverity, ErrorSeverityEnum errorSeverity, String errorCode, String errorDescription, + String details, String resolution) { + this.messageCode = messageCode; + this.eType = eType; + this.alarmSeverity = alarmSeverity; + this.errorSeverity = errorSeverity; + this.errorCode = errorCode; + this.errorDescription = errorDescription; + this.details = details; + this.resolution = resolution; + } + + public String getDetails() { + return this.details; + } + + public String getResolution() { + return this.resolution; + } + public String getErrorCode() { + return this.errorCode; + } + + public String getErrorDescription() { + return this.errorDescription; + } + + public ErrorSeverityEnum getErrorSeverity() { + return this.errorSeverity; + } + + public void setErrorSeverity(ErrorSeverityEnum errorSeverity) { + this.errorSeverity = errorSeverity; + } + + public ErrorCodesEnum getMessageCode() { + return messageCode; + } + + public void setMessageCode(ErrorCodesEnum messageCode) { + this.messageCode = messageCode; + } + + public AlarmSeverityEnum getAlarmSeverity() { + return alarmSeverity; + } + + public void setAlarmSeverity(AlarmSeverityEnum alarmSeverity) { + this.alarmSeverity = alarmSeverity; + } + + public ErrorTypeEnum getErrorType() { + return eType; + } + + public void setErrorType(ErrorTypeEnum eType) { + this.eType = eType; + } +} diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/logging/format/ApplicationCodes.properties b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/logging/format/ApplicationCodes.properties new file mode 100644 index 00000000..efd9ac24 --- /dev/null +++ b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/logging/format/ApplicationCodes.properties @@ -0,0 +1,221 @@ +### +# ================================================================================ +# eCOMP Portal SDK +# ================================================================================ +# Copyright (C) 2017 AT&T Intellectual Property +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ================================================================================ +### +######################################################################## +#Resource key=Error Code|Message text|Resolution text |Description text +####### +#Newlines can be utilized to add some clarity ensuring continuing line +#has atleast one leading space +#ResourceKey=\ +# ERR0000E\ +# Sample error msg txt\ +# Sample resolution msg\ +# Sample description txt +# +###### +#Error code classification category +#100 Permission errors +#200 Availability errors/Timeouts +#300 Data errors +#400 Schema Interface type/validation errors +#500 Business process errors +#900 Unknown errors +# +######################################################################## + +#Health check +BEUEBAUTHENTICATIONERROR_ONE_ARGUMENT=\ + ERR100E|\ + Authentication problem towards U-EB server. Reason: {0}.|\ + An Authentication failure occurred during access to UEB server. Please check that UEB keys are configured correctly under fusion.properties file.| + +BERESTAPIAUTHENTICATIONERROR =\ + ERR101E|\ + Rejected an incoming REST API request to {0} from {1} due to invalid credentials.|\ + Please check application credentials defined in Database or portal.properties file.| + +INTERNALAUTHENTICATIONINFO_ONE_ARGUMENT=\ + ERR199I|\ + Internal authentication problem. Description: {0}.| + +INTERNALAUTHENTICATIONWARNING_ONE_ARGUMENT=\ + ERR199W|\ + Internal authentication problem. Description: {0}.| + +INTERNALAUTHENTICATIONERROR_ONE_ARGUMENT=\ + ERR199E|\ + Internal authentication problem. Description: {0}.| + +INTERNALAUTHENTICATIONFATAL_ONE_ARGUMENT=\ + ERR199F|\ + Internal authentication problem. Description: {0}.| + +BEHEALTHCHECKERROR=\ + ERR200E|\ + {0} probably lost connectivity to either one of the following components: MySQL DB, UEB Cluster. Please check the logs for more information.| + +BEHEALTHCHECKMYSQLERROR=\ + ERR201E|\ + {0} probably lost connectivity to MySQL DB. Please check the logs for more information.|\ + Check connectivity to MYSQL is configured correctly under system.properties file.| + +BEHEALTHCHECKUEBCLUSTERERROR=\ + ERR203E|\ + {0} probably lost connectivity to UEB Cluster. Please check the logs for more information.|\ + Check connectivity to UEB cluster which is configured under portal.properties file.| + +BEHEALTHCHECKRECOVERY=\ + ERR205I|\ + {0} Recovery to either one of the following components: MySQL DB, UEB Cluster.| + +BEHEALTHCHECKMYSQLRECOVERY=\ + ERR206I|\ + {0} connection recovery to MySQL DB.| + +BEHEALTHCHECKUEBCLUSTERRECOVERY=\ + ERR208I|\ + {0} connection recovery to UEB Cluster.| + +FEHEALTHCHECKRECOVERY=\ + ERR209I|\ + Connectivity to {0} Server is recovered.| + +#UEB communication +BEUEBCONNECTIONERROR_ONE_ARGUMENT=\ + ERR210E|\ + Connection problem towards U-EB server. Reason: {0}.|\ + Please check that that parameter uebServers in portal.properties points to a valid UEB Cluster.| + +BEUEBSYSTEMERROR=\ + ERR502E|\ + Error occurred during access to U-EB Server. Operation: {0}.|\ + An error occurred in {1} distribution mechanism. Please check the logs for more information.| + +BEUEBUNKOWNHOSTERROR_ONE_ARGUMENT=\ + ERR211E|\ + Connection problem towards U-EB server. Cannot reach host {0}.|\ + Please check that that parameter uebServers in portal.properties points to a valid UEB Cluster.| + +#Onboarding apps +BEUEBREGISTERONBOARDINGAPPERROR=\ + ERR212E|\ + Unable to register the On-boarding application with the U-EB server. Reason: {0}.|\ + Please check that that parameter uebServers in system.properties points to a valid UEB Cluster.| + +#HTTP communication +BEHTTPCONNECTIONERROR_ONE_ARGUMENT=\ + ERR213E|\ + HTTP connection to an external application is failed. Reason: {0}.|\ + Please check the logs for more information.| + +INTERNALCONNECTIONINFO_ONE_ARGUMENT=\ + ERR299I|\ + Internal Connection problem. Description: {0}.| + +INTERNALCONNECTIONWARNING_ONE_ARGUMENT=\ + ERR299W|\ + Internal Connection problem. Description: {0}.| + +INTERNALCONNECTIONERROR_ONE_ARGUMENT=\ + ERR299E|\ + Internal Connection problem. Description: {0}.| + +INTERNALCONNECTIONFATAL_ONE_ARGUMENT=\ + ERR299F|\ + Internal Connection problem. Description: {0}.| + +BEUEBOBJECTNOTFOUNDERROR_ONE_ARGUMENT=\ + ERR303E|\ + Error occurred during access to U-EB Server. Data not found: {0}.|\ + An error occurred during access to UEB Server, {1} failed to either register or unregister to/from UEB topic.| + +#Login error codes +BEUSERMISSINGERROR_ONE_ARGUMENT=\ + ERR310E|\ + User {0} requested is not found.| + +BEUSERINACTIVEWARNING_ONE_ARGUMENT=\ + ERR313W|\ + User {0} is found but inactive.| + +BEUSERADMINPRIVILEGESINFO_ONE_ARGUMENT=\ + ERR314W|\ + User {0} is found but don't have administrative privileges.| + +BEINVALIDJSONINPUT=\ + ERR405E|\ + Failed to convert JSON input to object.|\ + Please check error logs for more information.| + +BEINCORRECTHTTPSTATUSERROR=\ + ERR407E|\ + Incorrect HttpResponse Received.|\ + Please check error & metrics logs for more information.| + +BEINITIALIZATIONERROR=\ + ERR500E|\ + BE was not initialized properly.| + +BEDAOSYSTEMERROR=\ + ERR505E|\ + Operation towards database failed.|\ + Please check MySQL DB health or look at the logs for more details.| + +BESYSTEMERROR=\ + ERR506E|\ + Unexpected error during operation.| + +BEEXECUTEROLLBACKERROR=\ + ERR507E|\ + Roll-back operation towards database failed.|\ + Please check MYSQL DB health or look at the logs for more details.| + +FEHTTPLOGGINGERROR=\ + ERR517E|\ + Error when logging FE HTTP request/response.| + +BEDAOCLOSESESSIONERROR=\ + ERR519E|\ + Close local session operation with database failed.|\ + Please check MYSQL DB health or look at the logs form more details.| + +BERESTAPIGENERALERROR=\ + ERR900E|\ + Unexpected error during BE REST API execution.|\ + Please check error log for more information.| + +FEHEALTHCHECKGENERALERROR=\ + ERR901E|\ + General error during FE Health Check.| + +INTERNALUNEXPECTEDINFO_ONE_ARGUMENT=\ + ERR999I|\ + Unexpected error. Description: {0}.| + +INTERNALUNEXPECTEDWARNING_ONE_ARGUMENT=\ + ERR999W|\ + Unexpected error. Description: {0}.| + +INTERNALUNEXPECTEDERROR_ONE_ARGUMENT=\ + ERR999E|\ + Unexpected error. Description: {0}.| + +INTERNALUNEXPECTEDFATAL_ONE_ARGUMENT=\ + ERR999F|\ + Unexpected error. Description: {0}.| diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/logging/format/AuditLogFormatter.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/logging/format/AuditLogFormatter.java new file mode 100644 index 00000000..2cb336e2 --- /dev/null +++ b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/logging/format/AuditLogFormatter.java @@ -0,0 +1,106 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.logging.format; + +import java.text.MessageFormat; +import java.util.Map; + +import org.openecomp.portalsdk.core.util.SystemProperties; + +public class AuditLogFormatter { + //Singleton + private static AuditLogFormatter instance = new AuditLogFormatter(); + + public static AuditLogFormatter getInstance() { + + return instance; + } + + public String createMessage(String protocol,String set, + String loginId, String message) { + + Object[] securityMessageArgs = prepareFormatArgs( + protocol, + set, + loginId, + message ); + + return MessageFormat.format(SystemProperties.SECURITY_LOG_TEMPLATE, securityMessageArgs); + } + + /** + * A method for normalizing the security log field - returns + * the @Param defaultValue in case the entry is null or empty. + * If the @param entry is not empty, a single quotation is added to it. + * + * @param entry the entry + * @param defaultValue The default value in case the entry is empty + * @return String (formatted) + */ + private String formatEntry(Object entry, String defaultValue) { + return (entry!=null && !entry.toString().isEmpty()) ? addSingleQuotes(entry.toString()): defaultValue; + + } + + private String addSingleQuotes(String s) { + if (null!=s && !s.isEmpty()) { + s = SystemProperties.SINGLE_QUOTE+s+SystemProperties.SINGLE_QUOTE; + } + return s; + } + + + /** + * This method prepares an Object array of arguments that would be passed + * to the MessageFormat.format() method, to format the security log. + * + * @param protocol + * @param set + * @param loginId + * @param accessingClient + * @param isSuccess + * @param message + * @return + */ + private Object[] prepareFormatArgs(String protocol,String set, + String loginId, String message) { + + Object[] messageFormatArgs = { + formatEntry(protocol, SystemProperties.NA), + formatEntry(set, SystemProperties.NA), + formatEntry(loginId, SystemProperties.UNKNOWN), + message + }; + return messageFormatArgs; + } + + + public String createMessage(Map logArgsMap) { + + Object[] securityMessageArgs = prepareFormatArgs( + logArgsMap.get(SystemProperties.PROTOCOL), + logArgsMap.get(SystemProperties.SECURIRY_EVENT_TYPE), + logArgsMap.get(SystemProperties.LOGIN_ID), + logArgsMap.get(SystemProperties.ADDITIONAL_INFO) + ); + + return MessageFormat.format(SystemProperties.SECURITY_LOG_TEMPLATE, securityMessageArgs); + } +} diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/logging/format/ErrorCodesEnum.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/logging/format/ErrorCodesEnum.java new file mode 100644 index 00000000..549d3262 --- /dev/null +++ b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/logging/format/ErrorCodesEnum.java @@ -0,0 +1,89 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.logging.format; + +import com.att.eelf.i18n.EELFResolvableErrorEnum; +//import com.att.eelf.i18n.EELFResourceManager; + +public enum ErrorCodesEnum implements EELFResolvableErrorEnum { + BERESTAPIAUTHENTICATIONERROR, + BEHTTPCONNECTIONERROR_ONE_ARGUMENT, + BEUEBAUTHENTICATIONERROR_ONE_ARGUMENT, + + INTERNALAUTHENTICATIONINFO_ONE_ARGUMENT, + INTERNALAUTHENTICATIONWARNING_ONE_ARGUMENT, + INTERNALAUTHENTICATIONERROR_ONE_ARGUMENT, + INTERNALAUTHENTICATIONFATAL_ONE_ARGUMENT, + + BEHEALTHCHECKRECOVERY, + BEHEALTHCHECKMYSQLRECOVERY, + BEHEALTHCHECKUEBCLUSTERRECOVERY, + FEHEALTHCHECKRECOVERY, + BeHEALTHCHECKERROR, + + BEHEALTHCHECKMYSQLERROR, + BEHEALTHCHECKUEBCLUSTERERROR, + FEHEALTHCHECKERROR, + BEUEBCONNECTIONERROR_ONE_ARGUMENT, + BEUEBUNKOWNHOSTERROR_ONE_ARGUMENT, + BEUEBREGISTERONBOARDINGAPPERROR, + + INTERNALCONNECTIONINFO_ONE_ARGUMENT, + INTERNALCONNECTIONWARNING_ONE_ARGUMENT, + INTERNALCONNECTIONERROR_ONE_ARGUMENT, + INTERNALCONNECTIONFATAL_ONE_ARGUMENT, + + BEUEBOBJECTNOTFOUNDERROR_ONE_ARGUMENT, + BEUSERMISSINGERROR_ONE_ARGUMENT, + + BEUSERINACTIVEWARNING_ONE_ARGUMENT, + BEUSERADMINPRIVILEGESINFO_ONE_ARGUMENT, + + BEINVALIDJSONINPUT, + BEINCORRECTHTTPSTATUSERROR, + + BEINITIALIZATIONERROR, + BEUEBSYSTEMERROR, + BEDAOSYSTEMERROR, + BESYSTEMERROR, + BEEXECUTEROLLBACKERROR, + + FEHTTPLOGGINGERROR, + FEPORTALSERVLETERROR, + BEDAOCLOSESESSIONERROR, + + BERESTAPIGENERALERROR, + FEHEALTHCHECKGENERALERROR, + + INTERNALUNEXPECTEDINFO_ONE_ARGUMENT, + INTERNALUNEXPECTEDWARNING_ONE_ARGUMENT, + INTERNALUNEXPECTEDERROR_ONE_ARGUMENT, + INTERNALUNEXPECTEDFATAL_ONE_ARGUMENT, + + ; + + /** + * Static initializer to ensure the resource bundles for this class are loaded... + * Here this application loads messages from three bundles + */ + //static { + // EELFResourceManager.loadMessageBundle("com/att/fusion/core/logging/format/ApplicationCodes"); + //} +} diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/logging/format/ErrorSeverityEnum.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/logging/format/ErrorSeverityEnum.java new file mode 100644 index 00000000..5908fda9 --- /dev/null +++ b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/logging/format/ErrorSeverityEnum.java @@ -0,0 +1,27 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.logging.format; + +public enum ErrorSeverityEnum { + INFO, + WARN, + ERROR, + FATAL, +} diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/logging/format/ErrorTypeEnum.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/logging/format/ErrorTypeEnum.java new file mode 100644 index 00000000..8ce2d4dc --- /dev/null +++ b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/logging/format/ErrorTypeEnum.java @@ -0,0 +1,29 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.logging.format; + +public enum ErrorTypeEnum { + RECOVERY, + CONFIG_ERROR, + SYSTEM_ERROR, + DATA_ERROR, + CONNECTION_PROBLEM, + AUTHENTICATION_PROBLEM +} -- cgit 1.2.3-korg