From 2a1c1ccabf1d8d681870578f54ae66455fadf9e7 Mon Sep 17 00:00:00 2001 From: "r.bogacki" Date: Wed, 13 Mar 2019 14:05:22 +0100 Subject: Reduced content of MsoLogger Cleaned java code dependencies for 'setLogContext' and 'getServiceName' methods from MsoLogger. Fixed imports. Change-Id: I33251c837088ce580ffa1c44e69766c77283004b Issue-ID: LOG-631 Signed-off-by: Robert Bogacki --- .../onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java | 9 +-------- .../org/onap/so/adapters/network/MsoNetworkAdapterImpl.java | 9 +++------ .../org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java | 5 +---- .../java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java | 11 ++++------- .../main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java | 9 +++------ .../org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java | 11 ++--------- .../org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java | 10 +--------- 7 files changed, 15 insertions(+), 49 deletions(-) (limited to 'adapters') diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java index 25d8e564da..d0ffa27027 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java @@ -126,9 +126,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { String messageId, MsoRequest msoRequest, String notificationUrl) { - String error; - MsoLogger.setLogContext (msoRequest); logger.debug("Async Create Network: {} of type {} in {}/{}", networkName, networkType, cloudSiteId, tenantId); // Use the synchronous method to perform the actual Create @@ -252,7 +250,6 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { MsoRequest msoRequest, String notificationUrl) { - MsoLogger.setLogContext (msoRequest); logger.debug("Async Update Network: {} of type {} in {}/{}", networkId, networkType, cloudSiteId, tenantId); // Use the synchronous method to perform the actual Create @@ -342,9 +339,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { String messageId, MsoRequest msoRequest, String notificationUrl) { - String error; - MsoLogger.setLogContext (msoRequest); logger.debug("Async Query Network {} in {}/{}", networkNameOrId, cloudSiteId, tenantId); String errorCreateNetworkMessage = "{} {} Error sending createNetwork notification {} "; @@ -440,8 +435,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { String messageId, MsoRequest msoRequest, String notificationUrl) { - String error; - MsoLogger.setLogContext (msoRequest); + String serviceName = "DeleteNetworkA"; logger.debug("Async Delete Network {} in {}/{}", networkId, cloudSiteId, tenantId); @@ -507,7 +501,6 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { return; } - MsoLogger.setLogContext (rollback.getMsoRequest ()); logger.info("{} {}", MessageEnum.RA_ASYNC_ROLLBACK, rollback.getNetworkStackId()); // Use the synchronous method to perform the actual Create diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java index bcb6b1be42..fc2fc4844b 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java @@ -266,7 +266,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { Holder networkFqdn, Holder > subnetIdMap, Holder rollback) throws NetworkException { - MsoLogger.setLogContext (msoRequest); logger.debug("*** CREATE Network: {} of type {} in {}/{}", networkName, networkType, cloudSiteId, tenantId); // Will capture execution time for metrics @@ -712,7 +711,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { MsoRequest msoRequest, Holder > subnetIdMap, Holder rollback) throws NetworkException { - MsoLogger.setLogContext (msoRequest); + logger.debug("***UPDATE Network adapter with Network: {} of type {} in {}/{}", networkName, networkType, cloudSiteId, tenantId); @@ -1147,7 +1146,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { Holder > vlans, Holder > routeTargets, Holder > subnetIdMap) throws NetworkException { - MsoLogger.setLogContext (msoRequest); + logger.debug("*** QUERY Network with Network: {} in {}/{}", networkNameOrId, cloudSiteId, tenantId); // Will capture execution time for metrics @@ -1285,7 +1284,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { String networkId, MsoRequest msoRequest, Holder networkDeleted) throws NetworkException { - MsoLogger.setLogContext (msoRequest); + logger.debug("*** DELETE Network adapter with Network: {} in {}/{}", networkId, cloudSiteId, tenantId); // Will capture execution time for metrics @@ -1386,8 +1385,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { return; } - MsoLogger.setLogContext (rollback.getMsoRequest()); - // Get the elements of the VnfRollback object for easier access String cloudSiteId = rollback.getCloudId (); String tenantId = rollback.getTenantId (); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java index a937bd9499..f46a95df91 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java @@ -88,7 +88,6 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter { MsoRequest msoRequest, Holder tenantId, Holder rollback) throws TenantException { - MsoLogger.setLogContext (msoRequest); logger.debug("Call to MSO createTenant adapter. Creating Tenant: {} in {}", tenantName, cloudSiteId); @@ -152,7 +151,7 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter { Holder tenantId, Holder tenantName, Holder > metadata) throws TenantException { - MsoLogger.setLogContext (msoRequest); + logger.debug ("Querying Tenant {} in {}", tenantNameOrId, cloudSiteId); MsoTenantUtils tUtils; @@ -196,7 +195,6 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter { String tenantId, MsoRequest msoRequest, Holder tenantDeleted) throws TenantException { - MsoLogger.setLogContext (msoRequest); logger.debug ("Deleting Tenant {} in {}", tenantId, cloudSiteId); @@ -238,7 +236,6 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter { String cloudSiteId = rollback.getCloudId (); String tenantId = rollback.getTenantId (); - MsoLogger.setLogContext (rollback.getMsoRequest ()); logger.debug("Rolling Back Tenant {} in {}", rollback.getTenantId(), cloudSiteId); if (rollback.getTenantCreated ()) { diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java index b445dc8a26..cf52280b3f 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java @@ -132,7 +132,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { String messageId, MsoRequest msoRequest, String notificationUrl) { - MsoLogger.setLogContext (msoRequest); + logger.info("{} createVnfA", MessageEnum.RA_ASYNC_CREATE_VNF); // Use the synchronous method to perform the actual Create MsoVnfAdapter vnfAdapter = vnfImpl; @@ -213,7 +213,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { String messageId, MsoRequest msoRequest, String notificationUrl) { - MsoLogger.setLogContext (msoRequest); + logger.info("{} UpdateVnfA", MessageEnum.RA_ASYNC_UPDATE_VNF); // Use the synchronous method to perform the actual Create @@ -289,9 +289,8 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { String messageId, MsoRequest msoRequest, String notificationUrl) { - String error; + String serviceName = "QueryVnfA"; - MsoLogger.setLogContext (msoRequest); logger.info("{}", MessageEnum.RA_ASYNC_QUERY_VNF); // Use the synchronous method to perform the actual query @@ -376,9 +375,8 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { String messageId, MsoRequest msoRequest, String notificationUrl) { - String error; + String serviceName = "DeleteVnfA"; - MsoLogger.setLogContext (msoRequest); logger.info("{}", MessageEnum.RA_ASYNC_DELETE_VNF); // Use the synchronous method to perform the actual delete @@ -441,7 +439,6 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { return; } - MsoLogger.setLogContext (rollback.getMsoRequest ()); logger.info("{} rollbackVnfA", MessageEnum.RA_ASYNC_ROLLBACK_VNF); // Use the synchronous method to perform the actual rollback diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java index a1d7698ad1..4d915f9e84 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java @@ -302,7 +302,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { Holder vnfId, Holder status, Holder > outputs) throws VnfException { - MsoLogger.setLogContext (msoRequest); + logger.debug("Querying VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId); // Will capture execution time for metrics @@ -361,7 +361,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String tenantId, String vnfName, MsoRequest msoRequest) throws VnfException { - MsoLogger.setLogContext (msoRequest); + logger.debug("Deleting VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId); // Will capture execution time for metrics long startTime = System.currentTimeMillis (); @@ -409,15 +409,12 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String tenantId = rollback.getTenantId (); String vnfId = rollback.getVnfId (); - MsoLogger.setLogContext (rollback.getMsoRequest()); - logger.debug("Rolling Back VNF {} in {}", vnfId, cloudSiteId + "/" + tenantId); // Use the MsoHeatUtils to delete the stack. Set the polling flag to true. // The possible outcomes of deleteStack are a StackInfo object with status // of NOTFOUND (on success) or FAILED (on error). Also, MsoOpenstackException // could be thrown. - long subStartTime = System.currentTimeMillis (); try { heat.deleteStack (tenantId, cloudSiteId, vnfId, true); } catch (MsoException me) { @@ -600,7 +597,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { useMCUuid = true; } } - MsoLogger.setLogContext (msoRequest); + String requestTypeString = ""; if (requestType != null && !"".equals(requestType)) { requestTypeString = requestType; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java index bba960cddf..833e200ce9 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java @@ -206,7 +206,6 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { Holder > outputs) throws VnfException { - MsoLogger.setLogContext (msoRequest); logger.debug ("Querying VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId); // Will capture execution time for metrics @@ -264,7 +263,6 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { String tenantId, String vnfName, MsoRequest msoRequest) throws VnfException { - MsoLogger.setLogContext (msoRequest); // This operation is no longer supported at the VNF level. The adapter is only called to deploy modules. logger.debug("DeleteVNF command attempted but not supported"); @@ -285,8 +283,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { long startTime = System.currentTimeMillis (); // rollback may be null (e.g. if stack already existed when Create was called) if (rollback == null) { - logger.info ("{} {} {} {}", MessageEnum.RA_ROLLBACK_NULL.toString(), "OpenStack", "rollbackVnf", MsoLogger - .getServiceName()); + logger.info ("{} {} {}", MessageEnum.RA_ROLLBACK_NULL.toString(), "OpenStack", "rollbackVnf"); return; } @@ -300,8 +297,6 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { String tenantId = rollback.getTenantId (); String vfModuleId = rollback.getVfModuleStackId (); - MsoLogger.setLogContext (rollback.getMsoRequest()); - logger.debug("Rolling Back VF Module {} in {}", vfModuleId, cloudSiteId + "/" + tenantId); DeploymentInfo deployment = null; @@ -576,8 +571,6 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { // Will capture execution time for metrics long startTime = System.currentTimeMillis (); - MsoLogger.setLogContext (msoRequest); - // Require a model customization ID. Every VF Module definition must have one. if (modelCustomizationUuid == null || modelCustomizationUuid.isEmpty()) { logger.debug("Missing required input: modelCustomizationUuid"); @@ -1179,7 +1172,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { String vnfName, MsoRequest msoRequest, Holder > outputs) throws VnfException { - MsoLogger.setLogContext (msoRequest); + logger.debug ("Deleting VF " + vnfName + " in " + cloudSiteId + "/" + tenantId); // Will capture execution time for metrics long startTime = System.currentTimeMillis (); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java index 704d54c918..b1b97b695e 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java @@ -225,7 +225,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { Holder > outputs) throws VnfException { - MsoLogger.setLogContext (msoRequest); logger.debug("Querying VNF " + vnfNameOrId + " in " + cloudSiteId + "/" + tenantId); // Will capture execution time for metrics @@ -281,7 +280,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { String tenantId, String vnfName, MsoRequest msoRequest) throws VnfException { - MsoLogger.setLogContext (msoRequest); // This operation is no longer supported at the VNF level. The adapter is only called to deploy modules. logger.debug("DeleteVNF command attempted but not supported"); @@ -302,8 +300,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { long startTime = System.currentTimeMillis (); // rollback may be null (e.g. if stack already existed when Create was called) if (rollback == null) { - logger.info("{} {} {} {}", MessageEnum.RA_ROLLBACK_NULL.toString(), "OpenStack", "rollbackVnf", - MsoLogger.getServiceName()); + logger.info("{} {} {}", MessageEnum.RA_ROLLBACK_NULL.toString(), "OpenStack", "rollbackVnf"); return; } @@ -319,8 +316,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { String vfModuleId = rollback.getVfModuleStackId (); - MsoLogger.setLogContext (rollback.getMsoRequest()); - logger.debug("Rolling Back VF Module " + vfModuleId + " in " + cloudSiteId + "/" + tenantId); VduInstance vduInstance = null; @@ -618,8 +613,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { // Will capture execution time for metrics long startTime = System.currentTimeMillis (); - MsoLogger.setLogContext (msoRequest); - // Require a model customization ID. Every VF Module definition must have one. if (modelCustomizationUuid == null || modelCustomizationUuid.isEmpty()) { logger.debug("Missing required input: modelCustomizationUuid"); @@ -1165,7 +1158,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { MsoRequest msoRequest, Holder > outputs) throws VnfException { - MsoLogger.setLogContext (msoRequest); logger.debug("Deleting VF Module " + vfModuleId + " in " + cloudSiteId + "/" + tenantId); // Will capture execution time for metrics -- cgit 1.2.3-korg