diff options
author | r.bogacki <r.bogacki@samsung.com> | 2019-03-14 15:24:57 +0100 |
---|---|---|
committer | r.bogacki <r.bogacki@samsung.com> | 2019-03-18 11:02:58 +0100 |
commit | faa0b29e3b7b1fa23a1444a5d9ac020b3c60dedc (patch) | |
tree | 4839f982eb10e66e587b55b757ffc00dd5f9d30f | |
parent | 4ca3abdffa40e7777a233151f66ee0b4131ed538 (diff) |
Removed MsoLogger class
Bye bye MsoLogger class.
Extracted constants to separated classes.
Fixed imports.
Change-Id: I7c8e0527e7dbd097d3ea93b9dab279354652da47
Issue-ID: LOG-631
Signed-off-by: Robert Bogacki <r.bogacki@samsung.com>
186 files changed, 1157 insertions, 2297 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 97e1627fd3..50bcb8e54a 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 @@ -85,8 +85,8 @@ import org.onap.so.config.beans.PoConfig; 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.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.exceptions.MsoAdapterException; import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound; import org.onap.so.openstack.exceptions.MsoException; @@ -271,7 +271,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{ if (!backout) { logger.warn("{} Deployment installation failed, backout deletion suppressed {} {}", - MessageEnum.RA_CREATE_STACK_ERR, MsoLogger.ErrorCode.BusinessProcesssError.getValue(), + MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcesssError.getValue(), "Exception in Deployment Installation, backout suppressed"); } else { @@ -293,14 +293,14 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{ // Didn't uninstall successfully. Log this error logger.error("{} Create Deployment: Cloudify error rolling back deployment install: {} {}", MessageEnum.RA_CREATE_STACK_ERR, installWorkflow.getError(), - MsoLogger.ErrorCode.BusinessProcesssError.getValue()); + ErrorCode.BusinessProcesssError.getValue()); } } catch (Exception e) { // Catch-all for backout errors trying to uninstall/delete // Log this error, and return the original exception logger.error("{} Create Stack: Nested exception rolling back deployment install: {}", - MessageEnum.RA_CREATE_STACK_ERR, MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); + MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcesssError.getValue(), e); } } @@ -316,7 +316,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{ if (!backout) { logger.warn("{} Deployment installation failed, backout deletion suppressed {}", - MessageEnum.RA_CREATE_STACK_ERR, MsoLogger.ErrorCode.BusinessProcesssError.getValue()); + MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcesssError.getValue()); } else { // Poll on delete if we rollback - use same values for now @@ -336,7 +336,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{ // Catch-all for backout errors trying to uninstall/delete // Log this error, and return the original exception logger.error("{} Create Stack: Nested exception rolling back deployment install: {} ", - MessageEnum.RA_CREATE_STACK_ERR, MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); + MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcesssError.getValue(), e); } } @@ -366,7 +366,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{ catch (CloudifyConnectException ce) { // Couldn't connect to Cloudify logger.error("{} QueryDeploymentOutputs: Cloudify connection failure: {} ", - MessageEnum.RA_CREATE_STACK_ERR, MsoLogger.ErrorCode.BusinessProcesssError.getValue(), ce); + MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcesssError.getValue(), ce); throw new MsoIOException (ce.getMessage(), ce); } catch (CloudifyResponseException re) { @@ -455,36 +455,36 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{ // Workflow failed. Log it and return the execution object (don't throw exception here) logger.error("{} Cloudify workflow failure: {} {} Execute Workflow: Failed: {}", MessageEnum.RA_CREATE_STACK_ERR, execution.getError(), - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), execution.getError()); + ErrorCode.BusinessProcesssError.getValue(), execution.getError()); return execution; } else if (status.equals(CANCELLED)){ // Workflow was cancelled, leaving the deployment in an indeterminate state. Log it and return the execution object (don't throw exception here) logger.error("{} Cloudify workflow cancelled. Deployment is in an indeterminate state {} {} {}", - MessageEnum.RA_CREATE_STACK_ERR, MsoLogger.ErrorCode.BusinessProcesssError.getValue(), + MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcesssError.getValue(), "Execute Workflow cancelled: ", workflowId); return execution; } else { // Can only get here after a timeout logger.error("{} Cloudify workflow timeout {} Execute Workflow: Timed Out", MessageEnum.RA_CREATE_STACK_ERR, - MsoLogger.ErrorCode.BusinessProcesssError.getValue()); + ErrorCode.BusinessProcesssError.getValue()); } } catch (CloudifyConnectException ce) { logger.error("{} {} Execute Workflow ({} {}): Cloudify connection failure {} ", MessageEnum.RA_CREATE_STACK_ERR, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), command, ce); + ErrorCode.BusinessProcesssError.getValue(), command, ce); savedException = ce; } catch (CloudifyResponseException re) { logger.error("{} {} Execute Workflow ({}): Cloudify response error {} ", MessageEnum.RA_CREATE_STACK_ERR, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), command, re.getMessage(), re); + ErrorCode.BusinessProcesssError.getValue(), command, re.getMessage(), re); savedException = re; } catch (RuntimeException e) { // Catch-all logger.error("{} {} Execute Workflow ({}): Internal error {}", MessageEnum.RA_CREATE_STACK_ERR, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), command, e.getMessage(), e); + ErrorCode.BusinessProcesssError.getValue(), command, e.getMessage(), e); savedException = e; } @@ -612,7 +612,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{ catch (CloudifyConnectException ce) { // Couldn't connect to Cloudify logger.error("{} QueryDeployment: Cloudify connection failure: {} ", MessageEnum.RA_CREATE_STACK_ERR, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), ce); + ErrorCode.BusinessProcesssError.getValue(), ce); throw new MsoIOException (ce.getMessage(), ce); } catch (CloudifyResponseException re) { @@ -1126,7 +1126,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{ } } catch (NumberFormatException e1) { logger.error("{} No retries. Exception in parsing retry code in config:{} {}", - MessageEnum.RA_CONFIG_EXC, rCode, MsoLogger.ErrorCode.SchemaError.getValue()); + MessageEnum.RA_CONFIG_EXC, rCode, ErrorCode.SchemaError.getValue()); throw e; } } @@ -1166,7 +1166,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{ // Failed Cloudify calls return an error entity body. CloudifyError error = re.getResponse ().getErrorEntity (CloudifyError.class); logger.error("{} {} {} Exception - Cloudify Error on {}: {}", MessageEnum.RA_CONNECTION_EXCEPTION, - CLOUDIFY, MsoLogger.ErrorCode.DataError.getValue(), context, error.getErrorCode()); + CLOUDIFY, ErrorCode.DataError.getValue(), context, error.getErrorCode()); String fullError = error.getErrorCode() + ": " + error.getMessage(); logger.debug(fullError); me = new MsoCloudifyException (re.getStatus(), @@ -1175,7 +1175,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{ } catch (Exception e2) { // Couldn't parse the body as a "CloudifyError". Report the original HTTP error. logger.error("{} {} {} Exception - HTTP Error on {}: {}, {} ", MessageEnum.RA_CONNECTION_EXCEPTION, - CLOUDIFY, MsoLogger.ErrorCode.DataError.getValue(), context, re.getStatus(), e.getMessage(), e2); + CLOUDIFY, ErrorCode.DataError.getValue(), context, re.getStatus(), e.getMessage(), e2); me = new MsoCloudifyException (re.getStatus (), re.getMessage (), ""); } @@ -1195,7 +1195,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{ // Generate an alarm for all connection errors. logger.error("{} {} {} Cloudify connection error on {}: ", MessageEnum.RA_CONNECTION_EXCEPTION, CLOUDIFY, - MsoLogger.ErrorCode.DataError.getValue(), context, e); + ErrorCode.DataError.getValue(), context, e); } return me; 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 8cd6b0f65e..5a7f67ea3c 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 @@ -39,8 +39,8 @@ import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; import org.onap.so.config.beans.PoConfig; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.exceptions.MsoAdapterException; import org.onap.so.openstack.exceptions.MsoException; import org.onap.so.openstack.exceptions.MsoExceptionCategory; @@ -108,7 +108,7 @@ public class MsoCommonUtils { } } catch (NumberFormatException e1) { logger.error("{} No retries. Exception in parsing retry code in config:{} {} {}", - MessageEnum.RA_CONFIG_EXC, rCode, MsoLogger.ErrorCode.SchemaError.getValue(), + MessageEnum.RA_CONFIG_EXC, rCode, ErrorCode.SchemaError.getValue(), "Exception in parsing retry code in config"); throw e; } @@ -160,12 +160,12 @@ public class MsoCommonUtils { // Failed Keystone calls return an Error entity body. Error error = re.getResponse ().getErrorEntity (Error.class); logger.error("{} {} Openstack Keystone Error on {}: {}", - MessageEnum.RA_CONNECTION_EXCEPTION, MsoLogger.ErrorCode.DataError.getValue(), context, error); + MessageEnum.RA_CONNECTION_EXCEPTION, ErrorCode.DataError.getValue(), context, error); me = new MsoOpenstackException (error.getCode (), error.getTitle (), error.getMessage ()); } catch (Exception e2) { // Can't parse the body as an "Error". Report the HTTP error logger.error("{} {} HTTP Error on {}: {}, {}", MessageEnum.RA_CONNECTION_EXCEPTION, - MsoLogger.ErrorCode.DataError.getValue(), context, re.getStatus(), re.getMessage(), e2); + ErrorCode.DataError.getValue(), context, re.getStatus(), re.getMessage(), e2); me = new MsoOpenstackException (re.getStatus (), re.getMessage (), ""); } @@ -184,7 +184,7 @@ public class MsoCommonUtils { // Generate an alarm for all connection errors. logger.error("{} {} Openstack Keystone connection error on {}: ", MessageEnum.RA_GENERAL_EXCEPTION_ARG, - MsoLogger.ErrorCode.DataError.getValue(), context, e); + ErrorCode.DataError.getValue(), context, e); } return me; @@ -204,7 +204,7 @@ public class MsoCommonUtils { // Failed Heat calls return an Explanation entity body. Explanation explanation = re.getResponse ().getErrorEntity (Explanation.class); logger.error("{} {} Exception - Openstack Error on {} : {}", MessageEnum.RA_CONNECTION_EXCEPTION, - MsoLogger.ErrorCode.DataError.getValue(), context, explanation.toString()); + ErrorCode.DataError.getValue(), context, explanation.toString()); String fullError = explanation.getExplanation() + ", error.type=" + explanation.getError().getType() + ", error.message=" + explanation.getError().getMessage(); logger.debug(fullError); me = new MsoOpenstackException (explanation.getCode (), @@ -214,7 +214,7 @@ public class MsoCommonUtils { } catch (Exception e2) { // Couldn't parse the body as an "Explanation". Report the original HTTP error. logger.error("{} {} Exception - HTTP Error on {}: {}, ", MessageEnum.RA_CONNECTION_EXCEPTION, - MsoLogger.ErrorCode.DataError.getValue(), context, re.getStatus(), e.getMessage(), e2); + ErrorCode.DataError.getValue(), context, re.getStatus(), e.getMessage(), e2); me = new MsoOpenstackException (re.getStatus (), re.getMessage (), ""); } @@ -234,7 +234,7 @@ public class MsoCommonUtils { // Generate an alarm for all connection errors. logger.error("{} {} Openstack Heat connection error on {}: ", MessageEnum.RA_CONNECTION_EXCEPTION, - MsoLogger.ErrorCode.DataError.getValue(), context, e); + ErrorCode.DataError.getValue(), context, e); } return me; @@ -254,12 +254,12 @@ public class MsoCommonUtils { // Failed Neutron calls return an NeutronError entity body NeutronError error = re.getResponse ().getErrorEntity (NeutronError.class); logger.error("{} {} Openstack Neutron Error on {} {}", MessageEnum.RA_CONNECTION_EXCEPTION, - MsoLogger.ErrorCode.DataError.getValue(), context, error); + ErrorCode.DataError.getValue(), context, error); me = new MsoOpenstackException (re.getStatus (), error.getType (), error.getMessage ()); } catch (Exception e2) { // Couldn't parse body as a NeutronError. Report the HTTP error. logger.error("{} {} Openstack HTTP Error on {}: {}, {}", MessageEnum.RA_CONNECTION_EXCEPTION, - MsoLogger.ErrorCode.DataError.getValue(), context, re.getStatus(), e.getMessage(), e2); + ErrorCode.DataError.getValue(), context, re.getStatus(), e.getMessage(), e2); me = new MsoOpenstackException (re.getStatus (), re.getMessage (), null); } @@ -279,7 +279,7 @@ public class MsoCommonUtils { // Generate an alarm for all connection errors. logger.error("{} {} Openstack Neutron Connection error on {}: ", MessageEnum.RA_CONNECTION_EXCEPTION, - MsoLogger.ErrorCode.DataError.getValue(), context, e); + ErrorCode.DataError.getValue(), context, e); } return me; @@ -298,7 +298,7 @@ public class MsoCommonUtils { // Always generate an alarm for internal exceptions logger.error("{} {} An exception occured on {}: ", MessageEnum.RA_GENERAL_EXCEPTION_ARG, - MsoLogger.ErrorCode.DataError.getValue(), context, e); + ErrorCode.DataError.getValue(), context, e); return me; } @@ -310,7 +310,7 @@ public class MsoCommonUtils { // Always generate an alarm for internal exceptions logger.error("{} {} An exception occured on {}: ", MessageEnum.RA_GENERAL_EXCEPTION_ARG, - MsoLogger.ErrorCode.DataError.getValue(), context, e); + ErrorCode.DataError.getValue(), context, e); 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 47ff6c1b5f..60088fc612 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 @@ -68,8 +68,8 @@ import org.onap.so.db.catalog.beans.CloudSite; 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.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.HeatStatus; import org.onap.so.openstack.beans.StackInfo; import org.onap.so.openstack.exceptions.MsoAdapterException; @@ -88,24 +88,6 @@ import org.springframework.context.annotation.Primary; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.woorea.openstack.base.client.OpenStackConnectException; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.base.client.OpenStackResponseException; -import com.woorea.openstack.heat.Heat; -import com.woorea.openstack.heat.model.CreateStackParam; -import com.woorea.openstack.heat.model.Resources; -import com.woorea.openstack.heat.model.Stack; -import com.woorea.openstack.heat.model.Stack.Output; -import com.woorea.openstack.heat.model.Stacks; -import com.woorea.openstack.keystone.Keystone; -import com.woorea.openstack.keystone.model.Access; -import com.woorea.openstack.keystone.model.Authentication; -import com.woorea.openstack.keystone.utils.KeystoneUtils; - @Primary @Component public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ @@ -382,7 +364,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ if (pollTimeout <= 0) { logger.error("{} Cloud site: {} Tenant: {} Stack: {} Stack status: {} {} Create stack timeout", MessageEnum.RA_CREATE_STACK_TIMEOUT, cloudSiteId, tenantId, stackName, - heatStack.getStackStatus(), MsoLogger.ErrorCode.AvailabilityError.getValue()); + heatStack.getStackStatus(), ErrorCode.AvailabilityError.getValue()); createTimedOut = true; break; } @@ -399,7 +381,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ if (!backout) { logger.warn("{} Exception in Create Stack, stack deletion suppressed {}", - MessageEnum.RA_CREATE_STACK_ERR, MsoLogger.ErrorCode.BusinessProcesssError.getValue()); + MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcesssError.getValue()); } else { @@ -421,7 +403,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ logger.error( "{} Cloud site: {} Tenant: {} Stack: {} Stack status: {} {} Rollback: DELETE stack timeout", MessageEnum.RA_CREATE_STACK_TIMEOUT, cloudSiteId, tenantId, stackName, - heatStack.getStackStatus(), MsoLogger.ErrorCode.AvailabilityError.getValue()); + heatStack.getStackStatus(), ErrorCode.AvailabilityError.getValue()); break; } else { sleep(deletePollInterval * 1000L); @@ -445,13 +427,13 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ } catch (Exception e3) { // Just log this one. We will report the original exception. logger.error("{} Create Stack: Nested exception rolling back stack: {} ", - MessageEnum.RA_CREATE_STACK_ERR, MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e3); + MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcesssError.getValue(), e3); } } } catch (Exception e2) { // Just log this one. We will report the original exception. logger.error("{} Create Stack: Nested exception rolling back stack: {} ", - MessageEnum.RA_CREATE_STACK_ERR, MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e2); + MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcesssError.getValue(), e2); } } @@ -464,14 +446,14 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ if (!"CREATE_COMPLETE".equals (heatStack.getStackStatus ())) { logger.error("{} Create Stack error: Polling complete with non-success status: {}, {} {} ", MessageEnum.RA_CREATE_STACK_ERR, heatStack.getStackStatus(), heatStack.getStackStatusReason(), - MsoLogger.ErrorCode.BusinessProcesssError.getValue()); + ErrorCode.BusinessProcesssError.getValue()); // Rollback the stack creation, since it is in an indeterminate state. if (!backout) { logger.warn( "{} Create Stack errored, stack deletion suppressed {} Create Stack error, stack deletion suppressed", - MessageEnum.RA_CREATE_STACK_ERR, MsoLogger.ErrorCode.BusinessProcesssError.getValue()); + MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcesssError.getValue()); } else { @@ -491,7 +473,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ logger.error( "{} Cloud site: {} Tenant: {} Stack: {} Stack status: {} {} Rollback: DELETE stack timeout", MessageEnum.RA_CREATE_STACK_TIMEOUT, cloudSiteId, tenantId, stackName, - heatStack.getStackStatus(), MsoLogger.ErrorCode.AvailabilityError.getValue()); + heatStack.getStackStatus(), ErrorCode.AvailabilityError.getValue()); break; } else { sleep(deletePollInterval * 1000L); @@ -506,7 +488,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ // Warn about this (?) - but still throw the original exception logger.warn( "{} Create Stack errored, stack deletion FAILED {} Create Stack error, stack deletion FAILED", - MessageEnum.RA_CREATE_STACK_ERR, MsoLogger.ErrorCode.BusinessProcesssError.getValue()); + MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcesssError.getValue()); logger.debug("Stack deletion FAILED on a rollback of a create - {}, status={}, reason={}", canonicalName, heatStack.getStackStatus(), heatStack.getStackStatusReason()); break; @@ -526,7 +508,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ logger.debug("Exception thrown trying to delete {} on a create->rollback: {} ", canonicalName, me2.getContextMessage(), me2); logger.warn("{} Create Stack errored, then stack deletion FAILED - exception thrown {} {}", - MessageEnum.RA_CREATE_STACK_ERR, MsoLogger.ErrorCode.BusinessProcesssError.getValue(), + MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcesssError.getValue(), me2.getContextMessage()); } @@ -545,7 +527,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ } catch (Exception e2) { // shouldn't happen - but handle logger.error("{} Create Stack: Nested exception rolling back stack: {} ", MessageEnum.RA_CREATE_STACK_ERR, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e2); + ErrorCode.BusinessProcesssError.getValue(), e2); } } MsoOpenstackException me = new MsoOpenstackException(0, "", stackErrorStatusReason.toString()); @@ -588,7 +570,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ } catch (MsoException me) { // Got an Openstack error. Propagate it logger.error("{} {} Openstack Exception on Token request: ", MessageEnum.RA_CONNECTION_EXCEPTION, - MsoLogger.ErrorCode.AvailabilityError.getValue(), me); + ErrorCode.AvailabilityError.getValue(), me); me.addContext ("QueryStack"); throw me; } @@ -650,7 +632,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ } catch (MsoException me) { // Got an Openstack error. Propagate it logger.error("{} {} Openstack Exception on Token request: ", MessageEnum.RA_CONNECTION_EXCEPTION, - MsoLogger.ErrorCode.AvailabilityError.getValue(), me); + ErrorCode.AvailabilityError.getValue(), me); me.addContext (DELETE_STACK); throw me; } @@ -727,7 +709,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ if (pollTimeout <= 0) { logger.error("{} Cloud site: {} Tenant: {} Stack: {} Stack status: {} {} Delete Stack Timeout", MessageEnum.RA_DELETE_STACK_TIMEOUT, cloudSiteId, tenantId, stackName, - heatStack.getStackStatus(), MsoLogger.ErrorCode.AvailabilityError.getValue()); + heatStack.getStackStatus(), ErrorCode.AvailabilityError.getValue()); // Throw a 'special case' of MsoOpenstackException to report the Heat status MsoOpenstackException me = new MsoOpenstackException (0, "", "Stack Deletion Timeout"); @@ -846,7 +828,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ // Problem - missing one or more required parameters String error = "Missing Required inputs for HEAT Template: " + missingParams; logger.error("{} for HEAT Template {} Missing Required inputs for HEAT Template: {}", - MessageEnum.RA_MISSING_PARAM, MsoLogger.ErrorCode.SchemaError.getValue(), missingParams); + MessageEnum.RA_MISSING_PARAM, ErrorCode.SchemaError.getValue(), missingParams); throw new IllegalArgumentException (error); } @@ -865,7 +847,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ if (!extraParams.isEmpty ()) { logger.warn("{} Heat Stack ({}) extra input params received: {} {}", MessageEnum.RA_GENERAL_WARNING, - heatTemplate.getTemplateName(), extraParams, MsoLogger.ErrorCode.DataError.getValue()); + heatTemplate.getTemplateName(), extraParams, ErrorCode.DataError.getValue()); } return updatedParams; diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdate.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdate.java index cbbabc79b3..d93ce9e1e1 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdate.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdate.java @@ -39,8 +39,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import org.onap.so.db.catalog.beans.CloudSite; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.StackInfo; import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound; import org.onap.so.openstack.exceptions.MsoException; @@ -295,7 +295,7 @@ public class MsoHeatUtilsWithUpdate extends MsoHeatUtils { logger.error( "{} Cloud site: {} Tenant: {} Stack: {} Stack status: {} {} Update stack timeout", MessageEnum.RA_UPDATE_STACK_TIMEOUT, cloudSiteId, tenantId, stackName, - updateStack.getStackStatus(), MsoLogger.ErrorCode.AvailabilityError.getValue()); + updateStack.getStackStatus(), ErrorCode.AvailabilityError.getValue()); loopAgain = false; } else { try { @@ -324,7 +324,7 @@ public class MsoHeatUtilsWithUpdate extends MsoHeatUtils { if (!"UPDATE_COMPLETE".equals (updateStack.getStackStatus ())) { logger.error("{} Stack status: {} Stack status reason: {} {} Update Stack error", MessageEnum.RA_UPDATE_STACK_ERR, updateStack.getStackStatus(), updateStack.getStackStatusReason(), - MsoLogger.ErrorCode.DataError.getValue()); + ErrorCode.DataError.getValue()); // TODO: No way to roll back the stack at this point. What to do? // Throw a 'special case' of MsoOpenstackException to report the Heat status 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 56a42e986f..c96cca9f61 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 @@ -42,8 +42,8 @@ import java.util.Optional; import org.onap.so.cloud.authentication.AuthenticationMethodFactory; import org.onap.so.db.catalog.beans.CloudIdentity; import org.onap.so.db.catalog.beans.CloudSite; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.MsoTenant; import org.onap.so.openstack.exceptions.MsoAdapterException; import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound; @@ -97,7 +97,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils { Optional<CloudSite> cloudSiteOpt = cloudConfig.getCloudSite(cloudSiteId); if (!cloudSiteOpt.isPresent()) { logger.error("{} MSOCloudSite {} not found {} ", MessageEnum.RA_CREATE_TENANT_ERR, cloudSiteId, - MsoLogger.ErrorCode.DataError.getValue()); + ErrorCode.DataError.getValue()); throw new MsoCloudSiteNotFound (cloudSiteId); } Keystone keystoneAdminClient = getKeystoneAdminClient(cloudSiteOpt.get()); @@ -109,7 +109,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils { if (tenant != null) { // Tenant already exists. Throw an exception logger.error("{} Tenant name {} already exists on Cloud site id {}, {}", - MessageEnum.RA_TENANT_ALREADY_EXIST, tenantName, cloudSiteId, MsoLogger.ErrorCode.DataError.getValue()); + MessageEnum.RA_TENANT_ALREADY_EXIST, tenantName, cloudSiteId, ErrorCode.DataError.getValue()); throw new MsoTenantAlreadyExists (tenantName, cloudSiteId); } @@ -159,7 +159,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils { if (!backout) { logger.warn("{} Create Tenant errored, Tenant deletion suppressed {} ", MessageEnum.RA_CREATE_TENANT_ERR, - MsoLogger.ErrorCode.DataError.getValue()); + ErrorCode.DataError.getValue()); } else { @@ -169,7 +169,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils { } catch (Exception e2) { // Just log this one. We will report the original exception. logger.error("{} Nested exception rolling back tenant {} ", MessageEnum.RA_CREATE_TENANT_ERR, - MsoLogger.ErrorCode.DataError.getValue(), e2); + ErrorCode.DataError.getValue(), e2); } } @@ -306,7 +306,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils { Tenant tenant = findTenantById (keystoneAdminClient, tenantId); if (tenant == null) { logger.error("{} Tenant id {} not found on cloud site id {}, {}", MessageEnum.RA_TENANT_NOT_FOUND, - tenantId, cloudSiteId, MsoLogger.ErrorCode.DataError.getValue()); + tenantId, cloudSiteId, ErrorCode.DataError.getValue()); return false; } @@ -353,7 +353,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils { if (tenant == null) { // OK if tenant already doesn't exist. logger.error("{} Tenant {} not found on Cloud site id {}, {}", MessageEnum.RA_TENANT_NOT_FOUND, - tenantName, cloudSiteId, MsoLogger.ErrorCode.DataError.getValue()); + tenantName, cloudSiteId, ErrorCode.DataError.getValue()); return false; } @@ -437,7 +437,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils { logger.error("{} Region: {} Cloud identity {} {} Exception in findEndpointURL ", MessageEnum.IDENTITY_SERVICE_NOT_FOUND, region, cloudIdentity.getId(), - MsoLogger.ErrorCode.DataError.getValue(), e); + ErrorCode.DataError.getValue(), e); throw new MsoAdapterException (error, e); } @@ -493,7 +493,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils { return null; } else { logger.error("{} {} Openstack Error, GET Tenant by Id ({}): ", MessageEnum.RA_CONNECTION_EXCEPTION, - MsoLogger.ErrorCode.DataError.getValue(), tenantId, e); + ErrorCode.DataError.getValue(), tenantId, e); throw e; } } @@ -522,7 +522,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils { return null; } else { logger.error("{} {} Openstack Error, GET Tenant By Name ({}) ", MessageEnum.RA_CONNECTION_EXCEPTION, - MsoLogger.ErrorCode.DataError.getValue(), tenantName, e); + ErrorCode.DataError.getValue(), tenantName, e); throw e; } } @@ -552,7 +552,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils { return findUserByName (adminClient, userNameOrId); } else { logger.error("{} {} Openstack Error, GET User ({}) ", MessageEnum.RA_CONNECTION_EXCEPTION, - MsoLogger.ErrorCode.DataError.getValue(), userNameOrId, e); + ErrorCode.DataError.getValue(), userNameOrId, e); throw e; } } @@ -581,7 +581,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils { return null; } else { logger.error("{} {} Openstack Error, GET User By Name ({}): ", MessageEnum.RA_CONNECTION_EXCEPTION, - MsoLogger.ErrorCode.DataError.getValue(), userName, e); + ErrorCode.DataError.getValue(), userName, e); throw 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 49758a1240..a939f79cf9 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 @@ -47,8 +47,8 @@ import org.onap.so.adapters.vdu.VduStatus; import org.onap.so.client.HttpClientFactory; import org.onap.so.client.RestClient; import org.onap.so.db.catalog.beans.CloudSite; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.HeatStatus; import org.onap.so.openstack.beans.StackInfo; import org.onap.so.openstack.exceptions.MsoAdapterException; @@ -388,7 +388,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{ if (pollTimeout <= 0) { // Note that this should not occur, since there is a timeout specified // in the Openstack (multicloud?) call. - logger.error(String.format("%s %s %s %s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_TIMEOUT.toString(), cloudSiteId, tenantId, instanceId, stackInfo.getStatus(), "", "", MsoLogger.ErrorCode.AvailabilityError.getValue(), "Create stack timeout")); + logger.error(String.format("%s %s %s %s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_TIMEOUT.toString(), cloudSiteId, tenantId, instanceId, stackInfo.getStatus(), "", "", ErrorCode.AvailabilityError.getValue(), "Create stack timeout")); createTimedOut = true; break; } @@ -406,7 +406,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{ // Cannot query the stack status. Something is wrong. // Try to roll back the stack if (!backout) { - logger.warn(String.format("%s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR.toString(), "Create Stack error, stack deletion suppressed", "", "", MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception in Create Stack, stack deletion suppressed")); + logger.warn(String.format("%s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR.toString(), "Create Stack error, stack deletion suppressed", "", "", ErrorCode.BusinessProcesssError.getValue(), "Exception in Create Stack, stack deletion suppressed")); } else { try { logger.debug("Create Stack error - unable to query for stack status - attempting to delete stack: " + instanceId + " - This will likely fail and/or we won't be able to query to see if delete worked"); @@ -421,7 +421,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{ if (HeatStatus.DELETING.equals(queryInfo.getStatus())) { if (deletePollTimeout <= 0) { logger.error(String.format("%s %s %s %s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_TIMEOUT.toString(), cloudSiteId, tenantId, instanceId, - queryInfo.getStatus(), "", "", MsoLogger.ErrorCode.AvailabilityError.getValue(), + queryInfo.getStatus(), "", "", ErrorCode.AvailabilityError.getValue(), "Rollback: DELETE stack timeout")); break; } else { @@ -438,12 +438,12 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{ } } catch (Exception e3) { // Just log this one. We will report the original exception. - logger.error(String.format("%s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR.toString(), "Create Stack: Nested exception rolling back stack: " + e3, "", "", MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Create Stack: Nested exception rolling back stack on error on query")); + logger.error(String.format("%s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR.toString(), "Create Stack: Nested exception rolling back stack: " + e3, "", "", ErrorCode.BusinessProcesssError.getValue(), "Create Stack: Nested exception rolling back stack on error on query")); } } } catch (Exception e2) { // Just log this one. We will report the original exception. - logger.error(String.format("%s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR.toString(), "Create Stack: Nested exception rolling back stack: " + e2, "", "", MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Create Stack: Nested exception rolling back stack")); + logger.error(String.format("%s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR.toString(), "Create Stack: Nested exception rolling back stack: " + e2, "", "", ErrorCode.BusinessProcesssError.getValue(), "Create Stack: Nested exception rolling back stack")); } } @@ -455,11 +455,11 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{ if (!HeatStatus.CREATED.equals(stackInfo.getStatus())) { logger.error(String.format("%s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR.toString(), "Create Stack error: Polling complete with non-success status: " - + stackInfo.getStatus () + ", " + stackInfo.getStatusMessage(), "", "", MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Create Stack error")); + + stackInfo.getStatus () + ", " + stackInfo.getStatusMessage(), "", "", ErrorCode.BusinessProcesssError.getValue(), "Create Stack error")); // Rollback the stack creation, since it is in an indeterminate state. if (!backout) { - logger.warn(String.format("%s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR.toString(), "Create Stack errored, stack deletion suppressed", "", "", MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Create Stack error, stack deletion suppressed")); + logger.warn(String.format("%s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR.toString(), "Create Stack errored, stack deletion suppressed", "", "", ErrorCode.BusinessProcesssError.getValue(), "Create Stack error, stack deletion suppressed")); } else { @@ -475,7 +475,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{ if (HeatStatus.DELETING.equals(queryInfo.getStatus())) { if (deletePollTimeout <= 0) { logger.error(String.format("%s %s %s %s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_TIMEOUT.toString(), cloudSiteId, tenantId, instanceId, - queryInfo.getStatus(), "", "", MsoLogger.ErrorCode.AvailabilityError.getValue(), + queryInfo.getStatus(), "", "", ErrorCode.AvailabilityError.getValue(), "Rollback: DELETE stack timeout")); break; } else { @@ -488,14 +488,14 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{ continue; } else { //got a status other than DELETE_IN_PROGRESS or DELETE_COMPLETE - so break and evaluate - logger.warn(String.format("%s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR.toString(), "Create Stack errored, stack deletion FAILED", "", "", MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Create Stack error, stack deletion FAILED")); + logger.warn(String.format("%s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR.toString(), "Create Stack errored, stack deletion FAILED", "", "", ErrorCode.BusinessProcesssError.getValue(), "Create Stack error, stack deletion FAILED")); logger.debug("Stack deletion FAILED on a rollback of a create - " + instanceId + ", status=" + queryInfo.getStatus() + ", reason=" + queryInfo.getStatusMessage()); break; } } catch (MsoException me2) { // Just log this one. We will report the original exception. logger.debug("Exception thrown trying to delete " + instanceId + " on a create->rollback: " + me2.getContextMessage(), me2); - logger.warn(String.format("%s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR.toString(), "Create Stack errored, then stack deletion FAILED - exception thrown", "", "", MsoLogger.ErrorCode.BusinessProcesssError.getValue(), me2.getContextMessage())); + logger.warn(String.format("%s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR.toString(), "Create Stack errored, then stack deletion FAILED - exception thrown", "", "", ErrorCode.BusinessProcesssError.getValue(), me2.getContextMessage())); } } StringBuilder errorContextMessage; @@ -511,7 +511,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{ } } catch (MsoException e2) { // shouldn't happen - but handle - logger.error(String.format("%s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR.toString(), "Create Stack: Nested exception rolling back stack: " + e2, "", "", MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception in Create Stack: rolling back stack")); + logger.error(String.format("%s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR.toString(), "Create Stack: Nested exception rolling back stack: " + e2, "", "", ErrorCode.BusinessProcesssError.getValue(), "Exception in Create Stack: rolling back stack")); } } MsoOpenstackException me = new MsoOpenstackException(0, "", stackErrorStatusReason.toString()); @@ -621,7 +621,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{ logger.error(String.format("%s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR.toString(), "Create Stack: " + e, "", "", - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), + ErrorCode.BusinessProcesssError.getValue(), "Exception in Create Stack: Invalid JSON format of directives" + directives)); MsoException me = new MsoAdapterException("Invalid JSON format of directives parameter: " + directives); me.addContext(CREATE_STACK); 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 b904a59ee1..22ce6d9781 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 @@ -46,8 +46,8 @@ import org.onap.so.cloud.authentication.ServiceEndpointNotFoundException; 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.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.NetworkInfo; import org.onap.so.openstack.exceptions.MsoAdapterException; import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound; @@ -119,7 +119,7 @@ public class MsoNeutronUtils extends MsoCommonUtils // Network already exists. Throw an exception logger.error("{} Network {} on Cloud site {} for tenant {} already exists {}", MessageEnum.RA_NETWORK_ALREADY_EXIST, networkName, cloudSiteId, tenantId, - MsoLogger.ErrorCode.DataError.getValue()); + ErrorCode.DataError.getValue()); throw new MsoNetworkAlreadyExists (networkName, tenantId, cloudSiteId); } @@ -296,7 +296,7 @@ public class MsoNeutronUtils extends MsoCommonUtils if (network == null) { // Network not found. Throw an exception logger.error("{} Network {} on Cloud site {} for Tenant {} not found {}", MessageEnum.RA_NETWORK_NOT_FOUND, - networkId, cloudSiteId, tenantId, MsoLogger.ErrorCode.DataError.getValue()); + networkId, cloudSiteId, tenantId, ErrorCode.DataError.getValue()); throw new MsoNetworkNotFound (networkId, tenantId, cloudSiteId); } @@ -483,7 +483,7 @@ public class MsoNeutronUtils extends MsoCommonUtils return null; } else { logger.error("{} {} Openstack Error, GET Network By ID ({}): ", MessageEnum.RA_CONNECTION_EXCEPTION, - MsoLogger.ErrorCode.DataError.getValue(), networkId, e); + ErrorCode.DataError.getValue(), networkId, e); throw e; } } @@ -530,7 +530,7 @@ public class MsoNeutronUtils extends MsoCommonUtils return null; } else { logger.error("{} {} Openstack Error, GET Network By Name ({}): ", MessageEnum.RA_CONNECTION_EXCEPTION, - MsoLogger.ErrorCode.DataError.getValue(), networkName, e); + ErrorCode.DataError.getValue(), networkName, e); throw e; } } diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java index 0f5ad6d92f..a97029ef5b 100644 --- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java @@ -21,6 +21,13 @@ package org.onap.so.adapters.catalogdb.catalogrest; import static org.junit.Assert.*; +import static org.onap.so.logger.MdcConstants.ENDTIME; +import static org.onap.so.logger.MdcConstants.INVOCATION_ID; +import static org.onap.so.logger.MdcConstants.PARTNERNAME; +import static org.onap.so.logger.MdcConstants.RESPONSECODE; +import static org.onap.so.logger.MdcConstants.RESPONSEDESC; +import static org.onap.so.logger.MdcConstants.SERVICE_NAME; +import static org.onap.so.logger.MdcConstants.STATUSCODE; import java.io.IOException; @@ -39,7 +46,6 @@ import org.junit.runner.RunWith; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.adapters.catalogdb.CatalogDBApplication; -import org.onap.so.logger.MsoLogger; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; import org.springframework.boot.web.server.LocalServerPort; @@ -833,22 +839,22 @@ public class CatalogDBRestTest { Map<String,String> mdc = logEvent.getMDCPropertyMap(); assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP)); assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); - assertNotNull(mdc.get(MsoLogger.INVOCATION_ID)); - assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME)); - assertEquals("v2/vfModules",mdc.get(MsoLogger.SERVICE_NAME)); - assertEquals("INPROGRESS",mdc.get(MsoLogger.STATUSCODE)); + assertNotNull(mdc.get(INVOCATION_ID)); + assertEquals("UNKNOWN",mdc.get(PARTNERNAME)); + assertEquals("v2/vfModules",mdc.get(SERVICE_NAME)); + assertEquals("INPROGRESS",mdc.get(STATUSCODE)); }else if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging") && logEvent.getMarker().getName().equals("EXIT")){ Map<String,String> mdc = logEvent.getMDCPropertyMap(); assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP)); - assertNotNull(mdc.get(MsoLogger.ENDTIME)); + assertNotNull(mdc.get(ENDTIME)); assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); - assertNotNull(mdc.get(MsoLogger.INVOCATION_ID)); - assertEquals("500",mdc.get(MsoLogger.RESPONSECODE)); - assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME)); - assertEquals("v2/vfModules",mdc.get(MsoLogger.SERVICE_NAME)); - assertEquals("ERROR",mdc.get(MsoLogger.STATUSCODE)); - assertNotNull(mdc.get(MsoLogger.RESPONSEDESC)); + assertNotNull(mdc.get(INVOCATION_ID)); + assertEquals("500",mdc.get(RESPONSECODE)); + assertEquals("UNKNOWN",mdc.get(PARTNERNAME)); + assertEquals("v2/vfModules",mdc.get(SERVICE_NAME)); + assertEquals("ERROR",mdc.get(STATUSCODE)); + assertNotNull(mdc.get(RESPONSEDESC)); } } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailPolicyRef.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailPolicyRef.java index 613ab0d2f9..7febf7e9a0 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailPolicyRef.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailPolicyRef.java @@ -26,8 +26,8 @@ package org.onap.so.adapters.network; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -49,7 +49,7 @@ public class ContrailPolicyRef { catch (Exception e) { logger.error("{} {} Error creating JsonString for Contrail Policy Ref: ", MessageEnum.RA_MARSHING_ERROR, - MsoLogger.ErrorCode.SchemaError.getValue(), e); + ErrorCode.SchemaError.getValue(), e); } return node; @@ -66,7 +66,7 @@ public class ContrailPolicyRef { catch (Exception e) { logger.error("{} {} Error creating JsonString for Contrail Policy Ref: ", MessageEnum.RA_MARSHING_ERROR, - MsoLogger.ErrorCode.SchemaError.getValue(), e); + ErrorCode.SchemaError.getValue(), e); } return jsonString; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnet.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnet.java index 6f80e0ee15..2662cef16e 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnet.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnet.java @@ -27,8 +27,9 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import java.util.ArrayList; import java.util.List; + +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.HostRoute; import org.onap.so.openstack.beans.Pool; import org.onap.so.openstack.beans.Subnet; @@ -133,7 +134,7 @@ public class ContrailSubnet { catch (Exception e) { logger.error("{} {} Error creating JsonNode for Contrail Subnet: {} ", MessageEnum.RA_MARSHING_ERROR, - MsoLogger.ErrorCode.SchemaError.getValue(), subnetName, e); + ErrorCode.SchemaError.getValue(), subnetName, e); } return node; @@ -150,7 +151,7 @@ public class ContrailSubnet { catch (Exception e) { logger.error("{} {} Error creating JsonString for Contrail Subnet: {} ", MessageEnum.RA_MARSHING_ERROR, - MsoLogger.ErrorCode.SchemaError.getValue(), subnetName, e); + ErrorCode.SchemaError.getValue(), subnetName, e); } return jsonString; 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 d0ffa27027..53fa2f6dc2 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 @@ -46,8 +46,8 @@ import org.onap.so.adapters.network.async.client.QueryNetworkNotification; 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.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.NetworkRollback; import org.onap.so.openstack.beans.NetworkStatus; import org.onap.so.openstack.beans.Subnet; @@ -176,7 +176,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { exCat = MsoExceptionCategory.fromValue (e.getFaultInfo ().getCategory ().name ()); } catch (Exception e1) { logger.error(FAULT_INFO_ERROR_LOGMSG, MessageEnum.RA_FAULT_INFO_EXC, - MsoLogger.ErrorCode.DataError.getValue(), e1); + ErrorCode.DataError.getValue(), e1); } // Build and send Asynchronous error response try { @@ -184,7 +184,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { notifyPort.createNetworkNotification (messageId, false, exCat, eMsg, null, null, null, null); } catch (Exception e1) { logger.error(CREATE_NETWORK_ERROR_LOGMSG, MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, - MsoLogger.ErrorCode.DataError.getValue(), e1.getMessage(), e1); + ErrorCode.DataError.getValue(), e1.getMessage(), e1); } return; @@ -203,7 +203,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { copyNrb (networkRollback)); } catch (Exception e) { logger.error(CREATE_NETWORK_ERROR_LOGMSG, MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, - MsoLogger.ErrorCode.DataError.getValue(), e.getMessage(), e); + ErrorCode.DataError.getValue(), e.getMessage(), e); } return; @@ -294,7 +294,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { exCat = MsoExceptionCategory.fromValue (e.getFaultInfo ().getCategory ().name ()); } catch (Exception e1) { logger.error(FAULT_INFO_ERROR_LOGMSG, MessageEnum.RA_FAULT_INFO_EXC, - MsoLogger.ErrorCode.DataError.getValue(), e1); + ErrorCode.DataError.getValue(), e1); } // Build and send Asynchronous error response try { @@ -302,7 +302,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { notifyPort.updateNetworkNotification (messageId, false, exCat, eMsg, null, copyNrb (networkRollback)); } catch (Exception e1) { logger.error("{} {} Error sending updateNetwork notification {} ", - MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, MsoLogger.ErrorCode.DataError.getValue(), e1.getMessage(), + MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, ErrorCode.DataError.getValue(), e1.getMessage(), e1); } @@ -320,7 +320,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { copyNrb (networkRollback)); } catch (Exception e) { logger.error("{} {} Error sending updateNotification request {} ", MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, - MsoLogger.ErrorCode.DataError.getValue(), e.getMessage(), e); + ErrorCode.DataError.getValue(), e.getMessage(), e); } return; } @@ -374,7 +374,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { exCat = MsoExceptionCategory.fromValue (e.getFaultInfo ().getCategory ().name ()); } catch (Exception e1) { logger.error(FAULT_INFO_ERROR_LOGMSG, MessageEnum.RA_FAULT_INFO_EXC, - MsoLogger.ErrorCode.DataError.getValue(), e1); + ErrorCode.DataError.getValue(), e1); } // Build and send Asynchronous error response try { @@ -382,7 +382,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { notifyPort.queryNetworkNotification (messageId, false, exCat, eMsg, null, null, null, null, null, null); } catch (Exception e1) { logger.error(errorCreateNetworkMessage, MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, - MsoLogger.ErrorCode.DataError.getValue(), e1.getMessage(), e1); + ErrorCode.DataError.getValue(), e1.getMessage(), e1); } return; } @@ -403,7 +403,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { copyQuerySubnetIdMap (subnetIdMap)); } catch (Exception e) { logger.error(errorCreateNetworkMessage, MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, - MsoLogger.ErrorCode.DataError.getValue(), e.getMessage(), e); + ErrorCode.DataError.getValue(), e.getMessage(), e); } return; } @@ -456,7 +456,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { exCat = MsoExceptionCategory.fromValue (e.getFaultInfo ().getCategory ().name ()); } catch (Exception e1) { logger.error(FAULT_INFO_ERROR_LOGMSG, MessageEnum.RA_FAULT_INFO_EXC, - MsoLogger.ErrorCode.DataError.getValue(), e1); + ErrorCode.DataError.getValue(), e1); } // Build and send Asynchronous error response try { @@ -464,7 +464,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { notifyPort.deleteNetworkNotification (messageId, false, exCat, eMsg, null); } catch (Exception e1) { logger.error("{} {} Error sending createNetwork notification {} ", - MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, MsoLogger.ErrorCode.DataError.getValue(), e1.getMessage(), + MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, ErrorCode.DataError.getValue(), e1.getMessage(), e1); } @@ -477,7 +477,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { notifyPort.deleteNetworkNotification (messageId, true, null, null, networkDeleted.value); } catch (Exception e) { logger.error("{} {} Error sending deleteNetwork notification {} ", MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, - MsoLogger.ErrorCode.DataError.getValue(), e.getMessage(), e); + ErrorCode.DataError.getValue(), e.getMessage(), e); } return; @@ -497,7 +497,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { // rollback may be null (e.g. if network already existed when Create was called) if (rollback == null) { logger.warn("{} {} Rollback is null", MessageEnum.RA_ROLLBACK_NULL, - MsoLogger.ErrorCode.SchemaError.getValue()); + ErrorCode.SchemaError.getValue()); return; } @@ -517,7 +517,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { exCat = MsoExceptionCategory.fromValue (e.getFaultInfo ().getCategory ().name ()); } catch (Exception e1) { logger.error("{} {} Exception in get fault info ", MessageEnum.RA_FAULT_INFO_EXC, - MsoLogger.ErrorCode.DataError.getValue(), e1); + ErrorCode.DataError.getValue(), e1); } // Build and send Asynchronous error response try { @@ -525,7 +525,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { notifyPort.rollbackNetworkNotification (rollback.getMsoRequest ().getRequestId (), false, exCat, eMsg); } catch (Exception e1) { logger.error(CREATE_NETWORK_ERROR_LOGMSG, MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, - MsoLogger.ErrorCode.DataError.getValue(), e1.getMessage(), e1); + ErrorCode.DataError.getValue(), e1.getMessage(), e1); } return; @@ -538,7 +538,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { } catch (Exception e) { logger .error("{} {} Error sending rollbackNetwork notification {} ", MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, - MsoLogger.ErrorCode.DataError.getValue(), e.getMessage(), e); + ErrorCode.DataError.getValue(), e.getMessage(), e); } return; @@ -578,17 +578,17 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { warWsdlLoc = Thread.currentThread ().getContextClassLoader ().getResource ("NetworkAdapterNotify.wsdl"); } catch (Exception e) { logger.error("{} {} Exception - WSDL not found ", MessageEnum.RA_WSDL_NOT_FOUND, - MsoLogger.ErrorCode.DataError.getValue(), e); + ErrorCode.DataError.getValue(), e); } if (warWsdlLoc == null) { logger - .error("{} {} WSDL not found", MessageEnum.RA_WSDL_NOT_FOUND, MsoLogger.ErrorCode.DataError.getValue()); + .error("{} {} WSDL not found", MessageEnum.RA_WSDL_NOT_FOUND, ErrorCode.DataError.getValue()); } else { try { logger.debug("NetworkAdpaterNotify.wsdl location: {}", warWsdlLoc.toURI().toString()); } catch (Exception e) { logger.error("{} {} Exception - WSDL URL convention ", MessageEnum.RA_WSDL_URL_CONVENTION_EXC, - MsoLogger.ErrorCode.SchemaError.getValue(), e); + ErrorCode.SchemaError.getValue(), e); } } @@ -605,7 +605,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { epUrl = new URL (notificationUrl); } catch (MalformedURLException e1) { logger.error("{} {} Exception - init notification ", MessageEnum.RA_INIT_NOTIF_EXC, - MsoLogger.ErrorCode.DataError.getValue(), e1); + ErrorCode.DataError.getValue(), e1); } if(null != epUrl) { @@ -628,7 +628,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { headers.put ("Authorization", Collections.singletonList (basicAuth)); } catch (Exception e) { logger.error("{} {} Unable to set authorization in callback request {} ", - MessageEnum.RA_SET_CALLBACK_AUTH_EXC, MsoLogger.ErrorCode.DataError.getValue(), e.getMessage(), e); + MessageEnum.RA_SET_CALLBACK_AUTH_EXC, ErrorCode.DataError.getValue(), e.getMessage(), e); } 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 fc2fc4844b..108a7148f6 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,8 +49,8 @@ import org.onap.so.db.catalog.data.repository.NetworkResourceCustomizationReposi 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.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.HeatStatus; import org.onap.so.openstack.beans.NetworkInfo; import org.onap.so.openstack.beans.NetworkRollback; @@ -288,7 +288,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { String error = String .format("Configuration Error. Stack %s in %s/%s: CloudSite does not exist in MSO Configuration", networkName, cloudSiteId, tenantId); - logger.error("{} {} {}", MessageEnum.RA_CONFIG_EXC, MsoLogger.ErrorCode.DataError.getValue(), error); + logger.error("{} {} {}", MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error); // Set the detailed error as the Exception 'message' throw new NetworkException(error, MsoExceptionCategory.USERDATA); } @@ -318,7 +318,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } catch (MsoException me) { logger.error( "{} {} Exception while querying network {} for CloudSite {} from Tenant {} from OpenStack ", - MessageEnum.RA_QUERY_NETWORK_EXC, MsoLogger.ErrorCode.BusinessProcesssError.getValue(), + MessageEnum.RA_QUERY_NETWORK_EXC, ErrorCode.BusinessProcesssError.getValue(), networkName, cloudSiteId, tenantId, me); me.addContext (CREATE_NETWORK_CONTEXT); throw new NetworkException (me); @@ -332,7 +332,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { .format("Create Nework: Network %s already exists in %s/%s with ID %s", networkName, cloudSiteId, tenantId, netInfo.getId()); logger.error("{} {} {}", MessageEnum.RA_NETWORK_ALREADY_EXIST, - MsoLogger.ErrorCode.DataError.getValue(), error); + ErrorCode.DataError.getValue(), error); throw new NetworkException(error, MsoExceptionCategory.USERDATA); } else { // Populate the outputs from the existing network. @@ -340,7 +340,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { neutronNetworkId.value = netInfo.getId (); rollback.value = networkRollback; // Default rollback - no updates performed logger.warn("{} {} Found Existing network, status={} for Neutron mode ", - MessageEnum.RA_NETWORK_ALREADY_EXIST, MsoLogger.ErrorCode.DataError.getValue(), + MessageEnum.RA_NETWORK_ALREADY_EXIST, ErrorCode.DataError.getValue(), netInfo.getStatus()); } return; @@ -357,7 +357,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } catch (MsoException me) { me.addContext(CREATE_NETWORK_CONTEXT); logger.error("{} {} Create Network: type {} in {}/{}: ", MessageEnum.RA_CREATE_NETWORK_EXC, - MsoLogger.ErrorCode.DataError.getValue(), neutronNetworkType, cloudSiteId, tenantId, me); + ErrorCode.DataError.getValue(), neutronNetworkType, cloudSiteId, tenantId, me); throw new NetworkException (me); } @@ -382,7 +382,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { if (heatTemplate == null) { String error = String .format("Network error - undefined Heat Template. Network Type = %s", networkType); - logger.error("{} {} {}", MessageEnum.RA_PARAM_NOT_FOUND, MsoLogger.ErrorCode.DataError.getValue(), + logger.error("{} {} {}", MessageEnum.RA_PARAM_NOT_FOUND, ErrorCode.DataError.getValue(), error); throw new NetworkException (error, MsoExceptionCategory.INTERNAL); } @@ -410,7 +410,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } catch (MsoException me) { me.addContext (CREATE_NETWORK_CONTEXT); logger.error("{} {} Create Network (heat): query network {} in {}/{}: ", - MessageEnum.RA_QUERY_NETWORK_EXC, MsoLogger.ErrorCode.DataError.getValue(), networkName, + MessageEnum.RA_QUERY_NETWORK_EXC, ErrorCode.DataError.getValue(), networkName, cloudSiteId, tenantId, me); throw new NetworkException (me); } @@ -422,7 +422,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { .format("CreateNetwork: Stack %s already exists in %s/%s as %s", networkName, cloudSiteId, tenantId, heatStack.getCanonicalName()); logger.error("{} {} {}", MessageEnum.RA_NETWORK_ALREADY_EXIST, - MsoLogger.ErrorCode.DataError.getValue(), error); + ErrorCode.DataError.getValue(), error); throw new NetworkException(error, MsoExceptionCategory.USERDATA); } else { // Populate the outputs from the existing stack. @@ -454,7 +454,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } subnetIdMap.value = sMap; logger.warn("{} {} Found Existing network stack, status={} networkName={} for {}/{}", - MessageEnum.RA_NETWORK_ALREADY_EXIST, MsoLogger.ErrorCode.DataError.getValue(), + MessageEnum.RA_NETWORK_ALREADY_EXIST, ErrorCode.DataError.getValue(), heatStack.getStatus(), networkName, cloudSiteId, tenantId); } return; @@ -479,7 +479,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } catch (IllegalArgumentException e) { String error = "Create Network: Configuration Error: " + e.getMessage (); logger.error("{} {} {} ", MessageEnum.RA_CONFIG_EXC, - MsoLogger.ErrorCode.DataError.getValue(), error,e); + ErrorCode.DataError.getValue(), error,e); // Input parameters were not valid throw new NetworkException (error, MsoExceptionCategory.INTERNAL); } @@ -498,7 +498,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { me.addContext (CREATE_NETWORK_CONTEXT); logger .error("{} {} Exception Create Network, merging subnets for network (heat) type {} in {}/{} ", - MessageEnum.RA_CREATE_NETWORK_EXC, MsoLogger.ErrorCode.DataError.getValue(), + MessageEnum.RA_CREATE_NETWORK_EXC, ErrorCode.DataError.getValue(), neutronNetworkType.toString(), cloudSiteId, tenantId, me); throw new NetworkException (me); } @@ -510,7 +510,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } catch (MsoException me) { me.addContext (CREATE_NETWORK_CONTEXT); logger.error("{} {} Exception Create Network, merging policyRefs type {} in {}/{} ", - MessageEnum.RA_CREATE_NETWORK_EXC, MsoLogger.ErrorCode.DataError.getValue(), + MessageEnum.RA_CREATE_NETWORK_EXC, ErrorCode.DataError.getValue(), neutronNetworkType.toString(), cloudSiteId, tenantId, me); throw new NetworkException (me); } @@ -522,7 +522,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } catch (MsoException me) { me.addContext (CREATE_NETWORK_CONTEXT); logger.error("{} {} Exception Create Network, merging routeTableRefs type {} in {}/{} ", - MessageEnum.RA_CREATE_NETWORK_EXC, MsoLogger.ErrorCode.DataError.getValue(), + MessageEnum.RA_CREATE_NETWORK_EXC, ErrorCode.DataError.getValue(), neutronNetworkType.toString(), cloudSiteId, tenantId, me); throw new NetworkException (me); } @@ -548,7 +548,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { me.addContext (CREATE_NETWORK_CONTEXT); logger .error("{} {} Exception creating network type {} in {}/{} ", MessageEnum.RA_CREATE_NETWORK_EXC, - MsoLogger.ErrorCode.DataError.getValue(), networkName, cloudSiteId, tenantId, me); + ErrorCode.DataError.getValue(), networkName, cloudSiteId, tenantId, me); throw new NetworkException (me); } @@ -729,7 +729,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { String error = String.format( "UpdateNetwork: Configuration Error. Stack %s in %s/%s: CloudSite does not exist in MSO Configuration", networkName, cloudSiteId, tenantId); - logger.error("{} {} {}", MessageEnum.RA_CONFIG_EXC, MsoLogger.ErrorCode.DataError.getValue(), error); + logger.error("{} {} {}", MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error); // Set the detailed error as the Exception 'message' throw new NetworkException(error, MsoExceptionCategory.USERDATA); } @@ -763,7 +763,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } catch (MsoException me) { me.addContext(UPDATE_NETWORK_CONTEXT); logger.error("{} {} Exception - queryNetwork query {} in {}/{} ", MessageEnum.RA_QUERY_NETWORK_EXC, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), networkId, cloudSiteId, tenantId, me); + ErrorCode.BusinessProcesssError.getValue(), networkId, cloudSiteId, tenantId, me); throw new NetworkException(me); } @@ -771,7 +771,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { String error = String .format("Update Nework: Network %s does not exist in %s/%s", networkId, cloudSiteId, tenantId); logger.error("{} {} {}", MessageEnum.RA_NETWORK_NOT_FOUND, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), error); + ErrorCode.BusinessProcesssError.getValue(), error); // Does not exist. Throw an exception (can't update a non-existent network) throw new NetworkException(error, MsoExceptionCategory.USERDATA); } @@ -786,7 +786,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } catch (MsoException me) { me.addContext(UPDATE_NETWORK_CONTEXT); logger.error("{} {} Exception - updateNetwork {} in {}/{} ", MessageEnum.RA_UPDATE_NETWORK_ERR, - MsoLogger.ErrorCode.DataError.getValue(), networkId, cloudSiteId, tenantId, me); + ErrorCode.DataError.getValue(), networkId, cloudSiteId, tenantId, me); throw new NetworkException(me); } @@ -811,14 +811,14 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } catch (MsoException me) { me.addContext(UPDATE_NETWORK_CONTEXT); logger.error("{} {} Exception - QueryStack query {} in {}/{} ", MessageEnum.RA_QUERY_NETWORK_EXC, - MsoLogger.ErrorCode.DataError.getValue(), networkId, cloudSiteId, tenantId, me); + ErrorCode.DataError.getValue(), networkId, cloudSiteId, tenantId, me); throw new NetworkException(me); } if (heatStack == null || (heatStack.getStatus() == HeatStatus.NOTFOUND)) { String error = String .format("UpdateNetwork: Stack %s does not exist in %s/%s", networkName, cloudSiteId, tenantId); - logger.error("{} {} {}", MessageEnum.RA_NETWORK_NOT_FOUND, MsoLogger.ErrorCode.DataError.getValue(), + logger.error("{} {} {}", MessageEnum.RA_NETWORK_NOT_FOUND, ErrorCode.DataError.getValue(), error); // Network stack does not exist. Return an error throw new NetworkException(error, MsoExceptionCategory.USERDATA); @@ -838,7 +838,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { previousVlans.add(Integer.parseInt(vlan)); } catch (NumberFormatException e) { logger.warn("{} {} Exception - VLAN parse for params {} ", MessageEnum.RA_VLAN_PARSE, - MsoLogger.ErrorCode.DataError.getValue(), vlansParam, e); + ErrorCode.DataError.getValue(), vlansParam, e); } } } @@ -850,7 +850,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { HeatTemplate heatTemplate = networkResource.getHeatTemplate(); if (heatTemplate == null) { String error = "Network error - undefined Heat Template. Network Type=" + networkType; - logger.error("{} {} {}", MessageEnum.RA_PARAM_NOT_FOUND, MsoLogger.ErrorCode.DataError.getValue(), + logger.error("{} {} {}", MessageEnum.RA_PARAM_NOT_FOUND, ErrorCode.DataError.getValue(), error); throw new NetworkException(error, MsoExceptionCategory.INTERNAL); } @@ -885,7 +885,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { stackParams = heat.validateStackParams(stackParams, heatTemplate); } catch (IllegalArgumentException e) { String error = "UpdateNetwork: Configuration Error: Network Type=" + networkType; - logger.error("{} {} {} ", MessageEnum.RA_CONFIG_EXC, MsoLogger.ErrorCode.DataError.getValue(), error); + logger.error("{} {} {} ", MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error); throw new NetworkException(error, MsoExceptionCategory.INTERNAL, e); } @@ -899,7 +899,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } catch (MsoException me) { me.addContext(UPDATE_NETWORK_CONTEXT); logger.error("{} {} Exception - UpdateNetwork mergeSubnets for network type {} in {}/{} ", - MessageEnum.RA_UPDATE_NETWORK_ERR, MsoLogger.ErrorCode.DataError.getValue(), + MessageEnum.RA_UPDATE_NETWORK_ERR, ErrorCode.DataError.getValue(), neutronNetworkType.toString(), cloudSiteId, tenantId, me); throw new NetworkException(me); } @@ -911,7 +911,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } catch (MsoException me) { me.addContext(UPDATE_NETWORK_CONTEXT); logger.error("{} {} Exception - UpdateNetwork mergePolicyRefs type {} in {}/{} ", - MessageEnum.RA_UPDATE_NETWORK_ERR, MsoLogger.ErrorCode.DataError.getValue(), + MessageEnum.RA_UPDATE_NETWORK_ERR, ErrorCode.DataError.getValue(), neutronNetworkType.toString(), cloudSiteId, tenantId, me); throw new NetworkException(me); } @@ -923,7 +923,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } catch (MsoException me) { me.addContext(UPDATE_NETWORK_CONTEXT); logger.error("{} {} Exception - UpdateNetwork mergeRouteTableRefs type {} in {}/{} ", - MessageEnum.RA_UPDATE_NETWORK_ERR, MsoLogger.ErrorCode.DataError.getValue(), + MessageEnum.RA_UPDATE_NETWORK_ERR, ErrorCode.DataError.getValue(), neutronNetworkType.toString(), cloudSiteId, tenantId, me); throw new NetworkException(me); } @@ -943,7 +943,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } catch (MsoException me) { me.addContext(UPDATE_NETWORK_CONTEXT); logger.error("{} {} Exception - update network {} in {}/{} ", MessageEnum.RA_UPDATE_NETWORK_ERR, - MsoLogger.ErrorCode.DataError.getValue(), networkId, cloudSiteId, tenantId, me); + ErrorCode.DataError.getValue(), networkId, cloudSiteId, tenantId, me); throw new NetworkException(me); } @@ -1026,7 +1026,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { String error = String.format( "Create/UpdateNetwork: Unable to get network resource with NetworkType: %s or ModelCustomizationUUID:%s", networkType, modelCustomizationUuid); - logger.error("{} {} {} ", MessageEnum.RA_UNKOWN_PARAM, MsoLogger.ErrorCode.DataError.getValue(), error); + logger.error("{} {} {} ", MessageEnum.RA_UNKOWN_PARAM, ErrorCode.DataError.getValue(), error); throw new NetworkException(error, MsoExceptionCategory.USERDATA); } @@ -1040,7 +1040,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { if (!("HEAT".equals(mode) || NEUTRON_MODE.equals(mode))) { String error = "CreateNetwork: Configuration Error: Network Type = " + networkType; logger.error("{} {} {}", MessageEnum.RA_NETWORK_ORCHE_MODE_NOT_SUPPORT, - MsoLogger.ErrorCode.DataError.getValue(), error); + ErrorCode.DataError.getValue(), error); throw new NetworkException(error, MsoExceptionCategory.INTERNAL); } @@ -1063,7 +1063,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { .format("Network Type:%s Version_Min:%s Version_Max:%s not supported on Cloud:%s with AIC_Version:%s", networkType, networkType, networkResource.getAicVersionMin(), networkResource.getAicVersionMax(), cloudSiteId, cloudSite.getCloudVersion()); - logger.error("{} {} {} ", MessageEnum.RA_CONFIG_EXC, MsoLogger.ErrorCode.DataError.getValue(), error); + logger.error("{} {} {} ", MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error); throw new NetworkException(error, MsoExceptionCategory.USERDATA); } @@ -1072,7 +1072,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { networkName, physicalNetworkName, vlans, routeTargets); if (!missing.isEmpty()) { String error = "Create Network: Missing parameters: " + missing; - logger.error("{} {} {}", MessageEnum.RA_MISSING_PARAM, MsoLogger.ErrorCode.DataError.getValue(), error); + logger.error("{} {} {}", MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error); throw new NetworkException(error, MsoExceptionCategory.USERDATA); } @@ -1157,7 +1157,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { || commonUtils.isNullOrEmpty(networkNameOrId)) { String error = "Missing mandatory parameter cloudSiteId, tenantId or networkId"; - logger.error("{} {} {}", MessageEnum.RA_MISSING_PARAM, MsoLogger.ErrorCode.DataError.getValue(), error); + logger.error("{} {} {}", MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error); throw new NetworkException (error, MsoExceptionCategory.USERDATA); } @@ -1167,7 +1167,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { String error = String .format("Configuration Error. Stack %s in %s/%s: CloudSite does not exist in MSO Configuration", networkNameOrId, cloudSiteId, tenantId); - logger.error("{} {} {}", MessageEnum.RA_CONFIG_EXC, MsoLogger.ErrorCode.DataError.getValue(), error); + logger.error("{} {} {}", MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error); // Set the detailed error as the Exception 'message' throw new NetworkException (error, MsoExceptionCategory.USERDATA); } @@ -1184,7 +1184,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } catch (MsoException me) { me.addContext ("QueryNetwork"); logger.error("{} {} Exception - Query Network (heat): {} in {}/{} ", MessageEnum.RA_QUERY_NETWORK_EXC, - MsoLogger.ErrorCode.DataError.getValue(), networkNameOrId, cloudSiteId, tenantId, me); + ErrorCode.DataError.getValue(), networkNameOrId, cloudSiteId, tenantId, me); throw new NetworkException (me); } @@ -1252,7 +1252,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } catch (MsoException me) { me.addContext ("QueryNetwork"); logger.error("{} {} Exception - Query Network (neutron): {} in {}/{} ", MessageEnum.RA_QUERY_NETWORK_EXC, - MsoLogger.ErrorCode.DataError.getValue(), networkNameOrId, cloudSiteId, tenantId, me); + ErrorCode.DataError.getValue(), networkNameOrId, cloudSiteId, tenantId, me); throw new NetworkException (me); } return; @@ -1295,7 +1295,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { || commonUtils.isNullOrEmpty(tenantId) || commonUtils.isNullOrEmpty(networkId)) { String error = "Missing mandatory parameter cloudSiteId, tenantId or networkId"; - logger.error("{} {} {} ", MessageEnum.RA_MISSING_PARAM, MsoLogger.ErrorCode.DataError.getValue(), error); + logger.error("{} {} {} ", MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error); throw new NetworkException (error, MsoExceptionCategory.USERDATA); } @@ -1332,7 +1332,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } catch (MsoException me) { me.addContext ("DeleteNetwork"); logger.error("{} {} Delete Network (neutron): {} in {}/{} ", MessageEnum.RA_DELETE_NETWORK_EXC, - MsoLogger.ErrorCode.DataError.getValue(), networkId, cloudSiteId, tenantId, me); + ErrorCode.DataError.getValue(), networkId, cloudSiteId, tenantId, me); throw new NetworkException (me); } } else { // DEFAULT to ("HEAT".equals (mode)) @@ -1355,7 +1355,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } catch (MsoException me) { me.addContext ("DeleteNetwork"); logger.error("{} {} Delete Network (heat): {} in {}/{} ", MessageEnum.RA_DELETE_NETWORK_EXC, - MsoLogger.ErrorCode.DataError.getValue(), networkId, cloudSiteId, tenantId, me); + ErrorCode.DataError.getValue(), networkId, cloudSiteId, tenantId, me); throw new NetworkException (me); } } @@ -1381,7 +1381,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { if (rollback == null) { logger - .error("{} {} rollback is null", MessageEnum.RA_ROLLBACK_NULL, MsoLogger.ErrorCode.DataError.getValue()); + .error("{} {} rollback is null", MessageEnum.RA_ROLLBACK_NULL, ErrorCode.DataError.getValue()); return; } @@ -1422,7 +1422,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } catch (MsoException me) { me.addContext ("RollbackNetwork"); logger.error("{} {} Exception - Rollback Network (neutron): {} in {}/{} ", - MessageEnum.RA_DELETE_NETWORK_EXC, MsoLogger.ErrorCode.BusinessProcesssError.getValue(), + MessageEnum.RA_DELETE_NETWORK_EXC, ErrorCode.BusinessProcesssError.getValue(), networkId, cloudSiteId, tenantId, me); throw new NetworkException (me); } @@ -1435,7 +1435,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } catch (MsoException me) { me.addContext ("RollbackNetwork"); logger.error("{} {} Exception - Rollback Network (heat): {} in {}/{} ", - MessageEnum.RA_DELETE_NETWORK_EXC, MsoLogger.ErrorCode.BusinessProcesssError.getValue(), + MessageEnum.RA_DELETE_NETWORK_EXC, ErrorCode.BusinessProcesssError.getValue(), networkId, cloudSiteId, tenantId, me); throw new NetworkException (me); } @@ -1619,7 +1619,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { catch (Exception e) { String error = "Error creating JsonNode for policyRefs Data"; - logger.error("{} {} {} ", MessageEnum.RA_MARSHING_ERROR, MsoLogger.ErrorCode.BusinessProcesssError.getValue(), + logger.error("{} {} {} ", MessageEnum.RA_MARSHING_ERROR, ErrorCode.BusinessProcesssError.getValue(), error, e); throw new MsoAdapterException (error); } @@ -1742,7 +1742,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { catch (Exception e) { String error = "Error creating JsonNode from input subnets"; - logger.error("{} {} {} ", MessageEnum.RA_MARSHING_ERROR, MsoLogger.ErrorCode.DataError.getValue(), error, e); + logger.error("{} {} {} ", MessageEnum.RA_MARSHING_ERROR, ErrorCode.DataError.getValue(), error, e); throw new MsoAdapterException (error); } //update parameters @@ -1795,7 +1795,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { curR = curR.replace ("%subnetId%", subnet.getSubnetId ()); } else { String error = "Missing Required AAI SubnetId for subnet in HEAT Template"; - logger.error("{} {} {} ", MessageEnum.RA_MISSING_PARAM, MsoLogger.ErrorCode.DataError.getValue(), error); + logger.error("{} {} {} ", MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error); throw new MsoAdapterException (error); } @@ -1809,7 +1809,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { curR = curR.replace ("%cidr%", subnet.getCidr ()); } else { String error = "Missing Required cidr for subnet in HEAT Template"; - logger.error("{} {} {} ", MessageEnum.RA_MISSING_PARAM, MsoLogger.ErrorCode.DataError.getValue(), error); + logger.error("{} {} {} ", MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error); throw new MsoAdapterException (error); } @@ -1892,7 +1892,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { catch (Exception e) { logger.error("{} {} Exception getting subnet-uuids ", MessageEnum.RA_MARSHING_ERROR, - MsoLogger.ErrorCode.DataError.getValue(), e); + ErrorCode.DataError.getValue(), e); } logger.debug("Return sMap {}", sMap.toString()); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java index 253f13d57d..4a6d591977 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java @@ -66,8 +66,8 @@ import org.onap.so.adapters.nwrest.UpdateNetworkRequest; import org.onap.so.adapters.nwrest.UpdateNetworkResponse; import org.onap.so.adapters.vnf.BpelRestClient; import org.onap.so.entity.MsoRequest; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.NetworkRollback; import org.onap.so.openstack.beans.NetworkStatus; import org.onap.so.openstack.beans.RouteTarget; @@ -126,7 +126,7 @@ public class NetworkAdapterRest { } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller logger.error("{} {} Exception while create network ", MessageEnum.RA_CREATE_NETWORK_EXC, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcesssError.getValue(), e); return Response.serverError().build(); } // send sync response (ACK) to caller @@ -324,7 +324,7 @@ public class NetworkAdapterRest { } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller logger.error("{} {} Exception while delete network ", MessageEnum.RA_DELETE_NETWORK_EXC, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcesssError.getValue(), e); return Response.serverError().build(); } // send sync response (ACK) to caller @@ -450,7 +450,7 @@ public class NetworkAdapterRest { .build(); } catch (NetworkException e) { logger.error("{} {} Exception when query VNF ", MessageEnum.RA_QUERY_VNF_ERR, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcesssError.getValue(), e); QueryNetworkError err = new QueryNetworkError(); err.setMessage(e.getMessage()); err.setCategory(MsoExceptionCategory.INTERNAL); @@ -493,7 +493,7 @@ public class NetworkAdapterRest { } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller logger.error("{} {} Exception in rollbackNetwork ", MessageEnum.RA_ROLLBACK_NULL, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcesssError.getValue(), e); return Response.serverError().build(); } // send sync response (ACK) to caller @@ -588,7 +588,7 @@ public class NetworkAdapterRest { } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller logger.error("{} {} Exception in updateNetwork ", MessageEnum.RA_UPDATE_NETWORK_ERR, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcesssError.getValue(), e); return Response.serverError().build(); } // send sync response (ACK) to caller diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java index f46a95df91..ceae1caca6 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java @@ -33,8 +33,8 @@ import org.onap.so.adapters.tenant.exceptions.TenantAlreadyExists; import org.onap.so.adapters.tenant.exceptions.TenantException; import org.onap.so.adapters.tenantrest.TenantRollback; import org.onap.so.entity.MsoRequest; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.MsoTenant; import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound; import org.onap.so.openstack.exceptions.MsoException; @@ -101,7 +101,7 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter { tUtils = tFactory.getTenantUtils (cloudSiteId); } catch (MsoCloudSiteNotFound me) { logger.error("{} {} no implementation found for {}: ", MessageEnum.RA_CREATE_TENANT_ERR, - MsoLogger.ErrorCode.DataError.getValue(), cloudSiteId, me); + ErrorCode.DataError.getValue(), cloudSiteId, me); throw new TenantException (me); } @@ -111,7 +111,7 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter { newTenant = tUtils.queryTenantByName (tenantName, cloudSiteId); } catch (MsoException me) { logger.error(OPENSTACK_COMMUNICATE_EXCEPTION_MSG, MessageEnum.RA_CREATE_TENANT_ERR, - MsoLogger.ErrorCode.DataError.getValue(), me); + ErrorCode.DataError.getValue(), me); throw new TenantException (me); } if (newTenant == null) { @@ -120,7 +120,7 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter { try { newTenantId = tUtils.createTenant (tenantName, cloudSiteId, metadata, backout.booleanValue ()); } catch (MsoException me) { - logger.error (OPENSTACK_COMMUNICATE_EXCEPTION_MSG, MessageEnum.RA_CREATE_TENANT_ERR, MsoLogger.ErrorCode.DataError.getValue(), me); + logger.error (OPENSTACK_COMMUNICATE_EXCEPTION_MSG, MessageEnum.RA_CREATE_TENANT_ERR, ErrorCode.DataError.getValue(), me); throw new TenantException (me); } tenantRollback.setTenantId (newTenantId); @@ -129,7 +129,7 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter { } else { if (failIfExists != null && failIfExists) { logger.error("{} {} CreateTenant: Tenant {} already exists in {} ", MessageEnum.RA_TENANT_ALREADY_EXIST, - MsoLogger.ErrorCode.DataError.getValue(), tenantName, cloudSiteId); + ErrorCode.DataError.getValue(), tenantName, cloudSiteId); throw new TenantAlreadyExists (tenantName, cloudSiteId, newTenant.getTenantId ()); } @@ -159,7 +159,7 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter { tUtils = tFactory.getTenantUtils (cloudSiteId); } catch (MsoCloudSiteNotFound me) { logger.error("{} {} no implementation found for {}: ", MessageEnum.RA_CREATE_TENANT_ERR, - MsoLogger.ErrorCode.DataError.getValue(), cloudSiteId, me); + ErrorCode.DataError.getValue(), cloudSiteId, me); throw new TenantException (me); } @@ -184,7 +184,7 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter { } } catch (MsoException me) { logger.error("Exception in queryTenant for {}: ", MessageEnum.RA_GENERAL_EXCEPTION, - MsoLogger.ErrorCode.DataError.getValue(), tenantNameOrId, me); + ErrorCode.DataError.getValue(), tenantNameOrId, me); throw new TenantException (me); } return; @@ -206,7 +206,7 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter { tenantDeleted.value = deleted; } catch (MsoException me) { logger.error("{} {} Exception - DeleteTenant {}: ", MessageEnum.RA_DELETE_TEMAMT_ERR, - MsoLogger.ErrorCode.DataError.getValue(), tenantId, me); + ErrorCode.DataError.getValue(), tenantId, me); throw new TenantException (me); } @@ -228,7 +228,7 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter { // rollback may be null (e.g. if stack already existed when Create was called) if (rollback == null) { logger.warn("{} {} rollbackTenant, rollback is null", MessageEnum.RA_ROLLBACK_NULL, - MsoLogger.ErrorCode.DataError.getValue()); + ErrorCode.DataError.getValue()); return; } @@ -247,7 +247,7 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter { me.addContext (ROLLBACK_TENANT); // Failed to delete the tenant. logger.error("{} {} Exception - rollbackTenant {}: ", MessageEnum.RA_ROLLBACK_TENANT_ERR, - MsoLogger.ErrorCode.DataError.getValue(), tenantId, me); + ErrorCode.DataError.getValue(), tenantId, me); throw new TenantException (me); } } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java index 8a5a083c63..1601de064d 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java @@ -37,8 +37,8 @@ import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.onap.so.utils.CryptoUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -221,7 +221,7 @@ public class BpelRestClient { if (totalretries >= retryCount) { debug("Retried " + totalretries + " times, giving up."); logger.error("{} {} Could not deliver response to BPEL after {} tries: {}", MessageEnum.RA_SEND_VNF_NOTIF_ERR, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), totalretries, toBpelStr); + ErrorCode.BusinessProcesssError.getValue(), totalretries, toBpelStr); return false; } totalretries++; @@ -278,7 +278,7 @@ public class BpelRestClient { } } catch (Exception e) { logger.error("{} {} Exception - Error sending Bpel notification: {} ", MessageEnum.RA_SEND_VNF_NOTIF_ERR, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), toBpelStr, e); + ErrorCode.BusinessProcesssError.getValue(), toBpelStr, e); lastResponseCode = 900; lastResponse = ""; } 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 cf52280b3f..fce14c718b 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 @@ -44,8 +44,8 @@ import org.onap.so.adapters.vnf.async.client.VnfAdapterNotify; 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.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.VnfRollback; import org.onap.so.openstack.beans.VnfStatus; import org.onap.so.utils.CryptoUtils; @@ -159,7 +159,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { vnfRollback); } catch (VnfException e) { logger.error("{} {} VnfException in createVnfA ", MessageEnum.RA_CREATE_VNF_ERR, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcesssError.getValue(), e); org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null; String eMsg = null; try { @@ -169,7 +169,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { .name ()); } catch (Exception e1) { logger.error("{} {} Exception - Fault info ", MessageEnum.RA_FAULT_INFO_EXC, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1); + ErrorCode.BusinessProcesssError.getValue(), e1); } // Build and send Asynchronous error response try { @@ -177,7 +177,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { notifyPort.createVnfNotification (messageId, false, exCat, eMsg, null, null, null); } catch (Exception e1) { logger.error("{} {} Exception sending createVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1); + ErrorCode.BusinessProcesssError.getValue(), e1); } logger.info("{}", MessageEnum.RA_ASYNC_CREATE_VNF_COMPLETE); return; @@ -195,7 +195,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { copyVrb (vnfRollback)); } catch (Exception e) { logger.error("{} {} Exception sending createVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcesssError.getValue(), e); } logger.info("{} createVnfA", MessageEnum.RA_ASYNC_CREATE_VNF_COMPLETE); return; @@ -228,7 +228,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { vnfAdapter.updateVnf (cloudSiteId, tenantId, vnfType,vnfVersion, vnfName, requestType, volumeGroupHeatStackId, inputs, msoRequest, outputs, vnfRollback); } catch (VnfException e) { logger.error("{} {} Exception sending updateVnf notification ", MessageEnum.RA_UPDATE_VNF_ERR, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcesssError.getValue(), e); org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null; String eMsg = null; try { @@ -238,7 +238,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { .name ()); } catch (Exception e1) { logger.error("{} {} Exception - fault info ", MessageEnum.RA_FAULT_INFO_EXC, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1); + ErrorCode.BusinessProcesssError.getValue(), e1); } // Build and send Asynchronous error response try { @@ -246,7 +246,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { notifyPort.updateVnfNotification (messageId, false, exCat, eMsg, null, null); } catch (Exception e1) { logger.error("{} {} Exception sending updateVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1); + ErrorCode.BusinessProcesssError.getValue(), e1); } logger.info("{} UpdateVnfA", MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE); return; @@ -263,7 +263,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { copyVrb (vnfRollback)); } catch (Exception e) { logger.error("{} {} Exception sending updateVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcesssError.getValue(), e); } logger.info("{} UpdateVnfA", MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE); return; @@ -306,7 +306,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { vnfAdapter.queryVnf (cloudSiteId, tenantId, vnfName, msoRequest, vnfExists, vnfId, status, outputs); } catch (VnfException e) { logger.error("{} {} Exception sending queryVnfA notification ", MessageEnum.RA_QUERY_VNF_ERR, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcesssError.getValue(), e); org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null; String eMsg = null; try { @@ -316,7 +316,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { .name ()); } catch (Exception e1) { logger.error("{} {} Exception - fault info ", MessageEnum.RA_FAULT_INFO_EXC, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1); + ErrorCode.BusinessProcesssError.getValue(), e1); } // Build and send Asynchronous error response try { @@ -324,7 +324,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { notifyPort.queryVnfNotification (messageId, false, exCat, eMsg, null, null, null, null); } catch (Exception e1) { logger.error("{} {} Exception sending queryVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1); + ErrorCode.BusinessProcesssError.getValue(), e1); } logger.info("{} queryVnfA", MessageEnum.RA_ASYNC_QUERY_VNF_COMPLETE); return; @@ -349,7 +349,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { copyQueryOutputs (outputs)); } catch (Exception e) { logger.error("{} {} Exception sending queryVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcesssError.getValue(), e); } logger.info("{} queryVnfA", MessageEnum.RA_ASYNC_QUERY_VNF_COMPLETE); @@ -386,7 +386,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { vnfAdapter.deleteVnf (cloudSiteId, tenantId, vnfName, msoRequest); } catch (VnfException e) { logger.error("{} {} Exception sending deleteVnfA notification ", MessageEnum.RA_DELETE_VNF_ERR, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcesssError.getValue(), e); org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null; String eMsg = null; try { @@ -396,7 +396,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { .name ()); } catch (Exception e1) { logger.error("{} {} Exception - fault info ", MessageEnum.RA_FAULT_INFO_EXC, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1); + ErrorCode.BusinessProcesssError.getValue(), e1); } // Build and send Asynchronous error response try { @@ -404,7 +404,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { notifyPort.deleteVnfNotification (messageId, false, exCat, eMsg); } catch (Exception e1) { logger.error("{} {} Exception sending deleteVnfA notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1); + ErrorCode.BusinessProcesssError.getValue(), e1); } logger.info("{} deleteVnfA", MessageEnum.RA_ASYNC_DELETE_VNF_COMPLETE); return; @@ -418,7 +418,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { } catch (Exception e) { logger.error("{} {} Exception sending deleteVnfA notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcesssError.getValue(), e); } logger.info("{} deleteVnfA", MessageEnum.RA_ASYNC_DELETE_VNF_COMPLETE); @@ -448,7 +448,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { vnfAdapter.rollbackVnf (rollback); } catch (VnfException e) { logger.error("{} {} Exception sending rollbackVnfA notification ", MessageEnum.RA_ROLLBACK_VNF_ERR, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcesssError.getValue(), e); org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null; String eMsg = null; try { @@ -458,7 +458,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { .name ()); } catch (Exception e1) { logger.error("{} {} Exception - fault info ", MessageEnum.RA_FAULT_INFO_EXC, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1); + ErrorCode.BusinessProcesssError.getValue(), e1); } // Build and send Asynchronous error response try { @@ -466,7 +466,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { notifyPort.rollbackVnfNotification (messageId, false, exCat, eMsg); } catch (Exception e1) { logger.error("{} {} Exception sending rollbackVnfA notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1); + ErrorCode.BusinessProcesssError.getValue(), e1); } logger.info("{} rollbackVnfA", MessageEnum.RA_ASYNC_ROLLBACK_VNF_COMPLETE); return; @@ -479,7 +479,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { notifyPort.rollbackVnfNotification (messageId, true, null, null); } catch (Exception e) { logger.error("{} {} Exception sending rollbackVnfA notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcesssError.getValue(), e); } logger.info("{} rollbackVnfA", MessageEnum.RA_ASYNC_ROLLBACK_VNF_COMPLETE); @@ -575,17 +575,17 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { warWsdlLoc = Thread.currentThread ().getContextClassLoader ().getResource ("VnfAdapterNotify.wsdl"); } catch (Exception e) { logger.error("{} {} Exception - WSDL not found ", MessageEnum.RA_WSDL_NOT_FOUND, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcesssError.getValue(), e); } if (warWsdlLoc == null) { logger.error("{} {} WSDL not found", MessageEnum.RA_WSDL_NOT_FOUND, - MsoLogger.ErrorCode.BusinessProcesssError.getValue()); + ErrorCode.BusinessProcesssError.getValue()); } else { try { logger.debug("VnfAdpaterNotify.wsdl location:{}", warWsdlLoc.toURI().toString()); } catch (Exception e) { logger.error("{} {} Exception - WSDL URL convention ", MessageEnum.RA_WSDL_URL_CONVENTION_EXC, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcesssError.getValue(), e); } } @@ -602,7 +602,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { epUrl = new URL (notificationUrl); } catch (MalformedURLException e1) { logger.error("{} {} MalformedURLException ", MessageEnum.RA_INIT_NOTIF_EXC, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1); + ErrorCode.BusinessProcesssError.getValue(), e1); } if(null != epUrl) { @@ -625,7 +625,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { headers.put ("Authorization", Collections.singletonList (basicAuth)); } catch (Exception e) { logger.error("{} {} Exception - Unable to set authorization in callback request ", - MessageEnum.RA_SET_CALLBACK_AUTH_EXC, MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); + MessageEnum.RA_SET_CALLBACK_AUTH_EXC, ErrorCode.BusinessProcesssError.getValue(), e); } 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 4d915f9e84..af09e5ac0c 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 @@ -53,9 +53,9 @@ import org.onap.so.db.catalog.data.repository.VFModuleCustomizationRepository; 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.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.HeatStatus; import org.onap.so.openstack.beans.StackInfo; import org.onap.so.openstack.beans.VnfRollback; @@ -274,7 +274,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { Holder <Map <String, String>> outputs, Holder <VnfRollback> rollback) throws VnfException { // As of 1707 - this method should no longer be called - MsoLogger.setLogContext (msoRequest.getRequestId (), msoRequest.getServiceInstanceId ()); logger.debug("UpdateVnf called?? This should not be called any longer - update vfModule"); } @@ -318,7 +317,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // Convert to a generic VnfException String error = "Query VNF: " + vnfName + " in " + cloudSiteId + "/" + tenantId + ": " + me; logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudSiteId, - tenantId, "OpenStack", "QueryVNF", MsoLogger.ErrorCode.DataError.getValue(), "Exception - queryStack", + tenantId, "OpenStack", "QueryVNF", ErrorCode.DataError.getValue(), "Exception - queryStack", me); logger.debug(error); throw new VnfException (me); @@ -379,7 +378,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // Convert to a generic VnfException String error = "Delete VNF: " + vnfName + " in " + cloudSiteId + "/" + tenantId + ": " + me; logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudSiteId, - tenantId, "OpenStack", "DeleteVNF", MsoLogger.ErrorCode.DataError.getValue(), "Exception - DeleteVNF", + tenantId, "OpenStack", "DeleteVNF", ErrorCode.DataError.getValue(), "Exception - DeleteVNF", me); logger.debug(error); throw new VnfException (me); @@ -423,7 +422,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { me.addContext ("RollbackVNF"); String error = "Rollback VNF: " + vnfId + " in " + cloudSiteId + "/" + tenantId + ": " + me; logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfId, cloudSiteId, - tenantId, "OpenStack", "DeleteStack", MsoLogger.ErrorCode.DataError.getValue(), + tenantId, "OpenStack", "DeleteStack", ErrorCode.DataError.getValue(), "Exception - DeleteStack", me); logger.debug(error); throw new VnfException (me); @@ -653,7 +652,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } catch (MsoException me) { String error = "Create VF Module: Query " + vfModuleName + " in " + cloudSiteId + "/" + tenantId + ": " + me ; logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudSiteId, - tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError.getValue(), "Exception - queryStack", + tenantId, "OpenStack", "queryStack", ErrorCode.DataError.getValue(), "Exception - queryStack", me); logger.debug(error); // Failed to query the Stack due to an openstack exception. @@ -669,7 +668,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // fail - it's in progress - return meaningful error String error = "Create VF: Stack " + vfModuleName + " already exists and has status " + status.toString() + " in " + cloudSiteId + "/" + tenantId + "; please wait for it to complete, or fix manually."; logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, - cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError.getValue(), + cloudSiteId, tenantId, "OpenStack", "queryStack", ErrorCode.DataError.getValue(), "Stack " + vfModuleName + " already exists"); logger.debug(error); throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, heatStack.getCanonicalName ()); @@ -678,7 +677,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // fail - it exists and is in a FAILED state String error = "Create VF: Stack " + vfModuleName + " already exists and is in FAILED state in " + cloudSiteId + "/" + tenantId + "; requires manual intervention."; logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, - cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError.getValue(), + cloudSiteId, tenantId, "OpenStack", "queryStack", ErrorCode.DataError.getValue(), "Stack " + vfModuleName + " already exists and is " + "in FAILED state"); logger.debug(error); throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, heatStack.getCanonicalName ()); @@ -689,7 +688,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { "Create VF: Stack " + vfModuleName + " already exists and has status " + status.toString() + " in " + cloudSiteId + "/" + tenantId + "; requires manual intervention."; logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, - cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError.getValue(), + cloudSiteId, tenantId, "OpenStack", "queryStack", ErrorCode.DataError.getValue(), "Stack " + vfModuleName + " already exists and is " + "in UPDATED or UNKNOWN state"); logger.debug(error); throw new VnfAlreadyExists(vfModuleName, cloudSiteId, tenantId, heatStack.getCanonicalName()); @@ -700,7 +699,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Create VF: Stack " + vfModuleName + " already exists in " + cloudSiteId + "/" + tenantId; logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, - cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError.getValue(), + cloudSiteId, tenantId, "OpenStack", "queryStack", ErrorCode.DataError.getValue(), "Stack " + vfModuleName + " already exists"); logger.debug(error); throw new VnfAlreadyExists(vfModuleName, cloudSiteId, tenantId, heatStack.getCanonicalName()); @@ -730,7 +729,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { me.addContext ("CreateVFModule"); String error = "Create VFModule: Attached heatStack ID Query " + nestedStackId + " in " + cloudSiteId + "/" + tenantId + ": " + me ; logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudSiteId, - tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.BusinessProcesssError.getValue(), + tenantId, "OpenStack", "queryStack", ErrorCode.BusinessProcesssError.getValue(), "MsoException trying to query nested stack", me); logger.debug("ERROR trying to query nested stack= {}", error); throw new VnfException (me); @@ -739,7 +738,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Create VFModule: Attached heatStack ID DOES NOT EXIST " + nestedStackId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR" ; logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudSiteId, tenantId, error, "OpenStack", "queryStack", - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), + ErrorCode.BusinessProcesssError.getValue(), "Create VFModule: Attached heatStack ID " + "DOES NOT EXIST"); logger.debug(error); throw new VnfException (error, MsoExceptionCategory.USERDATA); @@ -764,7 +763,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Create VFModule: Attached baseHeatStack ID Query " + nestedBaseStackId + " in " + cloudSiteId + "/" + tenantId + ": " + me ; logger .error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudSiteId, - tenantId, "OpenStack", "QueryStack", MsoLogger.ErrorCode.BusinessProcesssError.getValue(), + tenantId, "OpenStack", "QueryStack", ErrorCode.BusinessProcesssError.getValue(), "MsoException trying to query nested base stack", me); logger.debug("ERROR trying to query nested base stack= {}", error); throw new VnfException (me); @@ -773,7 +772,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Create VFModule: Attached base heatStack ID DOES NOT EXIST " + nestedBaseStackId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR" ; logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudSiteId, tenantId, error, "OpenStack", "QueryStack", - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), + ErrorCode.BusinessProcesssError.getValue(), "Create VFModule: Attached base heatStack ID DOES NOT EXIST"); logger.debug("Exception occurred", error); throw new VnfException (error, MsoExceptionCategory.USERDATA); @@ -807,7 +806,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Create vfModule error: Unable to find vfModuleCust with modelCustomizationUuid=" + mcu; logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "VF Module ModelCustomizationUuid", modelCustomizationUuid, "OpenStack", - MsoLogger.ErrorCode.DataError.getValue(), + ErrorCode.DataError.getValue(), "Create VF Module: Unable to find vfModule with " + "modelCustomizationUuid=" + mcu); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); @@ -834,7 +833,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { if (vnfResource == null) { String error = "Create VNF: Unknown VNF Type: " + vnfType; logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "VNF Type", vnfType, - "OpenStack", MsoLogger.ErrorCode.DataError.getValue(), "Create VNF: Unknown VNF Type"); + "OpenStack", ErrorCode.DataError.getValue(), "Create VNF: Unknown VNF Type"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); } @@ -904,7 +903,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // ERROR String error = "VNF Resource type: " + vnfResource.getModelName() + ", ModelUuid=" + vnfResource.getModelUUID() + " VersionMin=" + minVersionVnf + " VersionMax:" + maxVersionVnf + " NOT supported on Cloud: " + cloudSiteId + " with AIC_Version:" + cloudSiteOpt.get().getCloudVersion(); logger.error("{} {} {} {} {}", MessageEnum.RA_CONFIG_EXC.toString(), error, "OpenStack", - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion"); + ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); } @@ -947,7 +946,7 @@ 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.toString(), "Heat Template ID", vfModuleType, - "OpenStack", MsoLogger.ErrorCode.DataError.getValue(), error); + "OpenStack", ErrorCode.DataError.getValue(), error); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.INTERNAL); } else { @@ -961,7 +960,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { if (heatEnvironment == null) { String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType; logger.error("{} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID", - "OpenStack", MsoLogger.ErrorCode.DataError.getValue(), error); + "OpenStack", ErrorCode.DataError.getValue(), error); logger.debug(error); throw new VnfException (error, MsoExceptionCategory.INTERNAL); } else { @@ -1140,7 +1139,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // Problem - missing one or more required parameters String error = "Create VFModule: Missing Required inputs: " + missingParams; logger.error("{} {} {} {} {}", MessageEnum.RA_MISSING_PARAM.toString(), missingParams, "OpenStack", - MsoLogger.ErrorCode.DataError.getValue(), "Create VFModule: Missing Required inputs"); + ErrorCode.DataError.getValue(), "Create VFModule: Missing Required inputs"); logger.debug(error); throw new VnfException (error, MsoExceptionCategory.USERDATA); } else { @@ -1213,7 +1212,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Create VF Module " + vfModuleType + " in " + cloudSiteId + "/" + tenantId + ": " + me; logger .error("{} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudSiteId, - tenantId, "OpenStack", MsoLogger.ErrorCode.DataError.getValue(), "MsoException - createStack", + tenantId, "OpenStack", ErrorCode.DataError.getValue(), "MsoException - createStack", me); logger.debug(error); if (isValetEnabled && sendResponseToValet) { @@ -1231,7 +1230,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Create VFModule " + vfModuleType + " in " + cloudSiteId + "/" + tenantId + ": " + npe; logger .error("{} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudSiteId, - tenantId, "OpenStack", MsoLogger.ErrorCode.DataError.getValue(), + tenantId, "OpenStack", ErrorCode.DataError.getValue(), "NullPointerException - createStack", npe); logger.debug(error); logger.debug("NULL POINTER EXCEPTION at heat.createStack"); @@ -1289,7 +1288,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { me.addContext ("DeleteVFModule"); String error = "Delete VFModule: Query to get outputs: " + vnfName + " in " + cloudSiteId + "/" + tenantId + ": " + me; logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudSiteId, - tenantId, "OpenStack", "QueryStack", MsoLogger.ErrorCode.DataError.getValue(), "Exception - QueryStack", + tenantId, "OpenStack", "QueryStack", ErrorCode.DataError.getValue(), "Exception - QueryStack", me); logger.debug(error); throw new VnfException (me); @@ -1318,7 +1317,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // Convert to a generic VnfException String error = "Delete VF: " + vnfName + " in " + cloudSiteId + "/" + tenantId + ": " + me; logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudSiteId, - tenantId, "OpenStack", "DeleteStack", MsoLogger.ErrorCode.DataError.getValue(), + tenantId, "OpenStack", "DeleteStack", ErrorCode.DataError.getValue(), "Exception - deleteStack", me); logger.debug(error); if (isValetEnabled && valetDeleteRequestSucceeded) { @@ -1367,7 +1366,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String vfModuleName = vnfName; String vfModuleType = vnfType; String methodName = "updateVfModule"; - MsoLogger.setLogContext (msoRequest.getRequestId (), msoRequest.getServiceInstanceId ()); String serviceName = VNF_ADAPTER_SERVICE_NAME + methodName; StringBuilder sbInit = new StringBuilder(); @@ -1456,7 +1454,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { me.addContext ("UpdateVFModule"); String error = "Update VFModule: Query " + vfModuleName + " in " + cloudSiteId + "/" + tenantId + ": " + me; logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudSiteId, - tenantId, "OpenStack", "QueryStack", MsoLogger.ErrorCode.DataError.getValue(), "Exception - QueryStack", + tenantId, "OpenStack", "QueryStack", ErrorCode.DataError.getValue(), "Exception - QueryStack", me); logger.debug(error); throw new VnfException (me); @@ -1467,7 +1465,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // Not Found String error = "Update VF: Stack " + vfModuleName + " does not exist in " + cloudSiteId + "/" + tenantId; logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_NOT_EXIST.toString(), vfModuleName, cloudSiteId, - tenantId, "OpenStack", "QueryStack", MsoLogger.ErrorCode.DataError.getValue(), error); + tenantId, "OpenStack", "QueryStack", ErrorCode.DataError.getValue(), error); throw new VnfNotFound (cloudSiteId, tenantId, vfModuleName); } else { logger.debug("Found Existing stack, status={}", heatStack.getStatus()); @@ -1490,7 +1488,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { me.addContext ("UpdateVFModule"); String error = "Update VF: Attached heatStack ID Query " + nestedStackId + " in " + cloudSiteId + "/" + tenantId + ": " + me ; logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudSiteId, - tenantId, "OpenStack", "QueryStack", MsoLogger.ErrorCode.DataError.getValue(), "Exception - " + error, + tenantId, "OpenStack", "QueryStack", ErrorCode.DataError.getValue(), "Exception - " + error, me); logger.debug("ERROR trying to query nested stack= {}", error); throw new VnfException (me); @@ -1498,7 +1496,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { if (nestedHeatStack == null || nestedHeatStack.getStatus() == HeatStatus.NOTFOUND) { String error = "Update VFModule: Attached volume heatStack ID DOES NOT EXIST " + nestedStackId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR" ; logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudSiteId, - tenantId, error, "OpenStack", "QueryStack", MsoLogger.ErrorCode.DataError.getValue(), error); + tenantId, error, "OpenStack", "QueryStack", ErrorCode.DataError.getValue(), error); logger.debug(error); throw new VnfException (error, MsoExceptionCategory.USERDATA); } else { @@ -1522,7 +1520,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Update VFModule: Attached baseHeatStack ID Query " + nestedBaseStackId + " in " + cloudSiteId + "/" + tenantId + ": " + me ; logger .error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudSiteId, - tenantId, "OpenStack", "QueryStack", MsoLogger.ErrorCode.DataError.getValue(), + tenantId, "OpenStack", "QueryStack", ErrorCode.DataError.getValue(), "Exception - " + error, me); logger.debug("ERROR trying to query nested base stack= {}", error); throw new VnfException (me); @@ -1531,7 +1529,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Update VFModule: Attached base heatStack ID DOES NOT EXIST " + nestedBaseStackId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR" ; logger.error ("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudSiteId, tenantId, error, "OpenStack", - "QueryStack", MsoLogger.ErrorCode.DataError.getValue(), error); + "QueryStack", ErrorCode.DataError.getValue(), error); logger.debug(error); throw new VnfException (error, MsoExceptionCategory.USERDATA); } else { @@ -1561,7 +1559,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { if (vf == null) { String error = "Update VfModule: unable to find vfModule with modelCustomizationUuid=" + mcu; logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "VF Module Type", - vfModuleType, "OpenStack", MsoLogger.ErrorCode.DataError.getValue(), error); + vfModuleType, "OpenStack", ErrorCode.DataError.getValue(), error); throw new VnfException(error, MsoExceptionCategory.USERDATA); } logger.debug("Got VF module definition from Catalog: {}", vf.toString()); @@ -1640,7 +1638,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { + minVersionVnf + " VersionMax:" + maxVersionVnf + " NOT supported on Cloud: " + cloudSiteId + " with AIC_Version:" + aicV; logger.error("{} {} {} {} {}", MessageEnum.RA_CONFIG_EXC.toString(), error, "OpenStack", - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion"); + ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); } @@ -1671,7 +1669,7 @@ 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.toString(), "Heat Template ID", vfModuleType, - "OpenStack", MsoLogger.ErrorCode.DataError.getValue(), error); + "OpenStack", ErrorCode.DataError.getValue(), error); throw new VnfException(error, MsoExceptionCategory.INTERNAL); } else { logger.debug("Got HEAT Template from DB: {}", heatTemplate.getHeatTemplate()); @@ -1680,7 +1678,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { if (heatEnvironment == null) { String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType; logger.error("{} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID", - "OpenStack", MsoLogger.ErrorCode.DataError.getValue(), error); + "OpenStack", ErrorCode.DataError.getValue(), error); throw new VnfException (error, MsoExceptionCategory.INTERNAL); } else { logger.debug ("Got Heat Environment from DB: {}", heatEnvironment.getEnvironment()); @@ -1898,7 +1896,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { if (checkRequiredParameters) { String error = "Update VNF: Missing Required inputs: " + missingParams; logger.error("{} {} {} {} {}", MessageEnum.RA_MISSING_PARAM.toString(), missingParams, "OpenStack", - MsoLogger.ErrorCode.DataError.getValue(), error); + ErrorCode.DataError.getValue(), error); throw new VnfException (error, MsoExceptionCategory.USERDATA); } else { logger.debug("found missing parameters - but checkRequiredParameters is false - will not block"); @@ -1920,7 +1918,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { extraParams.removeAll (paramList); if (!extraParams.isEmpty ()) { logger.warn("{} {} {} {} {} {}", MessageEnum.RA_VNF_EXTRA_PARAM.toString(), vnfType, - extraParams.toString(), "OpenStack", MsoLogger.ErrorCode.DataError.getValue(), "Extra params"); + extraParams.toString(), "OpenStack", ErrorCode.DataError.getValue(), "Extra params"); inputs.keySet ().removeAll (extraParams); } } @@ -1991,7 +1989,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Update VFModule " + vfModuleType + " in " + cloudSiteId + "/" + tenantId + ": " + me; logger .error("{} {} {} {} {} {} {}", MessageEnum.RA_UPDATE_VNF_ERR.toString(), vfModuleType, cloudSiteId, - tenantId, "OpenStack", MsoLogger.ErrorCode.DataError.getValue(), "Exception - " + error, me); + tenantId, "OpenStack", ErrorCode.DataError.getValue(), "Exception - " + error, me); if (isValetEnabled && sendResponseToValet) { logger.debug("valet is enabled, the orchestration failed - now sending rollback to valet"); try { 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 833e200ce9..b8be910c43 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,9 +52,9 @@ import org.onap.so.db.catalog.beans.VnfResource; 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.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.MsoTenant; import org.onap.so.openstack.beans.VnfRollback; import org.onap.so.openstack.beans.VnfStatus; @@ -229,7 +229,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { String error = "Query VNF (Cloudify): " + vnfName + " in " + cloudSiteId + "/" + tenantId + ": " + me; logger .error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudSiteId, tenantId, - CLOUDIFY, "QueryVNF", MsoLogger.ErrorCode.DataError.getValue(), "Exception - queryDeployment", me); + CLOUDIFY, "QueryVNF", ErrorCode.DataError.getValue(), "Exception - queryDeployment", me); logger.debug(error); throw new VnfException(me); } @@ -321,7 +321,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { me.addContext ("RollbackVNF"); String error = "Rollback VF Module: " + vfModuleId + " in " + cloudSiteId + "/" + tenantId + ": " + me; logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudSiteId, - tenantId, CLOUDIFY, "DeleteDeployment", MsoLogger.ErrorCode.DataError.getValue(), + tenantId, CLOUDIFY, "DeleteDeployment", ErrorCode.DataError.getValue(), "Exception - DeleteDeployment", me); logger.debug(error); throw new VnfException (me); @@ -576,7 +576,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { logger.debug("Missing required input: modelCustomizationUuid"); String error = "Create vfModule error: Missing required input: modelCustomizationUuid"; logger.error("{} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), - "VF Module ModelCustomizationUuid", CLOUDIFY, MsoLogger.ErrorCode.DataError.getValue(), + "VF Module ModelCustomizationUuid", CLOUDIFY, ErrorCode.DataError.getValue(), "Create VF Module: Missing required input: modelCustomizationUuid"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); @@ -639,7 +639,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { logger.debug(error); logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "VF Module " + "ModelCustomizationUuid", - modelCustomizationUuid, "CatalogDb", MsoLogger.ErrorCode.DataError.getValue(), error); + modelCustomizationUuid, "CatalogDb", ErrorCode.DataError.getValue(), error); throw new VnfException(error, MsoExceptionCategory.USERDATA); } else { logger.debug("Found vfModuleCust entry " + vfmc.toString()); @@ -676,7 +676,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { + " VersionMin=" + vnfMin + " VersionMax:" + vnfMax + " NOT supported on Cloud: " + cloudSiteId + " with AIC_Version:" + cloudSite.getCloudVersion(); logger.error("{} {} {} {} {}", MessageEnum.RA_CONFIG_EXC.toString(), error, "OpenStack", - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion"); + ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); } @@ -695,7 +695,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { // Failed to query the Deployment due to a cloudify exception. String error = "Create VF Module: Query " + vfModuleName + " in " + cloudSiteId + "/" + tenantId + ": " + me ; logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudSiteId, - tenantId, CLOUDIFY, "queryDeployment", MsoLogger.ErrorCode.DataError.getValue(), + tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(), "Exception - queryDeployment", me); logger.debug(error); @@ -715,7 +715,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { if (failIfExists != null && failIfExists) { String error = "Create VF: Deployment " + vfModuleName + " already exists in " + cloudSiteId + "/" + tenantId; logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, - cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", MsoLogger.ErrorCode.DataError.getValue(), + cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(), "Deployment " + vfModuleName + " already exists"); logger.debug(error); throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, cloudifyDeployment.getId()); @@ -733,7 +733,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { // fail - it's in progress - return meaningful error String error = "Create VF: Deployment " + vfModuleName + " already exists and has status " + status.toString() + " in " + cloudSiteId + "/" + tenantId + "; please wait for it to complete, or fix manually."; logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, - cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", MsoLogger.ErrorCode.DataError.getValue(), + cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(), "Deployment " + vfModuleName + " already exists"); logger.debug(error); throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, cloudifyDeployment.getId()); @@ -742,7 +742,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { // fail - it exists and is in a FAILED state String error = "Create VF: Deployment " + vfModuleName + " already exists and is in FAILED state in " + cloudSiteId + "/" + tenantId + "; requires manual intervention."; logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, - cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", MsoLogger.ErrorCode.DataError.getValue(), + cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(), "Deployment " + vfModuleName + " already " + "exists and is in FAILED state"); logger.debug(error); throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, cloudifyDeployment.getId()); @@ -751,7 +751,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { // fail - it exists and is in a UNKNOWN state String error = "Create VF: Deployment " + vfModuleName + " already exists and has status " + status.toString() + " in " + cloudSiteId + "/" + tenantId + "; requires manual intervention."; logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, - cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", MsoLogger.ErrorCode.DataError.getValue(), + cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(), "Deployment " + vfModuleName + " already " + "exists and is in " + status.toString() + " state"); logger.debug(error); throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, cloudifyDeployment.getId()); @@ -762,7 +762,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { "Create VF: Deployment " + vfModuleName + " already exists with unexpected status " + status .toString() + " in " + cloudSiteId + "/" + tenantId + "; requires manual intervention."; logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, - cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", MsoLogger.ErrorCode.DataError.getValue(), + cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(), "Deployment " + vfModuleName + " already " + "exists and is in an unknown state"); logger.debug(error); throw new VnfAlreadyExists(vfModuleName, cloudSiteId, tenantId, cloudifyDeployment.getId()); @@ -786,7 +786,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { String error = "Create VF Module: Query Volume Group " + volumeGroupId + " in " + cloudSiteId + "/" + tenantId + ": " + me ; logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment(volume)", - MsoLogger.ErrorCode.DataError.getValue(), "Exception - queryDeployment(volume)", me); + ErrorCode.DataError.getValue(), "Exception - queryDeployment(volume)", me); logger.debug(error); // Convert to a generic VnfException me.addContext ("CreateVFModule(QueryVolume)"); @@ -799,7 +799,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { + tenantId + " USER ERROR"; logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId, cloudSiteId, tenantId, error, CLOUDIFY, "queryDeployment(volume)", - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), + ErrorCode.BusinessProcesssError.getValue(), "Create VFModule: Attached Volume Group DOES NOT EXIST"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); @@ -839,7 +839,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { + me; logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment(Base)", - MsoLogger.ErrorCode.DataError.getValue(), "Exception - queryDeployment(Base)", me); + ErrorCode.DataError.getValue(), "Exception - queryDeployment(Base)", me); logger.debug(error); // Convert to a generic VnfException me.addContext("CreateVFModule(QueryBase)"); @@ -852,7 +852,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { + tenantId + " USER ERROR"; logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId, cloudSiteId, tenantId, error, CLOUDIFY, "queryDeployment(Base)", - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), + ErrorCode.BusinessProcesssError.getValue(), "Create VFModule: Base " + "Module DOES NOT EXIST"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); @@ -887,7 +887,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType + ", reqType=" + requestType; logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID", vfModuleType, - "OpenStack", MsoLogger.ErrorCode.DataError.getValue(), error); + "OpenStack", ErrorCode.DataError.getValue(), error); throw new VnfException(error, MsoExceptionCategory.INTERNAL); } else { logger.debug("Got HEAT Template from DB: {}", heatTemplate.getHeatTemplate()); @@ -896,7 +896,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { if (heatEnvironment == null) { String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType; logger.error("{} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID", - "OpenStack", MsoLogger.ErrorCode.DataError.getValue(), error); + "OpenStack", ErrorCode.DataError.getValue(), error); // Alarm on this error, configuration must be fixed throw new VnfException(error, MsoExceptionCategory.INTERNAL); } else { @@ -1035,7 +1035,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { // Problem - missing one or more required parameters String error = "Create VFModule: Missing Required inputs: " + missingParams; logger.error("{} {} {} {} {}", MessageEnum.RA_MISSING_PARAM.toString(), missingParams, CLOUDIFY, - MsoLogger.ErrorCode.DataError.getValue(), "Create VFModule: Missing Required inputs"); + ErrorCode.DataError.getValue(), "Create VFModule: Missing Required inputs"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); } else { @@ -1098,7 +1098,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { me.addContext("CreateVFModule"); String error = "Create VF Module: Upload blueprint failed. Blueprint=" + blueprintName + ": " + me; logger.error("{} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudSiteId, - tenantId, CLOUDIFY, MsoLogger.ErrorCode.DataError.getValue(), "MsoException - uploadBlueprint", me); + tenantId, CLOUDIFY, ErrorCode.DataError.getValue(), "MsoException - uploadBlueprint", me); logger.debug(error); throw new VnfException(me); } @@ -1130,7 +1130,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { String error = "Create VF Module " + vfModuleType + " in " + cloudSiteId + "/" + tenantId + ": " + me; logger .error("{} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudSiteId, - tenantId, CLOUDIFY, MsoLogger.ErrorCode.DataError.getValue(), "MsoException - createDeployment", + tenantId, CLOUDIFY, ErrorCode.DataError.getValue(), "MsoException - createDeployment", me); logger.debug(error); throw new VnfException (me); @@ -1138,7 +1138,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { String error = "Create VFModule " + vfModuleType + " in " + cloudSiteId + "/" + tenantId + ": " + npe; logger .error("{} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudSiteId, - tenantId, CLOUDIFY, MsoLogger.ErrorCode.DataError.getValue(), + tenantId, CLOUDIFY, ErrorCode.DataError.getValue(), "NullPointerException - createDeployment", npe); logger.debug(error); logger.debug("NULL POINTER EXCEPTION at cloudify.createAndInstallDeployment"); @@ -1187,7 +1187,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { me.addContext ("DeleteVFModule"); String error = "Delete VFModule: Query to get outputs: " + vnfName + " in " + cloudSiteId + "/" + tenantId + ": " + me; logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudSiteId, - tenantId, CLOUDIFY, "QueryDeployment", MsoLogger.ErrorCode.DataError.getValue(), + tenantId, CLOUDIFY, "QueryDeployment", ErrorCode.DataError.getValue(), "Exception - QueryDeployment", me); logger.debug(error); throw new VnfException (me); @@ -1207,7 +1207,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { // Convert to a generic VnfException String error = "Delete VF: " + vnfName + " in " + cloudSiteId + "/" + tenantId + ": " + me; logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudSiteId, - tenantId, "DeleteDeployment", "DeleteDeployment", MsoLogger.ErrorCode.DataError.getValue(), + tenantId, "DeleteDeployment", "DeleteDeployment", ErrorCode.DataError.getValue(), "Exception - DeleteDeployment: " + me.getMessage()); logger.debug(error); throw new VnfException(me); 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 b1b97b695e..197777c1ae 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 @@ -72,9 +72,9 @@ import org.onap.so.db.catalog.beans.VnfResource; 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.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.VnfRollback; import org.onap.so.openstack.beans.VnfStatus; import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound; @@ -245,7 +245,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { e.addContext("QueryVNF"); String error = "Query VNF (VDU): " + vnfNameOrId + " in " + cloudSiteId + "/" + tenantId + ": " + e; logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfNameOrId, cloudSiteId, - tenantId, "VDU", "QueryVNF", MsoLogger.ErrorCode.DataError.getValue(), "Exception - queryVDU", e); + tenantId, "VDU", "QueryVNF", ErrorCode.DataError.getValue(), "Exception - queryVDU", e); logger.debug(error); throw new VnfException(e); } @@ -336,7 +336,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { ve.addContext ("RollbackVFModule"); String error = "Rollback VF Module: " + vfModuleId + " in " + cloudSiteId + "/" + tenantId + ": " + ve; logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudSiteId, - tenantId, "VDU", "DeleteVdu", MsoLogger.ErrorCode.DataError.getValue(), "Exception - DeleteVdu", ve); + tenantId, "VDU", "DeleteVdu", ErrorCode.DataError.getValue(), "Exception - DeleteVdu", ve); logger.debug(error); throw new VnfException (ve); } @@ -618,7 +618,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { logger.debug("Missing required input: modelCustomizationUuid"); String error = "Create vfModule error: Missing required input: modelCustomizationUuid"; logger.error("{} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), - "VF Module ModelCustomizationUuid", "VDU", MsoLogger.ErrorCode.DataError, + "VF Module ModelCustomizationUuid", "VDU", ErrorCode.DataError, "Create VF Module: " + "Missing required input: modelCustomizationUuid"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); @@ -681,7 +681,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { logger.debug(error); logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "VF Module ModelCustomizationUuid", modelCustomizationUuid, "CatalogDb", - MsoLogger.ErrorCode.DataError, error); + ErrorCode.DataError, error); throw new VnfException(error, MsoExceptionCategory.USERDATA); } else { logger.debug("Found vfModuleCust entry {}", vfModuleCust.toString()); @@ -719,7 +719,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { + " VersionMin=" + vnfMin + " VersionMax:" + vnfMax + " NOT supported on Cloud: " + cloudSiteId + " with AIC_Version:" + cloudSite.getCloudVersion(); logger.error("{} {} {} {} {}", MessageEnum.RA_CONFIG_EXC.toString(), error, "OpenStack", - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion"); + ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); } @@ -743,7 +743,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { // Failed to query the VDU due to a plugin exception. String error = "Create VF Module: Query " + vfModuleName + " in " + cloudSiteId + "/" + tenantId + ": " + me ; logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, - cloudSiteId, tenantId, "VDU", "queryVdu", MsoLogger.ErrorCode.DataError.getValue(), + cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(), "Exception - queryVdu", me); logger.debug(error); // Convert to a generic VnfException @@ -763,7 +763,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { String error = "Create VF: Deployment " + vfModuleName + " already exists in " + cloudSiteId + "/" + tenantId; logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, - cloudSiteId, tenantId, "VDU", "queryVdu", MsoLogger.ErrorCode.DataError.getValue(), + cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(), "VF Module " + vfModuleName + " already exists"); logger.debug(error); throw new VnfAlreadyExists(vfModuleName, cloudSiteId, tenantId, vduInstance.getVduInstanceId()); @@ -784,7 +784,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { "Create VF: Deployment " + vfModuleName + " already exists and has status " + status.toString() + " in " + cloudSiteId + "/" + tenantId + "; please wait for it to complete, or fix manually."; logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, - cloudSiteId, tenantId, "VDU", "queryVdu", MsoLogger.ErrorCode.DataError.getValue(), + cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(), "VF Module " + vfModuleName + " already exists"); logger.debug(error); throw new VnfAlreadyExists(vfModuleName, cloudSiteId, tenantId, vduInstance.getVduInstanceId()); @@ -794,7 +794,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { "Create VF: Deployment " + vfModuleName + " already exists and is in FAILED state in " + cloudSiteId + "/" + tenantId + "; requires manual intervention."; logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, - cloudSiteId, tenantId, "VDU", "queryVdu", MsoLogger.ErrorCode.DataError.getValue(), + cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(), "VF Module " + vfModuleName + " already exists and is in FAILED state"); logger.debug(error); throw new VnfAlreadyExists(vfModuleName, cloudSiteId, tenantId, vduInstance.getVduInstanceId()); @@ -804,7 +804,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { "Create VF: Deployment " + vfModuleName + " already exists and has status " + status.toString() + " in " + cloudSiteId + "/" + tenantId + "; requires manual intervention."; logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, - cloudSiteId, tenantId, "VDU", "queryVdu", MsoLogger.ErrorCode.DataError.getValue(), + cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(), "VF Module " + vfModuleName + " already exists and is in " + status.toString() + " state"); logger.debug(error); throw new VnfAlreadyExists(vfModuleName, cloudSiteId, tenantId, vduInstance.getVduInstanceId()); @@ -814,7 +814,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { "Create VF: Deployment " + vfModuleName + " already exists with unexpected status " + status .toString() + " in " + cloudSiteId + "/" + tenantId + "; requires manual intervention."; logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, - cloudSiteId, tenantId, "VDU", "queryVdu", MsoLogger.ErrorCode.DataError.getValue(), + cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(), "VF Module " + vfModuleName + " already exists and is in an unknown state"); logger.debug(error); throw new VnfAlreadyExists(vfModuleName, cloudSiteId, tenantId, vduInstance.getVduInstanceId()); @@ -837,7 +837,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { // Failed to query the Volume Group VDU due to a plugin exception. String error = "Create VF Module: Query Volume Group " + volumeGroupId + " in " + cloudSiteId + "/" + tenantId + ": " + me ; logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId, - cloudSiteId, tenantId, "VDU", "queryVdu(volume)", MsoLogger.ErrorCode.DataError.getValue(), + cloudSiteId, tenantId, "VDU", "queryVdu(volume)", ErrorCode.DataError.getValue(), "Exception - queryVdu(volume)", me); logger.debug(error); // Convert to a generic VnfException @@ -849,7 +849,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { String error = "Create VFModule: Attached Volume Group DOES NOT EXIST " + volumeGroupId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR" ; logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId, cloudSiteId, tenantId, error, "VDU", "queryVdu(volume)", - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), + ErrorCode.BusinessProcesssError.getValue(), "Create VFModule: Attached Volume Group " + "DOES NOT EXIST"); logger.debug(error); throw new VnfException (error, MsoExceptionCategory.USERDATA); @@ -887,7 +887,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { // Failed to query the Base VF Module due to a Vdu Plugin exception. String error = "Create VF Module: Query Base " + baseVfModuleId + " in " + cloudSiteId + "/" + tenantId + ": " + me ; logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId, - cloudSiteId, tenantId, "VDU", "queryVdu(Base)", MsoLogger.ErrorCode.DataError.getValue(), + cloudSiteId, tenantId, "VDU", "queryVdu(Base)", ErrorCode.DataError.getValue(), "Exception - queryVdu(Base)", me); logger.debug(error); // Convert to a generic VnfException @@ -901,7 +901,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { + tenantId + " USER ERROR"; logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId, cloudSiteId, tenantId, error, "VDU", "queryVdu(Base)", - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), + ErrorCode.BusinessProcesssError.getValue(), "Create VFModule: Base Module DOES NOT EXIST"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); @@ -934,7 +934,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType + ", reqType=" + requestType; logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID", vfModuleType, - "VNF", MsoLogger.ErrorCode.DataError.getValue(), error); + "VNF", ErrorCode.DataError.getValue(), error); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.INTERNAL); } else { @@ -944,7 +944,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { if (heatEnvironment == null) { String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType; logger.error("{} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID", - "OpenStack", MsoLogger.ErrorCode.DataError.getValue(), error); + "OpenStack", ErrorCode.DataError.getValue(), error); throw new VnfException(error, MsoExceptionCategory.INTERNAL); } else { logger.debug("Got Heat Environment from DB: " + heatEnvironment.getEnvironment()); @@ -1082,7 +1082,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { // Problem - missing one or more required parameters String error = "Create VFModule: Missing Required inputs: " + missingParams; logger.error("{} {} {} {} {}", MessageEnum.RA_MISSING_PARAM.toString(), missingParams, "VDU", - MsoLogger.ErrorCode.DataError.getValue(), "Create VFModule: Missing Required inputs"); + ErrorCode.DataError.getValue(), "Create VFModule: Missing Required inputs"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); } else { @@ -1118,14 +1118,14 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { me.addContext("CreateVFModule"); String error = "Create VF Module " + vfModuleType + " in " + cloudSiteId + "/" + tenantId + ": " + me; logger.error("{} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudSiteId, - tenantId, "VDU", MsoLogger.ErrorCode.DataError.getValue(), "MsoException - instantiateVdu", me); + tenantId, "VDU", ErrorCode.DataError.getValue(), "MsoException - instantiateVdu", me); logger.debug(error); // Convert to a generic VnfException throw new VnfException(me); } catch (NullPointerException npe) { String error = "Create VFModule " + vfModuleType + " in " + cloudSiteId + "/" + tenantId + ": " + npe; logger.error("{} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudSiteId, - tenantId, "VDU", MsoLogger.ErrorCode.DataError.getValue(), "NullPointerException - instantiateVdu", + tenantId, "VDU", ErrorCode.DataError.getValue(), "NullPointerException - instantiateVdu", npe); logger.debug(error); logger.debug("NULL POINTER EXCEPTION at vduPlugin.instantiateVdu", npe); @@ -1179,7 +1179,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { e.addContext("QueryVFModule"); String error = "Query VfModule (VDU): " + vfModuleId + " in " + cloudSiteId + "/" + tenantId + ": " + e; logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleId, cloudSiteId, - tenantId, "VDU", "QueryVFModule", MsoLogger.ErrorCode.DataError.getValue(), "Exception - queryVDU", e); + tenantId, "VDU", "QueryVFModule", ErrorCode.DataError.getValue(), "Exception - queryVDU", e); logger.debug(error); throw new VnfException(e); } @@ -1202,7 +1202,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { // Convert to a generic VnfException String error = "Delete VF: " + vfModuleId + " in " + cloudSiteId + "/" + tenantId + ": " + me; logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudSiteId, - tenantId, "VDU", "DeleteVdu", MsoLogger.ErrorCode.DataError.getValue(), + tenantId, "VDU", "DeleteVdu", ErrorCode.DataError.getValue(), "Exception - DeleteVdu: " + me.getMessage()); logger.debug(error); throw new VnfException (me); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java index 1a114067c3..33055c225e 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java @@ -56,8 +56,8 @@ import org.onap.so.adapters.vnfrest.UpdateVfModuleResponse; import org.onap.so.adapters.vnfrest.VfModuleExceptionResponse; import org.onap.so.adapters.vnfrest.VfModuleRollback; import org.onap.so.entity.MsoRequest; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.VnfRollback; import org.onap.so.openstack.beans.VnfStatus; import org.onap.so.openstack.exceptions.MsoExceptionCategory; @@ -166,7 +166,7 @@ public class VnfAdapterRest { } catch (Exception e) { // problem handling delete, send generic failure as sync resp to caller logger.error("", MessageEnum.RA_DELETE_VNF_ERR.toString(), "deleteVfModule", - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception in deleteVfModule", e); + ErrorCode.BusinessProcesssError.getValue(), "Exception in deleteVfModule", e); return Response.serverError().build(); } // send sync response (ACK) to caller @@ -213,7 +213,7 @@ public class VnfAdapterRest { response = new DeleteVfModuleResponse(req.getVnfId(), req.getVfModuleId(), Boolean.TRUE, req.getMessageId(), outputs.value); } catch (VnfException e) { logger.error("{} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "VnfException - Delete VNF Module", e); + ErrorCode.BusinessProcesssError.getValue(), "VnfException - Delete VNF Module", e); eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.TRUE, req.getMessageId()); } if (!req.isSynchronous()) { @@ -293,7 +293,7 @@ public class VnfAdapterRest { .build(); } catch (VnfException e) { logger.error("{} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, "queryVfModule", - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "VnfException - queryVfModule", e); + ErrorCode.BusinessProcesssError.getValue(), "VnfException - queryVfModule", e); VfModuleExceptionResponse excResp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.FALSE, null); return Response .status(HttpStatus.SC_INTERNAL_SERVER_ERROR) @@ -371,7 +371,7 @@ public class VnfAdapterRest { } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller logger.error("{} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR, "createVfModule", - MsoLogger.ErrorCode.BusinessProcesssError, "Exception - createVfModule", e); + ErrorCode.BusinessProcesssError, "Exception - createVfModule", e); return Response.serverError().build(); } // send sync response (ACK) to caller @@ -514,7 +514,7 @@ public class VnfAdapterRest { } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller logger.error("{} {} {} {}", MessageEnum.RA_UPDATE_VNF_ERR.toString(), "updateVfModule", - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception - updateVfModule", e); + ErrorCode.BusinessProcesssError.getValue(), "Exception - updateVfModule", e); return Response.serverError().build(); } // send sync response (ACK) to caller @@ -645,7 +645,7 @@ public class VnfAdapterRest { } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller logger.error("{} {} {} {}", MessageEnum.RA_ROLLBACK_VNF_ERR.toString(), "rollbackVfModule", - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception - rollbackVfModule", e); + ErrorCode.BusinessProcesssError.getValue(), "Exception - rollbackVfModule", e); return Response.serverError().build(); } // send sync response (ACK) to caller @@ -689,7 +689,7 @@ public class VnfAdapterRest { vnfAdapter.rollbackVnf (vrb); response = new RollbackVfModuleResponse(Boolean.TRUE, req.getMessageId()); } catch (VnfException e) { - logger.error("{} {} {}", MessageEnum.RA_ROLLBACK_VNF_ERR, MsoLogger.ErrorCode.BusinessProcesssError, + logger.error("{} {} {}", MessageEnum.RA_ROLLBACK_VNF_ERR, ErrorCode.BusinessProcesssError, "Exception" + " - " + "rollbackVfModule", e); eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, false, req.getMessageId()); } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java index 81989a6fcd..4696e43d75 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java @@ -55,8 +55,8 @@ import org.onap.so.adapters.vnfrest.UpdateVfModuleResponse; import org.onap.so.adapters.vnfrest.VfModuleExceptionResponse; import org.onap.so.adapters.vnfrest.VfModuleRollback; import org.onap.so.entity.MsoRequest; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.VnfRollback; import org.onap.so.openstack.beans.VnfStatus; import org.onap.so.openstack.exceptions.MsoExceptionCategory; @@ -167,7 +167,7 @@ public class VnfAdapterRestV2 { } catch (Exception e) { // problem handling delete, send generic failure as sync resp to caller logger.error("{} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), "deleteVfModule", - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception in deleteVfModule", e); + ErrorCode.BusinessProcesssError.getValue(), "Exception in deleteVfModule", e); return Response.serverError().build(); } // send sync response (ACK) to caller @@ -218,7 +218,7 @@ public class VnfAdapterRestV2 { response = new DeleteVfModuleResponse(req.getVnfId(), req.getVfModuleId(), Boolean.TRUE, req.getMessageId(), outputs.value); } catch (VnfException e) { logger.error("{} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "VnfException - " + "Delete VNF Module", e); + ErrorCode.BusinessProcesssError.getValue(), "VnfException - " + "Delete VNF Module", e); eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.TRUE, req.getMessageId()); } if (!req.isSynchronous()) { @@ -304,7 +304,7 @@ public class VnfAdapterRestV2 { .build(); } catch (VnfException e) { logger.error("{} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, "queryVfModule", - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "VnfException - queryVfModule", e); + ErrorCode.BusinessProcesssError.getValue(), "VnfException - queryVfModule", e); VfModuleExceptionResponse excResp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.FALSE, null); return Response .status(HttpStatus.SC_INTERNAL_SERVER_ERROR) @@ -385,7 +385,7 @@ public class VnfAdapterRestV2 { } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller logger.error("{} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), "createVfModule", - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception - createVfModule", e); + ErrorCode.BusinessProcesssError.getValue(), "Exception - createVfModule", e); return Response.serverError().build(); } // send sync response (ACK) to caller @@ -519,7 +519,7 @@ public class VnfAdapterRestV2 { } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller logger.error("{} {} {} {}", MessageEnum.RA_UPDATE_VNF_ERR.toString(), "updateVfModule", - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception - updateVfModule", e); + ErrorCode.BusinessProcesssError.getValue(), "Exception - updateVfModule", e); return Response.serverError().build(); } // send sync response (ACK) to caller @@ -654,7 +654,7 @@ public class VnfAdapterRestV2 { } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller logger.error("{} {} {} {}", MessageEnum.RA_ROLLBACK_VNF_ERR.toString(), "rollbackVfModule", - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception - rollbackVfModule", e); + ErrorCode.BusinessProcesssError.getValue(), "Exception - rollbackVfModule", e); return Response.serverError().build(); } // send sync response (ACK) to caller @@ -703,7 +703,7 @@ public class VnfAdapterRestV2 { response = new RollbackVfModuleResponse(Boolean.TRUE, req.getMessageId()); } catch (VnfException e) { logger.error("{} {} {}", MessageEnum.RA_ROLLBACK_VNF_ERR.toString(), - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception - rollbackVfModule", e); + ErrorCode.BusinessProcesssError.getValue(), "Exception - rollbackVfModule", e); eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, false, req.getMessageId()); } if (!req.isSynchronous()) { diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java index dc1ff12570..bdc93f675b 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java @@ -60,8 +60,8 @@ import org.onap.so.adapters.vnfrest.UpdateVolumeGroupResponse; import org.onap.so.adapters.vnfrest.VolumeGroupExceptionResponse; import org.onap.so.adapters.vnfrest.VolumeGroupRollback; import org.onap.so.entity.MsoRequest; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.VnfRollback; import org.onap.so.openstack.beans.VnfStatus; import org.onap.so.openstack.exceptions.MsoExceptionCategory; @@ -124,7 +124,7 @@ public class VolumeAdapterRest { } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller logger.error("{} {} Exception - createVNFVolumes: ", MessageEnum.RA_CREATE_VNF_ERR, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcesssError.getValue(), e); return Response.serverError().build(); } // send sync response (ACK) to caller @@ -286,7 +286,7 @@ public class VolumeAdapterRest { } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller logger.error("{} {} Exception - deleteVNFVolumes: ", MessageEnum.RA_DELETE_VNF_ERR, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcesssError.getValue(), e); return Response.serverError().build(); } // send sync response (ACK) to caller @@ -383,7 +383,7 @@ public class VolumeAdapterRest { } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller logger.error("{} {} Exception - rollbackVNFVolumes: ", MessageEnum.RA_ROLLBACK_VNF_ERR, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcesssError.getValue(), e); return Response.serverError().build(); } // send sync response (ACK) to caller @@ -483,7 +483,7 @@ public class VolumeAdapterRest { } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller logger.error("{} {} Exception - updateVNFVolumes: ", MessageEnum.RA_UPDATE_VNF_ERR, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcesssError.getValue(), e); return Response.serverError().build(); } // send sync response (ACK) to caller @@ -637,7 +637,7 @@ public class VolumeAdapterRest { .build(); } catch (VnfException e) { logger.error("{} {} AaiVolumeGroupId: {} VnfException - queryVNFVolumes", MessageEnum.RA_QUERY_VNF_ERR, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), aaiVolumeGroupId, e); + ErrorCode.BusinessProcesssError.getValue(), aaiVolumeGroupId, e); VolumeGroupExceptionResponse excResp = new VolumeGroupExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.FALSE, null); logger.debug("Query queryVNFVolumes exit"); return Response diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java index 1dcf586346..f38f858d7b 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java @@ -59,8 +59,8 @@ import org.onap.so.adapters.vnfrest.UpdateVolumeGroupResponse; import org.onap.so.adapters.vnfrest.VolumeGroupExceptionResponse; import org.onap.so.adapters.vnfrest.VolumeGroupRollback; import org.onap.so.entity.MsoRequest; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.VnfRollback; import org.onap.so.openstack.beans.VnfStatus; import org.onap.so.openstack.exceptions.MsoExceptionCategory; @@ -129,7 +129,7 @@ public class VolumeAdapterRestV2 { } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller logger.error("{} {} Exception - createVNFVolumes: ", MessageEnum.RA_CREATE_VNF_ERR, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcesssError.getValue(), e); return Response.serverError().build(); } // send sync response (ACK) to caller @@ -283,7 +283,7 @@ public class VolumeAdapterRestV2 { } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller logger.error("{} {} Exception - deleteVNFVolumes: ", MessageEnum.RA_DELETE_VNF_ERR, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcesssError.getValue(), e); return Response.serverError().build(); } // send sync response (ACK) to caller @@ -385,7 +385,7 @@ public class VolumeAdapterRestV2 { } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller logger.error("{} {} Exception - rollbackVNFVolumes: ", MessageEnum.RA_ROLLBACK_VNF_ERR, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcesssError.getValue(), e); return Response.serverError().build(); } // send sync response (ACK) to caller @@ -490,7 +490,7 @@ public class VolumeAdapterRestV2 { } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller logger.error("{} {} Exception - updateVNFVolumes: ", MessageEnum.RA_UPDATE_VNF_ERR, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcesssError.getValue(), e); return Response.serverError().build(); } // send sync response (ACK) to caller @@ -640,7 +640,7 @@ public class VolumeAdapterRestV2 { .build(); } catch (VnfException e) { logger.error("{} {} AaiVolumeGroupId: {} VnfException - queryVNFVolumes: ", MessageEnum.RA_QUERY_VNF_ERR, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), aaiVolumeGroupId, e); + ErrorCode.BusinessProcesssError.getValue(), aaiVolumeGroupId, e); VolumeGroupExceptionResponse excResp = new VolumeGroupExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.FALSE, null); logger.debug("Query queryVNFVolumes exit"); return Response diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java index f7d718ccdc..09e8cf1d32 100644 --- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java +++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java @@ -32,8 +32,8 @@ import org.onap.so.db.request.beans.ArchivedInfraRequests; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.data.repository.ArchivedInfraRequestsRepository; import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -148,7 +148,7 @@ public class ArchiveInfraRequestsScheduler { newArchivedReqs.add(archivedInfra); oldInfraReqs.add(iar); } catch(Exception e) { - logger.error("{} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), MsoLogger.ErrorCode + logger.error("{} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), ErrorCode .UnknownError.getValue(), e); } } diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java index 1027c8a18b..e3867d1b93 100644 --- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java +++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java @@ -38,7 +38,7 @@ import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository; import org.onap.so.db.request.data.repository.OperationStatusRepository; import org.onap.so.db.request.data.repository.ResourceOperationStatusRepository; import org.onap.so.db.request.data.repository.SiteStatusRepository; -import org.onap.so.logger.MsoLogger; +import org.onap.so.logger.ErrorCode; import org.onap.so.requestsdb.RequestsDbConstant; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -128,7 +128,7 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { } catch (Exception e) { String error = "Error retrieving MSO Infra Requests DB for Request ID " + requestId; logger.error(error, e); - throw new MsoRequestsDbException(error, MsoLogger.ErrorCode.BusinessProcesssError, e); + throw new MsoRequestsDbException(error, ErrorCode.BusinessProcesssError, e); } } @@ -154,7 +154,7 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { } catch (Exception e) { String error = "Error retrieving MSO Infra Requests DB for Request ID " + requestId; logger.error(error,e); - throw new MsoRequestsDbException(error,MsoLogger.ErrorCode.BusinessProcesssError , e); + throw new MsoRequestsDbException(error, ErrorCode.BusinessProcesssError , e); } return request; } diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/exceptions/MsoRequestsDbException.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/exceptions/MsoRequestsDbException.java index e6d736d2ad..16a3a7d427 100644 --- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/exceptions/MsoRequestsDbException.java +++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/exceptions/MsoRequestsDbException.java @@ -24,7 +24,7 @@ package org.onap.so.adapters.requestsdb.exceptions; import javax.xml.ws.WebFault; import org.onap.so.exceptions.MSOException; -import org.onap.so.logger.MsoLogger.ErrorCode; +import org.onap.so.logger.ErrorCode; /** * This class simply extends Exception (without addition additional functionality) diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java index 32eb40aed8..75c8f1af52 100644 --- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java +++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java @@ -30,7 +30,6 @@ import org.junit.runner.RunWith; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.adapters.requestsdb.application.MSORequestDBApplication; import org.onap.so.adapters.requestsdb.application.TestAppender; -import org.onap.so.logger.MsoLogger; import org.springframework.boot.web.server.LocalServerPort; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.client.TestRestTemplate; diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java index 103e216229..963ef7c832 100644 --- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java +++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java @@ -46,7 +46,6 @@ import org.onap.so.db.request.beans.OperationStatus; import org.onap.so.db.request.beans.ResourceOperationStatus; import org.onap.so.db.request.data.repository.OperationStatusRepository; import org.onap.so.db.request.data.repository.ResourceOperationStatusRepository; -import org.onap.so.logger.MsoLogger; import org.onap.so.requestsdb.RequestsDbConstant; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java index 543c8e4b00..2c84ed4fd0 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java @@ -32,7 +32,6 @@ import org.apache.cxf.jaxrs.swagger.Swagger2Feature; import org.apache.cxf.jaxws.EndpointImpl; import org.apache.cxf.transport.servlet.CXFServlet; import org.onap.so.adapters.sdnc.sdncrest.SNIROResponse; -import org.onap.so.logger.MsoLogger; import org.onap.so.logging.cxf.interceptor.SOAPLoggingInInterceptor; import org.onap.so.logging.cxf.interceptor.SOAPLoggingOutInterceptor; import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging; diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java index 5deec41d94..26e67c8507 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java @@ -32,8 +32,8 @@ import javax.xml.ws.WebEndpoint; import javax.xml.ws.WebServiceClient; import javax.xml.ws.WebServiceFeature; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -62,17 +62,17 @@ public class SDNCAdapterService extends Service { wsdlUrl = Thread.currentThread().getContextClassLoader().getResource("main/resources/SDNCAdapter.wsdl"); } catch (Exception e) { logger.error("{} {} {} {}", MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_ADAPTER_WSDL, - MsoLogger.ErrorCode.DataError.getValue(), "Exception - WSDL not found", e); + ErrorCode.DataError.getValue(), "Exception - WSDL not found", e); } if(wsdlUrl == null) { logger.error("{} {} {} {}", MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_ADAPTER_WSDL, - MsoLogger.ErrorCode.DataError.getValue(), "WSDL not found"); + ErrorCode.DataError.getValue(), "WSDL not found"); } else { try { logger.info("{} {} {}", MessageEnum.RA_PRINT_URL.toString(), SDNC_ADAPTER_WSDL, wsdlUrl.toURI().toString()); } catch (Exception e) { logger.error("{} {} {} {}", MessageEnum.RA_WSDL_URL_CONVENTION_EXC.toString(), SDNC_ADAPTER_WSDL, - MsoLogger.ErrorCode.DataError.getValue(), "Exception - print URL", e); + ErrorCode.DataError.getValue(), "Exception - print URL", e); } } WSDL_LOCATION = wsdlUrl; diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java index 3dcd008ba5..2703060761 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java @@ -33,8 +33,8 @@ import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -135,7 +135,7 @@ public class SDNCAdapterCallbackRequest { } catch (Exception e) { - logger.error("{} {} {}", MessageEnum.RA_MARSHING_ERROR.toString(), MsoLogger.ErrorCode.DataError.getValue(), + logger.error("{} {} {}", MessageEnum.RA_MARSHING_ERROR.toString(), ErrorCode.DataError.getValue(), "Exception - MARSHING_ERROR", e); } return ""; diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java index fd288c6a04..ee7a467357 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java @@ -31,8 +31,8 @@ import javax.xml.ws.WebEndpoint; import javax.xml.ws.WebServiceClient; import javax.xml.ws.WebServiceFeature; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -59,18 +59,18 @@ public class SDNCCallbackAdapterService extends Service { wsdlUrl = Thread.currentThread().getContextClassLoader().getResource("main/resources/SDNCCallbackAdapter.wsdl"); } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_CALLBACK_ADAPTER_WSDL, "SDNC", - MsoLogger.ErrorCode.DataError.getValue(), "Exception - WSDL not found", e); + ErrorCode.DataError.getValue(), "Exception - WSDL not found", e); } if(wsdlUrl == null) { logger.error("{} {} {} {} {}", MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_CALLBACK_ADAPTER_WSDL, "SDNC", - MsoLogger.ErrorCode.DataError.getValue(), "WSDL not found"); + ErrorCode.DataError.getValue(), "WSDL not found"); } else { try { logger.info("{} {} {} {}", MessageEnum.RA_PRINT_URL.toString(), SDNC_CALLBACK_ADAPTER_WSDL, wsdlUrl.toURI().toString(), "SDNC"); } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.RA_WSDL_URL_CONVENTION_EXC.toString(), SDNC_CALLBACK_ADAPTER_WSDL, - "SDNC", MsoLogger.ErrorCode.DataError.getValue(), "Exception - URL convention problem", e); + "SDNC", ErrorCode.DataError.getValue(), "Exception - URL convention problem", e); } } WSDL_LOCATION = wsdlUrl; diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java index 6262f2d86f..401f5c5b2b 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java @@ -23,8 +23,8 @@ package org.onap.so.adapters.sdnc.impl; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -65,7 +65,7 @@ public class MapRequestTunables { String[] parts = value.split("\\|"); //escape pipe if (parts.length < 3) { logger.warn("{} {} {} {} {} {}", MessageEnum.RA_SDNC_INVALID_CONFIG.toString(), key, value, "SDNC", - MsoLogger.ErrorCode.DataError.getValue(), "Invalid config"); + ErrorCode.DataError.getValue(), "Invalid config"); } for (int i = 0; i < parts.length; i++) { @@ -101,7 +101,7 @@ public class MapRequestTunables { } if (error != null) { logger.error("{} {} {} {} {}", MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), key, "SDNC", - MsoLogger.ErrorCode.DataError.getValue(), "Missing config param"); + ErrorCode.DataError.getValue(), "Missing config param"); } logger.debug("RequestTunables Key:{} Value:{} Tunables:{}", key, value, this.toString()); return reqTunable; 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 cf81ae4be0..104b4ebcc7 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 @@ -29,9 +29,9 @@ import javax.servlet.http.HttpServletResponse; 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.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -75,7 +75,7 @@ public class SDNCAdapterPortTypeImpl implements SDNCAdapterPortType { catch (Exception e){ String respMsg = "Error sending request to SDNC. Failed to start SDNC Client thread " + e.getMessage(); logger.error("{} {} {} {}", MessageEnum.RA_SEND_REQUEST_SDNC_ERR.toString(), "SDNC", - MsoLogger.ErrorCode.DataError.getValue(), respMsg, e); + ErrorCode.DataError.getValue(), respMsg, e); SDNCResponse sdncResp = new SDNCResponse(bpelReqId); sdncResp.setRespCode(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); 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 d7f2c11d0b..bea4c1bb3b 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 @@ -46,6 +46,8 @@ import javax.xml.ws.handler.MessageContext; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathFactory; + +import org.onap.so.logger.ErrorCode; import org.onap.so.utils.CryptoUtils; import org.onap.so.adapters.sdnc.SDNCAdapterRequest; import org.onap.so.adapters.sdnc.client.CallbackHeader; @@ -54,7 +56,6 @@ 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.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -192,7 +193,7 @@ public class SDNCRestClient{ catch (Exception e) { logger.error("{} {} {} {}", MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC", - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception processing request to SDNC", e); + ErrorCode.BusinessProcesssError.getValue(), "Exception processing request to SDNC", e); //default sdncResp.setRespCode(HttpURLConnection.HTTP_INTERNAL_ERROR); String respMsg = "Error processing request to SDNC. "; @@ -233,7 +234,7 @@ public class SDNCRestClient{ sdncErrMsg = new StringBuilder(". SDNC Returned-[error-type:" + eType); } catch (Exception e3) { logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-type", - error.toString(), "SDNC", MsoLogger.ErrorCode.DataError.getValue(), EXCEPTION_MSG, e3); + error.toString(), "SDNC", ErrorCode.DataError.getValue(), EXCEPTION_MSG, e3); } String eTag = null; @@ -242,7 +243,7 @@ public class SDNCRestClient{ sdncErrMsg.append(", error-tag:").append(eTag); } catch (Exception e3) { logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-tag", - error.toString(), "SDNC", MsoLogger.ErrorCode.DataError.getValue(), EXCEPTION_MSG, e3); + error.toString(), "SDNC", ErrorCode.DataError.getValue(), EXCEPTION_MSG, e3); } String eMsg = null; @@ -251,17 +252,17 @@ public class SDNCRestClient{ sdncErrMsg.append(", error-message:").append(eMsg).append("]"); } catch (Exception e3) { logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-message", error.toString(), - "SDNC", MsoLogger.ErrorCode.DataError.getValue(), EXCEPTION_MSG, e3); + "SDNC", ErrorCode.DataError.getValue(), EXCEPTION_MSG, e3); } } } catch (Exception e2) { logger.error("{} {} {} {}", MessageEnum.RA_ANALYZE_ERROR_EXC.toString(), "SDNC", - MsoLogger.ErrorCode.DataError.getValue(), "Exception while analyse error", e2); + ErrorCode.DataError.getValue(), "Exception while analyse error", e2); } } //is != null } catch (Exception e1) { logger.error("{} {} {} {}", MessageEnum.RA_ERROR_GET_RESPONSE_SDNC.toString(), "SDNC", - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception while get SDNC response", e1); + ErrorCode.BusinessProcesssError.getValue(), "Exception while get SDNC response", e1); } } //con != null @@ -273,7 +274,7 @@ public class SDNCRestClient{ sdncResp.setRespMsg(respMsg); logger.error("{} {} {} {}", MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC", - MsoLogger.ErrorCode.AvailabilityError.getValue(), "Exception while communicate with SDNC", e); + ErrorCode.AvailabilityError.getValue(), "Exception while communicate with SDNC", e); return sdncResp; } @@ -304,7 +305,7 @@ public class SDNCRestClient{ } catch (MalformedURLException e1) { error = "Caught exception initializing Callback wsdl " + e1.getMessage(); logger.error("{} {} {} {}", MessageEnum.RA_INIT_CALLBACK_WSDL_ERR.toString(), CAMUNDA, - MsoLogger.ErrorCode.DataError.getValue(), "Exception initializing Callback wsdl", e1); + ErrorCode.DataError.getValue(), "Exception initializing Callback wsdl", e1); } @@ -335,7 +336,7 @@ public class SDNCRestClient{ catch (Exception e2) { error = "Unable to set authorization in callback request " + e2.getMessage(); logger.error("{} {} {} {}", MessageEnum.RA_SET_CALLBACK_AUTH_EXC.toString(), CAMUNDA, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), + ErrorCode.BusinessProcesssError.getValue(), "Exception - Unable to set authorization in callback request", e2); } @@ -347,7 +348,7 @@ public class SDNCRestClient{ catch (Exception e) { error = "Error sending BpelCallback request" + e.getMessage(); - logger.error("Error {} - {} - {}", MsoLogger.ErrorCode.BusinessProcesssError.getValue(), + logger.error("Error {} - {} - {}", ErrorCode.BusinessProcesssError.getValue(), MessageEnum.RA_CALLBACK_BPEL_EXC.toString(), error, e); } logger.info(MessageEnum.RA_CALLBACK_BPEL_COMPLETE.name(), CAMUNDA); diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java index 96e7dcf51a..daa83d27f8 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java @@ -33,8 +33,8 @@ import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.w3c.dom.Document; @@ -103,7 +103,7 @@ public class Utils { } catch (Exception e) { logger.error("{} {} {} {}", MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST.toString(), "SDNC", - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception in genSdncReq", e); + ErrorCode.BusinessProcesssError.getValue(), "Exception in genSdncReq", e); } return null; } @@ -137,7 +137,7 @@ public class Utils { } catch (Exception e) { logger.error("{} {} {} {}", MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST.toString(), "SDNC", - MsoLogger.ErrorCode.DataError.getValue(), "Exception in genSdncPutReq", e); + ErrorCode.DataError.getValue(), "Exception in genSdncPutReq", e); } return null; } @@ -172,7 +172,7 @@ public class Utils { } catch (Exception e) { logger.error("{} {} {} {}", MessageEnum.RA_ERROR_CREATE_SDNC_RESPONSE.toString(), "SDNC", - MsoLogger.ErrorCode.DataError.getValue(), "Exception in genMsoFailResp", e); + ErrorCode.DataError.getValue(), "Exception in genMsoFailResp", e); } return null; } @@ -198,7 +198,7 @@ public class Utils { s = s.replaceAll("xmlns=\"\"", ""); return s; } catch (Exception e) { - logger.error("{} {} {}", MessageEnum.RA_ERROR_CONVERT_XML2STR.toString(), MsoLogger.ErrorCode.DataError + logger.error("{} {} {}", MessageEnum.RA_ERROR_CONVERT_XML2STR.toString(), ErrorCode.DataError .getValue(), "Exception - domToStr", e); } } 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 6a66770d29..cf52972d8f 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 @@ -36,9 +36,9 @@ import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.util.EntityUtils; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.adapters.sdnc.impl.Constants; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -134,7 +134,7 @@ public class BPRestCallback { method.setHeader(ONAPLogConstants.Headers.PARTNER_NAME,"SO-SDNCAdapter"); } catch (Exception e) { logger.error("{} {} {} {}", MessageEnum.RA_SET_CALLBACK_AUTH_EXC.toString(), CAMUNDA, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Unable to set authorization in callback request", e); + ErrorCode.BusinessProcesssError.getValue(), "Unable to set authorization in callback request", e); error = true; } @@ -150,7 +150,7 @@ 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.toString(), CAMUNDA, MsoLogger.ErrorCode + logger.error("{} {} {} {}", MessageEnum.RA_CALLBACK_BPEL_EXC.toString(), CAMUNDA, ErrorCode .BusinessProcesssError.getValue(), msg); } @@ -158,7 +158,7 @@ public class BPRestCallback { return true; } catch (Exception e) { logger.error("{} {} {} {}", MessageEnum.RA_CALLBACK_BPEL_EXC.toString(), CAMUNDA, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Error sending callback request", e); + ErrorCode.BusinessProcesssError.getValue(), "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 fd9ce4c719..d4c2c57510 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,9 +25,9 @@ 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.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -56,7 +56,7 @@ public class MapTypedRequestTunablesData { if ("".equals(value)) { error= MISSING_CONFIGURATION_ERROR_MSG + reqTunable.getKey(); logger.error("{} {} {} {} {}", MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), reqTunable.getKey(), "SDNC", - MsoLogger.ErrorCode.DataError.getValue(), MISSING_CONFIG_PARAM_ERROR_MSG); + ErrorCode.DataError.getValue(), MISSING_CONFIG_PARAM_ERROR_MSG); throw new SDNCAdapterException(error); } @@ -66,7 +66,7 @@ public class MapTypedRequestTunablesData { if (parts.length != 5) { error="Invalid configuration for: " + reqTunable.getKey(); logger.error("{} {} {} {} {} {}", MessageEnum.RA_SDNC_INVALID_CONFIG.toString(), reqTunable.getKey(), value, "SDNC", - MsoLogger.ErrorCode.DataError.getValue(), "Invalid config"); + ErrorCode.DataError.getValue(), "Invalid config"); throw new SDNCAdapterException(error); } @@ -82,7 +82,7 @@ public class MapTypedRequestTunablesData { if ("".equals(reqTunable.getSdncUrl())) { error=MISSING_CONFIGURATION_ERROR_MSG + urlPropKey; logger.error("{} {} {} {} {}", MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), urlPropKey, "SDNC", - MsoLogger.ErrorCode.DataError.getValue(), MISSING_CONFIG_PARAM_ERROR_MSG); + ErrorCode.DataError.getValue(), MISSING_CONFIG_PARAM_ERROR_MSG); throw new SDNCAdapterException(error); } @@ -100,7 +100,7 @@ public class MapTypedRequestTunablesData { if ("".equals(reqTunable.getMyUrl())) { error=MISSING_CONFIGURATION_ERROR_MSG + Constants.MY_URL_PROP; logger.error("{} {} {} {} {}", MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), Constants.MY_URL_PROP, "SDNC", - MsoLogger.ErrorCode.DataError.getValue(), MISSING_CONFIG_PARAM_ERROR_MSG); + ErrorCode.DataError.getValue(), MISSING_CONFIG_PARAM_ERROR_MSG); 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 06e7ab23a6..7cc5b8e14e 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,9 +52,9 @@ import org.apache.http.util.EntityUtils; 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.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -201,12 +201,12 @@ public abstract class SDNCConnector { protected void logError(String errMsg) { logger.error("{} {} {} {}", MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC", - MsoLogger.ErrorCode.AvailabilityError.getValue(), errMsg); + ErrorCode.AvailabilityError.getValue(), errMsg); } protected void logError(String errMsg, Throwable t) { logger.error("{} {} {} {}", MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC", - MsoLogger.ErrorCode.AvailabilityError.getValue(), errMsg, t); + ErrorCode.AvailabilityError.getValue(), errMsg, t); } /** @@ -290,7 +290,7 @@ public abstract class SDNCConnector { info += "error-type:" + errorType; } catch (XPathExpressionException e) { logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-type", error.toString(), - "SDNC", MsoLogger.ErrorCode.DataError.getValue(), XPATH_EXCEPTION, e); + "SDNC", ErrorCode.DataError.getValue(), XPATH_EXCEPTION, e); } try { @@ -301,7 +301,7 @@ public abstract class SDNCConnector { info += "error-tag:" + errorTag; } catch (XPathExpressionException e) { logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-tag", error.toString(), - "SDNC", MsoLogger.ErrorCode.DataError.getValue(), XPATH_EXCEPTION, e); + "SDNC", ErrorCode.DataError.getValue(), XPATH_EXCEPTION, e); } try { @@ -312,7 +312,7 @@ public abstract class SDNCConnector { info += "error-message:" + errorMessage; } catch (Exception e) { logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-message", - error.toString(), "SDNC", MsoLogger.ErrorCode.DataError.getValue(), XPATH_EXCEPTION, e); + error.toString(), "SDNC", ErrorCode.DataError.getValue(), XPATH_EXCEPTION, e); } if (!info.isEmpty()) { @@ -325,7 +325,7 @@ public abstract class SDNCConnector { } } catch (Exception e) { logger.error("{} {} {} {}", MessageEnum.RA_ANALYZE_ERROR_EXC.toString(), "SDNC", - MsoLogger.ErrorCode.DataError.getValue(), "Exception while analyzing errors", e); + ErrorCode.DataError.getValue(), "Exception while analyzing errors", e); } return output.toString(); diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java index d0973d3c44..a42e92db4b 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java @@ -39,8 +39,8 @@ import org.onap.so.adapters.sdncrest.RequestInformation; import org.onap.so.adapters.sdncrest.SDNCResponseCommon; import org.onap.so.adapters.sdncrest.SDNCServiceError; import org.onap.so.adapters.sdncrest.SDNCServiceRequest; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -65,7 +65,6 @@ public class SDNCServiceRequestTask { @Async public void runRequest(SDNCServiceRequest request,String msoRequestId,String msoServiceInstanceId,String myUrlSuffix) { - MsoLogger.setLogContext(msoRequestId, msoServiceInstanceId); String sdncRequestId = request.getSdncRequestId(); String sdncService = request.getSdncService(); @@ -193,7 +192,7 @@ public class SDNCServiceRequestTask { addTextChild(agnosticServiceInformation, "anydata", anydata); } catch (Exception e) { logger.error("{} {} {} {}", MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST.toString(), "SDNC", - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception in genSdncReq", e); + ErrorCode.BusinessProcesssError.getValue(), "Exception in genSdncReq", e); return null; } @@ -211,7 +210,7 @@ public class SDNCServiceRequestTask { transformer.transform(new DOMSource(doc), new StreamResult(writer)); xml = writer.toString(); } catch (Exception e) { - logger.error("{} {} {}", MessageEnum.RA_ERROR_CONVERT_XML2STR.toString(), MsoLogger.ErrorCode.DataError.getValue(), + logger.error("{} {} {}", MessageEnum.RA_ERROR_CONVERT_XML2STR.toString(), ErrorCode.DataError.getValue(), "Exception - domToStr", e); return null; } 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 75a0b07643..96153a18fa 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,9 +33,9 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.onap.so.adapters.sdnc.impl.Constants; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -72,7 +72,7 @@ public class SNIROResponse { if (bpUrl == null || ("").equals(bpUrl)) { String error = "Missing configuration for: " + Constants.BPEL_REST_URL_PROP; logger.error("{} {} {} {} {}", MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), Constants.BPEL_REST_URL_PROP, - "SDNC", MsoLogger.ErrorCode.DataError.getValue(), "Missing config param"); + "SDNC", ErrorCode.DataError.getValue(), "Missing config param"); 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/JsonUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java index 66ed6953a2..2c1155ca6f 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java @@ -27,8 +27,8 @@ import java.io.IOException; import org.onap.so.adapters.vfc.constant.HttpCode; import org.onap.so.adapters.vfc.exceptions.ApplicationException; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.core.type.TypeReference; @@ -86,7 +86,7 @@ public class JsonUtil { try { return MAPPER.readValue(jsonstr, type); } catch (IOException e) { - logger.error("{} {} {}", MessageEnum.RA_NS_EXC.toString(), MsoLogger.ErrorCode.BusinessProcesssError.getValue(), + logger.error("{} {} {}", MessageEnum.RA_NS_EXC.toString(), ErrorCode.BusinessProcesssError.getValue(), UNMARSHAL_FAIL_MSG, e); throw new ApplicationException(HttpCode.BAD_REQUEST, UNMARSHAL_FAIL_MSG); } @@ -104,7 +104,7 @@ public class JsonUtil { try { return MAPPER.readValue(jsonstr, type); } catch (IOException e) { - logger.error("{} {} {}", MessageEnum.RA_NS_EXC.toString(), MsoLogger.ErrorCode.BusinessProcesssError.getValue(), + logger.error("{} {} {}", MessageEnum.RA_NS_EXC.toString(), ErrorCode.BusinessProcesssError.getValue(), UNMARSHAL_FAIL_MSG, e); throw new ApplicationException(HttpCode.BAD_REQUEST, UNMARSHAL_FAIL_MSG); } @@ -121,7 +121,7 @@ public class JsonUtil { try { return MAPPER.writeValueAsString(srcObj); } catch (IOException e) { - logger.error("{} {} {}", MessageEnum.RA_NS_EXC.toString(), MsoLogger.ErrorCode.BusinessProcesssError.getValue(), + logger.error("{} {} {}", MessageEnum.RA_NS_EXC.toString(), ErrorCode.BusinessProcesssError.getValue(), "fail to marshal json", e); throw new ApplicationException(HttpCode.BAD_REQUEST, "srcObj marshal failed!"); } 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 9a23861bf6..a51564eef8 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,8 +43,8 @@ import org.apache.http.entity.StringEntity; 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.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -196,12 +196,12 @@ public class RestfulUtil { private static void logError(String errMsg, Throwable t) { logger.error("{} {} {} {}", MessageEnum.RA_NS_EXC.toString(), VFC_ADAPTER, - MsoLogger.ErrorCode.AvailabilityError.getValue(), errMsg, t); + ErrorCode.AvailabilityError.getValue(), errMsg, t); } private static void logError(String errMsg) { logger.error("{} {} {} {}", MessageEnum.RA_NS_EXC.toString(), VFC_ADAPTER, - MsoLogger.ErrorCode.AvailabilityError.toString(), errMsg); + ErrorCode.AvailabilityError.toString(), errMsg); } private static RestfulResponse createResponse(int statusCode, String content) { diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java index dc30b0e7de..fd810e1e67 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java @@ -57,8 +57,8 @@ import org.onap.so.asdc.tenantIsolation.WatchdogDistribution; import org.onap.so.asdc.util.ASDCNotificationLogging; import org.onap.so.db.request.beans.WatchdogDistributionStatus; import org.onap.so.db.request.data.repository.WatchdogDistributionStatusRepository; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -308,7 +308,7 @@ public class ASDCController { } else { logger.error("{} {} {} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL.toString(), artifact.getArtifactName(), artifact.getArtifactURL(), artifact.getArtifactUUID(), - downloadResult.getDistributionMessageResult(), MsoLogger.ErrorCode.DataError.getValue(), + downloadResult.getDistributionMessageResult(), ErrorCode.DataError.getValue(), "ASDC artifact download fail"); this.sendASDCNotification (NotificationType.DOWNLOAD, @@ -369,7 +369,7 @@ public class ASDCController { logger.debug("Exception :", e); logger.error("{} {} {} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL.toString(), artifact.getArtifactName(), artifact.getArtifactURL(), artifact.getArtifactUUID(), - resultArtifact.getDistributionMessageResult(), MsoLogger.ErrorCode.DataError.getValue(), + resultArtifact.getDistributionMessageResult(), ErrorCode.DataError.getValue(), "ASDC write to file failed"); } @@ -519,7 +519,7 @@ public class ASDCController { } } catch (RuntimeException e) { logger.warn("{} {} {} {} {}", MessageEnum.ASDC_SEND_NOTIF_ASDC_EXEC.toString(), "ASDC", - "sendASDCNotification", MsoLogger.ErrorCode.SchemaError.getValue(), + "sendASDCNotification", ErrorCode.SchemaError.getValue(), "RuntimeException - sendASDCNotification", e); } } @@ -549,7 +549,7 @@ public class ASDCController { } catch (RuntimeException e) { logger.debug("Exception caught in sendFinalDistributionStatus {}", e.getMessage()); logger.warn("{} {} {} {} {}", MessageEnum.ASDC_SEND_NOTIF_ASDC_EXEC.toString(), "ASDC", "sendASDCNotification", - MsoLogger.ErrorCode.SchemaError.getValue(), "RuntimeException - sendASDCNotification", e); + ErrorCode.SchemaError.getValue(), "RuntimeException - sendASDCNotification", e); } } @@ -671,12 +671,12 @@ public class ASDCController { iNotif.getDistributionID()); logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(), "Database concurrency exception: ", "ASDC", "treatNotification", - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "RuntimeException in treatNotification", e); + ErrorCode.BusinessProcesssError.getValue(), "RuntimeException in treatNotification", e); } catch (Exception e) { logger.error("", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(), "Unexpected exception caught during the notification processing", "ASDC", - "treatNotification", MsoLogger.ErrorCode.SchemaError.getValue(), "RuntimeException in treatNotification", + "treatNotification", ErrorCode.SchemaError.getValue(), "RuntimeException in treatNotification", e); try { @@ -785,7 +785,7 @@ public class ASDCController { } catch (ASDCDownloadException | UnsupportedEncodingException e) { logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(), "Exception caught during Installation of artifact", "ASDC", "processResourceNotification", - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception in processResourceNotification", e); + ErrorCode.BusinessProcesssError.getValue(), "Exception in processResourceNotification", e); } } protected void processCsarServiceArtifacts (INotificationData iNotif, ToscaResourceStructure toscaResourceStructure) { @@ -814,7 +814,7 @@ public class ASDCController { } catch(Exception e){ logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(), "Exception caught during processCsarServiceArtifacts", "ASDC", "processCsarServiceArtifacts", - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception in processCsarServiceArtifacts", e); + ErrorCode.BusinessProcesssError.getValue(), "Exception in processCsarServiceArtifacts", e); } } else if(artifact.getArtifactType().equals(ASDCConfiguration.WORKFLOWS)){ @@ -834,7 +834,7 @@ public class ASDCController { logger.info("Whats the error {}", e.getMessage()); logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(), "Exception caught during processCsarServiceArtifacts", "ASDC", "processCsarServiceArtifacts", - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception in processCsarServiceArtifacts", + ErrorCode.BusinessProcesssError.getValue(), "Exception in processCsarServiceArtifacts", e); } } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java index 329c139ec3..e9e5372d98 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java @@ -40,8 +40,8 @@ import org.onap.so.asdc.client.test.emulators.DistributionClientEmulator; import org.onap.so.asdc.client.test.emulators.NotificationDataImpl; import org.onap.so.asdc.client.test.emulators.JsonStatusData; import org.onap.so.asdc.installer.heat.ToscaResourceInstaller; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -111,7 +111,7 @@ public class ASDCRestInterface { logger.info("Error caught " + e.getMessage()); logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION.toString(), "Exception caught during ASDCRestInterface", "ASDC", "invokeASDCService", - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception in invokeASDCService", e); + ErrorCode.BusinessProcesssError.getValue(), "Exception in invokeASDCService", e); } logger.info("ASDC Updates are complete"); logger.info("{} {} {} {}", MessageEnum.ASDC_ARTIFACT_DEPLOY_SUC.toString(), statusData.getDistributionID(), "ASDC", diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java index 700a5b16bb..6616bf4b54 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java @@ -50,8 +50,8 @@ import org.onap.so.db.catalog.beans.ToscaCsar; import org.onap.so.db.catalog.beans.VfModule; import org.onap.so.db.catalog.beans.VfModuleCustomization; import org.onap.so.db.catalog.beans.VnfResourceCustomization; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -140,7 +140,7 @@ public class ToscaResourceStructure { logger.info("System out {}", e.getMessage()); logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(), "Exception caught during parser *****LOOK********* " + artifact.getArtifactName(), "ASDC", - "processResourceNotification", MsoLogger.ErrorCode.BusinessProcesssError.getValue(), + "processResourceNotification", ErrorCode.BusinessProcesssError.getValue(), "Exception in " + "processResourceNotification", e); throw new ASDCDownloadException ("Exception caught when passing the csar file to the parser ", e); diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java index 7e3f5dfef6..8daa708ee7 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java @@ -45,8 +45,8 @@ import org.apache.http.entity.mime.MultipartEntityBuilder; import org.apache.http.entity.mime.content.ByteArrayBody; import org.apache.http.entity.mime.content.StringBody; import org.apache.http.impl.client.HttpClientBuilder; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -84,7 +84,7 @@ public class BpmnInstaller { logger.debug("Failed deploying BPMN {}", name); logger .error("{} {} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(), name, fileName, - Integer.toString(response.getStatusLine().getStatusCode()), MsoLogger.ErrorCode.DataError.getValue(), + Integer.toString(response.getStatusLine().getStatusCode()), ErrorCode.DataError.getValue(), "ASDC BPMN deploy failed"); } else { @@ -95,7 +95,7 @@ public class BpmnInstaller { logger.debug("Exception :", e); logger .error("{} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(), name, e.getMessage(), - MsoLogger.ErrorCode.DataError.getValue(), "ASDC BPMN deploy failed"); + ErrorCode.DataError.getValue(), "ASDC BPMN deploy failed"); } } entry = csarFile.getNextEntry(); @@ -104,7 +104,7 @@ public class BpmnInstaller { } catch (IOException ex) { logger.debug("Exception :", ex); logger.error("{} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(), csarFilePath, - ex.getMessage(), MsoLogger.ErrorCode.DataError.getValue(), "ASDC reading CSAR with workflows failed"); + ex.getMessage(), ErrorCode.DataError.getValue(), "ASDC reading CSAR with workflows failed"); } return; } @@ -123,7 +123,7 @@ public class BpmnInstaller { } catch (Exception e) { logger.debug("Exception :", e); logger.error("{} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_CHECK_EXC.toString(), csarFilePath, e.getMessage(), - MsoLogger.ErrorCode.DataError.getValue(), "ASDC Unable to check CSAR entries"); + ErrorCode.DataError.getValue(), "ASDC Unable to check CSAR entries"); } return workflowsInCsar; } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java index 6d9e2fbb0c..ef0b4921e4 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java @@ -124,8 +124,8 @@ import org.onap.so.db.request.beans.WatchdogServiceModVerIdLookup; import org.onap.so.db.request.data.repository.WatchdogComponentDistributionStatusRepository; import org.onap.so.db.request.data.repository.WatchdogDistributionStatusRepository; import org.onap.so.db.request.data.repository.WatchdogServiceModVerIdLookupRepository; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -267,7 +267,7 @@ public class ToscaResourceInstaller { return status; } catch (Exception e) { logger - .error("{} {} {}", MessageEnum.ASDC_ARTIFACT_CHECK_EXC.toString(), MsoLogger.ErrorCode.SchemaError.getValue(), + .error("{} {} {}", MessageEnum.ASDC_ARTIFACT_CHECK_EXC.toString(), ErrorCode.SchemaError.getValue(), "Exception - isResourceAlreadyDeployed"); throw new ArtifactInstallerException("Exception caught during checking existence of the VNF Resource.", e); } @@ -336,14 +336,14 @@ public class ToscaResourceInstaller { || dbExceptionToCapture instanceof LockAcquisitionException) { logger.warn("{} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_ALREADY_DEPLOYED.toString(), vfResourceStructure.getResourceInstance().getResourceName(), - vfResourceStructure.getNotification().getServiceVersion(), MsoLogger.ErrorCode.DataError.getValue(), + vfResourceStructure.getNotification().getServiceVersion(), ErrorCode.DataError.getValue(), "Exception - ASCDC Artifact already deployed", e); } else { String elementToLog = (!artifactListForLogging.isEmpty() ? artifactListForLogging.get(artifactListForLogging.size() - 1).toString() : "No element listed"); logger.error("{} {} {} {}", MessageEnum.ASDC_ARTIFACT_INSTALL_EXC.toString(), elementToLog, - MsoLogger.ErrorCode.DataError.getValue(), + ErrorCode.DataError.getValue(), "Exception caught during installation of " + vfResourceStructure.getResourceInstance().getResourceName() + ". Transaction rollback", e); throw new ArtifactInstallerException("Exception caught during installation of " @@ -793,7 +793,7 @@ public class ToscaResourceInstaller { case ASDCConfiguration.OTHER: logger.warn("{} {} {} {}", MessageEnum.ASDC_ARTIFACT_TYPE_NOT_SUPPORT.toString(), vfModuleArtifact.getArtifactInfo().getArtifactType() + "(Artifact Name:" + vfModuleArtifact.getArtifactInfo() - .getArtifactName() + ")", MsoLogger.ErrorCode.DataError.getValue(), "Artifact type not supported"); + .getArtifactName() + ")", ErrorCode.DataError.getValue(), "Artifact type not supported"); break; default: break; diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy index 4e7c549323..b98e395228 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy @@ -23,6 +23,7 @@ package org.onap.so.bpmn.common.scripts import org.onap.so.client.HttpClientFactory +import org.onap.so.logger.ErrorCode import java.util.regex.Matcher import java.util.regex.Pattern @@ -39,7 +40,6 @@ import org.onap.so.client.HttpClient import org.onap.so.client.aai.AAIVersion import org.onap.so.client.aai.entities.uri.AAIUri import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory import org.onap.so.openpojo.rules.HasToStringRule @@ -136,13 +136,13 @@ class AaiUtil { }else{ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Call AAI Cloud Region is NOT Successful.", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); throw new BpmnError("MSOWorkflowException") } }catch(Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception occured while getting the Cloud Reqion.", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), e.getMessage()); + ErrorCode.UnknownError.getValue(), e.getMessage()); (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage()) } return regionId diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy index dec69dfb71..e0e85e9629 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy @@ -23,6 +23,7 @@ package org.onap.so.bpmn.common.scripts import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.so.logger.ErrorCode import static org.apache.commons.lang3.StringUtils.isBlank; @@ -40,7 +41,6 @@ import org.onap.so.client.aai.AAIResourcesClient import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -196,7 +196,7 @@ class AllottedResourceUtils { getAAIClient().update(uri,allottedResource) }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - "Exception in updateAR.", "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), e.getMessage()); + "Exception in updateAR.", "BPMN", ErrorCode.UnknownError.getValue(), e.getMessage()); exceptionUtil.buildAndThrowWorkflowException(execution, 500, 'Internal Error in updateAROrchStatus.' + e.getMessage()) } logger.trace("Exit updateAROrchStatus ") diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy index 3545361811..4a59b9789a 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy @@ -26,9 +26,9 @@ import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.core.json.JsonUtils import org.onap.appc.client.lcm.model.Action -import org.onap.so.client.appc.ApplicationControllerAction; +import org.onap.so.client.appc.ApplicationControllerAction +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -122,7 +122,7 @@ public class AppCClient extends AbstractServiceTaskProcessor{ catch (BpmnError e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); appcMessage = e.getMessage() } execution.setVariable("errorCode", appcCode) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy index 11c2bb265d..0d9b3c5b94 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy @@ -31,8 +31,9 @@ import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.HttpClient import org.onap.so.client.HttpClientFactory +import org.onap.so.logger.ErrorCode import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger + import org.slf4j.Logger import org.slf4j.LoggerFactory import org.onap.so.utils.TargetEntity @@ -81,7 +82,7 @@ class CatalogDbUtils { catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception in Querying Catalog DB", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), e.message); + ErrorCode.UnknownError.getValue(), e.message); throw e } @@ -119,7 +120,7 @@ class CatalogDbUtils { catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception in Querying Catalog DB", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), e.message); + ErrorCode.UnknownError.getValue(), e.message); throw e } } @@ -143,7 +144,7 @@ class CatalogDbUtils { catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception in Querying Catalog DB", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), e.message); + ErrorCode.UnknownError.getValue(), e.message); throw e } @@ -169,7 +170,7 @@ class CatalogDbUtils { catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception in Querying Catalog DB", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), e.message); + ErrorCode.UnknownError.getValue(), e.message); throw e } @@ -219,7 +220,7 @@ class CatalogDbUtils { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception in parsing Catalog DB Response", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), e.message); + ErrorCode.UnknownError.getValue(), e.message); } return modelInfos @@ -298,7 +299,7 @@ class CatalogDbUtils { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception in parsing Catalog DB Response", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), e.message); + ErrorCode.UnknownError.getValue(), e.message); } return modelInfos @@ -352,7 +353,7 @@ class CatalogDbUtils { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception in parsing Catalog DB Response", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), e.message); + ErrorCode.UnknownError.getValue(), e.message); } return modelInfos @@ -381,7 +382,7 @@ class CatalogDbUtils { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception in parsing Catalog DB Response", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), e.message); + ErrorCode.UnknownError.getValue(), e.message); } return serviceResourcesObject @@ -429,7 +430,7 @@ class CatalogDbUtils { catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception while parsing model information", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), e.message); + ErrorCode.UnknownError.getValue(), e.message); } return modelInfo } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy index 1c2862e00d..a9e01c7191 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy @@ -24,8 +24,8 @@ package org.onap.so.bpmn.common.scripts import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.logger.ErrorCode import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -75,7 +75,7 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor { throw e; } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' + - ' ' + method, "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ' ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) } @@ -238,7 +238,7 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) } logger.trace('Exited ' + method) @@ -271,7 +271,7 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) } @@ -309,7 +309,7 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) } } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy index dfe0772cab..6a82512d88 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy @@ -26,6 +26,7 @@ package org.onap.so.bpmn.common.scripts import joptsimple.internal.Strings import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.logger.ErrorCode import org.springframework.http.HttpStatus import javax.ws.rs.core.UriBuilder @@ -37,7 +38,6 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.constants.Defaults import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -132,7 +132,7 @@ public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{ public void handleAAIQueryFailure(DelegateExecution execution) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Error occurred attempting to query AAI, Response Code " + execution.getVariable("CVGN_queryVolumeGroupResponseCode"), - "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), + "BPMN", ErrorCode.UnknownError.getValue(), "ErrorResponse is:\n" + execution.getVariable("CVGN_queryVolumeGroupResponse")); } @@ -141,7 +141,7 @@ public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{ def errorNotAssociated = "Error occurred - volume group id ${execution.getVariable('CVGN_volumeGroupId')} " + "is not associated with ${execution.getVariable('CVGN_volumeGroupName')}" logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), errorNotAssociated, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, errorNotAssociated) } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy index f2d5a61542..7c1c0a0490 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy @@ -31,8 +31,8 @@ import org.onap.so.client.aai.entities.Relationships import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.constants.Defaults +import org.onap.so.logger.ErrorCode import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -107,7 +107,7 @@ class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{ }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing queryAAIForVolumeGroup.", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), e.getMessage()); + ErrorCode.UnknownError.getValue(), e.getMessage()); exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in preProcessRequest.") } logger.trace("COMPLETED queryAAIForVolumeGroup Process ") @@ -129,7 +129,7 @@ class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{ }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing assignVolumeHeatId.", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), e); + ErrorCode.UnknownError.getValue(), e); exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in assignVolumeHeatId.") } logger.trace("COMPLETED assignVolumeHeatId Process ") @@ -149,7 +149,7 @@ class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{ }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing assignWorkflowException.", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), e); + ErrorCode.UnknownError.getValue(), e); } logger.trace("COMPLETED Assign Workflow Exception =") } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy index 8bc97f7f40..c1f9f5b0b3 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy @@ -32,8 +32,8 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.client.graphinventory.entities.uri.Depth import org.onap.so.db.catalog.beans.OrchestrationStatus +import org.onap.so.logger.ErrorCode import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -426,7 +426,7 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{ public void handleAAIQueryFailure(DelegateExecution execution) { logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Error occurred attempting to query AAI, Response Code " + execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") + ", Error Response " + execution.getVariable("CAAIVfMod_queryGenericVnfResponse"), - "BPMN", MsoLogger.ErrorCode.UnknownError.getValue()); + "BPMN", ErrorCode.UnknownError.getValue()); int code = execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") exceptionUtil.buildAndThrowWorkflowException(execution, code, "Error occurred attempting to query AAI") @@ -478,7 +478,7 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Error occurred during CreateAAIVfModule flow", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), errorResponse); + ErrorCode.UnknownError.getValue(), errorResponse); exceptionUtil.buildAndThrowWorkflowException(execution, errorCode, errorResponse) logger.debug("Workflow exception occurred in CreateAAIVfModule: " + errorResponse) } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy index e6beac6742..83f31450b8 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy @@ -27,8 +27,8 @@ import org.onap.so.client.aai.AAIObjectType import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.client.graphinventory.entities.uri.Depth +import org.onap.so.logger.ErrorCode import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -208,7 +208,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{ public void handleAAIQueryFailure(DelegateExecution execution) { logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Error occurred attempting to query AAI, Response Code " + execution.getVariable("DAAIVfMod_queryGenericVnfResponseCode") + ", Error Response " + execution.getVariable("DAAIVfMod_queryGenericVnfResponse"), - "BPMN", MsoLogger.ErrorCode.UnknownError.getValue()); + "BPMN", ErrorCode.UnknownError.getValue()); def errorCode = 5000 // set the errorCode to distinguish between a A&AI failure // and the Generic Vnf Id not found @@ -255,7 +255,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Error occurred during DeleteAAIVfModule flow", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), errorResponse); + ErrorCode.UnknownError.getValue(), errorResponse); exceptionUtil.buildAndThrowWorkflowException(execution, errorCode, errorResponse) } @@ -265,7 +265,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{ public void handleDeleteGenericVnfFailure(DelegateExecution execution) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "AAI error occurred deleting the Generic Vnf", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), + ErrorCode.UnknownError.getValue(), execution.getVariable("DAAIVfMod_deleteGenericVnfResponse")); exceptionUtil.buildAndThrowWorkflowException(execution, 5000, execution.getVariable("DAAIVfMod_deleteGenericVnfResponse")) } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy index b062974c98..30dbeb09d5 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy @@ -22,6 +22,8 @@ package org.onap.so.bpmn.common.scripts +import org.onap.so.logger.ErrorCode + import static org.apache.commons.lang3.StringUtils.* import com.google.common.xml.XmlEscapers @@ -31,7 +33,6 @@ import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.core.WorkflowException import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -91,7 +92,7 @@ class ExceptionUtil extends AbstractServiceTaskProcessor { wfex = execution.getVariable("WorkflowException") logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), wfex.errorMessage); + ErrorCode.UnknownError.getValue(), wfex.errorMessage); return wfex } else { try { @@ -104,7 +105,7 @@ class ExceptionUtil extends AbstractServiceTaskProcessor { logger.debug("mappedErrorMessage " + mappedErrorMessage) wfex = execution.getVariable("WorkflowException") logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), wfex.errorMessage); + ErrorCode.UnknownError.getValue(), wfex.errorMessage); return wfex } catch(Exception ex) { logger.debug("error mapping error, return null: " + ex) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy index d4c5d2f7bb..2ceec3cb44 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy @@ -23,13 +23,13 @@ package org.onap.so.bpmn.common.scripts import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.logger.ErrorCode import java.text.SimpleDateFormat import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -99,7 +99,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) } } @@ -212,7 +212,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in" + method) } @@ -246,7 +246,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) } } @@ -277,7 +277,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) } } @@ -308,7 +308,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) } } @@ -337,7 +337,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) } } @@ -357,7 +357,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) } } @@ -392,7 +392,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor { // Do NOT throw WorkflowException! logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); } } } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy index 0d39ea15f8..740d9f70b6 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy @@ -24,6 +24,7 @@ package org.onap.so.bpmn.common.scripts import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.client.HttpClientFactory +import org.onap.so.logger.ErrorCode import java.io.Serializable; @@ -42,7 +43,6 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.client.graphinventory.entities.uri.Depth import org.onap.so.utils.TargetEntity import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -161,7 +161,7 @@ public class GenerateVfModuleName extends AbstractServiceTaskProcessor{ } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAI(): ' + e.getMessage()) } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy index 8c67a42b6d..d5e88a8868 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy @@ -20,7 +20,9 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.bpmn.common.scripts; +package org.onap.so.bpmn.common.scripts + +import org.onap.so.logger.ErrorCode; import static org.apache.commons.lang3.StringUtils.*; @@ -44,7 +46,6 @@ import org.onap.so.bpmn.core.domain.ServiceDecomposition import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.ruby.* import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -286,7 +287,7 @@ public class ManualHandling extends AbstractServiceTaskProcessor { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) } @@ -337,11 +338,11 @@ public class ManualHandling extends AbstractServiceTaskProcessor { } catch (BpmnError e) { msg = "BPMN error in createAOTSTicket " + ex.getMessage() logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); } catch (Exception ex){ msg = "Exception in createAOTSTicket " + ex.getMessage() logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); } logger.trace("Exit createAOTSTicket of ManualHandling ") } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy index 10d02686cc..324cc63649 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy @@ -22,6 +22,8 @@ package org.onap.so.bpmn.common.scripts +import org.onap.so.logger.ErrorCode + import java.text.SimpleDateFormat import org.apache.commons.codec.binary.Base64 @@ -29,7 +31,6 @@ import org.apache.commons.lang3.StringEscapeUtils import org.onap.so.bpmn.core.BPMNLogger import org.onap.so.bpmn.core.xml.XmlTool import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory import org.onap.so.utils.CryptoUtils @@ -296,13 +297,11 @@ class MsoUtils { if ("INFO"==logmode) { logger.info(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, logtxt, "BPMN"); } else if ("WARN"==logmode) { - // to see the warning text displayed in the log entry, the text must also be passed as arg0 (2nd argument) to invoke the correct MsoLogger warn() method logger.warn ("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING.toString(), logtxt, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), logtxt); + ErrorCode.UnknownError.getValue(), logtxt); } else if ("ERROR"==logmode) { - // to see the error text displayed in the log entry, the text must also be passed as arg0 (2nd argument) to invoke the correct MsoLogger error() method logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), logtxt, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), logtxt); + ErrorCode.UnknownError.getValue(), logtxt); } else { BPMNLogger.debug(isDebugLogEnabled, logtxt); diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy index 259808feb6..50c4e56547 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy @@ -38,7 +38,6 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.client.graphinventory.entities.uri.Depth import org.springframework.web.util.UriUtils import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy index 3a93d48da3..a0da6870ae 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy @@ -29,8 +29,8 @@ import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.logger.ErrorCode import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -67,7 +67,7 @@ public void preProcessRequest (DelegateExecution execution) { String msg = getProcessKey(execution) + ': Missing or empty input variable \'RCVWFMSG_timeout\'' logger.debug(msg) logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -78,7 +78,7 @@ public void preProcessRequest (DelegateExecution execution) { String msg = getProcessKey(execution) + ': Missing or empty input variable \'RCVWFMSG_messageType\'' logger.debug(msg) logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -89,7 +89,7 @@ public void preProcessRequest (DelegateExecution execution) { String msg = getProcessKey(execution) + ': Missing or empty input variable \'RCVWFMSG_correlator\'' logger.debug(msg) logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } execution.setVariable(messageType + '_CORRELATOR', correlator) @@ -101,7 +101,7 @@ public void preProcessRequest (DelegateExecution execution) { String msg = 'Caught exception in ' + method + ": " + e logger.debug(msg) logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy index cf0e35a59f..d909a77cc2 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy @@ -21,14 +21,14 @@ */ package org.onap.so.bpmn.common.scripts; -import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.logger.ErrorCode; import java.text.SimpleDateFormat import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.core.WorkflowException import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -75,7 +75,7 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor { } catch (IOException ex) { logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Unable to encode username password string", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); } // TODO Use variables instead of passing xml request - Huh? diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy index fd5dbaea90..8b04803050 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy @@ -23,6 +23,7 @@ package org.onap.so.bpmn.common.scripts import org.onap.so.client.HttpClientFactory +import org.onap.so.logger.ErrorCode import java.text.SimpleDateFormat import javax.ws.rs.core.Response @@ -43,7 +44,6 @@ import org.onap.so.bpmn.core.domain.RollbackData import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.HttpClient import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory import org.onap.so.utils.TargetEntity @@ -87,7 +87,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': mso:adapters:sdnc:rest:endpoint URN mapping is not defined' logger.debug(msg) logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -108,7 +108,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': no sdncRequestId in ' + requestType logger.debug(msg) logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -123,7 +123,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': no bpNotificationUrl in ' + requestType logger.debug(msg) logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -140,7 +140,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType logger.debug(msg) logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -156,7 +156,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { logger.debug(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined") logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); } else { try { def encodedString = utils.getBasicAuth(basicAuthValue, UrnPropertiesReader.getVariable("mso.msoKey", execution)) @@ -165,7 +165,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { logger.debug(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter") logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter", - "BPMN", MsoLogger.ErrorCode.UnknownError.getValue()); + "BPMN", ErrorCode.UnknownError.getValue()); } } @@ -196,7 +196,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = 'Caught exception in ' + method + ": " + e logger.debug(msg) logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } } @@ -244,7 +244,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = 'Unsupported HTTP method "' + sdncAdapterMethod + '" in ' + method + ": " + e logger.debug(msg) logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -258,7 +258,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = 'Caught exception in ' + method + ": " + e logger.debug(msg, e) logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } } @@ -372,7 +372,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = 'Caught exception in ' + method + ": " + e logger.debug(msg) logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } } @@ -398,7 +398,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = 'Caught exception in ' + method + ": " + e logger.debug(msg) logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy index cd86120860..c1d68c5f7c 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy @@ -22,6 +22,8 @@ package org.onap.so.bpmn.common.scripts +import org.onap.so.logger.ErrorCode + import java.text.SimpleDateFormat import java.net.URLEncoder @@ -38,7 +40,6 @@ import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -85,7 +86,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { String msg = getProcessKey(execution) + ': mso:adapters:sdnc:rest:endpoint URN mapping is not defined' logger.debug(msg) logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -106,7 +107,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { String msg = getProcessKey(execution) + ': no sdncRequestId in ' + requestType logger.debug(msg) logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -121,7 +122,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { String msg = getProcessKey(execution) + ': no bpNotificationUrl in ' + requestType logger.debug(msg) logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -132,7 +133,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType logger.debug(msg) logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -151,7 +152,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { logger.debug(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined") logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); } else { try { def encodedString = utils.getBasicAuth(basicAuthValue, UrnPropertiesReader.getVariable("mso.msoKey", execution)) @@ -160,7 +161,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { logger.debug(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter") logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter", - "BPMN", MsoLogger.ErrorCode.UnknownError.getValue()); + "BPMN", ErrorCode.UnknownError.getValue()); } } @@ -191,7 +192,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { String msg = 'Caught exception in ' + method + ": " + e logger.debug(msg) logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy index 085e82ca24..e6d54b8681 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy @@ -26,11 +26,11 @@ import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.L3Network import org.onap.so.bpmn.core.WorkflowException -import org.onap.so.bpmn.core.json.JsonUtils; +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.logger.ErrorCode; import org.springframework.web.util.UriUtils import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -265,7 +265,7 @@ class SDNCAdapterUtils { if (callbackUrl == null || callbackUrl.trim() == "") { logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'mso:workflow:sdncadapter:callback URN is not set', "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); workflowException(execution, 'Internal Error', 9999) // TODO: what message and error code? } @@ -403,7 +403,7 @@ class SDNCAdapterUtils { if (callbackUrl == null || callbackUrl.trim() == "") { logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'mso:workflow:sdncadapter:callback URN is not set', "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Internal Error - During PreProcess Request") } @@ -476,7 +476,7 @@ class SDNCAdapterUtils { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error") } } @@ -983,7 +983,7 @@ class SDNCAdapterUtils { }else { logger.warn("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING, 'sdncAdapter did not complete successfully, sdncAdapter Success Indicator was false ', - "BPMN", MsoLogger.ErrorCode.UnknownError, + "BPMN", ErrorCode.UnknownError, 'sdncAdapter did not complete successfully, sdncAdapter Success Indicator was false ') execution.setVariable("L3HLAB_rollback", true) def msg = trinityExceptionUtil.intDataResponseCode(response, execution) @@ -993,7 +993,7 @@ class SDNCAdapterUtils { if (response == null || response.trim().equals("")) { logger.warn("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING, 'sdncAdapter workflow response is empty', "BPMN", - MsoLogger.ErrorCode.UnknownError, 'sdncAdapter workflow response is empty') + ErrorCode.UnknownError, 'sdncAdapter workflow response is empty') execution.setVariable("L3HLAB_rollback", true) def msg = trinityExceptionUtil.buildException("Exception occurred while validating SDNC response " , execution) exceptionUtil.buildAndThrowWorkflowException(execution, intResponseCode, msg) @@ -1005,7 +1005,7 @@ class SDNCAdapterUtils { throw e; } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught ' + - 'exception in ' + method, "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + 'exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable(prefix+"ResponseCode",400) execution.setVariable("L3HLAB_rollback", true) def msg = trinityExceptionUtil.buildException("Exception occurred while validating SDNC response: " + e.getMessage(), execution) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy index c489778d36..615c977a1e 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy @@ -24,8 +24,8 @@ package org.onap.so.bpmn.common.scripts import org.camunda.bpm.engine.delegate.DelegateExecution import org.apache.commons.lang3.* +import org.onap.so.logger.ErrorCode import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -216,7 +216,7 @@ class TrinityExceptionUtil { if(message != null) { execution.setVariable(prefix+"ErrorResponse",message) logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), + ErrorCode.UnknownError.getValue(), execution.getVariable(prefix+"ErrorResponse")); return message } else { @@ -312,7 +312,7 @@ class TrinityExceptionUtil { execution.setVariable(prefix+"errTxt", messageTxt) execution.setVariable(prefix+"errVariables", msgVars) logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), + ErrorCode.UnknownError.getValue(), execution.getVariable(prefix+"ErrorResponse")); return message }catch(Exception ex) { diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy index fd45cb5a03..796ee43cf4 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy @@ -30,8 +30,8 @@ import org.onap.so.client.aai.AAIObjectType import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.client.graphinventory.entities.uri.Depth +import org.onap.so.logger.ErrorCode import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -183,7 +183,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor { if (newPersonaModelId != genericVnf.getModelInvariantId()) { def msg = 'Can\'t update Generic VNF ' + vnfId + ' since there is \'persona-model-id\' mismatch between the current and new values' logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()) + ErrorCode.UnknownError.getValue()) throw new Exception(msg) } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.groovy index 92a043e65a..9b12413177 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.groovy @@ -30,7 +30,6 @@ import org.onap.so.bpmn.core.WorkflowException import org.onap.so.client.aai.AAIObjectType import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy index 536d9062c0..c4ef165f63 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy @@ -20,7 +20,9 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.bpmn.common.scripts; +package org.onap.so.bpmn.common.scripts + +import org.onap.so.logger.ErrorCode; import javax.xml.parsers.DocumentBuilder import javax.xml.parsers.DocumentBuilderFactory @@ -31,7 +33,6 @@ import org.w3c.dom.Node import org.w3c.dom.NodeList import org.xml.sax.InputSource import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -111,7 +112,7 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor { } catch (Exception e) { logger.warn("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING.toString(), 'Exception transforming network params to vnfNetworks', "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), 'Exception is: \n' + e); + ErrorCode.UnknownError.getValue(), 'Exception is: \n' + e); } return vnfNetworks } @@ -150,7 +151,7 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor { } catch (Exception e) { logger.warn("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING.toString(), 'Exception transforming params to entries', "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), 'Exception transforming params to entries' + e); + ErrorCode.UnknownError.getValue(), 'Exception transforming params to entries' + e); } return entries } @@ -191,7 +192,7 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor { } catch (Exception e) { logger.warn("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING.toString(), 'Exception transforming params to entries', "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), 'Exception transforming params to entries' + e); + ErrorCode.UnknownError.getValue(), 'Exception transforming params to entries' + e); } return entries } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy index d8b2c4f5c0..ac67d949a5 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy @@ -23,6 +23,7 @@ package org.onap.so.bpmn.common.scripts import org.onap.so.client.HttpClientFactory +import org.onap.so.logger.ErrorCode import javax.ws.rs.core.Response import org.apache.commons.lang3.* @@ -31,7 +32,6 @@ import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.client.HttpClient import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory import org.onap.so.utils.TargetEntity @@ -79,7 +79,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (messageId == null || messageId.isEmpty()) { String msg = getProcessKey(execution) + ': no messageId in ' + requestType logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -93,7 +93,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (notificationUrl == null || notificationUrl.isEmpty()) { String msg = getProcessKey(execution) + ': no notificationUrl in ' + requestType logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -107,7 +107,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (vnfAdapterEndpoint == null || vnfAdapterEndpoint.isEmpty()) { String msg = getProcessKey(execution) + ': mso:adapters:vnf:rest:endpoint URN mapping is not defined' logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -125,7 +125,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (vnfId == null || vnfId.isEmpty()) { String msg = getProcessKey(execution) + ': no vnfId in ' + requestType logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -138,7 +138,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (vnfId == null || vnfId.isEmpty()) { String msg = getProcessKey(execution) + ': no vnfId in ' + requestType logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -147,7 +147,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (vfModuleId == null || vfModuleId.isEmpty()) { String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -161,7 +161,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (vnfId == null || vnfId.isEmpty()) { String msg = getProcessKey(execution) + ': no vnfId in ' + requestType logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -170,7 +170,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (vfModuleId == null || vfModuleId.isEmpty()) { String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -184,7 +184,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (vfModuleRollbackNode == null) { String msg = getProcessKey(execution) + ': no vfModuleRollback in ' + requestType logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -193,7 +193,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (vnfId == null || vnfId.isEmpty()) { String msg = getProcessKey(execution) + ': no vnfId in ' + requestType logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -202,7 +202,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (vfModuleId == null || vfModuleId.isEmpty()) { String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -223,7 +223,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (volumeGroupId == null || volumeGroupId.isEmpty()) { String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -239,7 +239,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (volumeGroupId == null || volumeGroupId.isEmpty()) { String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -255,7 +255,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (volumeGroupId == null || volumeGroupId.isEmpty()) { String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -268,7 +268,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { } else { String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -286,7 +286,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (basicAuthValue == null || basicAuthValue.isEmpty()) { logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); } else { try { def encodedString = utils.getBasicAuth(basicAuthValue, UrnPropertiesReader.getVariable("mso.msoKey", execution)) @@ -294,7 +294,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { } catch (IOException ex) { logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), getProcessKey(execution) + ": Unable to encode BasicAuth credentials for VnfAdapter", - "BPMN", MsoLogger.ErrorCode.UnknownError.getValue()); + "BPMN", ErrorCode.UnknownError.getValue()); } } @@ -304,7 +304,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { } catch (Exception e) { String msg = 'Caught exception in ' + method + ": " + e logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -356,7 +356,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { } else { String msg = 'Unsupported HTTP method "' + vnfAdapterMethod + '" in ' + method + ": " + e logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -369,7 +369,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { } catch (Exception e) { String msg = 'Caught exception in ' + method + ": " + e logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy index 4d74ac374e..c947bf2e65 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy @@ -25,8 +25,8 @@ package org.onap.so.bpmn.common.scripts import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution; import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.logger.ErrorCode import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -88,7 +88,7 @@ class VnfAdapterUtils { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 5000, 'Internal Error- Unable to validate VNF Response ' + e.getMessage()) } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java index 2dbf2feaf7..526f5d5288 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java @@ -35,13 +35,12 @@ import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.HttpClientBuilder; import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.onap.so.utils.CryptoUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; /** @@ -185,7 +184,7 @@ public class BpmnRestClient { logger.trace("request body is {}", jsonReq); } catch(Exception e) { logger.error("{} {} {} {} {}", MessageEnum.APIH_WARP_REQUEST.toString(), "Camunda", "wrapVIDRequest", - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e); + ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e); } return jsonReq; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java index 61f92313f7..0de3414381 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java @@ -26,8 +26,8 @@ package org.onap.so.bpmn.common.workflow.context; import java.util.concurrent.DelayQueue; import java.util.concurrent.TimeUnit; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; @@ -121,7 +121,6 @@ public class WorkflowContextHolder { while (!isInterrupted()) { try { WorkflowContext requestObject = responseQueue.take(); - MsoLogger.setLogContext(requestObject.getRequestId(), null); logger.debug("Time remaining for request id: {}:{}", requestObject.getRequestId(), requestObject .getDelay (TimeUnit.MILLISECONDS)); @@ -132,7 +131,7 @@ public class WorkflowContextHolder { } catch (Exception e) { logger.debug("WorkflowContextHolder timeout thread caught exception: ", e); logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Error in WorkflowContextHolder timeout thread"); + ErrorCode.UnknownError.getValue(), "Error in WorkflowContextHolder timeout thread"); } } logger.debug("WorkflowContextHolder timeout thread interrupted, quitting"); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java index 916d24e8dc..cb65f4d420 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java @@ -27,8 +27,8 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.common.DelegateExecutionImpl; import org.onap.so.bpmn.core.WorkflowException; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; @@ -55,7 +55,7 @@ public class ExceptionBuilder { } logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), msg.toString()); + ErrorCode.UnknownError.getValue(), msg.toString()); execution.setVariable(errorVariable, exception.getMessage()); } catch (Exception ex){ //log trace, allow process to complete gracefully @@ -84,7 +84,7 @@ public class ExceptionBuilder { } } logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), msg.toString()); + ErrorCode.UnknownError.getValue(), msg.toString()); execution.setVariable(errorVariable, exception.getMessage()); } catch (Exception ex){ //log trace, allow process to complete gracefully diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java index 4ab22f4616..46a6fa3ef3 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java @@ -33,8 +33,8 @@ import org.camunda.bpm.engine.RuntimeService; import org.camunda.bpm.engine.runtime.Execution; import org.camunda.bpm.engine.runtime.MessageCorrelationResult; import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -221,7 +221,7 @@ public class CallbackHandlerService { + queryException; logger.debug(msg); logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), msg, queryException); + ErrorCode.UnknownError.getValue(), msg, queryException); } return false; @@ -264,7 +264,7 @@ public class CallbackHandlerService { + "': " + ole; logger.debug(msg); logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN CORRELATION ERROR -", - MsoLogger.ErrorCode.UnknownError.getValue(), msg, ole); + ErrorCode.UnknownError.getValue(), msg, ole); //Retry for OptimisticLocking Exceptions int retryCount = 0; @@ -297,14 +297,14 @@ public class CallbackHandlerService { String strMsg = "Received exception, OptimisticLockingException retry failed, retryCount:" + retryCount + " | exception returned: " + olex; logger.debug(strMsg); logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), strMsg, olex); + ErrorCode.UnknownError.getValue(), strMsg, olex); } catch (Exception excep) { retryCount = 0; //oleFlag = ex instanceof org.camunda.bpm.engine.OptimisticLockingException; String strMsg = "Received exception, OptimisticLockingException retry failed, retryCount:" + retryCount + " | exception returned: " + excep; logger.debug(strMsg); logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), strMsg, excep); + ErrorCode.UnknownError.getValue(), strMsg, excep); } } @@ -318,7 +318,7 @@ public class CallbackHandlerService { + "': " + e; logger.debug(msg); logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), msg, e); + ErrorCode.UnknownError.getValue(), msg, e); } } catch (Exception e) { // This must be an exception from the flow itself. Log it, but don't @@ -328,7 +328,7 @@ public class CallbackHandlerService { + "': " + e; logger.debug(msg); logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN CORRELATION ERROR -", - MsoLogger.ErrorCode.UnknownError.getValue(), msg, e); + ErrorCode.UnknownError.getValue(), msg, e); } return true; @@ -364,10 +364,10 @@ public class CallbackHandlerService { protected void logCallbackError(String method, long startTime, String msg, Exception e) { if (e == null) { logger.error("{} {} {} {}", MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), msg); + ErrorCode.UnknownError.getValue(), msg); } else { logger.error("{} {} {} {}", MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), msg, e); + ErrorCode.UnknownError.getValue(), msg, e); } } diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java index 267e24fec4..a74bdfc649 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java @@ -34,7 +34,6 @@ import org.onap.so.bpmn.common.adapter.sdnc.SDNCAdapterResponse; import org.onap.so.bpmn.common.adapter.sdnc.SDNCCallbackAdapterPortType; import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackError; import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackResult; -import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -65,8 +64,6 @@ public class SDNCAdapterCallbackServiceImpl extends ProcessEngineAwareService im String correlationVariable = "SDNCA_requestId"; String correlationValue = sdncAdapterCallbackRequest.getCallbackHeader().getRequestId(); - MsoLogger.setLogContext(correlationValue, "N/A"); - CallbackResult result = callback.handleCallback(method, message, messageEventName, messageVariable, correlationVariable, correlationValue, logMarker); diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java index 65cc70d5f4..ed524c115e 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java @@ -40,7 +40,6 @@ import org.onap.so.bpmn.common.adapter.vnf.UpdateVnfNotification; import org.onap.so.bpmn.common.adapter.vnf.VnfAdapterNotify; import org.onap.so.bpmn.common.adapter.vnf.VnfRollback; import org.onap.so.bpmn.common.adapter.vnf.VnfStatus; -import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -118,8 +117,6 @@ public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService imple String correlationVariable = "VNFQ_messageId"; String correlationValue = messageId; - MsoLogger.setLogContext(correlationValue, "N/A"); - QueryVnfNotification message = new QueryVnfNotification(); message.setMessageId(messageId); @@ -161,8 +158,6 @@ public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService imple String correlationVariable = "VNFC_messageId"; String correlationValue = messageId; - MsoLogger.setLogContext(correlationValue, "N/A"); - CreateVnfNotification message = new CreateVnfNotification(); message.setMessageId(messageId); @@ -201,8 +196,6 @@ public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService imple String correlationVariable = "VNFU_messageId"; String correlationValue = messageId; - MsoLogger.setLogContext(correlationValue, "N/A"); - UpdateVnfNotification message = new UpdateVnfNotification(); message.setMessageId(messageId); @@ -236,8 +229,6 @@ public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService imple String correlationVariable = "VNFDEL_uuid"; String correlationValue = messageId; - MsoLogger.setLogContext(correlationValue, "N/A"); - DeleteVnfNotification message = new DeleteVnfNotification(); message.setMessageId(messageId); diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java index a5af553e1c..075102331c 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java @@ -36,8 +36,8 @@ import javax.ws.rs.core.Response; import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackError; import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackResult; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -79,7 +79,6 @@ public class WorkflowMessageResource{ String message) { String method = "receiveWorkflowMessage"; - MsoLogger.setLogContext(correlator, "N/A"); logger.debug(LOGMARKER + " Received workflow message" + " type='" + messageType + "'" @@ -91,7 +90,7 @@ public class WorkflowMessageResource{ String msg = "Missing message type"; logger.debug(LOGMARKER + " " + msg); logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", - MsoLogger.ErrorCode.DataError.getValue(), LOGMARKER + ":" + msg); + ErrorCode.DataError.getValue(), LOGMARKER + ":" + msg); return Response.status(400).entity(msg).build(); } @@ -99,7 +98,7 @@ public class WorkflowMessageResource{ String msg = "Missing correlator"; logger.debug(LOGMARKER + " " + msg); logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", - MsoLogger.ErrorCode.DataError.getValue(), LOGMARKER + ":" + msg); + ErrorCode.DataError.getValue(), LOGMARKER + ":" + msg); return Response.status(400).entity(msg).build(); } diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java index d10ecd1ce2..a5d479ae41 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java @@ -50,8 +50,8 @@ import org.camunda.bpm.engine.variable.Variables.SerializationDataFormats; import org.camunda.bpm.engine.variable.impl.VariableMapImpl; import org.onap.so.bpmn.common.workflow.context.WorkflowResponse; import org.onap.so.bpmn.core.WorkflowException; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.MDC; @@ -202,7 +202,7 @@ public class WorkflowResource extends ProcessEngineAwareService { if (processInstance != null) workflowResponse.setProcessInstanceID(processInstance.getId()); logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "BPMN", MDC.get(processKey), - MsoLogger.ErrorCode.UnknownError.getValue(), + ErrorCode.UnknownError.getValue(), LOGMARKER + workflowResponse.getMessage() + " for processKey: " + processKey + " with response: " + workflowResponse.getResponse()); @@ -237,10 +237,6 @@ public class WorkflowResource extends ProcessEngineAwareService { } private void setLogContext(String processKey, Map<String, Object> inputVariables) { - if (inputVariables != null) { - MsoLogger.setLogContext(getValueFromInputVariables(inputVariables, "mso-request-id"), - getValueFromInputVariables(inputVariables, "mso-service-instance-id")); - } } private String getValueFromInputVariables(Map<String,Object> inputVariables, String key) { @@ -591,7 +587,7 @@ public class WorkflowResource extends ProcessEngineAwareService { response.setProcessInstanceID(processInstanceId); logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "BPMN", MDC.get(processKey), - MsoLogger.ErrorCode.UnknownError.getValue(), + ErrorCode.UnknownError.getValue(), LOGMARKER + response.getMessage() + " for processKey: " + processKey + " with response: " + response .getResponse()); logger.debug("Exception :",ex); diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java index 04059557ae..f795bcc40e 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java @@ -56,8 +56,6 @@ import org.camunda.bpm.model.bpmn.instance.StartEvent; import org.onap.so.bpmn.core.BPMNLogger; -import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -316,7 +314,6 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin { String requestId = (String) execution.getVariable("mso-request-id"); String svcid = (String) execution.getVariable("mso-service-instance-id"); - MsoLogger.setLogContext(requestId, svcid); } } catch(Exception e) { logger.error("Exception occurred", e); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIVfModuleIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIVfModuleIT.java index 3dd2ac957c..2ba5c7286e 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIVfModuleIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIVfModuleIT.java @@ -40,7 +40,6 @@ import org.junit.Ignore; import org.junit.Test; import org.onap.so.BaseIntegrationTest; import org.onap.so.bpmn.mock.FileUtil; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy index 21426c1d51..bd465eb9a8 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy @@ -21,11 +21,12 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.bpmn.infrastructure.scripts; +package org.onap.so.bpmn.infrastructure.scripts -import static org.apache.commons.lang3.StringUtils.*; +import org.onap.so.logger.ErrorCode; + +import static org.apache.commons.lang3.StringUtils.* -import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor @@ -35,7 +36,6 @@ import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory import org.springframework.web.util.UriUtils @@ -327,7 +327,7 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing prepareInitServiceOperationStatus.", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage()) } logger.trace("finished prepareInitServiceOperationStatus") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy index 16f7d53087..19fe018e13 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy @@ -30,7 +30,6 @@ import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy index 116328b05d..712512fdc9 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy @@ -20,9 +20,8 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.bpmn.infrastructure.scripts; +package org.onap.so.bpmn.infrastructure.scripts -import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.v12.GenericVnf; @@ -35,9 +34,9 @@ import org.onap.so.bpmn.core.RollbackData import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.bpmn.infrastructure.aai.AAICreateResources; +import org.onap.so.bpmn.infrastructure.aai.AAICreateResources +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory import org.w3c.dom.* @@ -254,7 +253,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { //execution.setVariable("CVFMODVOL2_isDataOk", false) logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), " Exception Encountered - " + "\n" + restFaultMessage, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - During PreProcessRequest") } @@ -304,7 +303,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Encountered ", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) } } @@ -405,7 +404,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing PostProcessResponse - " + "\n", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("CVFMI_ErrorResponse", "Error Occured during PostProcessResponse Method:\n" + e.getMessage()) } logger.trace("COMPLETED PostProcessResponse Process") @@ -482,7 +481,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Caught exception in " + method , "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message") } } @@ -531,7 +530,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing prepareUpdateInfraRequest.", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareUpdateInfraRequest Method:\n" + e.getMessage()) } logger.trace("COMPLETED prepareUpdateInfraRequest Process") @@ -587,7 +586,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Caught exception in " + method , "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error') } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy index 26690ece48..5ba90eb989 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy @@ -22,21 +22,17 @@ package org.onap.so.bpmn.infrastructure.scripts -import org.apache.commons.collections.CollectionUtils import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution -import org.onap.aai.domain.yang.SearchResults import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor; import org.onap.so.bpmn.common.scripts.ExceptionUtil; import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.WorkflowException import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.AAIResultWrapper import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.so.logger.ErrorCode import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -311,7 +307,7 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { execution.setVariable(prefix+'FalloutHandlerRequest', xmlHandlerRequest) logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Overall Error Response " + - "going to FalloutHandler", "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "\n" + xmlHandlerRequest); + "going to FalloutHandler", "BPMN", ErrorCode.UnknownError.getValue(), "\n" + xmlHandlerRequest); } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy index 1c2975b06c..c0e8d5a6ba 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy @@ -23,6 +23,7 @@ package org.onap.so.bpmn.infrastructure.scripts import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory +import org.onap.so.logger.ErrorCode import static org.apache.commons.lang3.StringUtils.*; @@ -42,7 +43,6 @@ import org.onap.so.bpmn.core.domain.VnfResource import org.onap.so.bpmn.core.json.JsonUtils; import org.onap.so.bpmn.infrastructure.aai.groovyflows.AAICreateResources; import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -169,7 +169,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing' logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -195,7 +195,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { throw b }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), " Error Occurred in " + - "CreateVnfInfra PreProcessRequest method", "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e) + "CreateVnfInfra PreProcessRequest method", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occurred in CreateVnfInfra PreProcessRequest") } @@ -221,7 +221,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { } catch (Exception ex) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), " Error Occurred in CreateVnfInfra SendSyncResponse Process", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e) + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVnfInfra SendSyncResponse Process") } @@ -247,7 +247,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occurred Processing preProcessSDNCAssignRequest", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e) + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareProvision Method:\n" + e.getMessage()) } logger.trace("COMPLETED preProcessSDNCAssignRequest") @@ -271,7 +271,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured " + - "Processing preProcessSDNCActivateRequest", "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e) + "Processing preProcessSDNCActivateRequest", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCActivateRequest Method:\n" + e.getMessage()) } logger.trace("COMPLETED preProcessSDNCActivateRequest Process") @@ -462,7 +462,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { if (vnfs == null) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "No matching " + - "VNFs in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid, "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), ""); + "VNFs in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid, "BPMN", ErrorCode.UnknownError.getValue(), ""); exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "No matching VNFs in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid) } @@ -471,7 +471,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { if (vnf == null) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "No matching VNF" + - " in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid, "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), ""); + " in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid, "BPMN", ErrorCode.UnknownError.getValue(), ""); exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "No matching VNF in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid) } @@ -544,7 +544,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { }catch(Exception ex){ String msg = "Exception in LineOfBusiness. " + ex.getMessage(); logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex) + ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy index a19b7b7870..1e2f50148c 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy @@ -20,9 +20,8 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.bpmn.infrastructure.scripts; +package org.onap.so.bpmn.infrastructure.scripts -import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil @@ -30,14 +29,12 @@ import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.common.scripts.NetworkUtils import org.onap.so.bpmn.common.scripts.VidUtils import org.onap.so.bpmn.core.WorkflowException -import org.onap.so.bpmn.core.json.JsonUtils; +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory -import groovy.json.* - public class DeleteNetworkInstance extends AbstractServiceTaskProcessor { String Prefix="DELNI_" String groovyClassName = "DeleteNetworkInstance" @@ -359,7 +356,7 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequest) logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()) + ErrorCode.UnknownError.getValue()) } catch (Exception ex) { // caught exception @@ -382,7 +379,7 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequest) logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest,"BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex) + ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex) } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy index 234482f83c..3a1815cfe6 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy @@ -29,9 +29,9 @@ import org.onap.so.bpmn.common.scripts.ExceptionUtil; import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.common.scripts.VidUtils; import org.onap.so.bpmn.core.WorkflowException -import org.onap.so.bpmn.core.json.JsonUtils; +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -127,7 +127,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { catch(Exception e) { String restFaultMessage = e.getMessage() logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Caught exception", - "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), + "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Internal Error - During PreProcess Request") } @@ -161,7 +161,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Caught exception in " + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage()) } } @@ -204,7 +204,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Caught exception in " + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) } } @@ -230,7 +230,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { throw e; } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' - + method, "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepDoDeleteVfModule(): ' + e.getMessage()) } } @@ -279,7 +279,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepInfraRequest(): ' + e.getMessage()) } } @@ -324,7 +324,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error') } } @@ -377,7 +377,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error') } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy index c48527a64f..ccd9f9bd02 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy @@ -20,9 +20,8 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.bpmn.infrastructure.scripts; +package org.onap.so.bpmn.infrastructure.scripts -import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.VolumeGroup @@ -35,17 +34,13 @@ import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.client.aai.AAIObjectType import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.Relationships import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.constants.Defaults +import org.onap.so.logger.ErrorCode import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory -import org.springframework.web.util.UriUtils - - import groovy.json.JsonSlurper import javax.ws.rs.NotFoundException @@ -466,7 +461,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { execution.setVariable("DELVfModVol_FalloutHandlerRequest", xmlHandlerRequest) logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Overall Error Response going to FalloutHandler", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "\n" + xmlHandlerRequest); + ErrorCode.UnknownError.getValue(), "\n" + xmlHandlerRequest); } @@ -487,7 +482,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { ' retrieved from AAI for Volume Group Id ' + volumeGroupId logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Error in DeleteVfModuleVolume: " + "\n" + errorMessage, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); ExceptionUtil exceptionUtil = new ExceptionUtil() exceptionUtil.buildWorkflowException(execution, 5000, errorMessage) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy index e35268c45a..125c3e4504 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy @@ -20,7 +20,9 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -package org.onap.so.bpmn.infrastructure.scripts; +package org.onap.so.bpmn.infrastructure.scripts + +import org.onap.so.logger.ErrorCode; import static org.apache.commons.lang3.StringUtils.*; @@ -44,7 +46,6 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.bpmn.infrastructure.workflow.service.ServicePluginFactory import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -444,7 +445,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preInitResourcesOperStatus.", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), e); + ErrorCode.UnknownError.getValue(), e); execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage()) } logger.trace("COMPLETED preInitResourcesOperStatus Process ") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy index 418a1bdd9b..468f603ef6 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy @@ -32,8 +32,8 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.HttpClient +import org.onap.so.logger.ErrorCode import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory import org.onap.so.bpmn.core.UrnPropertiesReader @@ -236,7 +236,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception occured while executing AAI Put Call", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); throw new BpmnError("MSOWorkflowException") } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy index 80bc201ecd..c03f9f9c95 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy @@ -24,6 +24,7 @@ package org.onap.so.bpmn.infrastructure.scripts import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory import org.onap.so.client.HttpClientFactory +import org.onap.so.logger.ErrorCode import javax.ws.rs.core.MediaType import javax.ws.rs.core.Response @@ -62,7 +63,6 @@ import org.onap.so.client.graphinventory.entities.uri.Depth import org.onap.so.constants.Defaults import org.onap.so.db.catalog.beans.HomingInstance import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -569,7 +569,7 @@ public class DoCreateVfModule extends VfModuleBase { if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing' logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), msg); + ErrorCode.UnknownError.getValue(), msg); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -622,7 +622,7 @@ public class DoCreateVfModule extends VfModuleBase { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Internal Error') } @@ -751,7 +751,7 @@ public class DoCreateVfModule extends VfModuleBase { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModule(): ' + e.getMessage()) } } @@ -832,7 +832,7 @@ public class DoCreateVfModule extends VfModuleBase { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModuleForStatus(): ' + e.getMessage()) } } @@ -868,7 +868,7 @@ public class DoCreateVfModule extends VfModuleBase { }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occurred Processing preProcessSDNCAssignRequest", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareProvision Method:\n" + e.getMessage()) } logger.trace("COMPLETED preProcessSDNCAssignRequest") @@ -962,7 +962,7 @@ public class DoCreateVfModule extends VfModuleBase { }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occurred Processing preProcessSDNCGetRequest", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during prepareProvision Method:\n" + e.getMessage()) } logger.trace("COMPLETED preProcessSDNCGetRequest Process") @@ -1167,7 +1167,7 @@ public class DoCreateVfModule extends VfModuleBase { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message") } } @@ -1557,7 +1557,7 @@ public class DoCreateVfModule extends VfModuleBase { }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessUpdateAAIVfModuleRequestOrch", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessUpdateAAIVfModuleRequestOrch Method:\n" + e.getMessage()) } logger.trace("COMPLETED preProcessUpdateAAIVfModuleRequestOrch") @@ -1587,7 +1587,7 @@ public class DoCreateVfModule extends VfModuleBase { }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessUpdateAAIVfModuleStatus", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessUpdateAAIVfModuleStatus Method:\n" + e.getMessage()) } logger.trace("COMPLETED preProcessUpdateAAIVfModuleStatus") @@ -1617,7 +1617,7 @@ public class DoCreateVfModule extends VfModuleBase { }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessUpdateAAIVfModuleRequestGroup", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessUpdateAAIVfModuleRequestGroup Method:\n" + e.getMessage()) } logger.trace("COMPLETED preProcessUpdateAAIVfModuleRequestGroup") @@ -1697,7 +1697,7 @@ public class DoCreateVfModule extends VfModuleBase { }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessSDNCGetRequest", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during prepareProvision Method:\n" + e.getMessage()) } logger.trace("COMPLETED preProcessSDNCGetRequest Process") @@ -1819,14 +1819,14 @@ public class DoCreateVfModule extends VfModuleBase { } catch(BpmnError b){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Rethrowing MSOWorkflowException", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + b.getMessage()); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + b.getMessage()); throw b }catch (Exception ex) { // try error String errorMessage = "Bpmn error encountered in CreateVfModule flow. Unexpected Response from AAI - " + ex.getMessage() logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "AAI Query Cloud Region Failed " + errorMessage, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex); exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception occured during queryCloudRegion method") } } @@ -1889,7 +1889,7 @@ public class DoCreateVfModule extends VfModuleBase { }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Exception Occured Processing prepareCreateAAIVfModuleVolumeGroupRequest', "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during prepareCreateAAIVfModuleVolumeGroupRequest Method:\n" + e.getMessage()) } logger.trace("COMPLETED prepareCreateAAIVfModuleVolumeGroupRequest") @@ -2022,7 +2022,7 @@ public class DoCreateVfModule extends VfModuleBase { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Encountered in " + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage()) } @@ -2067,7 +2067,7 @@ public class DoCreateVfModule extends VfModuleBase { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in postProcessUpdateAAIGenericVnf(): ' + e.getMessage()) } } @@ -2120,7 +2120,7 @@ public class DoCreateVfModule extends VfModuleBase { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in queryCatalogDB', "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryCatalogDB(): ' + e.getMessage()) } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy index 6f6ed671fe..a6040ac290 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy @@ -36,13 +36,11 @@ import org.onap.so.client.aai.AAIObjectPlurals import org.onap.so.client.aai.AAIObjectType import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.so.logger.ErrorCode import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory -import org.springframework.web.util.UriUtils - import javax.ws.rs.NotFoundException @@ -265,7 +263,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessSDNCDeactivateRequest.", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage()) } logger.trace("COMPLETED preProcessSDNCDeactivateRequest") @@ -448,7 +446,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "AAI error occurred deleting the Generic Vnf" + execution.getVariable("DoDVfMod_deleteGenericVnfResponse"), - "BPMN", MsoLogger.ErrorCode.UnknownError.getValue()); + "BPMN", ErrorCode.UnknownError.getValue()); String processKey = getProcessKey(execution); exceptionUtil.buildWorkflowException(execution, 5000, "Failure in DoDeleteVfModule") @@ -609,7 +607,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessUpdateAAIGenericVnf((): ' + e.getMessage()) } } @@ -627,7 +625,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing setSuccessfulRollbackStatus.", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setSuccessfulRollbackStatus Method:\n" + e.getMessage()) } logger.trace("COMPLETED setSuccessfulRollbackStatus") @@ -647,7 +645,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing setFailedRollbackStatus.", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setFailedRollbackStatus Method:\n" + e.getMessage()) } logger.trace("COMPLETED setFailedRollbackStatus") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy index 24528db473..5f160bb068 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy @@ -23,13 +23,12 @@ package org.onap.so.bpmn.infrastructure.scripts import org.onap.so.db.catalog.beans.HomingInstance +import org.onap.so.logger.ErrorCode import static org.apache.commons.lang3.StringUtils.* import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution -import org.onap.aai.domain.yang.GenericVnf -import org.onap.so.bpmn.common.scripts.AaiUtil import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils @@ -42,17 +41,12 @@ import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.domain.VnfResource import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.AAIResultWrapper import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.springframework.web.util.UriUtils -import org.json.JSONObject - +import org.onap.so.client.aai.entities.uri.AAIUriFactory /** * This class supports the DoCreateVnf building block subflow @@ -222,7 +216,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing' logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } execution.setVariable("DoCVNF_sdncCallbackUrl", sdncCallbackUrl) @@ -414,7 +408,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessSDNCAssignRequest", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e) + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCAssignRequest Method:\n" + e.getMessage()) } logger.trace("COMPLETED preProcessSDNCAssignRequest") @@ -632,7 +626,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occurred Processing preProcessSDNCGetRequest. ", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during prepareProvision Method:\n" + e.getMessage()) } logger.trace("COMPLETED preProcessSDNCGetRequest Process") @@ -671,7 +665,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Caught exception in " + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage()) } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy index f0680e227c..725a139b59 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy @@ -39,8 +39,8 @@ import org.onap.so.bpmn.core.json.DecomposeJsonUtil import org.onap.so.bpmn.core.json.JsonUtils import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.onap.so.bpmn.infrastructure.aai.groovyflows.AAICreateResources; -import org.onap.so.logger.MsoLogger +import org.onap.so.bpmn.infrastructure.aai.groovyflows.AAICreateResources +import org.onap.so.logger.ErrorCode import org.slf4j.Logger import org.slf4j.LoggerFactory import org.onap.so.logger.MessageEnum @@ -310,7 +310,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessAddOnModule ", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessAddOnModule Method:\n" + e.getMessage()) } logger.trace("COMPLETED preProcessAddOnModule") @@ -328,7 +328,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing postProcessAddOnModule ", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during postProcessAddOnModule Method:\n" + e.getMessage()) } logger.trace("COMPLETED postProcessAddOnModule") @@ -358,7 +358,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing validateBaseModule ", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during validateBaseModule Method:\n" + e.getMessage()) } logger.trace("COMPLETED validateBaseModule") @@ -389,7 +389,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessAddOnModule ", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessAddOnModule Method:\n" + e.getMessage()) } logger.trace("COMPLETED validateAddOnModule") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy index 6f4c030683..3209f52fef 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy @@ -22,8 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts -import static org.apache.commons.lang3.StringUtils.*; - +import org.onap.so.logger.ErrorCode import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution; import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor @@ -34,7 +33,6 @@ import org.onap.so.bpmn.core.RollbackData import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -167,7 +165,7 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor { }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessCreateVfModuleRollback ", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessCreateVfModuleRollback Method:\n" + e.getMessage()) } logger.trace("COMPLETED preProcessCreateVfModuleRollback") @@ -187,14 +185,14 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor { }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing postProcessCreateVfModuleRollback ", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during postProcessCreateVfModuleRollback Method:\n" + e.getMessage()) } if (rolledBack == false) { logger.debug("Failure on DoCreateVfModuleRollback") logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Unsuccessful rollback of DoCreateVfModule ", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during rollback of DoCreateVfModule") } logger.trace("COMPLETED postProcessCreateVfModuleRollback") @@ -220,7 +218,7 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor { }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessSDNCDeactivateRequest ", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage()) } logger.trace("COMPLETED preProcessSDNCDeactivateRequest") @@ -342,7 +340,7 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor { }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured " + - "Processing setSuccessfulRollbackStatus ", "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + "Processing setSuccessfulRollbackStatus ", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setSuccessfulRollbackStatus Method:\n" + e.getMessage()) } logger.trace("COMPLETED setSuccessfulRollbackStatus") @@ -364,7 +362,7 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor { }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured " + - "Processing setFailedRollbackStatus. ", "BPMN",MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + "Processing setFailedRollbackStatus. ", "BPMN",ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setFailedRollbackStatus Method:\n" + e.getMessage()) } logger.trace("COMPLETED setFailedRollbackStatus") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy index 0c14827f22..f1b7328bcc 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy @@ -22,6 +22,8 @@ */ package org.onap.so.bpmn.infrastructure.scripts +import org.onap.so.logger.ErrorCode + import static org.apache.commons.lang3.StringUtils.*; import javax.xml.parsers.DocumentBuilder @@ -39,7 +41,6 @@ import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory import org.springframework.web.util.UriUtils; @@ -533,7 +534,7 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preInitResourcesOperStatus.", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), e); + ErrorCode.UnknownError.getValue(), e); execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage()) } logger.trace("COMPLETED preInitResourcesOperStatus Process ") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy index f476b080b7..1912d65ce3 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy @@ -23,6 +23,7 @@ package org.onap.so.bpmn.infrastructure.scripts import org.onap.aai.domain.yang.AllottedResource +import org.onap.so.logger.ErrorCode import javax.ws.rs.core.UriBuilder @@ -31,15 +32,13 @@ import static org.apache.commons.lang3.StringUtils.*; import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution -import org.json.JSONArray; -import org.onap.so.bpmn.common.scripts.AaiUtil +import org.json.JSONArray import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -947,7 +946,7 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preUpdateServiceOperationStatus.", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), e); + ErrorCode.UnknownError.getValue(), e); execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preUpdateServiceOperationStatus Method:\n" + e.getMessage()) } logger.trace("COMPLETED preUpdateServiceOperationStatus Process ") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy index 9c04328d0d..a54d90b2bf 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy @@ -44,8 +44,8 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.client.graphinventory.entities.uri.Depth import org.onap.so.constants.Defaults +import org.onap.so.logger.ErrorCode import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -466,7 +466,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { // caught exception String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, sendRequestToVnfAdapter() - " + ex.getMessage() logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage, - "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), + "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex); logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) @@ -518,7 +518,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { // caught exception String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, prepareSDNCRequest() - " + ex.getMessage() logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage, - "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), + "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex); logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) @@ -559,7 +559,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { // caught exception String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, prepareSDNCRequest() - " + ex.getMessage() logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage, - "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), + "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex); logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) @@ -999,7 +999,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { // caught exception String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, prepareSDNCRollback() - " + ex.getMessage() logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage, - "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), + "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex); logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy index e3e3990527..bedf5e0948 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy @@ -24,18 +24,17 @@ package org.onap.so.bpmn.infrastructure.scripts import org.onap.aai.domain.yang.NetworkPolicies import org.onap.aai.domain.yang.NetworkPolicy +import org.onap.so.logger.ErrorCode import javax.xml.parsers.DocumentBuilder import javax.xml.parsers.DocumentBuilderFactory import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution -import org.onap.so.bpmn.common.scripts.AaiUtil import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils -import org.onap.so.bpmn.common.scripts.VfModule import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils @@ -44,10 +43,8 @@ import org.onap.so.client.aai.AAIObjectType import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory -import org.springframework.web.util.UriUtils import org.w3c.dom.Document import org.w3c.dom.Element import org.w3c.dom.Node @@ -358,7 +355,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ public void handleDoDeleteVfModuleFailure(DelegateExecution execution) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "AAI error occurred deleting the Generic Vnf: " + execution.getVariable("DoDVfMod_deleteGenericVnfResponse"), - "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception"); + "BPMN", ErrorCode.UnknownError.getValue(), "Exception"); String processKey = getProcessKey(execution); WorkflowException exception = new WorkflowException(processKey, 5000, execution.getVariable("DoDVfMod_deleteGenericVnfResponse")) @@ -579,7 +576,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage()) } } @@ -628,7 +625,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModuleForStatus(): ' + e.getMessage()) } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy index 0c244e8e67..3be52f50f7 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy @@ -26,6 +26,7 @@ import org.onap.aai.domain.yang.GenericVnf import org.onap.aai.domain.yang.NetworkPolicies import org.onap.aai.domain.yang.NetworkPolicy import org.onap.aai.domain.yang.VfModule +import org.onap.so.logger.ErrorCode import static org.apache.commons.lang3.StringUtils.* import org.camunda.bpm.engine.delegate.BpmnError @@ -44,7 +45,6 @@ import org.onap.so.client.aai.AAIObjectType import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -112,7 +112,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing' logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception"); + ErrorCode.UnknownError.getValue(), "Exception"); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) @@ -162,7 +162,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIForVfModule(): ' + e.getMessage()) } } @@ -215,7 +215,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in validateVfModule(): ' + e.getMessage()) } } @@ -241,7 +241,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessSDNCDeactivateRequest. Exception is:\n" + e, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage()) } logger.trace("COMPLETED preProcessSDNCDeactivateRequest ") @@ -403,7 +403,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { public void handleDoDeleteVfModuleFailure(DelegateExecution execution) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "AAI error occurred deleting the Generic Vnf: " + execution.getVariable("DDVFMV_deleteGenericVnfResponse"), - "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception"); + "BPMN", ErrorCode.UnknownError.getValue(), "Exception"); String processKey = getProcessKey(execution); WorkflowException exception = new WorkflowException(processKey, 5000, execution.getVariable("DDVFMV_deleteGenericVnfResponse")) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy index a2c6a82a93..fb62babae9 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy @@ -44,8 +44,8 @@ import org.onap.so.client.graphinventory.entities.uri.Depth import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.client.aai.AAIObjectType +import org.onap.so.logger.ErrorCode import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -111,7 +111,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing' logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception"); + ErrorCode.UnknownError.getValue(), "Exception"); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) @@ -240,7 +240,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessAddOnModule." + e, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessAddOnModule Method:\n" + e.getMessage()) } logger.trace("COMPLETED preProcessSDNCAssignRequest ") @@ -341,7 +341,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModule(): ' + e.getMessage()) } } @@ -369,7 +369,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessAddOnModule." + e, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareNextModuleToDelete Method:\n" + e.getMessage()) } logger.trace("COMPLETED prepareNextModuleToDelete ") @@ -395,7 +395,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessSDNCDeactivateRequest." + e, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage()) } logger.trace("COMPLETED preProcessSDNCDeactivateRequest ") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy index 7f168d99ad..ce3b243533 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy @@ -21,6 +21,8 @@ */ package org.onap.so.bpmn.infrastructure.scripts +import org.onap.so.logger.ErrorCode + import static org.apache.commons.lang3.StringUtils.*; import org.camunda.bpm.engine.delegate.BpmnError @@ -32,7 +34,6 @@ import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory import org.springframework.web.util.UriUtils; @@ -139,7 +140,7 @@ public class DoScaleE2EServiceInstance extends AbstractServiceTaskProcessor { }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preInitResourcesOperStatus.", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), e); + ErrorCode.UnknownError.getValue(), e); execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage()) } logger.trace("COMPLETED preInitResourcesOperStatus Process ") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy index 905afb53d5..1b089d2a2b 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy @@ -33,6 +33,7 @@ import org.onap.so.bpmn.core.json.JsonUtils import org.camunda.bpm.engine.delegate.BpmnError import com.fasterxml.jackson.databind.ObjectMapper import org.onap.so.client.HttpClientFactory +import org.onap.so.logger.ErrorCode import javax.ws.rs.core.Response @@ -47,7 +48,6 @@ import org.onap.so.bpmn.infrastructure.vfcmodel.NsScaleParameters import org.onap.so.bpmn.infrastructure.vfcmodel.NsParameters import org.onap.so.bpmn.infrastructure.vfcmodel.LocationConstraint import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory import org.onap.so.utils.TargetEntity @@ -184,7 +184,7 @@ public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcess } catch (InterruptedException e) { logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Time Delay exception" + e, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); } } @@ -217,7 +217,7 @@ public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcess logger.trace("Completed Execute VF-C adapter Post Process ") }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception occured " + - "while executing VFC Post Call.", "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), e); + "while executing VFC Post Call.", "BPMN", ErrorCode.UnknownError.getValue(), e); throw new BpmnError("MSOWorkflowException") } return apiResponse diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy index 47647bd9a6..a17dc9d7fe 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy @@ -44,8 +44,8 @@ import org.onap.so.client.aai.entities.uri.AAIUri import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.constants.Defaults +import org.onap.so.logger.ErrorCode import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -327,7 +327,7 @@ public class DoUpdateVfModule extends VfModuleBase { if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing' logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -337,7 +337,7 @@ public class DoUpdateVfModule extends VfModuleBase { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage()) } } @@ -378,7 +378,7 @@ public class DoUpdateVfModule extends VfModuleBase { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preparePrepareUpdateAAIVfModule(): ' + e.getMessage()) } } @@ -429,14 +429,14 @@ public class DoUpdateVfModule extends VfModuleBase { } catch(BpmnError b){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Rethrowing MSOWorkflowException", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + b); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + b); throw b }catch (Exception e) { // try error String errorMessage = "Bpmn error encountered in CreateVfModule flow. Unexpected Response from AAI - " + e.getMessage() logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "AAI Query Cloud Region Failed. Exception - " + "\n" + errorMessage, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception occured during prepConfirmVolumeGroupTenant(): " + e.getMessage()) } logger.trace('Exited ' + method) @@ -543,7 +543,7 @@ public class DoUpdateVfModule extends VfModuleBase { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepSDNCTopologyChg(): ' + e.getMessage()) } } @@ -607,7 +607,7 @@ public class DoUpdateVfModule extends VfModuleBase { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepSDNCTopologyQuery(): ' + e.getMessage()) } } @@ -709,7 +709,7 @@ public class DoUpdateVfModule extends VfModuleBase { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepVnfAdapterRest(): ' + e.getMessage()) } } @@ -757,7 +757,7 @@ public class DoUpdateVfModule extends VfModuleBase { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage()) } } @@ -831,7 +831,7 @@ public class DoUpdateVfModule extends VfModuleBase { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIVfModule(): ' + e.getMessage()) } } @@ -934,7 +934,7 @@ public class DoUpdateVfModule extends VfModuleBase { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepSDNCTopologyAct(): ' + e.getMessage()) } } @@ -955,7 +955,7 @@ public class DoUpdateVfModule extends VfModuleBase { def WorkflowException workflowException = (WorkflowException) execution.getVariable('WorkflowException') logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), method + ' caught WorkflowException: ' + workflowException.getErrorMessage(), "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); logger.trace('Exited ' + method) } catch (BpmnError e) { @@ -963,7 +963,7 @@ public class DoUpdateVfModule extends VfModuleBase { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildWorkflowException(execution, 1002, 'Error in handleWorkflowException(): ' + e.getMessage()) } } @@ -1042,7 +1042,7 @@ public class DoUpdateVfModule extends VfModuleBase { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModule(): ' + e.getMessage()) } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy index 3d8205fd2a..3dd5e61246 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy @@ -23,6 +23,7 @@ package org.onap.so.bpmn.infrastructure.scripts import org.onap.so.client.HttpClientFactory +import org.onap.so.logger.ErrorCode import javax.ws.rs.core.Response import org.camunda.bpm.engine.delegate.BpmnError @@ -41,7 +42,6 @@ import org.onap.so.client.aai.AAIObjectType import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory import org.onap.so.utils.TargetEntity @@ -275,7 +275,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModule(): ' + e.getMessage()) } } @@ -331,7 +331,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor { }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessAddOnModule. Exception is:\n" + e, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareNextModuleToUpdate Method:\n" + e.getMessage()) } logger.trace("COMPLETED prepareNextModuleToUpdate ") @@ -407,7 +407,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage()) } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy index 534e5b513a..4321dbadd5 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy @@ -34,8 +34,8 @@ import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.aai.* import org.onap.so.client.appc.ApplicationControllerOrchestrator import org.onap.so.client.appc.ApplicationControllerSupport +import org.onap.so.logger.ErrorCode import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -235,7 +235,7 @@ public class ReplaceVnfInfra extends VnfCmBase { String restFaultMessage = e.getMessage() logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Encountered - " + "\n" + restFaultMessage, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage) } } @@ -278,7 +278,7 @@ public class ReplaceVnfInfra extends VnfCmBase { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) } } @@ -329,7 +329,7 @@ public class ReplaceVnfInfra extends VnfCmBase { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getVnfResourceDecomposition(): ' + e.getMessage()) } } @@ -371,7 +371,7 @@ public class ReplaceVnfInfra extends VnfCmBase { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage()) @@ -415,7 +415,7 @@ public class ReplaceVnfInfra extends VnfCmBase { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfPserversInMaintInAAI(): ' + e.getMessage()) @@ -463,7 +463,7 @@ public class ReplaceVnfInfra extends VnfCmBase { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) } @@ -533,19 +533,19 @@ public class ReplaceVnfInfra extends VnfCmBase { } catch (BpmnError e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) } catch (java.lang.NoSuchMethodError e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy index 5f215479e9..ef4a78ffde 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy @@ -21,41 +21,14 @@ package org.onap.so.bpmn.infrastructure.scripts -import groovy.json.JsonOutput - -import groovy.json.JsonSlurper -import groovy.util.Node -import groovy.util.XmlParser; -import groovy.xml.QName - -import java.io.Serializable; -import java.util.UUID; +import org.onap.so.logger.ErrorCode import org.onap.so.bpmn.common.scripts.ExceptionUtil -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.impl.cmd.AbstractSetVariableCmd import org.camunda.bpm.engine.delegate.DelegateExecution - -import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor; -import org.onap.so.bpmn.common.scripts.VidUtils; -import org.onap.so.bpmn.core.RollbackData -import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.bpmn.core.domain.ModelInfo -import org.onap.so.bpmn.core.domain.ServiceDecomposition -import org.onap.so.bpmn.core.domain.VnfResource -import org.onap.so.client.aai.* - -import org.onap.so.client.appc.ApplicationControllerClient; -import org.onap.so.client.appc.ApplicationControllerSupport; -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.uri.AAIUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.appc.client.lcm.model.Action; import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -116,7 +89,7 @@ public class RollbackVnf extends VnfCmBase { String restFaultMessage = e.getMessage() logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Encountered - " + "\n" + restFaultMessage, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("rollbackErrorCode", "1") exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage) } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy index 010ac7cda8..0afa34bdec 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy @@ -22,6 +22,8 @@ package org.onap.so.bpmn.infrastructure.scripts +import org.onap.so.logger.ErrorCode + import static org.apache.commons.lang3.StringUtils.* import org.camunda.bpm.engine.delegate.BpmnError @@ -33,7 +35,6 @@ import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory import org.onap.so.utils.UUIDChecker @@ -295,7 +296,7 @@ public class ScaleCustomE2EServiceInstance extends AbstractServiceTaskProcessor }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing prepareInitServiceOperationStatus.", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), e); + ErrorCode.UnknownError.getValue(), e); execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage()) } logger.trace("COMPLETED prepareInitServiceOperationStatus Process ") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy index 175bbbdbc9..9db5b7366a 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy @@ -28,8 +28,8 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.logger.ErrorCode import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -98,7 +98,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage()) } } @@ -153,7 +153,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendSynchResponse(): ' + e.getMessage()) } } @@ -183,7 +183,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepDoUpdateVfModule(): ' + e.getMessage()) } } @@ -239,7 +239,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateInfraRequest(): ' + e.getMessage()) } } @@ -280,7 +280,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error') } } @@ -335,7 +335,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error') } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy index cad1c6f204..2404169493 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy @@ -30,8 +30,8 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.logger.ErrorCode import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -223,7 +223,7 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor { catch(Exception e) { String restFaultMessage = e.getMessage() logger.error("{} {} Exception Encountered - \n{}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), restFaultMessage, e) + ErrorCode.UnknownError.getValue(), restFaultMessage, e) exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage) } } @@ -264,7 +264,7 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor { throw e; } catch (Exception e) { logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), method, e) + ErrorCode.UnknownError.getValue(), method, e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) } } @@ -293,7 +293,7 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor { throw e; } catch (Exception e) { logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), method, e) + ErrorCode.UnknownError.getValue(), method, e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepDoUpdateVfModule(): ' + e.getMessage()) } } @@ -347,7 +347,7 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor { throw e; } catch (Exception e) { logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), method, e) + ErrorCode.UnknownError.getValue(), method, e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateInfraRequest(): ' + e.getMessage()) } } @@ -386,7 +386,7 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor { throw e; } catch (Exception e) { logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), method, e) + ErrorCode.UnknownError.getValue(), method, e) exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error') } } @@ -439,7 +439,7 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor { throw e; } catch (Exception e) { logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), method, e) + ErrorCode.UnknownError.getValue(), method, e) exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error') } } @@ -509,7 +509,7 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor { throw e; } catch (Exception e) { logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), method, e) + ErrorCode.UnknownError.getValue(), method, e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message") } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfraV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfraV2.groovy index f04fa002fe..575a8f3f1a 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfraV2.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfraV2.groovy @@ -235,7 +235,6 @@ public class UpdateVfModuleInfraV2 { } catch(Exception e) { String restFaultMessage = e.getMessage() - //logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), " Exception Encountered - " + "\n" + restFaultMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage) } } @@ -276,7 +275,6 @@ public class UpdateVfModuleInfraV2 { } catch (BpmnError e) { throw e; } catch (Exception e) { - //logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) } } @@ -362,7 +360,6 @@ public class UpdateVfModuleInfraV2 { } catch (BpmnError e) { throw e; } catch (Exception e) { - //logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepDoUpdateVfModule(): ' + e.getMessage()) } @@ -398,7 +395,6 @@ public class UpdateVfModuleInfraV2 { } catch (BpmnError e) { throw e; } catch (Exception e) { - //logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error') } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy index 367a63fede..0c3294778a 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy @@ -37,8 +37,8 @@ import org.onap.so.client.aai.entities.Relationships import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.constants.Defaults +import org.onap.so.logger.ErrorCode import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -111,7 +111,7 @@ class UpdateVfModuleVolume extends VfModuleBase { throw bpmnError } catch (Exception e) { logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), method, e) + ErrorCode.UnknownError.getValue(), method, e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage()) } } @@ -163,7 +163,7 @@ class UpdateVfModuleVolume extends VfModuleBase { throw e } catch (Exception e) { logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), method, e) + ErrorCode.UnknownError.getValue(), method, e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendSynchResponse(): ' + e.getMessage()) } } @@ -214,7 +214,7 @@ class UpdateVfModuleVolume extends VfModuleBase { throw e } catch (Exception e) { logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), method, e) + ErrorCode.UnknownError.getValue(), method, e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIForVolumeGroup(): ' + e.getMessage()) } } @@ -283,7 +283,7 @@ class UpdateVfModuleVolume extends VfModuleBase { throw e } catch (Exception e) { logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), method, e) + ErrorCode.UnknownError.getValue(), method, e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepVnfAdapterRest(): ' + e.getMessage()) } } @@ -328,7 +328,7 @@ class UpdateVfModuleVolume extends VfModuleBase { throw e } catch (Exception e) { logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), method, e) + ErrorCode.UnknownError.getValue(), method, e) exceptionUtil.buildWorkflowException(execution, 1002, 'Error in prepDbInfraDbRequest(): ' + e.getMessage()) } } @@ -366,7 +366,7 @@ class UpdateVfModuleVolume extends VfModuleBase { throw e } catch (Exception e) { logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), method, e) + ErrorCode.UnknownError.getValue(), method, e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepCompletionHandlerRequest(): ' + e.getMessage()) } } @@ -416,7 +416,7 @@ class UpdateVfModuleVolume extends VfModuleBase { throw e } catch (Exception e) { logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), method, e) + ErrorCode.UnknownError.getValue(), method, e) exceptionUtil.buildWorkflowException(execution, 1002, 'Error in prepFalloutHandler(): ' + e.getMessage()) } } @@ -444,7 +444,7 @@ class UpdateVfModuleVolume extends VfModuleBase { '\' retrieved from AAI for Volume Group Id \'' + volumeGroupId + '\', AIC Cloud Region \'' + aicCloudRegion + '\'' logger.error("{} {} Error in UpdateVfModuleVol: {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), errorMessage) + ErrorCode.UnknownError.getValue(), errorMessage) WorkflowException exception = new WorkflowException(processKey, 5000, errorMessage) execution.setVariable("WorkflowException", exception) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy index 9e1694089e..361d6a2173 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy @@ -41,8 +41,8 @@ import org.onap.so.client.aai.entities.Relationships import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.constants.Defaults +import org.onap.so.logger.ErrorCode import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -480,7 +480,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { ExceptionUtil exceptionUtil = new ExceptionUtil() logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Error in ' + - 'UpdateVfModuleVol: ' + errorMessage, "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception") + 'UpdateVfModuleVol: ' + errorMessage, "BPMN", ErrorCode.UnknownError.getValue(), "Exception") exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) } @@ -499,7 +499,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { ExceptionUtil exceptionUtil = new ExceptionUtil() logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Error in ' + - 'UpdateVfModuleVol: ' + errorMessage, "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception") + 'UpdateVfModuleVol: ' + errorMessage, "BPMN", ErrorCode.UnknownError.getValue(), "Exception") exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy index 60af2a0fe2..26a509022c 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy @@ -35,8 +35,8 @@ import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.aai.AAIRestClientImpl import org.onap.so.client.aai.AAIUpdatorImpl import org.onap.so.client.aai.AAIValidatorImpl +import org.onap.so.logger.ErrorCode import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -214,7 +214,7 @@ public class UpdateVnfInfra extends VnfCmBase { catch(Exception e) { String restFaultMessage = e.getMessage() logger.error("{} {} Exception Encountered - \n{}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), restFaultMessage, e) + ErrorCode.UnknownError.getValue(), restFaultMessage, e) exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage) } } @@ -255,7 +255,7 @@ public class UpdateVnfInfra extends VnfCmBase { throw e; } catch (Exception e) { logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), method, e) + ErrorCode.UnknownError.getValue(), method, e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) } } @@ -305,7 +305,7 @@ public class UpdateVnfInfra extends VnfCmBase { throw e; } catch (Exception e) { logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), method, e) + ErrorCode.UnknownError.getValue(), method, e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getVnfResourceDecomposition(): ' + e.getMessage()) } } @@ -346,7 +346,7 @@ public class UpdateVnfInfra extends VnfCmBase { throw e; } catch (Exception e) { logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), method, e) + ErrorCode.UnknownError.getValue(), method, e) execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage()) @@ -389,7 +389,7 @@ public class UpdateVnfInfra extends VnfCmBase { throw e; } catch (Exception e) { logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), method, e) + ErrorCode.UnknownError.getValue(), method, e) execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfPserversInMaintInAAI(): ' + e.getMessage()) @@ -436,7 +436,7 @@ public class UpdateVnfInfra extends VnfCmBase { throw e; } catch (Exception e) { logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), method, e) + ErrorCode.UnknownError.getValue(), method, e) execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy index a83b36fd6e..09e7516f85 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy @@ -46,8 +46,8 @@ import org.onap.so.client.aai.entities.uri.AAIUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.client.appc.ApplicationControllerClient import org.onap.so.client.appc.ApplicationControllerSupport +import org.onap.so.logger.ErrorCode import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -100,7 +100,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { throw e; } catch (Exception e) { logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), method, e) + ErrorCode.UnknownError.getValue(), method, e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) } } @@ -149,7 +149,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { throw e; } catch (Exception e) { logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), method, e) + ErrorCode.UnknownError.getValue(), method, e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getVnfResourceDecomposition(): ' + e.getMessage()) } } @@ -190,7 +190,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { throw e; } catch (Exception e) { logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), method, e) + ErrorCode.UnknownError.getValue(), method, e) execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage()) @@ -320,7 +320,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { throw e; } catch (Exception e) { logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), method, e) + ErrorCode.UnknownError.getValue(), method, e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIForVnf(): ' + e.getMessage()) } } @@ -362,7 +362,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { throw e; } catch (Exception e) { logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), method, e) + ErrorCode.UnknownError.getValue(), method, e) execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfPserversInMaintInAAI(): ' + e.getMessage()) @@ -409,7 +409,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { throw e; } catch (Exception e) { logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), method, e) + ErrorCode.UnknownError.getValue(), method, e) execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) } @@ -454,7 +454,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { throw e; } catch (Exception e) { logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), method, e) + ErrorCode.UnknownError.getValue(), method, e) execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) } @@ -500,7 +500,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { throw e; } catch (Exception e) { logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), method, e) + ErrorCode.UnknownError.getValue(), method, e) execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) } @@ -579,19 +579,19 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { logger.trace('Exited ' + method) } catch (BpmnError e) { logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), method, e) + ErrorCode.UnknownError.getValue(), method, e) execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) } catch (java.lang.NoSuchMethodError e) { logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), method, e) + ErrorCode.UnknownError.getValue(), method, e) execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) } catch (Exception e) { logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), method, e) + ErrorCode.UnknownError.getValue(), method, e) execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) @@ -658,7 +658,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { throw e; } catch (Exception e) { logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), method, e) + ErrorCode.UnknownError.getValue(), method, e) exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error') } } @@ -729,7 +729,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { throw e; } catch (Exception e) { logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), method, e) + ErrorCode.UnknownError.getValue(), method, e) exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error') } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy index 0a748db561..90523a02be 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy @@ -33,8 +33,8 @@ import org.onap.so.client.aai.* import org.onap.so.client.aai.entities.AAIResultWrapper import org.onap.so.client.aai.entities.uri.AAIUri import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.so.logger.ErrorCode import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -159,7 +159,7 @@ public class VnfConfigUpdate extends VnfCmBase { catch(Exception e) { String restFaultMessage = e.getMessage() logger.error("{} {} Exception Encountered - \n {} \n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), restFaultMessage, e) + ErrorCode.UnknownError.getValue(), restFaultMessage, e) exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage) } } @@ -201,7 +201,7 @@ public class VnfConfigUpdate extends VnfCmBase { throw e; } catch (Exception e) { logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), method, e) + ErrorCode.UnknownError.getValue(), method, e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) } } @@ -242,7 +242,7 @@ public class VnfConfigUpdate extends VnfCmBase { throw e; } catch (Exception e) { logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), method, e) + ErrorCode.UnknownError.getValue(), method, e) execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage()) @@ -285,7 +285,7 @@ public class VnfConfigUpdate extends VnfCmBase { throw e; } catch (Exception e) { logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), method, e) + ErrorCode.UnknownError.getValue(), method, e) execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfPserversInMaintInAAI(): ' + e.getMessage()) @@ -333,7 +333,7 @@ public class VnfConfigUpdate extends VnfCmBase { throw e; } catch (Exception e) { logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), method, e) + ErrorCode.UnknownError.getValue(), method, e) execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) } @@ -378,7 +378,7 @@ public class VnfConfigUpdate extends VnfCmBase { throw e; } catch (Exception e) { logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), method, e) + ErrorCode.UnknownError.getValue(), method, e) execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage()) @@ -424,7 +424,7 @@ public class VnfConfigUpdate extends VnfCmBase { throw e; } catch (Exception e) { logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), method, e) + ErrorCode.UnknownError.getValue(), method, e) execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy index fe6045dc3b..05aff713bc 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy @@ -38,8 +38,8 @@ import org.onap.so.client.aai.entities.uri.AAIUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.client.appc.ApplicationControllerClient import org.onap.so.client.appc.ApplicationControllerSupport +import org.onap.so.logger.ErrorCode import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -179,7 +179,7 @@ public class VnfInPlaceUpdate extends VnfCmBase { catch(Exception e) { String restFaultMessage = e.getMessage() logger.error("{} {} Exception Encountered - {} \n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), restFaultMessage, e) + ErrorCode.UnknownError.getValue(), restFaultMessage, e) exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage) } } @@ -220,7 +220,7 @@ public class VnfInPlaceUpdate extends VnfCmBase { throw e; } catch (Exception e) { logger.error("{} {} Caught exception in {} \n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), method, e) + ErrorCode.UnknownError.getValue(), method, e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) } } @@ -262,7 +262,7 @@ public class VnfInPlaceUpdate extends VnfCmBase { throw e; } catch (Exception e) { logger.error("{} {} Caught exception in {} \n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), method, e) + ErrorCode.UnknownError.getValue(), method, e) execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage()) @@ -305,7 +305,7 @@ public class VnfInPlaceUpdate extends VnfCmBase { throw e; } catch (Exception e) { logger.error("{} {} Caught exception in {} \n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - MsoLogger.ErrorCode.UnknownError.getValue(), method, e) + ErrorCode.UnknownError.getValue(), method, e) execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfPserversInMaintInAAI(): ' + e.getMessage()) @@ -352,7 +352,7 @@ public class VnfInPlaceUpdate extends VnfCmBase { throw e; } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' + - ' ' + method, "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ' ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) } @@ -397,7 +397,7 @@ public class VnfInPlaceUpdate extends VnfCmBase { throw e; } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' + - ' ' + method, "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ' ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) } @@ -442,7 +442,7 @@ public class VnfInPlaceUpdate extends VnfCmBase { throw e; } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' + - ' ' + method, "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ' ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) } @@ -521,17 +521,17 @@ public class VnfInPlaceUpdate extends VnfCmBase { logger.trace('Exited ' + method) } catch (BpmnError e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' + - ' ' + method, "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ' ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) } catch (java.lang.NoSuchMethodError e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' + - ' ' + method, "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ' ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' + - ' ' + method, "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ' ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy index 628088c380..9829419128 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy @@ -19,7 +19,9 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -package org.onap.so.bpmn.vcpe.scripts; +package org.onap.so.bpmn.vcpe.scripts + +import org.onap.so.logger.ErrorCode; import static org.apache.commons.lang3.StringUtils.* @@ -34,7 +36,6 @@ import org.onap.so.bpmn.core.domain.* import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.springframework.web.util.UriUtils import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -421,7 +422,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) } } @@ -848,7 +849,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { } catch (BpmnError b) { logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Rethrowing MSOWorkflowException", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); throw b } catch (Exception e) { logger.debug("Caught Exception during processJavaException Method: " + e) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy index 312f3ca102..a1cdacaf08 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy @@ -30,8 +30,8 @@ import org.onap.so.bpmn.common.scripts.NetworkUtils import org.onap.so.bpmn.common.scripts.VidUtils import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.logger.ErrorCode import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -421,7 +421,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { }catch(BpmnError b){ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Rethrowing MSOWorkflowException", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue()); + ErrorCode.UnknownError.getValue()); throw b }catch(Exception e){ logger.debug("Caught Exception during processJavaException Method: " + e) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy index 8bf16a0dc4..24589a0893 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy @@ -34,8 +34,8 @@ import org.onap.so.client.aai.AAIObjectType import org.onap.so.client.aai.AAIResourcesClient import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.so.logger.ErrorCode import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -587,7 +587,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + e.getMessage()) } logger.trace("end preProcessSDNCGet") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy index 255b1f32eb..f27b3d94b1 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy @@ -30,8 +30,8 @@ import org.onap.so.bpmn.common.scripts.AllottedResourceUtils import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.logger.ErrorCode import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -207,7 +207,7 @@ public class DoCreateAllottedResourceBRGRollback extends AbstractServiceTaskProc }catch(Exception ex){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage()) } logger.trace("end deleteAaiAR") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy index d74510a25e..b6e7470834 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy @@ -33,8 +33,8 @@ import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.aai.AAIObjectType import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.so.logger.ErrorCode import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -522,7 +522,7 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + e.getMessage()) } logger.trace("end preProcessSDNCGet") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy index def3cca2f7..ad2c9e155d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy @@ -27,20 +27,14 @@ import org.onap.so.bpmn.common.scripts.*; import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.common.scripts.ExceptionUtil -import org.onap.so.bpmn.common.scripts.MsoUtils -import org.onap.so.bpmn.common.scripts.AaiUtil import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils - - -import java.util.UUID; +import org.onap.so.logger.ErrorCode import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution -import org.apache.commons.lang3.* -import org.springframework.web.util.UriUtils; + import static org.apache.commons.lang3.StringUtils.* import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -214,7 +208,7 @@ public class DoCreateAllottedResourceTXCRollback extends AbstractServiceTaskProc }catch(Exception ex){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage()) } logger.trace("end deleteAaiAR") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy index 8929f67cfc..ca1b2ded2a 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy @@ -31,8 +31,8 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.logger.ErrorCode import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -353,7 +353,7 @@ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{ }catch(Exception ex){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occurred Processing preProcessSDNCGetRequest." + ex, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:" + ex); + ErrorCode.UnknownError.getValue(), "Exception is:" + ex); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage()) } logger.trace("end deleteAaiAR") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy index 84e77afda7..0da6fd26f4 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy @@ -31,8 +31,8 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.logger.ErrorCode import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -357,7 +357,7 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{ }catch(Exception ex){ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex); + ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage()) } logger.trace("end deleteAaiAR") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/properties/BPMNProperties.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/properties/BPMNProperties.java index 0d7c4abeee..ee8743f846 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/properties/BPMNProperties.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/properties/BPMNProperties.java @@ -24,7 +24,6 @@ import java.util.List; import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.so.bpmn.core.UrnPropertiesReader; -import org.onap.so.logger.MsoLogger; public class BPMNProperties { diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NSResourceInputParameter.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NSResourceInputParameter.java index ae320bdfb0..292f6ef575 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NSResourceInputParameter.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NSResourceInputParameter.java @@ -21,7 +21,6 @@ package org.onap.so.bpmn.infrastructure.vfcmodel; -import org.onap.so.logger.MsoLogger; /** diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java index 1f837eb444..113f05d3ca 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java @@ -62,8 +62,8 @@ import org.onap.so.client.aai.entities.AAIResultWrapper; import org.onap.so.client.aai.entities.Relationships; import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.util.UriUtils; @@ -688,7 +688,7 @@ public class ServicePluginFactory { return mapper.readValue(jsonstr, type); } catch (IOException e) { logger.error("{} {} fail to unMarshal json", MessageEnum.RA_NS_EXC.toString(), - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcesssError.getValue(), e); } return null; } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java index 4f02fe2ec0..4c9bb4259e 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java @@ -45,8 +45,8 @@ import org.onap.so.bpmn.core.BaseTask; import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.GenericResourceApi; import org.onap.so.db.request.beans.ResourceOperationStatus; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.onap.so.requestsdb.RequestsDbConstant; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -285,7 +285,7 @@ public abstract class AbstractSdncOperationTask extends BaseTask { logger.error("exception: AbstractSdncOperationTask.updateProgress fail:", exception); logger.error("{} {} {} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(), " updateProgress catch exception: ", this.getTaskName(), - MsoLogger.ErrorCode.UnknownError.getValue(), exception.getClass().toString()); + ErrorCode.UnknownError.getValue(), exception.getClass().toString()); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java index 8dd55d9eac..760f623812 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java @@ -62,8 +62,8 @@ import org.onap.so.client.orchestration.AAIVfModuleResources; import org.onap.so.client.orchestration.AAIVnfResources; import org.onap.so.client.orchestration.AAIVolumeGroupResources; import org.onap.so.client.orchestration.AAIVpnBindingResources; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -121,7 +121,7 @@ public class AAICreateTasks { String errorMessage = "Exception in creating ServiceSubscription. Customer not present for ServiceInstanceID: " + serviceInstance.getServiceInstanceId(); logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), errorMessage, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), errorMessage); + ErrorCode.UnknownError.getValue(), errorMessage); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, errorMessage); } aaiSIResources.createServiceSubscription(customer); @@ -166,13 +166,13 @@ public class AAICreateTasks { if (owningEntityName == null || "".equals(owningEntityName)) { String msg = "Exception in AAICreateOwningEntity. Can't create an owningEntity with no owningEntityName."; logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), msg); + ErrorCode.UnknownError.getValue(), msg); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); } else { if(aaiSIResources.existsOwningEntityName(owningEntityName)){ String msg = "Exception in AAICreateOwningEntity. Can't create OwningEntity as name already exists in AAI associated with a different owning-entity-id (name must be unique)"; logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), msg); + ErrorCode.UnknownError.getValue(), msg); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); }else{ aaiSIResources.createOwningEntityandConnectServiceInstance(owningEntity, serviceInstance); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java index dc8f72c7a5..821dfc18b0 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java @@ -36,8 +36,8 @@ import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds; import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.onap.so.serviceinstancebeans.RequestDetails; import org.onap.so.serviceinstancebeans.ServiceInstancesRequest; import org.slf4j.Logger; @@ -136,7 +136,7 @@ public class ExecuteActivity implements JavaDelegate { protected void buildAndThrowException(DelegateExecution execution, String msg, Exception ex) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), msg, ex); + ErrorCode.UnknownError.getValue(), msg, ex); execution.setVariable("ExecuteActivityErrorMessage", msg); exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasks.java index 41dabf9302..5eab6110f9 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasks.java @@ -29,7 +29,6 @@ import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.adapter.network.mapper.NetworkAdapterObjectMapper; import org.onap.so.client.exception.ExceptionBuilder; -import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java index 47357d8ef3..05ddb2e417 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java @@ -37,8 +37,8 @@ import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.exceptions.MarshallerException; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -167,9 +167,9 @@ public class VnfAdapterImpl { SAXSource source = new SAXSource(xmlReader, inputSource); return jaxbUnmarshaller.unmarshal(source); } catch (Exception e) { - logger.error("{} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(), MsoLogger.ErrorCode.SchemaError.getValue(), + logger.error("{} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(), ErrorCode.SchemaError.getValue(), e.getMessage(), e); - throw new MarshallerException("Error parsing VNF Adapter response. " + e.getMessage(), MsoLogger.ErrorCode.SchemaError.getValue(), e); + throw new MarshallerException("Error parsing VNF Adapter response. " + e.getMessage(), ErrorCode.SchemaError.getValue(), e); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java index 4b4b3eca23..876a555b10 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java @@ -37,8 +37,8 @@ import org.onap.so.client.exception.BBObjectNotFoundException; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.db.catalog.beans.ControllerSelectionReference; import org.onap.so.db.catalog.client.CatalogDbClient; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -137,7 +137,7 @@ public class AppcRunTasks { catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "Caught exception in runAppcCommand", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "APPC Error", e); + ErrorCode.UnknownError.getValue(), "APPC Error", e); appcMessage = e.getMessage(); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java index 6c0cdb39f6..717d0deff6 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java @@ -39,8 +39,8 @@ import org.onap.so.client.appc.ApplicationControllerAction; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.db.catalog.beans.ControllerSelectionReference; import org.onap.so.db.catalog.client.CatalogDbClient; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -155,7 +155,7 @@ public class ConfigurationScaleOut { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "Caught exception in runAppcCommand in ConfigurationScaleOut", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "APPC Error", e); + ErrorCode.UnknownError.getValue(), "APPC Error", e); appcMessage = e.getMessage(); } logger.error("Error Message: " + appcMessage); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java index feb9fb81b4..ce14bde0b3 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java @@ -34,8 +34,8 @@ import org.onap.so.client.appc.ApplicationControllerAction; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.db.catalog.beans.ControllerSelectionReference; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -111,7 +111,7 @@ public class GenericVnfHealthCheck { appcMessage = appCClient.getErrorMessage(); } catch (BpmnError ex) { logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - "Caught exception in GenericVnfHealthCheck", "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), ex); + "Caught exception in GenericVnfHealthCheck", "BPMN", ErrorCode.UnknownError.getValue(), ex); appcMessage = ex.getMessage(); exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage); } catch (Exception e) { @@ -120,13 +120,13 @@ public class GenericVnfHealthCheck { appcMessage = "Request to APPC timed out. "; logger.error("{} {} {} {} {}", MessageEnum.RA_CONNECTION_EXCEPTION.toString(), "Caught timedOut exception in runAppcCommand in GenericVnfHealthCheck", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "APPC Error", e); + ErrorCode.UnknownError.getValue(), "APPC Error", e); throw e; } else { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "Caught exception in runAppcCommand in GenericVnfHealthCheck", "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), "APPC Error", e); + ErrorCode.UnknownError.getValue(), "APPC Error", e); appcMessage = e.getMessage(); exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/NetworkBBUtils.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/NetworkBBUtils.java index 945c693d47..217a60b60a 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/NetworkBBUtils.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/NetworkBBUtils.java @@ -26,7 +26,6 @@ import java.util.Optional; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; -import org.onap.so.logger.MsoLogger; import org.springframework.stereotype.Component; @Component diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java index 2fba3b3b25..9214635602 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java @@ -11,14 +11,16 @@ import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.ticket.ExternalTicket; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.client.RequestsDbClient; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class ManualHandlingTasks { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ManualHandlingTasks.class); + private static final Logger logger = LoggerFactory.getLogger(ManualHandlingTasks.class); private static final String TASK_TYPE_PAUSE = "pause"; private static final String TASK_TYPE_FALLOUT = "fallout"; @@ -34,7 +36,7 @@ public class ManualHandlingTasks { DelegateExecution execution = task.getExecution(); try { String taskId = task.getId(); - msoLogger.debug("taskId is: " + taskId); + logger.debug("taskId is: " + taskId); String type = TASK_TYPE_FALLOUT; String nfRole = (String) execution.getVariable("vnfType"); String subscriptionServiceType = (String) execution.getVariable("serviceType"); @@ -66,13 +68,13 @@ public class ManualHandlingTasks { TaskService taskService = execution.getProcessEngineServices().getTaskService(); taskService.setVariables(taskId, taskVariables); - msoLogger.debug("successfully created fallout task: "+ taskId); + logger.debug("successfully created fallout task: "+ taskId); } catch (BpmnError e) { - msoLogger.debug("BPMN exception: " + e.getMessage()); + logger.debug("BPMN exception: " + e.getMessage()); throw e; } catch (Exception ex){ String msg = "Exception in setFalloutTaskVariables " + ex.getMessage(); - msoLogger.debug(msg); + logger.debug(msg); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); } } @@ -83,7 +85,7 @@ public class ManualHandlingTasks { try { String taskId = task.getId(); - msoLogger.debug("taskId is: " + taskId); + logger.debug("taskId is: " + taskId); String type = TASK_TYPE_PAUSE; String nfRole = (String) execution.getVariable("vnfType"); String subscriptionServiceType = (String) execution.getVariable("serviceType"); @@ -115,13 +117,13 @@ public class ManualHandlingTasks { TaskService taskService = execution.getProcessEngineServices().getTaskService(); taskService.setVariables(taskId, taskVariables); - msoLogger.debug("successfully created pause task: "+ taskId); + logger.debug("successfully created pause task: "+ taskId); } catch (BpmnError e) { - msoLogger.debug("BPMN exception: " + e.getMessage()); + logger.debug("BPMN exception: " + e.getMessage()); throw e; } catch (Exception ex){ String msg = "Exception in setPauseTaskVariables " + ex.getMessage(); - msoLogger.debug(msg); + logger.debug(msg); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); } @@ -134,24 +136,24 @@ public class ManualHandlingTasks { try { String taskId = task.getId(); - msoLogger.debug("taskId is: " + taskId); + logger.debug("taskId is: " + taskId); TaskService taskService = execution.getProcessEngineServices().getTaskService(); Map<String, Object> taskVariables = taskService.getVariables(taskId); String responseValue = (String) taskVariables.get("responseValue"); - msoLogger.debug("Received responseValue on completion: "+ responseValue); + logger.debug("Received responseValue on completion: "+ responseValue); // Have to set the first letter of the response to upper case String responseValueUppercaseStart = responseValue.substring(0, 1).toUpperCase() + responseValue.substring(1); - msoLogger.debug("ResponseValue to taskListener: "+ responseValueUppercaseStart); + logger.debug("ResponseValue to taskListener: "+ responseValueUppercaseStart); execution.setVariable("responseValueTask", responseValueUppercaseStart); } catch (BpmnError e) { - msoLogger.debug("BPMN exception: " + e.getMessage()); + logger.debug("BPMN exception: " + e.getMessage()); throw e; } catch (Exception ex){ String msg = "Exception in completeManualTask " + ex.getMessage(); - msoLogger.debug(msg); + logger.debug(msg); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); } @@ -177,10 +179,10 @@ public class ManualHandlingTasks { ticket.createTicket(); } catch (BpmnError e) { String msg = "BPMN error in createAOTSTicket " + e.getMessage(); - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.ErrorCode.UnknownError, ""); + logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", ErrorCode.UnknownError.getValue()); } catch (Exception ex){ String msg = "Exception in createExternalTicket " + ex.getMessage(); - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.ErrorCode.UnknownError, ""); + logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", ErrorCode.UnknownError.getValue()); } } @@ -195,7 +197,7 @@ public class ManualHandlingTasks { requestDbclient.updateInfraActiveRequests(request); } catch (Exception e) { - msoLogger.error("Unable to save the updated request status to the DB",e); + logger.error("Unable to save the updated request status to the DB",e); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java index f917aed39e..8c774d8677 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java @@ -51,7 +51,6 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork; import org.onap.so.entity.MsoRequest; -import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.NetworkRollback; import org.onap.so.openstack.beans.RouteTarget; import org.onap.so.openstack.beans.Subnet; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java index 17fa10a186..8456f26239 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java @@ -31,8 +31,8 @@ import org.onap.namingservice.model.NameGenResponse; import org.onap.namingservice.model.NameGenResponseError; import org.onap.namingservice.model.Respelement; import org.onap.so.client.exception.BadResponseException; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.ResponseEntity; @@ -52,7 +52,7 @@ public class NamingClientResponseValidator { public String validateNameGenResponse(ResponseEntity<NameGenResponse> response) throws BadResponseException { if (response == null) { logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NO_RESPONSE_FROM_NAMING_SERVICE, - "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), + "BPMN", ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_NAMING_SERVICE); throw new BadResponseException(NO_RESPONSE_FROM_NAMING_SERVICE); } @@ -62,7 +62,7 @@ public class NamingClientResponseValidator { NameGenResponse responseBody = response.getBody(); if (responseBody == null) { logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NULL_RESPONSE_FROM_NAMING_SERVICE, - "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), + "BPMN", ErrorCode.UnknownError.getValue(), NULL_RESPONSE_FROM_NAMING_SERVICE); throw new BadResponseException(NULL_RESPONSE_FROM_NAMING_SERVICE); } @@ -92,7 +92,7 @@ public class NamingClientResponseValidator { } String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString); logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN", - MsoLogger.ErrorCode.DataError.getValue(), errorMessage); + ErrorCode.DataError.getValue(), errorMessage); throw new BadResponseException(errorMessage); } } @@ -100,7 +100,7 @@ public class NamingClientResponseValidator { public String validateNameGenDeleteResponse(ResponseEntity<NameGenDeleteResponse> response) throws BadResponseException { if (response == null) { logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NO_RESPONSE_FROM_NAMING_SERVICE, - "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), + "BPMN", ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_NAMING_SERVICE); throw new BadResponseException(NO_RESPONSE_FROM_NAMING_SERVICE); } @@ -110,7 +110,7 @@ public class NamingClientResponseValidator { NameGenDeleteResponse responseBody = response.getBody(); if (responseBody == null) { logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NULL_RESPONSE_FROM_NAMING_SERVICE, - "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), + "BPMN", ErrorCode.UnknownError.getValue(), NULL_RESPONSE_FROM_NAMING_SERVICE); throw new BadResponseException(NULL_RESPONSE_FROM_NAMING_SERVICE); } @@ -123,7 +123,7 @@ public class NamingClientResponseValidator { String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString); logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN", - MsoLogger.ErrorCode.DataError.getValue(), errorMessage); + ErrorCode.DataError.getValue(), errorMessage); throw new BadResponseException(errorMessage); } } @@ -143,7 +143,7 @@ public class NamingClientResponseValidator { } String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString); logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN", - MsoLogger.ErrorCode.DataError.getValue(), errorMessage); + ErrorCode.DataError.getValue(), errorMessage); return errorMessage; } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NetworkAdapterResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NetworkAdapterResources.java index 6867cb8ebb..8f3445529e 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NetworkAdapterResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NetworkAdapterResources.java @@ -43,7 +43,6 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.so.client.adapter.network.NetworkAdapterClientException; import org.onap.so.client.adapter.network.NetworkAdapterClientImpl; import org.onap.so.client.adapter.network.mapper.NetworkAdapterObjectMapper; -import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java index 8513b26a5d..418e70a09e 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java @@ -30,8 +30,8 @@ import org.apache.commons.lang.StringUtils; import org.apache.http.HttpStatus; import org.onap.so.client.exception.BadResponseException; import org.onap.so.client.exception.MapperException; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpHeaders; @@ -69,7 +69,7 @@ public class SdnCommonTasks { } catch (JsonProcessingException e) { logger.error("{} {} {} {} {}", MessageEnum.JAXB_EXCEPTION.toString(), COULD_NOT_CONVERT_SDNC_POJO_TO_JSON, - "BPMN", MsoLogger.ErrorCode.DataError.getValue(), e.getMessage()); + "BPMN", ErrorCode.DataError.getValue(), e.getMessage()); throw new MapperException(COULD_NOT_CONVERT_SDNC_POJO_TO_JSON); } jsonRequest = "{\"input\":" + jsonRequest + "}"; @@ -101,7 +101,7 @@ public class SdnCommonTasks { public String validateSDNResponse(LinkedHashMap<String, Object> output) throws BadResponseException { if (CollectionUtils.isEmpty(output)) { logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), NO_RESPONSE_FROM_SDNC, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_SDNC); + ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_SDNC); throw new BadResponseException(NO_RESPONSE_FROM_SDNC); } LinkedHashMap<String, Object> embeddedResponse =(LinkedHashMap<String, Object>) output.get("output"); @@ -128,7 +128,7 @@ public class SdnCommonTasks { } else { String errorMessage = String.format(SDNC_CODE_NOT_0_OR_IN_200_299, responseMessage); logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), errorMessage, "BPMN", - MsoLogger.ErrorCode.DataError.getValue(), errorMessage); + ErrorCode.DataError.getValue(), errorMessage); throw new BadResponseException(errorMessage); } } @@ -142,7 +142,7 @@ public class SdnCommonTasks { public String validateSDNGetResponse(LinkedHashMap<String, Object> output) throws BadResponseException { if (CollectionUtils.isEmpty(output)) { logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), NO_RESPONSE_FROM_SDNC, "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_SDNC); + ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_SDNC); throw new BadResponseException(NO_RESPONSE_FROM_SDNC); } ObjectMapper objMapper = new ObjectMapper(); @@ -153,7 +153,7 @@ public class SdnCommonTasks { } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), BAD_RESPONSE_FROM_SDNC, - "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), + "BPMN", ErrorCode.UnknownError.getValue(), BAD_RESPONSE_FROM_SDNC); throw new BadResponseException(BAD_RESPONSE_FROM_SDNC); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java index 5124435a79..b8c5fad41d 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java @@ -47,8 +47,8 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.so.client.exception.MapperException; import org.onap.so.client.sdnc.beans.SDNCSvcAction; import org.onap.so.client.sdnc.beans.SDNCSvcOperation; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -174,7 +174,7 @@ public class VfModuleTopologyOperationRequestMapper { objectPath = assignResponseInfo.getVfModuleResponseInformation().getObjectPath(); } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), e.getMessage(), "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), e.getMessage()); + ErrorCode.UnknownError.getValue(), e.getMessage()); } } return objectPath; diff --git a/common/src/main/java/org/onap/so/client/aai/AAIClientResponseExceptionMapper.java b/common/src/main/java/org/onap/so/client/aai/AAIClientResponseExceptionMapper.java index ffc474a55a..6c6cf9024d 100644 --- a/common/src/main/java/org/onap/so/client/aai/AAIClientResponseExceptionMapper.java +++ b/common/src/main/java/org/onap/so/client/aai/AAIClientResponseExceptionMapper.java @@ -32,7 +32,6 @@ import javax.ws.rs.ext.Provider; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.client.ResponseExceptionMapper; import org.onap.so.client.aai.entities.AAIError; -import org.onap.so.logger.MsoLogger; import org.slf4j.MDC; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/common/src/main/java/org/onap/so/logger/ErrorCode.java b/common/src/main/java/org/onap/so/logger/ErrorCode.java new file mode 100644 index 0000000000..b58189efda --- /dev/null +++ b/common/src/main/java/org/onap/so/logger/ErrorCode.java @@ -0,0 +1,16 @@ +package org.onap.so.logger; + +public enum ErrorCode { + PermissionError(100), AvailabilityError(200), DataError(300), SchemaError(400), BusinessProcesssError( + 500), UnknownError(900); + + private int value; + + ErrorCode(int value) { + this.value = value; + } + + public int getValue() { + return this.value; + } +} diff --git a/common/src/main/java/org/onap/so/logger/HttpHeadersConstants.java b/common/src/main/java/org/onap/so/logger/HttpHeadersConstants.java new file mode 100644 index 0000000000..f34b4b5a9a --- /dev/null +++ b/common/src/main/java/org/onap/so/logger/HttpHeadersConstants.java @@ -0,0 +1,13 @@ +package org.onap.so.logger; + +public class HttpHeadersConstants { + public static final String HEADER_FROM_APP_ID = "X-FromAppId"; + public static final String ONAP_PARTNER_NAME = "X-ONAP-PartnerName"; + public static final String HEADER_REQUEST_ID = "X-RequestId"; + public static final String TRANSACTION_ID = "X-TransactionID"; + public static final String ECOMP_REQUEST_ID = "X-ECOMP-RequestID"; + public static final String ONAP_REQUEST_ID = "X-ONAP-RequestID"; + public static final String CLIENT_ID = "X-ClientID"; + public static final String INVOCATION_ID_HEADER = "X-InvocationID"; + public static final String REQUESTOR_ID = "X-RequestorID"; +} diff --git a/common/src/main/java/org/onap/so/logger/MdcConstants.java b/common/src/main/java/org/onap/so/logger/MdcConstants.java new file mode 100644 index 0000000000..9f8417e047 --- /dev/null +++ b/common/src/main/java/org/onap/so/logger/MdcConstants.java @@ -0,0 +1,13 @@ +package org.onap.so.logger; + +public class MdcConstants { + public static final String INVOCATION_ID = "InvocationID"; + public static final String RESPONSECODE = "ResponseCode"; + public static final String RESPONSEDESC = "ResponseDesc"; + public static final String ECOMP_REQUEST_ID = "X-ECOMP-RequestID"; + public static final String CLIENT_ID = "X-ClientID"; + public static final String PARTNERNAME = "PartnerName"; + public static final String SERVICE_NAME = "ServiceName"; + public static final String STATUSCODE = "StatusCode"; + public static final String ENDTIME = "EndTimestamp"; +} diff --git a/common/src/main/java/org/onap/so/logger/MsoLogger.java b/common/src/main/java/org/onap/so/logger/MsoLogger.java deleted file mode 100644 index 9715695d7c..0000000000 --- a/common/src/main/java/org/onap/so/logger/MsoLogger.java +++ /dev/null @@ -1,1092 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.logger; - - -import java.io.PrintWriter; -import java.io.StringWriter; -import java.lang.invoke.MethodHandles; -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Date; - -import org.apache.commons.lang3.StringUtils; -import org.onap.so.entity.MsoRequest; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.slf4j.MDC; -import org.slf4j.Marker; -import org.slf4j.MarkerFactory; - - -/** - * This class supports all of the normal logging functions (debug, info, etc.), prepending - * a string of format "[<requestId>|<serviceId]" to each message. - * - * SO code should initialize with these IDs when available, so that individual - * requests and/or services can be tracked throughout the various MSO component - * logs (API Handler, BPEL, and Adapters). - * - * - */ - -public class MsoLogger { - // Required MDC parameters - public static final String REQUEST_ID = "RequestID"; - public static final String INVOCATION_ID = "InvocationID"; - public static final String INSTANCE_UUID = "InstanceUUID"; - public static final String SERVICE_NAME = "ServiceName"; - public static final String STATUSCODE = "StatusCode"; - public static final String RESPONSECODE = "ResponseCode"; - public static final String RESPONSEDESC = "ResponseDesc"; - public static final String FQDN = "ServerFQDN"; - public static final String ENTRY_TIMESTAMP = "EntryTimestamp"; - public static final String CLIENT_IPADDRESS = "EntryTimestamp"; - - - //HTTP Headers - public static final String HEADER_FROM_APP_ID = "X-FromAppId"; - public static final String ONAP_PARTNER_NAME = "X-ONAP-PartnerName"; - public static final String HEADER_REQUEST_ID = "X-RequestId"; - public static final String TRANSACTION_ID = "X-TransactionID"; - public static final String ECOMP_REQUEST_ID = "X-ECOMP-RequestID"; - public static final String ONAP_REQUEST_ID = "X-ONAP-RequestID"; - public static final String CLIENT_ID = "X-ClientID"; - public static final String INVOCATION_ID_HEADER = "X-InvocationID"; - public static final String REQUESTOR_ID = "X-RequestorID"; - - //Default values for not found - public static final String UNKNOWN_PARTNER = "UnknownPartner"; - - public static final String SERVICE_INSTANCE_ID = "ServiceInstanceId"; - public static final String SERVICE_NAME_IS_METHOD_NAME = "ServiceNameIsMethodName"; - public static final String SERVER_IP = "ServerIPAddress"; - - public static final String REMOTE_HOST = "RemoteHost"; - public static final String ALERT_SEVERITY = "AlertSeverity"; - public static final String TIMER = "Timer"; - public static final String USER = "User"; - public static final String DUMMY_VALUE = "trace-#"; - public static final String UNKNOWN = "UNKNOWN"; - public static final String CAT_LOG_LEVEL = "CategoryLogLevel"; - public static final String AUDI_CAT_LOG_LEVEL = "AuditCategoryLogLevel"; - - - - public static final String PARTNER_NAME = "PartnerName"; - - // Audit/Metric log specific - public static final String BEGINTIME = "BeginTimestamp"; - public static final String STARTTIME = "StartTimeMilis"; - public static final String ENDTIME = "EndTimestamp"; - public static final String PARTNERNAME = "PartnerName"; - - - - // Metric log specific - public static final String METRIC_BEGIN_TIME = "MetricBeginTime"; - public static final String METRIC_START_TIME = "MetricStartTime"; - public static final String METRIC_END_TIME = "MetricEndTime"; - public static final String METRIC_TIMER = "MetricEndTime"; - public static final String TARGETENTITY = "TargetEntity"; - public static final String TARGETSERVICENAME = "TargetServiceName"; - public static final String TARGETVIRTUALENTITY = "TargetVirtualEntity"; - - public static final String FATAL_LEVEL = "FATAL"; - public static final String ERROR_LEVEL = "ERROR"; - public static final String WARN_LEVEL = "WARN"; - public static final String INFO_LEVEL = "INFO"; - public static final String DEBUG_LEVEL = "DEBUG"; - - public static final String ERRORCODE = "ErrorCode"; - public static final String ERRORDESC = "ErrorDesc"; - - //Status Codes - public static final String COMPLETE = "COMPLETE"; - public static final String INPROGRESS = "INPROGRESS"; - - public enum Catalog { - APIH, BPEL, RA, ASDC, GENERAL - } - - public enum StatusCode { - COMPLETE, ERROR - } - - public enum TargetEntity { - CAMUNDA("Camunda"); - - private String name; - - TargetEntity(String name) { - this.name = name; - } - - public String getUrl() { - return name; - } - } - - public enum ResponseCode { - Suc(0), PermissionError(100), DataError(300), DataNotFound(301), BadRequest(302), SchemaError( - 400), BusinessProcesssError(500), ServiceNotAvailable(501), InternalError( - 502), Conflict(503), DBAccessError(504), CommunicationError(505), UnknownError(900); - - private int value; - - public int getValue() { - return this.value; - } - - private ResponseCode(int value) { - this.value = value; - } - } - - public enum ErrorCode { - PermissionError(100), AvailabilityError(200), DataError(300), SchemaError(400), BusinessProcesssError( - 500), UnknownError(900); - - private int value; - - public int getValue() { - return this.value; - } - - private ErrorCode(int value) { - this.value = value; - } - } - - - private Logger logger; - private Logger metricsLogger; - private Logger auditLogger; - private static String instanceUUID, serverIP, serverName; - private MessageEnum exceptionArg, defaultException, defaultWarning, defaultAudit, defaultMetrics; - - private MsoLogger() { - this(MsoLogger.Catalog.GENERAL); - } - - private MsoLogger(MsoLogger.Catalog cat) { - this(cat, MethodHandles.lookup().lookupClass()); - } - - private MsoLogger(MsoLogger.Catalog cat, Class<?> clazz) { - this.logger = LoggerFactory.getLogger(clazz); - this.auditLogger = LoggerFactory.getLogger("AUDIT"); - this.metricsLogger = LoggerFactory.getLogger("METRIC"); - setDefaultLogCatalog(cat); - } - - public static MsoLogger getMsoLogger(MsoLogger.Catalog cat, Class<?> clazz) { - return new MsoLogger(cat,clazz); - } - - - - /** - * Record the Metrics event with no argument - * - * @param startTime - * Transaction starting time in millieseconds - * @param statusCode - * StatusCode of the transaction, either COMPLETE or ERROR - * @param responseCode - * The response code returned by the sub-components - * @param responseDesc - * Human redable description of the response code - * @param targetEntity - * The component which is invoked for this sub-operation - * @param targetServiceName - * API invoked on the TargetEntity - * @param targetVEntity - * Target VNF or VM acted opon by the component, if available - */ - - public void recordMetricEvent(Long startTime, StatusCode statusCode, ResponseCode responseCode, String responseDesc, - String targetEntity, String targetServiceName, String targetVEntity) { - prepareMetricMsg(startTime, statusCode, responseCode.getValue(), responseDesc, targetEntity, targetServiceName, - targetVEntity); - metricsLogger.info(""); - MDC.remove(TIMER); - MDC.remove(TARGETENTITY); - MDC.remove(TARGETSERVICENAME); - } - - - /** - * Record the Audit event - * - * @param startTime - * Transaction starting time in millieseconds - * @param statusCode - * StatusCode of the transaction, either COMPLETE or ERROR - * @param responseCode - * The application specific response code - * @param responseDesc - * Human redable description of the application response code - */ - - public void recordAuditEvent(Long startTime, StatusCode statusCode, ResponseCode responseCode, - String responseDesc) { - if (StringUtils.isEmpty(MDC.get(MsoLogger.PARTNERNAME))) { - MDC.put(MsoLogger.PARTNERNAME, "UNKNOWN"); - } - prepareAuditMsg(startTime, statusCode, responseCode.getValue(), responseDesc); - auditLogger.info(""); - MDC.remove(TIMER); - } - - // Debug methods - /** - * Record the Debug event - * - * @param msg - * The log message to put - */ - public void debug(String msg) { - prepareMsg(DEBUG_LEVEL); - logger.debug(msg); - } - - /** - * Record the Debug event - * - * @param msg - * The log message to put - * @param t - * The exception to put - */ - public void debug(String msg, Throwable t) { - prepareMsg(DEBUG_LEVEL); - logger.debug(msg, t); - } - - public void info(String msg) { - prepareMsg(DEBUG_LEVEL); - logger.info(msg); - } - - - /** - * Log error message with the details of the exception that caused the error. - * @param msg - * @param throwable - */ - public void error(String msg) { - prepareMsg(ERROR_LEVEL); - logger.error(msg); - } - - /** - * Log error message with the details of the exception that caused the error. - * @param msg - * @param throwable - */ - public void error(String msg, Throwable throwable) { - prepareMsg(ERROR_LEVEL); - logger.error(msg, throwable); - } - - // Info methods - /** - * Record the Info event - * - * @param msg - * The log message to put - */ - public void info(String msg, String targetEntity, String targetServiceName) { - prepareErrorMsg(INFO_LEVEL, targetEntity, targetServiceName, null, ""); - - logger.info(msg); - MDC.remove(TARGETENTITY); - MDC.remove(TARGETSERVICENAME); - } - - /** - * Record the Info event with 1 argument - * - * @param msg - * The log message to put - * @param arg0 - * The argument used in the log message - */ - public void info(MessageEnum msg, String arg0, String targetEntity, String targetServiceName) { - prepareErrorMsg(INFO_LEVEL, targetEntity, targetServiceName, null, ""); - - logger.info(msg.toString(), normalize(arg0)); - MDC.remove(TARGETENTITY); - MDC.remove(TARGETSERVICENAME); - } - - /** - * Record the Info event with 2 arguments - * - * @param msg - * The log message to put - * @param arg0,arg1 - * The arguments used in the log message - */ - public void info(String msg, String arg0, String arg1, String targetEntity, - String targetServiceName) { - prepareErrorMsg(INFO_LEVEL, targetEntity, targetServiceName, null, ""); - - logger.info(msg, normalize(arg0), normalize(arg1)); - MDC.remove(TARGETENTITY); - MDC.remove(TARGETSERVICENAME); - } - - /** - * Record the Info event with 3 arguments - * - * @param msg - * The log message to put - * @param arg0,arg1,arg2 - * The arguments used in the log message - */ - public void info(MessageEnum msg, String arg0, String arg1, String arg2, String targetEntity, - String targetServiceName) { - prepareErrorMsg(INFO_LEVEL, targetEntity, targetServiceName, null, ""); - - logger.info(msg.toString(), normalize(arg0), normalize(arg1), normalize(arg2)); - MDC.remove(TARGETENTITY); - MDC.remove(TARGETSERVICENAME); - } - - /** - * Record the Info event with 4 arguments - * - * @param msg - * The log message to put - * @param arg0,arg1,arg2,arg3 - * The arguments used in the log message - */ - public void info(String msg, String arg0, String arg1, String arg2, String arg3, - String targetEntity, String targetServiceName) { - prepareErrorMsg(INFO_LEVEL, targetEntity, targetServiceName, null, ""); - - logger.info(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3)); - MDC.remove(TARGETENTITY); - MDC.remove(TARGETSERVICENAME); - } - - /** - * Record the Info event with 5 arguments - * - * @param msg - * The log message to put - * @param arg0,arg1,arg2,arg3,arg4 - * The arguments used in the log message - */ - public void info(String msg, String arg0, String arg1, String arg2, String arg3, String arg4, - String targetEntity, String targetServiceName) { - prepareErrorMsg(INFO_LEVEL, targetEntity, targetServiceName, null, ""); - - logger.info(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), normalize(arg4)); - MDC.remove(TARGETENTITY); - MDC.remove(TARGETSERVICENAME); - } - - /** - * Record the Info event with 6 arguments - * - * @param msg - * The log message to put - * @param arg0,arg1,arg2,arg3,arg4,arg5 - * The arguments used in the log message - */ - public void info(String msg, String arg0, String arg1, String arg2, String arg3, String arg4, - String arg5, String targetEntity, String targetServiceName) { - prepareErrorMsg(INFO_LEVEL, targetEntity, targetServiceName, null, ""); - - logger.info(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), normalize(arg4), - normalize(arg5)); - MDC.remove(TARGETENTITY); - MDC.remove(TARGETSERVICENAME); - } - - // Warning methods - - - /** - * Record the Warning event - * - * @param msg - * The log message to put - */ - public void warnSimple( String targetServiceName, String errorDesc) { - logger.warn("Service Name: {} Error: {}" , targetServiceName, errorDesc); - } - /** - * Record the Warning event - * - * @param msg - * The log message to put - */ - public void warn(MessageEnum msg, String targetEntity, String targetServiceName, ErrorCode errorCode, - String errorDesc) { - prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); - - logger.warn(msg.toString()); - MDC.remove(TARGETENTITY); - MDC.remove(TARGETSERVICENAME); - } - - /** - * Record the Warning event - * - * @param msg - * The log message to put - * @param t - * The exception info - */ - public void warn(MessageEnum msg, String targetEntity, String targetServiceName, ErrorCode errorCode, - String errorDesc, Throwable t) { - prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); - logger.warn("Warning: "+msg, t); - MDC.remove(TARGETENTITY); - MDC.remove(TARGETSERVICENAME); - } - - /** - * Record the Warn event with 1 argument - * - * @param msg - * The log message to put - * @param arg - * The argument used in the log message - */ - public void warn(MessageEnum msg, String arg, String targetEntity, String targetServiceName, - ErrorCode errorCode, String errorDesc) { - prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); - logger.warn(msg.toString(), arg); - MDC.remove(TARGETENTITY); - MDC.remove(TARGETSERVICENAME); - } - - /** - * Record the Warn event with 1 argument - * - * @param msg - * The log message to put - * @param arg - * The arguments used in the log message - * @param t - * The exception info - */ - public void warn(MessageEnum msg, String arg, String targetEntity, String targetServiceName, - ErrorCode errorCode, String errorDesc, Throwable t) { - prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); - logger.warn(msg.toString(), arg); - logger.debug("Exception raised", t); - MDC.remove(TARGETENTITY); - MDC.remove(TARGETSERVICENAME); - } - - /** - * Record the Warn event with 2 arguments - * - * @param msg - * The log message to put - * @param arg0,arg1 - * The arguments used in the log message - */ - public void warn(MessageEnum msg, String arg0, String arg1, String targetEntity, - String targetServiceName, ErrorCode errorCode, String errorDesc) { - prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); - logger.warn(msg.toString(), normalize(arg0), normalize(arg1)); - MDC.remove(TARGETENTITY); - MDC.remove(TARGETSERVICENAME); - } - - /** - * Record the Warn event with 2 arguments - * - * @param msg - * The log message to put - * @param arg0,arg1 - * The arguments used in the log message - * @param t - * The exception info - */ - public void warn(String msg, String arg0, String arg1, String targetEntity, - String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) { - prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); - logger.warn(msg, normalize(arg0), normalize(arg1)); - logger.warn(msg, t); - MDC.remove(TARGETENTITY); - MDC.remove(TARGETSERVICENAME); - } - - /** - * Record the Warn event with 3 arguments - * - * @param msg - * The log message to put - * @param arg0,arg1,arg2 - * The arguments used in the log message - */ - public void warn(String msg, String arg0, String arg1, String arg2, String targetEntity, - String targetServiceName, ErrorCode errorCode, String errorDesc) { - prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); - logger.warn(msg, normalize(arg0), normalize(arg1), normalize(arg2)); - MDC.remove(TARGETENTITY); - MDC.remove(TARGETSERVICENAME); - } - - /** - * Record the Warn event with 3 arguments - * - * @param msg - * The log message to put - * @param arg0,arg1,arg2 - * The arguments used in the log message - * @param t - * The exception info - */ - public void warn(String msg, String arg0, String arg1, String arg2, String targetEntity, - String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) { - prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); - logger.warn(msg, normalize(arg0), normalize(arg1), normalize(arg2)); - logger.warn(msg, t); - MDC.remove(TARGETENTITY); - MDC.remove(TARGETSERVICENAME); - } - - /** - * Record the Warn event with 4 arguments - * - * @param msg - * The log message to put - * @param arg0,arg1,arg2,arg3 - * The arguments used in the log message - */ - public void warn(String msg, String arg0, String arg1, String arg2, String arg3, - String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc) { - prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); - logger.warn(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3)); - MDC.remove(TARGETENTITY); - MDC.remove(TARGETSERVICENAME); - } - - /** - * Record the Warn event with 4 arguments - * - * @param msg - * The log message to put - * @param arg0,arg1,arg2, - * arg3 The arguments used in the log message - * @param t - * The exception info - */ - public void warn(String msg, String arg0, String arg1, String arg2, String arg3, - String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) { - prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); - logger.warn(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3)); - logger.warn(msg, t); - MDC.remove(TARGETENTITY); - MDC.remove(TARGETSERVICENAME); - } - - /** - * Record the Warn event with 5 arguments - * - * @param msg - * The log message to put - * @param arg0,arg1,arg2,arg3,arg4 - * The arguments used in the log message - */ - public void warn(String msg, String arg0, String arg1, String arg2, String arg3, String arg4, - String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc) { - prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); - logger.warn(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), normalize(arg4)); - MDC.remove(TARGETENTITY); - MDC.remove(TARGETSERVICENAME); - } - - /** - * Record the Warn event with 5 arguments - * - * @param msg - * The log message to put - * @param arg0,arg1,arg2,arg3,arg4 - * The arguments used in the log message - * @param t - * The exception info - */ - public void warn(String msg, String arg0, String arg1, String arg2, String arg3, String arg4, - String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) { - prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); - logger.warn(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), normalize(arg4)); - logger.warn(msg, t); - MDC.remove(TARGETENTITY); - MDC.remove(TARGETSERVICENAME); - } - - - - // Error methods - /** - * Record the Error event - * - * @param generalException - * The log message to put - */ - public void error(MessageEnum generalException, String targetEntity, String targetServiceName, ErrorCode errorCode, - String errorDesc) { - prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); - logger.error(generalException.toString() + ": " +errorDesc); - MDC.remove(TARGETENTITY); - MDC.remove(TARGETSERVICENAME); - } - - - /** - * Record the Error event - * - * @param msg - * The log message to put - * @param t - * The exception info - */ - public void trace(String traceMessage) { - logger.trace(traceMessage); - } - - - /** - * Record the Error event - * - * @param msg - * The log message to put - * @param t - * The exception info - */ - public void error( Throwable t) { - logger.error(t.getMessage(), t); - } - - - /** - * Record the Error event - * - * @param msg - * The log message to put - * @param t - * The exception info - */ - public void error(MessageEnum msg, String targetEntity, String targetServiceName, ErrorCode errorCode, - String errorDesc, Throwable t) { - prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); - logger.error(msg.toString(), t); - MDC.remove(TARGETENTITY); - MDC.remove(TARGETSERVICENAME); - } - - /** - * Record the Error event with 1 argument - * - * @param msg - * The log message to put - * @param arg0 - * The arguments used in the log message - */ - public void error(MessageEnum msg, String arg0, String targetEntity, String targetServiceName, - ErrorCode errorCode, String errorDesc) { - prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); - logger.error(msg.toString(), normalize(arg0)); - MDC.remove(TARGETENTITY); - MDC.remove(TARGETSERVICENAME); - } - - /** - * Record the Error event with 1 argument - * - * @param msg - * The log message to put - * @param arg0 - * The arguments used in the log message - * @param t - * The exception info - */ - public void error(MessageEnum msg, String arg0, String targetEntity, String targetServiceName, - ErrorCode errorCode, String errorDesc, Throwable t) { - prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); - logger.error(msg.toString(), normalize(arg0), t); - MDC.remove(TARGETENTITY); - MDC.remove(TARGETSERVICENAME); - } - - /** - * Record the Error event with 2 arguments - * - * @param msg - * The log message to put - * @param arg0,arg1 - * The arguments used in the log message - */ - public void error(MessageEnum msg, String arg0, String arg1, String targetEntity, - String targetServiceName, ErrorCode errorCode, String errorDesc) { - prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); - logger.error(msg.toString(), normalize(arg0), normalize(arg1)); - MDC.remove(TARGETENTITY); - MDC.remove(TARGETSERVICENAME); - } - - /** - * Record the Error event with 2 arguments - * - * @param msg - * The log message to put - * @param arg0,arg1 - * The arguments used in the log message - * @param t - * The exception info - */ - public void error(MessageEnum msg, String arg0, String arg1, String targetEntity, - String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) { - prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); - logger.error(msg.toString(), normalize(arg0), normalize(arg1), t); - logger.debug("Exception raised", t); - MDC.remove(TARGETENTITY); - MDC.remove(TARGETSERVICENAME); - } - - /** - * Record the Error event with 3 arguments - * - * @param msg - * The log message to put - * @param arg0,arg1,arg2 - * The arguments used in the log message - */ - public void error(MessageEnum msg, String arg0, String arg1, String arg2, String targetEntity, - String targetServiceName, ErrorCode errorCode, String errorDesc) { - prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); - logger.error(msg.toString(), normalize(arg0), normalize(arg1), normalize(arg2)); - MDC.remove(TARGETENTITY); - MDC.remove(TARGETSERVICENAME); - } - - /** - * Record the Error event with 3 arguments - * - * @param msg - * The log message to put - * @param arg0,arg1,arg2 - * The arguments used in the log message - * @param t - * The exception info - */ - public void error(MessageEnum msg, String arg0, String arg1, String arg2, String targetEntity, - String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) { - prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); - logger.error(msg.toString(), normalize(arg0), normalize(arg1), normalize(arg2), t); - MDC.remove(TARGETENTITY); - MDC.remove(TARGETSERVICENAME); - } - - /** - * Record the Error event with 4 arguments - * - * @param msg - * The log message to put - * @param arg0,arg1,arg2,arg3 - * The arguments used in the log message - */ - public void error(MessageEnum msg, String arg0, String arg1, String arg2, String arg3, - String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc) { - prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); - logger.error(msg.toString(), normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3)); - MDC.remove(TARGETENTITY); - MDC.remove(TARGETSERVICENAME); - } - - /** - * Record the Error event with 4 arguments - * - * @param msg - * The log message to put - * @param arg0,arg1,arg2,arg3 - * The arguments used in the log message - * @param t - * The exception info - */ - public void error(MessageEnum msg, String arg0, String arg1, String arg2, String arg3, - String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) { - prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); - logger.error(msg.toString(), normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), t); - - logger.debug("Exception raised", t); - MDC.remove(TARGETENTITY); - MDC.remove(TARGETSERVICENAME); - } - - /** - * Record the Error event with 5 arguments - * - * @param msg - * The log message to put - * @param arg0,arg1,arg2,arg3,arg4 - * The arguments used in the log message - */ - public void error(MessageEnum msg, String arg0, String arg1, String arg2, String arg3, String arg4, - String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc) { - prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); - logger.error(msg.toString(), normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), normalize(arg4)); - MDC.remove(TARGETENTITY); - MDC.remove(TARGETSERVICENAME); - } - - /** - * Record the Error event with 5 arguments - * - * @param msg - * The log message to put - * @param arg0,arg1,arg2,arg3,arg4 - * The arguments used in the log message - * @param t - * The exception info - */ - public void error(MessageEnum msg, String arg0, String arg1, String arg2, String arg3, String arg4, - String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) { - prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc); - logger.error(msg.toString(), normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), normalize(arg4), t); - logger.debug("Exception raised", t); - MDC.remove(TARGETENTITY); - MDC.remove(TARGETSERVICENAME); - } - - public void error(String errorMessage, String errorSource, String targetEntity, String targetServiceName, - ErrorCode errorCode, String errorText) { - prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorText); - logger.error(errorMessage); - MDC.remove(TARGETENTITY); - MDC.remove(TARGETSERVICENAME); - - } - - private void prepareMsg(String loggingLevel) { - prepareMsg(loggingLevel, null, null); - } - - private void prepareMsg(String loggingLevel, String serviceNamep, String timer) { - String reqId = MDC.get(REQUEST_ID); - String svcId = MDC.get(SERVICE_INSTANCE_ID); - - // Based on the discussion with Adrian, - // if these 2 parameters is not available, using dummy value "trace-#" - if (reqId == null || reqId.isEmpty()) { - MDC.put(REQUEST_ID, DUMMY_VALUE); - } - - if (timer != null) { - MDC.put(TIMER, timer); - } - - writeIfNotNullorEmpty(SERVICE_NAME,getFinalServiceName(serviceNamep)); - writeIfNotNullorEmpty(ALERT_SEVERITY,getSeverityLevel(loggingLevel)); - writeIfNotNullorEmpty(INSTANCE_UUID,instanceUUID); - writeIfNotNullorEmpty(SERVER_IP,serverIP); - writeIfNotNullorEmpty(FQDN,serverName); - - } - - private void writeIfNotNullorEmpty(String Key, String value) { - if (MDC.get(Key) == null|| MDC.get(Key).isEmpty()) { - MDC.put(Key, value); - } - } - - private void prepareAuditMsg(long startTime, StatusCode statusCode, int responseCode, String responseDesc) { - long endTime = System.currentTimeMillis(); - prepareMsg(INFO_LEVEL, null, String.valueOf(endTime - startTime)); - prepareAuditMetricMsg(startTime, endTime, statusCode, responseCode, responseDesc); - } - - private void prepareAuditMetricMsg(long startTime, long endTime, StatusCode statusCode, int responseCode, - String responseDesc) { - Date startDate = new Date(startTime); - Date endDate = new Date(endTime); - DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX"); - - MDC.put(BEGINTIME, String.valueOf(formatter.format(startDate))); - MDC.put(ENDTIME, String.valueOf(formatter.format(endDate))); - MDC.put(STATUSCODE, statusCode.name()); - MDC.put(RESPONSECODE, String.valueOf(responseCode)); - MDC.put(RESPONSEDESC, responseDesc); - } - - private void prepareErrorMsg(String loggingLevel, String targetEntity, String targetServiceName, - ErrorCode errorCode, String errorDesc) { - MDC.put(ALERT_SEVERITY, getSeverityLevel(loggingLevel)); - if(errorCode != null) { - MDC.put(ERRORCODE, Integer.toString(errorCode.getValue())); - } - MDC.put(ERRORDESC, errorDesc); - MDC.put(TARGETENTITY, targetEntity); - MDC.put(TARGETSERVICENAME, targetServiceName); - } - - private void prepareMetricMsg(long startTime, StatusCode statusCode, int responseCode, String responseDesc, - String targetEntity, String targetServiceName, String targetVEntity) { - long endTime = System.currentTimeMillis(); - prepareMsg(INFO_LEVEL, null, String.valueOf(endTime - startTime)); - prepareAuditMetricMsg(startTime, endTime, statusCode, responseCode, responseDesc); - - // Populate Metric log specific parameter - MDC.put(TARGETENTITY, targetEntity); - MDC.put(TARGETSERVICENAME, targetServiceName); - - if (null != targetVEntity) { - MDC.put(TARGETVIRTUALENTITY, targetVEntity); - } - } - - private String getSeverityLevel(String loggingLevel) { - String severity; - // According to the Nagios alerting: 0=OK; 1=WARNING; 2=UNKOWN; - // 3=CRITICAL - switch (loggingLevel) { - case ERROR_LEVEL: - severity = "2"; - break; - case FATAL_LEVEL: - severity = "3"; - break; - case WARN_LEVEL: - severity = "1"; - break; - default: - severity = "0"; - break; - } - return severity; - } - - private String getFinalServiceName(String serviceNamep) { - // This step to set the serviceName should be put after the className is - // get, - // since the default serviceName is obtained during the method to get - // the className. - // - // There's 3 ways to set the serviceName. The first method has the most - // priority to set the value. - // a) If the serviceName is set within the log method, this value will - // be used first - // b) If serviceName is not set within the log method, the value defined - // in the MDC will be used - // c) If nothing is set specifically, then MsoLogger will assign a - // default(MSO.<method_name>) value to it - String serName = MDC.get(MsoLogger.SERVICE_NAME); - - // Check if service name was already set as the method name by a - // previous call to this method. - String isMethodNameStr = MDC.get(MsoLogger.SERVICE_NAME_IS_METHOD_NAME); - boolean isMethodName = isMethodNameStr != null && isMethodNameStr.equals(Boolean.TRUE.toString()); - if (serviceNamep != null) { - return serviceNamep; - } else if (serName != null && !isMethodName) { - return serName; - } - - MDC.put(MsoLogger.SERVICE_NAME_IS_METHOD_NAME, Boolean.TRUE.toString()); - int limit; - StackTraceElement[] classArr = new Exception().getStackTrace(); - if (classArr.length >= 6) { - limit = 7; - } else { - limit = classArr.length; - } - for (int i = 1; i < limit; i++) { - if (!classArr[i].getClassName().equals(this.getClass().getName())) { - return classArr[i].getMethodName(); - } - } - return classArr[0].getMethodName(); - } - - /** - * Set the requestId and serviceInstanceId - * - * @param reqId - * The requestId - * @param svcId - * The serviceInstanceId - */ - public static void setLogContext(String reqId, String svcId) { - if (null != reqId) { - MDC.put(REQUEST_ID, reqId); - } - - if (null != svcId) { - MDC.put(SERVICE_INSTANCE_ID, svcId); - } - } - - private String normalize(String input) { - if (input == null) { - return null; - } - String result = input.replace('|', '!'); - result = result.replace("\n", " - "); - return result; - } - - private void setDefaultLogCatalog(MsoLogger.Catalog cat) { - if ("APIH".equals(cat.toString())) { - exceptionArg = MessageEnum.APIH_GENERAL_EXCEPTION_ARG; - defaultException = MessageEnum.APIH_GENERAL_EXCEPTION; - defaultWarning = MessageEnum.APIH_GENERAL_WARNING; - defaultAudit = MessageEnum.APIH_AUDIT_EXEC; - defaultMetrics = MessageEnum.APIH_GENERAL_METRICS; - } else if ("RA".equals(cat.toString())) { - exceptionArg = MessageEnum.RA_GENERAL_EXCEPTION_ARG; - defaultException = MessageEnum.RA_GENERAL_EXCEPTION; - defaultWarning = MessageEnum.RA_GENERAL_WARNING; - defaultAudit = MessageEnum.RA_AUDIT_EXEC; - defaultMetrics = MessageEnum.RA_GENERAL_METRICS; - } else if ("BPEL".equals(cat.toString())) { - exceptionArg = MessageEnum.BPMN_GENERAL_EXCEPTION_ARG; - defaultException = MessageEnum.BPMN_GENERAL_EXCEPTION; - defaultWarning = MessageEnum.BPMN_GENERAL_WARNING; - defaultAudit = MessageEnum.BPMN_AUDIT_EXEC; - defaultMetrics = MessageEnum.BPMN_GENERAL_METRICS; - } else if ("ASDC".equals(cat.toString())) { - exceptionArg = MessageEnum.ASDC_GENERAL_EXCEPTION_ARG; - defaultException = MessageEnum.ASDC_GENERAL_EXCEPTION; - defaultWarning = MessageEnum.ASDC_GENERAL_WARNING; - defaultAudit = MessageEnum.ASDC_AUDIT_EXEC; - defaultMetrics = MessageEnum.ASDC_GENERAL_METRICS; - } else { - exceptionArg = MessageEnum.GENERAL_EXCEPTION_ARG; - defaultException = MessageEnum.GENERAL_EXCEPTION; - defaultWarning = MessageEnum.GENERAL_WARNING; - defaultAudit = MessageEnum.AUDIT_EXEC; - defaultMetrics = MessageEnum.GENERAL_METRICS; - } - } -} diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/PayloadLoggingFilter.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/PayloadLoggingFilter.java index 29264f4e42..7f88f22b79 100644 --- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/PayloadLoggingFilter.java +++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/PayloadLoggingFilter.java @@ -39,7 +39,6 @@ import javax.ws.rs.ext.Provider; import javax.ws.rs.ext.WriterInterceptor; import javax.ws.rs.ext.WriterInterceptorContext; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -156,4 +155,4 @@ public class PayloadLoggingFilter implements ClientRequestFilter, ClientResponse return method; } -}
\ No newline at end of file +} diff --git a/common/src/main/java/org/onap/so/utils/CryptoUtils.java b/common/src/main/java/org/onap/so/utils/CryptoUtils.java index a1097780c0..7d272e39c7 100644 --- a/common/src/main/java/org/onap/so/utils/CryptoUtils.java +++ b/common/src/main/java/org/onap/so/utils/CryptoUtils.java @@ -23,8 +23,8 @@ package org.onap.so.utils; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -92,7 +92,7 @@ public final class CryptoUtils { return CryptoUtils.encrypt(message, CLOUD_KEY); } catch (GeneralSecurityException e) { logger.error("{} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception in encryptPassword ", e); + ErrorCode.BusinessProcesssError.getValue(), "Exception in encryptPassword ", e); return null; } } @@ -101,7 +101,7 @@ public final class CryptoUtils { return CryptoUtils.decrypt(message, CLOUD_KEY); } catch (GeneralSecurityException e) { logger.error("{} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception in encryptPassword ", e); + ErrorCode.BusinessProcesssError.getValue(), "Exception in encryptPassword ", e); return null; } } diff --git a/common/src/main/java/org/onap/so/utils/XmlMarshaller.java b/common/src/main/java/org/onap/so/utils/XmlMarshaller.java index 864266bf40..4aeecf88d8 100644 --- a/common/src/main/java/org/onap/so/utils/XmlMarshaller.java +++ b/common/src/main/java/org/onap/so/utils/XmlMarshaller.java @@ -35,8 +35,8 @@ import javax.xml.parsers.SAXParserFactory; import javax.xml.transform.sax.SAXSource; import org.onap.so.exceptions.MarshallerException; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.xml.sax.InputSource; @@ -55,8 +55,8 @@ public class XmlMarshaller { jaxbMarshaller.marshal(object, stringWriter); } catch (JAXBException e) { logger.error("{} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(), - MsoLogger.ErrorCode.SchemaError.getValue(), e.getMessage(), e); - throw new MarshallerException(e.getMessage(), MsoLogger.ErrorCode.SchemaError.getValue(), e); + ErrorCode.SchemaError.getValue(), e.getMessage(), e); + throw new MarshallerException(e.getMessage(), ErrorCode.SchemaError.getValue(), e); } return stringWriter.toString(); @@ -80,8 +80,8 @@ public class XmlMarshaller { object = jaxbUnmarshaller.unmarshal(source, object.getClass()).getValue(); } catch (Exception e) { logger.error("{} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(), - MsoLogger.ErrorCode.SchemaError.getValue(), e.getMessage(), e); - throw new MarshallerException(e.getMessage(), MsoLogger.ErrorCode.SchemaError.getValue(), e); + ErrorCode.SchemaError.getValue(), e.getMessage(), e); + throw new MarshallerException(e.getMessage(), ErrorCode.SchemaError.getValue(), e); } return object; diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java index d3e8323f37..9b77c1469b 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java @@ -40,8 +40,8 @@ import org.onap.so.apihandler.camundabeans.CamundaInput; import org.onap.so.apihandler.camundabeans.CamundaIntegerInput; import org.onap.so.apihandler.camundabeans.CamundaRequest; import org.onap.so.apihandler.camundabeans.CamundaVIDRequest; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.MDC; @@ -195,7 +195,7 @@ public class CamundaClient extends RequestClient{ logger.trace("request body is {}", jsonReq); }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.APIH_WARP_REQUEST.toString(), "Camunda", "wrapRequest", - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e); + ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e); } return jsonReq; } @@ -288,7 +288,7 @@ public class CamundaClient extends RequestClient{ logger.trace("request body is {}", jsonReq); }catch(Exception e){ logger.error("{} {} {} {} {}", MessageEnum.APIH_WARP_REQUEST.toString(), "Camunda", "wrapVIDRequest", - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e); + ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e); } return jsonReq; } diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java index 3d09a30731..6b43e96b08 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java @@ -35,8 +35,8 @@ import org.onap.so.apihandlerinfra.exceptions.ApiException; import org.onap.so.apihandlerinfra.exceptions.BPMNFailureException; import org.onap.so.apihandlerinfra.exceptions.ValidateException; import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import com.fasterxml.jackson.databind.ObjectMapper; import org.slf4j.Logger; @@ -78,7 +78,7 @@ public class ResponseHandler { HttpEntity entity = httpResponse.getEntity(); responseBody = EntityUtils.toString(entity); } catch (IOException e) { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_VALIDATION_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); ValidateException validateException = new ValidateException.Builder("IOException getting Camunda response body", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e) @@ -90,7 +90,7 @@ public class ResponseHandler { try { response = mapper.readValue(responseBody, CamundaResponse.class); } catch (IOException e) { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); ValidateException validateException = new ValidateException.Builder("Cannot parse Camunda Response", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e) @@ -100,7 +100,7 @@ public class ResponseHandler { if(response!=null){ responseBody = response.getResponse(); }else{ - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, MsoLogger.ErrorCode.BusinessProcesssError) + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, ErrorCode.BusinessProcesssError) .targetEntity("Camunda").targetServiceName("parseCamunda").build(); BPMNFailureException bpmnFailureException = new BPMNFailureException.Builder(String.valueOf(status), status, ErrorNumbers.ERROR_FROM_BPEL) .errorInfo(errorLoggerInfo).build(); @@ -117,13 +117,13 @@ public class ResponseHandler { } }catch(IOException e){ - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.DataError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.DataError).build(); ValidateException validateException = new ValidateException.Builder("Could not convert BPEL response to string", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e) .errorInfo(errorLoggerInfo).build(); throw validateException; } if(status!=HttpStatus.SC_ACCEPTED){ - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, MsoLogger.ErrorCode.BusinessProcesssError) + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, ErrorCode.BusinessProcesssError) .targetEntity("BPEL").targetServiceName("parseBpel").build(); @@ -144,7 +144,7 @@ public class ResponseHandler { responseBody = EntityUtils.toString(camundataskEntity); } }catch(IOException e) { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.DataError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.DataError).build(); ValidateException validateException = new ValidateException.Builder("Could not convert CamundaTask response to string", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e) @@ -152,7 +152,7 @@ public class ResponseHandler { throw validateException; } if(status!=HttpStatus.SC_NO_CONTENT && status != HttpStatus.SC_ACCEPTED){ - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, MsoLogger.ErrorCode.BusinessProcesssError) + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, ErrorCode.BusinessProcesssError) .targetEntity("CAMUNDATASK").targetServiceName("parseCamundaTask").build(); diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java index da13ff509b..c3dfe2c685 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java @@ -34,9 +34,9 @@ import javax.xml.validation.SchemaFactory; import javax.xml.validation.Validator; import org.apache.commons.io.IOUtils; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.xml.sax.SAXException; @@ -98,7 +98,7 @@ public class XMLValidator { } catch (Exception e) { logger.error("{} {} {}", MessageEnum.APIH_CANNOT_READ_SCHEMA.toString(), - MsoLogger.ErrorCode.SchemaError.getValue(), "APIH cannot read schema file", e); + ErrorCode.SchemaError.getValue(), "APIH cannot read schema file", e); return "ErrorDetails: " + "Unable to read the schema file"; } diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java index 282ca12e2b..4c069d5b1a 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java @@ -40,9 +40,9 @@ import javax.xml.bind.Marshaller; import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.onap.so.serviceinstancebeans.RequestError; import org.onap.so.serviceinstancebeans.ServiceException; @@ -137,7 +137,7 @@ public class ApiExceptionMapper implements ExceptionMapper<ApiException> { } catch (JsonProcessingException | JAXBException e) { String errorMsg = "Exception in buildServiceErrorResponse writing exceptionType to string " + e.getMessage(); logger.error("{} {} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(), "BuildServiceErrorResponse", - MsoLogger.ErrorCode.DataError.getValue(), errorMsg, e); + ErrorCode.DataError.getValue(), errorMsg, e); return errorMsg; } diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/logging/ErrorLoggerInfo.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/logging/ErrorLoggerInfo.java index b0b154bc5c..058d80868c 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/logging/ErrorLoggerInfo.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/logging/ErrorLoggerInfo.java @@ -23,7 +23,7 @@ package org.onap.so.apihandlerinfra.logging; import java.io.Serializable; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger.ErrorCode; +import org.onap.so.logger.ErrorCode; diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java index 1be521952a..42190a4a1e 100644 --- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java +++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java @@ -28,10 +28,9 @@ import org.onap.so.apihandler.common.ErrorNumbers; import org.onap.so.apihandlerinfra.exceptions.*; import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; - import java.io.IOException; import java.util.LinkedList; import java.util.List; @@ -89,7 +88,7 @@ public class ApiExceptionTest { @Test public void testDuplicateRequestException() throws ApiException { - ErrorLoggerInfo testLog = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); + ErrorLoggerInfo testLog = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); thrown.expect(DuplicateRequestException.class); thrown.expectMessage(startsWith("Error: Locked instance")); thrown.expect(hasProperty("httpResponseCode", is(HttpStatus.SC_NOT_FOUND))); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java index 84cac6ce5c..de38bc717a 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java @@ -62,9 +62,9 @@ import org.onap.so.db.catalog.beans.ServiceRecipe; import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.db.request.beans.OperationStatus; import org.onap.so.db.request.client.RequestsDbClient; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.onap.so.serviceinstancebeans.ModelInfo; import org.onap.so.serviceinstancebeans.ModelType; import org.onap.so.serviceinstancebeans.RequestDetails; @@ -235,7 +235,7 @@ public class E2EServiceInstances { MsoException.ServiceException, "Mapping of request to JSON object failed. " + e.getMessage(), ErrorNumbers.SVC_BAD_PARAMETER, null, version); logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, - MsoLogger.ErrorCode.SchemaError.getValue(), requestJSON, e); + ErrorCode.SchemaError.getValue(), requestJSON, e); logger.debug(END_OF_THE_TRANSACTION + response.getEntity().toString()); return response; @@ -282,7 +282,7 @@ public class E2EServiceInstances { MsoException.ServiceException, "Failed calling bpmn " + e.getMessage(), ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version); logger.error("", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine",e); + ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine",e); logger.debug(END_OF_THE_TRANSACTION + resp.getEntity().toString()); return resp; } @@ -291,7 +291,7 @@ public class E2EServiceInstances { Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException, "bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version); logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL"); + ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL"); logger.debug(END_OF_THE_TRANSACTION + resp.getEntity().toString()); return resp; } @@ -318,7 +318,7 @@ public class E2EServiceInstances { operationId); } catch (Exception e) { logger.error("{} {} {} {}", MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA, - MsoLogger.ErrorCode.AvailabilityError.getValue(), + ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Request DB - Infra Request Lookup", e); Response response = msoRequest.buildServiceErrorResponse( HttpStatus.SC_NOT_FOUND, MsoException.ServiceException, @@ -335,7 +335,7 @@ public class E2EServiceInstances { "E2E serviceId " + serviceId + " is not found in DB", ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, null, version); logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), + ErrorCode.BusinessProcesssError.getValue(), "Null response from RequestDB when searching by serviceId"); logger.debug(END_OF_THE_TRANSACTION + resp.getEntity()); return resp; @@ -368,7 +368,7 @@ public class E2EServiceInstances { + e.getMessage(), ErrorNumbers.SVC_BAD_PARAMETER, null, version); logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, - MsoLogger.ErrorCode.SchemaError.getValue(), requestJSON, e); + ErrorCode.SchemaError.getValue(), requestJSON, e); logger.debug(END_OF_THE_TRANSACTION + response.getEntity()); return response; } @@ -380,7 +380,7 @@ public class E2EServiceInstances { recipeLookupResult = getServiceInstanceOrchestrationURI(null, action); } catch (Exception e) { logger.error(MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA, - MsoLogger.ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e); + ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e); Response response = msoRequest.buildServiceErrorResponse( HttpStatus.SC_NOT_FOUND, MsoException.ServiceException, @@ -395,7 +395,7 @@ public class E2EServiceInstances { } if (recipeLookupResult == null) { logger.error("{} {} {} {}", MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND.toString(), MSO_PROP_APIHANDLER_INFRA, - MsoLogger.ErrorCode.DataError.getValue(), "No recipe found in DB"); + ErrorCode.DataError.getValue(), "No recipe found in DB"); Response response = msoRequest.buildServiceErrorResponse( HttpStatus.SC_NOT_FOUND, MsoException.ServiceException, "Recipe does not exist in catalog DB", @@ -441,7 +441,7 @@ public class E2EServiceInstances { "Failed calling bpmn " + e.getMessage(), ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version); logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, - MsoLogger.ErrorCode.AvailabilityError.getValue(), "Exception while communicate with BPMN engine"); + ErrorCode.AvailabilityError.getValue(), "Exception while communicate with BPMN engine"); logger.debug("End of the transaction, the final response is: " + resp.getEntity()); return resp; } @@ -452,7 +452,7 @@ public class E2EServiceInstances { "bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version); logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL"); + ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL"); logger.debug(END_OF_THE_TRANSACTION + resp.getEntity()); return resp; } @@ -484,7 +484,7 @@ public class E2EServiceInstances { MsoException.ServiceException, "Mapping of request to JSON object failed. " + e.getMessage(), ErrorNumbers.SVC_BAD_PARAMETER, null, version); logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, - MsoLogger.ErrorCode.SchemaError.getValue(), requestJSON, e); + ErrorCode.SchemaError.getValue(), requestJSON, e); logger.debug(END_OF_THE_TRANSACTION + response.getEntity()); return response; } @@ -502,7 +502,7 @@ public class E2EServiceInstances { logger.debug("Logging failed message to the database"); } logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, - MsoLogger.ErrorCode.SchemaError.getValue(), requestJSON, e); + ErrorCode.SchemaError.getValue(), requestJSON, e); logger.debug(END_OF_THE_TRANSACTION + response.getEntity()); return response; } @@ -512,7 +512,7 @@ public class E2EServiceInstances { recipeLookupResult = getServiceInstanceOrchestrationURI(e2eSir.getService().getServiceUuid(), action); } catch (Exception e) { logger.error("{} {} {} {}", MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA, - MsoLogger.ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e); + ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e); Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND, MsoException.ServiceException, "No communication to catalog DB " + e.getMessage(), ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version); @@ -524,7 +524,7 @@ public class E2EServiceInstances { if (recipeLookupResult == null) { logger.error("{} {} {} {}", MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND.toString(), MSO_PROP_APIHANDLER_INFRA, - MsoLogger.ErrorCode.DataError.getValue(), "No recipe found in DB"); + ErrorCode.DataError.getValue(), "No recipe found in DB"); Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND, MsoException.ServiceException, "Recipe does not exist in catalog DB", ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null, version); @@ -565,7 +565,7 @@ public class E2EServiceInstances { ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version); logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, - MsoLogger.ErrorCode.AvailabilityError.getValue(), "Exception while communicate with BPMN engine"); + ErrorCode.AvailabilityError.getValue(), "Exception while communicate with BPMN engine"); logger.debug(END_OF_THE_TRANSACTION + getBPMNResp.getEntity()); return getBPMNResp; @@ -575,7 +575,7 @@ public class E2EServiceInstances { Response getBPMNResp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException, "bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version); logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL"); + ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL"); logger.debug(END_OF_THE_TRANSACTION + getBPMNResp.getEntity()); return getBPMNResp; } @@ -606,7 +606,7 @@ public class E2EServiceInstances { MsoException.ServiceException, "Mapping of request to JSON object failed. " + e.getMessage(), ErrorNumbers.SVC_BAD_PARAMETER, null, version); logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, - MsoLogger.ErrorCode.SchemaError.getValue(), requestJSON, e); + ErrorCode.SchemaError.getValue(), requestJSON, e); logger.debug(END_OF_THE_TRANSACTION + response.getEntity()); return response; } @@ -624,7 +624,7 @@ public class E2EServiceInstances { logger.debug("Logging failed message to the database"); } logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, - MsoLogger.ErrorCode.SchemaError.getValue(), requestJSON, e); + ErrorCode.SchemaError.getValue(), requestJSON, e); logger.debug(END_OF_THE_TRANSACTION + response.getEntity()); return response; } @@ -634,7 +634,7 @@ public class E2EServiceInstances { recipeLookupResult = getServiceInstanceOrchestrationURI(e2eSir.getService().getServiceUuid(), action); } catch (Exception e) { logger.error("{} {} {} {}", MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA, - MsoLogger.ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e); + ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e); Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND, MsoException.ServiceException, "No communication to catalog DB " + e.getMessage(), ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version); @@ -644,7 +644,7 @@ public class E2EServiceInstances { if (recipeLookupResult == null) { logger.error("{} {} {} {}", MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND.toString(), MSO_PROP_APIHANDLER_INFRA, - MsoLogger.ErrorCode.DataError.getValue(), "No recipe found in DB"); + ErrorCode.DataError.getValue(), "No recipe found in DB"); Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND, MsoException.ServiceException, "Recipe does not exist in catalog DB", ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null, version); @@ -684,7 +684,7 @@ public class E2EServiceInstances { ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version); logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, - MsoLogger.ErrorCode.AvailabilityError.getValue(), "Exception while communicate with BPMN engine"); + ErrorCode.AvailabilityError.getValue(), "Exception while communicate with BPMN engine"); logger.debug(END_OF_THE_TRANSACTION + resp.getEntity()); return resp; } @@ -693,7 +693,7 @@ public class E2EServiceInstances { Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException, "bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version); logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL"); + ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL"); logger.debug(END_OF_THE_TRANSACTION + resp.getEntity()); return resp; } @@ -727,7 +727,7 @@ public class E2EServiceInstances { + e.getMessage(), ErrorNumbers.SVC_BAD_PARAMETER, null, version); logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, - MsoLogger.ErrorCode.SchemaError.getValue(), requestJSON, e); + ErrorCode.SchemaError.getValue(), requestJSON, e); logger.debug(END_OF_THE_TRANSACTION + response.getEntity()); return response; } @@ -738,7 +738,7 @@ public class E2EServiceInstances { recipeLookupResult = getServiceInstanceOrchestrationURI(null, action); } catch (Exception e) { logger.error("{} {} {} {}", MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA, - MsoLogger.ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e); + ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e); Response response = msoRequest.buildServiceErrorResponse( HttpStatus.SC_NOT_FOUND, MsoException.ServiceException, @@ -751,7 +751,7 @@ public class E2EServiceInstances { } if (recipeLookupResult == null) { logger.error("{} {} {} {}", MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND.toString(), MSO_PROP_APIHANDLER_INFRA, - MsoLogger.ErrorCode.DataError.getValue(), "No recipe found in DB"); + ErrorCode.DataError.getValue(), "No recipe found in DB"); Response response = msoRequest.buildServiceErrorResponse( HttpStatus.SC_NOT_FOUND, MsoException.ServiceException, @@ -797,7 +797,7 @@ public class E2EServiceInstances { ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version); logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, - MsoLogger.ErrorCode.AvailabilityError.getValue(), "Exception while communicate with BPMN engine", e); + ErrorCode.AvailabilityError.getValue(), "Exception while communicate with BPMN engine", e); logger.debug(END_OF_THE_TRANSACTION + resp.getEntity()); return resp; } @@ -808,7 +808,7 @@ public class E2EServiceInstances { "bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version); logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL"); + ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL"); logger.debug(END_OF_THE_TRANSACTION + resp.getEntity()); return resp; } @@ -846,7 +846,7 @@ public class E2EServiceInstances { + '\n' + camundaJSONResponseBody, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, variables, version); logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_RESPONSE_ERROR.toString(), requestClient.getUrl(), - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), + ErrorCode.BusinessProcesssError.getValue(), "Response from BPEL engine is failed with HTTP Status=" + bpelStatus); logger.debug(END_OF_THE_TRANSACTION + resp.getEntity()); return resp; @@ -859,7 +859,7 @@ public class E2EServiceInstances { ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, variables, version); logger.error("", MessageEnum.APIH_BPEL_RESPONSE_ERROR.toString(), requestClient.getUrl(), - MsoLogger.ErrorCode.BusinessProcesssError.getValue(), + ErrorCode.BusinessProcesssError.getValue(), "Response from BPEL engine is empty"); logger.debug(END_OF_THE_TRANSACTION + resp.getEntity()); return resp; @@ -1023,7 +1023,7 @@ public class E2EServiceInstances { try { msoRequest.parse(sir, instanceIdMap, action, version, requestJSON, reqVersion, aLaCarte); } catch (Exception e) { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); ValidateException validateException = new ValidateException.Builder("Error parsing request: " + e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e) .errorInfo(errorLoggerInfo).build(); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java index 07c98c19b9..ad20c5c527 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java @@ -45,7 +45,6 @@ import javax.ws.rs.core.UriBuilder; import org.apache.http.HttpStatus; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.http.HttpEntity; @@ -116,7 +115,6 @@ public class GlobalHealthcheckHandler { try{ // Generated RequestId String requestId = requestContext.getProperty("requestId").toString(); - MsoLogger.setLogContext(requestId, null); logger.info("{} {}", MessageEnum.APIH_GENERATED_REQUEST_ID.toString(), requestId); // set APIH status, this is the main entry point diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java index d686e80352..ad589ddc9c 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java @@ -54,9 +54,9 @@ import org.onap.so.apihandlerinfra.tasksbeans.Value; import org.onap.so.apihandlerinfra.tasksbeans.Variables; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.exceptions.ValidationException; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -97,8 +97,7 @@ public class ManualTasks { @Context ContainerRequestContext requestContext) throws ApiException { String requestId = requestContext.getProperty("requestId").toString(); - MsoLogger.setLogContext(requestId, null); - logger.info("{} {}", MessageEnum.APIH_GENERATED_REQUEST_ID.toString(), requestId); + logger.info("{} {}", MessageEnum.APIH_GENERATED_REQUEST_ID.toString(), requestId); long startTime = System.currentTimeMillis (); logger.debug ("requestId is: {}", requestId); TasksRequest taskRequest = null; @@ -122,7 +121,7 @@ public class ManualTasks { } }catch(IOException e){ - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).build(); ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed: " + e.getMessage(), @@ -131,7 +130,7 @@ public class ManualTasks { throw validateException; } catch(ValidationException e){ - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON Object failed. " + e.getMessage(), @@ -161,7 +160,7 @@ public class ManualTasks { camundaJsonReq = mapper.writeValueAsString(variablesForComplete); } catch(JsonProcessingException e){ - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.UnknownError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.UnknownError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); ValidateException validateException = new ValidateException.Builder("Mapping of JSON object to Camunda request failed", @@ -181,7 +180,7 @@ public class ManualTasks { } catch (Exception e) { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MsoLogger.ErrorCode.AvailabilityError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.AvailabilityError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); @@ -192,7 +191,7 @@ public class ManualTasks { } if (response == null) { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MsoLogger.ErrorCode.BusinessProcesssError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.BusinessProcesssError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); BPMNFailureException bpmnFailureException = new BPMNFailureException.Builder(String.valueOf(HttpStatus.SC_BAD_GATEWAY), @@ -218,7 +217,7 @@ public class ManualTasks { } catch (JsonProcessingException e) { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.BusinessProcesssError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.BusinessProcesssError).build(); ValidateException validateException = new ValidateException.Builder("Request Failed due to bad response format" , @@ -230,7 +229,7 @@ public class ManualTasks { logger.debug ("End of the transaction, the final response is: {}", completeResp); return builder.buildResponse(HttpStatus.SC_ACCEPTED, requestId, completeResp, apiVersion); } else { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.BusinessProcesssError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.BusinessProcesssError).build(); BPMNFailureException bpmnFailureException = new BPMNFailureException.Builder(String.valueOf(bpelStatus), diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java index 886e0d5133..de7d26379c 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java @@ -69,9 +69,9 @@ import org.onap.so.apihandlerinfra.vnfbeans.VnfRequest; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.client.RequestsDbClient; import org.onap.so.exceptions.ValidationException; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.LogConstants; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.onap.so.serviceinstancebeans.CloudConfiguration; import org.onap.so.serviceinstancebeans.InstanceDirection; import org.onap.so.serviceinstancebeans.ModelInfo; @@ -153,7 +153,7 @@ public class MsoRequest { mapper.setSerializationInclusion(Include.NON_DEFAULT); requestErrorStr = mapper.writeValueAsString(re); }catch(Exception e){ - logger.error("{} {} {}", MessageEnum.APIH_VALIDATION_ERROR.toString(), MsoLogger.ErrorCode.DataError.getValue(), + logger.error("{} {} {}", MessageEnum.APIH_VALIDATION_ERROR.toString(), ErrorCode.DataError.getValue(), "Exception in buildServiceErrorResponse writing exceptionType to string ", e); } @@ -384,7 +384,7 @@ public class MsoRequest { aq.setRequestStatus (status.toString ()); aq.setLastModifiedBy (Constants.MODIFIED_BY_APIHANDLER); } catch (Exception e) { - logger.error("{} {} {}", MessageEnum.APIH_DB_INSERT_EXC.toString(), MsoLogger.ErrorCode.DataError.getValue(), + logger.error("{} {} {}", MessageEnum.APIH_DB_INSERT_EXC.toString(), ErrorCode.DataError.getValue(), "Exception when creation record request", e); if (!status.equals (Status.FAILED)) { @@ -424,7 +424,7 @@ public class MsoRequest { aq.setLastModifiedBy (Constants.MODIFIED_BY_APIHANDLER); } catch (Exception e) { - logger.error("{} {} {}", MessageEnum.APIH_DB_INSERT_EXC.toString(), MsoLogger.ErrorCode.DataError.getValue(), + logger.error("{} {} {}", MessageEnum.APIH_DB_INSERT_EXC.toString(), ErrorCode.DataError.getValue(), "Exception when creation record request", e); if (!status.equals (Status.FAILED)) { @@ -452,7 +452,7 @@ public class MsoRequest { requestsDbClient.save(request); } catch (Exception e) { logger.error("{} {} {} {}", MessageEnum.APIH_DB_UPDATE_EXC.toString(), e.getMessage(), - MsoLogger.ErrorCode.DataError.getValue(), "Exception when updating record in DB"); + ErrorCode.DataError.getValue(), "Exception when updating record in DB"); logger.debug("Exception: ", e); } } @@ -536,7 +536,7 @@ public class MsoRequest { return null; } catch (Exception e) { - logger.error("{} {} {}", MessageEnum.APIH_DOM2STR_ERROR.toString(), MsoLogger.ErrorCode.DataError.getValue(), + logger.error("{} {} {}", MessageEnum.APIH_DOM2STR_ERROR.toString(), ErrorCode.DataError.getValue(), "Exception in domToStr", e); } return null; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java index d74a4de451..f613d3e193 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java @@ -54,9 +54,9 @@ import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.beans.RequestProcessingData; import org.onap.so.db.request.client.RequestsDbClient; import org.onap.so.exceptions.ValidationException; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.onap.so.serviceinstancebeans.GetOrchestrationListResponse; import org.onap.so.serviceinstancebeans.GetOrchestrationResponse; import org.onap.so.serviceinstancebeans.InstanceReferences; @@ -111,7 +111,7 @@ public class OrchestrationRequests { } catch (Exception e) { logger.error("Exception occurred", e); - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, MsoLogger.ErrorCode.AvailabilityError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.AvailabilityError).build(); @@ -126,7 +126,7 @@ public class OrchestrationRequests { if(infraActiveRequest == null) { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MsoLogger.ErrorCode.BusinessProcesssError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.BusinessProcesssError).build(); ValidateException validateException = new ValidateException.Builder("Orchestration RequestId " + requestId + " is not found in DB", @@ -169,7 +169,7 @@ public class OrchestrationRequests { } }catch(ValidationException ex){ logger.error("Exception occurred", ex); - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.DataError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.DataError).build(); ValidateException validateException = new ValidateException.Builder(ex.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_GENERAL_SERVICE_ERROR).cause(ex).errorInfo(errorLoggerInfo).build(); throw validateException; @@ -217,7 +217,7 @@ public class OrchestrationRequests { sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class); } catch(IOException e){ logger.error("Exception occurred", e); - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).build(); ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed : " + e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build(); @@ -228,7 +228,7 @@ public class OrchestrationRequests { msoRequest.parseOrchestration(sir); } catch (Exception e) { logger.error("Exception occurred", e); - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).build(); ValidateException validateException = new ValidateException.Builder("Error parsing request: " + e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e) .errorInfo(errorLoggerInfo).build(); throw validateException; @@ -236,7 +236,7 @@ public class OrchestrationRequests { infraActiveRequest = requestsDbClient.getInfraActiveRequestbyRequestId(requestId); if(infraActiveRequest == null) { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MsoLogger.ErrorCode.BusinessProcesssError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, ErrorCode.BusinessProcesssError).build(); ValidateException validateException = new ValidateException.Builder("Null response from RequestDB when searching by RequestId", @@ -253,7 +253,7 @@ public class OrchestrationRequests { requestsDbClient.save(infraActiveRequest); }else{ - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MsoLogger.ErrorCode.DataError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, ErrorCode.DataError).build(); ValidateException validateException = new ValidateException.Builder("Orchestration RequestId " + requestId + " has a status of " + status + " and can not be unlocked", @@ -324,7 +324,7 @@ public class OrchestrationRequests { } } catch (IOException e) { logger.error("Exception occurred", e); - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).build(); ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed : ", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build(); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java index ec1c4cb362..8c5904fb21 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java @@ -66,9 +66,9 @@ import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.client.RequestsDbClient; import org.onap.so.exceptions.ValidationException; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.LogConstants; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.onap.so.serviceinstancebeans.CloudConfiguration; import org.onap.so.serviceinstancebeans.ModelInfo; import org.onap.so.serviceinstancebeans.ModelType; @@ -125,6 +125,8 @@ import java.util.List; import java.util.Map; import java.util.Optional; +import static org.onap.so.logger.HttpHeadersConstants.REQUESTOR_ID; + @Component @Path("/onap/so/infra/serviceInstantiation") @Api(value="/onap/so/infra/serviceInstantiation",description="Infrastructure API Requests for Service Instances") @@ -703,8 +705,8 @@ public class ServiceInstances { if(!headers.containsKey(ONAPLogConstants.Headers.PARTNER_NAME)){ throw new ValidationException(ONAPLogConstants.Headers.PARTNER_NAME + " header", true); } - if(!headers.containsKey(MsoLogger.REQUESTOR_ID)){ - throw new ValidationException(MsoLogger.REQUESTOR_ID + " header", true); + if(!headers.containsKey(REQUESTOR_ID)){ + throw new ValidationException(REQUESTOR_ID + " header", true); } } @@ -799,7 +801,7 @@ public class ServiceInstances { } String errorMessage = "VnfType " + vnfType + " and VF Module Model Name " + modelInfo.getModelName() + serviceVersionText + " not found in MSO Catalog DB"; - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); VfModuleNotFoundException vfModuleException = new VfModuleNotFoundException.Builder(errorMessage, HttpStatus.SC_NOT_FOUND, ErrorNumbers.SVC_BAD_PARAMETER).errorInfo(errorLoggerInfo).build(); updateStatus(currentActiveReq, Status.FAILED, vfModuleException.getMessage()); @@ -840,7 +842,7 @@ public class ServiceInstances { try{ infraActiveRequestsClient.save(currentActiveReq); }catch(Exception e){ - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); throw new RequestDbFailureException.Builder(SAVE_TO_DB, e.toString(), HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e) .errorInfo(errorLoggerInfo).build(); } @@ -874,7 +876,7 @@ public class ServiceInstances { .setRequestUri(requestUri) .setInstanceGroupId(instanceGroupId).build(); } catch (IOException e) { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); throw new ValidateException.Builder("Unable to generate RequestClientParamter object" + e.getMessage(), HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_BAD_PARAMETER) .errorInfo(errorLoggerInfo).build(); } @@ -895,7 +897,7 @@ public class ServiceInstances { validateHeaders(requestContext); } catch (ValidationException e) { logger.error("Exception occurred", e); - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_VALIDATION_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); ValidateException validateException = new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e) .errorInfo(errorLoggerInfo).build(); updateStatus(currentActiveReq, Status.FAILED, validateException.getMessage()); @@ -927,7 +929,7 @@ public class ServiceInstances { try{ infraActiveRequestsClient.save(currentActiveReq); }catch(Exception e){ - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); throw new RequestDbFailureException.Builder(SAVE_TO_DB, e.toString(), HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e) .errorInfo(errorLoggerInfo).build(); } @@ -993,7 +995,7 @@ public class ServiceInstances { response = requestClient.post(requestClientParameter); } catch (Exception e) { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MsoLogger.ErrorCode.AvailabilityError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.AvailabilityError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); String url = requestClient != null ? requestClient.getUrl() : ""; ClientConnectionException clientException = new ClientConnectionException.Builder(url, HttpStatus.SC_BAD_GATEWAY, ErrorNumbers.SVC_NO_SERVER_RESOURCES).cause(e).errorInfo(errorLoggerInfo).build(); updateStatus(currentActiveReq, Status.FAILED, clientException.getMessage()); @@ -1003,7 +1005,7 @@ public class ServiceInstances { if (response == null) { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MsoLogger.ErrorCode.BusinessProcesssError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.BusinessProcesssError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); ClientConnectionException clientException = new ClientConnectionException.Builder(requestClient.getUrl(), HttpStatus.SC_BAD_GATEWAY, ErrorNumbers.SVC_NO_SERVER_RESOURCES).errorInfo(errorLoggerInfo).build(); updateStatus(currentActiveReq, Status.FAILED, clientException.getMessage()); @@ -1018,7 +1020,7 @@ public class ServiceInstances { bpelStatus = respHandler.getStatus (); } catch (ApiException e) { logger.error("Exception occurred", e); - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); ValidateException validateException = new ValidateException.Builder("Exception caught mapping Camunda JSON response to object", HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_BAD_PARAMETER).cause(e) .errorInfo(errorLoggerInfo).build(); updateStatus(currentActiveReq, Status.FAILED, validateException.getMessage()); @@ -1043,7 +1045,7 @@ public class ServiceInstances { } } catch (IOException e) { logger.error("Exception occurred", e); - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); ValidateException validateException = new ValidateException.Builder("Exception caught mapping Camunda JSON response to object", HttpStatus.SC_NOT_ACCEPTABLE, ErrorNumbers.SVC_BAD_PARAMETER).cause(e) .errorInfo(errorLoggerInfo).build(); updateStatus(currentActiveReq, Status.FAILED, validateException.getMessage()); @@ -1058,7 +1060,7 @@ public class ServiceInstances { String camundaJSONResponseBody = respHandler.getResponseBody (); if (camundaJSONResponseBody != null && !camundaJSONResponseBody.isEmpty ()) { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.BusinessProcesssError).errorSource(requestClient.getUrl()).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.BusinessProcesssError).errorSource(requestClient.getUrl()).build(); BPMNFailureException bpmnException = new BPMNFailureException.Builder(String.valueOf(bpelStatus) + camundaJSONResponseBody, bpelStatus, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR) .errorInfo(errorLoggerInfo).build(); @@ -1067,7 +1069,7 @@ public class ServiceInstances { throw bpmnException; } else { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.BusinessProcesssError).errorSource(requestClient.getUrl()).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.BusinessProcesssError).errorSource(requestClient.getUrl()).build(); BPMNFailureException servException = new BPMNFailureException.Builder(String.valueOf(bpelStatus), bpelStatus, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR) @@ -1153,7 +1155,7 @@ public class ServiceInstances { } //List<String> variables = new ArrayList<String>(); //variables.add(dup.getRequestStatus()); - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DUPLICATE_FOUND, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DUPLICATE_FOUND, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); DuplicateRequestException dupException = new DuplicateRequestException.Builder(requestScope,instance,dup.getRequestStatus(),dup.getRequestId(), HttpStatus.SC_CONFLICT, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR) @@ -1172,7 +1174,7 @@ public class ServiceInstances { dup = infraActiveRequestsClient.checkInstanceNameDuplicate (instanceIdMap, instanceName, requestScope); } } catch (Exception e) { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DUPLICATE_CHECK_EXC, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DUPLICATE_CHECK_EXC, ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); RequestDbFailureException requestDbFailureException = new RequestDbFailureException.Builder("check for duplicate instance", e.toString(), HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e) .errorInfo(errorLoggerInfo).build(); updateStatus(currentActiveReq, Status.FAILED, requestDbFailureException.getMessage()); @@ -1190,7 +1192,7 @@ public class ServiceInstances { try{ response = restTemplate.exchange(targetUrl, HttpMethod.GET, requestEntity, new ParameterizedTypeReference<List<HistoricProcessInstanceEntity>>(){}); }catch(HttpStatusCodeException e){ - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DUPLICATE_CHECK_EXC, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DUPLICATE_CHECK_EXC, ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); ContactCamundaException contactCamundaException= new ContactCamundaException.Builder(requestId, e.toString(), HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e) .errorInfo(errorLoggerInfo).build(); updateStatus(currentActiveReq, Status.FAILED, contactCamundaException.getMessage()); @@ -1232,7 +1234,7 @@ public class ServiceInstances { } catch (IOException e) { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); ValidateException validateException = new ValidateException.Builder("Error mapping request: " + e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e) .errorInfo(errorLoggerInfo).build(); @@ -1251,7 +1253,7 @@ public class ServiceInstances { msoRequest.parse(sir, instanceIdMap, action, version, requestJSON, reqVersion, aLaCarte); } catch (Exception e) { logger.error("failed to parse request", e); - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); ValidateException validateException = new ValidateException.Builder("Error parsing request: " + e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e) .errorInfo(errorLoggerInfo).build(); @@ -1276,7 +1278,7 @@ public class ServiceInstances { try { recipeLookupResult = getServiceURI(sir, action,alaCarteFlag); } catch (IOException e) { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); ValidateException validateException = new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e) @@ -1291,7 +1293,7 @@ public class ServiceInstances { try { recipeLookupResult = getVnfOrVfModuleUri( sir, action); } catch (ValidationException e) { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); ValidateException validateException = new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e) @@ -1306,7 +1308,7 @@ public class ServiceInstances { recipeLookupResult = getNetworkUri( sir, action); } catch (ValidationException e) { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); ValidateException validateException = new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e) @@ -1320,7 +1322,7 @@ public class ServiceInstances { } if (recipeLookupResult == null) { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); RecipeNotFoundException recipeNotFoundExceptionException = new RecipeNotFoundException.Builder("Recipe could not be retrieved from catalog DB.", HttpStatus.SC_NOT_FOUND, ErrorNumbers.SVC_GENERAL_SERVICE_ERROR) @@ -1852,7 +1854,7 @@ public class ServiceInstances { if (StringUtils.isBlank(orchestrationUri) || StringUtils.isBlank(timeOut)) { String error = StringUtils.isBlank(orchestrationUri) ? "ALaCarte Orchestration URI not found in properties" : "ALaCarte Recipe Timeout not found in properties"; - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); ValidateException validateException = new ValidateException.Builder(error, HttpStatus.SC_NOT_FOUND, ErrorNumbers.SVC_GENERAL_SERVICE_ERROR) @@ -1881,7 +1883,7 @@ public class ServiceInstances { try{ infraActiveRequestsClient.save(currentActiveReq); }catch(Exception e){ - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); throw new RequestDbFailureException.Builder(SAVE_TO_DB, e.toString(), HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e) .errorInfo(errorLoggerInfo).build(); } @@ -1906,7 +1908,7 @@ public class ServiceInstances { .setALaCarte(aLaCarte) .setRequestUri(requestUri).build(); } catch (IOException e) { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); throw new ValidateException.Builder("Unable to generate RequestClientParamter object" + e.getMessage(), HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_BAD_PARAMETER) .errorInfo(errorLoggerInfo).build(); } @@ -1922,7 +1924,7 @@ public class ServiceInstances { if (UUIDChecker.isValidUUID(requestId)) { return requestId; } else { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); ValidateException validateException = new ValidateException.Builder("Request Id " + requestId + " is not a valid UUID", HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_BAD_PARAMETER) .errorInfo(errorLoggerInfo).build(); @@ -1939,7 +1941,7 @@ public class ServiceInstances { try{ infraActiveRequestsClient.save(aq); }catch(Exception e){ - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); throw new RequestDbFailureException.Builder(SAVE_TO_DB, e.toString(), HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e) .errorInfo(errorLoggerInfo).build(); } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java index 0a72cf68ad..e35572598c 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java @@ -54,9 +54,9 @@ import org.onap.so.apihandlerinfra.tasksbeans.TaskList; import org.onap.so.apihandlerinfra.tasksbeans.TaskVariableValue; import org.onap.so.apihandlerinfra.tasksbeans.TaskVariables; import org.onap.so.apihandlerinfra.tasksbeans.TasksGetResponse; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -163,7 +163,7 @@ public class TasksHandler { response = requestClient.post(camundaJsonReq); } catch(JsonProcessingException e){ - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).build(); ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed : " + e.getMessage(), @@ -171,7 +171,7 @@ public class TasksHandler { throw validateException; } catch(IOException e) { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MsoLogger.ErrorCode.AvailabilityError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.AvailabilityError).build(); BPMNFailureException bpmnFailureException = new BPMNFailureException.Builder(String.valueOf(HttpStatus.SC_BAD_GATEWAY),HttpStatus.SC_BAD_GATEWAY,ErrorNumbers.SVC_NO_SERVER_RESOURCES).build(); throw bpmnFailureException; } @@ -203,7 +203,7 @@ public class TasksHandler { } else { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.BusinessProcesssError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.BusinessProcesssError).build(); BPMNFailureException bpmnFailureException = new BPMNFailureException.Builder(String.valueOf(bpelStatus), bpelStatus, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR) @@ -218,7 +218,7 @@ public class TasksHandler { jsonResponse = mapper.writeValueAsString(trr); } catch (JsonProcessingException e) { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).build(); ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed : " + e.getMessage(), @@ -241,7 +241,7 @@ public class TasksHandler { try { getResponse = requestClient.get(); }catch(IOException e){ - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MsoLogger.ErrorCode.AvailabilityError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.AvailabilityError).build(); BPMNFailureException validateException = new BPMNFailureException.Builder(String.valueOf(HttpStatus.SC_BAD_GATEWAY), HttpStatus.SC_BAD_GATEWAY, ErrorNumbers.SVC_NO_SERVER_RESOURCES).build(); throw validateException; } @@ -253,7 +253,7 @@ public class TasksHandler { taskList = buildTaskList(taskId, respBody); } else { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MsoLogger.ErrorCode.AvailabilityError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.AvailabilityError).build(); @@ -265,7 +265,7 @@ public class TasksHandler { } else { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MsoLogger.ErrorCode.AvailabilityError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.AvailabilityError).build(); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java index 00f1d6889d..be8f603a28 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java @@ -55,8 +55,8 @@ import org.onap.so.apihandlerinfra.tenantisolationbeans.TenantSyncResponse; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.client.RequestsDbClient; import org.onap.so.exceptions.ValidationException; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -124,7 +124,6 @@ public class CloudOrchestration { private Response cloudOrchestration(String requestJSON, Action action, HashMap<String, String> instanceIdMap, String version, String requestId) throws ApiException{ - MsoLogger.setLogContext(requestId, null); logger.info("{} {}", MessageEnum.APIH_GENERATED_REQUEST_ID.toString(), requestId); long startTime = System.currentTimeMillis (); CloudOrchestrationRequest cor = null; @@ -135,7 +134,8 @@ public class CloudOrchestration { try { tenantIsolationRequest.parse(cor, instanceIdMap, action); }catch(ValidationException e){ - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,MsoLogger.ErrorCode.SchemaError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, + ErrorCode.SchemaError).build(); throw new ValidateException.Builder("Mapping of request to JSON object failed. " + e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER) @@ -160,7 +160,7 @@ public class CloudOrchestration { instance = instanceIdMap.get(resourceType + "InstanceId"); } - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DUPLICATE_FOUND, MsoLogger.ErrorCode.SchemaError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DUPLICATE_FOUND, ErrorCode.SchemaError).build(); throw new DuplicateRequestException.Builder(resourceType,instance,dup.getRequestStatus(),dup.getRequestId(), HttpStatus.SC_CONFLICT, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR) @@ -189,7 +189,8 @@ public class CloudOrchestration { try { encodedValue = new String(instanceId.getBytes("UTF-8")); } catch(UnsupportedEncodingException ex) { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,MsoLogger.ErrorCode.DataError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, + ErrorCode.DataError).build(); throw new ValidateException.Builder("Could not encode instanceID" + ex.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER) @@ -210,7 +211,7 @@ public class CloudOrchestration { try { return requestsDbClient.checkInstanceNameDuplicate (instanceIdMap, instanceName, requestScope); } catch (Exception e) { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DUPLICATE_CHECK_EXC, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DUPLICATE_CHECK_EXC, ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); throw new ValidateException.Builder("Duplicate Check Request", HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e) @@ -226,7 +227,8 @@ public class CloudOrchestration { return mapper.readValue(requestJSON, CloudOrchestrationRequest.class); } catch(IOException e){ - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,MsoLogger.ErrorCode.SchemaError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, + ErrorCode.SchemaError).build(); ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed. " + e.getMessage(), HttpStatus.SC_BAD_REQUEST,ErrorNumbers.SVC_BAD_PARAMETER) diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java index 9305b80c13..fe74b108ba 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java @@ -45,7 +45,6 @@ import org.apache.http.HttpStatus; import org.onap.so.apihandler.common.ErrorNumbers; import org.onap.so.apihandler.common.ResponseBuilder; import org.onap.so.apihandlerinfra.Constants; -import org.onap.so.apihandlerinfra.Messages; import org.onap.so.apihandlerinfra.exceptions.ApiException; import org.onap.so.apihandlerinfra.exceptions.ValidateException; @@ -59,9 +58,9 @@ import org.onap.so.apihandlerinfra.tenantisolationbeans.RequestStatus; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.client.RequestsDbClient; import org.onap.so.exceptions.ValidationException; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -103,7 +102,8 @@ public class CloudResourcesOrchestration { ObjectMapper mapper = new ObjectMapper(); cor = mapper.readValue(requestJSON, CloudOrchestrationRequest.class); } catch(IOException e){ - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,MsoLogger.ErrorCode.SchemaError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, + ErrorCode.SchemaError).build(); ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed. " + e.getMessage(), HttpStatus.SC_BAD_REQUEST,ErrorNumbers.SVC_BAD_PARAMETER) .cause(e).errorInfo(errorLoggerInfo).build(); @@ -113,7 +113,8 @@ public class CloudResourcesOrchestration { try{ msoRequest.parseOrchestration(cor); } catch (ValidationException e) { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,MsoLogger.ErrorCode.SchemaError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, + ErrorCode.SchemaError).build(); ValidateException validateException = new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST,ErrorNumbers.SVC_BAD_PARAMETER) .cause(e).errorInfo(errorLoggerInfo).build(); throw validateException; @@ -126,7 +127,7 @@ public class CloudResourcesOrchestration { } if(infraActiveRequest == null) { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND,MsoLogger.ErrorCode.BusinessProcesssError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, ErrorCode.BusinessProcesssError).build(); ValidateException validateException = new ValidateException.Builder("Orchestration RequestId " + requestId + " is not found in DB", HttpStatus.SC_BAD_REQUEST,ErrorNumbers.SVC_DETAILED_SERVICE_ERROR) .errorInfo(errorLoggerInfo).build(); @@ -140,7 +141,8 @@ public class CloudResourcesOrchestration { infraActiveRequest.setRequestId(requestId); requestDbClient.save(infraActiveRequest); }else{ - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND,MsoLogger.ErrorCode.DataError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, + ErrorCode.DataError).build(); ValidateException validateException = new ValidateException.Builder("Orchestration RequestId " + requestId + " has a status of " + status + " and can not be unlocked", HttpStatus.SC_BAD_REQUEST,ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build(); @@ -173,14 +175,14 @@ public class CloudResourcesOrchestration { try { requestDB = requestDbClient.getInfraActiveRequestbyRequestId(requestId); } catch (Exception e) { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, MsoLogger.ErrorCode.AvailabilityError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.AvailabilityError).build(); ValidateException validateException = new ValidateException.Builder(e.getMessage(), HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e) .errorInfo(errorLoggerInfo).build(); throw validateException; } if(requestDB == null) { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MsoLogger.ErrorCode.BusinessProcesssError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.BusinessProcesssError).build(); ValidateException validateException = new ValidateException.Builder("Orchestration RequestId " + requestId + " is not found in DB", HttpStatus.SC_NO_CONTENT, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR) .errorInfo(errorLoggerInfo).build(); @@ -202,7 +204,7 @@ public class CloudResourcesOrchestration { try{ orchestrationMap = tenantIsolationRequest.getOrchestrationFilters(queryParams); }catch(ValidationException ex){ - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.BusinessProcesssError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError).build(); ValidateException validateException = new ValidateException.Builder(ex.getMessage(), HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_GENERAL_SERVICE_ERROR).cause(ex) .errorInfo(errorLoggerInfo).build(); @@ -251,7 +253,7 @@ public class CloudResourcesOrchestration { ObjectMapper mapper = new ObjectMapper(); requestDetails = mapper.readValue(requestBody, RequestDetails.class); } catch (IOException e) { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).build(); ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed. " + e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER) .cause(e).errorInfo(errorLoggerInfo).build(); throw validateException; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java index 3ec3ade959..4be1ec9187 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java @@ -46,8 +46,8 @@ import org.onap.so.apihandlerinfra.tenantisolationbeans.Action; import org.onap.so.apihandlerinfra.tenantisolationbeans.Distribution; import org.onap.so.apihandlerinfra.tenantisolationbeans.Status; import org.onap.so.exceptions.ValidationException; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.onap.so.serviceinstancebeans.RequestError; import org.onap.so.serviceinstancebeans.ServiceException; import org.slf4j.Logger; @@ -85,7 +85,8 @@ public class ModelDistributionRequest { ObjectMapper mapper = new ObjectMapper(); distributionRequest = mapper.readValue(requestJSON, Distribution.class); } catch(IOException e) { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,MsoLogger.ErrorCode.SchemaError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, + ErrorCode.SchemaError).build(); ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed. " + e.getMessage(), HttpStatus.SC_BAD_REQUEST,ErrorNumbers.SVC_BAD_PARAMETER) @@ -98,7 +99,8 @@ public class ModelDistributionRequest { parse(distributionRequest); } catch(ValidationException e) { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,MsoLogger.ErrorCode.SchemaError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, + ErrorCode.SchemaError).build(); ValidateException validateException = new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST,ErrorNumbers.SVC_BAD_PARAMETER) @@ -148,7 +150,7 @@ public class ModelDistributionRequest { requestErrorStr = mapper.writeValueAsString(re); }catch(JsonProcessingException e){ - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_VALIDATION_ERROR,MsoLogger.ErrorCode.DataError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_VALIDATION_ERROR, ErrorCode.DataError).build(); ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed. " + e.getMessage(), HttpStatus.SC_BAD_REQUEST,ErrorNumbers.SVC_BAD_PARAMETER) diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java index 47cbb0c895..82a5d1ebbf 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java @@ -47,8 +47,8 @@ import org.onap.so.apihandlerinfra.vnfbeans.RequestStatusType; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.client.RequestsDbClient; import org.onap.so.exceptions.ValidationException; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.onap.so.utils.UUIDChecker; import org.slf4j.Logger; @@ -84,11 +84,9 @@ public class TenantIsolationRequest { TenantIsolationRequest (String requestId) { this.requestId = requestId; - MsoLogger.setLogContext (requestId, null); } TenantIsolationRequest () { - MsoLogger.setLogContext (requestId, null); } void parse(CloudOrchestrationRequest request, HashMap<String,String> instanceIdMap, Action action) throws ValidationException { @@ -356,7 +354,7 @@ public class TenantIsolationRequest { requestsDbClient.save(request); } catch (Exception e) { logger.error("{} {} {} {}", MessageEnum.APIH_DB_UPDATE_EXC.toString(), e.getMessage(), - MsoLogger.ErrorCode.DataError.getValue(), "Exception when updating record in DB"); + ErrorCode.DataError.getValue(), "Exception when updating record in DB"); logger.debug("Exception: ", e); } } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java index 00ce137ee3..98104e9073 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java @@ -34,8 +34,8 @@ import org.onap.so.apihandlerinfra.tenantisolation.process.CreateVnfOperationalE import org.onap.so.apihandlerinfra.tenantisolation.process.DeactivateVnfOperationalEnvironment; import org.onap.so.apihandlerinfra.tenantisolationbeans.Action; import org.onap.so.apihandlerinfra.tenantisolationbeans.OperationalEnvironment; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.onap.so.requestsdb.RequestsDBHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -76,7 +76,7 @@ public class TenantIsolationRunnable { } else if(OperationalEnvironment.VNF.name().equalsIgnoreCase(operationalEnvType)) { createVnfOpEnv.execute(requestId, cor); } else { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.DataError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.DataError).build(); ValidateException validateException = new ValidateException.Builder("Invalid OperationalEnvironment Type specified for Create Action", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).errorInfo(errorLoggerInfo) .build(); @@ -90,7 +90,7 @@ public class TenantIsolationRunnable { } else if(Action.distributionStatus.equals(action)) { activateVnfStatusOpEnv.execute(requestId, cor); } else { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.DataError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.DataError).build(); ValidateException validateException = new ValidateException.Builder("Invalid Action specified: " + action, HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).errorInfo(errorLoggerInfo).build(); throw validateException; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/DmaapOperationalEnvClient.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/DmaapOperationalEnvClient.java index f718431534..55b1ea6198 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/DmaapOperationalEnvClient.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/DmaapOperationalEnvClient.java @@ -29,8 +29,8 @@ import org.onap.so.apihandler.common.ErrorNumbers; import org.onap.so.apihandlerinfra.exceptions.ApiException; import org.onap.so.apihandlerinfra.exceptions.ValidateException; import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -55,7 +55,7 @@ public class DmaapOperationalEnvClient { try { return this.getJson(operationalEnv); }catch(JsonProcessingException ex){ - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).build(); ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed : " + ex.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(ex).errorInfo(errorLoggerInfo).build(); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java index 9303e12071..bf5623a9da 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java @@ -37,8 +37,8 @@ import org.onap.so.apihandlerinfra.exceptions.ValidateException; import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo; import org.onap.so.client.HttpClient; import org.onap.so.client.HttpClientFactory; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.onap.so.utils.CryptoUtils; import org.onap.so.utils.TargetEntity; import org.slf4j.Logger; @@ -86,7 +86,7 @@ public class SDCClientHelper { String basicAuthCred = getBasicAuth(); if ( basicAuthCred == null || "".equals(basicAuthCred) ) { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.BusinessProcesssError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError).build(); ValidateException validateException = new ValidateException.Builder(" SDC credentials 'mso.sdc.client.auth' not setup in properties file!", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build(); @@ -131,7 +131,7 @@ public class SDCClientHelper { try { return client.post(jsonPayload); }catch(Exception ex){ - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.BusinessProcesssError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError).build(); ValidateException validateException = new ValidateException.Builder("Bad request could not post payload", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(ex).errorInfo(errorLoggerInfo).build(); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java index 554aafc73b..dde45a81c9 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java @@ -28,9 +28,6 @@ import javax.ws.rs.core.Response; import org.apache.http.HttpStatus; import org.json.JSONObject; import org.onap.aai.domain.yang.OperationalEnvironment; -import org.onap.aai.domain.yang.RelationshipList; -import org.onap.aai.domain.yang.Relationship; -import org.onap.aai.domain.yang.RelationshipData; import org.onap.so.apihandler.common.ErrorNumbers; import org.onap.so.db.request.client.RequestsDbClient; import org.onap.so.apihandlerinfra.exceptions.ApiException; @@ -47,8 +44,8 @@ import org.onap.so.client.aai.entities.Relationships; import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.db.request.beans.OperationalEnvDistributionStatus; import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.onap.so.requestsdb.RequestsDBHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -109,12 +106,12 @@ public class ActivateVnfOperationalEnvironment { String workloadContext = operationalEnv.getWorkloadContext(); logger.debug(" aai workloadContext: {}", workloadContext); if (!vidWorkloadContext.equals(workloadContext)) { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.BusinessProcesssError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError).build(); throw new ValidateException.Builder(" The vid workloadContext did not match from aai record. " + " vid workloadContext:" + vidWorkloadContext + " aai workloadContext:" + workloadContext, HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build(); } if (ecompOperationalEnvironmentId==null) { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.BusinessProcesssError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError).build(); throw new ValidateException.Builder(" The ECOMP OE was not in aai record; the value of relationship.relationship-data key: " + OPER_ENVIRONMENT_ID_KEY, HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build(); } @@ -179,7 +176,7 @@ public class ActivateVnfOperationalEnvironment { client.save(distStatus); } else { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.BusinessProcesssError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError).build(); String dbErrorMessage = " Failure calling SDC: statusCode: " + statusCode + "; messageId: " + jsonResponse.get("messageId") + "; message: " + jsonResponse.get("message"); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java index c12828aeb3..e09dcd8d2d 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java @@ -45,8 +45,8 @@ import org.onap.so.apihandlerinfra.tenantisolationbeans.DistributionStatus; import org.onap.so.client.aai.entities.AAIResultWrapper; import org.onap.so.db.request.beans.OperationalEnvDistributionStatus; import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.onap.so.requestsdb.RequestsDBHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -254,7 +254,7 @@ public class ActivateVnfStatusOperationalEnvironment { String dbErrorMessage = "Failure calling SDC: statusCode: " + statusCode + "; messageId: " + jsonResponse.get("messageId") + "; message: " + jsonResponse.get("message"); - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.BusinessProcesssError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError).build(); ValidateException validateException = new ValidateException.Builder(dbErrorMessage, HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build(); requestDb.updateInfraFailureCompletion(dbErrorMessage, this.origRequestId, operEnvironmentId); @@ -303,7 +303,7 @@ public class ActivateVnfStatusOperationalEnvironment { } else { if (status.equals("Failure") && queryServiceModelResponseList.size() == count) { this.errorMessage = "Overall Activation process is a Failure. " + status; - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.BusinessProcesssError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError).build(); ValidateException validateException = new ValidateException.Builder(this.errorMessage, HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build(); requestDb.updateInfraFailureCompletion(this.errorMessage, origRequestId, operationalEnvironmentId); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java index 6ba78aa175..e9c9be9dd4 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java @@ -31,8 +31,8 @@ import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestrationRequest; import org.onap.so.apihandlerinfra.tenantisolation.dmaap.DmaapOperationalEnvClient; import org.onap.so.apihandlerinfra.tenantisolation.helpers.AAIClientHelper; import org.onap.so.apihandlerinfra.tenantisolation.helpers.AAIClientObjectBuilder; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.onap.so.requestsdb.RequestsDBHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -75,7 +75,7 @@ public class CreateEcompOperationalEnvironment { request.getRequestDetails().getRequestParameters().getWorkloadContext(), "Create"); }catch(Exception e){ - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.DataError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.DataError).build(); ValidateException validateException = new ValidateException.Builder("Could not publish DMaap", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e) .errorInfo(errorLoggerInfo).build(); requestDb.updateInfraFailureCompletion(e.getMessage(), requestId, request.getOperationalEnvironmentId()); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java index 2eaba25234..cc3e3aeb16 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java @@ -47,8 +47,8 @@ import org.onap.so.client.grm.beans.ServiceEndPoint; import org.onap.so.client.grm.beans.ServiceEndPointList; import org.onap.so.client.grm.beans.ServiceEndPointRequest; import org.onap.so.client.grm.beans.Version; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.onap.so.requestsdb.RequestsDBHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -108,7 +108,7 @@ public class CreateVnfOperationalEnvironment { requestDb.updateInfraSuccessCompletion("SUCCESSFULLY created VNF operational environment", requestId, request.getOperationalEnvironmentId()); }catch(Exception e) { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.DataError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.DataError).build(); ValidateException validateException = new ValidateException.Builder(e.getMessage(), diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java index 2181215ca7..7f8b330727 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java @@ -34,8 +34,8 @@ import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo; import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestrationRequest; import org.onap.so.apihandlerinfra.tenantisolation.helpers.AAIClientHelper; import org.onap.so.client.aai.entities.AAIResultWrapper; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.onap.so.requestsdb.RequestsDBHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -62,7 +62,7 @@ public class DeactivateVnfOperationalEnvironment { if(StringUtils.isBlank(operationalEnvironmentStatus)) { String error = "OperationalEnvironmentStatus is null on OperationalEnvironmentId: " + operationalEnvironmentId; - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.DataError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.DataError).build(); throw new ValidateException.Builder(error, HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR) .errorInfo(errorLoggerInfo) .build(); @@ -75,7 +75,7 @@ public class DeactivateVnfOperationalEnvironment { } else if(!operationalEnvironmentStatus.equalsIgnoreCase("INACTIVE")) { String error = "Invalid OperationalEnvironmentStatus on OperationalEnvironmentId: " + operationalEnvironmentId; - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.DataError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.DataError).build(); ValidateException validateException = new ValidateException.Builder(error, HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build(); requestDb.updateInfraFailureCompletion(error, requestId, operationalEnvironmentId); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java index 7bb1bdf71a..6efcdc47e5 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java @@ -28,10 +28,9 @@ import org.onap.so.apihandler.common.ErrorNumbers; import org.onap.so.apihandlerinfra.exceptions.*; import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; - import java.io.IOException; import java.util.LinkedList; import java.util.List; @@ -89,7 +88,7 @@ public class ApiExceptionTest extends BaseTest { @Test public void testDuplicateRequestException() throws ApiException { - ErrorLoggerInfo testLog = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); + ErrorLoggerInfo testLog = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); thrown.expect(DuplicateRequestException.class); thrown.expectMessage(startsWith("Error: Locked instance")); thrown.expect(hasProperty("httpResponseCode", is(HttpStatus.SC_NOT_FOUND))); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java index bb78c822f7..1943b42404 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java @@ -29,6 +29,15 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static com.shazam.shazamcrest.MatcherAssert.assertThat; +import static org.onap.so.logger.MdcConstants.ECOMP_REQUEST_ID; +import static org.onap.so.logger.MdcConstants.ENDTIME; +import static org.onap.so.logger.MdcConstants.INVOCATION_ID; +import static org.onap.so.logger.MdcConstants.PARTNERNAME; +import static org.onap.so.logger.MdcConstants.RESPONSECODE; +import static org.onap.so.logger.MdcConstants.RESPONSEDESC; +import static org.onap.so.logger.MdcConstants.SERVICE_NAME; +import static org.onap.so.logger.MdcConstants.STATUSCODE; +import static org.onap.so.logger.MdcConstants.CLIENT_ID; import java.io.IOException; import java.util.Map; @@ -44,7 +53,6 @@ import org.onap.so.apihandlerinfra.tasksbeans.RequestInfo; import org.onap.so.apihandlerinfra.tasksbeans.TaskRequestReference; import org.onap.so.apihandlerinfra.tasksbeans.TasksRequest; import org.onap.so.apihandlerinfra.tasksbeans.ValidResponses; -import org.onap.so.logger.MsoLogger; import org.onap.so.serviceinstancebeans.RequestError; import org.onap.so.serviceinstancebeans.ServiceException; import org.springframework.http.HttpEntity; @@ -64,8 +72,6 @@ public class ManualTasksTest extends BaseTest{ private final String basePath = "/tasks/v1/"; - - @Test public void testCreateOpEnvObjectMapperError() throws IOException { TestAppender.events.clear(); @@ -88,8 +94,8 @@ public class ManualTasksTest extends BaseTest{ HttpHeaders headers = new HttpHeaders(); headers.set("Accept", MediaType.APPLICATION_JSON); headers.set("Content-Type", MediaType.APPLICATION_JSON); - headers.set(MsoLogger.ECOMP_REQUEST_ID, "987654321"); - headers.set(MsoLogger.CLIENT_ID, "VID"); + headers.set(ECOMP_REQUEST_ID, "987654321"); + headers.set(CLIENT_ID, "VID"); HttpEntity<TasksRequest> entity = new HttpEntity<TasksRequest>(taskReq, headers); UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(basePath) + taskId + "/complete"); @@ -116,22 +122,22 @@ public class ManualTasksTest extends BaseTest{ Map<String,String> mdc = logEvent.getMDCPropertyMap(); assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP)); assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); - assertNotNull(mdc.get(MsoLogger.INVOCATION_ID)); - assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME)); - assertEquals("tasks/v1/55/complete",mdc.get(MsoLogger.SERVICE_NAME)); - assertEquals("INPROGRESS",mdc.get(MsoLogger.STATUSCODE)); + assertNotNull(mdc.get(INVOCATION_ID)); + assertEquals("UNKNOWN",mdc.get(PARTNERNAME)); + assertEquals("tasks/v1/55/complete",mdc.get(SERVICE_NAME)); + assertEquals("INPROGRESS",mdc.get(STATUSCODE)); }else if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging") && logEvent.getMarker() != null && logEvent.getMarker().getName().equals("EXIT")){ Map<String,String> mdc = logEvent.getMDCPropertyMap(); assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP)); - assertNotNull(mdc.get(MsoLogger.ENDTIME)); + assertNotNull(mdc.get(ENDTIME)); assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); - assertNotNull(mdc.get(MsoLogger.INVOCATION_ID)); - assertEquals("202",mdc.get(MsoLogger.RESPONSECODE)); - assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME)); - assertEquals("tasks/v1/55/complete",mdc.get(MsoLogger.SERVICE_NAME)); - assertEquals("COMPLETE",mdc.get(MsoLogger.STATUSCODE)); - assertNotNull(mdc.get(MsoLogger.RESPONSEDESC)); + assertNotNull(mdc.get(INVOCATION_ID)); + assertEquals("202",mdc.get(RESPONSECODE)); + assertEquals("UNKNOWN",mdc.get(PARTNERNAME)); + assertEquals("tasks/v1/55/complete",mdc.get(SERVICE_NAME)); + assertEquals("COMPLETE",mdc.get(STATUSCODE)); + assertNotNull(mdc.get(RESPONSEDESC)); assertEquals("application/json", response.getHeaders().get(HttpHeaders.CONTENT_TYPE).get(0)); assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0)); assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0)); @@ -151,8 +157,8 @@ public class ManualTasksTest extends BaseTest{ HttpHeaders headers = new HttpHeaders(); headers.set("Accept", MediaType.APPLICATION_JSON); headers.set("Content-Type", MediaType.APPLICATION_JSON); - headers.set(MsoLogger.ECOMP_REQUEST_ID, "987654321"); - headers.set(MsoLogger.CLIENT_ID, "VID"); + headers.set(ECOMP_REQUEST_ID, "987654321"); + headers.set(CLIENT_ID, "VID"); HttpEntity<String> entity = new HttpEntity<String>(invalidRequest, headers); UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(basePath) + "55" + "/complete"); @@ -187,8 +193,8 @@ public class ManualTasksTest extends BaseTest{ HttpHeaders headers = new HttpHeaders(); headers.set("Accept", MediaType.APPLICATION_JSON); headers.set("Content-Type", MediaType.APPLICATION_JSON); - headers.set(MsoLogger.ECOMP_REQUEST_ID, "987654321"); - headers.set(MsoLogger.CLIENT_ID, "VID"); + headers.set(ECOMP_REQUEST_ID, "987654321"); + headers.set(CLIENT_ID, "VID"); HttpEntity<TasksRequest> entity = new HttpEntity<TasksRequest>(taskReq, headers); UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(basePath) + taskId + "/complete"); @@ -227,8 +233,8 @@ public class ManualTasksTest extends BaseTest{ HttpHeaders headers = new HttpHeaders(); headers.set("Accept", MediaType.APPLICATION_JSON); headers.set("Content-Type", MediaType.APPLICATION_JSON); - headers.set(MsoLogger.ECOMP_REQUEST_ID, "987654321"); - headers.set(MsoLogger.CLIENT_ID, "VID"); + headers.set(ECOMP_REQUEST_ID, "987654321"); + headers.set(CLIENT_ID, "VID"); HttpEntity<TasksRequest> entity = new HttpEntity<TasksRequest>(taskReq, headers); UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(basePath) + taskId + "/complete"); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java index d6c794ef2e..17fa011c93 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java @@ -34,6 +34,18 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; +import static org.onap.so.logger.HttpHeadersConstants.ONAP_REQUEST_ID; +import static org.onap.so.logger.HttpHeadersConstants.REQUESTOR_ID; +import static org.onap.so.logger.MdcConstants.CLIENT_ID; +import static org.onap.so.logger.MdcConstants.ENDTIME; +import static org.onap.so.logger.MdcConstants.INVOCATION_ID; +import static org.onap.so.logger.MdcConstants.PARTNERNAME; +import static org.onap.so.logger.MdcConstants.RESPONSECODE; +import static org.onap.so.logger.MdcConstants.RESPONSEDESC; +import static org.onap.so.logger.MdcConstants.SERVICE_NAME; +import static org.onap.so.logger.MdcConstants.STATUSCODE; +import static org.onap.so.logger.HttpHeadersConstants.TRANSACTION_ID; + import java.io.File; import java.io.IOException; @@ -59,8 +71,7 @@ import org.onap.so.apihandlerinfra.exceptions.RequestDbFailureException; import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.ServiceRecipe; import org.onap.so.db.request.beans.InfraActiveRequests; -import org.onap.so.logger.LogConstants; -import org.onap.so.logger.MsoLogger; +import org.onap.so.logger.HttpHeadersConstants; import org.onap.so.serviceinstancebeans.CloudConfiguration; import org.onap.so.serviceinstancebeans.ModelInfo; import org.onap.so.serviceinstancebeans.RequestDetails; @@ -117,11 +128,11 @@ public class ServiceInstancesTest extends BaseTest{ // set headers headers = new HttpHeaders(); headers.set(ONAPLogConstants.Headers.PARTNER_NAME, "test_name"); - headers.set(MsoLogger.TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d"); - headers.set(MsoLogger.ONAP_REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d"); + headers.set(HttpHeadersConstants.TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d"); + headers.set(ONAP_REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d"); headers.set(ONAPLogConstants.MDCs.REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d"); - headers.set(MsoLogger.CLIENT_ID, "VID"); - headers.set(MsoLogger.REQUESTOR_ID, "xxxxxx"); + headers.set(CLIENT_ID, "VID"); + headers.set(REQUESTOR_ID, "xxxxxx"); try { // generate one-time port number to avoid RANDOM port number later. initialUrl = new URL(createURLWithPort(Constants.ORCHESTRATION_REQUESTS_PATH)); initialPort = initialUrl.getPort(); @@ -263,22 +274,22 @@ public class ServiceInstancesTest extends BaseTest{ Map<String,String> mdc = logEvent.getMDCPropertyMap(); assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP)); assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); - assertNotNull(mdc.get(MsoLogger.INVOCATION_ID)); - assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME)); - assertEquals("onap/so/infra/serviceInstantiation/v5/serviceInstances",mdc.get(MsoLogger.SERVICE_NAME)); - assertEquals("INPROGRESS",mdc.get(MsoLogger.STATUSCODE)); + assertNotNull(mdc.get(INVOCATION_ID)); + assertEquals("UNKNOWN",mdc.get(PARTNERNAME)); + assertEquals("onap/so/infra/serviceInstantiation/v5/serviceInstances",mdc.get(SERVICE_NAME)); + assertEquals("INPROGRESS",mdc.get(STATUSCODE)); }else if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging") && logEvent.getMarker() != null && logEvent.getMarker().getName().equals("EXIT")){ Map<String,String> mdc = logEvent.getMDCPropertyMap(); assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP)); - assertNotNull(mdc.get(MsoLogger.ENDTIME)); + assertNotNull(mdc.get(ENDTIME)); assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); - assertNotNull(mdc.get(MsoLogger.INVOCATION_ID)); - assertEquals("202",mdc.get(MsoLogger.RESPONSECODE)); - assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME)); - assertEquals("onap/so/infra/serviceInstantiation/v5/serviceInstances",mdc.get(MsoLogger.SERVICE_NAME)); - assertEquals("COMPLETE",mdc.get(MsoLogger.STATUSCODE)); - assertNotNull(mdc.get(MsoLogger.RESPONSEDESC)); + assertNotNull(mdc.get(INVOCATION_ID)); + assertEquals("202",mdc.get(RESPONSECODE)); + assertEquals("UNKNOWN",mdc.get(PARTNERNAME)); + assertEquals("onap/so/infra/serviceInstantiation/v5/serviceInstances",mdc.get(SERVICE_NAME)); + assertEquals("COMPLETE",mdc.get(STATUSCODE)); + assertNotNull(mdc.get(RESPONSEDESC)); assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0)); assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0)); assertEquals("5.0.0", response.getHeaders().get("X-LatestVersion").get(0)); @@ -2387,14 +2398,14 @@ public class ServiceInstancesTest extends BaseTest{ assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - assertEquals(response.getHeaders().get(MsoLogger.TRANSACTION_ID).get(0), "32807a28-1a14-4b88-b7b3-2950918aa76d"); + assertEquals(response.getHeaders().get(TRANSACTION_ID).get(0), "32807a28-1a14-4b88-b7b3-2950918aa76d"); for(ILoggingEvent logEvent : TestAppender.events){ if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging") && logEvent.getMarker() != null && logEvent.getMarker().getName().equals("ENTRY")){ Map<String,String> mdc = logEvent.getMDCPropertyMap(); assertEquals("32807a28-1a14-4b88-b7b3-2950918aa76d", mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); - assertEquals("VID",mdc.get(MsoLogger.PARTNERNAME)); + assertEquals("VID",mdc.get(PARTNERNAME)); } } } @@ -2451,7 +2462,7 @@ public class ServiceInstancesTest extends BaseTest{ public void deleteInstanceGroupNoPartnerNameHeader() throws IOException{ HttpHeaders noPartnerHeaders = new HttpHeaders(); noPartnerHeaders.set(ONAPLogConstants.Headers.REQUEST_ID, "eca3a1b1-43ab-457e-ab1c-367263d148b4"); - noPartnerHeaders.set(MsoLogger.REQUESTOR_ID, "xxxxxx"); + noPartnerHeaders.set(REQUESTOR_ID, "xxxxxx"); uri = servInstanceuri + "/v7/instanceGroups/e05864f0-ab35-47d0-8be4-56fd9619ba3c"; ResponseEntity<String> response = sendRequest(null, uri, HttpMethod.DELETE, noPartnerHeaders); //then diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java index ce1dde835d..65ec5fade6 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java @@ -40,8 +40,8 @@ import org.onap.so.apihandlerinfra.tenantisolationbeans.RequestInfo; import org.onap.so.apihandlerinfra.tenantisolationbeans.RequestParameters; import org.onap.so.client.aai.AAIVersion; import org.onap.so.db.request.beans.InfraActiveRequests; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; import javax.ws.rs.core.HttpHeaders; @@ -102,7 +102,7 @@ public class CreateEcompOperationalEnvironmentTest extends BaseTest{ .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED))); stubFor(post(urlPathMatching("/events/.*")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_NOT_FOUND))); - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.DataError).build(); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.DataError).build(); ValidateException expectedException = new ValidateException.Builder("Could not publish DMaap", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER) .errorInfo(errorLoggerInfo).build(); diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/SiteStatus.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/SiteStatus.java index 4e83ea5911..e7a0c39702 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/SiteStatus.java +++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/SiteStatus.java @@ -32,7 +32,6 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; -import org.onap.so.logger.MsoLogger; import java.util.Objects; import org.apache.commons.lang3.builder.ToStringBuilder; diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudifyManager.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudifyManager.java index eb9078fd57..30ebca8699 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudifyManager.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudifyManager.java @@ -24,7 +24,6 @@ import java.util.Date; import com.fasterxml.jackson.annotation.JsonProperty; import com.openpojo.business.annotation.BusinessKey; -import org.onap.so.logger.MsoLogger; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; @@ -205,4 +204,4 @@ public class CloudifyManager { return new HashCodeBuilder(1, 31).append(getId()).append(getCloudifyUrl()).append(getUsername()) .append(getPassword()).append(getVersion()).toHashCode(); } -}
\ No newline at end of file +} |