summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java4
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java7
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java4
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java32
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java36
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java35
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditQueryStackService.java34
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java41
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java2
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java4
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java4
-rw-r--r--adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/MSORequestDBApplication.java5
-rw-r--r--adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/WebMvcConfig.java4
-rw-r--r--adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java6
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java6
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterApplication.java2
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/CXFConfiguration.java6
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java12
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/activity/ActivitySpecsActions.java7
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy6
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy47
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java10
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java16
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy4
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy10
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayUnitTest.java21
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java16
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java10
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java8
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy6
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy6
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java14
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java11
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java20
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java16
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java18
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java2
-rw-r--r--common/pom.xml5
-rw-r--r--common/src/main/java/org/onap/so/client/BaseClient.java4
-rw-r--r--common/src/main/java/org/onap/so/client/HttpClient.java8
-rw-r--r--common/src/main/java/org/onap/so/client/HttpClientFactory.java8
-rw-r--r--common/src/main/java/org/onap/so/client/RestClient.java21
-rw-r--r--common/src/main/java/org/onap/so/client/RestTemplateConfig.java6
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIRestClient.java6
-rw-r--r--common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestClient.java6
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java14
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryRestClient.java5
-rw-r--r--common/src/main/java/org/onap/so/client/grm/GRMRestClient.java6
-rw-r--r--common/src/main/java/org/onap/so/client/policy/PolicyRestClient.java6
-rw-r--r--common/src/main/java/org/onap/so/externaltasks/logging/AuditMDCSetup.java56
-rw-r--r--common/src/main/java/org/onap/so/logger/HttpHeadersConstants.java8
-rw-r--r--common/src/main/java/org/onap/so/logger/LogConstants.java2
-rw-r--r--common/src/main/java/org/onap/so/logger/MdcConstants.java10
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsClientLogging.java136
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java173
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCSetup.java111
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCTaskDecorator.java43
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/PayloadLoggingFilter.java158
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/SOAuditLogContainerFilter.java34
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/SOMetricLogClientFilter.java44
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/SOSpringClientFilter.java52
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/SpringClientFilter.java156
-rw-r--r--common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java132
-rw-r--r--common/src/main/java/org/onap/so/utils/Components.java7
-rw-r--r--common/src/main/java/org/onap/so/utils/ExternalTaskUtils.java10
-rw-r--r--common/src/main/java/org/onap/so/utils/TargetEntities.java27
-rw-r--r--common/src/main/java/org/onap/so/utils/TargetEntity.java59
-rw-r--r--common/src/test/java/org/onap/so/client/HttpClientTest.java8
-rw-r--r--common/src/test/java/org/onap/so/client/RestClientTest.java4
-rw-r--r--common/src/test/java/org/onap/so/client/adapter/rest/AdapterRestClientTest.java6
-rw-r--r--common/src/test/java/org/onap/so/externaltasks/logging/AuditMDCSetupTest.java89
-rw-r--r--cxf-logging/pom.xml5
-rw-r--r--cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java2
-rw-r--r--cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingOutInterceptor.java2
-rw-r--r--deployment-configs/src/main/resources/logger/logback-spring.xml231
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ApiHandlerApplication.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java6
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java7
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java36
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java7
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java57
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/client/grm/GRMClientTest.java6
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java4
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java13
-rw-r--r--packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml35
-rw-r--r--pom.xml15
108 files changed, 1004 insertions, 1417 deletions
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 c75aa9a67e..1701cda98e 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
@@ -51,7 +51,7 @@ import org.onap.so.openstack.exceptions.MsoAdapterException;
import org.onap.so.openstack.exceptions.MsoException;
import org.onap.so.openstack.exceptions.MsoOpenstackException;
import org.onap.so.openstack.mappers.StackInfoMapper;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -821,7 +821,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
private RestClient getMulticloudClient(String endpoint, String tenantId) {
HttpClient client = null;
try {
- client = httpClientFactory.newJsonClient(new URL(endpoint), TargetEntity.MULTICLOUD);
+ client = httpClientFactory.newJsonClient(new URL(endpoint), ONAPComponents.MULTICLOUD);
if (tenantId != null && !tenantId.isEmpty()) {
client.addAdditionalHeader("Project", tenantId);
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java
index aa19aed515..6fb65ca87e 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java
@@ -28,7 +28,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication(scanBasePackages = {"org.onap.so.adapters.catalogdb", "org.onap.so.db.catalog.client",
"org.onap.so.logging.jaxrs.filter", "org.onap.so.logging.spring.interceptor", "org.onap.so.client",
- "org.onap.so.configuration", "org.onap.so.db"})
+ "org.onap.so.configuration", "org.onap.so.db", "org.onap.logging.filter"})
@EnableJpaRepositories("org.onap.so.db.catalog.data.repository")
@EntityScan("org.onap.so.db.catalog.beans")
@EnableScheduling
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java
index b43447f5c4..699347015b 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java
@@ -23,10 +23,12 @@ package org.onap.so.adapters.catalogdb;
import javax.annotation.PostConstruct;
import javax.ws.rs.ApplicationPath;
import org.glassfish.jersey.server.ResourceConfig;
+import org.onap.logging.filter.base.Constants;
+import org.onap.logging.filter.base.ONAPComponents;
import org.onap.so.adapters.catalogdb.rest.CatalogDbAdapterRest;
import org.onap.so.adapters.catalogdb.rest.ServiceRestImpl;
import org.onap.so.adapters.catalogdb.rest.VnfRestImpl;
-import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging;
+import org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter;
import org.springframework.context.annotation.Configuration;
import io.swagger.jaxrs.config.BeanConfig;
import io.swagger.jaxrs.listing.ApiListingResource;
@@ -38,10 +40,11 @@ public class JerseyConfiguration extends ResourceConfig {
@PostConstruct
public void setUp() {
+ System.setProperty(Constants.Property.PARTNER_NAME, ONAPComponents.CATALOG_DB.toString());
register(CatalogDbAdapterRest.class);
register(ApiListingResource.class);
register(SwaggerSerializers.class);
- register(JaxRsFilterLogging.class);
+ register(SOAuditLogContainerFilter.class);
register(ServiceRestImpl.class);
register(VnfRestImpl.class);
BeanConfig beanConfig = new BeanConfig();
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java
index 4dabb58f7d..ff0f8dc432 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java
@@ -21,14 +21,16 @@
package org.onap.so.adapters.catalogdb;
-import org.onap.so.logging.spring.interceptor.LoggingInterceptor;
+import org.onap.logging.filter.spring.LoggingInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.handler.MappedInterceptor;
@Configuration
+@ComponentScan(basePackages = {"org.onap.logging.filter"})
public class WebMvcConfig extends WebMvcConfigurerAdapter {
@Autowired
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 145ba50583..e1cca8901e 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
@@ -22,13 +22,13 @@ package org.onap.so.adapters.catalogdb.catalogrest;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-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.logging.ref.slf4j.ONAPLogConstants.MDCs.INVOCATION_ID;
+import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.LOG_TIMESTAMP;
+import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.PARTNER_NAME;
+import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.RESPONSE_CODE;
+import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION;
+import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE;
+import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.SERVICE_NAME;
import java.io.IOException;
import java.util.Map;
import javax.ws.rs.core.MediaType;
@@ -815,27 +815,27 @@ public class CatalogDBRestTest extends CatalogDbAdapterBaseTest {
for (ILoggingEvent logEvent : TestAppender.events)
- if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging")
+ if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter")
&& logEvent.getMarker().getName().equals("ENTRY")) {
Map<String, String> mdc = logEvent.getMDCPropertyMap();
assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
assertNotNull(mdc.get(INVOCATION_ID));
- assertEquals("UNKNOWN", mdc.get(PARTNERNAME));
+ assertEquals("UNKNOWN", mdc.get(PARTNER_NAME));
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")
+ assertEquals("INPROGRESS", mdc.get(RESPONSE_STATUS_CODE));
+ } else if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter")
&& logEvent.getMarker().getName().equals("EXIT")) {
Map<String, String> mdc = logEvent.getMDCPropertyMap();
assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
- assertNotNull(mdc.get(ENDTIME));
+ assertNotNull(mdc.get(LOG_TIMESTAMP));
assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
assertNotNull(mdc.get(INVOCATION_ID));
- assertEquals("500", mdc.get(RESPONSECODE));
- assertEquals("UNKNOWN", mdc.get(PARTNERNAME));
+ assertEquals("500", mdc.get(RESPONSE_CODE));
+ assertEquals("UNKNOWN", mdc.get(PARTNER_NAME));
assertEquals("v2/vfModules", mdc.get(SERVICE_NAME));
- assertEquals("ERROR", mdc.get(STATUSCODE));
- assertNotNull(mdc.get(RESPONSEDESC));
+ assertEquals("ERROR", mdc.get(RESPONSE_STATUS_CODE));
+ assertNotNull(mdc.get(RESPONSE_DESCRIPTION));
}
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java
index 493ac4a54f..0c05df959f 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java
@@ -25,6 +25,7 @@ import java.util.Optional;
import org.onap.so.objects.audit.AAIObjectAudit;
import org.onap.so.objects.audit.AAIObjectAuditList;
import org.onap.so.utils.ExternalTaskUtils;
+import org.onap.logging.filter.base.ONAPComponents;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -79,5 +80,4 @@ public abstract class AbstractAuditService extends ExternalTaskUtils {
return false;
}
}
-
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java
index d03c86ac30..54ffc597f4 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java
@@ -30,6 +30,7 @@ import org.camunda.bpm.client.task.ExternalTaskService;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.audit.beans.AuditInventory;
import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
+import org.onap.so.externaltasks.logging.AuditMDCSetup;
import org.onap.so.objects.audit.AAIObjectAuditList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -44,14 +45,17 @@ public class AuditCreateStackService extends AbstractAuditService {
@Autowired
public HeatStackAudit heatStackAudit;
+ @Autowired
+ private AuditMDCSetup mdcSetup;
+
protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
- setupMDC(externalTask);
+ mdcSetup.setupMDC(externalTask);
AuditInventory auditInventory = externalTask.getVariable("auditInventory");
Map<String, Object> variables = new HashMap<>();
boolean success = false;
try {
- logger.info("Executing External Task Audit Inventory, Retry Number: {} \n {}", auditInventory,
- externalTask.getRetries());
+ Integer retryCount = externalTask.getRetries();
+ logger.info("Executing External Task Audit Inventory, Retry Number: {} \n {}", auditInventory, retryCount);
Optional<AAIObjectAuditList> auditListOpt = heatStackAudit.auditHeatStack(auditInventory.getCloudRegion(),
auditInventory.getCloudOwner(), auditInventory.getTenantId(), auditInventory.getHeatStackName());
if (auditListOpt.isPresent()) {
@@ -65,29 +69,35 @@ public class AuditCreateStackService extends AbstractAuditService {
logger.error("Error during audit of stack", e);
}
variables.put("auditIsSuccessful", success);
+ mdcSetup.setElapsedTime();
+ String externalTaskId = externalTask.getId();
if (success) {
externalTaskService.complete(externalTask, variables);
- logger.debug("The External Task Id: {} Successful", externalTask.getId());
+ mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.COMPLETE.toString());
+ logger.debug("The External Task Id: {} Successful", externalTaskId);
logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
+ mdcSetup.clearClientMDCs();
} else {
- if (externalTask.getRetries() == null) {
+ Integer retryCount = externalTask.getRetries();
+ if (retryCount == null) {
logger.debug("The External Task Id: {} Failed, Setting Retries to Default Start Value: {}",
- externalTask.getId(), getRetrySequence().length);
+ externalTaskId, getRetrySequence().length);
externalTaskService.handleFailure(externalTask, UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI,
UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, getRetrySequence().length, 10000);
- } else if (externalTask.getRetries() != null && externalTask.getRetries() - 1 == 0) {
- logger.debug("The External Task Id: {} Failed, All Retries Exhausted", externalTask.getId());
+ } else if (retryCount != null && retryCount - 1 == 0) {
externalTaskService.complete(externalTask, variables);
+ mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.ERROR.toString());
+ logger.debug("The External Task Id: {} Failed, All Retries Exhausted", externalTaskId);
logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
+ mdcSetup.clearClientMDCs();
} else {
logger.debug("The External Task Id: {} Failed, Decrementing Retries: {} , Retry Delay: ",
- externalTask.getId(), externalTask.getRetries() - 1,
- calculateRetryDelay(externalTask.getRetries()));
+ externalTaskId, retryCount - 1, calculateRetryDelay(retryCount));
externalTaskService.handleFailure(externalTask, UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI,
- UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, externalTask.getRetries() - 1,
- calculateRetryDelay(externalTask.getRetries()));
+ UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, retryCount - 1,
+ calculateRetryDelay(retryCount));
}
- logger.debug("The External Task Id: {} Failed", externalTask.getId());
+ logger.debug("The External Task Id: {} Failed", externalTaskId);
}
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java
index 0aa4f9bdc3..9a4f154347 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java
@@ -28,6 +28,7 @@ import org.camunda.bpm.client.task.ExternalTaskService;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.audit.beans.AuditInventory;
import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
+import org.onap.so.externaltasks.logging.AuditMDCSetup;
import org.onap.so.objects.audit.AAIObjectAuditList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -44,6 +45,9 @@ public class AuditDeleteStackService extends AbstractAuditService {
protected HeatStackAudit heatStackAudit;
@Autowired
+ private AuditMDCSetup mdcSetup;
+
+ @Autowired
protected AuditVServer auditVservers;
@Autowired
@@ -53,12 +57,13 @@ public class AuditDeleteStackService extends AbstractAuditService {
protected Environment env;
protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
- setupMDC(externalTask);
+ mdcSetup.setupMDC(externalTask);
AuditInventory auditInventory = externalTask.getVariable("auditInventory");
Map<String, Object> variables = new HashMap<>();
boolean success = false;
try {
- logger.info("Executing External Task Delete Audit Inventory. Retry Number: {}", externalTask.getRetries());
+ Integer retryCount = externalTask.getRetries();
+ logger.info("Executing External Task Delete Audit Inventory. Retry Number: {}", retryCount);
Optional<AAIObjectAuditList> auditListOpt = auditDataService.getStackDataFromRequestDb(auditInventory);
if (auditListOpt.isPresent()) {
auditVservers.auditVservers(auditListOpt.get());
@@ -77,29 +82,35 @@ public class AuditDeleteStackService extends AbstractAuditService {
logger.error("Error during audit of stack", e);
}
variables.put("auditIsSuccessful", success);
+ mdcSetup.setElapsedTime();
+ String externalTaskId = externalTask.getId();
if (success) {
externalTaskService.complete(externalTask, variables);
- logger.debug("The External Task Id: {} Successful", externalTask.getId());
+ mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.COMPLETE.toString());
+ logger.debug("The External Task Id: {} Successful", externalTaskId);
logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
+ mdcSetup.clearClientMDCs();
} else {
- if (externalTask.getRetries() == null) {
+ Integer retryCount = externalTask.getRetries();
+ if (retryCount == null) {
logger.debug("The External Task Id: {} Failed, Setting Retries to Default Start Value: {}",
- externalTask.getId(), getRetrySequence().length);
+ externalTaskId, getRetrySequence().length);
externalTaskService.handleFailure(externalTask, UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI,
UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, getRetrySequence().length, 10000);
- } else if (externalTask.getRetries() != null && externalTask.getRetries() - 1 == 0) {
- logger.debug("The External Task Id: {} Failed, All Retries Exhausted", externalTask.getId());
+ } else if (retryCount != null && retryCount - 1 == 0) {
externalTaskService.complete(externalTask, variables);
+ mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.ERROR.toString());
+ logger.debug("The External Task Id: {} Failed, All Retries Exhausted", externalTaskId);
logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
+ mdcSetup.clearClientMDCs();
} else {
logger.debug("The External Task Id: {} Failed, Decrementing Retries: {} , Retry Delay: ",
- externalTask.getId(), externalTask.getRetries() - 1,
- calculateRetryDelay(externalTask.getRetries()));
+ externalTaskId, retryCount - 1, calculateRetryDelay(retryCount));
externalTaskService.handleFailure(externalTask, UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI,
- UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, externalTask.getRetries() - 1,
- calculateRetryDelay(externalTask.getRetries()));
+ UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, retryCount - 1,
+ calculateRetryDelay(retryCount));
}
- logger.debug("The External Task Id: {} Failed", externalTask.getId());
+ logger.debug("The External Task Id: {} Failed", externalTaskId);
}
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditQueryStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditQueryStackService.java
index 2ef7d5b325..dc672ff017 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditQueryStackService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditQueryStackService.java
@@ -7,6 +7,7 @@ import org.camunda.bpm.client.task.ExternalTask;
import org.camunda.bpm.client.task.ExternalTaskService;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.audit.beans.AuditInventory;
+import org.onap.so.externaltasks.logging.AuditMDCSetup;
import org.onap.so.objects.audit.AAIObjectAuditList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -22,47 +23,56 @@ public class AuditQueryStackService extends AbstractAuditService {
protected HeatStackAudit heatStackAudit;
@Autowired
+ private AuditMDCSetup mdcSetup;
+
+ @Autowired
protected AuditDataService auditDataService;
protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
- setupMDC(externalTask);
+ mdcSetup.setupMDC(externalTask);
AuditInventory auditInventory = externalTask.getVariable("auditInventory");
boolean success = false;
Map<String, Object> variables = new HashMap<>();
try {
+ Integer retryCount = externalTask.getRetries();
logger.info("Executing External Task Query Audit Inventory. Audit Inventory: {} \n Retry Number: {}",
- auditInventory.toString(), externalTask.getRetries());
+ auditInventory.toString(), retryCount);
Optional<AAIObjectAuditList> auditList = heatStackAudit.queryHeatStack(auditInventory.getCloudOwner(),
auditInventory.getCloudRegion(), auditInventory.getTenantId(), auditInventory.getHeatStackName());
if (auditList.isPresent()) {
+ mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.COMPLETE.toString());
success = true;
auditDataService.writeStackDataToRequestDb(auditInventory, auditList.get());
}
+ mdcSetup.setElapsedTime();
+ String externalTaskId = externalTask.getId();
if (success) {
externalTaskService.complete(externalTask, variables);
- logger.debug("The External Task {} was Successful", externalTask.getId());
+ mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.COMPLETE.toString());
+ logger.debug("The External Task {} was Successful", externalTaskId);
logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
+ mdcSetup.clearClientMDCs();
} else {
- if (externalTask.getRetries() == null) {
+ if (retryCount == null) {
logger.debug("The External Task {} Failed. Setting Retries to Default Start Value: {}",
- externalTask.getId(), getRetrySequence().length);
+ externalTaskId, getRetrySequence().length);
externalTaskService.handleFailure(externalTask, UNABLE_TO_FIND_V_SERVERS_IN_OPENSTACK,
UNABLE_TO_FIND_V_SERVERS_IN_OPENSTACK, getRetrySequence().length, 10000);
- } else if (externalTask.getRetries() != null && externalTask.getRetries() - 1 == 0) {
- logger.debug("The External Task {} Failed. All Retries Exhausted", externalTask.getId());
+ } else if (retryCount != null && retryCount - 1 == 0) {
externalTaskService.complete(externalTask, variables);
+ mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.ERROR.toString());
+ logger.debug("The External Task {} Failed. All Retries Exhausted", externalTaskId);
logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
+ mdcSetup.clearClientMDCs();
} else {
logger.debug("The External Task {} Failed. Decrementing Retries to {} , Retry Delay: ",
- externalTask.getId(), externalTask.getRetries() - 1,
- calculateRetryDelay(externalTask.getRetries()));
+ externalTaskId, retryCount - 1, calculateRetryDelay(retryCount));
externalTaskService.handleFailure(externalTask, UNABLE_TO_FIND_V_SERVERS_IN_OPENSTACK,
- UNABLE_TO_FIND_V_SERVERS_IN_OPENSTACK, externalTask.getRetries() - 1,
- calculateRetryDelay(externalTask.getRetries()));
+ UNABLE_TO_FIND_V_SERVERS_IN_OPENSTACK, retryCount - 1, calculateRetryDelay(retryCount));
}
- logger.debug("The External Task {} Failed", externalTask.getId());
+ logger.debug("The External Task {} Failed", externalTaskId);
}
} catch (Exception e) {
logger.error("Error during audit query of stack", e);
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java
index 29d0ef633f..3d2d1d2aa3 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java
@@ -26,6 +26,7 @@ import org.camunda.bpm.client.task.ExternalTask;
import org.camunda.bpm.client.task.ExternalTaskService;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
+import org.onap.so.externaltasks.logging.AuditMDCSetup;
import org.onap.so.objects.audit.AAIObjectAuditList;
import org.onap.so.utils.ExternalTaskUtils;
import org.slf4j.Logger;
@@ -45,22 +46,29 @@ public class CreateInventoryTask extends ExternalTaskUtils {
@Autowired
CreateAAIInventory createInventory;
+ @Autowired
+ private AuditMDCSetup mdcSetup;
+
protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
- setupMDC(externalTask);
+ mdcSetup.setupMDC(externalTask);
boolean success = true;
boolean inventoryException = false;
String auditInventoryString = externalTask.getVariable("auditInventoryResult");
AAIObjectAuditList auditInventory = null;
+ String externalTaskId = externalTask.getId();
try {
GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider();
auditInventory = objectMapper.getMapper().readValue(auditInventoryString, AAIObjectAuditList.class);
} catch (Exception e) {
+ mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.ERROR.toString());
logger.error("Error Parsing Audit Results", e);
}
+ mdcSetup.setElapsedTime();
if (auditInventory != null) {
+ Integer retryCount = externalTask.getRetries();
try {
logger.info("Executing External Task Create Inventory, Retry Number: {} \n {}", auditInventory,
- externalTask.getRetries());
+ retryCount);
createInventory.createInventory(auditInventory);
} catch (InventoryException e) {
logger.error("Error during inventory of stack", e);
@@ -70,38 +78,39 @@ public class CreateInventoryTask extends ExternalTaskUtils {
logger.error("Error during inventory of stack", e);
success = false;
}
+ mdcSetup.setElapsedTime();
if (success) {
externalTaskService.complete(externalTask);
- logger.debug("The External Task Id: {} Successful", externalTask.getId());
+ mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.COMPLETE.toString());
+ logger.debug("The External Task Id: {} Successful", externalTaskId);
logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
+ mdcSetup.clearClientMDCs();
} else if (inventoryException) {
- logger.debug("The External Task Id: {} Failed, Retry not needed", externalTask.getId());
+ mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.ERROR.toString());
+ logger.debug("The External Task Id: {} Failed, Retry not needed", externalTaskId);
externalTaskService.handleBpmnError(externalTask, AAI_INVENTORY_FAILURE);
} else {
- if (externalTask.getRetries() == null) {
+ if (retryCount == null) {
logger.debug("The External Task Id: {} Failed, Setting Retries to Default Start Value: {}",
- externalTask.getId(), getRetrySequence().length);
+ externalTaskId, getRetrySequence().length);
externalTaskService.handleFailure(externalTask, UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI,
UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI, getRetrySequence().length, 10000);
- } else if (externalTask.getRetries() != null && externalTask.getRetries() - 1 == 0) {
- logger.debug("The External Task Id: {} Failed, All Retries Exhausted", externalTask.getId());
+ } else if (retryCount != null && retryCount - 1 == 0) {
externalTaskService.handleBpmnError(externalTask, AAI_INVENTORY_FAILURE);
+ mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.ERROR.toString());
+ logger.debug("The External Task Id: {} Failed, All Retries Exhausted", externalTaskId);
logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
} else {
logger.debug("The External Task Id: {} Failed, Decrementing Retries: {} , Retry Delay: ",
- externalTask.getId(), externalTask.getRetries() - 1,
- calculateRetryDelay(externalTask.getRetries()));
+ externalTaskId, retryCount - 1, calculateRetryDelay(retryCount));
externalTaskService.handleFailure(externalTask, UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI,
- UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI, externalTask.getRetries() - 1,
- calculateRetryDelay(externalTask.getRetries()));
+ UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI, retryCount - 1, calculateRetryDelay(retryCount));
}
- logger.debug("The External Task Id: {} Failed", externalTask.getId());
+ logger.debug("The External Task Id: {} Failed", externalTaskId);
}
} else {
- logger.debug("The External Task Id: {} Failed, No Audit Results Written", externalTask.getId());
+ logger.debug("The External Task Id: {} Failed, No Audit Results Written", externalTaskId);
externalTaskService.handleBpmnError(externalTask, AAI_INVENTORY_FAILURE);
}
}
-
-
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java
index 436836491d..d9a83e6a9a 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java
@@ -21,7 +21,7 @@
package org.onap.so.adapters.openstack;
import java.util.concurrent.Executor;
-import org.onap.so.logging.jaxrs.filter.MDCTaskDecorator;
+import org.onap.logging.filter.spring.MDCTaskDecorator;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java
index 2109fb289f..cff4d5f994 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java
@@ -37,6 +37,7 @@ import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.onap.so.audit.beans.AuditInventory;
+import org.onap.so.externaltasks.logging.AuditMDCSetup;
import org.onap.so.objects.audit.AAIObjectAuditList;
import org.springframework.core.env.Environment;
import com.fasterxml.jackson.core.JsonParseException;
@@ -67,6 +68,9 @@ public class AuditStackServiceDataTest extends AuditCreateStackService {
@Mock
private AuditDataService auditDataService;
+ @Mock
+ private AuditMDCSetup mdcSetup;
+
private ObjectMapper objectMapper = new ObjectMapper();
private AuditInventory auditInventory = new AuditInventory();
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java
index 8dc9d7fe5c..c4fa9ee2c5 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java
@@ -31,6 +31,7 @@ import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
+import org.onap.so.externaltasks.logging.AuditMDCSetup;
import org.onap.so.objects.audit.AAIObjectAudit;
import org.onap.so.objects.audit.AAIObjectAuditList;
import com.fasterxml.jackson.core.JsonProcessingException;
@@ -46,6 +47,9 @@ public class CreateInventoryTaskTest {
@Mock
ExternalTaskService externalTaskService;
+ @Mock
+ private AuditMDCSetup mdcSetup;
+
@InjectMocks
CreateInventoryTask inventoryTask;
diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/MSORequestDBApplication.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/MSORequestDBApplication.java
index 85c05decb1..e1dc4cab66 100644
--- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/MSORequestDBApplication.java
+++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/MSORequestDBApplication.java
@@ -24,6 +24,8 @@ package org.onap.so.adapters.requestsdb.application;
import java.time.Duration;
import javax.sql.DataSource;
+import org.onap.logging.filter.base.Constants;
+import org.onap.logging.filter.base.ONAPComponents;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
@@ -40,7 +42,7 @@ import net.javacrumbs.shedlock.spring.ScheduledLockConfigurationBuilder;
*
*/
-@SpringBootApplication(scanBasePackages = {"org.onap.so"})
+@SpringBootApplication(scanBasePackages = {"org.onap.so", "org.onap.logging.filter"})
@EnableScheduling
@EnableMBeanExport(registration = RegistrationPolicy.IGNORE_EXISTING)
public class MSORequestDBApplication {
@@ -54,6 +56,7 @@ public class MSORequestDBApplication {
}
public static void main(String... args) {
+ System.setProperty(Constants.Property.PARTNER_NAME, ONAPComponents.REQUEST_DB.toString());
SpringApplication.run(MSORequestDBApplication.class, args);
java.security.Security.setProperty("networkaddress.cache.ttl", "10");
setLogsDir();
diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/WebMvcConfig.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/WebMvcConfig.java
index 579afe9243..c0dfbe08ef 100644
--- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/WebMvcConfig.java
+++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/WebMvcConfig.java
@@ -21,14 +21,16 @@
package org.onap.so.adapters.requestsdb.application;
-import org.onap.so.logging.spring.interceptor.LoggingInterceptor;
+import org.onap.logging.filter.spring.LoggingInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.handler.MappedInterceptor;
@Configuration
+@ComponentScan(basePackages = {"org.onap.logging.filter"})
public class WebMvcConfig extends WebMvcConfigurerAdapter {
@Autowired
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 e53b957210..fa2acbc0ca 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
@@ -449,7 +449,7 @@ public class MSORequestDBImplTest extends RequestsAdapterBase {
assertNotNull(mdc.get(ONAPLogConstants.MDCs.INSTANCE_UUID));
assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID));
- assertEquals("", mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME));
+ assertEquals("UNKNOWN", mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME));
assertEquals("/services/RequestsDbAdapter", mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME));
assertEquals("INPROGRESS", mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
} else if (logEvent.getLoggerName().equals("org.onap.so.logging.cxf.interceptor.SOAPLoggingOutInterceptor")
@@ -458,9 +458,9 @@ public class MSORequestDBImplTest extends RequestsAdapterBase {
assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID));
assertEquals(null, mdc.get(ONAPLogConstants.MDCs.RESPONSE_CODE));
- assertEquals("", mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME));
+ assertEquals("UNKNOWN", mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME));
assertEquals("/services/RequestsDbAdapter", mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME));
- assertEquals("COMPLETED", mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
+ assertEquals("COMPLETE", mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
}
}
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 6149f7ed25..dd1da98dd8 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,7 @@ import org.apache.cxf.transport.servlet.CXFServlet;
import org.onap.so.adapters.sdnc.sdncrest.SNIROResponse;
import org.onap.so.logging.cxf.interceptor.SOAPLoggingInInterceptor;
import org.onap.so.logging.cxf.interceptor.SOAPLoggingOutInterceptor;
-import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging;
+import org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
@@ -51,7 +51,7 @@ public class CXFConfiguration {
private Bus bus;
@Autowired
- private JaxRsFilterLogging jaxRsFilterLogging;
+ private SOAuditLogContainerFilter soAuditLogContainerFilter;
@Autowired
private SDNCAdapterPortType sdncAdapterPortImpl;
@@ -70,7 +70,7 @@ public class CXFConfiguration {
endpoint.setServiceBeans(Arrays.<Object>asList(sniroResponse));
endpoint.setAddress("/rest");
endpoint.setFeatures(Arrays.asList(createSwaggerFeature(), new LoggingFeature()));
- endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(mapper), jaxRsFilterLogging));
+ endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(mapper), soAuditLogContainerFilter));
return endpoint.create();
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterApplication.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterApplication.java
index 55023088bc..fc6d0a6fc9 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterApplication.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterApplication.java
@@ -23,7 +23,7 @@
package org.onap.so.adapters.sdnc;
import java.util.concurrent.Executor;
-import org.onap.so.logging.jaxrs.filter.MDCTaskDecorator;
+import org.onap.logging.filter.spring.MDCTaskDecorator;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/CXFConfiguration.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/CXFConfiguration.java
index 5ea68f08a2..dd875c573e 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/CXFConfiguration.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/CXFConfiguration.java
@@ -28,7 +28,7 @@ import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
import org.apache.cxf.jaxrs.swagger.Swagger2Feature;
import org.apache.cxf.transport.servlet.CXFServlet;
import org.onap.so.adapters.vfc.rest.VfcAdapterRest;
-import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging;
+import org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
@@ -47,7 +47,7 @@ public class CXFConfiguration {
private VfcAdapterRest vfcAdapterRest;
@Autowired
- private JaxRsFilterLogging jaxRsFilterLogging;
+ private SOAuditLogContainerFilter soAuditLogContainerFilter;
@Autowired
private ObjectMapper mapper;
@@ -64,7 +64,7 @@ public class CXFConfiguration {
endpoint.setServiceBeans(Arrays.<Object>asList(vfcAdapterRest));
endpoint.setAddress("/");
endpoint.setFeatures(Arrays.asList(createSwaggerFeature(), new LoggingFeature()));
- endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(mapper), jaxRsFilterLogging));
+ endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(mapper), soAuditLogContainerFilter));
return endpoint.create();
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java
index 93312cfa64..b621759b59 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java
@@ -30,6 +30,7 @@ import java.security.NoSuchAlgorithmException;
import java.security.UnrecoverableKeyException;
import java.security.cert.CertificateException;
import java.util.Iterator;
+import java.util.ListIterator;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
@@ -43,6 +44,7 @@ import org.onap.aai.domain.yang.EsrSystemInfo;
import org.onap.aai.domain.yang.EsrVnfm;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.JSON;
import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
+import org.onap.so.logging.jaxrs.filter.SOSpringClientFilter;
import org.onap.so.rest.service.HttpRestServiceProvider;
import org.onap.so.rest.service.HttpRestServiceProviderImpl;
import org.slf4j.Logger;
@@ -53,6 +55,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.Resource;
import org.springframework.http.client.BufferingClientHttpRequestFactory;
+import org.springframework.http.client.ClientHttpRequestInterceptor;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.GsonHttpMessageConverter;
@@ -167,4 +170,13 @@ public class VnfmServiceProviderConfiguration {
}
}
+ private void removeSpringClientFilter(final RestTemplate restTemplate) {
+ ListIterator<ClientHttpRequestInterceptor> interceptorIterator = restTemplate.getInterceptors().listIterator();
+ while (interceptorIterator.hasNext()) {
+ if (interceptorIterator.next() instanceof SOSpringClientFilter) {
+ interceptorIterator.remove();
+ }
+ }
+ }
+
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/activity/ActivitySpecsActions.java b/asdc-controller/src/main/java/org/onap/so/asdc/activity/ActivitySpecsActions.java
index c37eccf594..06887f1253 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/activity/ActivitySpecsActions.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/activity/ActivitySpecsActions.java
@@ -29,7 +29,8 @@ import org.onap.so.asdc.activity.beans.ActivitySpec;
import org.onap.so.asdc.activity.beans.ActivitySpecCreateResponse;
import org.onap.so.client.HttpClient;
import org.onap.so.client.HttpClientFactory;
-import org.onap.so.utils.TargetEntity;
+import org.onap.so.logger.LoggingAnchor;
+import org.onap.logging.filter.base.ONAPComponents;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@@ -62,7 +63,7 @@ public class ActivitySpecsActions {
String urlString = UriBuilder.fromUri(hostname).path(ACTIVITY_SPEC_URI).build().toString();
URL url = new URL(urlString);
- HttpClient httpClient = httpClientFactory.newJsonClient(url, TargetEntity.SDC);
+ HttpClient httpClient = httpClientFactory.newJsonClient(url, ONAPComponents.SDC);
httpClient.addAdditionalHeader("Content-Type", ContentType.APPLICATION_JSON.toString());
Response response = httpClient.post(payload);
@@ -104,7 +105,7 @@ public class ActivitySpecsActions {
String urlString = UriBuilder.fromUri(hostname).path(path).build().toString();
URL url = new URL(urlString);
- HttpClient httpClient = httpClientFactory.newJsonClient(url, TargetEntity.SDC);
+ HttpClient httpClient = httpClientFactory.newJsonClient(url, ONAPComponents.SDC);
httpClient.addAdditionalHeader("Content-Type", ContentType.APPLICATION_JSON.toString());
Response response = httpClient.put(CERTIFY_ACTIVITY_PAYLOAD);
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 f14e3dcc42..ee70dcc89c 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
@@ -44,7 +44,7 @@ import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.onap.so.openpojo.rules.HasToStringRule
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
@Deprecated
class AaiUtil {
@@ -96,7 +96,7 @@ class AaiUtil {
String regionId = ""
try{
URL Url = new URL(url)
- HttpClient client = new HttpClientFactory().newXmlClient(Url, TargetEntity.AAI)
+ HttpClient client = new HttpClientFactory().newXmlClient(Url, ONAPComponents.AAI)
client.addBasicAuthHeader(UrnPropertiesReader.getVariable("aai.auth", execution), UrnPropertiesReader.getVariable("mso.msoKey", execution))
client.addAdditionalHeader("X-FromAppId", "MSO")
client.addAdditionalHeader("X-TransactionId", utils.getRequestID())
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 2bf7298584..83784e1960 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
@@ -37,7 +37,7 @@ import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import org.springframework.web.util.UriUtils
import javax.ws.rs.core.MediaType
@@ -442,7 +442,7 @@ class CatalogDbUtils {
String catalogDbEndpoint = UrnPropertiesReader.getVariable("mso.catalog.db.endpoint",execution)
String queryEndpoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + endPoint
def responseData = ''
- HttpClient client = httpClientFactory.newJsonClient(new URL(queryEndpoint), TargetEntity.CATALOG_DB)
+ HttpClient client = httpClientFactory.newJsonClient(new URL(queryEndpoint), ONAPComponents.CATALOG_DB)
client.addAdditionalHeader(ONAPLogConstants.Headers.REQUEST_ID, UUID.randomUUID().toString())
client.addAdditionalHeader('X-FromAppId', "BPMN")
client.addAdditionalHeader('Accept', MediaType.APPLICATION_JSON)
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 c23150384e..195b1fc0d6 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
@@ -34,7 +34,7 @@ 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.utils.TargetEntities
+import org.onap.logging.filter.base.ONAPComponentsList
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -285,7 +285,7 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
logger.debug("Outgoing WorkflowException is " + exception)
}
- public void buildWorkflowException(DelegateExecution execution, int errorCode, String errorMessage, TargetEntities extSystemErrorSource) {
+ public void buildWorkflowException(DelegateExecution execution, int errorCode, String errorMessage, ONAPComponentsList extSystemErrorSource) {
MsoUtils utils = new MsoUtils()
String processKey = getProcessKey(execution);
logger.debug("Building a WorkflowException for " + processKey)
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy
index 5525c2642b..a5111a62d3 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy
@@ -29,7 +29,7 @@ import org.onap.so.client.HttpClient
import org.onap.so.client.HttpClientFactory
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import javax.ws.rs.core.MediaType
import javax.ws.rs.core.Response
@@ -145,7 +145,7 @@ class ExternalAPIUtil {
logger.debug( "URL to be used is: " + url)
logger.debug("URL to be passed in header is: " + execution.getVariable("SPPartnerUrl"))
- HttpClient client = httpClientFactory.newJsonClient(new URL(url), TargetEntity.EXTERNAL)
+ HttpClient client = httpClientFactory.newJsonClient(new URL(url), ONAPComponents.EXTERNAL)
client.addBasicAuthHeader(execution.getVariable("URN_externalapi_auth"), execution.getVariable("URN_mso_msoKey"))
client.addAdditionalHeader("X-FromAppId", "MSO")
client.addAdditionalHeader(ONAPLogConstants.Headers.REQUEST_ID, uuid)
@@ -183,7 +183,7 @@ class ExternalAPIUtil {
logger.debug( "URL to be used is: " + url)
logger.debug("URL to be passed in header is: " + execution.getVariable("SPPartnerUrl"))
- HttpClient httpClient = httpClientFactory.newJsonClient(new URL(url), TargetEntity.AAI)
+ HttpClient httpClient = httpClientFactory.newJsonClient(new URL(url), ONAPComponents.AAI)
httpClient.addBasicAuthHeader(execution.getVariable("URN_externalapi_auth"), execution.getVariable("URN_mso_msoKey"))
httpClient.addAdditionalHeader("X-FromAppId", "MSO")
httpClient.addAdditionalHeader("X-TransactionId", uuid)
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 3008f77b62..6d4b50f690 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
@@ -42,7 +42,7 @@ 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.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -92,7 +92,7 @@ public class GenerateVfModuleName extends AbstractServiceTaskProcessor{
logger.debug("AAI endPoint: " + endPoint)
try {
- HttpClient client = new HttpClientFactory().newXmlClient(new URL(endPoint), TargetEntity.AAI)
+ HttpClient client = new HttpClientFactory().newXmlClient(new URL(endPoint), ONAPComponents.AAI)
client.addAdditionalHeader('X-TransactionId', UUID.randomUUID().toString())
client.addAdditionalHeader('X-FromAppId', 'MSO')
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy
index 6583ded413..b082c1830e 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy
@@ -41,7 +41,7 @@ import org.onap.so.db.catalog.beans.CloudIdentity
import org.onap.so.db.catalog.beans.CloudSite
import org.onap.so.db.catalog.beans.HomingInstance
import org.onap.so.db.catalog.beans.ServerType
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -165,7 +165,7 @@ class OofHoming extends AbstractServiceTaskProcessor {
URL url = new URL(urlString)
- HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.OOF)
+ HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.OOF)
httpClient.addAdditionalHeader("Authorization", authHeader)
Response httpResponse = httpClient.post(oofRequest)
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy
index 4bfb29bc45..606b97bec2 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy
@@ -40,7 +40,7 @@ import org.onap.so.client.HttpClient
import org.onap.so.client.HttpClientFactory
import org.onap.so.db.catalog.beans.CloudSite
import org.onap.so.db.catalog.beans.HomingInstance
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import org.springframework.http.HttpEntity
import org.springframework.http.HttpHeaders
import org.springframework.http.HttpMethod
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 c30d807bf3..52d6758b2b 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
@@ -47,7 +47,7 @@ import org.onap.so.client.HttpClient
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
@@ -223,7 +223,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
URL url = new URL(sdncAdapterUrl)
- HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.SDNC_ADAPTER)
+ HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.SDNC_ADAPTER)
httpClient.addAdditionalHeader("X-ONAP-RequestID", execution.getVariable("mso-request-id"))
httpClient.addAdditionalHeader("X-ONAP-InvocationID", UUID.randomUUID().toString())
httpClient.addAdditionalHeader("X-ONAP-PartnerName", "SO-SDNCAdapter")
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy
index 8c2da2c112..08c032fba3 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy
@@ -37,7 +37,7 @@ import org.onap.so.bpmn.core.domain.VnfResource
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.HttpClient
import org.onap.so.client.HttpClientFactory
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.json.JSONArray
@@ -136,7 +136,7 @@ class SniroHomingV1 extends AbstractServiceTaskProcessor{
logger.debug("Sniro Url is: " + urlString)
URL url = new URL(urlString);
- HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.SNIRO)
+ HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.SNIRO)
httpClient.addAdditionalHeader("Authorization", authHeader)
Response httpResponse = httpClient.post(sniroRequest)
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 866229f6b8..803a3f71de 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
@@ -35,8 +35,9 @@ import org.onap.so.client.HttpClient
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import java.util.UUID
+import org.onap.so.utils.Components
@@ -80,7 +81,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no messageId in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
execution.setVariable('VNFAResponse_CORRELATOR', messageId)
@@ -94,7 +95,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no notificationUrl in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
execution.setVariable(prefix + 'notificationUrl', notificationUrl)
@@ -108,7 +109,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': mso:adapters:vnf:rest:endpoint URN mapping is not defined'
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
while (vnfAdapterEndpoint.endsWith('/')) {
@@ -126,7 +127,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
vnfAdapterMethod = 'POST'
@@ -139,7 +140,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
String vfModuleId = getChildText(root, 'vfModuleId')
@@ -148,7 +149,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
vnfAdapterMethod = 'PUT'
@@ -162,7 +163,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
String vfModuleId = getChildText(root, 'vfModuleId')
@@ -171,7 +172,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
vnfAdapterMethod = 'DELETE'
@@ -185,7 +186,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no vfModuleRollback in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
String vnfId = getChildText(vfModuleRollbackNode, 'vnfId')
@@ -194,7 +195,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
String vfModuleId = getChildText(vfModuleRollbackNode, 'vfModuleId')
@@ -203,7 +204,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
vnfAdapterMethod = 'DELETE'
@@ -224,7 +225,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
vnfAdapterMethod = 'PUT'
@@ -240,7 +241,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
vnfAdapterMethod = 'DELETE'
@@ -256,7 +257,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
vnfAdapterMethod = 'DELETE'
@@ -269,7 +270,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
execution.setVariable(prefix + 'vnfAdapterMethod', vnfAdapterMethod)
@@ -306,7 +307,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
}
@@ -337,7 +338,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
URL url = new URL(vnfAdapterUrl);
- HttpClient httpClient = new HttpClientFactory().newXmlClient(url, TargetEntity.VNF_ADAPTER)
+ HttpClient httpClient = new HttpClientFactory().newXmlClient(url, ONAPComponents.VNF_ADAPTER)
httpClient.addAdditionalHeader("Authorization", execution.getVariable(prefix + "basicAuthHeaderValue"))
httpClient.addAdditionalHeader("X-ONAP-RequestID", execution.getVariable("mso-request-id"))
@@ -357,7 +358,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = 'Unsupported HTTP method "' + vnfAdapterMethod + '" in ' + method + ": " + e
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
execution.setVariable(prefix + "vnfAdapterStatusCode", response.getStatus())
@@ -370,7 +371,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = 'Caught exception in ' + method + ": " + e
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
}
@@ -399,7 +400,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
}
} catch (Exception e) {
logger.debug("Error encountered within VnfAdapterRest ProcessCallback method: {}", e.getMessage(), e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7020, "Error encountered within VnfAdapterRest ProcessCallback method", TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7020, "Error encountered within VnfAdapterRest ProcessCallback method", ONAPComponents.SO)
}
}
@@ -418,10 +419,10 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String rolledBack = getChildText(root, "rolledBack")
rolledBack = rolledBack == null || rolledBack.isEmpty() ? "" : " rolledBack='" + rolledBack + "'"
exceptionUtil.buildWorkflowException(execution, 7020, "Received " + root.name() +
- " from VnfAdapter:" + category + message + rolledBack, TargetEntity.OPENSTACK);
+ " from VnfAdapter:" + category + message + rolledBack, Components.OPENSTACK);
} catch (Exception e) {
response = response == null || String.valueOf(response).isEmpty() ? "NONE" : response
- exceptionUtil.buildWorkflowException(execution, 7020, "Received error from VnfAdapter: " + response, TargetEntity.OPENSTACK)
+ exceptionUtil.buildWorkflowException(execution, 7020, "Received error from VnfAdapter: " + response, Components.OPENSTACK)
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
index 2c1d36273d..8efb6a3e1c 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
@@ -44,7 +44,7 @@ import org.onap.so.bpmn.core.domain.VnfResource;
import org.onap.so.bpmn.core.json.JsonUtils;
import org.onap.so.client.HttpClient;
import org.onap.so.client.HttpClientFactory;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
@@ -383,7 +383,7 @@ public class ResourceRequestBuilder {
HttpClient client = new HttpClientFactory().newJsonClient(UriBuilder.fromUri(catalogEndPoint)
.path(SERVICE_URL_SERVICE_INSTANCE).queryParam("serviceModelUuid", uuid).build().toURL(),
- TargetEntity.CATALOG_DB);
+ ONAPComponents.CATALOG_DB);
client.addAdditionalHeader("Accept", "application/json");
client.addAdditionalHeader("Authorization", UrnPropertiesReader.getVariable("mso.db.auth"));
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
index be53e505ac..7684627825 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
@@ -25,6 +25,7 @@ package org.onap.so.bpmn.servicedecomposition.tasks;
import java.util.Map;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.logging.filter.base.ONAPComponentsList;
import org.onap.so.bpmn.core.WorkflowException;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
@@ -35,8 +36,7 @@ import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus;
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.utils.TargetEntities;
-import org.onap.so.utils.TargetEntity;
+import org.onap.so.utils.Components;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -223,7 +223,7 @@ public class ExecuteBuildingBlockRainyDay {
try {
String requestId = (String) execution.getVariable("mso-request-id");
WorkflowException exception = (WorkflowException) execution.getVariable("WorkflowException");
- TargetEntities extSystemErrorSource = exception.getExtSystemErrorSource();
+ ONAPComponentsList extSystemErrorSource = exception.getExtSystemErrorSource();
InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
Boolean isRollbackFailure = (Boolean) execution.getVariable("isRollback");
if (isRollbackFailure == null) {
@@ -244,10 +244,10 @@ public class ExecuteBuildingBlockRainyDay {
} else if (isRollbackFailure) {
logger.debug(
"rollbackExtSystemErrorSource is null for isRollbackFailure. Setting rollbackExtSystemErrorSource to UNKNOWN");
- request.setRollbackExtSystemErrorSource(TargetEntity.UNKNOWN.toString());
+ request.setRollbackExtSystemErrorSource(Components.UNKNOWN.toString());
} else {
logger.debug("extSystemErrorSource is null. Setting extSystemErrorSource to UNKNOWN");
- request.setExtSystemErrorSource(TargetEntity.UNKNOWN.toString());
+ request.setExtSystemErrorSource(Components.UNKNOWN.toString());
}
request.setLastModifiedBy("CamundaBPMN");
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 729f5c95c4..c26a1cfecc 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
@@ -43,8 +43,8 @@ import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvide
import org.onap.so.logger.MessageEnum;
import org.onap.so.objects.audit.AAIObjectAudit;
import org.onap.so.objects.audit.AAIObjectAuditList;
-import org.onap.so.utils.TargetEntities;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponentsList;
+import org.onap.logging.filter.base.ONAPComponents;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@@ -92,7 +92,7 @@ public class ExceptionBuilder {
}
public void buildAndThrowWorkflowException(BuildingBlockExecution execution, int errorCode, Exception exception,
- TargetEntities extSystemErrorSource) {
+ ONAPComponentsList extSystemErrorSource) {
String msg = "Exception in %s.%s ";
try {
logger.error("Exception occurred", exception);
@@ -156,7 +156,7 @@ public class ExceptionBuilder {
}
public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, Exception exception,
- TargetEntities extSystemErrorSource) {
+ ONAPComponentsList extSystemErrorSource) {
String msg = "Exception in %s.%s ";
try {
logger.error("Exception occurred", exception);
@@ -195,7 +195,7 @@ public class ExceptionBuilder {
}
public void buildAndThrowWorkflowException(BuildingBlockExecution execution, int errorCode, String errorMessage,
- TargetEntities extSystemErrorSource) {
+ ONAPComponentsList extSystemErrorSource) {
if (execution instanceof DelegateExecutionImpl) {
buildAndThrowWorkflowException(((DelegateExecutionImpl) execution).getDelegateExecution(), errorCode,
errorMessage, extSystemErrorSource);
@@ -215,7 +215,7 @@ public class ExceptionBuilder {
}
public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, String errorMessage,
- TargetEntities extSystemErrorSource) {
+ ONAPComponentsList extSystemErrorSource) {
String processKey = getProcessKey(execution);
logger.info("Building a WorkflowException for Subflow");
@@ -293,7 +293,7 @@ public class ExceptionBuilder {
execution.setVariable("StatusMessage", errorMessage.toString());
} else {
WorkflowException exception =
- new WorkflowException(processKey, 400, errorMessage.toString(), TargetEntity.SO);
+ new WorkflowException(processKey, 400, errorMessage.toString(), ONAPComponents.SO);
execution.setVariable("WorkflowException", exception);
execution.setVariable("WorkflowExceptionErrorMessage", errorMessage.toString());
logger.info("Outgoing WorkflowException is {}", exception);
@@ -303,7 +303,7 @@ public class ExceptionBuilder {
} else {
String errorMessage = "Unable to process audit results due to auditInventoryResult being null";
- WorkflowException exception = new WorkflowException(processKey, 400, errorMessage, TargetEntity.SO);
+ WorkflowException exception = new WorkflowException(processKey, 400, errorMessage, ONAPComponents.SO);
execution.setVariable("WorkflowException", exception);
execution.setVariable("WorkflowExceptionErrorMessage", errorMessage);
logger.info("Outgoing WorkflowException is {}", exception);
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy
index d7438f80f9..fda6b8e6e3 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy
@@ -32,7 +32,7 @@ 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.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import org.skyscreamer.jsonassert.JSONAssert
import org.skyscreamer.jsonassert.JSONCompareMode
import org.springframework.core.env.Environment
@@ -127,7 +127,7 @@ class CatalogDbUtilsTest {
private void mockGetResponseFromCatalogDb(String queryEndpoint) {
Environment environmentMock = createEnvironmentMock()
when(environmentMock.getProperty("mso.catalog.db.endpoint")).thenReturn("http://testUrl")
- when(httpClientFactoryMock.newJsonClient(new URL(queryEndpoint), TargetEntity.CATALOG_DB)).thenReturn(httpClientMock)
+ when(httpClientFactoryMock.newJsonClient(new URL(queryEndpoint), ONAPComponents.CATALOG_DB)).thenReturn(httpClientMock)
Response responseMock = mock(Response.class)
when(httpClientMock.get()).thenReturn(responseMock)
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy
index 837bc77f19..7abfcffb13 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy
@@ -26,7 +26,7 @@ import org.junit.Test
import org.onap.logging.ref.slf4j.ONAPLogConstants
import org.onap.so.client.HttpClient
import org.onap.so.client.HttpClientFactory
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import org.springframework.http.HttpStatus
import javax.ws.rs.core.MediaType
@@ -53,7 +53,7 @@ class ExternalAPIUtilTest {
HttpClient httpClient = mock(HttpClient.class)
given(httpClient.get()).willReturn(expectedResponse)
HttpClientFactory httpClientFactory = mock(HttpClientFactory.class)
- given(httpClientFactory.newJsonClient(new URL(URL), TargetEntity.EXTERNAL)).willReturn(httpClient)
+ given(httpClientFactory.newJsonClient(new URL(URL), ONAPComponents.EXTERNAL)).willReturn(httpClient)
// WHEN
ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(httpClientFactory, new DummyMsoUtils(UUID_STR), new ExceptionUtil())
@@ -75,7 +75,7 @@ class ExternalAPIUtilTest {
HttpClient httpClient = mock(HttpClient.class)
willThrow(new RuntimeException("error occurred")).given(httpClient).get()
HttpClientFactory httpClientFactory = mock(HttpClientFactory.class)
- given(httpClientFactory.newJsonClient(new URL(URL), TargetEntity.EXTERNAL)).willReturn(httpClient)
+ given(httpClientFactory.newJsonClient(new URL(URL), ONAPComponents.EXTERNAL)).willReturn(httpClient)
DelegateExecution delegateExecution = createDelegateExecution()
DummyExceptionUtil exceptionUtil = new DummyExceptionUtil()
@@ -97,7 +97,7 @@ class ExternalAPIUtilTest {
HttpClient httpClient = mock(HttpClient.class)
willThrow(new RuntimeException("error occurred")).given(httpClient).post(BODY_PAYLOAD)
HttpClientFactory httpClientFactory = mock(HttpClientFactory.class)
- given(httpClientFactory.newJsonClient(new URL(URL), TargetEntity.AAI)).willReturn(httpClient)
+ given(httpClientFactory.newJsonClient(new URL(URL), ONAPComponents.AAI)).willReturn(httpClient)
DelegateExecution delegateExecution = createDelegateExecution()
DummyExceptionUtil exceptionUtil = new DummyExceptionUtil()
@@ -120,7 +120,7 @@ class ExternalAPIUtilTest {
HttpClient httpClient = mock(HttpClient.class)
given(httpClient.post(BODY_PAYLOAD)).willReturn(expectedResponse)
HttpClientFactory httpClientFactory = mock(HttpClientFactory.class)
- given(httpClientFactory.newJsonClient(new URL(URL), TargetEntity.AAI)).willReturn(httpClient)
+ given(httpClientFactory.newJsonClient(new URL(URL), ONAPComponents.AAI)).willReturn(httpClient)
// WHEN
ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(httpClientFactory, new DummyMsoUtils(UUID_STR), new ExceptionUtil())
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayUnitTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayUnitTest.java
index 6a48558d11..6d5ce622d9 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayUnitTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayUnitTest.java
@@ -33,10 +33,11 @@ import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.logging.filter.base.ONAPComponents;
import org.onap.so.bpmn.core.WorkflowException;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
-import org.onap.so.utils.TargetEntity;
+import org.onap.so.utils.Components;
@RunWith(MockitoJUnitRunner.class)
public class ExecuteBuildingBlockRainyDayUnitTest {
@@ -57,7 +58,7 @@ public class ExecuteBuildingBlockRainyDayUnitTest {
@Before
public void setup() {
- exception = new WorkflowException("Test exception", 7000, "", "", TargetEntity.SDNC);
+ exception = new WorkflowException("Test exception", 7000, "", "", ONAPComponents.SDNC);
noExtSystemErrorSourceException =
new WorkflowException("Test exception without extsystemErrorSource", 7000, "", "");
@@ -75,7 +76,7 @@ public class ExecuteBuildingBlockRainyDayUnitTest {
execution.setVariable("isRollback", false);
execution.setVariable("WorkflowException", exception);
executeBuildingBlockRainyDay.updateExtSystemErrorSource(execution);
- request.setExtSystemErrorSource(TargetEntity.SDNC.toString());
+ request.setExtSystemErrorSource(ONAPComponents.SDNC.toString());
verify(requestsDbClient, Mockito.times(1)).updateInfraActiveRequests(request);
}
@@ -87,42 +88,42 @@ public class ExecuteBuildingBlockRainyDayUnitTest {
execution.setVariable("isRollback", true);
execution.setVariable("WorkflowException", exception);
executeBuildingBlockRainyDay.updateExtSystemErrorSource(execution);
- request.setExtSystemErrorSource(TargetEntity.SDNC.toString());
+ request.setExtSystemErrorSource(ONAPComponents.SDNC.toString());
verify(requestsDbClient, Mockito.times(1)).updateInfraActiveRequests(request);
}
@Test
- public void updateExtSystemErrorSourceisRollbackTargetEntityNullTest() {
+ public void updateExtSystemErrorSourceisRollbackONAPComponentsNullTest() {
doReturn(request).when(requestsDbClient).getInfraActiveRequestbyRequestId(msoRequestId);
doNothing().when(requestsDbClient).updateInfraActiveRequests(request);
execution.setVariable("isRollback", true);
execution.setVariable("WorkflowException", noExtSystemErrorSourceException);
executeBuildingBlockRainyDay.updateExtSystemErrorSource(execution);
- request.setExtSystemErrorSource(TargetEntity.UNKNOWN.toString());
+ request.setExtSystemErrorSource(Components.UNKNOWN.toString());
verify(requestsDbClient, Mockito.times(1)).updateInfraActiveRequests(request);
}
@Test
- public void updateExtSystemErrorSourceTargetEntityNullTest() {
+ public void updateExtSystemErrorSourceONAPComponentsNullTest() {
doReturn(request).when(requestsDbClient).getInfraActiveRequestbyRequestId(msoRequestId);
doNothing().when(requestsDbClient).updateInfraActiveRequests(request);
execution.setVariable("isRollback", false);
execution.setVariable("WorkflowException", noExtSystemErrorSourceException);
executeBuildingBlockRainyDay.updateExtSystemErrorSource(execution);
- request.setExtSystemErrorSource(TargetEntity.UNKNOWN.toString());
+ request.setExtSystemErrorSource(Components.UNKNOWN.toString());
verify(requestsDbClient, Mockito.times(1)).updateInfraActiveRequests(request);
}
@Test
- public void updateExtSystemErrorSourceTargetEntityisRollbackNullTest() {
+ public void updateExtSystemErrorSourceONAPComponentsisRollbackNullTest() {
doReturn(request).when(requestsDbClient).getInfraActiveRequestbyRequestId(msoRequestId);
doNothing().when(requestsDbClient).updateInfraActiveRequests(request);
executionNullisRollback.setVariable("WorkflowException", exception);
executeBuildingBlockRainyDay.updateExtSystemErrorSource(executionNullisRollback);
- request.setExtSystemErrorSource(TargetEntity.SDNC.toString());
+ request.setExtSystemErrorSource(ONAPComponents.SDNC.toString());
verify(requestsDbClient, Mockito.times(1)).updateInfraActiveRequests(request);
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java
index b109ae258d..5baafbba67 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java
@@ -39,7 +39,7 @@ import org.mockito.Mock;
import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.bpmn.common.BuildingBlockExecution;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
@RunWith(MockitoJUnitRunner.class)
public class ExceptionBuilderUnitTest {
@@ -67,12 +67,12 @@ public class ExceptionBuilderUnitTest {
String expectedErrorMessage =
"Exception in org.onap.so.client.exception.ExceptionBuilder.buildAndThrowWorkflowException failure message";
doNothing().when(exceptionBuilder).buildAndThrowWorkflowException(execution, 7000, expectedErrorMessage,
- TargetEntity.SDNC);
+ ONAPComponents.SDNC);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e, TargetEntity.SDNC);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e, ONAPComponents.SDNC);
verify(exceptionBuilder, times(1)).buildAndThrowWorkflowException(execution, 7000, expectedErrorMessage,
- TargetEntity.SDNC);
+ ONAPComponents.SDNC);
}
@Test
@@ -80,12 +80,12 @@ public class ExceptionBuilderUnitTest {
String expectedErrorMessage =
"Exception in org.onap.so.client.exception.ExceptionBuilder.buildAndThrowWorkflowException failure message";
doNothing().when(exceptionBuilder).buildAndThrowWorkflowException(buildingBlockExecution, 7000,
- expectedErrorMessage, TargetEntity.SDNC);
+ expectedErrorMessage, ONAPComponents.SDNC);
- exceptionBuilder.buildAndThrowWorkflowException(buildingBlockExecution, 7000, e, TargetEntity.SDNC);
+ exceptionBuilder.buildAndThrowWorkflowException(buildingBlockExecution, 7000, e, ONAPComponents.SDNC);
verify(exceptionBuilder, times(1)).buildAndThrowWorkflowException(buildingBlockExecution, 7000,
- expectedErrorMessage, TargetEntity.SDNC);
+ expectedErrorMessage, ONAPComponents.SDNC);
}
@Test
@@ -93,6 +93,6 @@ public class ExceptionBuilderUnitTest {
doReturn("Process key").when(exceptionBuilder).getProcessKey(execution);
thrown.expect(BpmnError.class);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), TargetEntity.SDNC);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), ONAPComponents.SDNC);
}
}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java
index 7d5bb0dcf1..f8dfad61f2 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java
@@ -21,7 +21,7 @@
package org.onap.so.bpmn.core;
import java.io.Serializable;
-import org.onap.so.utils.TargetEntities;
+import org.onap.logging.filter.base.ONAPComponentsList;
/**
* An object that represents a workflow exception.
@@ -33,7 +33,7 @@ public class WorkflowException implements Serializable {
private final int errorCode;
private final String errorMessage;
private final String workStep;
- private TargetEntities extSystemErrorSource;
+ private ONAPComponentsList extSystemErrorSource;
/**
* Constructor
@@ -50,7 +50,7 @@ public class WorkflowException implements Serializable {
}
public WorkflowException(String processKey, int errorCode, String errorMessage,
- TargetEntities extSystemErrorSource) {
+ ONAPComponentsList extSystemErrorSource) {
this.processKey = processKey;
this.errorCode = errorCode;
this.errorMessage = errorMessage;
@@ -66,7 +66,7 @@ public class WorkflowException implements Serializable {
}
public WorkflowException(String processKey, int errorCode, String errorMessage, String workStep,
- TargetEntities extSystemErrorSource) {
+ ONAPComponentsList extSystemErrorSource) {
this.processKey = processKey;
this.errorCode = errorCode;
this.errorMessage = errorMessage;
@@ -102,7 +102,7 @@ public class WorkflowException implements Serializable {
return workStep;
}
- public TargetEntities getExtSystemErrorSource() {
+ public ONAPComponentsList getExtSystemErrorSource() {
return extSystemErrorSource;
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java
index a049f81906..03feda6d0f 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java
@@ -38,9 +38,7 @@ import org.onap.so.bpmn.common.workflow.service.WorkflowMessageResource;
import org.onap.so.bpmn.common.workflow.service.WorkflowResource;
import org.onap.so.logging.cxf.interceptor.SOAPLoggingInInterceptor;
import org.onap.so.logging.cxf.interceptor.SOAPLoggingOutInterceptor;
-import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
@@ -65,7 +63,7 @@ public class CXFConfiguration {
private WorkflowAsyncResource workflowAsyncResource;
@Autowired
- private JaxRsFilterLogging jaxRsFilterLogging;
+ private SOAuditLogContainerFilter soAuditLogContainerFilter;
@Autowired
private ObjectMapper mapper;
@@ -108,7 +106,7 @@ public class CXFConfiguration {
endpoint.setServiceBeans(Arrays.<Object>asList(wmr, workflowResource, workflowAsyncResource));
endpoint.setAddress("/");
endpoint.setFeatures(Arrays.asList(createSwaggerFeature(), new LoggingFeature()));
- endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(mapper), jaxRsFilterLogging));
+ endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(mapper), soAuditLogContainerFilter));
return endpoint.create();
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
index a4fc6e54b0..29fc4e93fc 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
@@ -33,7 +33,7 @@ import org.camunda.bpm.engine.repository.DeploymentBuilder;
import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator;
import org.onap.so.db.catalog.beans.Workflow;
import org.onap.so.db.catalog.client.CatalogDbClient;
-import org.onap.so.logging.jaxrs.filter.MDCTaskDecorator;
+import org.onap.logging.filter.spring.MDCTaskDecorator;;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy
index 901964f465..2e664d90da 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy
@@ -37,7 +37,7 @@ import org.slf4j.LoggerFactory
import org.onap.so.bpmn.core.UrnPropertiesReader
import javax.ws.rs.core.Response
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
/**
* This groovy class supports the <class>DoCreateVFCNetworkServiceInstance.bpmn</class> process.
@@ -273,7 +273,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
// Get the Basic Auth credentials for the VFCAdapter, username is 'bpel', auth is '07a7159d3bf51a0e53be7a8f89699be7'
// user 'bepl' authHeader is the same with mso.db.auth
String basicAuthValuedb = UrnPropertiesReader.getVariable("mso.db.auth", execution)
- HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.VNF_ADAPTER)
+ HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.VNF_ADAPTER)
httpClient.addAdditionalHeader("Accept", "application/json")
httpClient.addAdditionalHeader("Authorization", basicAuthValuedb)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy
index 7abdd49d1d..1d3b2757e7 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy
@@ -52,7 +52,7 @@ import org.camunda.bpm.engine.delegate.DelegateExecution
import org.apache.commons.lang3.*
import javax.ws.rs.core.MediaType
import org.apache.commons.codec.binary.Base64
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
/**
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy
index 41a302f5f1..e34e505e55 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy
@@ -35,7 +35,7 @@ import org.onap.so.bpmn.common.scripts.NetworkUtils
import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
import org.onap.so.bpmn.common.scripts.VidUtils
import org.onap.so.bpmn.core.WorkflowException
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import javax.ws.rs.core.Response
import org.camunda.bpm.engine.delegate.BpmnError
@@ -199,7 +199,7 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso
execution.setVariable(Prefix + "urlRollbackPoNetwork", urlRollbackPoNetwork)
URL url = new URL(urlRollbackPoNetwork)
- HttpClient httpClient = new HttpClientFactory().newXmlClient(url, TargetEntity.OPENSTACK_ADAPTER)
+ HttpClient httpClient = new HttpClientFactory().newXmlClient(url, ONAPComponents.OPENSTACK_ADAPTER)
httpClient.addAdditionalHeader("Authorization", execution.getVariable("BasicAuthHeaderValuePO"))
Response response = httpClient.delete(rollbackNetworkRequest)
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 1517a335d9..2def9e2d06 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
@@ -39,7 +39,7 @@ import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.onap.so.bpmn.core.UrnPropertiesReader
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import javax.ws.rs.core.Response
@@ -258,7 +258,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
// Get the Basic Auth credentials for the VFCAdapter, username is 'bpel', auth is '07a7159d3bf51a0e53be7a8f89699be7'
// user 'bepl' authHeader is the same with mso.db.auth
String basicAuthValuedb = UrnPropertiesReader.getVariable("mso.db.auth", execution)
- HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.VNF_ADAPTER)
+ HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.VNF_ADAPTER)
httpClient.addAdditionalHeader("Accept", "application/json")
httpClient.addAdditionalHeader("Authorization", basicAuthValuedb)
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 731c5b8dc5..dafc4b5470 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
@@ -67,7 +67,7 @@ import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import org.w3c.dom.Document
import org.w3c.dom.Element
import org.w3c.dom.NamedNodeMap
@@ -698,7 +698,7 @@ public class DoCreateVfModule extends VfModuleBase {
String endPoint = aaiUriUtil.createAaiUri(uri)
try {
- HttpClient client = httpClientFactory.newXmlClient(new URL(endPoint), TargetEntity.AAI)
+ HttpClient client = httpClientFactory.newXmlClient(new URL(endPoint), ONAPComponents.AAI)
client.addAdditionalHeader('X-TransactionId', UUID.randomUUID().toString())
client.addAdditionalHeader('X-FromAppId', 'MSO')
client.addAdditionalHeader('Content-Type', MediaType.APPLICATION_XML)
@@ -781,7 +781,7 @@ public class DoCreateVfModule extends VfModuleBase {
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, vnfId).queryParam("vf-module-name",vfModuleName)
String endPoint = aaiUriUtil.createAaiUri(uri)
- HttpClient client = httpClientFactory.newXmlClient(new URL(endPoint), TargetEntity.AAI)
+ HttpClient client = httpClientFactory.newXmlClient(new URL(endPoint), ONAPComponents.AAI)
client.addAdditionalHeader('X-TransactionId', UUID.randomUUID().toString())
client.addAdditionalHeader('X-FromAppId', 'MSO')
client.addAdditionalHeader('Content-Type', MediaType.APPLICATION_XML)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy
index 34ea20ba62..a24bc4411e 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy
@@ -54,7 +54,7 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import org.springframework.web.util.UriUtils
import javax.ws.rs.NotFoundException
@@ -388,7 +388,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
String serviceAaiPath = "${aai_endpoint}${urlLink}"
URL url = new URL(serviceAaiPath)
- HttpClient client = new HttpClientFactory().newXmlClient(url, TargetEntity.AAI)
+ HttpClient client = new HttpClientFactory().newXmlClient(url, ONAPComponents.AAI)
client.addBasicAuthHeader(UrnPropertiesReader.getVariable("aai.auth", execution), UrnPropertiesReader.getVariable("mso.msoKey", execution))
client.addAdditionalHeader("X-FromAppId", "MSO")
client.addAdditionalHeader("X-TransactionId", utils.getRequestID())
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 df8735aaaa..09eb7994a8 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
@@ -51,7 +51,7 @@ import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.springframework.web.util.UriUtils
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import groovy.json.JsonOutput
import javax.ws.rs.core.Response
@@ -455,7 +455,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
String vnfAdapterRequest = execution.getVariable(Prefix + "deleteNetworkRequest")
URL url = new URL(vnfAdapterUrl)
- HttpClient httpClient = new HttpClientFactory().newXmlClient(url, TargetEntity.OPENSTACK_ADAPTER)
+ HttpClient httpClient = new HttpClientFactory().newXmlClient(url, ONAPComponents.OPENSTACK_ADAPTER)
httpClient.accept = "application/xml"
httpClient.addAdditionalHeader("Authorization", execution.getVariable("BasicAuthHeaderValuePO"))
Response response = httpClient.delete(vnfAdapterRequest)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy
index 00244aded0..28f4460d71 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy
@@ -34,7 +34,7 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import org.onap.so.bpmn.core.UrnPropertiesReader
import javax.ws.rs.core.Response
@@ -226,7 +226,7 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
// Get the Basic Auth credentials for the VFCAdapter, username is 'bpel', auth is '07a7159d3bf51a0e53be7a8f89699be7'
// user 'bepl' authHeader is the same with mso.db.auth
String basicAuthValuedb = UrnPropertiesReader.getVariable("mso.db.auth", execution)
- HttpClient httpClient = httpClientFactory.newJsonClient(url, TargetEntity.VNF_ADAPTER)
+ HttpClient httpClient = httpClientFactory.newJsonClient(url, ONAPComponents.VNF_ADAPTER)
httpClient.addAdditionalHeader("Accept", "application/json")
httpClient.addAdditionalHeader("Authorization", basicAuthValuedb)
@@ -257,7 +257,7 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
// Get the Basic Auth credentials for the VFCAdapter, username is 'bpel', auth is '07a7159d3bf51a0e53be7a8f89699be7'
// user 'bepl' authHeader is the same with mso.db.auth
String basicAuthValuedb = UrnPropertiesReader.getVariable("mso.db.auth", execution)
- HttpClient httpClient = httpClientFactory.newJsonClient(url, TargetEntity.VNF_ADAPTER)
+ HttpClient httpClient = httpClientFactory.newJsonClient(url, ONAPComponents.VNF_ADAPTER)
httpClient.addAdditionalHeader("Accept", "application/json")
httpClient.addAdditionalHeader("Authorization", basicAuthValuedb)
httpClient.addAdditionalHeader("Content-Type", "application/json")
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 2a8cc08cdf..367975e003 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
@@ -51,7 +51,7 @@ import org.onap.so.bpmn.infrastructure.vfcmodel.LocationConstraint
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
@@ -209,7 +209,7 @@ public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcess
try{
URL url = new URL(urlString);
- HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.VNF_ADAPTER)
+ HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.VNF_ADAPTER)
httpClient.addAdditionalHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk")
apiResponse = httpClient.post(requestBody)
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 75ac6900fa..cfdba89db7 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
@@ -45,7 +45,7 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
/**
* This class supports the VID Flow
@@ -164,7 +164,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor {
logger.debug("AAI endPoint: " + endPoint)
try {
- HttpClient client = new HttpClientFactory().newXmlClient(new URL(endPoint), TargetEntity.AAI)
+ HttpClient client = new HttpClientFactory().newXmlClient(new URL(endPoint), ONAPComponents.AAI)
client.addAdditionalHeader('X-TransactionId', UUID.randomUUID().toString())
client.addAdditionalHeader('X-FromAppId', 'MSO')
client.addAdditionalHeader('Content-Type', 'application/xml')
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
index f1fd23fe82..f10b503ed3 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
@@ -65,7 +65,7 @@ import org.onap.so.client.sniro.beans.ServiceInfo;
import org.onap.so.client.sniro.beans.SniroManagerRequest;
import org.onap.so.client.sniro.beans.SubscriberInfo;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -162,14 +162,14 @@ public class SniroHomingV2 {
} catch (BpmnError e) {
logger.error(EXCEPTION_OCCURRED, e);
exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage(),
- TargetEntity.SNIRO);
+ ONAPComponents.SNIRO);
} catch (BadResponseException e) {
logger.error(EXCEPTION_OCCURRED, e);
- exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage(), TargetEntity.SNIRO);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage(), ONAPComponents.SNIRO);
} catch (Exception e) {
logger.error(EXCEPTION_OCCURRED, e);
exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL,
- "Internal Error - occurred while preparing sniro request: " + e.getMessage(), TargetEntity.SO);
+ "Internal Error - occurred while preparing sniro request: " + e.getMessage(), ONAPComponents.SO);
}
}
@@ -214,15 +214,15 @@ public class SniroHomingV2 {
} catch (BpmnError e) {
logger.error(EXCEPTION_OCCURRED, e);
exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage(),
- TargetEntity.SNIRO);
+ ONAPComponents.SNIRO);
} catch (BadResponseException e) {
logger.error(EXCEPTION_OCCURRED, e);
- exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage(), TargetEntity.SNIRO);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage(), ONAPComponents.SNIRO);
} catch (Exception e) {
logger.error(EXCEPTION_OCCURRED, e);
exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL,
"Internal Error - occurred while processing sniro asynchronous response: " + e.getMessage(),
- TargetEntity.SO);
+ ONAPComponents.SO);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java
index e9d33f46ab..2705d00d6b 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java
@@ -38,11 +38,12 @@ import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.NetworkAdapterResources;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import org.onap.so.utils.Components;
@Component
public class NetworkAdapterRestV1 {
@@ -94,7 +95,7 @@ public class NetworkAdapterRestV1 {
throw new Exception("No Network Request was created. networkAdapterRequest was null.");
}
} catch (Exception ex) {
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO);
}
}
@@ -139,7 +140,7 @@ public class NetworkAdapterRestV1 {
}
} catch (Exception e) {
logger.error("Error in Openstack Adapter callback", e);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), TargetEntity.OPENSTACK);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), Components.OPENSTACK);
}
}
@@ -152,7 +153,7 @@ public class NetworkAdapterRestV1 {
public void handleTimeOutException(DelegateExecution execution) {
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,
- "Error timed out waiting on Openstack Async-Response", TargetEntity.SO);
+ "Error timed out waiting on Openstack Async-Response", ONAPComponents.SO);
}
public void handleSyncError(DelegateExecution execution) {
@@ -160,6 +161,6 @@ public class NetworkAdapterRestV1 {
String responseString = (String) execution.getVariable(NETWORK_SYNC_RESPONSE);
String errorMessage = "Error with Openstack Adapter Sync Request: StatusCode = " + statusCode + " Response = "
+ responseString;
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, errorMessage, TargetEntity.OPENSTACK);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, errorMessage, Components.OPENSTACK);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java
index 080d6d34b1..192cb3fc90 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java
@@ -32,7 +32,7 @@ import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.SDNCVnfResources;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
import org.onap.so.client.orchestration.SDNCVfModuleResources;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -80,13 +80,13 @@ public class SDNCQueryTasks {
} catch (BadResponseException ex) {
logger.error("Exception occurred", ex);
if (!ex.getMessage().equals(NO_RESPONSE_FROM_SDNC)) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SDNC);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SDNC);
} else {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO);
}
} catch (Exception ex) {
logger.error("Exception occurred", ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO);
}
}
@@ -121,9 +121,9 @@ public class SDNCQueryTasks {
} catch (BadResponseException ex) {
logger.error("Exception occurred for BadResponse ", ex);
if (!ex.getMessage().equals(NO_RESPONSE_FROM_SDNC)) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SDNC);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SDNC);
} else {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO);
}
} catch (Exception ex) {
logger.error("Exception occurred", ex);
@@ -158,18 +158,18 @@ public class SDNCQueryTasks {
// module id, then we should throw
// the error as normal
if (!ResourceKey.VF_MODULE_ID.equals(bbException.getResourceKey())) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, bbException, TargetEntity.SO);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, bbException, ONAPComponents.SO);
}
} catch (BadResponseException ex) {
logger.error("Error occurred for BadResponseException in SDNCQueryTasks queryVfModuleForVolumeGroup ", ex);
if (!ex.getMessage().equals(NO_RESPONSE_FROM_SDNC)) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SDNC);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SDNC);
} else {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO);
}
} catch (Exception ex) {
logger.error("Exception occurred", ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO);
}
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java
index 03714db943..3383fde0a8 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java
@@ -37,7 +37,7 @@ import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.SDNCClient;
import org.onap.so.client.sdnc.beans.SDNCRequest;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -80,19 +80,19 @@ public class SDNCRequestTasks {
} catch (PathNotFoundException e) {
logger.error("Error Parsing SDNC Response. Could not find read final ack indicator from JSON.", e);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,
- "Recieved invalid response from SDNC, unable to read message content.", TargetEntity.SO);
+ "Recieved invalid response from SDNC, unable to read message content.", ONAPComponents.SO);
} catch (MapperException e) {
logger.error("Failed to map SDNC object to JSON prior to POST.", e);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,
- "Failed to map SDNC object to JSON prior to POST.", TargetEntity.SO);
+ "Failed to map SDNC object to JSON prior to POST.", ONAPComponents.SO);
} catch (BadResponseException e) {
logger.error("Did not receive a successful response from SDNC.", e);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getLocalizedMessage(),
- TargetEntity.SDNC);
+ ONAPComponents.SDNC);
} catch (HttpClientErrorException e) {
logger.error("HttpClientErrorException: 404 Not Found, Failed to contact SDNC", e);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "SDNC cannot be contacted.",
- TargetEntity.SO);
+ ONAPComponents.SO);
}
}
@@ -123,17 +123,17 @@ public class SDNCRequestTasks {
}
} catch (SDNCErrorResponseException e) {
logger.error("SDNC error response - " + e.getMessage());
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), TargetEntity.SDNC);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), ONAPComponents.SDNC);
} catch (Exception e) {
logger.error("Error processing SDNC callback", e);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "Error processing SDNC callback",
- TargetEntity.SO);
+ ONAPComponents.SO);
}
}
public void handleTimeOutException(DelegateExecution execution) {
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,
- "Error timed out waiting on SDNC Async-Response", TargetEntity.SO);
+ "Error timed out waiting on SDNC Async-Response", ONAPComponents.SO);
}
protected boolean convertIndicatorToBoolean(String finalMessageIndicator) {
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java
index 8aea2d2650..3994208d23 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java
@@ -39,7 +39,8 @@ import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.exception.MapperException;
-import org.onap.so.utils.TargetEntity;
+import org.onap.so.utils.Components;
+import org.onap.logging.filter.base.ONAPComponents;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.eq;
@@ -113,7 +114,7 @@ public class NetworkAdapterRestV1Test extends BaseTaskTest {
delegateExecution.setVariable("NetworkAResponse_MESSAGE", updateNetworkResponse.toXmlString());
doThrow(new BpmnError("MSOWorkflowException")).when(exceptionBuilder).buildAndThrowWorkflowException(
- any(DelegateExecution.class), anyInt(), any(String.class), any(TargetEntity.class));
+ any(DelegateExecution.class), anyInt(), any(String.class), any(ONAPComponents.class));
try {
networkAdapterRestV1Tasks.processCallback(delegateExecution);
@@ -122,6 +123,6 @@ public class NetworkAdapterRestV1Test extends BaseTaskTest {
}
assertNull(delegateExecution.getVariable("updateNetworkResponse"));
verify(exceptionBuilder, times(1)).buildAndThrowWorkflowException(any(DelegateExecution.class), eq(7000),
- eq("test error message"), eq(TargetEntity.OPENSTACK));
+ eq("test error message"), eq(Components.OPENSTACK));
}
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java
index 0ba9237aaf..e158925568 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java
@@ -44,8 +44,8 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.client.exception.BadResponseException;
-import org.onap.so.utils.TargetEntities;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponentsList;
+import org.onap.logging.filter.base.ONAPComponents;
public class SDNCQueryTasksTest extends BaseTaskTest {
@InjectMocks
@@ -65,7 +65,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest {
vfModule = setVfModule();
doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(
- any(BuildingBlockExecution.class), eq(7000), any(Exception.class), any(TargetEntities.class));
+ any(BuildingBlockExecution.class), eq(7000), any(Exception.class), any(ONAPComponentsList.class));
when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
.thenReturn(serviceInstance);
@@ -98,7 +98,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest {
expectedException.expect(BpmnError.class);
sdncQueryTasks.queryVfModule(execution);
- verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SDNC);
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, ONAPComponents.SDNC);
}
@Test
@@ -109,7 +109,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest {
expectedException.expect(BpmnError.class);
sdncQueryTasks.queryVfModule(execution);
- verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SO);
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, ONAPComponents.SO);
}
@Test
@@ -133,7 +133,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest {
expectedException.expect(BpmnError.class);
sdncQueryTasks.queryVnf(execution);
- verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SDNC);
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, ONAPComponents.SDNC);
}
@Test
@@ -144,7 +144,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest {
expectedException.expect(BpmnError.class);
sdncQueryTasks.queryVnf(execution);
- verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SO);
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, ONAPComponents.SO);
}
@Test
@@ -169,7 +169,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest {
expectedException.expect(BpmnError.class);
sdncQueryTasks.queryVfModuleForVolumeGroup(execution);
- verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SDNC);
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, ONAPComponents.SDNC);
}
@Test
@@ -180,7 +180,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest {
expectedException.expect(BpmnError.class);
sdncQueryTasks.queryVfModuleForVolumeGroup(execution);
- verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SO);
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, ONAPComponents.SO);
}
@Test
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java
index 0fc33fe5ce..e435909f59 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java
@@ -49,7 +49,7 @@ import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.SDNCClient;
import org.onap.so.client.sdnc.beans.SDNCRequest;
import org.onap.so.client.sdnc.endpoint.SDNCTopology;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import com.fasterxml.jackson.core.JsonParseException;
diff --git a/common/pom.xml b/common/pom.xml
index 1a4ffe13a8..9e4382621a 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -118,11 +118,6 @@
<artifactId>spring-security-web</artifactId>
</dependency>
<dependency>
- <groupId>org.onap.logging-analytics</groupId>
- <artifactId>logging-slf4j</artifactId>
- <version>1.2.2</version>
- </dependency>
- <dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
</dependency>
diff --git a/common/src/main/java/org/onap/so/client/BaseClient.java b/common/src/main/java/org/onap/so/client/BaseClient.java
index d939a33358..d1523a1f96 100644
--- a/common/src/main/java/org/onap/so/client/BaseClient.java
+++ b/common/src/main/java/org/onap/so/client/BaseClient.java
@@ -22,7 +22,7 @@ package org.onap.so.client;
import java.util.ArrayList;
import java.util.List;
-import org.onap.so.logging.jaxrs.filter.SpringClientFilter;
+import org.onap.so.logging.jaxrs.filter.SOSpringClientFilter;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
@@ -80,7 +80,7 @@ public class BaseClient<I, O> {
RestTemplate restTemplate = new RestTemplate();
restTemplate
.setRequestFactory(new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory()));
- restTemplate.getInterceptors().add(new SpringClientFilter());
+ restTemplate.getInterceptors().add(new SOSpringClientFilter());
ResponseEntity<O> responseEntity =
restTemplate.exchange(getTargetUrl(), method, requestEntity, typeRef, uriVariables);
return responseEntity.getBody();
diff --git a/common/src/main/java/org/onap/so/client/HttpClient.java b/common/src/main/java/org/onap/so/client/HttpClient.java
index 715ba32831..63a4b1cd65 100644
--- a/common/src/main/java/org/onap/so/client/HttpClient.java
+++ b/common/src/main/java/org/onap/so/client/HttpClient.java
@@ -24,22 +24,22 @@ import java.net.URL;
import java.util.Map;
import java.util.Optional;
import static org.apache.commons.lang3.StringUtils.*;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class HttpClient extends RestClient {
protected final Logger log = LoggerFactory.getLogger(HttpClient.class);
- private TargetEntity targetEntity;
+ private ONAPComponents targetEntity;
- HttpClient(URL host, String contentType, TargetEntity targetEntity) {
+ HttpClient(URL host, String contentType, ONAPComponents targetEntity) {
super(host, contentType);
this.targetEntity = targetEntity;
}
@Override
- public TargetEntity getTargetEntity() {
+ public ONAPComponents getTargetEntity() {
return targetEntity;
}
diff --git a/common/src/main/java/org/onap/so/client/HttpClientFactory.java b/common/src/main/java/org/onap/so/client/HttpClientFactory.java
index d02c18ff56..3a8a9ee1bd 100644
--- a/common/src/main/java/org/onap/so/client/HttpClientFactory.java
+++ b/common/src/main/java/org/onap/so/client/HttpClientFactory.java
@@ -21,19 +21,19 @@ package org.onap.so.client;
import java.net.URL;
import javax.ws.rs.core.MediaType;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
public class HttpClientFactory {
- public HttpClient newJsonClient(URL host, TargetEntity targetEntity) {
+ public HttpClient newJsonClient(URL host, ONAPComponents targetEntity) {
return new HttpClient(host, MediaType.APPLICATION_JSON, targetEntity);
}
- public HttpClient newXmlClient(URL host, TargetEntity targetEntity) {
+ public HttpClient newXmlClient(URL host, ONAPComponents targetEntity) {
return new HttpClient(host, MediaType.APPLICATION_XML, targetEntity);
}
- public HttpClient newTextXmlClient(URL host, TargetEntity targetEntity) {
+ public HttpClient newTextXmlClient(URL host, ONAPComponents targetEntity) {
return new HttpClient(host, MediaType.TEXT_XML, targetEntity);
}
}
diff --git a/common/src/main/java/org/onap/so/client/RestClient.java b/common/src/main/java/org/onap/so/client/RestClient.java
index d3a4d444f7..c8d7dc9f5c 100644
--- a/common/src/main/java/org/onap/so/client/RestClient.java
+++ b/common/src/main/java/org/onap/so/client/RestClient.java
@@ -44,11 +44,13 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import javax.ws.rs.core.UriBuilder;
+import org.onap.logging.filter.base.MDCSetup;
+import org.onap.logging.filter.base.ONAPComponentsList;
+import org.onap.logging.filter.base.PayloadLoggingClientFilter;
import org.onap.so.client.policy.CommonObjectMapperProvider;
-import org.onap.so.logging.jaxrs.filter.JaxRsClientLogging;
-import org.onap.so.logging.jaxrs.filter.PayloadLoggingFilter;
+import org.onap.so.logging.jaxrs.filter.SOMetricLogClientFilter;
import org.onap.so.utils.CryptoUtils;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
@@ -71,7 +73,8 @@ public abstract class RestClient {
protected String accept;
protected String contentType;
protected String requestId = "";
- protected JaxRsClientLogging jaxRsClientLogging;
+ protected SOMetricLogClientFilter metricLogClientFilter;
+ protected MDCSetup mdcSetup = new MDCSetup();
protected RestProperties props;
protected RestClient(RestProperties props, Optional<URI> path) {
@@ -179,18 +182,18 @@ public abstract class RestClient {
return ClientBuilder.newBuilder().build();
}
- protected abstract TargetEntity getTargetEntity();
+ protected abstract ONAPComponentsList getTargetEntity();
protected void initializeClient(Client client) {
if (this.enableLogging()) {
- client.register(new PayloadLoggingFilter(this.getMaxPayloadSize()));
+ client.register(new PayloadLoggingClientFilter(this.getMaxPayloadSize()));
}
CommonObjectMapperProvider provider = this.getCommonObjectMapperProvider();
client.register(new JacksonJsonProvider(provider.getMapper()));
- jaxRsClientLogging = new JaxRsClientLogging();
- jaxRsClientLogging.setTargetService(getTargetEntity());
- client.register(jaxRsClientLogging);
+ metricLogClientFilter = new SOMetricLogClientFilter();
+ mdcSetup.setTargetEntity(getTargetEntity());
+ client.register(metricLogClientFilter);
if (!path.isPresent()) {
webTarget = client.target(host.toString());
diff --git a/common/src/main/java/org/onap/so/client/RestTemplateConfig.java b/common/src/main/java/org/onap/so/client/RestTemplateConfig.java
index 0633ae74c9..5fbc9126cf 100644
--- a/common/src/main/java/org/onap/so/client/RestTemplateConfig.java
+++ b/common/src/main/java/org/onap/so/client/RestTemplateConfig.java
@@ -21,7 +21,7 @@
package org.onap.so.client;
import org.onap.so.configuration.rest.HttpComponentsClientConfiguration;
-import org.onap.so.logging.jaxrs.filter.SpringClientFilter;
+import org.onap.so.logging.jaxrs.filter.SOSpringClientFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
@@ -45,7 +45,7 @@ public class RestTemplateConfig {
final RestTemplate restTemplate = new RestTemplate();
restTemplate
.setRequestFactory(new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory()));
- restTemplate.getInterceptors().add(new SpringClientFilter());
+ restTemplate.getInterceptors().add(new SOSpringClientFilter());
return restTemplate;
}
@@ -56,7 +56,7 @@ public class RestTemplateConfig {
httpComponentsClientConfiguration.httpComponentsClientHttpRequestFactory();
final RestTemplate restTemplate =
new RestTemplate(new BufferingClientHttpRequestFactory(clientHttpRequestFactory));
- restTemplate.getInterceptors().add(new SpringClientFilter());
+ restTemplate.getInterceptors().add(new SOSpringClientFilter());
return restTemplate;
}
}
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java b/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java
index b546aaa23e..610ff728e9 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java
@@ -26,7 +26,7 @@ import java.util.Optional;
import org.onap.so.client.ResponseExceptionMapper;
import org.onap.so.client.graphinventory.GraphInventoryPatchConverter;
import org.onap.so.client.graphinventory.GraphInventoryRestClient;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
public class AAIRestClient extends GraphInventoryRestClient {
@@ -38,8 +38,8 @@ public class AAIRestClient extends GraphInventoryRestClient {
}
@Override
- public TargetEntity getTargetEntity() {
- return TargetEntity.AAI;
+ public ONAPComponents getTargetEntity() {
+ return ONAPComponents.AAI;
}
@Override
diff --git a/common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestClient.java b/common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestClient.java
index d6c7072c14..88899a7097 100644
--- a/common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestClient.java
+++ b/common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestClient.java
@@ -29,7 +29,7 @@ import org.onap.so.client.RestClient;
import org.onap.so.client.policy.CommonObjectMapperProvider;
import org.onap.so.client.policy.JettisonStyleMapperProvider;
import org.onap.so.utils.CryptoUtils;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
public class AdapterRestClient extends RestClient {
@@ -46,8 +46,8 @@ public class AdapterRestClient extends RestClient {
}
@Override
- public TargetEntity getTargetEntity() {
- return TargetEntity.OPENSTACK_ADAPTER;
+ public ONAPComponents getTargetEntity() {
+ return ONAPComponents.OPENSTACK_ADAPTER;
}
@Override
diff --git a/common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java b/common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java
index 68b4e84448..b0ffb9358c 100644
--- a/common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java
@@ -22,11 +22,15 @@ package org.onap.so.client.dmaap.rest;
import java.net.URL;
import java.util.Map;
+import java.util.UUID;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.client.RestClient;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
+import org.slf4j.MDC;
public class DMaaPRestClient extends RestClient {
+ private static final String SO = "SO";
private final String auth;
private final String key;
@@ -37,8 +41,8 @@ public class DMaaPRestClient extends RestClient {
}
@Override
- public TargetEntity getTargetEntity() {
- return TargetEntity.DMAAP;
+ public ONAPComponents getTargetEntity() {
+ return ONAPComponents.DMAAP;
}
@Override
@@ -46,6 +50,8 @@ public class DMaaPRestClient extends RestClient {
if (auth != null && !auth.isEmpty() && key != null && !key.isEmpty()) {
addBasicAuthHeader(auth, key);
}
+ String onapRequestId = UUID.randomUUID().toString();
+ headerMap.put(ONAPLogConstants.Headers.REQUEST_ID, onapRequestId);
+ headerMap.put(ONAPLogConstants.Headers.INVOCATION_ID, MDC.get(ONAPLogConstants.MDCs.REQUEST_ID));
}
-
}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryRestClient.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryRestClient.java
index 434c65da46..babfa14d71 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryRestClient.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryRestClient.java
@@ -28,7 +28,8 @@ import org.onap.so.client.ResponseExceptionMapper;
import org.onap.so.client.RestClientSSL;
import org.onap.so.client.RestProperties;
import org.onap.so.client.policy.CommonObjectMapperProvider;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
+import org.onap.logging.filter.base.ONAPComponentsList;
public abstract class GraphInventoryRestClient extends RestClientSSL {
@@ -42,7 +43,7 @@ public abstract class GraphInventoryRestClient extends RestClientSSL {
}
@Override
- public abstract TargetEntity getTargetEntity();
+ public abstract ONAPComponentsList getTargetEntity();
@Override
protected abstract void initializeHeaderMap(Map<String, String> headerMap);
diff --git a/common/src/main/java/org/onap/so/client/grm/GRMRestClient.java b/common/src/main/java/org/onap/so/client/grm/GRMRestClient.java
index 507f1130b5..147f688ea8 100644
--- a/common/src/main/java/org/onap/so/client/grm/GRMRestClient.java
+++ b/common/src/main/java/org/onap/so/client/grm/GRMRestClient.java
@@ -25,7 +25,7 @@ import java.net.URI;
import java.util.Map;
import java.util.Optional;
import org.onap.so.client.RestClient;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
public class GRMRestClient extends RestClient {
@@ -37,8 +37,8 @@ public class GRMRestClient extends RestClient {
}
@Override
- public TargetEntity getTargetEntity() {
- return TargetEntity.GRM;
+ public ONAPComponents getTargetEntity() {
+ return ONAPComponents.GRM;
}
@Override
diff --git a/common/src/main/java/org/onap/so/client/policy/PolicyRestClient.java b/common/src/main/java/org/onap/so/client/policy/PolicyRestClient.java
index 95bc4282ae..33ece07e3d 100644
--- a/common/src/main/java/org/onap/so/client/policy/PolicyRestClient.java
+++ b/common/src/main/java/org/onap/so/client/policy/PolicyRestClient.java
@@ -26,7 +26,7 @@ import java.util.Optional;
import javax.ws.rs.core.UriBuilder;
import org.onap.so.client.RestClient;
import org.onap.so.client.policy.entities.PolicyServiceType;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
public class PolicyRestClient extends RestClient {
@@ -38,8 +38,8 @@ public class PolicyRestClient extends RestClient {
}
@Override
- public TargetEntity getTargetEntity() {
- return TargetEntity.POLICY;
+ public ONAPComponents getTargetEntity() {
+ return ONAPComponents.POLICY;
}
@Override
diff --git a/common/src/main/java/org/onap/so/externaltasks/logging/AuditMDCSetup.java b/common/src/main/java/org/onap/so/externaltasks/logging/AuditMDCSetup.java
new file mode 100644
index 0000000000..8d30ad35ff
--- /dev/null
+++ b/common/src/main/java/org/onap/so/externaltasks/logging/AuditMDCSetup.java
@@ -0,0 +1,56 @@
+package org.onap.so.externaltasks.logging;
+
+import java.time.ZoneOffset;
+import java.time.ZonedDateTime;
+import java.time.format.DateTimeFormatter;
+import org.camunda.bpm.client.task.ExternalTask;
+import org.onap.logging.filter.base.MDCSetup;
+import org.onap.logging.filter.base.ONAPComponents;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.so.logger.MdcConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+import org.springframework.stereotype.Component;
+
+@Component
+public class AuditMDCSetup {
+
+ private MDCSetup mdcSetup = new MDCSetup();
+
+ private static final Logger logger = LoggerFactory.getLogger(AuditMDCSetup.class);
+
+ public void setupMDC(ExternalTask externalTask) {
+ MDC.put(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP,
+ ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT));
+ String msoRequestId = externalTask.getVariable("mso-request-id");
+ if (msoRequestId != null && !msoRequestId.isEmpty()) {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, msoRequestId);
+ }
+ MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, externalTask.getTopicName());
+ MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME, ONAPComponents.OPENSTACK_ADAPTER.toString());
+ setResponseCode(ONAPLogConstants.ResponseStatus.INPROGRESS.toString());
+ setElapsedTime();
+ mdcSetup.setServerFQDN();
+ logger.info(ONAPLogConstants.Markers.ENTRY, "Entering");
+ }
+
+ public void setElapsedTime() {
+ DateTimeFormatter timeFormatter = DateTimeFormatter.ISO_ZONED_DATE_TIME;
+ MDC.put(ONAPLogConstants.MDCs.ELAPSED_TIME, Long.toString(System.currentTimeMillis() - ZonedDateTime
+ .parse(MDC.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP), timeFormatter).toInstant().toEpochMilli()));
+ }
+
+ public void setResponseCode(String code) {
+ MDC.put(MdcConstants.OPENSTACK_STATUS_CODE, code);
+ MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, code);
+ }
+
+ public void clearClientMDCs() {
+ MDC.remove(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE);
+ MDC.remove(MdcConstants.OPENSTACK_STATUS_CODE);
+ MDC.remove(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP);
+ MDC.remove(ONAPLogConstants.MDCs.ELAPSED_TIME);
+ MDC.remove(ONAPLogConstants.MDCs.PARTNER_NAME);
+ }
+}
diff --git a/common/src/main/java/org/onap/so/logger/HttpHeadersConstants.java b/common/src/main/java/org/onap/so/logger/HttpHeadersConstants.java
index 83b860ff01..2010bc1988 100644
--- a/common/src/main/java/org/onap/so/logger/HttpHeadersConstants.java
+++ b/common/src/main/java/org/onap/so/logger/HttpHeadersConstants.java
@@ -21,13 +21,5 @@
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/LogConstants.java b/common/src/main/java/org/onap/so/logger/LogConstants.java
index 30915c6171..3dc0c062c6 100644
--- a/common/src/main/java/org/onap/so/logger/LogConstants.java
+++ b/common/src/main/java/org/onap/so/logger/LogConstants.java
@@ -21,8 +21,6 @@
package org.onap.so.logger;
public class LogConstants {
- public static final String TARGET_ENTITY_HEADER = "X-Target-Entity";
- public static final String UNKNOWN_TARGET_ENTITY = "Unknown-Target-Entity";
public static final String HTTP_URL = "Http-Url";
public static final String URI_BASE = "Uri-Base";
}
diff --git a/common/src/main/java/org/onap/so/logger/MdcConstants.java b/common/src/main/java/org/onap/so/logger/MdcConstants.java
index 33fceb2f0f..4c6672e59f 100644
--- a/common/src/main/java/org/onap/so/logger/MdcConstants.java
+++ b/common/src/main/java/org/onap/so/logger/MdcConstants.java
@@ -21,14 +21,6 @@
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";
public static final String ORIGINAL_PARTNER_NAME = "OriginalPartnerName";
+ public static final String OPENSTACK_STATUS_CODE = "OpenstackStatusCode";
}
diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsClientLogging.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsClientLogging.java
deleted file mode 100644
index 5dbf88d346..0000000000
--- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsClientLogging.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. 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.logging.jaxrs.filter;
-
-
-import org.onap.logging.ref.slf4j.ONAPLogConstants;
-import org.onap.so.utils.TargetEntity;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.slf4j.MDC;
-import org.springframework.stereotype.Component;
-import javax.annotation.Priority;
-import javax.ws.rs.client.ClientRequestContext;
-import javax.ws.rs.client.ClientRequestFilter;
-import javax.ws.rs.client.ClientResponseContext;
-import javax.ws.rs.client.ClientResponseFilter;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.ext.Providers;
-import java.time.ZoneOffset;
-import java.time.ZonedDateTime;
-import java.time.format.DateTimeFormatter;
-import java.util.UUID;
-
-@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
-@Component
-@Priority(0)
-public class JaxRsClientLogging implements ClientRequestFilter, ClientResponseFilter {
-
- @Context
- private Providers providers;
-
- private static final String TRACE = "trace-#";
- private static final String SO = "SO";
- private static Logger logger = LoggerFactory.getLogger(JaxRsClientLogging.class);
-
- public void setTargetService(TargetEntity targetEntity) {
- MDC.put(ONAPLogConstants.MDCs.TARGET_ENTITY, targetEntity.toString());
- }
-
- @Override
- public void filter(ClientRequestContext clientRequest) {
- try {
- setupMDC(clientRequest);
- setupHeaders(clientRequest);
- logger.info(ONAPLogConstants.Markers.INVOKE, "Invoke");
- } catch (Exception e) {
- logger.warn("Error in incoming JAX-RS Inteceptor", e);
- }
- }
-
- private void setupHeaders(ClientRequestContext clientRequest) {
- MultivaluedMap<String, Object> headers = clientRequest.getHeaders();
- headers.add(ONAPLogConstants.Headers.REQUEST_ID, extractRequestID(clientRequest));
- headers.add(ONAPLogConstants.Headers.INVOCATION_ID, MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID));
- headers.add(ONAPLogConstants.Headers.PARTNER_NAME, SO);
- }
-
- private void setupMDC(ClientRequestContext clientRequest) {
- MDC.put(ONAPLogConstants.MDCs.INVOKE_TIMESTAMP,
- ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT));
- MDC.put(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME, clientRequest.getUri().toString());
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.INPROGRESS.toString());
- setInvocationId();
- MDC.put(ONAPLogConstants.MDCs.TARGET_ENTITY, MDC.get(ONAPLogConstants.MDCs.TARGET_ENTITY));
- }
-
- private String extractRequestID(ClientRequestContext clientRequest) {
- String requestId = MDC.get(ONAPLogConstants.MDCs.REQUEST_ID);
- if (requestId == null || requestId.isEmpty() || requestId.equals(TRACE)) {
- requestId = UUID.randomUUID().toString();
- logger.warn("Could not Find Request ID Generating New One: {}", clientRequest.getUri().getPath());
- }
- return requestId;
- }
-
- private void setInvocationId() {
- String invocationId = MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID);
- if (invocationId == null || invocationId.isEmpty())
- invocationId = UUID.randomUUID().toString();
- MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, invocationId);
- }
-
-
- @Override
- public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext) {
-
- try {
- String statusCode;
- if (Response.Status.Family.familyOf(responseContext.getStatus())
- .equals(Response.Status.Family.SUCCESSFUL)) {
- statusCode = ONAPLogConstants.ResponseStatus.COMPLETED.toString();
- } else {
- statusCode = ONAPLogConstants.ResponseStatus.ERROR.toString();
- }
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE, String.valueOf(responseContext.getStatus()));
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, statusCode);
- logger.info(ONAPLogConstants.Markers.INVOKE_RETURN, "InvokeReturn");
- clearClientMDCs();
- } catch (Exception e) {
- logger.warn("Error in outgoing JAX-RS Inteceptor", e);
- }
- }
-
- private void clearClientMDCs() {
- MDC.remove(ONAPLogConstants.MDCs.INVOCATION_ID);
- MDC.remove(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION);
- MDC.remove(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE);
- MDC.remove(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION);
- MDC.remove(ONAPLogConstants.MDCs.RESPONSE_CODE);
- MDC.remove(ONAPLogConstants.MDCs.TARGET_ENTITY);
- MDC.remove(ONAPLogConstants.MDCs.PARTNER_NAME);
- MDC.remove(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME);
- MDC.remove(ONAPLogConstants.MDCs.INVOKE_TIMESTAMP);
- }
-
-}
diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java
deleted file mode 100644
index 7e2b603ba6..0000000000
--- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. 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.logging.jaxrs.filter;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.UUID;
-import javax.annotation.Priority;
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.container.ContainerRequestContext;
-import javax.ws.rs.container.ContainerRequestFilter;
-import javax.ws.rs.container.ContainerResponseContext;
-import javax.ws.rs.container.ContainerResponseFilter;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.ext.MessageBodyWriter;
-import javax.ws.rs.ext.Provider;
-import javax.ws.rs.ext.Providers;
-import org.onap.logging.ref.slf4j.ONAPLogConstants;
-import org.onap.so.logger.HttpHeadersConstants;
-import org.onap.so.logger.LogConstants;
-import org.onap.so.logger.MdcConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.slf4j.MDC;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-@Priority(1)
-@Provider
-@Component
-public class JaxRsFilterLogging implements ContainerRequestFilter, ContainerResponseFilter {
-
- protected static Logger logger = LoggerFactory.getLogger(JaxRsFilterLogging.class);
-
- @Context
- private HttpServletRequest httpServletRequest;
-
- @Context
- private Providers providers;
-
- @Autowired
- private MDCSetup mdcSetup;
-
- @Override
- public void filter(ContainerRequestContext containerRequest) {
- try {
- MultivaluedMap<String, String> headers = containerRequest.getHeaders();
- setRequestId(headers);
- containerRequest.setProperty("requestId", MDC.get(ONAPLogConstants.MDCs.REQUEST_ID));
- setInvocationId(headers);
- setServiceName(containerRequest);
- setMDCPartnerName(headers);
- mdcSetup.setServerFQDN();
- mdcSetup.setClientIPAddress(httpServletRequest);
- mdcSetup.setInstanceUUID();
- mdcSetup.setEntryTimeStamp();
- MDC.put(HttpHeadersConstants.REQUESTOR_ID, headers.getFirst("X-RequestorID"));
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.INPROGRESS.toString());
- MDC.put(LogConstants.URI_BASE, containerRequest.getUriInfo().getBaseUri().toString());
- MDC.put(MdcConstants.ORIGINAL_PARTNER_NAME, MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME));
- logger.info(ONAPLogConstants.Markers.ENTRY, "Entering");
- } catch (Exception e) {
- logger.warn("Error in incoming JAX-RS Inteceptor", e);
- }
- }
-
- @Override
- public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext)
- throws IOException {
- try {
- setResponseStatusCode(responseContext);
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION, payloadMessage(responseContext));
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE, String.valueOf(responseContext.getStatus()));
- logger.info(ONAPLogConstants.Markers.EXIT, "Exiting.");
- MDC.clear();
- } catch (Exception e) {
- MDC.clear();
- logger.warn("Error in outgoing JAX-RS Inteceptor", e);
- }
- }
-
- private void setResponseStatusCode(ContainerResponseContext responseContext) {
- String statusCode;
- if (Response.Status.Family.familyOf(responseContext.getStatus()).equals(Response.Status.Family.SUCCESSFUL)) {
- statusCode = ONAPLogConstants.ResponseStatus.COMPLETED.toString();
- } else {
- statusCode = ONAPLogConstants.ResponseStatus.ERROR.toString();
- }
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, statusCode);
- }
-
- private String payloadMessage(ContainerResponseContext responseContext) throws IOException {
- String message = "";
- if (responseContext.hasEntity()) {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- Class<?> entityClass = responseContext.getEntityClass();
- Type entityType = responseContext.getEntityType();
- Annotation[] entityAnnotations = responseContext.getEntityAnnotations();
- MediaType mediaType = responseContext.getMediaType();
- @SuppressWarnings("unchecked")
- MessageBodyWriter<Object> bodyWriter = (MessageBodyWriter<Object>) providers
- .getMessageBodyWriter(entityClass, entityType, entityAnnotations, mediaType);
- bodyWriter.writeTo(responseContext.getEntity(), entityClass, entityType, entityAnnotations, mediaType,
- responseContext.getHeaders(), baos);
- message = message.concat(new String(baos.toByteArray()));
- }
- return message;
- }
-
- private void setRequestId(MultivaluedMap<String, String> headers) {
- String requestId = headers.getFirst(ONAPLogConstants.Headers.REQUEST_ID);
- if (requestId == null || requestId.isEmpty())
- requestId = UUID.randomUUID().toString();
- MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, requestId);
- }
-
- private void setInvocationId(MultivaluedMap<String, String> headers) {
- MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, findInvocationId(headers));
- }
-
- private void setMDCPartnerName(MultivaluedMap<String, String> headers) {
- String partnerName = headers.getFirst(ONAPLogConstants.Headers.PARTNER_NAME);
- if (partnerName == null || partnerName.isEmpty())
- partnerName = "";
- MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME, partnerName);
- }
-
- private String findInvocationId(MultivaluedMap<String, String> headers) {
- String invocationId = headers.getFirst(ONAPLogConstants.Headers.INVOCATION_ID);
- if (invocationId == null || invocationId.isEmpty())
- invocationId = UUID.randomUUID().toString();
- return invocationId;
- }
-
- private void setServiceName(ContainerRequestContext containerRequest) {
- MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, containerRequest.getUriInfo().getPath());
- }
-
- private void clearClientMDCs() {
- MDC.remove(ONAPLogConstants.MDCs.INVOCATION_ID);
- MDC.remove(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION);
- MDC.remove(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE);
- MDC.remove(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION);
- MDC.remove(ONAPLogConstants.MDCs.RESPONSE_CODE);
- MDC.remove(ONAPLogConstants.MDCs.TARGET_ENTITY);
- MDC.remove(ONAPLogConstants.MDCs.PARTNER_NAME);
- MDC.remove(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME);
- }
-
-}
diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCSetup.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCSetup.java
deleted file mode 100644
index 607f067ec4..0000000000
--- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCSetup.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2018 AT&T Intellectual Property. 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.logging.jaxrs.filter;
-
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.time.ZoneOffset;
-import java.time.ZonedDateTime;
-import java.time.format.DateTimeFormatter;
-import java.util.Map;
-import java.util.UUID;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.ws.rs.core.Response;
-import org.onap.logging.ref.slf4j.ONAPLogConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.slf4j.MDC;
-import org.springframework.stereotype.Component;
-
-@Component
-public class MDCSetup {
-
- protected static Logger logger = LoggerFactory.getLogger(MDCSetup.class);
-
- private static final String INSTANCE_UUID = UUID.randomUUID().toString();
-
- public void setInstanceUUID() {
- MDC.put(ONAPLogConstants.MDCs.INSTANCE_UUID, INSTANCE_UUID);
- }
-
- public void setServerFQDN() {
- String serverFQDN = "";
- InetAddress addr = null;
- try {
- addr = InetAddress.getLocalHost();
- serverFQDN = addr.toString();
- } catch (UnknownHostException e) {
- logger.warn("Cannot Resolve Host Name");
- serverFQDN = "";
- }
- MDC.put(ONAPLogConstants.MDCs.SERVER_FQDN, serverFQDN);
- }
-
- public void setClientIPAddress(HttpServletRequest httpServletRequest) {
- String remoteIpAddress = "";
- if (httpServletRequest != null) {
- remoteIpAddress = httpServletRequest.getRemoteAddr();
- }
- MDC.put(ONAPLogConstants.MDCs.CLIENT_IP_ADDRESS, remoteIpAddress);
- }
-
- public void setEntryTimeStamp() {
- MDC.put(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP,
- ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT));
- }
-
- public void setServiceName(HttpServletRequest request) {
- MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, request.getRequestURI());
- }
-
- public void setRequestId(Map<String, String> headers) {
- String requestId = headers.get(ONAPLogConstants.Headers.REQUEST_ID);
- if (requestId == null || requestId.isEmpty())
- requestId = UUID.randomUUID().toString();
- MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, requestId);
- }
-
- public void setInvocationId(Map<String, String> headers) {
- String invocationId = headers.get(ONAPLogConstants.Headers.INVOCATION_ID);
- if (invocationId == null || invocationId.isEmpty())
- invocationId = UUID.randomUUID().toString();
- MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, invocationId);
- }
-
- public void setMDCPartnerName(Map<String, String> headers) {
- String partnerName = headers.get(ONAPLogConstants.Headers.PARTNER_NAME);
- if (partnerName == null || partnerName.isEmpty())
- partnerName = "";
- MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME, partnerName);
- }
-
-
- public void setResponseStatusCode(HttpServletResponse response) {
- String statusCode;
- if (Response.Status.Family.familyOf(response.getStatus()).equals(Response.Status.Family.SUCCESSFUL)) {
- statusCode = ONAPLogConstants.ResponseStatus.COMPLETED.toString();
- } else {
- statusCode = ONAPLogConstants.ResponseStatus.ERROR.toString();
- }
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, statusCode);
- }
-}
diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCTaskDecorator.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCTaskDecorator.java
deleted file mode 100644
index e644f9e030..0000000000
--- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCTaskDecorator.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2018 AT&T Intellectual Property. 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.logging.jaxrs.filter;
-
-import java.util.Map;
-import org.slf4j.MDC;
-import org.springframework.core.task.TaskDecorator;
-
-public class MDCTaskDecorator implements TaskDecorator {
-
- @Override
- public Runnable decorate(Runnable runnable) {
- Map<String, String> contextMap = MDC.getCopyOfContextMap();
- return () -> {
- try {
- if (contextMap != null) {
- MDC.setContextMap(contextMap);
- runnable.run();
- }
- } finally {
- MDC.clear();
- }
- };
- }
-}
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
deleted file mode 100644
index 21c0b52a91..0000000000
--- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/PayloadLoggingFilter.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. 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.logging.jaxrs.filter;
-
-import java.io.BufferedInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.FilterOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.nio.charset.Charset;
-import java.nio.charset.StandardCharsets;
-import javax.annotation.Priority;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.client.ClientRequestContext;
-import javax.ws.rs.client.ClientRequestFilter;
-import javax.ws.rs.client.ClientResponseContext;
-import javax.ws.rs.client.ClientResponseFilter;
-import javax.ws.rs.ext.Provider;
-import javax.ws.rs.ext.WriterInterceptor;
-import javax.ws.rs.ext.WriterInterceptorContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-@Provider
-@Priority(1)
-public class PayloadLoggingFilter implements ClientRequestFilter, ClientResponseFilter, WriterInterceptor {
-
- private static final Logger logger = LoggerFactory.getLogger(PayloadLoggingFilter.class);
- private static final String ENTITY_STREAM_PROPERTY = "LoggingFilter.entityStream";
- private static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8;
- private final int maxEntitySize;
-
- public PayloadLoggingFilter() {
- maxEntitySize = 1024 * 1024;
- }
-
- public PayloadLoggingFilter(int maxPayloadSize) {
- this.maxEntitySize = Integer.min(maxPayloadSize, 1024 * 1024);
- }
-
- private void log(StringBuilder sb) {
- logger.debug(sb.toString());
- }
-
- protected InputStream logInboundEntity(final StringBuilder b, InputStream stream, final Charset charset)
- throws IOException {
- if (!stream.markSupported()) {
- stream = new BufferedInputStream(stream);
- }
- stream.mark(maxEntitySize + 1);
- final byte[] entity = new byte[maxEntitySize + 1];
- final int entitySize = stream.read(entity);
- if (entitySize != -1) {
- b.append(new String(entity, 0, Math.min(entitySize, maxEntitySize), charset));
- }
- if (entitySize > maxEntitySize) {
- b.append("...more...");
- }
- b.append('\n');
- stream.reset();
- return stream;
- }
-
- @Override
- public void filter(ClientRequestContext requestContext) throws IOException {
- if (requestContext.hasEntity()) {
- final OutputStream stream = new LoggingStream(requestContext.getEntityStream());
- requestContext.setEntityStream(stream);
- requestContext.setProperty(ENTITY_STREAM_PROPERTY, stream);
- }
- String method = formatMethod(requestContext);
- log(new StringBuilder("Making " + method + " request to: " + requestContext.getUri() + "\nRequest Headers: "
- + requestContext.getHeaders().toString()));
-
- }
-
- @Override
- public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext) throws IOException {
- final StringBuilder sb = new StringBuilder();
- if (responseContext.hasEntity()) {
- responseContext.setEntityStream(logInboundEntity(sb, responseContext.getEntityStream(), DEFAULT_CHARSET));
- String method = formatMethod(requestContext);
- log(sb.insert(0, "Response from " + method + ": " + requestContext.getUri() + "\nResponse Headers: "
- + responseContext.getHeaders().toString()));
- }
- }
-
- @Override
- public void aroundWriteTo(WriterInterceptorContext context) throws IOException, WebApplicationException {
- final LoggingStream stream = (LoggingStream) context.getProperty(ENTITY_STREAM_PROPERTY);
- context.proceed();
- if (stream != null) {
- log(stream.getStringBuilder(DEFAULT_CHARSET));
- }
- }
-
- private class LoggingStream extends FilterOutputStream {
-
- private final StringBuilder sb = new StringBuilder();
- private final ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
- LoggingStream(OutputStream out) {
- super(out);
- }
-
- StringBuilder getStringBuilder(Charset charset) {
- // write entity to the builder
- final byte[] entity = baos.toByteArray();
-
- sb.append(new String(entity, 0, entity.length, charset));
- if (entity.length > maxEntitySize) {
- sb.append("...more...");
- }
- sb.append('\n');
-
- return sb;
- }
-
- @Override
- public void write(final int i) throws IOException {
- if (baos.size() <= maxEntitySize) {
- baos.write(i);
- }
- out.write(i);
- }
- }
-
- private String formatMethod(ClientRequestContext requestContext) {
- String method = requestContext.getHeaderString("X-HTTP-Method-Override");
- if (method == null) {
- method = requestContext.getMethod();
- } else {
- method = requestContext.getMethod() + " (overridden to " + method + ")";
- }
-
- return method;
- }
-}
diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOAuditLogContainerFilter.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOAuditLogContainerFilter.java
new file mode 100644
index 0000000000..5ae1082464
--- /dev/null
+++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOAuditLogContainerFilter.java
@@ -0,0 +1,34 @@
+package org.onap.so.logging.jaxrs.filter;
+
+import javax.annotation.Priority;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerResponseContext;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.so.logger.HttpHeadersConstants;
+import org.onap.so.logger.LogConstants;
+import org.slf4j.MDC;
+import org.springframework.stereotype.Component;
+import org.onap.logging.filter.base.AuditLogContainerFilter;
+
+@Priority(1)
+@Component
+public class SOAuditLogContainerFilter extends AuditLogContainerFilter {
+
+ private static final String ORIGINAL_PARTNER_NAME = "OriginalPartnerName";
+
+ @Override
+ protected void additionalPreHandling(ContainerRequestContext request) {
+ request.setProperty("requestId", MDC.get(ONAPLogConstants.MDCs.REQUEST_ID));
+ MDC.put(ORIGINAL_PARTNER_NAME, MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME));
+ String requestorId = request.getHeaders().getFirst("X-RequestorID");
+ if (requestorId != null) {
+ MDC.put(HttpHeadersConstants.REQUESTOR_ID, requestorId);
+ }
+ MDC.put(LogConstants.URI_BASE, request.getUriInfo().getBaseUri().toString());
+ }
+
+ @Override
+ protected void additionalPostHandling(ContainerResponseContext response) {
+ // override to add additional post handling
+ }
+}
diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOMetricLogClientFilter.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOMetricLogClientFilter.java
new file mode 100644
index 0000000000..248e2f00bf
--- /dev/null
+++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOMetricLogClientFilter.java
@@ -0,0 +1,44 @@
+package org.onap.so.logging.jaxrs.filter;
+
+import javax.ws.rs.client.ClientRequestContext;
+import javax.ws.rs.client.ClientResponseContext;
+import org.onap.logging.filter.base.MDCSetup;
+import org.onap.logging.filter.base.MetricLogClientFilter;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.so.logger.MdcConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+import org.slf4j.Marker;
+import org.slf4j.MarkerFactory;
+
+
+public class SOMetricLogClientFilter extends MetricLogClientFilter {
+
+ protected static Logger logger = LoggerFactory.getLogger(MDCSetup.class);
+ private static final Marker INVOKE_RETURN = MarkerFactory.getMarker("INVOKE-RETURN");
+
+ private MDCSetup mdcSetup = new MDCSetup();
+
+ @Override
+ public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext) {
+ try {
+ mdcSetup.setLogTimestamp();
+ mdcSetup.setElapsedTimeInvokeTimestamp();
+ mdcSetup.setResponseStatusCode(responseContext.getStatus());
+ mdcSetup.setResponseDescription(responseContext.getStatus());
+ MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE, String.valueOf(responseContext.getStatus()));
+ logger.info(INVOKE_RETURN, "InvokeReturn");
+ mdcSetup.clearClientMDCs();
+ setOpenStackResponseCode();
+ } catch (Exception e) {
+ logger.warn("Error in JAX-RS request,response client filter", e);
+ }
+ }
+
+ protected void setOpenStackResponseCode() {
+ if (MDC.get(MdcConstants.OPENSTACK_STATUS_CODE) != null) {
+ MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, MDC.get(MdcConstants.OPENSTACK_STATUS_CODE));
+ }
+ }
+}
diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOSpringClientFilter.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOSpringClientFilter.java
new file mode 100644
index 0000000000..c2b8df37c2
--- /dev/null
+++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOSpringClientFilter.java
@@ -0,0 +1,52 @@
+package org.onap.so.logging.jaxrs.filter;
+
+import java.io.IOException;
+import java.nio.charset.Charset;
+import org.onap.logging.filter.base.MDCSetup;
+import org.onap.logging.filter.spring.SpringClientFilter;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.so.logger.MdcConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+import org.slf4j.Marker;
+import org.slf4j.MarkerFactory;
+import org.springframework.http.client.ClientHttpRequestInterceptor;
+import org.springframework.http.client.ClientHttpResponse;
+import org.springframework.stereotype.Component;
+import org.springframework.util.StreamUtils;
+
+@Component
+public class SOSpringClientFilter extends SpringClientFilter implements ClientHttpRequestInterceptor {
+
+ private final Logger logger = LoggerFactory.getLogger(this.getClass());
+ private MDCSetup mdcSetup = new MDCSetup();
+ private static final Marker INVOKE_RETURN = MarkerFactory.getMarker("INVOKE-RETURN");
+
+
+ protected void processResponse(ClientHttpResponse response) throws IOException {
+ if (logger.isDebugEnabled()) {
+ logger.debug("============================response begin==========================================");
+ logger.debug("Status code : {}", response.getStatusCode());
+ logger.debug("Status text : {}", response.getStatusText());
+ logger.debug("Headers : {}", response.getHeaders());
+ logger.debug("Response body: {}", StreamUtils.copyToString(response.getBody(), Charset.defaultCharset()));
+ logger.debug("=======================response end=================================================");
+ }
+ mdcSetup.setLogTimestamp();
+ mdcSetup.setElapsedTimeInvokeTimestamp();
+ mdcSetup.setResponseStatusCode(response.getRawStatusCode());
+ int statusCode = response.getRawStatusCode();
+ MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE, String.valueOf(statusCode));
+ mdcSetup.setResponseDescription(statusCode);
+ logger.info(INVOKE_RETURN, "InvokeReturn");
+ mdcSetup.clearClientMDCs();
+ setOpenStackResponseCode();
+ }
+
+ protected void setOpenStackResponseCode() {
+ if (MDC.get(MdcConstants.OPENSTACK_STATUS_CODE) != null) {
+ MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, MDC.get(MdcConstants.OPENSTACK_STATUS_CODE));
+ }
+ }
+}
diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/SpringClientFilter.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/SpringClientFilter.java
deleted file mode 100644
index c763dd4374..0000000000
--- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/SpringClientFilter.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2018 AT&T Intellectual Property. 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.logging.jaxrs.filter;
-
-import org.onap.logging.ref.slf4j.ONAPLogConstants;
-import org.onap.so.logger.LogConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.slf4j.MDC;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpRequest;
-import org.springframework.http.client.ClientHttpRequestExecution;
-import org.springframework.http.client.ClientHttpRequestInterceptor;
-import org.springframework.http.client.ClientHttpResponse;
-import org.springframework.util.StreamUtils;
-import java.io.IOException;
-import java.nio.charset.Charset;
-import java.time.ZoneOffset;
-import java.time.ZonedDateTime;
-import java.time.format.DateTimeFormatter;
-import java.util.List;
-import java.util.UUID;
-import javax.ws.rs.core.Response;
-
-public class SpringClientFilter implements ClientHttpRequestInterceptor {
-
- private final Logger log = LoggerFactory.getLogger(this.getClass());
-
- private static final String TRACE = "trace-#";
- private static final String SO = "SO";
-
- @Override
- public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution)
- throws IOException {
- processRequest(request, body);
- ClientHttpResponse response = execution.execute(request, body);
- processResponse(response);
- return response;
- }
-
- private void processRequest(HttpRequest request, byte[] body) throws IOException {
- setInvocationId();
- setupHeaders(request);
- setupMDC(request);
- if (log.isDebugEnabled()) {
- log.debug("===========================request begin================================================");
- log.debug("URI : {}", request.getURI());
- log.debug("Method : {}", request.getMethod());
- log.debug("Headers : {}", request.getHeaders());
- log.debug("Request body: {}", new String(body, "UTF-8"));
- log.debug("==========================request end================================================");
- }
- }
-
- private void setupHeaders(HttpRequest clientRequest) {
- HttpHeaders headers = clientRequest.getHeaders();
- headers.add(ONAPLogConstants.Headers.REQUEST_ID, extractRequestID(clientRequest));
- headers.add(ONAPLogConstants.Headers.INVOCATION_ID, MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID));
- headers.add(ONAPLogConstants.Headers.PARTNER_NAME, SO);
- }
-
- private String extractRequestID(HttpRequest clientRequest) {
- String requestId = MDC.get(ONAPLogConstants.MDCs.REQUEST_ID);
- if (requestId == null || requestId.isEmpty() || requestId.equals(TRACE)) {
- requestId = UUID.randomUUID().toString();
- log.warn("Could not Find Request ID Generating New One: {}", clientRequest.getURI());
- }
- return requestId;
- }
-
- private void setupMDC(HttpRequest clientRequest) {
- MDC.put(ONAPLogConstants.MDCs.INVOKE_TIMESTAMP,
- ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT));
- MDC.put(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME, clientRequest.getURI().toString());
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.INPROGRESS.toString());
- MDC.put(ONAPLogConstants.MDCs.TARGET_ENTITY, extractTargetEntity(clientRequest));
- }
-
- private String extractTargetEntity(HttpRequest clientRequest) {
- HttpHeaders headers = clientRequest.getHeaders();
- String headerTargetEntity = null;
- List<String> headerTargetEntityList = headers.get(LogConstants.TARGET_ENTITY_HEADER);
- if (headerTargetEntityList != null && !headerTargetEntityList.isEmpty())
- headerTargetEntity = headerTargetEntityList.get(0);
- String targetEntity = MDC.get(ONAPLogConstants.MDCs.TARGET_ENTITY);
- if (targetEntity != null && !targetEntity.isEmpty()) {
- return targetEntity;
- } else if (headerTargetEntity != null && !headerTargetEntity.isEmpty()) {
- targetEntity = headerTargetEntity;
- } else {
- targetEntity = LogConstants.UNKNOWN_TARGET_ENTITY;
- log.warn("Could not Target Entity: {}", clientRequest.getURI());
- }
- return targetEntity;
- }
-
- private void setInvocationId() {
- String invocationId = MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID);
- if (invocationId == null || invocationId.isEmpty())
- invocationId = UUID.randomUUID().toString();
- MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, invocationId);
- }
-
-
- private void processResponse(ClientHttpResponse response) throws IOException {
- if (log.isDebugEnabled()) {
- log.debug("============================response begin==========================================");
- log.debug("Status code : {}", response.getStatusCode());
- log.debug("Status text : {}", response.getStatusText());
- log.debug("Headers : {}", response.getHeaders());
- log.debug("Response body: {}", StreamUtils.copyToString(response.getBody(), Charset.defaultCharset()));
- log.debug("=======================response end=================================================");
- }
- String statusCode;
- if (Response.Status.Family.familyOf(response.getRawStatusCode()).equals(Response.Status.Family.SUCCESSFUL)) {
- statusCode = ONAPLogConstants.ResponseStatus.COMPLETED.toString();
- } else {
- statusCode = ONAPLogConstants.ResponseStatus.ERROR.toString();
- }
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE, String.valueOf(response.getRawStatusCode()));
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION, "");
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, statusCode);
- log.info(ONAPLogConstants.Markers.INVOKE_RETURN, "InvokeReturn");
- clearClientMDCs();
- }
-
- private void clearClientMDCs() {
- MDC.remove(ONAPLogConstants.MDCs.INVOCATION_ID);
- MDC.remove(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION);
- MDC.remove(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE);
- MDC.remove(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION);
- MDC.remove(ONAPLogConstants.MDCs.RESPONSE_CODE);
- MDC.remove(ONAPLogConstants.MDCs.TARGET_ENTITY);
- MDC.remove(ONAPLogConstants.MDCs.PARTNER_NAME);
- MDC.remove(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME);
- MDC.remove(ONAPLogConstants.MDCs.INVOKE_TIMESTAMP);
- }
-}
diff --git a/common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java b/common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java
deleted file mode 100644
index fa5a5d5da4..0000000000
--- a/common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2018 AT&T Intellectual Property. 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.logging.spring.interceptor;
-
-import java.util.Collections;
-import java.util.Map;
-import java.util.UUID;
-import java.util.stream.Collectors;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.ext.Providers;
-import org.onap.logging.ref.slf4j.ONAPLogConstants;
-import org.onap.so.logging.jaxrs.filter.MDCSetup;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.slf4j.MDC;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-import org.springframework.web.servlet.ModelAndView;
-import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
-
-@Component
-public class LoggingInterceptor extends HandlerInterceptorAdapter {
-
- Logger logger = LoggerFactory.getLogger(LoggingInterceptor.class);
-
- @Autowired
- private MDCSetup mdcSetup;
-
- @Context
- private Providers providers;
-
- @Override
- public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
- throws Exception {
-
- Map<String, String> headers = Collections.list((request).getHeaderNames()).stream()
- .collect(Collectors.toMap(h -> h, request::getHeader));
- setRequestId(headers);
- setInvocationId(headers);
- setServiceName(request);
- setMDCPartnerName(headers);
- mdcSetup.setClientIPAddress(request);
- mdcSetup.setEntryTimeStamp();
- mdcSetup.setInstanceUUID();
- mdcSetup.setServerFQDN();
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.INPROGRESS.toString());
- logger.info(ONAPLogConstants.Markers.ENTRY, "Entering");
- if (logger.isDebugEnabled())
- logRequestInformation(request);
- return true;
- }
-
- protected void logRequestInformation(HttpServletRequest request) {
- Map<String, String> headers = Collections.list((request).getHeaderNames()).stream()
- .collect(Collectors.toMap(h -> h, request::getHeader));
-
- logger.debug("===========================request begin================================================");
- logger.debug("URI : {}", request.getRequestURI());
- logger.debug("Method : {}", request.getMethod());
- logger.debug("Headers : {}", headers);
- logger.debug("==========================request end================================================");
-
- }
-
- @Override
- public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
- ModelAndView modelAndView) throws Exception {
- setResponseStatusCode(response);
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION, "");
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE, String.valueOf(response.getStatus()));
- logger.info(ONAPLogConstants.Markers.EXIT, "Exiting.");
- MDC.clear();
- }
-
- protected void setResponseStatusCode(HttpServletResponse response) {
- String statusCode;
- if (Response.Status.Family.familyOf(response.getStatus()).equals(Response.Status.Family.SUCCESSFUL)) {
- statusCode = ONAPLogConstants.ResponseStatus.COMPLETED.toString();
- } else {
- statusCode = ONAPLogConstants.ResponseStatus.ERROR.toString();
- }
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, statusCode);
- }
-
- protected void setServiceName(HttpServletRequest request) {
- MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, request.getRequestURI());
- }
-
- protected void setRequestId(Map<String, String> headers) {
- String requestId = headers.get(ONAPLogConstants.Headers.REQUEST_ID.toLowerCase());
- if (requestId == null || requestId.isEmpty())
- requestId = UUID.randomUUID().toString();
- MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, requestId);
- }
-
- protected void setInvocationId(Map<String, String> headers) {
- String invocationId = headers.get(ONAPLogConstants.Headers.INVOCATION_ID.toLowerCase());
- if (invocationId == null || invocationId.isEmpty())
- invocationId = UUID.randomUUID().toString();
- MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, invocationId);
- }
-
- protected void setMDCPartnerName(Map<String, String> headers) {
- String partnerName = headers.get(ONAPLogConstants.Headers.PARTNER_NAME.toLowerCase());
- if (partnerName == null || partnerName.isEmpty())
- partnerName = "";
- MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME, partnerName);
- }
-
-
-}
diff --git a/common/src/main/java/org/onap/so/utils/Components.java b/common/src/main/java/org/onap/so/utils/Components.java
new file mode 100644
index 0000000000..0713723264
--- /dev/null
+++ b/common/src/main/java/org/onap/so/utils/Components.java
@@ -0,0 +1,7 @@
+package org.onap.so.utils;
+
+import org.onap.logging.filter.base.ONAPComponentsList;
+
+public enum Components implements ONAPComponentsList {
+ OPENSTACK, UNKNOWN;
+}
diff --git a/common/src/main/java/org/onap/so/utils/ExternalTaskUtils.java b/common/src/main/java/org/onap/so/utils/ExternalTaskUtils.java
index 349767fc5b..a2aed638fe 100644
--- a/common/src/main/java/org/onap/so/utils/ExternalTaskUtils.java
+++ b/common/src/main/java/org/onap/so/utils/ExternalTaskUtils.java
@@ -33,14 +33,4 @@ public abstract class ExternalTaskUtils {
}
return seq;
}
-
- protected void setupMDC(ExternalTask externalTask) {
- logger.info(ONAPLogConstants.Markers.ENTRY, "Entering");
- String msoRequestId = externalTask.getVariable("mso-request-id");
- if (msoRequestId != null && !msoRequestId.isEmpty()) {
- MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, msoRequestId);
- }
- MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, externalTask.getTopicName());
- }
-
}
diff --git a/common/src/main/java/org/onap/so/utils/TargetEntities.java b/common/src/main/java/org/onap/so/utils/TargetEntities.java
deleted file mode 100644
index 67016a1fa9..0000000000
--- a/common/src/main/java/org/onap/so/utils/TargetEntities.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. 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.utils;
-
-import java.io.Serializable;
-
-public interface TargetEntities extends Serializable {
-
-}
diff --git a/common/src/main/java/org/onap/so/utils/TargetEntity.java b/common/src/main/java/org/onap/so/utils/TargetEntity.java
deleted file mode 100644
index 3a3ec91d2f..0000000000
--- a/common/src/main/java/org/onap/so/utils/TargetEntity.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. 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.utils;
-
-import java.util.EnumSet;
-
-public enum TargetEntity implements TargetEntities {
- OPENSTACK_ADAPTER,
- BPMN,
- GRM,
- AAI,
- DMAAP,
- POLICY,
- CATALOG_DB,
- REQUEST_DB,
- VNF_ADAPTER,
- SDNC_ADAPTER,
- SNIRO,
- SDC,
- EXTERNAL,
- MULTICLOUD,
- OOF,
- SDNC,
- SO,
- UNKNOWN,
- OPENSTACK;
-
- private static final String PREFIX = "SO";
-
- public static EnumSet<TargetEntity> getSOInternalComponents() {
- return EnumSet.of(OPENSTACK_ADAPTER, BPMN, CATALOG_DB, REQUEST_DB, VNF_ADAPTER, SDNC_ADAPTER);
- }
-
- @Override
- public String toString() {
- if (getSOInternalComponents().contains(this))
- return TargetEntity.PREFIX + "." + this.name();
- else
- return this.name();
- }
-}
diff --git a/common/src/test/java/org/onap/so/client/HttpClientTest.java b/common/src/test/java/org/onap/so/client/HttpClientTest.java
index b12ed5956a..a01e2bb812 100644
--- a/common/src/test/java/org/onap/so/client/HttpClientTest.java
+++ b/common/src/test/java/org/onap/so/client/HttpClientTest.java
@@ -32,7 +32,7 @@ import java.net.MalformedURLException;
import java.net.URL;
import org.junit.Rule;
import org.junit.Test;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
import com.github.tomakehurst.wiremock.junit.WireMockRule;
public class HttpClientTest {
@@ -49,7 +49,7 @@ public class HttpClientTest {
.willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody("")));
URL url = new URL("http://localhost:" + wireMockConfig().portNumber() + "/services/sdnc/post");
- HttpClient client = httpClientFactory.newJsonClient(url, TargetEntity.BPMN);
+ HttpClient client = httpClientFactory.newJsonClient(url, ONAPComponents.BPMN);
client.addBasicAuthHeader(
"97FF88AB352DA16E00DDD81E3876431DEF8744465DACA489EB3B3BE1F10F63EDA1715E626D0A4827A3E19CD88421BF",
@@ -68,7 +68,7 @@ public class HttpClientTest {
.willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody("")));
URL url = new URL("http://localhost:" + wireMockConfig().portNumber() + "/services/sdnc/post");
- HttpClient client = httpClientFactory.newJsonClient(url, TargetEntity.BPMN);
+ HttpClient client = httpClientFactory.newJsonClient(url, ONAPComponents.BPMN);
client.addAdditionalHeader("Accept", "application/json");
client.addAdditionalHeader("id", null);
@@ -86,7 +86,7 @@ public class HttpClientTest {
.willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody("")));
URL url = new URL("http://localhost:" + wireMockConfig().portNumber() + "/services/sdnc/post");
- HttpClient client = httpClientFactory.newJsonClient(url, TargetEntity.BPMN);
+ HttpClient client = httpClientFactory.newJsonClient(url, ONAPComponents.BPMN);
client.addBasicAuthHeader("", "12345");
client.addAdditionalHeader("Accept", "application/json");
diff --git a/common/src/test/java/org/onap/so/client/RestClientTest.java b/common/src/test/java/org/onap/so/client/RestClientTest.java
index 745dee23e8..cd00a9e4de 100644
--- a/common/src/test/java/org/onap/so/client/RestClientTest.java
+++ b/common/src/test/java/org/onap/so/client/RestClientTest.java
@@ -39,7 +39,7 @@ import org.junit.runner.RunWith;
import org.mockito.ArgumentMatchers;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
@RunWith(MockitoJUnitRunner.class)
public class RestClientTest {
@@ -82,7 +82,7 @@ public class RestClientTest {
private RestClient buildSpy() throws MalformedURLException, IllegalArgumentException, UriBuilderException {
RestClient client = httpClientFactory.newJsonClient(UriBuilder.fromUri("http://localhost/test").build().toURL(),
- TargetEntity.BPMN);
+ ONAPComponents.BPMN);
return spy(client);
}
diff --git a/common/src/test/java/org/onap/so/client/adapter/rest/AdapterRestClientTest.java b/common/src/test/java/org/onap/so/client/adapter/rest/AdapterRestClientTest.java
index bc600310b3..5075da3b7a 100644
--- a/common/src/test/java/org/onap/so/client/adapter/rest/AdapterRestClientTest.java
+++ b/common/src/test/java/org/onap/so/client/adapter/rest/AdapterRestClientTest.java
@@ -34,7 +34,7 @@ import org.junit.Before;
import org.junit.Test;
import org.onap.so.client.policy.JettisonStyleMapperProvider;
import org.onap.so.utils.CryptoUtils;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
public class AdapterRestClientTest {
@@ -88,9 +88,9 @@ public class AdapterRestClientTest {
}
@Test
- public void getTargetEntity_success() throws URISyntaxException {
+ public void getONAPComponents_success() throws URISyntaxException {
AdapterRestClient testedObject = new AdapterRestClient(adapterRestPropertiesMock, new URI(""));
- assertThat(testedObject.getTargetEntity()).isEqualTo(TargetEntity.OPENSTACK_ADAPTER);
+ assertThat(testedObject.getTargetEntity()).isEqualTo(ONAPComponents.OPENSTACK_ADAPTER);
}
@Test
diff --git a/common/src/test/java/org/onap/so/externaltasks/logging/AuditMDCSetupTest.java b/common/src/test/java/org/onap/so/externaltasks/logging/AuditMDCSetupTest.java
new file mode 100644
index 0000000000..5e2a51a56f
--- /dev/null
+++ b/common/src/test/java/org/onap/so/externaltasks/logging/AuditMDCSetupTest.java
@@ -0,0 +1,89 @@
+package org.onap.so.externaltasks.logging;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.mockito.Mockito.doReturn;
+import org.camunda.bpm.client.task.ExternalTask;
+import org.junit.After;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.so.logger.MdcConstants;
+import org.slf4j.MDC;
+
+@RunWith(MockitoJUnitRunner.class)
+public class AuditMDCSetupTest {
+
+ @Mock
+ private ExternalTask externalTask;
+
+ @Spy
+ @InjectMocks
+ private AuditMDCSetup mdcSetup;
+
+ private String requestId = "9bb86b8d-a02f-4a0b-81a9-2eb963850009";
+ private String serviceName = "testServiceName";
+
+ @After
+ public void tearDown() {
+ MDC.clear();
+ }
+
+ @Test
+ public void setupMDCTest() {
+ doReturn(requestId).when(externalTask).getVariable("mso-request-id");
+ doReturn(serviceName).when(externalTask).getTopicName();
+
+ mdcSetup.setupMDC(externalTask);
+
+ assertNotNull(MDC.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
+ assertEquals(requestId, MDC.get(ONAPLogConstants.MDCs.REQUEST_ID));
+ assertEquals(serviceName, MDC.get(ONAPLogConstants.MDCs.SERVICE_NAME));
+ assertEquals("SO.OPENSTACK_ADAPTER", MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME));
+ assertEquals(ONAPLogConstants.ResponseStatus.INPROGRESS.toString(),
+ MDC.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
+ }
+
+ @Test
+ public void setElapsedTimeTest() {
+ MDC.put(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP, "2019-06-18T02:09:06.024Z");
+
+ mdcSetup.setElapsedTime();
+
+ assertNotNull(MDC.get(ONAPLogConstants.MDCs.ELAPSED_TIME));
+ }
+
+ @Test
+ public void setResponseCodeTest() {
+ mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.INPROGRESS.toString());
+
+ assertEquals(ONAPLogConstants.ResponseStatus.INPROGRESS.toString(),
+ MDC.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
+ assertEquals(ONAPLogConstants.ResponseStatus.INPROGRESS.toString(),
+ MDC.get(MdcConstants.OPENSTACK_STATUS_CODE));
+ }
+
+ @Test
+ public void clearClientMDCsTest() {
+ MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.INPROGRESS.toString());
+ MDC.put(MdcConstants.OPENSTACK_STATUS_CODE, ONAPLogConstants.ResponseStatus.INPROGRESS.toString());
+ MDC.put(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP, "2019-06-18T02:09:06.024Z");
+ MDC.put(ONAPLogConstants.MDCs.ELAPSED_TIME, "318");
+ MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME, "SO.OPENSTACK_ADAPTER");
+
+ mdcSetup.clearClientMDCs();
+
+ assertNull(MDC.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
+ assertNull(MDC.get(MdcConstants.OPENSTACK_STATUS_CODE));
+ assertNull(MDC.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
+ assertNull(MDC.get(ONAPLogConstants.MDCs.ELAPSED_TIME));
+ assertNull(MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME));
+
+ }
+
+}
diff --git a/cxf-logging/pom.xml b/cxf-logging/pom.xml
index 2c891f2c4a..f0c969aeb1 100644
--- a/cxf-logging/pom.xml
+++ b/cxf-logging/pom.xml
@@ -37,11 +37,6 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
- <dependency>
- <groupId>org.onap.logging-analytics</groupId>
- <artifactId>logging-slf4j</artifactId>
- <version>1.2.2</version>
- </dependency>
</dependencies>
<build>
<resources>
diff --git a/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java b/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java
index a6cce27f91..f6ac449057 100644
--- a/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java
+++ b/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java
@@ -75,7 +75,7 @@ public class SOAPLoggingInInterceptor extends AbstractSoapInterceptor {
// CXF Appears to flatten headers to lower case
private void setMDCPartnerName(Map<String, List<String>> headers) {
- String partnerName = getValueOrDefault(headers, ONAPLogConstants.Headers.PARTNER_NAME.toLowerCase(), "");
+ String partnerName = getValueOrDefault(headers, ONAPLogConstants.Headers.PARTNER_NAME.toLowerCase(), "UNKNOWN");
MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME, partnerName);
}
diff --git a/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingOutInterceptor.java b/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingOutInterceptor.java
index 92b266870c..3785d3165f 100644
--- a/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingOutInterceptor.java
+++ b/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingOutInterceptor.java
@@ -51,7 +51,7 @@ public class SOAPLoggingOutInterceptor extends AbstractSoapInterceptor {
Exception ex = message.getContent(Exception.class);
if (ex == null) {
MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE,
- ONAPLogConstants.ResponseStatus.COMPLETED.toString());
+ ONAPLogConstants.ResponseStatus.COMPLETE.toString());
} else {
int responseCode = 0;
responseCode = (int) message.get(Message.RESPONSE_CODE);
diff --git a/deployment-configs/src/main/resources/logger/logback-spring.xml b/deployment-configs/src/main/resources/logger/logback-spring.xml
new file mode 100644
index 0000000000..607d7b1f74
--- /dev/null
+++ b/deployment-configs/src/main/resources/logger/logback-spring.xml
@@ -0,0 +1,231 @@
+<!-- ============LICENSE_START=======================================================
+ ECOMP MSO ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. 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========================================================= -->
+
+<configuration scan="false" debug="false">
+ <contextListener class="org.onap.so.logger.LoggerStartupListener" />
+
+ <property name="queueSize" value="256" />
+ <property name="maxFileSize" value="200MB" />
+ <property name="maxHistory" value="30" />
+ <property name="totalSizeCap" value="10GB" />
+
+ <!-- log file names -->
+ <property name="errorLogName" value="error" />
+ <property name="metricsLogName" value="metrics" />
+ <property name="auditLogName" value="audit" />
+ <property name="debugLogName" value="debug" />
+ <property name="cadiLogName" value="cadi" />
+
+ <property name="currentTimeStamp" value="%d{&quot;yyyy-MM-dd'T'HH:mm:ss.SSSXXX&quot;,UTC}"/>
+
+ <property name="errorPattern"
+ value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestID}|%thread|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%.-5level|%X{ErrorCode}|%X{ErrorDesc}|%msg%n" />
+
+ <property name="debugPattern"
+ value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestID}|%logger{50} - %msg%n" />
+
+ <property name="auditPattern"
+ value="%X{EntryTimestamp}|%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX,UTC}|%X{RequestID}|%X{ServiceInstanceId}|%thread||%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDesc}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}||||%marker|%mdc|||%msg%n" />
+
+ <property name="metricPattern"
+ value="%X{InvokeTimestamp}|%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX,UTC}|%X{RequestID}|%X{ServiceInstanceId}|%thread||%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDesc}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}||||%X{TargetVirtualEntity}|%marker|%mdc|||%msg%n" />
+
+ <property name="defaultPattern"
+ value="%nopexception%logger
+ \t%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX,UTC}
+ \t%level
+ \t%replace(%replace(%message){'\t','\\\\t'}){'\n','\\\\n'}
+ \t%replace(%replace(%mdc){'\t','\\\\t'}){'\n','\\\\n'}
+ \t%replace(%replace(%rootException){'\t','\\\\t'}){'\n','\\\\n'}
+ \t%replace(%replace(%marker){'\t','\\\\t'}){'\n','\\\\n'}
+ \t%thread
+ \t%n" />
+
+ <appender name="Audit"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
+ <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
+ <marker>EXIT</marker>
+ </evaluator>
+ <onMismatch>DENY</onMismatch>
+ <onMatch>ACCEPT</onMatch>
+ </filter>
+ <file>${logs_dir:-.}/${auditLogName}.log</file>
+ <rollingPolicy
+ class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+ <fileNamePattern>${logs_dir:-.}/${auditLogName}.%d{yyyy-MM-dd}.%i.log.zip
+ </fileNamePattern>
+ <maxFileSize>${maxFileSize}</maxFileSize>
+ <maxHistory>${maxHistory}</maxHistory>
+ <totalSizeCap>${totalSizeCap}</totalSizeCap>
+ </rollingPolicy>
+ <encoder>
+ <pattern>${auditPattern}</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="asyncAudit" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <appender-ref ref="Audit" />
+ </appender>
+
+ <appender name="Metric"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
+ <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
+ <marker>INVOKE-RETURN</marker>
+ </evaluator>
+ <onMismatch>DENY</onMismatch>
+ <onMatch>ACCEPT</onMatch>
+ </filter>
+ <file>${logs_dir:-.}/${metricsLogName}.log</file>
+ <rollingPolicy
+ class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+ <fileNamePattern>${logs_dir:-.}/${metricsLogName}.%d{yyyy-MM-dd}.%i.log.zip
+ </fileNamePattern>
+ <maxFileSize>${maxFileSize}</maxFileSize>
+ <maxHistory>${maxHistory}</maxHistory>
+ <totalSizeCap>${totalSizeCap}</totalSizeCap>
+ </rollingPolicy>
+ <encoder>
+ <pattern>${metricPattern}</pattern>
+ </encoder>
+ </appender>
+
+
+ <appender name="asyncMetric" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <appender-ref ref="Metric" />
+ </appender>
+
+ <appender name="Error"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <filter class="ch.qos.logback.classic.filter.LevelFilter">
+ <level>ERROR</level>
+ <onMatch>ACCEPT</onMatch>
+ <onMismatch>DENY</onMismatch>
+ </filter>
+ <file>${logs_dir:-.}/${errorLogName}.log</file>
+ <rollingPolicy
+ class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+ <fileNamePattern>${logs_dir:-.}/${errorLogName}.%d{yyyy-MM-dd}.%i.log.zip
+ </fileNamePattern>
+ <maxFileSize>${maxFileSize}</maxFileSize>
+ <maxHistory>${maxHistory}</maxHistory>
+ <totalSizeCap>${totalSizeCap}</totalSizeCap>
+ </rollingPolicy>
+ <encoder>
+ <pattern>${errorPattern}</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="asyncError" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <appender-ref ref="Error" />
+ </appender>
+
+ <appender name="Debug"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
+ <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
+ <marker>INVOKE</marker>
+ <marker>INVOKE-RETURN</marker>
+ <marker>ENTRY</marker>
+ <marker>EXIT</marker>
+ </evaluator>
+ <onMismatch>ACCEPT</onMismatch>
+ <onMatch>DENY</onMatch>
+ </filter>
+ <file>${logs_dir:-.}/${debugLogName}.log</file>
+ <rollingPolicy
+ class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+ <fileNamePattern>${logs_dir:-.}/${debugLogName}.%d{yyyy-MM-dd}.%i.log.zip
+ </fileNamePattern>
+ <maxFileSize>${maxFileSize}</maxFileSize>
+ <maxHistory>${maxHistory}</maxHistory>
+ <totalSizeCap>${totalSizeCap}</totalSizeCap>
+ </rollingPolicy>
+ <encoder>
+ <pattern>${debugPattern}</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="asyncDebug" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <appender-ref ref="Debug" />
+ <includeCallerData>true</includeCallerData>
+ </appender>
+
+ <appender name="Cadi"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${logs_dir:-.}/${cadiLogName}.log</file>
+ <rollingPolicy
+ class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+ <fileNamePattern>${logs_dir:-.}/${cadiLogName}.%d{yyyy-MM-dd}.%i.log.zip
+ </fileNamePattern>
+ <maxFileSize>${maxFileSize}</maxFileSize>
+ <maxHistory>${maxHistory}</maxHistory>
+ <totalSizeCap>${totalSizeCap}</totalSizeCap>
+ </rollingPolicy>
+ <encoder>
+ <pattern>${debugPattern}</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="asyncCadi" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <appender-ref ref="Cadi" />
+ <includeCallerData>true</includeCallerData>
+ </appender>
+
+ <!-- Spring related loggers -->
+ <logger name="org.springframework" level="WARN" />
+ <logger
+ name="org.springframework.security.authentication.dao.DaoAuthenticationProvider"
+ level="DEBUG" />
+
+ <!-- Camunda related loggers -->
+ <logger name="org.camunda.bpm.engine.jobexecutor.level" level="DEBUG" />
+ <logger
+ name="org.camunda.bpm.engine.impl.persistence.entity.JobEntity.level"
+ level="DEBUG" />
+
+ <logger name="org.flywaydb" level="DEBUG"/>
+ <logger name="org.apache.wire" level="DEBUG" />
+ <logger name="org.onap" level="DEBUG" />
+ <logger name="org.apache.cxf.interceptor" level="DEBUG" />
+ <logger name="com.woorea.openstack.connector" level="DEBUG" />
+
+ <!-- AAF Logs go here-->
+ <logger name="org.apache.catalina.core.ContainerBase" level="INFO" additivity="false">
+ <appender-ref ref="asyncCadi" />
+ </logger>
+
+ <logger name="org.reflections.Reflections" level="ERROR" additivity="false">
+ <appender-ref ref="asyncCadi" />
+ </logger>
+
+ <logger name="AUDIT" level="INFO" additivity="false">
+ <appender-ref ref="asyncAudit" />
+ </logger>
+
+ <logger name="METRIC" level="INFO" additivity="false">
+ <appender-ref ref="asyncMetric" />
+ </logger>
+
+ <root level="INFO">
+ <appender-ref ref="asyncDebug" />
+ <appender-ref ref="asyncError" />
+ <appender-ref ref="asyncAudit" />
+ <appender-ref ref="asyncMetric" />
+ </root>
+
+</configuration>
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ApiHandlerApplication.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ApiHandlerApplication.java
index 5beb4810ec..482fd8868a 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ApiHandlerApplication.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ApiHandlerApplication.java
@@ -21,7 +21,7 @@
package org.onap.so.apihandlerinfra;
import java.util.concurrent.Executor;
-import org.onap.so.logging.jaxrs.filter.MDCTaskDecorator;
+import org.onap.logging.filter.spring.MDCTaskDecorator;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java
index 2703e1edd3..271efddc71 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java
@@ -28,6 +28,7 @@ import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Context;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.servlet.ServletProperties;
+import org.onap.logging.filter.base.Constants;
import org.onap.so.apihandler.filters.RequestIdFilter;
import org.onap.so.apihandlerinfra.exceptions.ApiExceptionMapper;
import org.onap.so.apihandlerinfra.infra.rest.Network;
@@ -43,7 +44,7 @@ import org.onap.so.apihandlerinfra.infra.rest.exception.mapper.WorkflowEngineCon
import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestration;
import org.onap.so.apihandlerinfra.tenantisolation.CloudResourcesOrchestration;
import org.onap.so.apihandlerinfra.tenantisolation.ModelDistributionRequest;
-import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging;
+import org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter;
import org.onap.so.web.exceptions.RuntimeExceptionMapper;
import org.springframework.context.annotation.Configuration;
import io.swagger.v3.jaxrs2.integration.JaxrsOpenApiContextBuilder;
@@ -60,6 +61,7 @@ public class JerseyConfiguration extends ResourceConfig {
@PostConstruct
public void setUp() {
+ System.setProperty(Constants.Property.PARTNER_NAME, "SO.APIH");
register(GlobalHealthcheckHandler.class);
register(NodeHealthcheckHandler.class);
register(ServiceInstances.class);
@@ -72,7 +74,7 @@ public class JerseyConfiguration extends ResourceConfig {
register(Network.class);
register(Volumes.class);
register(ServiceInstance.class);
- register(JaxRsFilterLogging.class);
+ register(SOAuditLogContainerFilter.class);
register(ManualTasks.class);
register(TasksHandler.class);
register(OpenApiResource.class);
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 18ca6d3086..de5edb5b54 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
@@ -38,7 +38,7 @@ import org.onap.so.client.HttpClientFactory;
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.utils.CryptoUtils;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
@@ -105,7 +105,7 @@ public class SDCClientHelper {
URL url = new URL(urlString);
- HttpClient httpClient = httpClientFactory.newJsonClient(url, TargetEntity.SDC);
+ HttpClient httpClient = httpClientFactory.newJsonClient(url, ONAPComponents.SDC);
httpClient.addBasicAuthHeader(sdcClientAuth, msoKey);
httpClient.addAdditionalHeader("X-ECOMP-InstanceID", sdcActivateInstanceId);
httpClient.addAdditionalHeader("X-ECOMP-RequestID", UUID.randomUUID().toString());
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java
index 9fc9e4a51b..276f891eb2 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java
@@ -29,9 +29,10 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
-import static org.onap.so.logger.HttpHeadersConstants.ONAP_REQUEST_ID;
+import static org.onap.logging.filter.base.Constants.HttpHeaders.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.logging.filter.base.Constants.HttpHeaders.CLIENT_ID;
+import static org.onap.logging.filter.base.Constants.HttpHeaders.TRANSACTION_ID;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
@@ -81,7 +82,7 @@ public class InstanceManagementTest extends BaseTest {
// set headers
headers = new HttpHeaders();
headers.set(ONAPLogConstants.Headers.PARTNER_NAME, "test_name");
- headers.set(HttpHeadersConstants.TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
+ headers.set(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(CLIENT_ID, "VID");
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 ad0a878931..8a112e3fdd 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
@@ -28,15 +28,15 @@ import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
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 static org.onap.logging.filter.base.Constants.HttpHeaders.ECOMP_REQUEST_ID;
+import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.INVOCATION_ID;
+import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.PARTNER_NAME;
+import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.RESPONSE_CODE;
+import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION;
+import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.LOG_TIMESTAMP;
+import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.SERVICE_NAME;
+import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE;
+import static org.onap.logging.filter.base.Constants.HttpHeaders.CLIENT_ID;
import java.io.IOException;
import java.util.Map;
import javax.ws.rs.core.MediaType;
@@ -110,27 +110,27 @@ public class ManualTasksTest extends BaseTest {
assertThat(realResponse, sameBeanAs(expectedResponse));
for (ILoggingEvent logEvent : TestAppender.events)
- if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging")
+ if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter")
&& logEvent.getMarker() != null && logEvent.getMarker().getName().equals("ENTRY")) {
Map<String, String> mdc = logEvent.getMDCPropertyMap();
assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
assertNotNull(mdc.get(INVOCATION_ID));
- assertEquals("UNKNOWN", mdc.get(PARTNERNAME));
+ assertEquals("UNKNOWN", mdc.get(PARTNER_NAME));
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")
+ assertEquals("INPROGRESS", mdc.get(RESPONSE_STATUS_CODE));
+ } else if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter")
&& logEvent.getMarker() != null && logEvent.getMarker().getName().equals("EXIT")) {
Map<String, String> mdc = logEvent.getMDCPropertyMap();
assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
- assertNotNull(mdc.get(ENDTIME));
+ assertNotNull(mdc.get(LOG_TIMESTAMP));
assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
assertNotNull(mdc.get(INVOCATION_ID));
- assertEquals("202", mdc.get(RESPONSECODE));
- assertEquals("UNKNOWN", mdc.get(PARTNERNAME));
+ assertEquals("202", mdc.get(RESPONSE_CODE));
+ assertEquals("UNKNOWN", mdc.get(PARTNER_NAME));
assertEquals("tasks/v1/55/complete", mdc.get(SERVICE_NAME));
- assertEquals("COMPLETE", mdc.get(STATUSCODE));
- assertNotNull(mdc.get(RESPONSEDESC));
+ assertEquals("COMPLETE", mdc.get(RESPONSE_STATUS_CODE));
+ assertNotNull(mdc.get(RESPONSE_DESCRIPTION));
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));
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java
index e4532cd8d7..d0561a4518 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java
@@ -30,9 +30,10 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
-import static org.onap.so.logger.HttpHeadersConstants.ONAP_REQUEST_ID;
+import static org.onap.logging.filter.base.Constants.HttpHeaders.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.logging.filter.base.Constants.HttpHeaders.CLIENT_ID;
+import static org.onap.logging.filter.base.Constants.HttpHeaders.TRANSACTION_ID;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
@@ -95,7 +96,7 @@ public class RequestHandlerUtilsTest extends BaseTest {
// set headers
headers = new HttpHeaders();
headers.set(ONAPLogConstants.Headers.PARTNER_NAME, "test_name");
- headers.set(HttpHeadersConstants.TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
+ headers.set(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(CLIENT_ID, "VID");
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 48a5343104..94436d54b0 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
@@ -33,17 +33,10 @@ 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.logging.filter.base.Constants.HttpHeaders.ONAP_REQUEST_ID;
import static org.onap.so.logger.HttpHeadersConstants.REQUESTOR_ID;
-import static org.onap.so.logger.HttpHeadersConstants.TRANSACTION_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.logging.filter.base.Constants.HttpHeaders.TRANSACTION_ID;
+import static org.onap.logging.filter.base.Constants.HttpHeaders.CLIENT_ID;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
@@ -64,7 +57,6 @@ 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.HttpHeadersConstants;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.ModelInfo;
import org.onap.so.serviceinstancebeans.ModelType;
@@ -121,7 +113,7 @@ public class ServiceInstancesTest extends BaseTest {
// set headers
headers = new HttpHeaders();
headers.set(ONAPLogConstants.Headers.PARTNER_NAME, "test_name");
- headers.set(HttpHeadersConstants.TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
+ headers.set(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(CLIENT_ID, "VID");
@@ -229,27 +221,29 @@ public class ServiceInstancesTest extends BaseTest {
for (ILoggingEvent logEvent : TestAppender.events)
- if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging")
+ if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter")
&& logEvent.getMarker() != null && logEvent.getMarker().getName().equals("ENTRY")) {
Map<String, String> mdc = logEvent.getMDCPropertyMap();
assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
- 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")
+ assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID));
+ assertEquals("UNKNOWN", mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME));
+ assertEquals("onap/so/infra/serviceInstantiation/v5/serviceInstances",
+ mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME));
+ assertEquals("INPROGRESS", mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
+ } else if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter")
&& logEvent.getMarker() != null && logEvent.getMarker().getName().equals("EXIT")) {
Map<String, String> mdc = logEvent.getMDCPropertyMap();
assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
- assertNotNull(mdc.get(ENDTIME));
+ assertNotNull(mdc.get(ONAPLogConstants.MDCs.LOG_TIMESTAMP));
assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
- 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));
+ assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID));
+ assertEquals("202", mdc.get(ONAPLogConstants.MDCs.RESPONSE_CODE));
+ assertEquals("UNKNOWN", mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME));
+ assertEquals("onap/so/infra/serviceInstantiation/v5/serviceInstances",
+ mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME));
+ assertEquals("COMPLETE", mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
+ assertNotNull(mdc.get(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION));
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));
@@ -406,6 +400,15 @@ public class ServiceInstancesTest extends BaseTest {
.withStatus(HttpStatus.SC_NOT_FOUND)));
assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatusCode().value());
+
+ for (ILoggingEvent logEvent : TestAppender.events) {
+ if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.SOAuditLogContainerFilter")
+ && 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));
+ assertNotNull(mdc.get("PartnerName"));
+ }
+ }
}
@Test
@@ -2571,11 +2574,11 @@ public class ServiceInstancesTest extends BaseTest {
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")
+ if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter")
&& 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(PARTNERNAME));
+ assertEquals("VID", mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME));
}
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/client/grm/GRMClientTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/client/grm/GRMClientTest.java
index f178a3c0cb..cfb865c9e1 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/client/grm/GRMClientTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/client/grm/GRMClientTest.java
@@ -82,15 +82,15 @@ public class GRMClientTest extends BaseTest {
boolean foundInvoke = false;
boolean foundInvokeReturn = false;
for (ILoggingEvent logEvent : TestAppender.events)
- if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.JaxRsClientLogging")
+ if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.SOMetricLogClientFilter")
&& logEvent.getMarker() != null && logEvent.getMarker().getName().equals("INVOKE")) {
Map<String, String> mdc = logEvent.getMDCPropertyMap();
assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID));
assertEquals("GRM", mdc.get("TargetEntity"));
assertEquals("INPROGRESS", mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
foundInvoke = true;
- } else if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.JaxRsClientLogging")
- && logEvent.getMarker() != null && logEvent.getMarker().getName().equals("INVOKE_RETURN")) {
+ } else if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.SOMetricLogClientFilter")
+ && logEvent.getMarker() != null && logEvent.getMarker().getName().equals("INVOKE-RETURN")) {
Map<String, String> mdc = logEvent.getMDCPropertyMap();
assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID));
assertEquals("200", mdc.get(ONAPLogConstants.MDCs.RESPONSE_CODE));
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java
index 9be92ad93a..5ea0d3c54a 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java
@@ -44,7 +44,7 @@ import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus;
import org.onap.so.db.request.beans.WatchdogDistributionStatus;
import org.onap.so.db.request.beans.WatchdogServiceModVerIdLookup;
import org.onap.so.db.request.data.controller.InstanceNameDuplicateCheckRequest;
-import org.onap.so.logging.jaxrs.filter.SpringClientFilter;
+import org.onap.so.logging.jaxrs.filter.SOSpringClientFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Primary;
@@ -157,7 +157,7 @@ public class RequestsDbClient {
return Configuration.builder().setBaseUri(baseUri).setClientHttpRequestFactory(factory)
.setRestTemplateConfigurer(restTemplate -> {
- restTemplate.getInterceptors().add((new SpringClientFilter()));
+ restTemplate.getInterceptors().add((new SOSpringClientFilter()));
restTemplate.getInterceptors().add((request, body, execution) -> {
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
index 23539b074d..fcafe90405 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
@@ -30,6 +30,7 @@ import javax.persistence.EntityNotFoundException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriBuilder;
import org.apache.http.HttpStatus;
+import org.onap.logging.filter.base.Constants;
import org.onap.so.db.catalog.beans.BuildingBlockDetail;
import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.db.catalog.beans.CloudifyManager;
@@ -64,7 +65,7 @@ import org.onap.so.db.catalog.beans.macro.NorthBoundRequest;
import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus;
import org.onap.so.logger.LogConstants;
-import org.onap.so.logging.jaxrs.filter.SpringClientFilter;
+import org.onap.so.logging.jaxrs.filter.SOSpringClientFilter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -366,12 +367,12 @@ public class CatalogDbClient {
ClientFactory clientFactory =
Configuration.builder().setClientHttpRequestFactory(factory).setRestTemplateConfigurer(restTemplate -> {
- restTemplate.getInterceptors().add((new SpringClientFilter()));
+ restTemplate.getInterceptors().add((new SOSpringClientFilter()));
restTemplate.getInterceptors().add((request, body, execution) -> {
request.getHeaders().add(HttpHeaders.AUTHORIZATION, msoAdaptersAuth);
- request.getHeaders().add(LogConstants.TARGET_ENTITY_HEADER, TARGET_ENTITY);
+ request.getHeaders().add(Constants.HttpHeaders.TARGET_ENTITY_HEADER, TARGET_ENTITY);
return execution.execute(request, body);
});
}).build().buildClientFactory();
@@ -415,12 +416,12 @@ public class CatalogDbClient {
ClientFactory clientFactory = Configuration.builder().setBaseUri(baseUri).setClientHttpRequestFactory(factory)
.setRestTemplateConfigurer(restTemplate -> {
- restTemplate.getInterceptors().add((new SpringClientFilter()));
+ restTemplate.getInterceptors().add((new SOSpringClientFilter()));
restTemplate.getInterceptors().add((request, body, execution) -> {
request.getHeaders().add(HttpHeaders.AUTHORIZATION, auth);
- request.getHeaders().add(LogConstants.TARGET_ENTITY_HEADER, TARGET_ENTITY);
+ request.getHeaders().add(Constants.HttpHeaders.TARGET_ENTITY_HEADER, TARGET_ENTITY);
return execution.execute(request, body);
});
}).build().buildClientFactory();
@@ -1007,7 +1008,7 @@ public class CatalogDbClient {
headers.set(HttpHeaders.AUTHORIZATION, msoAdaptersAuth);
headers.set(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON);
headers.set(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON);
- headers.set(LogConstants.TARGET_ENTITY_HEADER, TARGET_ENTITY);
+ headers.set(Constants.HttpHeaders.TARGET_ENTITY_HEADER, TARGET_ENTITY);
return headers;
}
diff --git a/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml b/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml
index e1de3317e7..c68495d27e 100644
--- a/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml
+++ b/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml
@@ -1,12 +1,12 @@
-<!-- ============LICENSE_START=======================================================
- ECOMP MSO ================================================================================
- Copyright (C) 2017 AT&T Intellectual Property. 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
+<!-- ============LICENSE_START=======================================================
+ ECOMP MSO ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. 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========================================================= -->
<configuration scan="true" debug="false">
@@ -23,20 +23,20 @@
<property name="metricsLogName" value="metrics" />
<property name="auditLogName" value="audit" />
<property name="debugLogName" value="debug" />
-
+
<property name="currentTimeStamp" value="%d{&quot;yyyy-MM-dd'T'HH:mm:ss.SSSXXX&quot;,UTC}"/>
<property name="errorPattern"
value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestID}|%thread|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%.-5level|%X{ErrorCode:-500}|%X{ErrorDesc}|%msg%n" />
<property name="debugPattern"
- value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestID}| %logger{50} - %msg%n" />
+ value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestID}|%logger{50} - %msg%n" />
<property name="auditPattern"
- value="%X{EntryTimestamp}|%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX,UTC}|%X{RequestID}|%X{ServiceInstanceId}|%thread||%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDesc}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{Timer}|%X{ServerFQDN}|%X{RemoteHost}||||||||%msg%n" />
+ value="%X{EntryTimestamp}|%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX,UTC}|%X{RequestID}|%X{ServiceInstanceId}|%thread||%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDesc}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}||||%marker|%mdc|||%msg%n" />
<property name="metricPattern"
- value="%X{InvokeTimestamp}|%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX,UTC}|%X{RequestID}|%X{ServiceInstanceId}|%thread||%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDesc}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{Timer}|%X{ServerFQDN}|%X{RemoteHost}||||%X{TargetVirtualEntity}|||||%msg%n" />
+ value="%X{InvokeTimestamp}|%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX,UTC}|%X{RequestID}|%X{ServiceInstanceId}|%thread||%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDesc}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}||||%X{TargetVirtualEntity}|%marker|%mdc|||%msg%n" />
<property name="defaultPattern"
value="%nopexception%logger
@@ -52,7 +52,7 @@
<appender name="Audit"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.core.filter.EvaluatorFilter">
- <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
+ <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
<marker>EXIT</marker>
</evaluator>
<onMismatch>DENY</onMismatch>
@@ -80,8 +80,8 @@
<appender name="Metric"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.core.filter.EvaluatorFilter">
- <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
- <marker>INVOKE_RETURN</marker>
+ <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
+ <marker>INVOKE-RETURN</marker>
</evaluator>
<onMismatch>DENY</onMismatch>
<onMatch>ACCEPT</onMatch>
@@ -137,7 +137,7 @@
<filter class="ch.qos.logback.core.filter.EvaluatorFilter">
<evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
<marker>INVOKE</marker>
- <marker>INVOKE_RETURN</marker>
+ <marker>INVOKE-RETURN</marker>
<marker>ENTRY</marker>
<marker>EXIT</marker>
</evaluator>
@@ -180,6 +180,7 @@
<logger name="org.onap" level="DEBUG" />
<logger name="com.att.ecomp" level="DEBUG" />
<logger name="org.apache.cxf.interceptor" level="DEBUG" />
+ <logger name="com.att.commons" level="DEBUG" />
<logger name="AUDIT" level="INFO" additivity="false">
<appender-ref ref="asyncAudit" />
diff --git a/pom.xml b/pom.xml
index d5cd1f4a0b..01f44f94b7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -635,6 +635,21 @@
<!-- *********************************************************************************************************** -->
<!-- Dependencies -->
<dependencies>
+ <dependency>
+ <groupId>org.onap.logging-analytics</groupId>
+ <artifactId>logging-slf4j</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.logging-analytics</groupId>
+ <artifactId>logging-filter-base</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.logging-analytics</groupId>
+ <artifactId>logging-filter-spring</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ </dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>