diff options
author | Steve Smokowski <ss835w@att.com> | 2019-06-10 14:43:07 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-06-10 14:43:07 +0000 |
commit | 33ce1d167c0daba899887b8ecd16b8a508cf12a0 (patch) | |
tree | 1f1b33d81329020c3463ea364ffbc25d96895aa8 /adapters | |
parent | 6ec917f8f6490861a47f2b03a6065cc1da2be1dc (diff) | |
parent | 48b34de1fd7d68f41e868a25e8817346af6ef85a (diff) |
Merge "replaced String.repeat with static final strings"
Diffstat (limited to 'adapters')
24 files changed, 235 insertions, 251 deletions
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 429948cef1..a9af3683f5 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 @@ -47,6 +47,7 @@ import org.onap.so.adapters.network.async.client.UpdateNetworkNotification; import org.onap.so.adapters.network.exceptions.NetworkException; import org.onap.so.entity.MsoRequest; import org.onap.so.logger.ErrorCode; +import org.onap.so.logger.LoggingAnchor; import org.onap.so.logger.MessageEnum; import org.onap.so.openstack.beans.NetworkRollback; import org.onap.so.openstack.beans.NetworkStatus; @@ -404,7 +405,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { return; } - logger.info("{} {}", MessageEnum.RA_ASYNC_ROLLBACK, rollback.getNetworkStackId()); + logger.info(LoggingAnchor.TWO, 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 dd2d9f95f7..d2c0d9cabd 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 @@ -33,7 +33,7 @@ import java.util.Map; import java.util.Optional; import javax.jws.WebService; import javax.xml.ws.Holder; -import com.google.common.base.Strings; +import org.onap.so.logger.LoggingAnchor; import org.onap.so.adapters.network.beans.ContrailPolicyRef; import org.onap.so.adapters.network.beans.ContrailPolicyRefSeq; import org.onap.so.adapters.network.beans.ContrailSubnet; @@ -206,7 +206,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { String error = String.format( "Configuration Error. Stack %s in %s/%s: CloudSite does not exist in MSO Configuration", networkName, cloudSiteId, tenantId); - logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error); + logger.error(LoggingAnchor.THREE, MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error); // Set the detailed error as the Exception 'message' throw new NetworkException(error, MsoExceptionCategory.USERDATA); } @@ -241,7 +241,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { if (failIfExists != null && failIfExists) { String error = String.format("Create Nework: Network %s already exists in %s/%s with ID %s", networkName, cloudSiteId, tenantId, netInfo.getId()); - logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_NETWORK_ALREADY_EXIST, + logger.error(LoggingAnchor.THREE, MessageEnum.RA_NETWORK_ALREADY_EXIST, ErrorCode.DataError.getValue(), error); throw new NetworkException(error, MsoExceptionCategory.USERDATA); } else { @@ -286,7 +286,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { HeatTemplate heatTemplate = networkResource.getHeatTemplate(); if (heatTemplate == null) { String error = String.format("Network error - undefined Heat Template. Network Type = %s", networkType); - logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_PARAM_NOT_FOUND, ErrorCode.DataError.getValue(), + logger.error(LoggingAnchor.THREE, MessageEnum.RA_PARAM_NOT_FOUND, ErrorCode.DataError.getValue(), error); throw new NetworkException(error, MsoExceptionCategory.INTERNAL); } @@ -324,7 +324,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { if (failIfExists != null && failIfExists) { String error = String.format("CreateNetwork: Stack %s already exists in %s/%s as %s", networkName, cloudSiteId, tenantId, heatStack.getCanonicalName()); - logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_NETWORK_ALREADY_EXIST, + logger.error(LoggingAnchor.THREE, MessageEnum.RA_NETWORK_ALREADY_EXIST, ErrorCode.DataError.getValue(), error); throw new NetworkException(error, MsoExceptionCategory.USERDATA); } else { @@ -373,8 +373,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { stackParams = heat.validateStackParams(stackParams, heatTemplate); } catch (IllegalArgumentException e) { String error = "Create Network: Configuration Error: " + e.getMessage(); - logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error, - e); + logger.error(LoggingAnchor.THREE, MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error, e); // Input parameters were not valid throw new NetworkException(error, MsoExceptionCategory.INTERNAL); } @@ -540,7 +539,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { String error = String.format( "UpdateNetwork: Configuration Error. Stack %s in %s/%s: CloudSite does not exist in MSO Configuration", networkName, cloudSiteId, tenantId); - logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error); + logger.error(LoggingAnchor.THREE, MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error); // Set the detailed error as the Exception 'message' throw new NetworkException(error, MsoExceptionCategory.USERDATA); } @@ -572,7 +571,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { if (netInfo == null) { String error = String.format("Update Nework: Network %s does not exist in %s/%s", networkId, cloudSiteId, tenantId); - logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_NETWORK_NOT_FOUND, + logger.error(LoggingAnchor.THREE, MessageEnum.RA_NETWORK_NOT_FOUND, ErrorCode.BusinessProcesssError.getValue(), error); // Does not exist. Throw an exception (can't update a non-existent network) throw new NetworkException(error, MsoExceptionCategory.USERDATA); @@ -616,7 +615,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { if (heatStack == null || (heatStack.getStatus() == HeatStatus.NOTFOUND)) { String error = String.format("UpdateNetwork: Stack %s does not exist in %s/%s", networkName, cloudSiteId, tenantId); - logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_NETWORK_NOT_FOUND, ErrorCode.DataError.getValue(), + logger.error(LoggingAnchor.THREE, MessageEnum.RA_NETWORK_NOT_FOUND, ErrorCode.DataError.getValue(), error); // Network stack does not exist. Return an error throw new NetworkException(error, MsoExceptionCategory.USERDATA); @@ -648,7 +647,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { HeatTemplate heatTemplate = networkResource.getHeatTemplate(); if (heatTemplate == null) { String error = "Network error - undefined Heat Template. Network Type=" + networkType; - logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_PARAM_NOT_FOUND, ErrorCode.DataError.getValue(), + logger.error(LoggingAnchor.THREE, MessageEnum.RA_PARAM_NOT_FOUND, ErrorCode.DataError.getValue(), error); throw new NetworkException(error, MsoExceptionCategory.INTERNAL); } @@ -677,8 +676,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { stackParams = heat.validateStackParams(stackParams, heatTemplate); } catch (IllegalArgumentException e) { String error = "UpdateNetwork: Configuration Error: Network Type=" + networkType; - logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), - error); + logger.error(LoggingAnchor.THREE, MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error); throw new NetworkException(error, MsoExceptionCategory.INTERNAL, e); } @@ -808,7 +806,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { String error = String.format( "Create/UpdateNetwork: Unable to get network resource with NetworkType: %s or ModelCustomizationUUID:%s", networkType, modelCustomizationUuid); - logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_UNKOWN_PARAM, ErrorCode.DataError.getValue(), error); + logger.error(LoggingAnchor.THREE, MessageEnum.RA_UNKOWN_PARAM, ErrorCode.DataError.getValue(), error); throw new NetworkException(error, MsoExceptionCategory.USERDATA); } @@ -820,7 +818,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { // All Networks are orchestrated via HEAT or Neutron if (!("HEAT".equals(mode) || NEUTRON_MODE.equals(mode))) { String error = "CreateNetwork: Configuration Error: Network Type = " + networkType; - logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_NETWORK_ORCHE_MODE_NOT_SUPPORT, + logger.error(LoggingAnchor.THREE, MessageEnum.RA_NETWORK_ORCHE_MODE_NOT_SUPPORT, ErrorCode.DataError.getValue(), error); throw new NetworkException(error, MsoExceptionCategory.INTERNAL); } @@ -842,7 +840,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { "Network Type:%s Version_Min:%s Version_Max:%s not supported on Cloud:%s with AIC_Version:%s", networkType, networkType, networkResource.getAicVersionMin(), networkResource.getAicVersionMax(), cloudSiteId, cloudSite.getCloudVersion()); - logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error); + logger.error(LoggingAnchor.THREE, MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error); throw new NetworkException(error, MsoExceptionCategory.USERDATA); } @@ -851,7 +849,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { validateNetworkParams(neutronNetworkType, networkName, physicalNetworkName, vlans, routeTargets); if (!missing.isEmpty()) { String error = "Create Network: Missing parameters: " + missing; - logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error); + logger.error(LoggingAnchor.THREE, MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error); throw new NetworkException(error, MsoExceptionCategory.USERDATA); } @@ -896,7 +894,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { || commonUtils.isNullOrEmpty(networkNameOrId)) { String error = "Missing mandatory parameter cloudSiteId, tenantId or networkId"; - logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error); + logger.error(LoggingAnchor.THREE, MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error); throw new NetworkException(error, MsoExceptionCategory.USERDATA); } @@ -905,7 +903,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { String error = String.format( "Configuration Error. Stack %s in %s/%s: CloudSite does not exist in MSO Configuration", networkNameOrId, cloudSiteId, tenantId); - logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error); + logger.error(LoggingAnchor.THREE, MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error); // Set the detailed error as the Exception 'message' throw new NetworkException(error, MsoExceptionCategory.USERDATA); } @@ -1023,7 +1021,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { if (commonUtils.isNullOrEmpty(cloudSiteId) || commonUtils.isNullOrEmpty(tenantId) || commonUtils.isNullOrEmpty(networkId)) { String error = "Missing mandatory parameter cloudSiteId, tenantId or networkId"; - logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error); + logger.error(LoggingAnchor.THREE, MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error); throw new NetworkException(error, MsoExceptionCategory.USERDATA); } @@ -1315,8 +1313,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { logger.debug("Json PolicyRefs Data:{}", jsonString); } catch (Exception e) { String error = "Error creating JsonNode for policyRefs Data"; - logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_MARSHING_ERROR, - ErrorCode.BusinessProcesssError.getValue(), error, e); + logger.error(LoggingAnchor.THREE, MessageEnum.RA_MARSHING_ERROR, ErrorCode.BusinessProcesssError.getValue(), + error, e); throw new MsoAdapterException(error); } // update parameters @@ -1392,8 +1390,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { logger.debug("Json Subnet List:{}", jsonString); } catch (Exception e) { String error = "Error creating JsonNode from input subnets"; - logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_MARSHING_ERROR, ErrorCode.DataError.getValue(), error, - e); + logger.error(LoggingAnchor.THREE, MessageEnum.RA_MARSHING_ERROR, ErrorCode.DataError.getValue(), error, e); throw new MsoAdapterException(error); } // update parameters @@ -1439,8 +1436,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { curR = curR.replace("%subnetId%", subnet.getSubnetId()); } else { String error = "Missing Required AAI SubnetId for subnet in HEAT Template"; - logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), - error); + logger.error(LoggingAnchor.THREE, MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error); throw new MsoAdapterException(error); } @@ -1454,8 +1450,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { curR = curR.replace("%cidr%", subnet.getCidr()); } else { String error = "Missing Required cidr for subnet in HEAT Template"; - logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), - error); + logger.error(LoggingAnchor.THREE, MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error); throw new MsoAdapterException(error); } 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 9236945d37..b81efa38e5 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java @@ -45,6 +45,7 @@ import org.onap.so.adapters.vnf.async.client.VnfAdapterNotify_Service; import org.onap.so.adapters.vnf.exceptions.VnfException; import org.onap.so.entity.MsoRequest; import org.onap.so.logger.ErrorCode; +import org.onap.so.logger.LoggingAnchor; import org.onap.so.logger.MessageEnum; import org.onap.so.openstack.beans.VnfRollback; import org.onap.so.openstack.beans.VnfStatus; @@ -153,7 +154,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { logger.error("{} {} Exception sending createVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR, ErrorCode.BusinessProcesssError.getValue(), e1); } - logger.info("{}", MessageEnum.RA_ASYNC_CREATE_VNF_COMPLETE); + logger.info(LoggingAnchor.ONE, MessageEnum.RA_ASYNC_CREATE_VNF_COMPLETE); return; } logger.debug("Async Create VNF: {} VnfId:{}", vnfName, vnfId.value); @@ -245,7 +246,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { MsoRequest msoRequest, String notificationUrl) { String serviceName = "QueryVnfA"; - logger.info("{}", MessageEnum.RA_ASYNC_QUERY_VNF); + logger.info(LoggingAnchor.ONE, MessageEnum.RA_ASYNC_QUERY_VNF); // Use the synchronous method to perform the actual query MsoVnfAdapter vnfAdapter = vnfImpl; @@ -323,7 +324,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { MsoRequest msoRequest, String notificationUrl) { String serviceName = "DeleteVnfA"; - logger.info("{}", MessageEnum.RA_ASYNC_DELETE_VNF); + logger.info(LoggingAnchor.ONE, MessageEnum.RA_ASYNC_DELETE_VNF); // Use the synchronous method to perform the actual delete MsoVnfAdapter vnfAdapter = vnfImpl; 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 d523fedb28..f1b6f838a0 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 @@ -36,7 +36,7 @@ import java.util.Optional; import java.util.concurrent.TimeUnit; import javax.jws.WebService; import javax.xml.ws.Holder; -import com.google.common.base.Strings; +import org.onap.so.logger.LoggingAnchor; import org.apache.commons.collections.CollectionUtils; import org.onap.so.adapters.valet.GenericValetResponse; import org.onap.so.adapters.valet.ValetClient; @@ -268,8 +268,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // Convert to a generic VnfException String error = "Query VNF: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error(Strings.repeat("{} ", 8), MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudSiteId, - tenantId, OPENSTACK, "QueryVNF", ErrorCode.DataError.getValue(), "Exception - queryStack", me); + logger.error(LoggingAnchor.EIGHT, MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudSiteId, tenantId, + OPENSTACK, "QueryVNF", ErrorCode.DataError.getValue(), "Exception - queryStack", me); logger.debug(error); throw new VnfException(me); } @@ -321,9 +321,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // Convert to a generic VnfException String error = "Delete VNF: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudOwner, - cloudSiteId, tenantId, OPENSTACK, "DeleteVNF", ErrorCode.DataError.getValue(), - "Exception - DeleteVNF", me); + logger.error(LoggingAnchor.NINE, MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId, + tenantId, OPENSTACK, "DeleteVNF", ErrorCode.DataError.getValue(), "Exception - DeleteVNF", me); logger.debug(error); throw new VnfException(me); } @@ -365,9 +364,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { me.addContext("RollbackVNF"); String error = "Rollback VNF: " + vnfId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfId, cloudOwner, - cloudSiteId, tenantId, OPENSTACK, "DeleteStack", ErrorCode.DataError.getValue(), - "Exception - DeleteStack", me); + logger.error(LoggingAnchor.NINE, MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfId, cloudOwner, cloudSiteId, + tenantId, OPENSTACK, "DeleteStack", ErrorCode.DataError.getValue(), "Exception - DeleteStack", me); logger.debug(error); throw new VnfException(me); } @@ -643,7 +641,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } catch (MsoException me) { String error = "Create VF Module: Query " + vfModuleName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner, + logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner, cloudSiteId, tenantId, OPENSTACK, "queryStack", ErrorCode.DataError.getValue(), "Exception - queryStack", me); logger.debug(error); @@ -662,8 +660,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Create VF: Stack " + vfModuleName + " already exists and has status " + status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; please wait for it to complete, or fix manually."; - logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, - cloudOwner, cloudSiteId, tenantId, OPENSTACK, "queryStack", ErrorCode.DataError.getValue(), + logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner, + cloudSiteId, tenantId, OPENSTACK, "queryStack", ErrorCode.DataError.getValue(), "Stack " + vfModuleName + " already exists"); logger.debug(error); throw new VnfAlreadyExists(vfModuleName, cloudOwner, cloudSiteId, tenantId, @@ -673,8 +671,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // fail - it exists and is in a FAILED state String error = "Create VF: Stack " + vfModuleName + " already exists and is in FAILED state in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; requires manual intervention."; - logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, - cloudOwner, cloudSiteId, tenantId, OPENSTACK, "queryStack", ErrorCode.DataError.getValue(), + logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner, + cloudSiteId, tenantId, OPENSTACK, "queryStack", ErrorCode.DataError.getValue(), "Stack " + vfModuleName + " already exists and is " + "in FAILED state"); logger.debug(error); throw new VnfAlreadyExists(vfModuleName, cloudOwner, cloudSiteId, tenantId, @@ -685,8 +683,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Create VF: Stack " + vfModuleName + " already exists and has status " + status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; requires manual intervention."; - logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, - cloudOwner, cloudSiteId, tenantId, OPENSTACK, "queryStack", ErrorCode.DataError.getValue(), + logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner, + cloudSiteId, tenantId, OPENSTACK, "queryStack", ErrorCode.DataError.getValue(), "Stack " + vfModuleName + " already exists and is " + "in UPDATED or UNKNOWN state"); logger.debug(error); throw new VnfAlreadyExists(vfModuleName, cloudOwner, cloudSiteId, tenantId, @@ -697,7 +695,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { if (failIfExists != null && failIfExists) { String error = "Create VF: Stack " + vfModuleName + " already exists in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId; - logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, + logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner, cloudSiteId, tenantId, OPENSTACK, "queryStack", ErrorCode.DataError.getValue(), "Stack " + vfModuleName + " already exists"); logger.debug(error); @@ -729,17 +727,17 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { me.addContext("CreateVFModule"); String error = "Create VFModule: Attached heatStack ID Query " + nestedStackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, - cloudOwner, cloudSiteId, tenantId, OPENSTACK, "queryStack", - ErrorCode.BusinessProcesssError.getValue(), "MsoException trying to query nested stack", me); + logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner, + cloudSiteId, tenantId, OPENSTACK, "queryStack", ErrorCode.BusinessProcesssError.getValue(), + "MsoException trying to query nested stack", me); logger.debug("ERROR trying to query nested stack= {}", error); throw new VnfException(me); } if (nestedHeatStack == null || nestedHeatStack.getStatus() == HeatStatus.NOTFOUND) { String error = "Create VFModule: Attached heatStack ID DOES NOT EXIST " + nestedStackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR"; - logger.error(Strings.repeat("{} ", 10), MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, - cloudOwner, cloudSiteId, tenantId, error, OPENSTACK, "queryStack", + logger.error(LoggingAnchor.TEN, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner, + cloudSiteId, tenantId, error, OPENSTACK, "queryStack", ErrorCode.BusinessProcesssError.getValue(), "Create VFModule: Attached heatStack ID " + "DOES NOT EXIST"); logger.debug(error); @@ -763,18 +761,17 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { me.addContext("CreateVFModule"); String error = "Create VFModule: Attached baseHeatStack ID Query " + nestedBaseStackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, - cloudOwner, cloudSiteId, tenantId, OPENSTACK, "QueryStack", - ErrorCode.BusinessProcesssError.getValue(), "MsoException trying to query nested base stack", - me); + logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner, + cloudSiteId, tenantId, OPENSTACK, "QueryStack", ErrorCode.BusinessProcesssError.getValue(), + "MsoException trying to query nested base stack", me); logger.debug("ERROR trying to query nested base stack= {}", error); throw new VnfException(me); } if (nestedBaseHeatStack == null || nestedBaseHeatStack.getStatus() == HeatStatus.NOTFOUND) { String error = "Create VFModule: Attached base heatStack ID DOES NOT EXIST " + nestedBaseStackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR"; - logger.error(Strings.repeat("{} ", 10), MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, - cloudOwner, cloudSiteId, tenantId, error, OPENSTACK, "QueryStack", + logger.error(LoggingAnchor.TEN, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner, + cloudSiteId, tenantId, error, OPENSTACK, "QueryStack", ErrorCode.BusinessProcesssError.getValue(), "Create VFModule: Attached base heatStack ID DOES NOT EXIST"); logger.debug("Exception occurred", error); @@ -802,7 +799,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { logger.debug("Unable to find vfModuleCust with modelCustomizationUuid={}", mcu); String error = "Create vfModule error: Unable to find vfModuleCust with modelCustomizationUuid=" + mcu; - logger.error(Strings.repeat("{} ", 6), MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), + logger.error(LoggingAnchor.SIX, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "VF Module ModelCustomizationUuid", modelCustomizationUuid, OPENSTACK, ErrorCode.DataError.getValue(), "Create VF Module: Unable to find vfModule with " + "modelCustomizationUuid=" + mcu); @@ -831,8 +828,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } if (vnfResource == null) { String error = "Create VNF: Unknown VNF Type: " + vnfType; - logger.error(Strings.repeat("{} ", 6), MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "VNF Type", - vnfType, OPENSTACK, ErrorCode.DataError.getValue(), "Create VNF: Unknown VNF Type"); + logger.error(LoggingAnchor.SIX, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "VNF Type", vnfType, + OPENSTACK, ErrorCode.DataError.getValue(), "Create VNF: Unknown VNF Type"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); } @@ -905,9 +902,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { + vnfResource.getModelUUID() + " VersionMin=" + minVersionVnf + " VersionMax:" + maxVersionVnf + " NOT supported on Cloud: " + cloudSiteId + " with AIC_Version:" + cloudSiteOpt.get().getCloudVersion(); - logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_CONFIG_EXC.toString(), error, - OPENSTACK, ErrorCode.BusinessProcesssError.getValue(), - "Exception - setVersion"); + logger.error(LoggingAnchor.FIVE, MessageEnum.RA_CONFIG_EXC.toString(), error, OPENSTACK, + ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); } @@ -942,8 +938,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType + ", modelCustomizationUuid=" + mcu + ", vfModuleUuid=" + vf.getModelUUID() + ", vnfResourceModelUuid=" + vnfResource.getModelUUID() + ", reqType=" + requestTypeString; - logger.error(Strings.repeat("{} ", 6), MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), - "Heat Template " + "ID", vfModuleType, OPENSTACK, ErrorCode.DataError.getValue(), error); + logger.error(LoggingAnchor.SIX, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template " + "ID", + vfModuleType, OPENSTACK, ErrorCode.DataError.getValue(), error); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.INTERNAL); } else { @@ -958,7 +954,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType + ", modelCustomizationUuid=" + mcu + ", vfModuleUuid=" + vf.getModelUUID() + ", vnfResourceModelUuid=" + vnfResource.getModelUUID() + ", reqType=" + requestTypeString; - logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), + logger.error(LoggingAnchor.FIVE, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat " + "Environment ID", OPENSTACK, ErrorCode.DataError.getValue(), error); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.INTERNAL); @@ -1135,8 +1131,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { if (checkRequiredParameters) { // Problem - missing one or more required parameters String error = "Create VFModule: Missing Required inputs: " + missingParams; - logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_MISSING_PARAM.toString(), missingParams, - OPENSTACK, ErrorCode.DataError.getValue(), "Create VFModule: Missing Required inputs"); + logger.error(LoggingAnchor.FIVE, MessageEnum.RA_MISSING_PARAM.toString(), missingParams, OPENSTACK, + ErrorCode.DataError.getValue(), "Create VFModule: Missing Required inputs"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); } else { @@ -1259,9 +1255,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { me.addContext("DeleteVFModule"); String error = "Delete VFModule: Query to get outputs: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner, - cloudSiteId, tenantId, OPENSTACK, "QueryStack", ErrorCode.DataError.getValue(), - "Exception - QueryStack", me); + logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId, + tenantId, OPENSTACK, "QueryStack", ErrorCode.DataError.getValue(), "Exception - QueryStack", me); logger.debug(error); throw new VnfException(me); } @@ -1287,9 +1282,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // Convert to a generic VnfException String error = "Delete VF: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudOwner, - cloudSiteId, tenantId, OPENSTACK, "DeleteStack", ErrorCode.DataError.getValue(), - "Exception - deleteStack", me); + logger.error(LoggingAnchor.NINE, MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId, + tenantId, OPENSTACK, "DeleteStack", ErrorCode.DataError.getValue(), "Exception - deleteStack", me); logger.debug(error); if (isValetEnabled && valetDeleteRequestSucceeded) { logger.debug("valet is enabled, the orchestration failed - now sending rollback to valet"); @@ -1423,7 +1417,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { me.addContext("UpdateVFModule"); String error = "Update VFModule: Query " + vfModuleName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner, + logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner, cloudSiteId, tenantId, OPENSTACK, "QueryStack", ErrorCode.DataError.getValue(), "Exception - QueryStack", me); logger.debug(error); @@ -1435,7 +1429,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // Not Found String error = "Update VF: Stack " + vfModuleName + " does not exist in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId; - logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_VNF_NOT_EXIST.toString(), vfModuleName, cloudOwner, + logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_NOT_EXIST.toString(), vfModuleName, cloudOwner, cloudSiteId, tenantId, OPENSTACK, "QueryStack", ErrorCode.DataError.getValue(), error); throw new VnfNotFound(cloudSiteId, cloudOwner, tenantId, vfModuleName); } else { @@ -1459,7 +1453,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { me.addContext("UpdateVFModule"); String error = "Update VF: Attached heatStack ID Query " + nestedStackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner, + logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId, tenantId, OPENSTACK, "QueryStack", ErrorCode.DataError.getValue(), "Exception - " + error, me); logger.debug("ERROR trying to query nested stack= {}", error); @@ -1468,7 +1462,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { if (nestedHeatStack == null || nestedHeatStack.getStatus() == HeatStatus.NOTFOUND) { String error = "Update VFModule: Attached volume heatStack ID DOES NOT EXIST " + nestedStackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR"; - logger.error(Strings.repeat("{} ", 10), MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner, + logger.error(LoggingAnchor.TEN, MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId, tenantId, error, OPENSTACK, "QueryStack", ErrorCode.DataError.getValue(), error); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); @@ -1492,8 +1486,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { me.addContext("UpdateVfModule"); String error = "Update VFModule: Attached baseHeatStack ID Query " + nestedBaseStackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, - cloudOwner, cloudSiteId, tenantId, OPENSTACK, "QueryStack", ErrorCode.DataError.getValue(), + logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner, + cloudSiteId, tenantId, OPENSTACK, "QueryStack", ErrorCode.DataError.getValue(), "Exception - " + error, me); logger.debug("ERROR trying to query nested base stack= {}", error); throw new VnfException(me); @@ -1501,9 +1495,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { if (nestedBaseHeatStack == null || nestedBaseHeatStack.getStatus() == HeatStatus.NOTFOUND) { String error = "Update VFModule: Attached base heatStack ID DOES NOT EXIST " + nestedBaseStackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR"; - logger.error(Strings.repeat("{} ", 10), MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, - cloudOwner, cloudSiteId, tenantId, error, OPENSTACK, "QueryStack", - ErrorCode.DataError.getValue(), error); + logger.error(LoggingAnchor.TEN, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner, + cloudSiteId, tenantId, error, OPENSTACK, "QueryStack", ErrorCode.DataError.getValue(), error); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); } else { @@ -1532,8 +1525,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } if (vf == null) { String error = "Update VfModule: unable to find vfModule with modelCustomizationUuid=" + mcu; - logger.error(Strings.repeat("{} ", 6), MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "VF Module Type", - vfModuleType, OPENSTACK, ErrorCode.DataError.getValue(), error); + logger.error(LoggingAnchor.SIX, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "VF Module Type", vfModuleType, + OPENSTACK, ErrorCode.DataError.getValue(), error); throw new VnfException(error, MsoExceptionCategory.USERDATA); } logger.debug("Got VF module definition from Catalog: {}", vf.toString()); @@ -1613,8 +1606,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "VNF Resource type: " + vnfResource.getModelName() + " VersionMin=" + minVersionVnf + " VersionMax:" + maxVersionVnf + " NOT supported on Cloud: " + cloudSiteId + " with AIC_Version:" + aicV; - logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_CONFIG_EXC.toString(), error, - OPENSTACK, ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion"); + logger.error(LoggingAnchor.FIVE, MessageEnum.RA_CONFIG_EXC.toString(), error, OPENSTACK, + ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); } @@ -1645,7 +1638,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType + ", modelCustomizationUuid=" + mcu + ", vfModuleUuid=" + vf.getModelUUID() + ", reqType=" + requestTypeString; - logger.error(Strings.repeat("{} ", 6), MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID", + logger.error(LoggingAnchor.SIX, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID", vfModuleType, OPENSTACK, ErrorCode.DataError.getValue(), error); throw new VnfException(error, MsoExceptionCategory.INTERNAL); } else { @@ -1655,7 +1648,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { if (heatEnvironment == null) { String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType + ", modelCustomizationUuid=" + mcu + ", vfModuleUuid=" + vf.getModelUUID() + ", reqType=" + requestTypeString; - logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID", + logger.error(LoggingAnchor.FIVE, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID", OPENSTACK, ErrorCode.DataError.getValue(), error); throw new VnfException(error, MsoExceptionCategory.INTERNAL); } else { @@ -1863,8 +1856,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // Problem - missing one or more required parameters if (checkRequiredParameters) { String error = "Update VNF: Missing Required inputs: " + missingParams; - logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_MISSING_PARAM.toString(), missingParams, - OPENSTACK, ErrorCode.DataError.getValue(), error); + logger.error(LoggingAnchor.FIVE, MessageEnum.RA_MISSING_PARAM.toString(), missingParams, OPENSTACK, + ErrorCode.DataError.getValue(), error); throw new VnfException(error, MsoExceptionCategory.USERDATA); } else { logger.debug("found missing parameters - but checkRequiredParameters is false - will not block"); @@ -1883,7 +1876,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // This is not a valid parameter for this template extraParams.removeAll(paramList); if (!extraParams.isEmpty()) { - logger.warn(Strings.repeat("{} ", 6), MessageEnum.RA_VNF_EXTRA_PARAM.toString(), vnfType, + logger.warn(LoggingAnchor.SIX, MessageEnum.RA_VNF_EXTRA_PARAM.toString(), vnfType, extraParams.toString(), OPENSTACK, ErrorCode.DataError.getValue(), "Extra params"); inputs.keySet().removeAll(extraParams); } @@ -1947,7 +1940,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { me.addContext("UpdateVFModule"); String error = "Update VFModule " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error(Strings.repeat("{} ", 8), MessageEnum.RA_UPDATE_VNF_ERR.toString(), vfModuleType, cloudOwner, + logger.error(LoggingAnchor.EIGHT, MessageEnum.RA_UPDATE_VNF_ERR.toString(), vfModuleType, cloudOwner, cloudSiteId, tenantId, OPENSTACK, ErrorCode.DataError.getValue(), "Exception - " + error, me); if (isValetEnabled && sendResponseToValet) { logger.debug("valet is enabled, the orchestration failed - now sending rollback to valet"); 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 b4bf44643c..98cfa9d410 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 @@ -32,7 +32,7 @@ import java.util.Optional; import java.util.Set; import javax.jws.WebService; import javax.xml.ws.Holder; -import com.google.common.base.Strings; +import org.onap.so.logger.LoggingAnchor; import com.woorea.openstack.heat.Heat; import org.onap.so.adapters.vnf.exceptions.VnfAlreadyExists; import org.onap.so.adapters.vnf.exceptions.VnfException; @@ -85,7 +85,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { private static final String CLOUDIFY = "Cloudify"; private static final ObjectMapper JSON_MAPPER = new ObjectMapper(); - private static final String BRACKETS = Strings.repeat("{} ", 9); + private static final String BRACKETS = LoggingAnchor.NINE; private static final String OPENSTACK = "OpenStack"; @Autowired @@ -244,7 +244,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(Strings.repeat("{} ", 3), MessageEnum.RA_ROLLBACK_NULL.toString(), OPENSTACK, "rollbackVnf"); + logger.info(LoggingAnchor.THREE, MessageEnum.RA_ROLLBACK_NULL.toString(), OPENSTACK, "rollbackVnf"); return; } @@ -511,7 +511,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { if (modelCustomizationUuid == null || modelCustomizationUuid.isEmpty()) { logger.debug("Missing required input: modelCustomizationUuid"); String error = "Create vfModule error: Missing required input: modelCustomizationUuid"; - logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), + logger.error(LoggingAnchor.FIVE, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "VF Module ModelCustomizationUuid", CLOUDIFY, ErrorCode.DataError.getValue(), "Create VF Module: Missing required input: modelCustomizationUuid"); logger.debug(error); @@ -574,7 +574,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { String error = "Create vfModule error: Unable to find vfModuleCust with modelCustomizationUuid=" + modelCustomizationUuid; logger.debug(error); - logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), + logger.error(LoggingAnchor.FIVE, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "VF Module " + "ModelCustomizationUuid", modelCustomizationUuid, "CatalogDb", ErrorCode.DataError.getValue(), error); throw new VnfException(error, MsoExceptionCategory.USERDATA); @@ -610,7 +610,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { String error = "VNF Resource type: " + vnfResource.getModelName() + ", ModelUuid=" + vnfResource.getModelUUID() + " VersionMin=" + vnfMin + " VersionMax:" + vnfMax + " NOT supported on Cloud: " + cloudSiteId + " with AIC_Version:" + cloudSite.getCloudVersion(); - logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_CONFIG_EXC.toString(), error, OPENSTACK, + logger.error(LoggingAnchor.FIVE, MessageEnum.RA_CONFIG_EXC.toString(), error, OPENSTACK, ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); @@ -629,7 +629,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { // Failed to query the Deployment due to a cloudify exception. String error = "Create VF Module: Query " + vfModuleName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error(Strings.repeat("{} ", 8), MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudSiteId, + logger.error(LoggingAnchor.EIGHT, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(), "Exception - queryDeployment", me); logger.debug(error); @@ -822,7 +822,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType + ", modelCustomizationUuid=" + modelCustomizationUuid + ", vfModuleUuid=" + vf.getModelUUID() + ", reqType=" + requestType; - logger.error(Strings.repeat("{} ", 6), MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID", + logger.error(LoggingAnchor.SIX, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID", vfModuleType, OPENSTACK, ErrorCode.DataError.getValue(), error); throw new VnfException(error, MsoExceptionCategory.INTERNAL); } else { @@ -832,7 +832,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { if (heatEnvironment == null) { String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType + ", modelCustomizationUuid=" + modelCustomizationUuid + ", vfModuleUuid=" + vf.getModelUUID() + ", reqType=" + requestType; - logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID", + logger.error(LoggingAnchor.FIVE, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID", OPENSTACK, ErrorCode.DataError.getValue(), error); // Alarm on this error, configuration must be fixed throw new VnfException(error, MsoExceptionCategory.INTERNAL); @@ -968,7 +968,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { if (checkRequiredParameters) { // Problem - missing one or more required parameters String error = "Create VFModule: Missing Required inputs: " + missingParams; - logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_MISSING_PARAM.toString(), missingParams, + logger.error(LoggingAnchor.FIVE, MessageEnum.RA_MISSING_PARAM.toString(), missingParams, CLOUDIFY, ErrorCode.DataError.getValue(), "Create VFModule: Missing Required inputs"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); @@ -1031,9 +1031,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { catch (MsoException me) { me.addContext("CreateVFModule"); String error = "Create VF Module: Upload blueprint failed. Blueprint=" + blueprintName + ": " + me; - logger.error(Strings.repeat("{} ", 7), MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, - cloudSiteId, tenantId, CLOUDIFY, ErrorCode.DataError.getValue(), - "MsoException - uploadBlueprint", me); + logger.error(LoggingAnchor.SEVEN, MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudSiteId, + tenantId, CLOUDIFY, ErrorCode.DataError.getValue(), "MsoException - uploadBlueprint", me); logger.debug(error); throw new VnfException(me); } @@ -1058,16 +1057,16 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { me.addContext("CreateVFModule"); String error = "Create VF Module " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error(Strings.repeat("{} ", 8), MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, - cloudOwner, cloudSiteId, tenantId, CLOUDIFY, ErrorCode.DataError.getValue(), + logger.error(LoggingAnchor.EIGHT, MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner, + cloudSiteId, tenantId, CLOUDIFY, ErrorCode.DataError.getValue(), "MsoException - createDeployment", me); logger.debug(error); throw new VnfException(me); } catch (NullPointerException npe) { String error = "Create VFModule " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + npe; - logger.error(Strings.repeat("{} ", 8), MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, - cloudOwner, cloudSiteId, tenantId, CLOUDIFY, ErrorCode.DataError.getValue(), + logger.error(LoggingAnchor.EIGHT, MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner, + cloudSiteId, tenantId, CLOUDIFY, ErrorCode.DataError.getValue(), "NullPointerException - createDeployment", npe); logger.debug(error); logger.debug("NULL POINTER EXCEPTION at cloudify.createAndInstallDeployment"); 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 b9053aaa23..c22bb327d4 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 @@ -42,7 +42,7 @@ import java.util.Optional; import java.util.Set; import javax.jws.WebService; import javax.xml.ws.Holder; -import com.google.common.base.Strings; +import org.onap.so.logger.LoggingAnchor; import org.onap.so.adapters.vdu.CloudInfo; import org.onap.so.adapters.vdu.VduException; import org.onap.so.adapters.vdu.VduInstance; @@ -204,7 +204,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { e.addContext("QueryVNF"); String error = "Query VNF (VDU): " + vnfNameOrId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + e; - logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfNameOrId, cloudOwner, + logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfNameOrId, cloudOwner, cloudSiteId, tenantId, "VDU", "QueryVNF", ErrorCode.DataError.getValue(), "Exception - queryVDU", e); logger.debug(error); @@ -255,7 +255,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(Strings.repeat("{} ", 3), MessageEnum.RA_ROLLBACK_NULL.toString(), "OpenStack", "rollbackVnf"); + logger.info(LoggingAnchor.THREE, MessageEnum.RA_ROLLBACK_NULL.toString(), "OpenStack", "rollbackVnf"); return; } @@ -292,7 +292,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { ve.addContext("RollbackVFModule"); String error = "Rollback VF Module: " + vfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + ve; - logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudOwner, + logger.error(LoggingAnchor.NINE, MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudOwner, cloudSiteId, tenantId, "VDU", "DeleteVdu", ErrorCode.DataError.getValue(), "Exception - DeleteVdu", ve); logger.debug(error); @@ -547,7 +547,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { if (modelCustomizationUuid == null || modelCustomizationUuid.isEmpty()) { logger.debug("Missing required input: modelCustomizationUuid"); String error = "Create vfModule error: Missing required input: modelCustomizationUuid"; - logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), + logger.error(LoggingAnchor.FIVE, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "VF Module ModelCustomizationUuid", "VDU", ErrorCode.DataError, "Create VF Module: " + "Missing required input: modelCustomizationUuid"); logger.debug(error); @@ -611,7 +611,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { String error = "Create vfModule error: Unable to find vfModuleCust with modelCustomizationUuid=" + modelCustomizationUuid; logger.debug(error); - logger.error(Strings.repeat("{} ", 6), MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), + logger.error(LoggingAnchor.SIX, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "VF Module ModelCustomizationUuid", modelCustomizationUuid, "CatalogDb", ErrorCode.DataError, error); throw new VnfException(error, MsoExceptionCategory.USERDATA); @@ -650,7 +650,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { "VNF Resource type: " + vnfResource.getModelName() + ", ModelUuid=" + vnfResource.getModelUUID() + " VersionMin=" + vnfMin + " VersionMax:" + vnfMax + " NOT supported on Cloud: " + cloudSiteId + " with AIC_Version:" + cloudSite.getCloudVersion(); - logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_CONFIG_EXC.toString(), error, "OpenStack", + logger.error(LoggingAnchor.FIVE, MessageEnum.RA_CONFIG_EXC.toString(), error, "OpenStack", ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); @@ -672,7 +672,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { // Failed to query the VDU due to a plugin exception. String error = "Create VF Module: Query " + vfModuleName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner, + logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(), "Exception - queryVdu", me); logger.debug(error); @@ -691,7 +691,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { // fail - it exists String error = "Create VF: Deployment " + vfModuleName + " already exists in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId; - logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, + logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(), "VF Module " + vfModuleName + " already exists"); logger.debug(error); @@ -713,8 +713,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { String error = "Create VF: Deployment " + vfModuleName + " already exists and has status " + status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; please wait for it to complete, or fix manually."; - logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, - cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(), + logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner, + cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(), "VF Module " + vfModuleName + " already exists"); logger.debug(error); throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId, @@ -723,8 +723,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { // fail - it exists and is in a FAILED state String error = "Create VF: Deployment " + vfModuleName + " already exists and is in FAILED state in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; requires manual intervention."; - logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, - cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(), + logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner, + cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(), "VF Module " + vfModuleName + " already exists and is in FAILED state"); logger.debug(error); throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId, @@ -734,8 +734,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { String error = "Create VF: Deployment " + vfModuleName + " already exists and has status " + status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; requires manual intervention."; - logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, - cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(), + logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner, + cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(), "VF Module " + vfModuleName + " already exists and is in " + status.toString() + " state"); logger.debug(error); throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId, @@ -745,8 +745,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { String error = "Create VF: Deployment " + vfModuleName + " already exists with unexpected status " + status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; requires manual intervention."; - logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, - cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(), + logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner, + cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(), "VF Module " + vfModuleName + " already exists and is in an unknown state"); logger.debug(error); throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId, @@ -769,8 +769,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { // Failed to query the Volume Group VDU due to a plugin exception. String error = "Create VF Module: Query Volume Group " + volumeGroupId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId, - cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu(volume)", ErrorCode.DataError.getValue(), + logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId, cloudOwner, + cloudSiteId, tenantId, "VDU", "queryVdu(volume)", ErrorCode.DataError.getValue(), "Exception - queryVdu(volume)", me); logger.debug(error); // Convert to a generic VnfException @@ -781,8 +781,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { if (volumeVdu == null || volumeVdu.getStatus().getState() == VduStateType.NOTFOUND) { String error = "Create VFModule: Attached Volume Group DOES NOT EXIST " + volumeGroupId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR"; - logger.error(Strings.repeat("{} ", 10), MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId, - cloudOwner, cloudSiteId, tenantId, error, "VDU", "queryVdu(volume)", + logger.error(LoggingAnchor.TEN, MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId, cloudOwner, + cloudSiteId, tenantId, error, "VDU", "queryVdu(volume)", ErrorCode.BusinessProcesssError.getValue(), "Create VFModule: Attached Volume Group " + "DOES NOT EXIST"); logger.debug(error); @@ -819,7 +819,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { // Failed to query the Base VF Module due to a Vdu Plugin exception. String error = "Create VF Module: Query Base " + baseVfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId, + logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId, cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu(Base)", ErrorCode.DataError.getValue(), "Exception - queryVdu(Base)", me); logger.debug(error); @@ -831,8 +831,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { if (baseVdu == null || baseVdu.getStatus().getState() == VduStateType.NOTFOUND) { String error = "Create VFModule: Base Module DOES NOT EXIST " + baseVfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR"; - logger.error(Strings.repeat("{} ", 10), MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId, - cloudOwner, cloudSiteId, tenantId, error, "VDU", "queryVdu(Base)", + logger.error(LoggingAnchor.TEN, MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId, cloudOwner, + cloudSiteId, tenantId, error, "VDU", "queryVdu(Base)", ErrorCode.BusinessProcesssError.getValue(), "Create VFModule: Base Module DOES NOT EXIST"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); @@ -865,7 +865,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType + ", modelCustomizationUuid=" + modelCustomizationUuid + ", vfModuleUuid=" + vfModule.getModelUUID() + ", reqType=" + requestType; - logger.error(Strings.repeat("{} ", 6), MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID", + logger.error(LoggingAnchor.SIX, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID", vfModuleType, "VNF", ErrorCode.DataError.getValue(), error); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.INTERNAL); @@ -876,7 +876,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { if (heatEnvironment == null) { String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType + ", modelCustomizationUuid=" + modelCustomizationUuid + ", vfModuleUuid=" + vfModule.getModelUUID() + ", reqType=" + requestType; - logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID", + logger.error(LoggingAnchor.FIVE, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID", "OpenStack", ErrorCode.DataError.getValue(), error); throw new VnfException(error, MsoExceptionCategory.INTERNAL); } else { @@ -1010,8 +1010,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { if (checkRequiredParameters) { // Problem - missing one or more required parameters String error = "Create VFModule: Missing Required inputs: " + missingParams; - logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_MISSING_PARAM.toString(), missingParams, - "VDU", ErrorCode.DataError.getValue(), "Create VFModule: Missing Required inputs"); + logger.error(LoggingAnchor.FIVE, MessageEnum.RA_MISSING_PARAM.toString(), missingParams, "VDU", + ErrorCode.DataError.getValue(), "Create VFModule: Missing Required inputs"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); } else { @@ -1047,7 +1047,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { me.addContext("CreateVFModule"); String error = "Create VF Module " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error(Strings.repeat("{} ", 8), MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner, + logger.error(LoggingAnchor.EIGHT, MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner, cloudSiteId, tenantId, "VDU", ErrorCode.DataError.getValue(), "MsoException - instantiateVdu", me); logger.debug(error); // Convert to a generic VnfException @@ -1055,7 +1055,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { } catch (NullPointerException npe) { String error = "Create VFModule " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + npe; - logger.error(Strings.repeat("{} ", 8), MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner, + logger.error(LoggingAnchor.EIGHT, MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner, cloudSiteId, tenantId, "VDU", ErrorCode.DataError.getValue(), "NullPointerException - instantiateVdu", npe); logger.debug(error); @@ -1106,7 +1106,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { e.addContext("QueryVFModule"); String error = "Query VfModule (VDU): " + vfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + e; - logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleId, cloudOwner, + logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleId, cloudOwner, cloudSiteId, tenantId, "VDU", "QueryVFModule", ErrorCode.DataError.getValue(), "Exception - queryVDU", e); logger.debug(error); @@ -1132,7 +1132,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { // Convert to a generic VnfException String error = "Delete VF: " + vfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudOwner, + logger.error(LoggingAnchor.NINE, MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudOwner, cloudSiteId, tenantId, "VDU", "DeleteVdu", ErrorCode.DataError.getValue(), "Exception - DeleteVdu: " + me.getMessage()); logger.debug(error); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java index 2254a149fe..8c871c742e 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java @@ -40,7 +40,7 @@ import javax.ws.rs.core.GenericEntity; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.xml.ws.Holder; -import com.google.common.base.Strings; +import org.onap.so.logger.LoggingAnchor; import org.apache.http.HttpStatus; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.adapters.vnf.exceptions.VnfException; @@ -184,7 +184,7 @@ public class VnfAdapterRest { response = new DeleteVfModuleResponse(req.getVnfId(), req.getVfModuleId(), Boolean.TRUE, req.getMessageId(), outputs.value); } catch (VnfException e) { - logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_DELETE_VNF_ERR.toString(), + logger.error(LoggingAnchor.THREE, MessageEnum.RA_DELETE_VNF_ERR.toString(), ErrorCode.BusinessProcesssError.getValue(), "VnfException - Delete VNF Module", e); eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.TRUE, req.getMessageId()); @@ -242,8 +242,8 @@ public class VnfAdapterRest { logger.debug("Query vfModule exit"); return Response.status(respStatus).entity(new GenericEntity<QueryVfModuleResponse>(qryResp) {}).build(); } catch (VnfException e) { - logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, - "queryVfModule", ErrorCode.BusinessProcesssError.getValue(), "VnfException - queryVfModule", e); + logger.error(LoggingAnchor.FIVE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, "queryVfModule", + ErrorCode.BusinessProcesssError.getValue(), "VnfException - queryVfModule", e); VfModuleExceptionResponse excResp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.FALSE, null); return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR) @@ -289,7 +289,7 @@ public class VnfAdapterRest { t1.start(); } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller - logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_CREATE_VNF_ERR, "createVfModule", + logger.error(LoggingAnchor.FOUR, MessageEnum.RA_CREATE_VNF_ERR, "createVfModule", ErrorCode.BusinessProcesssError, "Exception - createVfModule", e); return Response.serverError().build(); } @@ -404,7 +404,7 @@ public class VnfAdapterRest { t1.start(); } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller - logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_UPDATE_VNF_ERR.toString(), "updateVfModule", + logger.error(LoggingAnchor.FOUR, MessageEnum.RA_UPDATE_VNF_ERR.toString(), "updateVfModule", ErrorCode.BusinessProcesssError.getValue(), "Exception - updateVfModule", e); return Response.serverError().build(); } @@ -508,7 +508,7 @@ public class VnfAdapterRest { t1.start(); } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller - logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_ROLLBACK_VNF_ERR.toString(), "rollbackVfModule", + logger.error(LoggingAnchor.FOUR, MessageEnum.RA_ROLLBACK_VNF_ERR.toString(), "rollbackVfModule", ErrorCode.BusinessProcesssError.getValue(), "Exception - rollbackVfModule", e); return Response.serverError().build(); } @@ -560,7 +560,7 @@ public class VnfAdapterRest { vnfAdapter.rollbackVnf(vrb); response = new RollbackVfModuleResponse(Boolean.TRUE, req.getMessageId()); } catch (VnfException e) { - logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_ROLLBACK_VNF_ERR, ErrorCode.BusinessProcesssError, + logger.error(LoggingAnchor.THREE, MessageEnum.RA_ROLLBACK_VNF_ERR, ErrorCode.BusinessProcesssError, "Exception" + " - " + "rollbackVfModule", e); eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, false, req.getMessageId()); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java index 972305b033..9a7354c40c 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java @@ -39,7 +39,7 @@ import javax.ws.rs.core.GenericEntity; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.xml.ws.Holder; -import com.google.common.base.Strings; +import org.onap.so.logger.LoggingAnchor; import org.apache.http.HttpStatus; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.adapters.vnf.exceptions.VnfException; @@ -85,7 +85,7 @@ public class VnfAdapterRestV2 { private static Logger logger = LoggerFactory.getLogger(VnfAdapterRestV2.class); private static final String TESTING_KEYWORD = "___TESTING___"; private static final String RESP = ", resp="; - private static final String BRACKETS = Strings.repeat("{} ", 4); + private static final String BRACKETS = LoggingAnchor.FOUR; @Autowired private VnfAdapterRestUtils vnfAdapterRestUtils; @@ -200,7 +200,7 @@ public class VnfAdapterRestV2 { response = new DeleteVfModuleResponse(req.getVnfId(), req.getVfModuleId(), Boolean.TRUE, req.getMessageId(), outputs.value); } catch (VnfException e) { - logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_DELETE_VNF_ERR.toString(), + logger.error(LoggingAnchor.THREE, MessageEnum.RA_DELETE_VNF_ERR.toString(), ErrorCode.BusinessProcesssError.getValue(), "VnfException - " + "Delete VNF Module", e); eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.TRUE, req.getMessageId()); @@ -270,8 +270,8 @@ public class VnfAdapterRestV2 { logger.debug("Query vfModule exit"); return Response.status(respStatus).entity(new GenericEntity<QueryVfModuleResponse>(qryResp) {}).build(); } catch (VnfException e) { - logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, - "queryVfModule", ErrorCode.BusinessProcesssError.getValue(), "VnfException - queryVfModule", e); + logger.error(LoggingAnchor.FIVE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, "queryVfModule", + ErrorCode.BusinessProcesssError.getValue(), "VnfException - queryVfModule", e); VfModuleExceptionResponse excResp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.FALSE, null); return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR) @@ -611,7 +611,7 @@ public class VnfAdapterRestV2 { response = new RollbackVfModuleResponse(Boolean.TRUE, req.getMessageId()); } catch (VnfException e) { - logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_ROLLBACK_VNF_ERR.toString(), + logger.error(LoggingAnchor.THREE, MessageEnum.RA_ROLLBACK_VNF_ERR.toString(), ErrorCode.BusinessProcesssError.getValue(), "Exception - rollbackVfModule", e); eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, false, req.getMessageId()); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java index 761116b4ab..3b80da1ba9 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java @@ -50,16 +50,17 @@ import org.onap.so.heatbridge.helpers.AaiHelper; import org.onap.so.heatbridge.openstack.api.OpenstackClient; import org.onap.so.heatbridge.openstack.factory.OpenstackClientFactoryImpl; import org.onap.so.heatbridge.utils.HeatBridgeUtils; -import org.onap.so.logger.MessageEnum; import org.onap.so.logger.ErrorCode; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.onap.so.logger.LoggingAnchor; +import org.onap.so.logger.MessageEnum; import org.openstack4j.model.compute.Server; import org.openstack4j.model.heat.Resource; import org.openstack4j.model.network.IP; import org.openstack4j.model.network.Network; import org.openstack4j.model.network.NetworkType; import org.openstack4j.model.network.Port; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.google.common.base.Preconditions; import com.google.common.base.Strings; import com.google.common.collect.ImmutableMap; @@ -323,9 +324,9 @@ public class HeatBridgeImpl implements HeatBridgeApi { } } catch (WebApplicationException e) { // Silently log that we failed to update the Pserver p-interface with PCI-ID - logger.error(Strings.repeat("{} ", 9), MessageEnum.GENERAL_EXCEPTION, pserverHostName, - matchingPifName.get(), cloudOwner, tenantId, "OpenStack", "Heatbridge", - ErrorCode.DataError.getValue(), "Exception - Failed to add sriov-pf object to pserver", e); + logger.error(LoggingAnchor.NINE, MessageEnum.GENERAL_EXCEPTION, pserverHostName, matchingPifName.get(), + cloudOwner, tenantId, "OpenStack", "Heatbridge", ErrorCode.DataError.getValue(), + "Exception - Failed to add sriov-pf object to pserver", e); } } } diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java index 8d97d85e43..8c4150cd50 100644 --- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java +++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java @@ -27,7 +27,7 @@ import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.List; -import com.google.common.base.Strings; +import org.onap.so.logger.LoggingAnchor; import org.onap.so.db.request.beans.ArchivedInfraRequests; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.data.repository.ArchivedInfraRequestsRepository; @@ -146,7 +146,7 @@ public class ArchiveInfraRequestsScheduler { newArchivedReqs.add(archivedInfra); oldInfraReqs.add(iar); } catch (Exception e) { - logger.error(Strings.repeat("{} ", 2), MessageEnum.RA_GENERAL_EXCEPTION.toString(), + logger.error(LoggingAnchor.TWO, MessageEnum.RA_GENERAL_EXCEPTION.toString(), ErrorCode.UnknownError.getValue(), e); } } diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java index b657e7ab26..b96a564b1a 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java @@ -30,7 +30,7 @@ import javax.xml.ws.Service; import javax.xml.ws.WebEndpoint; import javax.xml.ws.WebServiceClient; import javax.xml.ws.WebServiceFeature; -import com.google.common.base.Strings; +import org.onap.so.logger.LoggingAnchor; import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; @@ -60,19 +60,19 @@ public class SDNCAdapterService extends Service { try { wsdlUrl = Thread.currentThread().getContextClassLoader().getResource("main/resources/SDNCAdapter.wsdl"); } catch (Exception e) { - logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_ADAPTER_WSDL, + logger.error(LoggingAnchor.FOUR, MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_ADAPTER_WSDL, ErrorCode.DataError.getValue(), "Exception - WSDL not found", e); } if (wsdlUrl == null) { - logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_ADAPTER_WSDL, + logger.error(LoggingAnchor.FOUR, MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_ADAPTER_WSDL, ErrorCode.DataError.getValue(), "WSDL not found"); } else { try { - logger.info(Strings.repeat("{} ", 3), MessageEnum.RA_PRINT_URL.toString(), SDNC_ADAPTER_WSDL, + logger.info(LoggingAnchor.THREE, MessageEnum.RA_PRINT_URL.toString(), SDNC_ADAPTER_WSDL, wsdlUrl.toURI().toString()); } catch (Exception e) { - logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_WSDL_URL_CONVENTION_EXC.toString(), - SDNC_ADAPTER_WSDL, ErrorCode.DataError.getValue(), "Exception - print URL", e); + logger.error(LoggingAnchor.FOUR, MessageEnum.RA_WSDL_URL_CONVENTION_EXC.toString(), SDNC_ADAPTER_WSDL, + ErrorCode.DataError.getValue(), "Exception - print URL", e); } } WSDL_LOCATION = wsdlUrl; diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java index c9976686b6..577b550be6 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java @@ -31,7 +31,7 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; -import com.google.common.base.Strings; +import org.onap.so.logger.LoggingAnchor; import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; @@ -123,8 +123,8 @@ public class SDNCAdapterCallbackRequest { m.marshal(this, w); return w.toString(); } catch (Exception e) { - logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_MARSHING_ERROR.toString(), - ErrorCode.DataError.getValue(), "Exception - MARSHING_ERROR", e); + logger.error(LoggingAnchor.THREE, MessageEnum.RA_MARSHING_ERROR.toString(), ErrorCode.DataError.getValue(), + "Exception - MARSHING_ERROR", e); } return ""; } diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java index f19c403861..87620743d7 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java @@ -29,7 +29,7 @@ import javax.xml.ws.Service; import javax.xml.ws.WebEndpoint; import javax.xml.ws.WebServiceClient; import javax.xml.ws.WebServiceFeature; -import com.google.common.base.Strings; +import org.onap.so.logger.LoggingAnchor; import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; @@ -58,18 +58,18 @@ public class SDNCCallbackAdapterService extends Service { wsdlUrl = Thread.currentThread().getContextClassLoader() .getResource("main/resources/SDNCCallbackAdapter.wsdl"); } catch (Exception e) { - logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_CALLBACK_ADAPTER_WSDL, + logger.error(LoggingAnchor.FIVE, MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_CALLBACK_ADAPTER_WSDL, "SDNC", ErrorCode.DataError.getValue(), "Exception - WSDL not found", e); } if (wsdlUrl == null) { - logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_CALLBACK_ADAPTER_WSDL, + logger.error(LoggingAnchor.FIVE, MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_CALLBACK_ADAPTER_WSDL, "SDNC", ErrorCode.DataError.getValue(), "WSDL not found"); } else { try { - logger.info(Strings.repeat("{} ", 4), MessageEnum.RA_PRINT_URL.toString(), SDNC_CALLBACK_ADAPTER_WSDL, + logger.info(LoggingAnchor.FOUR, MessageEnum.RA_PRINT_URL.toString(), SDNC_CALLBACK_ADAPTER_WSDL, wsdlUrl.toURI().toString(), "SDNC"); } catch (Exception e) { - logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_WSDL_URL_CONVENTION_EXC.toString(), + logger.error(LoggingAnchor.FIVE, MessageEnum.RA_WSDL_URL_CONVENTION_EXC.toString(), SDNC_CALLBACK_ADAPTER_WSDL, "SDNC", ErrorCode.DataError.getValue(), "Exception - URL convention problem", e); } diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java index d958f8cc7f..880ef0a7b0 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java @@ -23,7 +23,7 @@ package org.onap.so.adapters.sdnc.impl; -import com.google.common.base.Strings; +import org.onap.so.logger.LoggingAnchor; import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; @@ -70,7 +70,7 @@ public class MapRequestTunables { String[] parts = value.split("\\|"); // escape pipe if (parts.length < 3) { - logger.warn(Strings.repeat("{} ", 6), MessageEnum.RA_SDNC_INVALID_CONFIG.toString(), key, value, "SDNC", + logger.warn(LoggingAnchor.SIX, MessageEnum.RA_SDNC_INVALID_CONFIG.toString(), key, value, "SDNC", ErrorCode.DataError.getValue(), "Invalid config"); } @@ -106,7 +106,7 @@ public class MapRequestTunables { error = "Missing configuration for:" + key; } if (error != null) { - logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), key, "SDNC", + logger.error(LoggingAnchor.FIVE, MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), key, "SDNC", ErrorCode.DataError.getValue(), "Missing config param"); } logger.debug("RequestTunables Key:{} Value:{} Tunables:{}", key, value, this.toString()); diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java index 6daaab5abd..2b023f4c15 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java @@ -25,7 +25,7 @@ package org.onap.so.adapters.sdnc.impl; import javax.annotation.PostConstruct; import javax.jws.WebService; import javax.servlet.http.HttpServletResponse; -import com.google.common.base.Strings; +import org.onap.so.logger.LoggingAnchor; import org.onap.so.adapters.sdnc.SDNCAdapterPortType; import org.onap.so.adapters.sdnc.SDNCAdapterRequest; import org.onap.so.adapters.sdnc.SDNCAdapterResponse; @@ -52,8 +52,7 @@ public class SDNCAdapterPortTypeImpl implements SDNCAdapterPortType { @PostConstruct public void init() { - logger.info(Strings.repeat("{} ", 3), MessageEnum.RA_INIT_SDNC_ADAPTER.toString(), "SDNC", - "SDNCAdapterPortType"); + logger.info(LoggingAnchor.THREE, MessageEnum.RA_INIT_SDNC_ADAPTER.toString(), "SDNC", "SDNCAdapterPortType"); } /** @@ -73,7 +72,7 @@ public class SDNCAdapterPortTypeImpl implements SDNCAdapterPortType { sdncClient.executeRequest(bpelRequest); } catch (Exception e) { String respMsg = "Error sending request to SDNC. Failed to start SDNC Client thread " + e.getMessage(); - logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_SEND_REQUEST_SDNC_ERR.toString(), "SDNC", + logger.error(LoggingAnchor.FOUR, MessageEnum.RA_SEND_REQUEST_SDNC_ERR.toString(), "SDNC", ErrorCode.DataError.getValue(), respMsg, e); SDNCResponse sdncResp = new SDNCResponse(bpelReqId); diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java index 9c77a38b0b..012a19f1a9 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java @@ -45,7 +45,7 @@ import javax.xml.ws.handler.MessageContext; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathFactory; -import com.google.common.base.Strings; +import org.onap.so.logger.LoggingAnchor; import org.onap.so.logger.ErrorCode; import org.onap.so.utils.CryptoUtils; import org.onap.so.adapters.sdnc.SDNCAdapterRequest; @@ -90,7 +90,7 @@ public class SDNCRestClient { try { Thread.sleep(5000); } catch (InterruptedException e) { - logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "SDNC", + logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "SDNC", ErrorCode.UnknownError.getValue(), "Exception processing request to SDNC", e); Thread.currentThread().interrupt(); @@ -177,7 +177,7 @@ public class SDNCRestClient { logger.info("{} :\n {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.name(), sdncResp.toString(), "SDNC"); return (sdncResp); } catch (Exception e) { - logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC", + logger.error(LoggingAnchor.FOUR, MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC", ErrorCode.BusinessProcesssError.getValue(), "Exception processing request to SDNC", e); // default sdncResp.setRespCode(HttpURLConnection.HTTP_INTERNAL_ERROR); @@ -214,10 +214,9 @@ public class SDNCRestClient { eType = xpath.evaluate("error-type", error); sdncErrMsg = new StringBuilder(". SDNC Returned-[error-type:" + eType); } catch (Exception e3) { - logger.error(Strings.repeat("{} ", 6), - MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-type", - error.toString(), "SDNC", ErrorCode.DataError.getValue(), EXCEPTION_MSG, - e3); + logger.error(LoggingAnchor.SIX, MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), + "error-type", error.toString(), "SDNC", ErrorCode.DataError.getValue(), + EXCEPTION_MSG, e3); } String eTag = null; @@ -225,10 +224,9 @@ public class SDNCRestClient { eTag = xpath.evaluate("error-tag", error); sdncErrMsg.append(", error-tag:").append(eTag); } catch (Exception e3) { - logger.error(Strings.repeat("{} ", 6), - MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-tag", - error.toString(), "SDNC", ErrorCode.DataError.getValue(), EXCEPTION_MSG, - e3); + logger.error(LoggingAnchor.SIX, MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), + "error-tag", error.toString(), "SDNC", ErrorCode.DataError.getValue(), + EXCEPTION_MSG, e3); } String eMsg = null; @@ -236,19 +234,18 @@ public class SDNCRestClient { eMsg = xpath.evaluate("error-message", error); sdncErrMsg.append(", error-message:").append(eMsg).append("]"); } catch (Exception e3) { - logger.error(Strings.repeat("{} ", 6), - MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-message", - error.toString(), "SDNC", ErrorCode.DataError.getValue(), EXCEPTION_MSG, - e3); + logger.error(LoggingAnchor.SIX, MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), + "error-message", error.toString(), "SDNC", ErrorCode.DataError.getValue(), + EXCEPTION_MSG, e3); } } } catch (Exception e2) { - logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_ANALYZE_ERROR_EXC.toString(), "SDNC", + logger.error(LoggingAnchor.FOUR, MessageEnum.RA_ANALYZE_ERROR_EXC.toString(), "SDNC", ErrorCode.DataError.getValue(), "Exception while analyse error", e2); } } // is != null } catch (Exception e1) { - logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_ERROR_GET_RESPONSE_SDNC.toString(), "SDNC", + logger.error(LoggingAnchor.FOUR, MessageEnum.RA_ERROR_GET_RESPONSE_SDNC.toString(), "SDNC", ErrorCode.BusinessProcesssError.getValue(), "Exception while get SDNC response", e1); } } // con != null @@ -260,7 +257,7 @@ public class SDNCRestClient { sdncResp.setRespMsg(respMsg); - logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC", + logger.error(LoggingAnchor.FOUR, MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC", ErrorCode.AvailabilityError.getValue(), "Exception while communicate with SDNC", e); return sdncResp; @@ -286,7 +283,7 @@ public class SDNCRestClient { try { wsdlUrl = new URL(bpelUrl); } catch (MalformedURLException e1) { - logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_INIT_CALLBACK_WSDL_ERR.toString(), CAMUNDA, + logger.error(LoggingAnchor.FOUR, MessageEnum.RA_INIT_CALLBACK_WSDL_ERR.toString(), CAMUNDA, ErrorCode.DataError.getValue(), "Exception initializing Callback wsdl", e1); } @@ -314,7 +311,7 @@ public class SDNCRestClient { reqCtx.put(MessageContext.HTTP_REQUEST_HEADERS, headers); headers.put("Authorization", Collections.singletonList(basicAuth)); } catch (Exception e2) { - logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_SET_CALLBACK_AUTH_EXC.toString(), CAMUNDA, + logger.error(LoggingAnchor.FOUR, MessageEnum.RA_SET_CALLBACK_AUTH_EXC.toString(), CAMUNDA, ErrorCode.BusinessProcesssError.getValue(), "Exception - Unable to set authorization in callback request", e2); diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java index f83f0bfede..1c47a2d6b0 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java @@ -31,7 +31,7 @@ import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; -import com.google.common.base.Strings; +import org.onap.so.logger.LoggingAnchor; import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; @@ -98,7 +98,7 @@ public class Utils { return s; } catch (Exception e) { - logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST.toString(), "SDNC", + logger.error(LoggingAnchor.FOUR, MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST.toString(), "SDNC", ErrorCode.BusinessProcesssError.getValue(), "Exception in genSdncReq", e); } return null; @@ -132,7 +132,7 @@ public class Utils { return s; } catch (Exception e) { - logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST.toString(), "SDNC", + logger.error(LoggingAnchor.FOUR, MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST.toString(), "SDNC", ErrorCode.DataError.getValue(), "Exception in genSdncPutReq", e); } return null; @@ -167,7 +167,7 @@ public class Utils { return s; } catch (Exception e) { - logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_ERROR_CREATE_SDNC_RESPONSE.toString(), "SDNC", + logger.error(LoggingAnchor.FOUR, MessageEnum.RA_ERROR_CREATE_SDNC_RESPONSE.toString(), "SDNC", ErrorCode.DataError.getValue(), "Exception in genMsoFailResp", e); } return null; @@ -192,7 +192,7 @@ public class Utils { s = s.replaceAll("xmlns=\"\"", ""); return s; } catch (Exception e) { - logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_ERROR_CONVERT_XML2STR.toString(), + logger.error(LoggingAnchor.THREE, MessageEnum.RA_ERROR_CONVERT_XML2STR.toString(), ErrorCode.DataError.getValue(), "Exception - domToStr", e); } } diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java index 1d96e7ae85..b50662a832 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java @@ -25,7 +25,7 @@ package org.onap.so.adapters.sdnc.sdncrest; import javax.xml.bind.DatatypeConverter; -import com.google.common.base.Strings; +import org.onap.so.logger.LoggingAnchor; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.config.RequestConfig; @@ -93,7 +93,7 @@ public class BPRestCallback { public boolean send(String url, String message) { logger.debug(getClass().getSimpleName() + ".send(" + "url=" + url + " message=" + message + ")"); - logger.info(Strings.repeat("{} ", 3), MessageEnum.RA_CALLBACK_BPEL.toString(), + logger.info(LoggingAnchor.THREE, MessageEnum.RA_CALLBACK_BPEL.toString(), message == null ? "[no content]" : message, CAMUNDA); HttpPost method = null; @@ -124,7 +124,7 @@ public class BPRestCallback { method.setHeader(ONAPLogConstants.Headers.INVOCATION_ID, MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID)); method.setHeader(ONAPLogConstants.Headers.PARTNER_NAME, "SO-SDNCAdapter"); } catch (Exception e) { - logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_SET_CALLBACK_AUTH_EXC.toString(), CAMUNDA, + logger.error(LoggingAnchor.FOUR, MessageEnum.RA_SET_CALLBACK_AUTH_EXC.toString(), CAMUNDA, ErrorCode.BusinessProcesssError.getValue(), "Unable to set authorization in callback request", e); error = true; @@ -142,14 +142,14 @@ public class BPRestCallback { if (httpResponse.getStatusLine().getStatusCode() >= 300) { String msg = "Received error response to callback request: " + httpResponse.getStatusLine(); - logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_CALLBACK_BPEL_EXC.toString(), CAMUNDA, + logger.error(LoggingAnchor.FOUR, MessageEnum.RA_CALLBACK_BPEL_EXC.toString(), CAMUNDA, ErrorCode.BusinessProcesssError.getValue(), msg); } } return true; } catch (Exception e) { - logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_CALLBACK_BPEL_EXC.toString(), CAMUNDA, + logger.error(LoggingAnchor.FOUR, MessageEnum.RA_CALLBACK_BPEL_EXC.toString(), CAMUNDA, ErrorCode.BusinessProcesssError.getValue(), "Error sending callback request", e); return false; } finally { @@ -169,7 +169,7 @@ public class BPRestCallback { logger.debug("Exception:", e); } } - logger.info(Strings.repeat("{} ", 2), MessageEnum.RA_CALLBACK_BPEL_COMPLETE.toString(), CAMUNDA); + logger.info(LoggingAnchor.TWO, MessageEnum.RA_CALLBACK_BPEL_COMPLETE.toString(), CAMUNDA); } } } diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java index 1eabedb185..ad99d0da36 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java @@ -23,7 +23,7 @@ package org.onap.so.adapters.sdnc.sdncrest; -import com.google.common.base.Strings; +import org.onap.so.logger.LoggingAnchor; import org.onap.so.adapters.sdnc.exception.SDNCAdapterException; import org.onap.so.adapters.sdnc.impl.Constants; import org.onap.so.logger.ErrorCode; @@ -55,8 +55,8 @@ public class MapTypedRequestTunablesData { if ("".equals(value)) { error = MISSING_CONFIGURATION_ERROR_MSG + reqTunable.getKey(); - logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), - reqTunable.getKey(), "SDNC", ErrorCode.DataError.getValue(), MISSING_CONFIG_PARAM_ERROR_MSG); + logger.error(LoggingAnchor.FIVE, MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), reqTunable.getKey(), + "SDNC", ErrorCode.DataError.getValue(), MISSING_CONFIG_PARAM_ERROR_MSG); throw new SDNCAdapterException(error); } @@ -65,8 +65,8 @@ public class MapTypedRequestTunablesData { if (parts.length != 5) { error = "Invalid configuration for: " + reqTunable.getKey(); - logger.error(Strings.repeat("{} ", 6), MessageEnum.RA_SDNC_INVALID_CONFIG.toString(), reqTunable.getKey(), - value, "SDNC", ErrorCode.DataError.getValue(), "Invalid config"); + logger.error(LoggingAnchor.SIX, MessageEnum.RA_SDNC_INVALID_CONFIG.toString(), reqTunable.getKey(), value, + "SDNC", ErrorCode.DataError.getValue(), "Invalid config"); throw new SDNCAdapterException(error); } @@ -81,7 +81,7 @@ public class MapTypedRequestTunablesData { if ("".equals(reqTunable.getSdncUrl())) { error = MISSING_CONFIGURATION_ERROR_MSG + urlPropKey; - logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), urlPropKey, "SDNC", + logger.error(LoggingAnchor.FIVE, MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), urlPropKey, "SDNC", ErrorCode.DataError.getValue(), MISSING_CONFIG_PARAM_ERROR_MSG); throw new SDNCAdapterException(error); @@ -99,8 +99,8 @@ public class MapTypedRequestTunablesData { if ("".equals(reqTunable.getMyUrl())) { error = MISSING_CONFIGURATION_ERROR_MSG + Constants.MY_URL_PROP; - logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), - Constants.MY_URL_PROP, "SDNC", ErrorCode.DataError.getValue(), MISSING_CONFIG_PARAM_ERROR_MSG); + logger.error(LoggingAnchor.FIVE, MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), Constants.MY_URL_PROP, + "SDNC", ErrorCode.DataError.getValue(), MISSING_CONFIG_PARAM_ERROR_MSG); throw new SDNCAdapterException(error); } diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java index c258b72007..e184bbd110 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java @@ -34,7 +34,7 @@ import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; -import com.google.common.base.Strings; +import org.onap.so.logger.LoggingAnchor; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.config.RequestConfig; @@ -160,8 +160,7 @@ public abstract class SDNCConnector { method = null; - logger.info(Strings.repeat("{} ", 3), MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), responseContent, - "SDNC"); + logger.info(LoggingAnchor.THREE, MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), responseContent, "SDNC"); return createResponseFromContent(statusCode, statusMessage, responseContent, rt); } catch (SocketTimeoutException | ConnectTimeoutException e) { @@ -194,12 +193,12 @@ public abstract class SDNCConnector { } protected void logError(String errMsg) { - logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC", + logger.error(LoggingAnchor.FOUR, MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC", ErrorCode.AvailabilityError.getValue(), errMsg); } protected void logError(String errMsg, Throwable t) { - logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC", + logger.error(LoggingAnchor.FOUR, MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC", ErrorCode.AvailabilityError.getValue(), errMsg, t); } @@ -285,7 +284,7 @@ public abstract class SDNCConnector { String errorType = xpath.evaluate("error-type", error); info += "error-type:" + errorType; } catch (XPathExpressionException e) { - logger.error(Strings.repeat("{} ", 6), MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-type", + logger.error(LoggingAnchor.SIX, MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-type", error.toString(), "SDNC", ErrorCode.DataError.getValue(), XPATH_EXCEPTION, e); } @@ -296,7 +295,7 @@ public abstract class SDNCConnector { } info += "error-tag:" + errorTag; } catch (XPathExpressionException e) { - logger.error(Strings.repeat("{} ", 6), MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-tag", + logger.error(LoggingAnchor.SIX, MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-tag", error.toString(), "SDNC", ErrorCode.DataError.getValue(), XPATH_EXCEPTION, e); } @@ -307,9 +306,8 @@ public abstract class SDNCConnector { } info += "error-message:" + errorMessage; } catch (Exception e) { - logger.error(Strings.repeat("{} ", 6), MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), - "error-message", error.toString(), "SDNC", ErrorCode.DataError.getValue(), XPATH_EXCEPTION, - e); + logger.error(LoggingAnchor.SIX, MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-message", + error.toString(), "SDNC", ErrorCode.DataError.getValue(), XPATH_EXCEPTION, e); } if (!info.isEmpty()) { @@ -321,7 +319,7 @@ public abstract class SDNCConnector { } } } catch (Exception e) { - logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_ANALYZE_ERROR_EXC.toString(), "SDNC", + logger.error(LoggingAnchor.FOUR, MessageEnum.RA_ANALYZE_ERROR_EXC.toString(), "SDNC", ErrorCode.DataError.getValue(), "Exception while analyzing errors", e); } diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java index 022fb7bf89..a68bd3e0be 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java @@ -31,7 +31,7 @@ import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; -import com.google.common.base.Strings; +import org.onap.so.logger.LoggingAnchor; import org.apache.http.HttpStatus; import org.onap.so.adapters.sdnc.exception.SDNCAdapterException; import org.onap.so.adapters.sdncrest.RequestInformation; @@ -186,7 +186,7 @@ public class SDNCServiceRequestTask { addTextChild(agnosticServiceInformation, "content-type", contentType); addTextChild(agnosticServiceInformation, "anydata", anydata); } catch (Exception e) { - logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST.toString(), "SDNC", + logger.error(LoggingAnchor.FOUR, MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST.toString(), "SDNC", ErrorCode.BusinessProcesssError.getValue(), "Exception in genSdncReq", e); return null; } @@ -205,7 +205,7 @@ public class SDNCServiceRequestTask { transformer.transform(new DOMSource(doc), new StreamResult(writer)); xml = writer.toString(); } catch (Exception e) { - logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_ERROR_CONVERT_XML2STR.toString(), + logger.error(LoggingAnchor.THREE, MessageEnum.RA_ERROR_CONVERT_XML2STR.toString(), ErrorCode.DataError.getValue(), "Exception - domToStr", e); return null; } diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java index 31187c568f..5f80c20b97 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java @@ -31,7 +31,7 @@ import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import com.google.common.base.Strings; +import org.onap.so.logger.LoggingAnchor; import org.onap.so.adapters.sdnc.impl.Constants; import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; @@ -62,14 +62,14 @@ public class SNIROResponse { @Consumes("*/*") @Produces({MediaType.TEXT_PLAIN}) public Response serviceNotification(@PathParam("correlator") String correlator, String content) { - logger.info(Strings.repeat("{} ", 4), MessageEnum.RA_RECEIVE_SDNC_NOTIF.toString(), content, "SDNC", + logger.info(LoggingAnchor.FOUR, MessageEnum.RA_RECEIVE_SDNC_NOTIF.toString(), content, "SDNC", "SDNCNotify/SNIROResponse"); String bpUrl = env.getProperty(Constants.BPEL_REST_URL_PROP, ""); if (bpUrl == null || ("").equals(bpUrl)) { String error = "Missing configuration for: " + Constants.BPEL_REST_URL_PROP; - logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), + logger.error(LoggingAnchor.FIVE, MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), Constants.BPEL_REST_URL_PROP, "SDNC", ErrorCode.DataError.getValue(), "Missing config param"); return Response.status(HttpServletResponse.SC_BAD_REQUEST).entity(error).build(); diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java index efc0a303c0..e8b4cfd997 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java @@ -24,7 +24,7 @@ package org.onap.so.adapters.vfc.util; import java.io.IOException; -import com.google.common.base.Strings; +import org.onap.so.logger.LoggingAnchor; import org.onap.so.adapters.vfc.constant.HttpCode; import org.onap.so.adapters.vfc.exceptions.ApplicationException; import org.onap.so.logger.ErrorCode; @@ -84,7 +84,7 @@ public class JsonUtil { try { return MAPPER.readValue(jsonstr, type); } catch (IOException e) { - logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_NS_EXC.toString(), + logger.error(LoggingAnchor.THREE, MessageEnum.RA_NS_EXC.toString(), ErrorCode.BusinessProcesssError.getValue(), UNMARSHAL_FAIL_MSG, e); throw new ApplicationException(HttpCode.BAD_REQUEST, UNMARSHAL_FAIL_MSG); } @@ -102,7 +102,7 @@ public class JsonUtil { try { return MAPPER.readValue(jsonstr, type); } catch (IOException e) { - logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_NS_EXC.toString(), + logger.error(LoggingAnchor.THREE, MessageEnum.RA_NS_EXC.toString(), ErrorCode.BusinessProcesssError.getValue(), UNMARSHAL_FAIL_MSG, e); throw new ApplicationException(HttpCode.BAD_REQUEST, UNMARSHAL_FAIL_MSG); } @@ -119,7 +119,7 @@ public class JsonUtil { try { return MAPPER.writeValueAsString(srcObj); } catch (IOException e) { - logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_NS_EXC.toString(), + logger.error(LoggingAnchor.THREE, MessageEnum.RA_NS_EXC.toString(), ErrorCode.BusinessProcesssError.getValue(), "fail to marshal json", e); throw new ApplicationException(HttpCode.BAD_REQUEST, "srcObj marshal failed!"); } diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java index a84785bcad..647fcafa66 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java @@ -27,7 +27,7 @@ package org.onap.so.adapters.vfc.util; import java.net.HttpURLConnection; import java.net.SocketTimeoutException; import javax.ws.rs.core.UriBuilder; -import com.google.common.base.Strings; +import org.onap.so.logger.LoggingAnchor; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.config.RequestConfig; @@ -195,12 +195,12 @@ public class RestfulUtil { } private static void logError(String errMsg, Throwable t) { - logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_NS_EXC.toString(), VFC_ADAPTER, + logger.error(LoggingAnchor.FOUR, MessageEnum.RA_NS_EXC.toString(), VFC_ADAPTER, ErrorCode.AvailabilityError.getValue(), errMsg, t); } private static void logError(String errMsg) { - logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_NS_EXC.toString(), VFC_ADAPTER, + logger.error(LoggingAnchor.FOUR, MessageEnum.RA_NS_EXC.toString(), VFC_ADAPTER, ErrorCode.AvailabilityError.toString(), errMsg); } |