From bf07cded9927ad1455d39b196da24bb7fba8fcd5 Mon Sep 17 00:00:00 2001 From: "pawel.kadlubanski" Date: Wed, 31 Jan 2018 11:48:57 +0100 Subject: Improve code metrics Change variable name identified by Sonar as issue in class vnfapiProvider fixes Change-Id: I98965aeb8f64e06d7e2f5d5ff7eca7a9f2ddd22f Issue-ID: SDNC-243 Signed-off-by: pawel.kadlubanski --- .../java/org/onap/sdnc/vnfapi/VnfApiProvider.java | 281 +++++++++++---------- 1 file changed, 141 insertions(+), 140 deletions(-) (limited to 'vnfapi/provider/src/main') diff --git a/vnfapi/provider/src/main/java/org/onap/sdnc/vnfapi/VnfApiProvider.java b/vnfapi/provider/src/main/java/org/onap/sdnc/vnfapi/VnfApiProvider.java index 18019724..bc0429d2 100644 --- a/vnfapi/provider/src/main/java/org/onap/sdnc/vnfapi/VnfApiProvider.java +++ b/vnfapi/provider/src/main/java/org/onap/sdnc/vnfapi/VnfApiProvider.java @@ -1433,8 +1433,8 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL // Grab the service instance ID from the input buffer String siid = input.getVnfRequestInformation().getVnfId(); - String preload_name = input.getVnfRequestInformation().getVnfName(); - String preload_type = input.getVnfRequestInformation().getVnfType(); + String preloadName = input.getVnfRequestInformation().getVnfName(); + String preloadType = input.getVnfRequestInformation().getVnfType(); if (input.getSdncRequestHeader() != null) { responseBuilder.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId()); @@ -1442,7 +1442,7 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL } PreloadDataBuilder preloadDataBuilder = new PreloadDataBuilder(); - getPreloadData(preload_name, preload_type, preloadDataBuilder); + getPreloadData(preloadName, preloadType, preloadDataBuilder); ServiceDataBuilder serviceDataBuilder = new ServiceDataBuilder(); getServiceData(siid, serviceDataBuilder); @@ -1476,7 +1476,7 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL VnfSdnUtil.toProperties(parms, "operational-data", operDataBuilder); log.info( - "Adding CONFIG data for " + SVC_OPERATION + " [" + preload_name + "," + preload_type + "] preload-data: " + "Adding CONFIG data for " + SVC_OPERATION + " [" + preloadName + "," + preloadType + "] preload-data: " + preloadDataBuilder.build()); VnfSdnUtil.toProperties(parms, "preload-data", preloadDataBuilder); @@ -1594,17 +1594,19 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL @Override public Future> networkTopologyOperation( NetworkTopologyOperationInput input) { - final String SVC_OPERATION = "network-topology-operation"; + final String svcOperation = "network-topology-operation"; + ServiceData serviceData; + ServiceStatusBuilder serviceStatusBuilder = new ServiceStatusBuilder(); Properties parms = new Properties(); - log.info(SVC_OPERATION + " called."); + log.info(svcOperation + " called."); // create a new response object NetworkTopologyOperationOutputBuilder responseBuilder = new NetworkTopologyOperationOutputBuilder(); if (input == null || input.getServiceInformation() == null || input.getServiceInformation().getServiceInstanceId() == null || input.getServiceInformation().getServiceInstanceId().length() == 0) { - log.debug("exiting " + SVC_OPERATION + " because of invalid input, null or empty service-instance-id"); + log.debug("exiting " + svcOperation + " because of invalid input, null or empty service-instance-id"); responseBuilder.setResponseCode("403"); responseBuilder.setResponseMessage("invalid input, null or empty service-instance-id"); responseBuilder.setAckFinalIndicator("Y"); @@ -1617,7 +1619,7 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL if (input.getNetworkRequestInformation() == null || input.getNetworkRequestInformation().getNetworkName() == null) { - log.debug("exiting " + SVC_OPERATION + " because of invalid input, null or empty service-instance-id"); + log.debug("exiting " + svcOperation + " because of invalid input, null or empty service-instance-id"); responseBuilder.setResponseCode("403"); responseBuilder.setResponseMessage("invalid input, null or empty service-instance-id"); responseBuilder.setAckFinalIndicator("Y"); @@ -1635,8 +1637,8 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL } else { siid = input.getNetworkRequestInformation().getNetworkId(); } - String preload_name = input.getNetworkRequestInformation().getNetworkName(); - String preload_type = input.getNetworkRequestInformation().getNetworkType(); + String preloadName = input.getNetworkRequestInformation().getNetworkName(); + String preloadType = input.getNetworkRequestInformation().getNetworkType(); if (input.getSdncRequestHeader() != null) { responseBuilder.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId()); @@ -1644,9 +1646,9 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL } PreloadDataBuilder preloadDataBuilder = new PreloadDataBuilder(); - getPreloadData(preload_name, preload_type, preloadDataBuilder); + getPreloadData(preloadName, preloadType, preloadDataBuilder); - log.info("Adding INPUT data for " + SVC_OPERATION + " [" + siid + "] input: " + input); + log.info("Adding INPUT data for " + svcOperation + " [" + siid + "] input: " + input); NetworkTopologyOperationInputBuilder inputBuilder = new NetworkTopologyOperationInputBuilder(input); VnfSdnUtil.toProperties(parms, inputBuilder.build()); @@ -1659,18 +1661,18 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL String networkId = "error"; try { - if (svcLogicClient.hasGraph("VNF-API", SVC_OPERATION, null, "sync")) { + if (svcLogicClient.hasGraph("VNF-API", svcOperation, null, "sync")) { try { respProps = - svcLogicClient.execute("VNF-API", SVC_OPERATION, null, "sync", preloadDataBuilder, parms); + svcLogicClient.execute("VNF-API", svcOperation, null, "sync", preloadDataBuilder, parms); } catch (Exception e) { - log.error("Caught exception executing service logic for " + SVC_OPERATION, e); + log.error("Caught exception executing service logic for " + svcOperation, e); errorMessage = e.getMessage(); errorCode = "500"; } } else { - errorMessage = "No service logic active for VNF-API: '" + SVC_OPERATION + "'"; + errorMessage = "No service logic active for VNF-API: '" + svcOperation + "'"; errorCode = "503"; } } catch (Exception e) { @@ -1691,7 +1693,7 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL responseBuilder.setResponseMessage(errorMessage); responseBuilder.setAckFinalIndicator(ackFinal); - log.error("Returned FAILED for " + SVC_OPERATION + " [" + siid + "] " + responseBuilder.build()); + log.error("Returned FAILED for " + svcOperation + " [" + siid + "] " + responseBuilder.build()); RpcResult rpcResult = RpcResultBuilder.status(true).withResult(responseBuilder.build()) @@ -1707,11 +1709,11 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL responseBuilder.setNetworkInformation(networkInformationBuilder.build()); responseBuilder.setServiceInformation(input.getServiceInformation()); } catch (IllegalStateException e) { - log.error("Caught Exception updating MD-SAL for " + SVC_OPERATION + " [" + siid + "] \n", e); + log.error("Caught Exception updating MD-SAL for " + svcOperation + " [" + siid + "] \n", 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 " + svcOperation + " [" + siid + "] " + responseBuilder.build()); RpcResult rpcResult = RpcResultBuilder.status(true).withResult(responseBuilder.build()) .build(); @@ -1725,8 +1727,8 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL if (errorMessage != null) { 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 " + svcOperation + " [" + siid + "] "); + log.info("Returned SUCCESS for " + svcOperation + " [" + siid + "] " + responseBuilder.build()); RpcResult rpcResult = RpcResultBuilder.status(true).withResult(responseBuilder.build()).build(); @@ -1737,11 +1739,11 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL @Override public Future> preloadVnfTopologyOperation( PreloadVnfTopologyOperationInput input) { - final String SVC_OPERATION = "preload-vnf-topology-operation"; + final String svcOperation = "preload-vnf-topology-operation"; PreloadData preloadData; Properties parms = new Properties(); - log.info(SVC_OPERATION + " called."); + log.info(svcOperation + " called."); // create a new response object PreloadVnfTopologyOperationOutputBuilder responseBuilder = new PreloadVnfTopologyOperationOutputBuilder(); @@ -1751,7 +1753,7 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL || input.getVnfTopologyInformation().getVnfTopologyIdentifier() == null || input.getVnfTopologyInformation().getVnfTopologyIdentifier().getVnfName() == null || input.getVnfTopologyInformation().getVnfTopologyIdentifier().getVnfType() == null) { - log.debug("exiting " + SVC_OPERATION + " because of invalid input, null or empty vnf-name or vnf-type"); + log.debug("exiting " + svcOperation + " because of invalid input, null or empty vnf-name or vnf-type"); responseBuilder.setResponseCode("403"); responseBuilder.setResponseMessage("invalid input, null or empty vnf-name or vnf-type"); responseBuilder.setAckFinalIndicator("Y"); @@ -1762,12 +1764,12 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL } // Grab the name and type from the input buffer - String preload_name = input.getVnfTopologyInformation().getVnfTopologyIdentifier().getVnfName(); - String preload_type = input.getVnfTopologyInformation().getVnfTopologyIdentifier().getVnfType(); + String preloadName = input.getVnfTopologyInformation().getVnfTopologyIdentifier().getVnfName(); + String preloadType = input.getVnfTopologyInformation().getVnfTopologyIdentifier().getVnfType(); - // Make sure we have a preload_name and preload_type - if (preload_name == null || preload_name.length() == 0) { - log.debug("exiting " + SVC_OPERATION + " because of invalid preload-name"); + // Make sure we have a preloadName and preloadType + if (preloadName == null || preloadName.length() == 0) { + log.debug("exiting " + svcOperation + " because of invalid preload-name"); responseBuilder.setResponseCode("403"); responseBuilder.setResponseMessage("invalid input, invalid preload-name"); responseBuilder.setAckFinalIndicator("Y"); @@ -1776,8 +1778,8 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL .build(); return Futures.immediateFuture(rpcResult); } - if (preload_type == null || preload_type.length() == 0) { - log.debug("exiting " + SVC_OPERATION + " because of invalid preload-type"); + if (preloadType == null || preloadType.length() == 0) { + log.debug("exiting " + svcOperation + " because of invalid preload-type"); responseBuilder.setResponseCode("403"); responseBuilder.setResponseMessage("invalid input, invalid preload-type"); responseBuilder.setAckFinalIndicator("Y"); @@ -1793,10 +1795,9 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL } PreloadDataBuilder preloadDataBuilder = new PreloadDataBuilder(); - getPreloadData(preload_name, preload_type, preloadDataBuilder); - + getPreloadData(preloadName, preloadType, preloadDataBuilder); PreloadDataBuilder operDataBuilder = new PreloadDataBuilder(); - getPreloadData(preload_name, preload_type, operDataBuilder, LogicalDatastoreType.OPERATIONAL); + getPreloadData(preloadName, preloadType, operDataBuilder, LogicalDatastoreType.OPERATIONAL); // // setup a preload-data object builder @@ -1808,10 +1809,10 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL // // container preload-data log.info( - "Adding INPUT data for " + SVC_OPERATION + " [" + preload_name + "," + preload_type + "] input: " + input); + "Adding INPUT data for " + svcOperation + " [" + preloadName + "," + preloadType + "] input: " + input); PreloadVnfTopologyOperationInputBuilder inputBuilder = new PreloadVnfTopologyOperationInputBuilder(input); VnfSdnUtil.toProperties(parms, inputBuilder.build()); - log.info("Adding OPERATIONAL data for " + SVC_OPERATION + " [" + preload_name + "," + preload_type + log.info("Adding OPERATIONAL data for " + svcOperation + " [" + preloadName + "," + preloadType + "] operational-data: " + operDataBuilder.build()); VnfSdnUtil.toProperties(parms, "operational-data", operDataBuilder); @@ -1823,18 +1824,18 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL String ackFinal = "Y"; try { - if (svcLogicClient.hasGraph("VNF-API", SVC_OPERATION, null, "sync")) { + if (svcLogicClient.hasGraph("VNF-API", svcOperation, null, "sync")) { try { respProps = - svcLogicClient.execute("VNF-API", SVC_OPERATION, null, "sync", preloadDataBuilder, parms); + svcLogicClient.execute("VNF-API", svcOperation, null, "sync", preloadDataBuilder, parms); } catch (Exception e) { - log.error("Caught exception executing service logic for " + SVC_OPERATION, e); + log.error("Caught exception executing service logic for " + svcOperation, e); errorMessage = e.getMessage(); errorCode = "500"; } } else { - errorMessage = "No service logic active for VNF-API: '" + SVC_OPERATION + "'"; + errorMessage = "No service logic active for VNF-API: '" + svcOperation + "'"; errorCode = "503"; } } catch (Exception e) { @@ -1856,17 +1857,17 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL responseBuilder.setAckFinalIndicator(ackFinal); VnfPreloadListBuilder preloadVnfListBuilder = new VnfPreloadListBuilder(); - preloadVnfListBuilder.setVnfName(preload_name); - preloadVnfListBuilder.setVnfType(preload_type); + preloadVnfListBuilder.setVnfName(preloadName); + preloadVnfListBuilder.setVnfType(preloadType); preloadVnfListBuilder.setPreloadData(preloadDataBuilder.build()); log.error( - "Returned FAILED for " + SVC_OPERATION + " [" + preload_name + "," + preload_type + "] error code: '" + "Returned FAILED for " + svcOperation + " [" + preloadName + "," + preloadType + "] error code: '" + errorCode + "', Reason: '" + errorMessage + "'"); try { savePreloadList(preloadVnfListBuilder.build(), true, LogicalDatastoreType.CONFIGURATION); } catch (Exception e) { log.error( - "Caught Exception updating MD-SAL for " + SVC_OPERATION + " [" + preload_name + "," + preload_type + "Caught Exception updating MD-SAL for " + svcOperation + " [" + preloadName + "," + preloadType + "] \n", e); } log.debug("Sending Success rpc result due to external error"); @@ -1880,12 +1881,12 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL try { preloadData = preloadDataBuilder.build(); log.info( - "Updating MD-SAL for " + SVC_OPERATION + " [" + preload_name + "," + preload_type + "] preloadData: " + "Updating MD-SAL for " + svcOperation + " [" + preloadName + "," + preloadType + "] preloadData: " + preloadData); // svc-configuration-list VnfPreloadListBuilder preloadVnfListBuilder = new VnfPreloadListBuilder(); - preloadVnfListBuilder.setVnfName(preload_name); - preloadVnfListBuilder.setVnfType(preload_type); + preloadVnfListBuilder.setVnfName(preloadName); + preloadVnfListBuilder.setVnfType(preloadType); preloadVnfListBuilder.setPreloadData(preloadData); // SDNGC-989 set merge flag to false @@ -1893,12 +1894,12 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL log.info("Updating OPERATIONAL tree."); savePreloadList(preloadVnfListBuilder.build(), false, LogicalDatastoreType.OPERATIONAL); } catch (Exception e) { - log.error("Caught Exception updating MD-SAL for " + SVC_OPERATION + " [" + preload_name + "," + preload_type + log.error("Caught Exception updating MD-SAL for " + svcOperation + " [" + preloadName + "," + preloadType + "] \n", e); responseBuilder.setResponseCode("500"); responseBuilder.setResponseMessage(e.toString()); responseBuilder.setAckFinalIndicator("Y"); - log.error("Returned FAILED for " + SVC_OPERATION + " [" + preload_name + "," + preload_type + "] " + log.error("Returned FAILED for " + svcOperation + " [" + preloadName + "," + preloadType + "] " + responseBuilder.build()); RpcResult rpcResult = RpcResultBuilder.status(false).withResult(responseBuilder.build()) @@ -1912,9 +1913,9 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL if (errorMessage != null) { responseBuilder.setResponseMessage(errorMessage); } - log.info("Updated MD-SAL for " + SVC_OPERATION + " [" + preload_name + "," + preload_type + "] "); + log.info("Updated MD-SAL for " + svcOperation + " [" + preloadName + "," + preloadType + "] "); log.info( - "Returned SUCCESS for " + SVC_OPERATION + " [" + preload_name + "," + preload_type + "] " + responseBuilder + "Returned SUCCESS for " + svcOperation + " [" + preloadName + "," + preloadType + "] " + responseBuilder .build()); RpcResult rpcResult = @@ -1927,11 +1928,11 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL @Override public Future> preloadVnfInstanceTopologyOperation( PreloadVnfInstanceTopologyOperationInput input) { - final String SVC_OPERATION = "preload-vnf-instance-topology-operation"; + final String svcOperation = "preload-vnf-instance-topology-operation"; VnfInstancePreloadData vnfInstancePreloadData; Properties parms = new Properties(); - log.info(SVC_OPERATION + " called."); + log.info(svcOperation + " called."); // create a new response object PreloadVnfInstanceTopologyOperationOutputBuilder responseBuilder = new PreloadVnfInstanceTopologyOperationOutputBuilder(); @@ -1940,7 +1941,7 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL if (input == null || input.getVnfInstanceTopologyInformation() == null || input.getVnfInstanceTopologyInformation().getVnfInstanceIdentifiers().getVnfInstanceName() == null || input.getVnfInstanceTopologyInformation().getVnfInstanceIdentifiers().getVnfModelId() == null) { - log.debug("exiting " + SVC_OPERATION + log.debug("exiting " + svcOperation + " because of invalid input, null or empty vnf-instance-name or vnf-model-id"); responseBuilder.setResponseCode("403"); responseBuilder.setResponseMessage("invalid input, null or empty vnf-instance-name or vnf-model-id"); @@ -1952,13 +1953,13 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL } // Grab the name and type from the input buffer - String preload_name = + String preloadName = input.getVnfInstanceTopologyInformation().getVnfInstanceIdentifiers().getVnfInstanceName(); - String preload_type = input.getVnfInstanceTopologyInformation().getVnfInstanceIdentifiers().getVnfModelId(); + String preloadType = input.getVnfInstanceTopologyInformation().getVnfInstanceIdentifiers().getVnfModelId(); - // Make sure we have a preload_name and preload_type - if (preload_name == null || preload_name.length() == 0) { - log.debug("exiting " + SVC_OPERATION + " because of invalid preload-name"); + // Make sure we have a preloadName and preloadType + if (preloadName == null || preloadName.length() == 0) { + log.debug("exiting " + svcOperation + " because of invalid preload-name"); responseBuilder.setResponseCode("403"); responseBuilder.setResponseMessage("invalid input, invalid preload-name"); responseBuilder.setAckFinalIndicator("Y"); @@ -1967,8 +1968,8 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL .withResult(responseBuilder.build()).build(); return Futures.immediateFuture(rpcResult); } - if (preload_type == null || preload_type.length() == 0) { - log.debug("exiting " + SVC_OPERATION + " because of invalid preload-type"); + if (preloadType == null || preloadType.length() == 0) { + log.debug("exiting " + svcOperation + " because of invalid preload-type"); responseBuilder.setResponseCode("403"); responseBuilder.setResponseMessage("invalid input, invalid preload-type"); responseBuilder.setAckFinalIndicator("Y"); @@ -1984,11 +1985,11 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL } VnfInstancePreloadDataBuilder vnfInstancePreloadDataBuilder = new VnfInstancePreloadDataBuilder(); - getVnfInstancePreloadData(preload_name, preload_type, vnfInstancePreloadDataBuilder); - + getVnfInstancePreloadData(preloadName, preloadType, vnfInstancePreloadDataBuilder); + //preloadData = preloadDataBuilder.build(); VnfInstancePreloadDataBuilder operDataBuilder = new VnfInstancePreloadDataBuilder(); - getVnfInstancePreloadData(preload_name, preload_type, operDataBuilder, LogicalDatastoreType.OPERATIONAL); + getVnfInstancePreloadData(preloadName, preloadType, operDataBuilder, LogicalDatastoreType.OPERATIONAL); // // setup a preload-data object builder @@ -1998,11 +1999,11 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL // OUTPUT: // container preload-data log.info( - "Adding INPUT data for " + SVC_OPERATION + " [" + preload_name + "," + preload_type + "] input: " + input); + "Adding INPUT data for " + svcOperation + " [" + preloadName + "," + preloadType + "] input: " + input); PreloadVnfInstanceTopologyOperationInputBuilder inputBuilder = new PreloadVnfInstanceTopologyOperationInputBuilder(input); VnfSdnUtil.toProperties(parms, inputBuilder.build()); - log.info("Adding OPERATIONAL data for " + SVC_OPERATION + " [" + preload_name + "," + preload_type + log.info("Adding OPERATIONAL data for " + svcOperation + " [" + preloadName + "," + preloadType + "] operational-data: " + operDataBuilder.build()); VnfSdnUtil.toProperties(parms, "operational-data", operDataBuilder); @@ -2014,18 +2015,18 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL String ackFinal = "Y"; try { - if (svcLogicClient.hasGraph("VNF-API", SVC_OPERATION, null, "sync")) { + if (svcLogicClient.hasGraph("VNF-API", svcOperation, null, "sync")) { try { respProps = svcLogicClient - .execute("VNF-API", SVC_OPERATION, null, "sync", vnfInstancePreloadDataBuilder, parms); + .execute("VNF-API", svcOperation, null, "sync", vnfInstancePreloadDataBuilder, parms); } catch (Exception e) { - log.error("Caught exception executing service logic for " + SVC_OPERATION, e); + log.error("Caught exception executing service logic for " + svcOperation, e); errorMessage = e.getMessage(); errorCode = "500"; } } else { - errorMessage = "No service logic active for VNF-API: '" + SVC_OPERATION + "'"; + errorMessage = "No service logic active for VNF-API: '" + svcOperation + "'"; errorCode = "503"; } } catch (Exception e) { @@ -2047,18 +2048,18 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL responseBuilder.setAckFinalIndicator(ackFinal); VnfInstancePreloadListBuilder vnfInstancePreloadListBuilder = new VnfInstancePreloadListBuilder(); - vnfInstancePreloadListBuilder.setVnfInstanceName(preload_name); - vnfInstancePreloadListBuilder.setVnfModelId(preload_type); + vnfInstancePreloadListBuilder.setVnfInstanceName(preloadName); + vnfInstancePreloadListBuilder.setVnfModelId(preloadType); vnfInstancePreloadListBuilder.setVnfInstancePreloadData(vnfInstancePreloadDataBuilder.build()); log.error( - "Returned FAILED for " + SVC_OPERATION + " [" + preload_name + "," + preload_type + "] error code: '" + "Returned FAILED for " + svcOperation + " [" + preloadName + "," + preloadType + "] error code: '" + errorCode + "', Reason: '" + errorMessage + "'"); try { saveVnfInstancePreloadList(vnfInstancePreloadListBuilder.build(), true, LogicalDatastoreType.CONFIGURATION); } catch (Exception e) { log.error( - "Caught Exception updating MD-SAL for " + SVC_OPERATION + " [" + preload_name + "," + preload_type + "Caught Exception updating MD-SAL for " + svcOperation + " [" + preloadName + "," + preloadType + "] \n", e); } log.debug("Sending Success rpc result due to external error"); @@ -2072,12 +2073,12 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL try { vnfInstancePreloadData = vnfInstancePreloadDataBuilder.build(); log.info( - "Updating MD-SAL for " + SVC_OPERATION + " [" + preload_name + "," + preload_type + "] preloadData: " + "Updating MD-SAL for " + svcOperation + " [" + preloadName + "," + preloadType + "] preloadData: " + vnfInstancePreloadData); // svc-configuration-list VnfInstancePreloadListBuilder vnfInstancePreloadListBuilder = new VnfInstancePreloadListBuilder(); - vnfInstancePreloadListBuilder.setVnfInstanceName(preload_name); - vnfInstancePreloadListBuilder.setVnfModelId(preload_type); + vnfInstancePreloadListBuilder.setVnfInstanceName(preloadName); + vnfInstancePreloadListBuilder.setVnfModelId(preloadType); vnfInstancePreloadListBuilder.setVnfInstancePreloadData(vnfInstancePreloadData); // SDNGC-989 set merge flag to false @@ -2086,12 +2087,12 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL log.info("Updating OPERATIONAL tree."); saveVnfInstancePreloadList(vnfInstancePreloadListBuilder.build(), false, LogicalDatastoreType.OPERATIONAL); } catch (Exception e) { - log.error("Caught Exception updating MD-SAL for " + SVC_OPERATION + " [" + preload_name + "," + preload_type + log.error("Caught Exception updating MD-SAL for " + svcOperation + " [" + preloadName + "," + preloadType + "] \n", e); responseBuilder.setResponseCode("500"); responseBuilder.setResponseMessage(e.toString()); responseBuilder.setAckFinalIndicator("Y"); - log.error("Returned FAILED for " + SVC_OPERATION + " [" + preload_name + "," + preload_type + "] " + log.error("Returned FAILED for " + svcOperation + " [" + preloadName + "," + preloadType + "] " + responseBuilder.build()); RpcResult rpcResult = RpcResultBuilder.status(false) @@ -2105,9 +2106,9 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL if (errorMessage != null) { responseBuilder.setResponseMessage(errorMessage); } - log.info("Updated MD-SAL for " + SVC_OPERATION + " [" + preload_name + "," + preload_type + "] "); + log.info("Updated MD-SAL for " + svcOperation + " [" + preloadName + "," + preloadType + "] "); log.info( - "Returned SUCCESS for " + SVC_OPERATION + " [" + preload_name + "," + preload_type + "] " + responseBuilder + "Returned SUCCESS for " + svcOperation + " [" + preloadName + "," + preloadType + "] " + responseBuilder .build()); RpcResult rpcResult = @@ -2121,11 +2122,11 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL @Override public Future> preloadVfModuleTopologyOperation( PreloadVfModuleTopologyOperationInput input) { - final String SVC_OPERATION = "preload-vf-module-topology-operation"; + final String svcOperation = "preload-vf-module-topology-operation"; VfModulePreloadData vfModulePreloadData; Properties parms = new Properties(); - log.info(SVC_OPERATION + " called."); + log.info(svcOperation + " called."); // create a new response object PreloadVfModuleTopologyOperationOutputBuilder responseBuilder = new PreloadVfModuleTopologyOperationOutputBuilder(); @@ -2135,7 +2136,7 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL if (input == null || input.getVfModuleTopologyInformation() == null || input.getVfModuleTopologyInformation().getVfModuleIdentifiers().getVfModuleName() == null || input.getVfModuleTopologyInformation().getVfModuleIdentifiers().getVfModuleModelId() == null) { - log.debug("exiting " + SVC_OPERATION + log.debug("exiting " + svcOperation + " because of invalid input, null or empty vf-module-name or vf-module-model-id"); responseBuilder.setResponseCode("403"); responseBuilder.setResponseMessage("invalid input, null or empty vf-module-name or vf-module-model-id"); @@ -2147,12 +2148,12 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL } // Grab the name and type from the input buffer - String preload_name = input.getVfModuleTopologyInformation().getVfModuleIdentifiers().getVfModuleName(); - String preload_type = input.getVfModuleTopologyInformation().getVfModuleIdentifiers().getVfModuleModelId(); + String preloadName = input.getVfModuleTopologyInformation().getVfModuleIdentifiers().getVfModuleName(); + String preloadType = input.getVfModuleTopologyInformation().getVfModuleIdentifiers().getVfModuleModelId(); - // Make sure we have a preload_name and preload_type - if (preload_name == null || preload_name.length() == 0) { - log.debug("exiting " + SVC_OPERATION + " because of invalid preload-name"); + // Make sure we have a preloadName and preloadType + if (preloadName == null || preloadName.length() == 0) { + log.debug("exiting " + svcOperation + " because of invalid preload-name"); responseBuilder.setResponseCode("403"); responseBuilder.setResponseMessage("invalid input, invalid preload-name"); responseBuilder.setAckFinalIndicator("Y"); @@ -2161,8 +2162,8 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL .withResult(responseBuilder.build()).build(); return Futures.immediateFuture(rpcResult); } - if (preload_type == null || preload_type.length() == 0) { - log.debug("exiting " + SVC_OPERATION + " because of invalid preload-type"); + if (preloadType == null || preloadType.length() == 0) { + log.debug("exiting " + svcOperation + " because of invalid preload-type"); responseBuilder.setResponseCode("403"); responseBuilder.setResponseMessage("invalid input, invalid preload-type"); responseBuilder.setAckFinalIndicator("Y"); @@ -2178,10 +2179,10 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL } VfModulePreloadDataBuilder vfModulePreloadDataBuilder = new VfModulePreloadDataBuilder(); - getVfModulePreloadData(preload_name, preload_type, vfModulePreloadDataBuilder); + getVfModulePreloadData(preloadName, preloadType, vfModulePreloadDataBuilder); VfModulePreloadDataBuilder operDataBuilder = new VfModulePreloadDataBuilder(); - getVfModulePreloadData(preload_name, preload_type, operDataBuilder, LogicalDatastoreType.OPERATIONAL); + getVfModulePreloadData(preloadName, preloadType, operDataBuilder, LogicalDatastoreType.OPERATIONAL); // // setup a preload-data object builder @@ -2194,11 +2195,11 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL // container preload-data log.info( - "Adding INPUT data for " + SVC_OPERATION + " [" + preload_name + "," + preload_type + "] input: " + input); + "Adding INPUT data for " + svcOperation + " [" + preloadName + "," + preloadType + "] input: " + input); PreloadVfModuleTopologyOperationInputBuilder inputBuilder = new PreloadVfModuleTopologyOperationInputBuilder(input); VnfSdnUtil.toProperties(parms, inputBuilder.build()); - log.info("Adding OPERATIONAL data for " + SVC_OPERATION + " [" + preload_name + "," + preload_type + log.info("Adding OPERATIONAL data for " + svcOperation + " [" + preloadName + "," + preloadType + "] operational-data: " + operDataBuilder.build()); VnfSdnUtil.toProperties(parms, "operational-data", operDataBuilder); @@ -2210,17 +2211,17 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL String ackFinal = "Y"; try { - if (svcLogicClient.hasGraph("VNF-API", SVC_OPERATION, null, "sync")) { + if (svcLogicClient.hasGraph("VNF-API", svcOperation, null, "sync")) { try { respProps = svcLogicClient - .execute("VNF-API", SVC_OPERATION, null, "sync", vfModulePreloadDataBuilder, parms); + .execute("VNF-API", svcOperation, null, "sync", vfModulePreloadDataBuilder, parms); } catch (Exception e) { - log.error("Caught exception executing service logic for " + SVC_OPERATION, e); + log.error("Caught exception executing service logic for " + svcOperation, e); errorMessage = e.getMessage(); errorCode = "500"; } } else { - errorMessage = "No service logic active for VNF-API: '" + SVC_OPERATION + "'"; + errorMessage = "No service logic active for VNF-API: '" + svcOperation + "'"; errorCode = "503"; } } catch (Exception e) { @@ -2242,17 +2243,17 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL responseBuilder.setAckFinalIndicator(ackFinal); VfModulePreloadListBuilder vfModulePreloadListBuilder = new VfModulePreloadListBuilder(); - vfModulePreloadListBuilder.setVfModuleName(preload_name); - vfModulePreloadListBuilder.setVfModuleModelId(preload_type); + vfModulePreloadListBuilder.setVfModuleName(preloadName); + vfModulePreloadListBuilder.setVfModuleModelId(preloadType); vfModulePreloadListBuilder.setVfModulePreloadData(vfModulePreloadDataBuilder.build()); log.error( - "Returned FAILED for " + SVC_OPERATION + " [" + preload_name + "," + preload_type + "] error code: '" + "Returned FAILED for " + svcOperation + " [" + preloadName + "," + preloadType + "] error code: '" + errorCode + "', Reason: '" + errorMessage + "'"); try { saveVfModulePreloadList(vfModulePreloadListBuilder.build(), true, LogicalDatastoreType.CONFIGURATION); } catch (Exception e) { log.error( - "Caught Exception updating MD-SAL for " + SVC_OPERATION + " [" + preload_name + "," + preload_type + "Caught Exception updating MD-SAL for " + svcOperation + " [" + preloadName + "," + preloadType + "] \n", e); } log.debug("Sending Success rpc result due to external error"); @@ -2266,12 +2267,12 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL try { vfModulePreloadData = vfModulePreloadDataBuilder.build(); log.info( - "Updating MD-SAL for " + SVC_OPERATION + " [" + preload_name + "," + preload_type + "] preloadData: " + "Updating MD-SAL for " + svcOperation + " [" + preloadName + "," + preloadType + "] preloadData: " + vfModulePreloadData); // svc-configuration-list VfModulePreloadListBuilder vfModulePreloadListBuilder = new VfModulePreloadListBuilder(); - vfModulePreloadListBuilder.setVfModuleName(preload_name); - vfModulePreloadListBuilder.setVfModuleModelId(preload_type); + vfModulePreloadListBuilder.setVfModuleName(preloadName); + vfModulePreloadListBuilder.setVfModuleModelId(preloadType); vfModulePreloadListBuilder.setVfModulePreloadData(vfModulePreloadData); // SDNGC-989 set merge flag to false @@ -2279,12 +2280,12 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL log.info("Updating OPERATIONAL tree."); saveVfModulePreloadList(vfModulePreloadListBuilder.build(), false, LogicalDatastoreType.OPERATIONAL); } catch (Exception e) { - log.error("Caught Exception updating MD-SAL for " + SVC_OPERATION + " [" + preload_name + "," + preload_type + log.error("Caught Exception updating MD-SAL for " + svcOperation + " [" + preloadName + "," + preloadType + "] \n", e); responseBuilder.setResponseCode("500"); responseBuilder.setResponseMessage(e.toString()); responseBuilder.setAckFinalIndicator("Y"); - log.error("Returned FAILED for " + SVC_OPERATION + " [" + preload_name + "," + preload_type + "] " + log.error("Returned FAILED for " + svcOperation + " [" + preloadName + "," + preloadType + "] " + responseBuilder.build()); RpcResult rpcResult = RpcResultBuilder.status(false) @@ -2298,9 +2299,9 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL if (errorMessage != null) { responseBuilder.setResponseMessage(errorMessage); } - log.info("Updated MD-SAL for " + SVC_OPERATION + " [" + preload_name + "," + preload_type + "] "); + log.info("Updated MD-SAL for " + svcOperation + " [" + preloadName + "," + preloadType + "] "); log.info( - "Returned SUCCESS for " + SVC_OPERATION + " [" + preload_name + "," + preload_type + "] " + responseBuilder + "Returned SUCCESS for " + svcOperation + " [" + preloadName + "," + preloadType + "] " + responseBuilder .build()); RpcResult rpcResult = @@ -2313,11 +2314,11 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL @Override public Future> preloadNetworkTopologyOperation( PreloadNetworkTopologyOperationInput input) { - final String SVC_OPERATION = "preload-network-topology-operation"; - PreloadData preloadData; + final String svcOperation = "preload-network-topology-operation"; + PreloadData preloadData = null; Properties parms = new Properties(); - log.info(SVC_OPERATION + " called."); + log.info(svcOperation + " called."); // create a new response object PreloadNetworkTopologyOperationOutputBuilder responseBuilder = new PreloadNetworkTopologyOperationOutputBuilder(); @@ -2328,7 +2329,7 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL || input.getNetworkTopologyInformation().getNetworkTopologyIdentifier() == null || input.getNetworkTopologyInformation().getNetworkTopologyIdentifier().getNetworkName() == null || input.getNetworkTopologyInformation().getNetworkTopologyIdentifier().getNetworkType() == null) { - log.debug("exiting " + SVC_OPERATION + " because of invalid input, null or" + + log.debug("exiting " + svcOperation + " because of invalid input, null or" + " empty network-name or network-type"); responseBuilder.setResponseCode("403"); responseBuilder.setResponseMessage("input, null or empty network-name or network-type"); @@ -2340,12 +2341,12 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL } // Grab the name and type from the input buffer - String preload_name = input.getNetworkTopologyInformation().getNetworkTopologyIdentifier().getNetworkName(); - String preload_type = input.getNetworkTopologyInformation().getNetworkTopologyIdentifier().getNetworkType(); + String preloadName = input.getNetworkTopologyInformation().getNetworkTopologyIdentifier().getNetworkName(); + String preloadType = input.getNetworkTopologyInformation().getNetworkTopologyIdentifier().getNetworkType(); - // Make sure we have a preload_name and preload_type - if (preload_name == null || preload_name.length() == 0) { - log.debug("exiting " + SVC_OPERATION + " because of invalid preload-name"); + // Make sure we have a preloadName and preloadType + if (preloadName == null || preloadName.length() == 0) { + log.debug("exiting " + svcOperation + " because of invalid preload-name"); responseBuilder.setResponseCode("403"); responseBuilder.setResponseMessage("input, invalid preload-name"); responseBuilder.setAckFinalIndicator("Y"); @@ -2355,8 +2356,8 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL return Futures.immediateFuture(rpcResult); } - if (preload_type == null || preload_type.length() == 0) { - log.debug("exiting " + SVC_OPERATION + " because of invalid preload-type"); + if (preloadType == null || preloadType.length() == 0) { + log.debug("exiting " + svcOperation + " because of invalid preload-type"); responseBuilder.setResponseCode("403"); responseBuilder.setResponseMessage("input, invalid preload-type"); responseBuilder.setAckFinalIndicator("Y"); @@ -2372,10 +2373,10 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL } PreloadDataBuilder preloadDataBuilder = new PreloadDataBuilder(); - getPreloadData(preload_name, preload_type, preloadDataBuilder); + getPreloadData(preloadName, preloadType, preloadDataBuilder); PreloadDataBuilder operDataBuilder = new PreloadDataBuilder(); - getPreloadData(preload_name, preload_type, operDataBuilder, LogicalDatastoreType.OPERATIONAL); + getPreloadData(preloadName, preloadType, operDataBuilder, LogicalDatastoreType.OPERATIONAL); // // setup a preload-data object builder @@ -2387,11 +2388,11 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL // // container preload-data log.info( - "Adding INPUT data for " + SVC_OPERATION + " [" + preload_name + "," + preload_type + "] input: " + input); + "Adding INPUT data for " + svcOperation + " [" + preloadName + "," + preloadType + "] input: " + input); PreloadNetworkTopologyOperationInputBuilder inputBuilder = new PreloadNetworkTopologyOperationInputBuilder(input); VnfSdnUtil.toProperties(parms, inputBuilder.build()); - log.info("Adding OPERATIONAL data for " + SVC_OPERATION + " [" + preload_name + "," + preload_type + log.info("Adding OPERATIONAL data for " + svcOperation + " [" + preloadName + "," + preloadType + "] operational-data: " + operDataBuilder.build()); VnfSdnUtil.toProperties(parms, "operational-data", operDataBuilder); @@ -2403,17 +2404,17 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL String ackFinal = "Y"; try { - if (svcLogicClient.hasGraph("VNF-API", SVC_OPERATION, null, "sync")) { + if (svcLogicClient.hasGraph("VNF-API", svcOperation, null, "sync")) { try { respProps = - svcLogicClient.execute("VNF-API", SVC_OPERATION, null, "sync", preloadDataBuilder, parms); + svcLogicClient.execute("VNF-API", svcOperation, null, "sync", preloadDataBuilder, parms); } catch (Exception e) { - log.error("Caught exception executing service logic for " + SVC_OPERATION, e); + log.error("Caught exception executing service logic for " + svcOperation, e); errorMessage = e.getMessage(); errorCode = "500"; } } else { - errorMessage = "No service logic active for VNF-API: '" + SVC_OPERATION + "'"; + errorMessage = "No service logic active for VNF-API: '" + svcOperation + "'"; errorCode = "503"; } } catch (Exception e) { @@ -2435,17 +2436,17 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL responseBuilder.setAckFinalIndicator(ackFinal); VnfPreloadListBuilder preloadVnfListBuilder = new VnfPreloadListBuilder(); - preloadVnfListBuilder.setVnfName(preload_name); - preloadVnfListBuilder.setVnfType(preload_type); + preloadVnfListBuilder.setVnfName(preloadName); + preloadVnfListBuilder.setVnfType(preloadType); preloadVnfListBuilder.setPreloadData(preloadDataBuilder.build()); log.error( - "Returned FAILED for " + SVC_OPERATION + " [" + preload_name + "," + preload_type + "] error code: '" + "Returned FAILED for " + svcOperation + " [" + preloadName + "," + preloadType + "] error code: '" + errorCode + "', Reason: '" + errorMessage + "'"); try { savePreloadList(preloadVnfListBuilder.build(), true, LogicalDatastoreType.CONFIGURATION); } catch (Exception e) { log.error( - "Caught Exception updating MD-SAL for " + SVC_OPERATION + " [" + preload_name + "," + preload_type + "Caught Exception updating MD-SAL for " + svcOperation + " [" + preloadName + "," + preloadType + "] \n", e); } @@ -2460,12 +2461,12 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL try { preloadData = preloadDataBuilder.build(); log.info( - "Updating MD-SAL for " + SVC_OPERATION + " [" + preload_name + "," + preload_type + "] preloadData: " + "Updating MD-SAL for " + svcOperation + " [" + preloadName + "," + preloadType + "] preloadData: " + preloadData); // svc-configuration-list VnfPreloadListBuilder preloadVnfListBuilder = new VnfPreloadListBuilder(); - preloadVnfListBuilder.setVnfName(preload_name); - preloadVnfListBuilder.setVnfType(preload_type); + preloadVnfListBuilder.setVnfName(preloadName); + preloadVnfListBuilder.setVnfType(preloadType); preloadVnfListBuilder.setPreloadData(preloadData); // SDNGC-989 set merge flag to false @@ -2473,12 +2474,12 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL log.info("Updating OPERATIONAL tree."); savePreloadList(preloadVnfListBuilder.build(), false, LogicalDatastoreType.OPERATIONAL); } catch (Exception e) { - log.error("Caught Exception updating MD-SAL for " + SVC_OPERATION + " [" + preload_name + "," + preload_type + log.error("Caught Exception updating MD-SAL for " + svcOperation + " [" + preloadName + "," + preloadType + "] \n", e); responseBuilder.setResponseCode("500"); responseBuilder.setResponseMessage(e.toString()); responseBuilder.setAckFinalIndicator("Y"); - log.error("Returned FAILED for " + SVC_OPERATION + " [" + preload_name + "," + preload_type + "] " + log.error("Returned FAILED for " + svcOperation + " [" + preloadName + "," + preloadType + "] " + responseBuilder.build()); RpcResult rpcResult = RpcResultBuilder.status(false) @@ -2492,9 +2493,9 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL if (errorMessage != null) { responseBuilder.setResponseMessage(errorMessage); } - log.info("Updated MD-SAL for " + SVC_OPERATION + " [" + preload_name + "," + preload_type + "] "); + log.info("Updated MD-SAL for " + svcOperation + " [" + preloadName + "," + preloadType + "] "); log.info( - "Returned SUCCESS for " + SVC_OPERATION + " [" + preload_name + "," + preload_type + "] " + responseBuilder + "Returned SUCCESS for " + svcOperation + " [" + preloadName + "," + preloadType + "] " + responseBuilder .build()); RpcResult rpcResult = -- cgit 1.2.3-korg