diff options
Diffstat (limited to 'adapters')
19 files changed, 112 insertions, 149 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java index 85abf9403c..14e5b80d2e 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java @@ -84,7 +84,7 @@ import org.onap.so.db.catalog.beans.CloudSite; import org.onap.so.db.catalog.beans.CloudifyManager; import org.onap.so.db.catalog.beans.HeatTemplateParam; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoAlarmLogger; + import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.exceptions.MsoAdapterException; import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound; @@ -298,7 +298,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{ MsoCloudifyException me = new MsoCloudifyException (0, "Workflow Execution Failed", installWorkflow.getError()); me.addContext (CREATE_DEPLOYMENT); - alarmLogger.sendAlarm(CLOUDIFY_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage()); + throw me; } } @@ -333,7 +333,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{ // Propagate the original exception from Stack Query. me.addContext (CREATE_DEPLOYMENT); - alarmLogger.sendAlarm(CLOUDIFY_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage()); + throw me; } } @@ -711,7 +711,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{ // leave the deployment in an indeterminate state, as cloud resources may still exist. MsoCloudifyException me = new MsoCloudifyException (0, "Uninstall Workflow Failed", uninstallWorkflow.getError()); me.addContext (DELETE_DEPLOYMENT); - alarmLogger.sendAlarm(CLOUDIFY_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage()); + throw me; } } @@ -719,7 +719,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{ // Uninstall workflow has failed. // Must fail the deletion... may leave the deployment in an inconclusive state me.addContext (DELETE_DEPLOYMENT); - alarmLogger.sendAlarm(CLOUDIFY_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage()); + throw me; } @@ -738,7 +738,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{ // deployment in Cloudify DB. MsoCloudifyException me = new MsoCloudifyException (0, "Deployment Delete Failed", ce.getMessage(), ce); me.addContext (DELETE_DEPLOYMENT); - alarmLogger.sendAlarm(CLOUDIFY_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage()); + throw me; } catch (CloudifyResponseException re) { @@ -746,14 +746,14 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{ // deployment in the Cloudify DB. MsoCloudifyException me = new MsoCloudifyException (re.getStatus(), re.getMessage(), re.getMessage(), re); me.addContext (DELETE_DEPLOYMENT); - alarmLogger.sendAlarm(CLOUDIFY_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage()); + throw me; } catch (Exception e) { // Catch-all MsoAdapterException ae = new MsoAdapterException (e.getMessage(), e); ae.addContext (DELETE_DEPLOYMENT); - alarmLogger.sendAlarm(CLOUDIFY_ERROR, MsoAlarmLogger.CRITICAL, ae.getContextMessage()); + throw ae; } @@ -1154,7 +1154,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{ // Generate an alarm for 5XX and higher errors. if (re.getStatus () >= 500) { - alarmLogger.sendAlarm (CLOUDIFY_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage ()); + } } else if (e instanceof CloudifyConnectException) { CloudifyConnectException ce = (CloudifyConnectException) e; @@ -1163,7 +1163,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{ me.addContext (context); // Generate an alarm for all connection errors. - alarmLogger.sendAlarm ("CloudifyIOError", MsoAlarmLogger.CRITICAL, me.getContextMessage ()); + LOGGER.error(MessageEnum.RA_CONNECTION_EXCEPTION, CLOUDIFY, "Cloudify connection error on " + context + ": " + e, CLOUDIFY, "", MsoLogger.ErrorCode.DataError, "Cloudify connection error on " + context); } diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java index da81da91ea..75b9fc94f6 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java @@ -29,7 +29,7 @@ import java.util.Map.Entry; import org.onap.so.config.beans.PoConfig; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoAlarmLogger; + import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.exceptions.MsoAdapterException; import org.onap.so.openstack.exceptions.MsoException; @@ -54,7 +54,7 @@ import com.woorea.openstack.quantum.model.NeutronError; public class MsoCommonUtils { private static MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, MsoCommonUtils.class); - protected static MsoAlarmLogger alarmLogger = new MsoAlarmLogger(); + @Autowired private PoConfig poConfig; @@ -166,7 +166,7 @@ public class MsoCommonUtils { // Generate an alarm for 5XX and higher errors. if (re.getStatus () >= 500) { - alarmLogger.sendAlarm ("KeystoneError", MsoAlarmLogger.CRITICAL, me.getContextMessage ()); + } } else if (e instanceof OpenStackConnectException) { OpenStackConnectException ce = (OpenStackConnectException) e; @@ -176,7 +176,7 @@ public class MsoCommonUtils { // Generate an alarm for all connection errors. logger.error(MessageEnum.RA_GENERAL_EXCEPTION_ARG, "Openstack Keystone connection error on " + context + ": " + e, "Openstack", "", MsoLogger.ErrorCode.DataError, "Openstack Keystone connection error on " + context); - alarmLogger.sendAlarm ("KeystoneIOError", MsoAlarmLogger.CRITICAL, me.getContextMessage ()); + } return me; @@ -213,7 +213,7 @@ public class MsoCommonUtils { // Generate an alarm for 5XX and higher errors. if (re.getStatus () >= 500) { - alarmLogger.sendAlarm ("HeatError", MsoAlarmLogger.CRITICAL, me.getContextMessage ()); + } } else if (e instanceof OpenStackConnectException) { OpenStackConnectException ce = (OpenStackConnectException) e; @@ -222,7 +222,7 @@ public class MsoCommonUtils { me.addContext (context); // Generate an alarm for all connection errors. - alarmLogger.sendAlarm ("HeatIOError", MsoAlarmLogger.CRITICAL, me.getContextMessage ()); + logger.error(MessageEnum.RA_CONNECTION_EXCEPTION, "OpenStack", "Openstack Heat connection error on " + context + ": " + e, "Openstack", "", MsoLogger.ErrorCode.DataError, "Openstack Heat connection error on " + context); } @@ -255,7 +255,7 @@ public class MsoCommonUtils { // Generate an alarm for 5XX and higher errors. if (re.getStatus () >= 500) { - alarmLogger.sendAlarm ("NeutronError", MsoAlarmLogger.CRITICAL, me.getContextMessage ()); + } } else if (e instanceof OpenStackConnectException) { OpenStackConnectException ce = (OpenStackConnectException) e; @@ -264,7 +264,7 @@ public class MsoCommonUtils { me.addContext (context); // Generate an alarm for all connection errors. - alarmLogger.sendAlarm ("NeutronIOError", MsoAlarmLogger.CRITICAL, me.getContextMessage ()); + logger.error(MessageEnum.RA_CONNECTION_EXCEPTION, "OpenStack", "Openstack Neutron Connection error on "+ context + ": " + e, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Openstack Neutron Connection error on "+ context); } @@ -284,7 +284,7 @@ public class MsoCommonUtils { // Always generate an alarm for internal exceptions logger.error(MessageEnum.RA_GENERAL_EXCEPTION_ARG, "An exception occured on "+ context + ": " + e, "OpenStack", "", MsoLogger.ErrorCode.DataError, "An exception occured on "+ context); - alarmLogger.sendAlarm ("AdapterInternalError", MsoAlarmLogger.CRITICAL, me.getContextMessage ()); + return me; } @@ -296,7 +296,7 @@ public class MsoCommonUtils { // Always generate an alarm for internal exceptions logger.error(MessageEnum.RA_GENERAL_EXCEPTION_ARG, "An exception occured on "+ context + ": " + e, "OpenStack", "", MsoLogger.ErrorCode.DataError, "An exception occured on "+ context); - alarmLogger.sendAlarm ("AdapterInternalError", MsoAlarmLogger.CRITICAL, me.getContextMessage ()); + return me; } diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java index d87330bfd4..1f9b6bd910 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java @@ -52,7 +52,7 @@ import org.onap.so.db.catalog.beans.HeatTemplate; import org.onap.so.db.catalog.beans.HeatTemplateParam; import org.onap.so.db.catalog.beans.ServerType; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoAlarmLogger; + import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.HeatCacheEntry; import org.onap.so.openstack.beans.HeatStatus; @@ -532,7 +532,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ } // MsoOpenstackException me = new MsoOpenstackException(0, "", stackErrorStatusReason.toString()); // me.addContext(CREATE_STACK); - // alarmLogger.sendAlarm(HEAT_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage()); + // throw me; } catch (Exception e2) { // shouldn't happen - but handle @@ -541,7 +541,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ } MsoOpenstackException me = new MsoOpenstackException(0, "", stackErrorStatusReason.toString()); me.addContext(CREATE_STACK); - alarmLogger.sendAlarm(HEAT_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage()); + throw me; } @@ -716,7 +716,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ me.addContext (DELETE_STACK); // Alarm this condition, stack deletion failed - alarmLogger.sendAlarm (HEAT_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage ()); + throw me; } @@ -729,7 +729,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ me.addContext (DELETE_STACK); // Alarm this condition, stack deletion failed - alarmLogger.sendAlarm (HEAT_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage ()); + throw me; } @@ -938,7 +938,6 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ } catch (RuntimeException e) { // This comes back for not found (probably an incorrect region ID) String error = "AIC did not match an orchestration service for: region=" + region + ",cloud=" + cloudIdentity.getIdentityUrl(); - alarmLogger.sendAlarm ("MsoConfigurationError", MsoAlarmLogger.CRITICAL, error); throw new MsoAdapterException (error, e); } tokenId = access.getToken ().getId (); @@ -952,7 +951,6 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ } catch (ServiceEndpointNotFoundException e) { // This comes back for not found (probably an incorrect region ID) String error = "cloud did not match an orchestration service for: region=" + region + ",cloud=" + cloudIdentity.getIdentityUrl(); - alarmLogger.sendAlarm ("MsoConfigurationError", MsoAlarmLogger.CRITICAL, error); throw new MsoAdapterException (error, e); } } @@ -960,7 +958,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ if (e.getStatus () == 401) { // Authentication error. String error = "Authentication Failure: tenant=" + tenantId + ",cloud=" + cloudIdentity.getId (); - alarmLogger.sendAlarm ("MsoAuthenticationError", MsoAlarmLogger.CRITICAL, error); + throw new MsoAdapterException (error); } else { throw keystoneErrorToMsoException (e, TOKEN_AUTH); @@ -974,6 +972,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ // Catch-all throw runtimeExceptionToMsoException (e, TOKEN_AUTH); } + Heat heatClient = new Heat (heatUrl); heatClient.token (tokenId); diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java index 8c5840074f..3936ae6496 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java @@ -31,7 +31,7 @@ import org.onap.so.db.catalog.beans.CloudIdentity; import org.onap.so.db.catalog.beans.CloudSite; import org.onap.so.cloud.authentication.AuthenticationMethodFactory; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoAlarmLogger; + import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.MsoTenant; import org.onap.so.openstack.exceptions.MsoAdapterException; @@ -435,7 +435,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils { if (e.getStatus () == 401) { // Authentication error. Can't access admin tenant - something is mis-configured String error = "MSO Authentication Failed for " + cloudIdentity.getId (); - alarmLogger.sendAlarm ("MsoAuthenticationError", MsoAlarmLogger.CRITICAL, error); + throw new MsoAdapterException (error); } else { throw keystoneErrorToMsoException (e, "TokenAuth"); @@ -453,7 +453,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils { adminUrl = adminUrl.replaceFirst("5000", "35357"); } catch (RuntimeException e) { String error = "Identity service not found: region=" + region + ",cloud=" + cloudIdentity.getId (); - alarmLogger.sendAlarm ("MsoConfigurationError", MsoAlarmLogger.CRITICAL, error); + LOGGER.error(MessageEnum.IDENTITY_SERVICE_NOT_FOUND, region, cloudIdentity.getId(), "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception in findEndpointURL"); throw new MsoAdapterException (error, e); } diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java index 8f71af4dfe..829f6c1445 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java @@ -52,7 +52,6 @@ import org.onap.so.client.HttpClient; import org.onap.so.client.RestClient; import org.onap.so.db.catalog.beans.CloudSite; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoAlarmLogger; import org.onap.so.logger.MsoLogger; import org.onap.so.utils.TargetEntity; import org.springframework.beans.factory.annotation.Autowired; @@ -519,7 +518,6 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{ } MsoOpenstackException me = new MsoOpenstackException(0, "", stackErrorStatusReason.toString()); me.addContext(CREATE_STACK); - alarmLogger.sendAlarm(HEAT_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage()); throw me; } } else { diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java index b7676e0041..7b82ad62ff 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java @@ -36,7 +36,7 @@ import org.onap.so.db.catalog.beans.CloudIdentity; import org.onap.so.db.catalog.beans.CloudSite; import org.onap.so.db.catalog.beans.ServerType; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoAlarmLogger; + import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.NetworkInfo; import org.onap.so.openstack.beans.NeutronCacheEntry; @@ -408,7 +408,6 @@ public class MsoNeutronUtils extends MsoCommonUtils } catch (RuntimeException e) { // This comes back for not found (probably an incorrect region ID) String error = "Network service not found: region=" + region + ",cloud=" + cloudIdentity.getId(); - alarmLogger.sendAlarm("MsoConfigurationError", MsoAlarmLogger.CRITICAL, error); throw new MsoAdapterException (error, e); } tokenId = access.getToken().getId(); @@ -425,7 +424,6 @@ public class MsoNeutronUtils extends MsoCommonUtils } catch (ServiceEndpointNotFoundException e) { // This comes back for not found (probably an incorrect region ID) String error = "Network service not found: region=" + region + ",cloud=" + cloudIdentity.getId(); - alarmLogger.sendAlarm("MsoConfigurationError", MsoAlarmLogger.CRITICAL, error); throw new MsoAdapterException (error, e); } } @@ -434,7 +432,7 @@ public class MsoNeutronUtils extends MsoCommonUtils if (e.getStatus() == 401) { // Authentication error. String error = "Authentication Failure: tenant=" + tenantId + ",cloud=" + cloudIdentity.getId(); - alarmLogger .sendAlarm("MsoAuthenticationError", MsoAlarmLogger.CRITICAL, error); + throw new MsoAdapterException(error); } else { @@ -453,6 +451,7 @@ public class MsoNeutronUtils extends MsoCommonUtils MsoException me = runtimeExceptionToMsoException(e, "TokenAuth"); throw me; } + Quantum neutronClient = new Quantum(neutronUrl); neutronClient.token(tokenId); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java index 6578912b9a..608f39adb4 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java @@ -48,7 +48,7 @@ import org.onap.so.adapters.network.async.client.UpdateNetworkNotification; import org.onap.so.adapters.network.exceptions.NetworkException; import org.onap.so.entity.MsoRequest; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoAlarmLogger; + import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.NetworkRollback; import org.onap.so.openstack.beans.NetworkStatus; @@ -63,7 +63,7 @@ import org.springframework.stereotype.Component; public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,MsoNetworkAdapterAsyncImpl.class); - private static final MsoAlarmLogger alarmLogger = new MsoAlarmLogger (); + private static final String BPEL_AUTH_PROP = "org.onap.so.adapters.network.bpelauth"; private static final String ENCRYPTION_KEY_PROP = "org.onap.so.adapters.network.encryptionKey"; private static final String NETWORK_EXCEPTION_MSG="Got a NetworkException on createNetwork: "; @@ -179,7 +179,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { } catch (Exception e1) { error = CREATE_NETWORK_ERROR_MSG + e1.getMessage (); LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError,CREATE_NETWORK_EXCEPTON_MSG, e1); - alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error); + } return; } @@ -198,7 +198,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { } catch (Exception e) { error = CREATE_NETWORK_ERROR_MSG + e.getMessage (); LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, CREATE_NETWORK_EXCEPTON_MSG, e); - alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error); + } return; } @@ -294,7 +294,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { } catch (Exception e1) { error = "Error sending updateNetwork notification " + e1.getMessage (); LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending updateNetwork notification", e1); - alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error); + } return; } @@ -311,7 +311,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { } catch (Exception e) { error = "Error sending updateNotification request" + e.getMessage (); LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending updateNotification request", e); - alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error); + } return; } @@ -376,9 +376,9 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl); notifyPort.queryNetworkNotification (messageId, false, exCat, eMsg, null, null, null, null, null, null); } catch (Exception e1) { - error = CREATE_NETWORK_ERROR_MSG + e1.getMessage (); - LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, CREATE_NETWORK_EXCEPTON_MSG, e1); - alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error); + error = "Error sending createNetwork notification " + e1.getMessage (); + LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending createNetwork notification", e1); + } return; } @@ -398,9 +398,9 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { vlans.value, copyQuerySubnetIdMap (subnetIdMap)); } catch (Exception e) { - error = CREATE_NETWORK_ERROR_MSG + e.getMessage (); - LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, CREATE_NETWORK_EXCEPTON_MSG, e); - alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error); + error = "Error sending createNetwork notification " + e.getMessage (); + LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending createNetwork notification", e); + } return; } @@ -463,9 +463,9 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl); notifyPort.deleteNetworkNotification (messageId, false, exCat, eMsg, null); } catch (Exception e1) { - error = CREATE_NETWORK_ERROR_MSG + e1.getMessage (); - LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, CREATE_NETWORK_EXCEPTON_MSG, e1); - alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error); + error = "Error sending createNetwork notification " + e1.getMessage (); + LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending createNetwork notification", e1); + } return; } @@ -477,7 +477,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { } catch (Exception e) { error = "Error sending deleteNetwork notification " + e.getMessage (); LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending deleteNetwork notification", e); - alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error); + } return; } @@ -529,7 +529,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { } catch (Exception e1) { error = CREATE_NETWORK_ERROR_MSG + e1.getMessage (); LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception in sending createNetwork notification ", e1); - alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error); + } return; } @@ -541,7 +541,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { } catch (Exception e) { error = "Error sending rollbackNetwork notification " + e.getMessage (); LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception in sending rollbackNetwork notification", e); - alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error); + } return; } @@ -627,7 +627,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { } catch (Exception e) { String error1 = "Unable to set authorization in callback request" + e.getMessage (); LOGGER.error (MessageEnum.RA_SET_CALLBACK_AUTH_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception - Unable to set authorization in callback request", e); - alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error1); + } return notifyPort; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java index 4b6bd09144..45285d0e51 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java @@ -49,7 +49,7 @@ import org.onap.so.db.catalog.data.repository.NetworkResourceRepository; import org.onap.so.db.catalog.utils.MavenLikeVersioning; import org.onap.so.entity.MsoRequest; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoAlarmLogger; + import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.HeatStatus; import org.onap.so.openstack.beans.NetworkInfo; @@ -92,7 +92,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { private static final String NEUTRON_MODE = "NEUTRON"; private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,MsoNetworkAdapterImpl.class); - private static final MsoAlarmLogger alarmLogger = new MsoAlarmLogger (); + @Autowired private CloudConfig cloudConfig; @Autowired @@ -404,10 +404,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { if (heatTemplate == null) { String error = "Network error - undefined Heat Template. Network Type = " + networkType; LOGGER.error (MessageEnum.RA_PARAM_NOT_FOUND, "Heat Template", "Network Type", networkType, "Openstack", "", MsoLogger.ErrorCode.DataError, "Network error - undefined Heat Template. Network Type = " + networkType); - alarmLogger.sendAlarm (MSO_CONFIGURATION_ERROR, MsoAlarmLogger.CRITICAL, error); // Alarm on this - // error, - // configuration - // must be fixed LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error); throw new NetworkException (error, MsoExceptionCategory.INTERNAL); } @@ -514,10 +510,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } catch (IllegalArgumentException e) { String error = "Create Network: Configuration Error: " + e.getMessage (); LOGGER.error (MessageEnum.RA_CONFIG_EXC, e.getMessage(), "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception - Create Network, Configuration Error", e); - alarmLogger.sendAlarm (MSO_CONFIGURATION_ERROR, MsoAlarmLogger.CRITICAL, error); // Alarm on this - // error, - // configuration - // must be fixed LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError, error); // Input parameters were not valid throw new NetworkException (error, MsoExceptionCategory.INTERNAL); @@ -953,7 +945,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { if (heatTemplate == null) { String error = "Network error - undefined Heat Template. Network Type=" + networkType; LOGGER.error(MessageEnum.RA_PARAM_NOT_FOUND, "Heat Template", "Network Type", networkType, "OpenStack", "getHeatTemplate", MsoLogger.ErrorCode.DataError, "Network error - undefined Heat Template. Network Type=" + networkType); - alarmLogger.sendAlarm(MSO_CONFIGURATION_ERROR, MsoAlarmLogger.CRITICAL, error); + LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, error); throw new NetworkException(error, MsoExceptionCategory.INTERNAL); } @@ -989,7 +981,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } catch (IllegalArgumentException e) { String error = "UpdateNetwork: Configuration Error: Network Type=" + networkType; LOGGER.error(MessageEnum.RA_CONFIG_EXC, "Network Type=" + networkType, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Exception - UpdateNetwork: Configuration Error"); - alarmLogger.sendAlarm(MSO_CONFIGURATION_ERROR, MsoAlarmLogger.CRITICAL, error); + LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, error); throw new NetworkException(error, MsoExceptionCategory.INTERNAL, e); } @@ -1177,10 +1169,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { LOGGER.error(MessageEnum.RA_NETWORK_ORCHE_MODE_NOT_SUPPORT, mode, "OpenStack", "", MsoLogger.ErrorCode.DataError, "CreateNetwork: Configuration Error"); - // Alarm on this error, configuration must be fixed - alarmLogger.sendAlarm(MSO_CONFIGURATION_ERROR, - MsoAlarmLogger.CRITICAL, error); - throw new NetworkException(error, MsoExceptionCategory.INTERNAL); } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java index bd0dc378d2..21b7ea4142 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java @@ -45,7 +45,7 @@ import org.onap.so.adapters.vnf.async.client.VnfAdapterNotify_Service; import org.onap.so.adapters.vnf.exceptions.VnfException; import org.onap.so.entity.MsoRequest; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoAlarmLogger; + import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.VnfRollback; import org.onap.so.openstack.beans.VnfStatus; @@ -60,7 +60,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { public static final String MSO_PROP_VNF_ADAPTER="MSO_PROP_VNF_ADAPTER"; private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, MsoVnfAdapterAsyncImpl.class); - private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger (); + private static final String BPEL_AUTH_PROP = "org.onap.so.adapters.vnf.bpelauth"; private static final String ENCRYPTION_KEY_PROP = "org.onap.so.adapters.network.encryptionKey"; @@ -181,7 +181,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { } catch (Exception e1) { error = "Error sending createVnf notification " + e1.getMessage (); LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "createVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending createVnf notification", e1); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + } LOGGER.info (MessageEnum.RA_ASYNC_CREATE_VNF_COMPLETE, "", "createVnfA", ""); return; @@ -200,7 +200,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { } catch (Exception e) { error = "Error sending createVnf notification " + e.getMessage (); LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "createVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending createVnf notification", e); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + } LOGGER.info (MessageEnum.RA_ASYNC_CREATE_VNF_COMPLETE, "", "","createVnfA"); return; @@ -255,7 +255,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { } catch (Exception e1) { error = "Error sending updateVnf notification " + e1.getMessage (); LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "UpdateVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending updateVnf notification", e1); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + } LOGGER.info (MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE,"","","UpdateVnfA"); return; @@ -273,7 +273,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { } catch (Exception e) { error = "Error sending updateVnf notification " + e.getMessage (); LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "UpdateVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending updateVnf notification", e); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + } LOGGER.info (MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE, "", "","UpdateVnfA"); return; @@ -337,7 +337,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { } catch (Exception e1) { error = "Error sending queryVnf notification " + e1.getMessage (); LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "queryVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending queryVnf notification", e1); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + } LOGGER.info (MessageEnum.RA_ASYNC_QUERY_VNF_COMPLETE, "","", "queryVnfA"); return; @@ -363,7 +363,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { } catch (Exception e) { error = "Error sending queryVnf notification " + e.getMessage (); LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "queryVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending queryVnf notification", e); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + } LOGGER.info (MessageEnum.RA_ASYNC_QUERY_VNF_COMPLETE, "","", "queryVnfA"); @@ -421,7 +421,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { } catch (Exception e1) { error = "Error sending deleteVnf notification " + e1.getMessage (); LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "deleteVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending deleteVnfA notification", e1); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + } LOGGER.info (MessageEnum.RA_ASYNC_DELETE_VNF_COMPLETE, "","", "deleteVnfA"); return; @@ -436,7 +436,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { } catch (Exception e) { error = "Error sending deleteVnf notification " + e.getMessage (); LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "deleteVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending deleteVnfA notification", e); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + } LOGGER.info (MessageEnum.RA_ASYNC_DELETE_VNF_COMPLETE, "", "","deleteVnfA"); @@ -458,7 +458,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { if (rollback == null) { error = "Empty Rollback: No action to perform"; LOGGER.info (MessageEnum.RA_ROLLBACK_NULL, "","", "rollbackVnfA"); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + return; } @@ -491,7 +491,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { } catch (Exception e1) { error = "Error sending rollbackVnf notification " + e1.getMessage (); LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "rollbackVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending rollbackVnfA notification", e1); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + } LOGGER.info (MessageEnum.RA_ASYNC_ROLLBACK_VNF_COMPLETE, "","", "rollbackVnfA"); return; @@ -505,7 +505,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { } catch (Exception e) { error = "Error sending rollbackVnf notification " + e.getMessage (); LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "rollbackVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending rollbackVnfA notification", e); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + } LOGGER.info (MessageEnum.RA_ASYNC_ROLLBACK_VNF_COMPLETE, "", "","rollbackVnfA"); @@ -647,7 +647,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { headers.put ("Authorization", Collections.singletonList (basicAuth)); } catch (Exception e) { LOGGER.error (MessageEnum.RA_SET_CALLBACK_AUTH_EXC, "", "getNotifyEP", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - Unable to set authorization in callback request", e); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, "Unable to set authorization in callback request"); + } return notifyPort; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java index 19a41ad7a8..092cefe5f5 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java @@ -52,7 +52,7 @@ import org.onap.so.db.catalog.data.repository.VnfResourceRepository; import org.onap.so.db.catalog.utils.MavenLikeVersioning; import org.onap.so.entity.MsoRequest; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoAlarmLogger; + import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.HeatStatus; import org.onap.so.openstack.beans.StackInfo; @@ -96,7 +96,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { private static final String MSO_CONFIGURATION_ERROR = "MsoConfigurationError"; private static final String VNF_ADAPTER_SERVICE_NAME = "MSO-BPMN:MSO-VnfAdapter."; private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,MsoVnfAdapterImpl.class); - private static final MsoAlarmLogger alarmLogger = new MsoAlarmLogger (); + private static final String CHECK_REQD_PARAMS = "org.onap.so.adapters.vnf.checkRequiredParameters"; private static final String ADD_GET_FILES_ON_VOLUME_REQ = "org.onap.so.adapters.vnf.addGetFilesOnVolumeReq"; private static final ObjectMapper JSON_MAPPER = new ObjectMapper(); @@ -932,9 +932,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { if (heatTemplate == null) { String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType + ", reqType=" + requestTypeString; LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Template ID", vfModuleType, "OpenStack", "", MsoLogger.ErrorCode.DataError, error); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error); - alarmLogger.sendAlarm(MSO_CONFIGURATION_ERROR, - MsoAlarmLogger.CRITICAL, error); + LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error); throw new VnfException(error, MsoExceptionCategory.INTERNAL); } else { LOGGER.debug ("Got HEAT Template from DB: " + heatTemplate.getHeatTemplate()); @@ -948,9 +946,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType; LOGGER.error (MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Environment ID", "OpenStack", "", MsoLogger.ErrorCode.DataError, error); LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error); - // Alarm on this error, configuration must be fixed - alarmLogger.sendAlarm (MSO_CONFIGURATION_ERROR, MsoAlarmLogger.CRITICAL, error); - throw new VnfException (error, MsoExceptionCategory.INTERNAL); } else { LOGGER.debug ("Got Heat Environment from DB: " + heatEnvironment.getEnvironment()); @@ -1661,8 +1656,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType + ", reqType=" + requestTypeString; LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Template ID", vfModuleType, "OpenStack", "", MsoLogger.ErrorCode.DataError, error); LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error); - alarmLogger.sendAlarm(MSO_CONFIGURATION_ERROR, - MsoAlarmLogger.CRITICAL, error); throw new VnfException(error, MsoExceptionCategory.INTERNAL); } else { LOGGER.debug ("Got HEAT Template from DB: " + heatTemplate.getHeatTemplate()); @@ -1672,9 +1665,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType; LOGGER.error (MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Environment ID", "OpenStack", "", MsoLogger.ErrorCode.DataError, error); LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error); - // Alarm on this error, configuration must be fixed - alarmLogger.sendAlarm (MSO_CONFIGURATION_ERROR, MsoAlarmLogger.CRITICAL, error); - throw new VnfException (error, MsoExceptionCategory.INTERNAL); } else { LOGGER.debug ("Got Heat Environment from DB: " + heatEnvironment.getEnvironment()); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java index 41da3c2988..00e72373dd 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java @@ -52,7 +52,7 @@ import org.onap.so.db.catalog.data.repository.VFModuleCustomizationRepository; import org.onap.so.db.catalog.utils.MavenLikeVersioning; import org.onap.so.entity.MsoRequest; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoAlarmLogger; + import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.MsoTenant; import org.onap.so.openstack.beans.VnfRollback; @@ -81,7 +81,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { private static final String VNF_ADAPTER_SERVICE_NAME = "MSO-BPMN:MSO-VnfAdapter."; private static final String LOG_REPLY_NAME = "MSO-VnfAdapter:MSO-BPMN."; private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, MsoVnfCloudifyAdapterImpl.class); - private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger (); + private static final String CHECK_REQD_PARAMS = "org.onap.so.adapters.vnf.checkRequiredParameters"; private static final String ADD_GET_FILES_ON_VOLUME_REQ = "org.onap.so.adapters.vnf.addGetFilesOnVolumeReq"; private static final String CLOUDIFY_RESPONSE_SUCCESS="Successfully received response from Cloudify"; @@ -873,9 +873,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { if (heatTemplate == null) { String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType + ", reqType=" + requestType; LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Template ID", vfModuleType, "OpenStack", "", MsoLogger.ErrorCode.DataError, error); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error); - alarmLogger.sendAlarm(MSO_CONFIGURATION_ERROR, - MsoAlarmLogger.CRITICAL, error); + LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error); throw new VnfException(error, MsoExceptionCategory.INTERNAL); } else { LOGGER.debug ("Got HEAT Template from DB: " + heatTemplate.getHeatTemplate()); @@ -886,7 +884,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { LOGGER.error (MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Environment ID", "OpenStack", "", MsoLogger.ErrorCode.DataError, error); LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error); // Alarm on this error, configuration must be fixed - alarmLogger.sendAlarm (MSO_CONFIGURATION_ERROR, MsoAlarmLogger.CRITICAL, error); + throw new VnfException (error, MsoExceptionCategory.INTERNAL); } else { diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java index 269acb9d6f..e0d7581dcf 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java @@ -71,7 +71,7 @@ import org.onap.so.db.catalog.data.repository.VFModuleCustomizationRepository; import org.onap.so.db.catalog.utils.MavenLikeVersioning; import org.onap.so.entity.MsoRequest; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoAlarmLogger; + import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.VnfRollback; import org.onap.so.openstack.beans.VnfStatus; @@ -98,7 +98,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { private static final String MSO_CONFIGURATION_ERROR = "MsoConfigurationError"; private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, MsoVnfPluginAdapterImpl.class); - private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger (); + private static final String CHECK_REQD_PARAMS = "org.onap.so.adapters.vnf.checkRequiredParameters"; private static final ObjectMapper JSON_MAPPER = new ObjectMapper(); @@ -919,9 +919,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { if (heatTemplate == null) { String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType + ", reqType=" + requestType; LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Template ID", vfModuleType, "VNF", "", MsoLogger.ErrorCode.DataError, error); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error); - alarmLogger.sendAlarm(MSO_CONFIGURATION_ERROR, - MsoAlarmLogger.CRITICAL, error); + LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error); throw new VnfException(error, MsoExceptionCategory.INTERNAL); } else { LOGGER.debug ("Got HEAT Template from DB: " + heatTemplate.getHeatTemplate()); @@ -931,9 +929,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType; LOGGER.error (MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Environment ID", "OpenStack", "", MsoLogger.ErrorCode.DataError, error); LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error); - // Alarm on this error, configuration must be fixed - alarmLogger.sendAlarm (MSO_CONFIGURATION_ERROR, MsoAlarmLogger.CRITICAL, error); - throw new VnfException (error, MsoExceptionCategory.INTERNAL); } else { LOGGER.debug ("Got Heat Environment from DB: " + heatEnvironment.getEnvironment()); diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java index a0e3a17496..4a6ac9f5e2 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java @@ -28,7 +28,7 @@ import org.onap.so.adapters.sdnc.SDNCAdapterPortType; import org.onap.so.adapters.sdnc.SDNCAdapterRequest; import org.onap.so.adapters.sdnc.SDNCAdapterResponse; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoAlarmLogger; + import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -41,7 +41,7 @@ public class SDNCAdapterPortTypeImpl implements SDNCAdapterPortType { private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,SDNCAdapterPortTypeImpl.class); - private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger(); + @Autowired private SDNCRestClient sdncClient; @@ -71,7 +71,7 @@ public class SDNCAdapterPortTypeImpl implements SDNCAdapterPortType { catch (Exception e){ String respMsg = "Error sending request to SDNC. Failed to start SDNC Client thread " + e.getMessage(); msoLogger.error(MessageEnum.RA_SEND_REQUEST_SDNC_ERR, "SDNC", "", MsoLogger.ErrorCode.DataError, respMsg, e); - alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, respMsg); + SDNCResponse sdncResp = new SDNCResponse(bpelReqId); sdncResp.setRespCode(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); sdncResp.setRespMsg(respMsg); diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java index fd924cad79..4b3181e6e9 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java @@ -52,7 +52,7 @@ import org.onap.so.adapters.sdnc.client.SDNCAdapterCallbackRequest; import org.onap.so.adapters.sdnc.client.SDNCCallbackAdapterPortType; import org.onap.so.adapters.sdnc.client.SDNCCallbackAdapterService; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoAlarmLogger; + import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; @@ -74,7 +74,7 @@ public class SDNCRestClient{ private MapRequestTunables tunablesMapper; private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,SDNCRestClient.class); - private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger(); + private static final String EXCEPTION_MSG="Exception while evaluate xpath"; private static final String MSO_INTERNAL_ERROR="MsoInternalError"; private static final String CAMUNDA="Camunda"; @@ -257,7 +257,7 @@ public class SDNCRestClient{ sdncResp.setRespMsg(respMsg); msoLogger.error(MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC, "SDNC", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with SDNC", e); - alarmLogger.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, respMsg); + return sdncResp; } finally @@ -287,7 +287,7 @@ public class SDNCRestClient{ } catch (MalformedURLException e1) { error = "Caught exception initializing Callback wsdl " + e1.getMessage(); msoLogger.error(MessageEnum.RA_INIT_CALLBACK_WSDL_ERR, CAMUNDA, "", MsoLogger.ErrorCode.DataError, "Exception initializing Callback wsdl", e1); - alarmLogger.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, error); + } SDNCCallbackAdapterService cbSvc = new SDNCCallbackAdapterService(); @@ -317,7 +317,7 @@ public class SDNCRestClient{ catch (Exception e2) { error = "Unable to set authorization in callback request " + e2.getMessage(); msoLogger.error(MessageEnum.RA_SET_CALLBACK_AUTH_EXC, CAMUNDA, "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - Unable to set authorization in callback request", e2); - alarmLogger.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, error); + } msoLogger.debug("Invoking Bpel Callback. BpelCallbackUrl:" + bpelUrl); @@ -328,7 +328,7 @@ public class SDNCRestClient{ { error = "Error sending BpelCallback request" + e.getMessage(); msoLogger.error("Error " + MsoLogger.ErrorCode.BusinessProcesssError + " - " + MessageEnum.RA_CALLBACK_BPEL_EXC + " - " + error, e); - alarmLogger.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, error); + } msoLogger.info(MessageEnum.RA_CALLBACK_BPEL_COMPLETE.name(), CAMUNDA, ""); return; diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java index 9c4dd5e8a0..aaf6cc7d70 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java @@ -35,7 +35,7 @@ import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.util.EntityUtils; import org.onap.so.adapters.sdnc.impl.Constants; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoAlarmLogger; + import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -48,7 +48,7 @@ import org.springframework.core.env.Environment; @Component public class BPRestCallback { private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,BPRestCallback.class); - private static final MsoAlarmLogger ALARMLOGGER = new MsoAlarmLogger(); + private static final String CAMUNDA="Camunda"; private static final String MSO_INTERNAL_ERROR="MsoInternalError"; @Autowired @@ -125,9 +125,7 @@ public class BPRestCallback { method.setHeader("Authorization", authorization); } catch (Exception e) { LOGGER.error(MessageEnum.RA_SET_CALLBACK_AUTH_EXC, CAMUNDA, "", MsoLogger.ErrorCode.BusinessProcesssError, - "Unable to set authorization in callback request", e); - ALARMLOGGER.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, - "Unable to set authorization in callback request: " + e.getMessage()); + "Unable to set authorization in callback request", e); error = true; } @@ -144,15 +142,13 @@ public class BPRestCallback { if (httpResponse.getStatusLine().getStatusCode() >= 300) { String msg = "Received error response to callback request: " + httpResponse.getStatusLine(); LOGGER.error(MessageEnum.RA_CALLBACK_BPEL_EXC, CAMUNDA, "", MsoLogger.ErrorCode.BusinessProcesssError, msg); - ALARMLOGGER.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, msg); + } } return true; } catch (Exception e) { LOGGER.error(MessageEnum.RA_CALLBACK_BPEL_EXC, CAMUNDA, "", MsoLogger.ErrorCode.BusinessProcesssError, - "Error sending callback request", e); - ALARMLOGGER.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, - "Error sending callback request: " + e.getMessage()); + "Error sending callback request", e); return false; } finally { if (httpResponse != null) { diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java index da00a6fafa..6f40ba07a9 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java @@ -25,7 +25,7 @@ package org.onap.so.adapters.sdnc.sdncrest; import org.onap.so.adapters.sdnc.exception.SDNCAdapterException; import org.onap.so.adapters.sdnc.impl.Constants; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoAlarmLogger; + import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; @@ -36,7 +36,7 @@ public class MapTypedRequestTunablesData { private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,MapTypedRequestTunablesData.class); - private static final MsoAlarmLogger alarmLogger = new MsoAlarmLogger(); + private static final String MISSING_CONFIGURATION_ERROR_MSG= "Missing configuration for: "; private static final String MISSING_CONFIG_PARAM_ERROR_MSG="Missing config param"; @@ -55,7 +55,7 @@ public class MapTypedRequestTunablesData { if ("".equals(value)) { error= MISSING_CONFIGURATION_ERROR_MSG + reqTunable.getKey(); msoLogger.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, reqTunable.getKey(), "SDNC", "", MsoLogger.ErrorCode.DataError, MISSING_CONFIG_PARAM_ERROR_MSG); - alarmLogger.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, reqTunable.getError()); + throw new SDNCAdapterException(error); } @@ -64,7 +64,7 @@ public class MapTypedRequestTunablesData { if (parts.length != 5) { error="Invalid configuration for: " + reqTunable.getKey(); msoLogger.error(MessageEnum.RA_SDNC_INVALID_CONFIG, reqTunable.getKey(), value, "SDNC", "", MsoLogger.ErrorCode.DataError, "Invalid config"); - alarmLogger.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, reqTunable.getError()); + throw new SDNCAdapterException(error); } @@ -80,7 +80,7 @@ public class MapTypedRequestTunablesData { if ("".equals(reqTunable.getSdncUrl())) { error=MISSING_CONFIGURATION_ERROR_MSG + urlPropKey; msoLogger.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, urlPropKey, "SDNC", "", MsoLogger.ErrorCode.DataError, MISSING_CONFIG_PARAM_ERROR_MSG); - alarmLogger.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, reqTunable.getError()); + throw new SDNCAdapterException(error); } @@ -98,7 +98,7 @@ public class MapTypedRequestTunablesData { error=MISSING_CONFIGURATION_ERROR_MSG + Constants.MY_URL_PROP; msoLogger.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, Constants.MY_URL_PROP, "SDNC", "", MsoLogger.ErrorCode.DataError, MISSING_CONFIG_PARAM_ERROR_MSG); - alarmLogger.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, reqTunable.getError()); + throw new SDNCAdapterException(error); } diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java index 1c5025a59d..3ecf6337cf 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java @@ -52,7 +52,7 @@ import org.onap.so.adapters.sdnc.impl.Constants; import org.onap.so.adapters.sdncrest.SDNCErrorCommon; import org.onap.so.adapters.sdncrest.SDNCResponseCommon; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoAlarmLogger; + import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -69,7 +69,7 @@ import org.springframework.core.env.Environment; @Component public abstract class SDNCConnector { private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,SDNCConnector.class); - private static final MsoAlarmLogger ALARMLOGGER = new MsoAlarmLogger(); + private static final String MSO_INTERNAL_ERROR="MsoInternalError"; private static final String XPATH_EXCEPTION="XPath Exception"; @Autowired @@ -149,7 +149,7 @@ public abstract class SDNCConnector { } logError(errMsg); - ALARMLOGGER.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, errMsg); + return createErrorResponse(statusCode, errMsg, rt); } @@ -199,13 +199,13 @@ public abstract class SDNCConnector { protected void logError(String errMsg) { LOGGER.error(MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC, "SDNC", "", MsoLogger.ErrorCode.AvailabilityError, errMsg); - ALARMLOGGER.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, errMsg); + } protected void logError(String errMsg, Throwable t) { LOGGER.error(MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC, "SDNC", "", MsoLogger.ErrorCode.AvailabilityError, errMsg, t); - ALARMLOGGER.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, errMsg); + } /** diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java index 4c85241f9a..48bc2d84bb 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java @@ -33,7 +33,7 @@ import javax.ws.rs.core.Response; import org.onap.so.adapters.sdnc.impl.Constants; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoAlarmLogger; + import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; @@ -48,7 +48,7 @@ import org.springframework.stereotype.Component; @Component public class SNIROResponse { private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,SNIROResponse.class); - private static final MsoAlarmLogger ALARMLOGGER = new MsoAlarmLogger(); + @Autowired private Environment env; @@ -71,7 +71,7 @@ public class SNIROResponse { String error = "Missing configuration for: " + Constants.BPEL_REST_URL_PROP; LOGGER.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, Constants.BPEL_REST_URL_PROP, "SDNC", "", MsoLogger.ErrorCode.DataError, "Missing config param"); - ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + return Response.status(HttpServletResponse.SC_BAD_REQUEST).entity(error).build(); } diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java index 0536dd3560..1db9d9546d 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java @@ -43,7 +43,7 @@ import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.util.EntityUtils; import org.onap.so.adapters.vfc.model.RestfulResponse; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoAlarmLogger; + import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; @@ -66,7 +66,7 @@ public class RestfulUtil { */ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, RestfulUtil.class); - private static final MsoAlarmLogger ALARMLOGGER = new MsoAlarmLogger(); + private static final int DEFAULT_TIME_OUT = 60000; @@ -201,12 +201,12 @@ public class RestfulUtil { private static void logError(String errMsg, Throwable t) { LOGGER.error(MessageEnum.RA_NS_EXC, VFC_ADAPTER, "", MsoLogger.ErrorCode.AvailabilityError, errMsg, t); - ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, errMsg); + } private static void logError(String errMsg) { LOGGER.error(MessageEnum.RA_NS_EXC, VFC_ADAPTER, "", MsoLogger.ErrorCode.AvailabilityError, errMsg); - ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, errMsg); + } private static RestfulResponse createResponse(int statusCode, String content) { |