diff options
author | Gaurav Agrawal <gaurav.agrawal@huawei.com> | 2017-09-18 17:27:12 +0530 |
---|---|---|
committer | Gaurav Agrawal <gaurav.agrawal@huawei.com> | 2017-09-19 01:20:52 +0530 |
commit | d52ee00c84a1a097354b3179c4dd700fa322b165 (patch) | |
tree | 1d4e13a3ce679bc5c8023573dc6fa56d831fda31 /generic-resource-api/provider/src | |
parent | 06a1cf8b1e8313b5a4f25647736ac2c73883abef (diff) |
Some minor refinements to generic-resource-api
Minor refinements to generic-resource-api including:
1) Replace printStackTrace() with log
2) Use built-in string formatting instead of string concatenation
3) Removed redundant ';' after switch statement
4) Change the private method names to follow guidelines to start with lower case
5) Removed redundant null assignment
Change-Id: I48eb08f7305aa549b952715615201a13c3458ca4
Issue-Id: SDNC-45
Signed-off-by: Gaurav Agrawal <gaurav.agrawal@huawei.com>
Diffstat (limited to 'generic-resource-api/provider/src')
-rw-r--r-- | generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java | 310 |
1 files changed, 160 insertions, 150 deletions
diff --git a/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java b/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java index f0659342..0176aca4 100644 --- a/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java +++ b/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java @@ -138,7 +138,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC public GenericResourceApiProvider(DataBroker dataBroker2, NotificationPublishService notificationPublishService, RpcProviderRegistry rpcProviderRegistry) { - this.log.info( "Creating provider for " + appName ); + log.info( "Creating provider for {}", appName); executor = Executors.newFixedThreadPool(1); dataBroker = dataBroker2; notificationService = notificationPublishService; @@ -148,7 +148,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC } public void initialize(){ - log.info( "Initializing provider for " + appName ); + log.info("Initializing provider for {}", appName); // Create the top level containers createContainers(); try { @@ -158,7 +158,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC } rpcRegistration = rpcRegistry.addRpcImplementation(GENERICRESOURCEAPIService.class, this); - log.info( "Initialization complete for " + appName ); + log.info("Initialization complete for {}", appName); } @@ -169,10 +169,10 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC @Override public void close() throws Exception { - log.info( "Closing provider for " + appName ); + log.info("Closing provider for {}", appName); executor.shutdown(); rpcRegistration.close(); - log.info( "Successfully closed provider for " + appName ); + log.info("Successfully closed provider for {}", appName); } private static class Iso8601Util @@ -191,22 +191,21 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC public void setDataBroker(DataBroker dataBroker) { this.dataBroker = dataBroker; if( log.isDebugEnabled() ){ - log.debug( "DataBroker set to " + (dataBroker==null?"null":"non-null") + "." ); + log.debug("DataBroker set to {}", (dataBroker==null?"null":"non-null")); } } - public void setNotificationService( - NotificationPublishService notificationService) { + public void setNotificationService(NotificationPublishService notificationService) { this.notificationService = notificationService; if( log.isDebugEnabled() ){ - log.debug( "Notification Service set to " + (notificationService==null?"null":"non-null") + "." ); + log.debug("Notification Service set to {}", (notificationService==null?"null":"non-null")); } } public void setRpcRegistry(RpcProviderRegistry rpcRegistry) { this.rpcRegistry = rpcRegistry; if( log.isDebugEnabled() ){ - log.debug( "RpcRegistry set to " + (rpcRegistry==null?"null":"non-null") + "." ); + log.debug("RpcRegistry set to {}", (rpcRegistry==null?"null":"non-null")); } } @@ -229,11 +228,10 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC try { CheckedFuture<Void, TransactionCommitFailedException> checkedFuture = t.submit(); checkedFuture.get(); - log.info("Create Containers succeeded!: "); + log.info("Create containers succeeded!"); } catch (InterruptedException | ExecutionException e) { - log.error("Create Containers Failed: " + e); - e.printStackTrace(); + log.error("Create containers failed: ", e); } } @@ -290,16 +288,16 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC serviceStatusBuilder.setRpcAction(RpcAction.Delete); break; default: - log.error("Unknown SvcAction: " + requestHeader.getSvcAction() ); + log.error("Unknown SvcAction: {}", requestHeader.getSvcAction() ); break; - }; + } } } private void getServiceData(String siid, ServiceDataBuilder serviceDataBuilder) { // default to config - getServiceData(siid,serviceDataBuilder,LogicalDatastoreType.CONFIGURATION); + getServiceData(siid,serviceDataBuilder, LogicalDatastoreType.CONFIGURATION); } @@ -314,13 +312,13 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC try { data = (Optional<Service>) readTx.read(type, serviceInstanceIdentifier).get(); } catch (InterruptedException | ExecutionException e) { - log.error("Caught Exception reading MD-SAL ("+type+") for ["+siid+"] " ,e); + log.error("Caught Exception reading MD-SAL ({}) data for [{}] ", type, siid, e); } if (data != null && data.isPresent()) { ServiceData serviceData = data.get().getServiceData(); if (serviceData != null) { - log.info("Read MD-SAL ("+type+") data for ["+siid+"] ServiceData: " + serviceData); + log.info("Read MD-SAL ({}) data for [{}] ServiceData: {}", type, siid, serviceData); serviceDataBuilder.setSdncRequestHeader(serviceData.getSdncRequestHeader()); serviceDataBuilder.setRequestInformation(serviceData.getRequestInformation()); serviceDataBuilder.setServiceInformation(serviceData.getServiceInformation()); @@ -333,49 +331,49 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC serviceDataBuilder.setConsumedAllottedResources(serviceData.getConsumedAllottedResources()); // service-instance-id needs to be set } else { - log.info("No service-data found in MD-SAL ("+type+") for ["+siid+"] "); + log.info("No service-data found in MD-SAL ({}) for [{}]", type, siid); } } else { - log.info("No data found in MD-SAL ("+type+") for ["+siid+"] "); + log.info("No data found in MD-SAL ({}) for [{}]", type, siid); } } private void getPreloadData(String vnf_name, String vnf_type, PreloadDataBuilder preloadDataBuilder) { // default to config - getPreloadData(vnf_name, vnf_type ,preloadDataBuilder,LogicalDatastoreType.CONFIGURATION); + getPreloadData(vnf_name, vnf_type ,preloadDataBuilder, LogicalDatastoreType.CONFIGURATION); } private void getPreloadData(String preload_name, String preload_type, PreloadDataBuilder preloadDataBuilder, LogicalDatastoreType type) { // See if any data exists yet for this name/type, if so grab it. - InstanceIdentifier preloadInstanceIdentifier = - InstanceIdentifier.<PreloadVnfs>builder(PreloadVnfs.class) + InstanceIdentifier preloadInstanceIdentifier = InstanceIdentifier.<PreloadVnfs>builder(PreloadVnfs.class) .child(VnfPreloadList.class, new VnfPreloadListKey(preload_name, preload_type)).build(); ReadOnlyTransaction readTx = dataBroker.newReadOnlyTransaction(); Optional<VnfPreloadList> data = null; try { data = (Optional<VnfPreloadList>) readTx.read(type, preloadInstanceIdentifier).get(); } catch (InterruptedException | ExecutionException e) { - log.error("Caught Exception reading MD-SAL ("+type+") for ["+preload_name+","+preload_type+"] " ,e); + log.error("Caught Exception reading MD-SAL ({}) for [{},{}] ", type, preload_name, preload_type, e); } if (data != null && data.isPresent()) { PreloadData preloadData = data.get().getPreloadData(); if (preloadData != null) { - log.info("Read MD-SAL ("+type+") data for ["+preload_name+","+preload_type+"] PreloadData: " + preloadData); + log.info("Read MD-SAL ({}) data for [{},{}] PreloadData: {}", + type, preload_name, preload_type, preloadData); preloadDataBuilder.setVnfTopologyInformation(preloadData.getVnfTopologyInformation()); preloadDataBuilder.setNetworkTopologyInformation(preloadData.getNetworkTopologyInformation()); preloadDataBuilder.setOperStatus(preloadData.getOperStatus()); } else { - log.info("No preload-data found in MD-SAL ("+type+") for ["+preload_name+","+preload_type+"] "); + log.info("No preload-data found in MD-SAL ({}) for [{},{}] ", type, preload_name, preload_type); } } else { - log.info("No data found in MD-SAL ("+type+") for ["+preload_name+","+preload_type+"] "); + log.info("No data found in MD-SAL ({}) for [{},{}] ", type, preload_name, preload_type); } } - private void SaveService (final Service entry, boolean merge, LogicalDatastoreType storeType) throws IllegalStateException { + private void saveService(final Service entry, boolean merge, LogicalDatastoreType storeType) throws IllegalStateException { // Each entry will be identifiable by a unique key, we have to create that identifier InstanceIdentifier.InstanceIdentifierBuilder<Service> serviceBuilder = InstanceIdentifier.<Services>builder(Services.class) @@ -409,7 +407,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC } } - private void DeleteService(final Service entry, LogicalDatastoreType storeType) throws IllegalStateException { + private void deleteService(final Service entry, LogicalDatastoreType storeType) throws IllegalStateException { // Each entry will be identifiable by a unique key, we have to create // that identifier InstanceIdentifier.InstanceIdentifierBuilder<Service> serviceListIdBuilder = InstanceIdentifier.<Services> builder(Services.class).child(Service.class, entry.getKey()); @@ -438,7 +436,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC } } - private void SavePreloadList(final VnfPreloadList entry, boolean merge, LogicalDatastoreType storeType) throws IllegalStateException{ + private void savePreloadList(final VnfPreloadList entry, boolean merge, LogicalDatastoreType storeType) throws IllegalStateException{ // Each entry will be identifiable by a unique key, we have to create that identifier InstanceIdentifier.InstanceIdentifierBuilder<VnfPreloadList> vnfPreloadListBuilder = @@ -481,7 +479,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC ServiceStatusBuilder serviceStatusBuilder = new ServiceStatusBuilder(); Properties parms = new Properties(); - log.info( SVC_OPERATION +" called." ); + log.info("{} called.",SVC_OPERATION); // create a new response object ServiceTopologyOperationOutputBuilder responseBuilder = new ServiceTopologyOperationOutputBuilder(); @@ -490,7 +488,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC input.getServiceInformation().getServiceInstanceId() == null || input.getServiceInformation().getServiceInstanceId().length() == 0) { - log.debug("exiting " +SVC_OPERATION+ " because of null or empty service-instance-id"); + log.debug("exiting {} because of null or empty service-instance-id", SVC_OPERATION); responseBuilder.setResponseCode("404"); responseBuilder.setResponseMessage("invalid input, null or empty service-instance-id"); responseBuilder.setAckFinalIndicator("Y"); @@ -526,11 +524,11 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC // uses service-response-information; */ - log.info("Adding INPUT data for "+SVC_OPERATION+" ["+siid+"] input: " + input); + log.info("Adding INPUT data for {} [{}] input: {}", SVC_OPERATION, siid, input); ServiceTopologyOperationInputBuilder inputBuilder = new ServiceTopologyOperationInputBuilder(input); GenericResourceApiUtil.toProperties(parms, inputBuilder.build()); - log.info("Adding OPERATIONAL data for "+SVC_OPERATION+" ["+siid+"] operational-data: " + operDataBuilder.build()); + log.info("Adding OPERATIONAL data for {} [{}] operational-data: {}", SVC_OPERATION, siid, operDataBuilder.build()); GenericResourceApiUtil.toProperties(parms, "operational-data", operDataBuilder); // Call SLI sync method @@ -555,7 +553,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC } catch (Exception e) { - log.error("Caught exception executing service logic for "+ SVC_OPERATION, e); + log.error("Caught exception executing service logic for {} ", SVC_OPERATION, e); errorMessage = e.getMessage(); errorCode = "500"; } @@ -594,11 +592,11 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC serviceBuilder.setServiceInstanceId(siid); serviceBuilder.setServiceStatus(serviceStatusBuilder.build()); try { - SaveService (serviceBuilder.build(), true,LogicalDatastoreType.CONFIGURATION); + saveService(serviceBuilder.build(), true, LogicalDatastoreType.CONFIGURATION); } catch (Exception e) { - log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] \n",e); + log.error("Caught Exception updating MD-SAL for {} [{}] \n", SVC_OPERATION, siid, e); } - log.error("Returned FAILED for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build()); + log.error("Returned FAILED for {} [{}] {}", SVC_OPERATION, siid, responseBuilder.build()); RpcResult<ServiceTopologyOperationOutput> rpcResult = RpcResultBuilder.<ServiceTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); return Futures.immediateFuture(rpcResult); @@ -607,14 +605,14 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC // Got success from SLI try { serviceData = serviceDataBuilder.build(); - log.info("Updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] ServiceData: " + serviceData); + log.info("Updating MD-SAL for {} [{}] ServiceData: {}", SVC_OPERATION, siid, serviceData); // service object ServiceBuilder serviceBuilder = new ServiceBuilder(); serviceBuilder.setServiceData(serviceData); serviceBuilder.setServiceInstanceId(siid); serviceBuilder.setServiceStatus(serviceStatusBuilder.build()); - SaveService (serviceBuilder.build(), false,LogicalDatastoreType.CONFIGURATION); + saveService(serviceBuilder.build(), false, LogicalDatastoreType.CONFIGURATION); if (input.getSdncRequestHeader() != null && input.getSdncRequestHeader().getSvcAction() != null) { @@ -622,8 +620,8 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC if (input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Delete)) { log.info("Delete from both CONFIGURATION and OPERATIONAL tree."); - DeleteService(serviceBuilder.build(), LogicalDatastoreType.OPERATIONAL); - DeleteService(serviceBuilder.build(), LogicalDatastoreType.CONFIGURATION); + deleteService(serviceBuilder.build(), LogicalDatastoreType.OPERATIONAL); + deleteService(serviceBuilder.build(), LogicalDatastoreType.CONFIGURATION); } } @@ -633,11 +631,11 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC responseBuilder.setServiceResponseInformation(serviceResponseInformationBuilder.build()); } catch (Exception e) { - log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] \n",e); + log.error("Caught Exception updating MD-SAL for {} [{}] \n",SVC_OPERATION, siid, e); responseBuilder.setResponseCode("500"); responseBuilder.setResponseMessage(e.toString()); responseBuilder.setAckFinalIndicator("Y"); - log.error("Returned FAILED for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build()); + log.error("Returned FAILED for {} [{}] {}", SVC_OPERATION, siid, responseBuilder.build()); RpcResult<ServiceTopologyOperationOutput> rpcResult = RpcResultBuilder.<ServiceTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); return Futures.immediateFuture(rpcResult); @@ -650,8 +648,8 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC { responseBuilder.setResponseMessage(errorMessage); } - log.info("Updated MD-SAL for "+SVC_OPERATION+" ["+siid+"] "); - log.info("Returned SUCCESS for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build()); + log.info("Updated MD-SAL for {} [{}]", SVC_OPERATION, siid); + log.info("Returned SUCCESS for {} [{}] {}", SVC_OPERATION, siid, responseBuilder.build()); RpcResult<ServiceTopologyOperationOutput> rpcResult = RpcResultBuilder.<ServiceTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); @@ -667,7 +665,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC ServiceStatusBuilder serviceStatusBuilder = new ServiceStatusBuilder(); Properties parms = new Properties(); - log.info( SVC_OPERATION +" called." ); + log.info("{} called.", SVC_OPERATION); // create a new response object VnfTopologyOperationOutputBuilder responseBuilder = new VnfTopologyOperationOutputBuilder(); @@ -676,7 +674,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC input.getServiceInformation().getServiceInstanceId() == null || input.getServiceInformation().getServiceInstanceId().length() == 0) { - log.debug("exiting " +SVC_OPERATION+ " because of null or empty service-instance-id"); + log.debug("exiting {} because of null or empty service-instance-id", SVC_OPERATION); responseBuilder.setResponseCode("404"); responseBuilder.setResponseMessage("invalid input, null or empty service-instance-id"); responseBuilder.setAckFinalIndicator("Y"); @@ -697,7 +695,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC input.getVnfInformation().getVnfId() == null || input.getVnfInformation().getVnfId().length() == 0) { - log.debug("exiting " +SVC_OPERATION+ " because of null or empty vnf-id"); + log.debug("exiting {} because of null or empty vnf-id", SVC_OPERATION); responseBuilder.setResponseCode("404"); responseBuilder.setResponseMessage("invalid input, null or empty vnf-id"); responseBuilder.setAckFinalIndicator("Y"); @@ -755,11 +753,11 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC // uses vnf-configuration-information; // uses oper-status; - log.info("Adding INPUT data for "+SVC_OPERATION+" ["+siid+"] input: " + input); + log.info("Adding INPUT data for {} [{}] input: {}", SVC_OPERATION, siid, input); VnfTopologyOperationInputBuilder inputBuilder = new VnfTopologyOperationInputBuilder(input); GenericResourceApiUtil.toProperties(parms, inputBuilder.build()); - log.info("Adding OPERATIONAL data for "+SVC_OPERATION+" ["+siid+"] operational-data: " + operDataBuilder.build()); + log.info("Adding OPERATIONAL data for {} [{}] operational-data: {}", SVC_OPERATION, siid, operDataBuilder.build()); GenericResourceApiUtil.toProperties(parms, "operational-data", operDataBuilder); /* @@ -789,7 +787,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC } catch (Exception e) { - log.error("Caught exception executing service logic for "+ SVC_OPERATION, e); + log.error("Caught exception executing service logic for {} ", SVC_OPERATION, e); errorMessage = e.getMessage(); errorCode = "500"; } @@ -827,7 +825,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC serviceBuilder.setServiceInstanceId(siid); serviceBuilder.setServiceStatus(serviceStatusBuilder.build()); try { - SaveService (serviceBuilder.build(), true,LogicalDatastoreType.CONFIGURATION); + saveService(serviceBuilder.build(), true, LogicalDatastoreType.CONFIGURATION); if (input.getSdncRequestHeader() != null && input.getSdncRequestHeader().getSvcAction() != null) { // Only update operational tree on activate or delete @@ -835,13 +833,13 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Activate)) { log.info("Updating OPERATIONAL tree."); - SaveService (serviceBuilder.build(), false, LogicalDatastoreType.OPERATIONAL); + saveService(serviceBuilder.build(), false, LogicalDatastoreType.OPERATIONAL); } } } catch (Exception e) { - log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] \n",e); + log.error("Caught Exception updating MD-SAL for {} [{}] \n", SVC_OPERATION, siid, e); } - log.error("Returned FAILED for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build()); + log.error("Returned FAILED for {} [{}] {}", SVC_OPERATION, siid, responseBuilder.build()); RpcResult<VnfTopologyOperationOutput> rpcResult = RpcResultBuilder.<VnfTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); // return error @@ -851,14 +849,14 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC // Got success from SLI try { serviceData = serviceDataBuilder.build(); - log.info("Updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] ServiceData: " + serviceData); + log.info("Updating MD-SAL for {} [{}] ServiceData: {}", SVC_OPERATION, siid, serviceData); // service object ServiceBuilder serviceBuilder = new ServiceBuilder(); serviceBuilder.setServiceData(serviceData); serviceBuilder.setServiceInstanceId(siid); serviceBuilder.setServiceStatus(serviceStatusBuilder.build()); - SaveService (serviceBuilder.build(), false,LogicalDatastoreType.CONFIGURATION); + saveService(serviceBuilder.build(), false, LogicalDatastoreType.CONFIGURATION); if (input.getSdncRequestHeader() != null && input.getSdncRequestHeader().getSvcAction() != null) { @@ -866,7 +864,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC if (input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Activate)) { log.info("Updating OPERATIONAL tree."); - SaveService (serviceBuilder.build(), false, LogicalDatastoreType.OPERATIONAL); + saveService(serviceBuilder.build(), false, LogicalDatastoreType.OPERATIONAL); } } @@ -876,11 +874,11 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC responseBuilder.setServiceResponseInformation(serviceResponseInformationBuilder.build()); } catch (Exception e) { - log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] \n",e); + log.error("Caught Exception updating MD-SAL for {} [{}] \n", SVC_OPERATION, siid, e); responseBuilder.setResponseCode("500"); responseBuilder.setResponseMessage(e.toString()); responseBuilder.setAckFinalIndicator("Y"); - log.error("Returned FAILED for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build()); + log.error("Returned FAILED for {} [{}] {}", SVC_OPERATION, siid, responseBuilder.build()); RpcResult<VnfTopologyOperationOutput> rpcResult = RpcResultBuilder.<VnfTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); return Futures.immediateFuture(rpcResult); @@ -893,8 +891,8 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC { responseBuilder.setResponseMessage(errorMessage); } - log.info("Updated MD-SAL for "+SVC_OPERATION+" ["+siid+"] "); - log.info("Returned SUCCESS for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build()); + log.info("Updated MD-SAL for {} [{}]", SVC_OPERATION, siid); + log.info("Returned SUCCESS for {} [{}] {}", SVC_OPERATION, siid, responseBuilder.build()); RpcResult<VnfTopologyOperationOutput> rpcResult = RpcResultBuilder.<VnfTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); @@ -911,7 +909,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC ServiceStatusBuilder serviceStatusBuilder = new ServiceStatusBuilder(); Properties parms = new Properties(); - log.info( SVC_OPERATION +" called." ); + log.info("{} called.", SVC_OPERATION); // create a new response object VfModuleTopologyOperationOutputBuilder responseBuilder = new VfModuleTopologyOperationOutputBuilder(); @@ -920,7 +918,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC input.getServiceInformation().getServiceInstanceId() == null || input.getServiceInformation().getServiceInstanceId().length() == 0) { - log.debug("exiting " +SVC_OPERATION+ " because of null or empty service-instance-id"); + log.debug("exiting {} because of null or empty service-instance-id", SVC_OPERATION); responseBuilder.setResponseCode("403"); responseBuilder.setResponseMessage("invalid input, null or empty service-instance-id"); responseBuilder.setAckFinalIndicator("Y"); @@ -934,7 +932,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC input.getVnfInformation().getVnfId() == null || input.getVnfInformation().getVnfId().length() == 0) { - log.debug("exiting " +SVC_OPERATION+ " because of null or empty vnf-id"); + log.debug("exiting {} because of null or empty vnf-id", SVC_OPERATION); responseBuilder.setResponseCode("403"); responseBuilder.setResponseMessage("invalid input, null or empty vnf-id"); responseBuilder.setAckFinalIndicator("Y"); @@ -947,7 +945,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC input.getVfModuleInformation().getVfModuleId() == null || input.getVfModuleInformation().getVfModuleId().length() == 0) { - log.debug("exiting " +SVC_OPERATION+ " because of null or empty vf-module-id"); + log.debug("exiting {} because of null or empty vf-module-id", SVC_OPERATION); responseBuilder.setResponseCode("403"); responseBuilder.setResponseMessage("invalid input, vf-module-id is null or empty"); responseBuilder.setAckFinalIndicator("Y"); @@ -1010,11 +1008,11 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC // uses vnf-configuration-information; // uses oper-status; - log.info("Adding INPUT data for "+SVC_OPERATION+" ["+siid+"] input: " + input); + log.info("Adding INPUT data for {} [{}] input: {}", SVC_OPERATION, siid, input); VfModuleTopologyOperationInputBuilder inputBuilder = new VfModuleTopologyOperationInputBuilder(input); GenericResourceApiUtil.toProperties(parms, inputBuilder.build()); - log.info("Adding OPERATIONAL data for "+SVC_OPERATION+" ["+siid+"] operational-data: " + operDataBuilder.build()); + log.info("Adding OPERATIONAL data for {} [{}] operational-data: {}", SVC_OPERATION, siid, operDataBuilder.build()); GenericResourceApiUtil.toProperties(parms, "operational-data", operDataBuilder); /* @@ -1081,11 +1079,11 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC serviceBuilder.setServiceInstanceId(siid); serviceBuilder.setServiceStatus(serviceStatusBuilder.build()); try { - SaveService (serviceBuilder.build(), true,LogicalDatastoreType.CONFIGURATION); + saveService(serviceBuilder.build(), true, LogicalDatastoreType.CONFIGURATION); } catch (Exception e) { - log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] \n",e); + log.error("Caught Exception updating MD-SAL for {} [{}] \n", SVC_OPERATION, siid, e); } - log.error("Returned FAILED for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build()); + log.error("Returned FAILED for {} [{}] {}", SVC_OPERATION, siid, responseBuilder.build()); RpcResult<VfModuleTopologyOperationOutput> rpcResult = RpcResultBuilder.<VfModuleTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); // return error @@ -1095,7 +1093,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC // Got success from SLI try { serviceData = serviceDataBuilder.build(); - log.info("Updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] ServiceData: " + serviceData); + log.info("Updating MD-SAL for {} [{}] ServiceData: {}", SVC_OPERATION, siid, serviceData); // service object ServiceBuilder serviceBuilder = new ServiceBuilder(); @@ -1103,7 +1101,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC //serviceBuilder.setServiceInstanceId(serviceData.getServiceTopology().getServiceTopologyIdentifier().getServiceInstanceId()); serviceBuilder.setServiceInstanceId(siid); serviceBuilder.setServiceStatus(serviceStatusBuilder.build()); - SaveService (serviceBuilder.build(), false,LogicalDatastoreType.CONFIGURATION); + saveService(serviceBuilder.build(), false, LogicalDatastoreType.CONFIGURATION); if (input.getSdncRequestHeader() != null && input.getSdncRequestHeader().getSvcAction() != null) { @@ -1112,7 +1110,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Activate)) { log.info("Updating OPERATIONAL tree."); - SaveService (serviceBuilder.build(), false, LogicalDatastoreType.OPERATIONAL); + saveService(serviceBuilder.build(), false, LogicalDatastoreType.OPERATIONAL); } } @@ -1122,11 +1120,11 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC responseBuilder.setServiceResponseInformation(serviceResponseInformationBuilder.build()); } catch (Exception e) { - log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] \n",e); + log.error("Caught Exception updating MD-SAL for {} [{}] \n", SVC_OPERATION, siid, e); responseBuilder.setResponseCode("500"); responseBuilder.setResponseMessage(e.toString()); responseBuilder.setAckFinalIndicator("Y"); - log.error("Returned FAILED for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build()); + log.error("Returned FAILED for {} [{}] {}", SVC_OPERATION, siid, responseBuilder.build()); RpcResult<VfModuleTopologyOperationOutput> rpcResult = RpcResultBuilder.<VfModuleTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); return Futures.immediateFuture(rpcResult); @@ -1139,8 +1137,8 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC { responseBuilder.setResponseMessage(errorMessage); } - log.info("Updated MD-SAL for "+SVC_OPERATION+" ["+siid+"] "); - log.info("Returned SUCCESS for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build()); + log.info("Updated MD-SAL for {} [{}]", SVC_OPERATION, siid); + log.info("Returned SUCCESS for {} [{}] {}", SVC_OPERATION, siid, responseBuilder.build()); RpcResult<VfModuleTopologyOperationOutput> rpcResult = RpcResultBuilder.<VfModuleTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); @@ -1157,7 +1155,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC ServiceStatusBuilder serviceStatusBuilder = new ServiceStatusBuilder(); Properties parms = new Properties(); - log.info( SVC_OPERATION +" called." ); + log.info("{} called.", SVC_OPERATION ); // create a new response object NetworkTopologyOperationOutputBuilder responseBuilder = new NetworkTopologyOperationOutputBuilder(); @@ -1166,7 +1164,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC input.getServiceInformation().getServiceInstanceId() == null || input.getServiceInformation().getServiceInstanceId().length() == 0) { - log.debug("exiting " +SVC_OPERATION+ " because of null or empty service-instance-id"); + log.debug("exiting {} because of null or empty service-instance-id", SVC_OPERATION); responseBuilder.setResponseCode("404"); responseBuilder.setResponseMessage("invalid input, null or empty service-instance-id"); responseBuilder.setAckFinalIndicator("Y"); @@ -1188,7 +1186,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC ServiceData sd = serviceDataBuilder.build(); if (sd == null || sd.getServiceLevelOperStatus() == null) { - log.debug("exiting " +SVC_OPERATION+ " because the service-instance does not have any service data in SDNC"); + log.debug("exiting {} because the service-instance does not have any service data in SDNC", SVC_OPERATION); responseBuilder.setResponseCode("404"); responseBuilder.setResponseMessage("invalid input: the service-instance does not have any service data in SDNC"); responseBuilder.setAckFinalIndicator("Y"); @@ -1222,7 +1220,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC } */ - log.info("Adding INPUT data for "+SVC_OPERATION+" ["+siid+"] input: " + input); + log.info("Adding INPUT data for {} [{}] input: {}", SVC_OPERATION, siid, input); NetworkTopologyOperationInputBuilder inputBuilder = new NetworkTopologyOperationInputBuilder(input); GenericResourceApiUtil.toProperties(parms, inputBuilder.build()); @@ -1250,7 +1248,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC } catch (Exception e) { - log.error("Caught exception executing service logic for "+ SVC_OPERATION, e); + log.error("Caught exception executing service logic for {}", SVC_OPERATION, e); errorMessage = e.getMessage(); errorCode = "500"; } @@ -1282,7 +1280,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC responseBuilder.setResponseMessage(errorMessage); responseBuilder.setAckFinalIndicator(ackFinal); - log.error("Returned FAILED for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build()); + log.error("Returned FAILED for {} [{}] {}", SVC_OPERATION, siid, responseBuilder.build()); RpcResult<NetworkTopologyOperationOutput> rpcResult = RpcResultBuilder.<NetworkTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); @@ -1293,14 +1291,14 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC try { serviceData = serviceDataBuilder.build(); - log.info("Updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] ServiceData: " + serviceData); + log.info("Updating MD-SAL for {} [{}] ServiceData: {}", SVC_OPERATION, siid, serviceData); // service object ServiceBuilder serviceBuilder = new ServiceBuilder(); serviceBuilder.setServiceData(serviceData); serviceBuilder.setServiceInstanceId(siid); serviceBuilder.setServiceStatus(serviceStatusBuilder.build()); - SaveService (serviceBuilder.build(), false,LogicalDatastoreType.CONFIGURATION); + saveService(serviceBuilder.build(), false, LogicalDatastoreType.CONFIGURATION); if (input.getSdncRequestHeader() != null && input.getSdncRequestHeader().getSvcAction() != null) { @@ -1308,7 +1306,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC if (input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Activate)) { log.info("Updating OPERATIONAL tree."); - SaveService (serviceBuilder.build(), false, LogicalDatastoreType.OPERATIONAL); + saveService(serviceBuilder.build(), false, LogicalDatastoreType.OPERATIONAL); } } @@ -1323,11 +1321,11 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC responseBuilder.setServiceResponseInformation(serviceResponseInformationBuilder.build()); } catch (IllegalStateException e) { - log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] \n",e); + log.error("Caught Exception updating MD-SAL for {} [{}] \n", SVC_OPERATION, siid, e); responseBuilder.setResponseCode("500"); responseBuilder.setResponseMessage(e.toString()); responseBuilder.setAckFinalIndicator("Y"); - log.error("Returned FAILED for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build()); + log.error("Returned FAILED for {} [{}] {}", SVC_OPERATION, siid, responseBuilder.build()); RpcResult<NetworkTopologyOperationOutput> rpcResult = RpcResultBuilder.<NetworkTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); return Futures.immediateFuture(rpcResult); @@ -1340,8 +1338,8 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC { responseBuilder.setResponseMessage(errorMessage); } - log.info("Updated MD-SAL for "+SVC_OPERATION+" ["+siid+"] "); - log.info("Returned SUCCESS for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build()); + log.info("Updated MD-SAL for {} [{}]", SVC_OPERATION, siid); + log.info("Returned SUCCESS for {} [{}] {}", SVC_OPERATION, siid, responseBuilder.build()); RpcResult<NetworkTopologyOperationOutput> rpcResult = RpcResultBuilder.<NetworkTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); @@ -1357,7 +1355,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC ServiceStatusBuilder serviceStatusBuilder = new ServiceStatusBuilder(); Properties parms = new Properties(); - log.info( SVC_OPERATION +" called." ); + log.info("{} called.", SVC_OPERATION); // create a new response object ContrailRouteTopologyOperationOutputBuilder responseBuilder = new ContrailRouteTopologyOperationOutputBuilder(); @@ -1366,7 +1364,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC input.getServiceInformation().getServiceInstanceId() == null || input.getServiceInformation().getServiceInstanceId().length() == 0) { - log.debug("exiting " +SVC_OPERATION+ " because of null or empty service-instance-id"); + log.debug("exiting {} because of null or empty service-instance-id", SVC_OPERATION); responseBuilder.setResponseCode("404"); responseBuilder.setResponseMessage("invalid input, null or empty service-instance-id"); responseBuilder.setAckFinalIndicator("Y"); @@ -1388,7 +1386,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC ServiceData sd = serviceDataBuilder.build(); if (sd == null || sd.getServiceLevelOperStatus() == null) { - log.debug("exiting " +SVC_OPERATION+ " because the service-instance does not have any service data in SDNC"); + log.debug("exiting {} because the service-instance does not have any service data in SDNC", SVC_OPERATION); responseBuilder.setResponseCode("404"); responseBuilder.setResponseMessage("invalid input: the service-instance does not have any service data in SDNC"); responseBuilder.setAckFinalIndicator("Y"); @@ -1425,7 +1423,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC } catch (Exception e) { - log.error("Caught exception executing service logic for "+ SVC_OPERATION, e); + log.error("Caught exception executing service logic for {}", SVC_OPERATION, e); errorMessage = e.getMessage(); errorCode = "500"; } @@ -1457,7 +1455,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC responseBuilder.setResponseMessage(errorMessage); responseBuilder.setAckFinalIndicator(ackFinal); - log.error("Returned FAILED for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build()); + log.error("Returned FAILED for {} [{}] {}", SVC_OPERATION, siid, responseBuilder.build()); RpcResult<ContrailRouteTopologyOperationOutput> rpcResult = RpcResultBuilder.<ContrailRouteTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); @@ -1468,14 +1466,14 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC try { serviceData = serviceDataBuilder.build(); - log.info("Updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] ServiceData: " + serviceData); + log.info("Updating MD-SAL for {} [{}] ServiceData: {}", SVC_OPERATION, siid, serviceData); // service object ServiceBuilder serviceBuilder = new ServiceBuilder(); serviceBuilder.setServiceData(serviceData); serviceBuilder.setServiceInstanceId(siid); serviceBuilder.setServiceStatus(serviceStatusBuilder.build()); - SaveService (serviceBuilder.build(), false,LogicalDatastoreType.CONFIGURATION); + saveService(serviceBuilder.build(), false, LogicalDatastoreType.CONFIGURATION); if (input.getSdncRequestHeader() != null && input.getSdncRequestHeader().getSvcAction() != null) { @@ -1484,7 +1482,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Activate)) { log.info("Updating OPERATIONAL tree."); - SaveService (serviceBuilder.build(), false, LogicalDatastoreType.OPERATIONAL); + saveService(serviceBuilder.build(), false, LogicalDatastoreType.OPERATIONAL); } } @@ -1499,11 +1497,11 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC responseBuilder.setServiceResponseInformation(serviceResponseInformationBuilder.build()); } catch (IllegalStateException e) { - log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] \n",e); + log.error("Caught Exception updating MD-SAL for {} [{}] \n", SVC_OPERATION, siid, e); responseBuilder.setResponseCode("500"); responseBuilder.setResponseMessage(e.toString()); responseBuilder.setAckFinalIndicator("Y"); - log.error("Returned FAILED for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build()); + log.error("Returned FAILED for {} [{}] {}", SVC_OPERATION, siid, responseBuilder.build()); RpcResult<ContrailRouteTopologyOperationOutput> rpcResult = RpcResultBuilder.<ContrailRouteTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); return Futures.immediateFuture(rpcResult); @@ -1516,8 +1514,8 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC { responseBuilder.setResponseMessage(errorMessage); } - log.info("Updated MD-SAL for "+SVC_OPERATION+" ["+siid+"] "); - log.info("Returned SUCCESS for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build()); + log.info("Updated MD-SAL for {} [{}]", SVC_OPERATION, siid); + log.info("Returned SUCCESS for {} [{}] {}", SVC_OPERATION, siid, responseBuilder.build()); RpcResult<ContrailRouteTopologyOperationOutput> rpcResult = RpcResultBuilder.<ContrailRouteTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); @@ -1533,7 +1531,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC ServiceStatusBuilder serviceStatusBuilder = new ServiceStatusBuilder(); Properties parms = new Properties(); - log.info( SVC_OPERATION +" called." ); + log.info("{} called.", SVC_OPERATION); // create a new response object SecurityZoneTopologyOperationOutputBuilder responseBuilder = new SecurityZoneTopologyOperationOutputBuilder(); @@ -1542,7 +1540,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC input.getServiceInformation().getServiceInstanceId() == null || input.getServiceInformation().getServiceInstanceId().length() == 0) { - log.debug("exiting " +SVC_OPERATION+ " because of null or empty service-instance-id"); + log.debug("exiting {} because of null or empty service-instance-id", SVC_OPERATION); responseBuilder.setResponseCode("404"); responseBuilder.setResponseMessage("invalid input, null or empty service-instance-id"); responseBuilder.setAckFinalIndicator("Y"); @@ -1564,7 +1562,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC ServiceData sd = serviceDataBuilder.build(); if (sd == null || sd.getServiceLevelOperStatus() == null) { - log.debug("exiting " +SVC_OPERATION+ " because the service-instance does not have any service data in SDNC"); + log.debug("exiting {} because the service-instance does not have any service data in SDNC", SVC_OPERATION); responseBuilder.setResponseCode("404"); responseBuilder.setResponseMessage("invalid input: the service-instance does not have any service data in SDNC"); responseBuilder.setAckFinalIndicator("Y"); @@ -1573,7 +1571,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC return Futures.immediateFuture(rpcResult); } - log.info("Adding INPUT data for "+SVC_OPERATION+" ["+siid+"] input: " + input); + log.info("Adding INPUT data for {} [{}] input: {}", SVC_OPERATION, siid, input); SecurityZoneTopologyOperationInputBuilder inputBuilder = new SecurityZoneTopologyOperationInputBuilder(input); GenericResourceApiUtil.toProperties(parms, inputBuilder.build()); @@ -1601,7 +1599,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC } catch (Exception e) { - log.error("Caught exception executing service logic for "+ SVC_OPERATION, e); + log.error("Caught exception executing service logic for {}", SVC_OPERATION, e); errorMessage = e.getMessage(); errorCode = "500"; } @@ -1633,7 +1631,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC responseBuilder.setResponseMessage(errorMessage); responseBuilder.setAckFinalIndicator(ackFinal); - log.error("Returned FAILED for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build()); + log.error("Returned FAILED for {} [{}] {}", SVC_OPERATION, siid, responseBuilder.build()); RpcResult<SecurityZoneTopologyOperationOutput> rpcResult = RpcResultBuilder.<SecurityZoneTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); @@ -1644,14 +1642,14 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC try { serviceData = serviceDataBuilder.build(); - log.info("Updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] ServiceData: " + serviceData); + log.info("Updating MD-SAL for {} [{}] ServiceData: {}", SVC_OPERATION, siid, serviceData); // service object ServiceBuilder serviceBuilder = new ServiceBuilder(); serviceBuilder.setServiceData(serviceData); serviceBuilder.setServiceInstanceId(siid); serviceBuilder.setServiceStatus(serviceStatusBuilder.build()); - SaveService (serviceBuilder.build(), false,LogicalDatastoreType.CONFIGURATION); + saveService(serviceBuilder.build(), false, LogicalDatastoreType.CONFIGURATION); if (input.getSdncRequestHeader() != null && input.getSdncRequestHeader().getSvcAction() != null) { @@ -1660,7 +1658,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Activate)) { log.info("Updating OPERATIONAL tree."); - SaveService (serviceBuilder.build(), false, LogicalDatastoreType.OPERATIONAL); + saveService(serviceBuilder.build(), false, LogicalDatastoreType.OPERATIONAL); } } @@ -1675,11 +1673,11 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC responseBuilder.setServiceResponseInformation(serviceResponseInformationBuilder.build()); } catch (IllegalStateException e) { - log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] \n",e); + log.error("Caught Exception updating MD-SAL for {} [{}] \n", SVC_OPERATION, siid, e); responseBuilder.setResponseCode("500"); responseBuilder.setResponseMessage(e.toString()); responseBuilder.setAckFinalIndicator("Y"); - log.error("Returned FAILED for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build()); + log.error("Returned FAILED for {} [{}] {}", SVC_OPERATION, siid, responseBuilder.build()); RpcResult<SecurityZoneTopologyOperationOutput> rpcResult = RpcResultBuilder.<SecurityZoneTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); return Futures.immediateFuture(rpcResult); @@ -1692,8 +1690,8 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC { responseBuilder.setResponseMessage(errorMessage); } - log.info("Updated MD-SAL for "+SVC_OPERATION+" ["+siid+"] "); - log.info("Returned SUCCESS for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build()); + log.info("Updated MD-SAL for {} [{}]", SVC_OPERATION, siid); + log.info("Returned SUCCESS for {} [{}] {}", SVC_OPERATION, siid, responseBuilder.build()); RpcResult<SecurityZoneTopologyOperationOutput> rpcResult = RpcResultBuilder.<SecurityZoneTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); @@ -1705,10 +1703,10 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC PreloadVnfTopologyOperationInput input) { final String SVC_OPERATION = "preload-vnf-topology-operation"; - PreloadData preloadData = null; + PreloadData preloadData; Properties parms = new Properties(); - log.info( SVC_OPERATION +" called." ); + log.info("{} called.", SVC_OPERATION); // create a new response object PreloadVnfTopologyOperationOutputBuilder responseBuilder = new PreloadVnfTopologyOperationOutputBuilder(); @@ -1717,7 +1715,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC if(input == null || input.getVnfTopologyInformation() == null || input.getVnfTopologyInformation().getVnfTopologyIdentifier() == null) { - log.debug("exiting " +SVC_OPERATION+ " because of null input"); + log.debug("exiting {} because of null input", SVC_OPERATION); responseBuilder.setResponseCode("403"); responseBuilder.setResponseMessage("invalid input: input is null"); responseBuilder.setAckFinalIndicator("Y"); @@ -1732,7 +1730,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC // Make sure we have a preload_name and preload_type if(preload_name == null || preload_name.length() == 0 || preload_type == null || preload_type.length() == 0 ) { - log.debug("exiting "+ SVC_OPERATION + " vnf-name or vnf-type is null or empty"); + log.debug("exiting {} vnf-name or vnf-type is null or empty", SVC_OPERATION); responseBuilder.setResponseCode("403"); responseBuilder.setResponseMessage("invalid input: vnf-name or vnf-type is null or empty"); responseBuilder.setAckFinalIndicator("Y"); @@ -1765,10 +1763,11 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC // uses network-topology-information; // uses oper-status; - log.info("Adding INPUT data for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] input: " + input); + log.info("Adding INPUT data for {} [{},{}] input: {}", SVC_OPERATION, preload_name, preload_type, input); PreloadVnfTopologyOperationInputBuilder inputBuilder = new PreloadVnfTopologyOperationInputBuilder(input); GenericResourceApiUtil.toProperties(parms, inputBuilder.build()); - log.info("Adding OPERATIONAL data for "+SVC_OPERATION+" ["+preload_name+","+preload_type +"] operational-data: " + operDataBuilder.build()); + log.info("Adding OPERATIONAL data for {} [{},{}] operational-data: {}", + SVC_OPERATION, preload_name, preload_type, operDataBuilder.build()); GenericResourceApiUtil.toProperties(parms, "operational-data", operDataBuilder); // Call SLI sync method @@ -1793,7 +1792,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC } catch (Exception e) { - log.error("Caught exception executing service logic for "+ SVC_OPERATION, e); + log.error("Caught exception executing service logic for {}", SVC_OPERATION, e); errorMessage = e.getMessage(); errorCode = "500"; } @@ -1828,11 +1827,13 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC preloadVnfListBuilder.setVnfName(preload_name); preloadVnfListBuilder.setVnfType(preload_type); preloadVnfListBuilder.setPreloadData(preloadDataBuilder.build()); - log.error("Returned FAILED for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] error code: '" + errorCode + "', Reason: '" + errorMessage + "'"); + log.error("Returned FAILED for {} [{},{}] error code: '{}', Reason: '{}'", + SVC_OPERATION, preload_name, preload_type, errorCode, errorMessage); try { - SavePreloadList (preloadVnfListBuilder.build(), true,LogicalDatastoreType.CONFIGURATION); + savePreloadList(preloadVnfListBuilder.build(), true, LogicalDatastoreType.CONFIGURATION); } catch (Exception e) { - log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] \n",e); + log.error("Caught Exception updating MD-SAL for {} [{},{}] \n", + SVC_OPERATION, preload_name, preload_type, e); } log.debug("Sending Success rpc result due to external error"); RpcResult<PreloadVnfTopologyOperationOutput> rpcResult = @@ -1843,7 +1844,8 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC // Got success from SLI try { preloadData = preloadDataBuilder.build(); - log.info("Updating MD-SAL for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] preloadData: " + preloadData); + log.info("Updating MD-SAL for {} [{},{}] preloadData: {}", + SVC_OPERATION, preload_name, preload_type, preloadData); // svc-configuration-list VnfPreloadListBuilder preloadVnfListBuilder = new VnfPreloadListBuilder(); preloadVnfListBuilder.setVnfName(preload_name); @@ -1851,15 +1853,17 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC preloadVnfListBuilder.setPreloadData(preloadData); // merge flag sets to false to allow it to be overwritten (not appended) - SavePreloadList (preloadVnfListBuilder.build(), false, LogicalDatastoreType.CONFIGURATION); + savePreloadList(preloadVnfListBuilder.build(), false, LogicalDatastoreType.CONFIGURATION); log.info("Updating OPERATIONAL tree."); - SavePreloadList (preloadVnfListBuilder.build(), false, LogicalDatastoreType.OPERATIONAL); + savePreloadList(preloadVnfListBuilder.build(), false, LogicalDatastoreType.OPERATIONAL); } catch (Exception e) { - log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] \n",e); + log.error("Caught Exception updating MD-SAL for {} [{},{}] \n", + SVC_OPERATION, preload_name, preload_type, e); responseBuilder.setResponseCode("500"); responseBuilder.setResponseMessage(e.toString()); responseBuilder.setAckFinalIndicator("Y"); - log.error("Returned FAILED for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] " + responseBuilder.build()); + log.error("Returned FAILED for {} [{},{}] {}", + SVC_OPERATION, preload_name, preload_type, responseBuilder.build()); RpcResult<PreloadVnfTopologyOperationOutput> rpcResult = RpcResultBuilder.<PreloadVnfTopologyOperationOutput> status(false).withResult(responseBuilder.build()).build(); return Futures.immediateFuture(rpcResult); @@ -1872,8 +1876,8 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC { responseBuilder.setResponseMessage(errorMessage); } - log.info("Updated MD-SAL for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] "); - log.info("Returned SUCCESS for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] " + responseBuilder.build()); + log.info("Updated MD-SAL for {} [{},{}]", SVC_OPERATION, preload_name, preload_type); + log.info("Returned SUCCESS for {} [{},{}] {}", SVC_OPERATION, preload_name, preload_type, responseBuilder.build()); RpcResult<PreloadVnfTopologyOperationOutput> rpcResult = RpcResultBuilder.<PreloadVnfTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); @@ -1886,10 +1890,10 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC PreloadNetworkTopologyOperationInput input) { final String SVC_OPERATION = "preload-network-topology-operation"; - PreloadData preloadData = null; + PreloadData preloadData; Properties parms = new Properties(); - log.info( SVC_OPERATION +" called." ); + log.info("{} called.", SVC_OPERATION); // create a new response object PreloadNetworkTopologyOperationOutputBuilder responseBuilder = new PreloadNetworkTopologyOperationOutputBuilder(); @@ -1899,7 +1903,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC if(input == null || input.getNetworkTopologyInformation() == null || input.getNetworkTopologyInformation().getNetworkTopologyIdentifier() == null) { - log.debug("exiting " +SVC_OPERATION+ " because of null input"); + log.debug("exiting {} because of null input", SVC_OPERATION); responseBuilder.setResponseCode("403"); responseBuilder.setResponseMessage("input is null"); responseBuilder.setAckFinalIndicator("Y"); @@ -1914,7 +1918,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC // Make sure we have a preload_name and preload_type if(preload_name == null || preload_name.length() == 0 || preload_type == null || preload_type.length() == 0 ) { - log.debug("exiting "+SVC_OPERATION+" because of invalid preload-name"); + log.debug("exiting {} because of invalid preload-name", SVC_OPERATION); responseBuilder.setResponseCode("403"); responseBuilder.setResponseMessage("input, invalid preload-name"); responseBuilder.setAckFinalIndicator("Y"); @@ -1949,10 +1953,11 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC // uses oper-status; - log.info("Adding INPUT data for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] input: " + input); + log.info("Adding INPUT data for {} [{},{}] input: {}", SVC_OPERATION, preload_name, preload_type, input); PreloadNetworkTopologyOperationInputBuilder inputBuilder = new PreloadNetworkTopologyOperationInputBuilder(input); GenericResourceApiUtil.toProperties(parms, inputBuilder.build()); - log.info("Adding OPERATIONAL data for "+SVC_OPERATION+" ["+preload_name+","+preload_type +"] operational-data: " + operDataBuilder.build()); + log.info("Adding OPERATIONAL data for {} [{},{}] operational-data: {}", + SVC_OPERATION, preload_name, preload_type, operDataBuilder.build()); GenericResourceApiUtil.toProperties(parms, "operational-data", operDataBuilder); // Call SLI sync method @@ -1977,7 +1982,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC } catch (Exception e) { - log.error("Caught exception executing service logic for "+ SVC_OPERATION, e); + log.error("Caught exception executing service logic for {}", SVC_OPERATION, e); errorMessage = e.getMessage(); errorCode = "500"; } @@ -2012,11 +2017,13 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC preloadVnfListBuilder.setVnfName(preload_name); preloadVnfListBuilder.setVnfType(preload_type); preloadVnfListBuilder.setPreloadData(preloadDataBuilder.build()); - log.error("Returned FAILED for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] error code: '" + errorCode + "', Reason: '" + errorMessage + "'"); + log.error("Returned FAILED for {} [{},{}] error code: '{}', Reason: '{}'", + SVC_OPERATION, preload_name, preload_type, errorCode, errorMessage); try { - SavePreloadList (preloadVnfListBuilder.build(),true,LogicalDatastoreType.CONFIGURATION); + savePreloadList(preloadVnfListBuilder.build(),true, LogicalDatastoreType.CONFIGURATION); } catch (Exception e) { - log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] \n",e); + log.error("Caught Exception updating MD-SAL for {} [{},{}] \n", + SVC_OPERATION, preload_name, preload_type, e); } log.debug("Sending Success rpc result due to external error"); @@ -2028,7 +2035,8 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC // Got success from SLI try { preloadData = preloadDataBuilder.build(); - log.info("Updating MD-SAL for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] preloadData: " + preloadData); + log.info("Updating MD-SAL for {} [{},{}] preloadData: {}", + SVC_OPERATION, preload_name, preload_type, preloadData); // svc-configuration-list VnfPreloadListBuilder preloadVnfListBuilder = new VnfPreloadListBuilder(); preloadVnfListBuilder.setVnfName(preload_name); @@ -2036,15 +2044,16 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC preloadVnfListBuilder.setPreloadData(preloadData); // merge flag sets to false to allow it to be overwritten (not appended) - SavePreloadList (preloadVnfListBuilder.build(), false, LogicalDatastoreType.CONFIGURATION); + savePreloadList(preloadVnfListBuilder.build(), false, LogicalDatastoreType.CONFIGURATION); log.info("Updating OPERATIONAL tree."); - SavePreloadList (preloadVnfListBuilder.build(), false, LogicalDatastoreType.OPERATIONAL); + savePreloadList(preloadVnfListBuilder.build(), false, LogicalDatastoreType.OPERATIONAL); } catch (Exception e) { log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] \n",e); responseBuilder.setResponseCode("500"); responseBuilder.setResponseMessage(e.toString()); responseBuilder.setAckFinalIndicator("Y"); - log.error("Returned FAILED for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] " + responseBuilder.build()); + log.error("Returned FAILED for {} [{},{}] {}", + SVC_OPERATION, preload_name, preload_type, responseBuilder.build()); RpcResult<PreloadNetworkTopologyOperationOutput> rpcResult = RpcResultBuilder.<PreloadNetworkTopologyOperationOutput> status(false).withResult(responseBuilder.build()).build(); return Futures.immediateFuture(rpcResult); @@ -2057,8 +2066,9 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC { responseBuilder.setResponseMessage(errorMessage); } - log.info("Updated MD-SAL for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] "); - log.info("Returned SUCCESS for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] " + responseBuilder.build()); + log.info("Updated MD-SAL for {} [{},{}]", SVC_OPERATION, preload_name, preload_type); + log.info("Returned SUCCESS for {} [{},{}] {}", + SVC_OPERATION, preload_name, preload_type, responseBuilder.build()); RpcResult<PreloadNetworkTopologyOperationOutput> rpcResult = RpcResultBuilder.<PreloadNetworkTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); |