aboutsummaryrefslogtreecommitdiffstats
path: root/vnfapi/provider/src
diff options
context:
space:
mode:
authorJakub Dudycz <jakub.dudycz@nokia.com>2018-02-06 13:25:19 +0100
committerJakub Dudycz <jakub.dudycz@nokia.com>2018-02-06 13:25:19 +0100
commit6fdae97679ca410c4923fa7b8a97fb02190233f4 (patch)
tree00812fa2656cde169ecf40ee36c56599d658235b /vnfapi/provider/src
parentbf07cded9927ad1455d39b196da24bb7fba8fcd5 (diff)
Fixed some sonar minors in VnfApiProvider
Change-Id: Ia9ed74f4c5dfab36c083b887191d9acca817eec8 Issue-ID: SDNC-247 Signed-off-by: Jakub Dudycz <jakub.dudycz@nokia.com>
Diffstat (limited to 'vnfapi/provider/src')
-rw-r--r--vnfapi/provider/src/main/java/org/onap/sdnc/vnfapi/VnfApiProvider.java318
1 files changed, 157 insertions, 161 deletions
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 bc0429d2..bfec080c 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
@@ -24,7 +24,6 @@ package org.onap.sdnc.vnfapi;
import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.SettableFuture;
import com.google.common.base.Optional;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.DataChangeListener;
@@ -160,7 +159,6 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
private static final String APP_NAME = "vnfapi";
private static final String VNF_API = "VNF-API";
private static final String OPERATIONAL_DATA = "operational-data";
- private static final String SVC_OPERATION = "vf-module-topology-operation";
private static final String READ_MD_SAL_STR = "Read MD-SAL (";
private static final String DATA_FOR_STR = ") data for [";
@@ -185,7 +183,6 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
private static final String INVALID_INPUT_VNF_INSTANCE_STR = "invalid input, null or empty vnf-instance-id";
private VNFSDNSvcLogicServiceClient svcLogicClient;
-
protected DataBroker dataBroker;
protected NotificationPublishService notificationService;
protected RpcProviderRegistry rpcRegistry;
@@ -616,8 +613,7 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
}
if (data.isPresent()) {
- VnfInstanceServiceData vnfInstanceServiceData =
- (VnfInstanceServiceData) data.get().getVnfInstanceServiceData();
+ VnfInstanceServiceData vnfInstanceServiceData = data.get().getVnfInstanceServiceData();
if (vnfInstanceServiceData != null) {
log.info(READ_MD_SAL_STR + type + DATA_FOR_STR + siid + "] VnfInstanceServiceData: "
+ vnfInstanceServiceData);
@@ -812,7 +808,6 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
.child(VnfList.class, entry.getKey())
.build();
-
int optimisticLockTries = 2;
boolean tryAgain = true;
while (tryAgain) {
@@ -861,7 +856,6 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
.child(VnfInstanceList.class, entry.getKey())
.build();
-
tryUpdateDataStore(entry, merge, storeType, path);
}
@@ -913,7 +907,7 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
tryUpdateDataStore(entry, merge, storeType, path);
}
- private <T extends DataObject> void tryUpdateDataStore(T entry, boolean merge, LogicalDatastoreType storeType,
+ private <T extends DataObject> void tryUpdateDataStore(T entry, boolean merge, LogicalDatastoreType storeType,
InstanceIdentifier<T> path) {
int tries = 2;
@@ -951,17 +945,18 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
public Future<RpcResult<VnfInstanceTopologyOperationOutput>> vnfInstanceTopologyOperation(
VnfInstanceTopologyOperationInput input) {
+ final String svcOperation = "vnf-instance-topology-operation";
VnfInstanceServiceData vnfInstanceServiceData;
ServiceStatusBuilder serviceStatusBuilder = new ServiceStatusBuilder();
Properties parms = new Properties();
- log.info(SVC_OPERATION + CALLED_STR);
+ log.info(svcOperation + CALLED_STR);
// create a new response object
VnfInstanceTopologyOperationOutputBuilder responseBuilder = new VnfInstanceTopologyOperationOutputBuilder();
if (input == null || input.getVnfInstanceRequestInformation() == null
|| input.getVnfInstanceRequestInformation().getVnfInstanceId() == null) {
- log.debug(EXITING_STR + SVC_OPERATION + " because of " + INVALID_INPUT_VNF_INSTANCE_STR);
+ log.debug(EXITING_STR + svcOperation + " because of " + INVALID_INPUT_VNF_INSTANCE_STR);
responseBuilder.setResponseCode("403");
responseBuilder.setResponseMessage(INVALID_INPUT_VNF_INSTANCE_STR);
responseBuilder.setAckFinalIndicator("Y");
@@ -980,7 +975,7 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
// Make sure we have a valid viid
if (viid == null || viid.length() == 0) {
- log.debug(EXITING_STR + SVC_OPERATION + " because of invalid vnf-instance-id");
+ log.debug(EXITING_STR + svcOperation + " because of invalid vnf-instance-id");
responseBuilder.setResponseCode("403");
responseBuilder.setResponseMessage(INVALID_INPUT_VNF_INSTANCE_STR);
responseBuilder.setAckFinalIndicator("Y");
@@ -1015,7 +1010,7 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
//
// setup a service-data object builder
- // ACTION vnf-topology-operation
+ // ACTION vnf-topology-operationa
// INPUT:
// USES sdnc-request-header;
// USES request-information;
@@ -1030,16 +1025,16 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
// uses vnf-configuration-information;
// uses oper-status;
- log.info(ADDING_INPUT_DATA_STR + SVC_OPERATION + " [" + viid + INPUT_STR + input);
+ log.info(ADDING_INPUT_DATA_STR + svcOperation + " [" + viid + INPUT_STR + input);
VnfInstanceTopologyOperationInputBuilder inputBuilder = new VnfInstanceTopologyOperationInputBuilder(input);
VnfSdnUtil.toProperties(parms, inputBuilder.build());
- log.info(ADDING_OPERATIONAL_DATA_STR + SVC_OPERATION + " [" + viid + OPERATIONAL_DATA_STR + operDataBuilder
+ log.info(ADDING_OPERATIONAL_DATA_STR + svcOperation + " [" + viid + OPERATIONAL_DATA_STR + operDataBuilder
.build());
VnfSdnUtil.toProperties(parms, OPERATIONAL_DATA, operDataBuilder);
log.info(
- ADDING_CONFIG_DATA_STR + SVC_OPERATION + " [" + preloadName + "," + preloadType + "] preload-data: "
+ ADDING_CONFIG_DATA_STR + svcOperation + " [" + preloadName + "," + preloadType + "] preload-data: "
+ vnfInstancePreloadDataBuilder.build());
VnfSdnUtil.toProperties(parms, "vnf-instance-preload-data", vnfInstancePreloadDataBuilder);
@@ -1051,18 +1046,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", vnfInstanceServiceDataBuilder, parms);
+ .execute(VNF_API, svcOperation, null, "sync", vnfInstanceServiceDataBuilder, 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) {
@@ -1091,9 +1086,9 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
try {
saveVnfInstanceList(vnfInstanceListBuilder.build(), true, LogicalDatastoreType.CONFIGURATION);
} catch (Exception e) {
- log.error(CAUGHT_EXCEPTION_STR + SVC_OPERATION + " [" + viid + "] \n", e);
+ log.error(CAUGHT_EXCEPTION_STR + svcOperation + " [" + viid + "] \n", e);
}
- log.error(RETURNED_FAILED_STR + SVC_OPERATION + " [" + viid + "] " + responseBuilder.build());
+ log.error(RETURNED_FAILED_STR + svcOperation + " [" + viid + "] " + responseBuilder.build());
RpcResult<VnfInstanceTopologyOperationOutput> rpcResult = RpcResultBuilder
.<VnfInstanceTopologyOperationOutput>status(true)
.withResult(responseBuilder.build())
@@ -1105,13 +1100,12 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
// Got success from SLI
try {
vnfInstanceServiceData = vnfInstanceServiceDataBuilder.build();
- log.info(UPDATING_MD_SAL_STR + SVC_OPERATION + " [" + viid + "] VnfInstanceServiceData: "
+ log.info(UPDATING_MD_SAL_STR + svcOperation + " [" + viid + "] VnfInstanceServiceData: "
+ vnfInstanceServiceData);
// svc-configuration-list
VnfInstanceListBuilder vnfInstanceListBuilder = new VnfInstanceListBuilder();
vnfInstanceListBuilder.setVnfInstanceServiceData(vnfInstanceServiceData);
vnfInstanceListBuilder.setVnfInstanceId(vnfInstanceServiceData.getVnfInstanceId());
- //siid = vnfInstanceServiceData.getVnfInstanceId();
vnfInstanceListBuilder.setServiceStatus(serviceStatusBuilder.build());
saveVnfInstanceList(vnfInstanceListBuilder.build(), false, LogicalDatastoreType.CONFIGURATION);
if (input.getSdncRequestHeader() != null && input.getSdncRequestHeader().getSvcAction() != null) {
@@ -1127,11 +1121,11 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
responseBuilder.setVnfInstanceInformation(vnfInstanceInformationBuilder.build());
responseBuilder.setServiceInformation(vnfInstanceServiceData.getServiceInformation());
} catch (Exception e) {
- log.error(CAUGHT_EXCEPTION_STR + SVC_OPERATION + " [" + viid + "] \n", e);
+ log.error(CAUGHT_EXCEPTION_STR + svcOperation + " [" + viid + "] \n", e);
responseBuilder.setResponseCode("500");
responseBuilder.setResponseMessage(e.toString());
responseBuilder.setAckFinalIndicator("Y");
- log.error(RETURNED_FAILED_STR + SVC_OPERATION + " [" + viid + "] " + responseBuilder.build());
+ log.error(RETURNED_FAILED_STR + svcOperation + " [" + viid + "] " + responseBuilder.build());
RpcResult<VnfInstanceTopologyOperationOutput> rpcResult = RpcResultBuilder
.<VnfInstanceTopologyOperationOutput>status(true)
.withResult(responseBuilder.build())
@@ -1146,8 +1140,8 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
if (errorMessage != null) {
responseBuilder.setResponseMessage(errorMessage);
}
- log.info(UPDATED_MD_SAL_STR + SVC_OPERATION + " [" + viid + "] ");
- log.info(RETURNED_SUCCESS_STR + SVC_OPERATION + " [" + viid + "] " + responseBuilder.build());
+ log.info(UPDATED_MD_SAL_STR + svcOperation + " [" + viid + "] ");
+ log.info(RETURNED_SUCCESS_STR + svcOperation + " [" + viid + "] " + responseBuilder.build());
RpcResult<VnfInstanceTopologyOperationOutput> rpcResult = RpcResultBuilder
.<VnfInstanceTopologyOperationOutput>status(true)
@@ -1162,18 +1156,19 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
public Future<RpcResult<VfModuleTopologyOperationOutput>> vfModuleTopologyOperation(
VfModuleTopologyOperationInput input) {
+ final String svcOperation = "vf-module-topology-operation";
VfModuleServiceData vfModuleServiceData;
ServiceStatusBuilder serviceStatusBuilder = new ServiceStatusBuilder();
Properties parms = new Properties();
- log.info(SVC_OPERATION + CALLED_STR);
+ log.info(svcOperation + CALLED_STR);
// create a new response object
VfModuleTopologyOperationOutputBuilder responseBuilder = new VfModuleTopologyOperationOutputBuilder();
// Validate vf-module-id from vf-module-request-information
if (input == null || input.getVfModuleRequestInformation() == null
|| input.getVfModuleRequestInformation().getVfModuleId() == null) {
- log.debug(EXITING_STR + SVC_OPERATION + " because of invalid input, null or empty vf-module-id");
+ log.debug(EXITING_STR + svcOperation + " because of invalid input, null or empty vf-module-id");
responseBuilder.setResponseCode("403");
responseBuilder.setResponseMessage(INVALID_INPUT_VF_MODULE_STR);
responseBuilder.setAckFinalIndicator("Y");
@@ -1192,7 +1187,7 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
// Make sure we have a valid siid
if (vfid == null || vfid.length() == 0) {
- log.debug(EXITING_STR + SVC_OPERATION + " because of invalid vf-module-id");
+ log.debug(EXITING_STR + svcOperation + " because of invalid vf-module-id");
responseBuilder.setResponseCode("403");
responseBuilder.setResponseMessage(INVALID_INPUT_VF_MODULE_STR);
responseBuilder.setAckFinalIndicator("Y");
@@ -1208,7 +1203,7 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
String viid = input.getVfModuleRequestInformation().getVnfInstanceId();
if (viid == null || viid.length() == 0) {
- log.debug(EXITING_STR + SVC_OPERATION + " because of invalid vnf-instance-id");
+ log.debug(EXITING_STR + svcOperation + " because of invalid vnf-instance-id");
responseBuilder.setResponseCode("403");
responseBuilder.setResponseMessage(INVALID_INPUT_VNF_INSTANCE_STR);
responseBuilder.setAckFinalIndicator("Y");
@@ -1245,7 +1240,6 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
VnfInstanceServiceDataBuilder vnfInstanceOperDataBuilder = new VnfInstanceServiceDataBuilder();
getVnfInstanceServiceData(viid, vnfInstanceOperDataBuilder, LogicalDatastoreType.OPERATIONAL);
-
// Set the serviceStatus based on input
setServiceStatus(serviceStatusBuilder, input.getSdncRequestHeader());
setServiceStatus(serviceStatusBuilder, input.getRequestInformation());
@@ -1263,23 +1257,23 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
//
// container service-data
- log.info(ADDING_INPUT_DATA_STR + SVC_OPERATION + " [" + vfid + INPUT_STR + input);
+ log.info(ADDING_INPUT_DATA_STR + svcOperation + " [" + vfid + INPUT_STR + input);
VfModuleTopologyOperationInputBuilder inputBuilder = new VfModuleTopologyOperationInputBuilder(input);
VnfSdnUtil.toProperties(parms, inputBuilder.build());
- log.info(ADDING_OPERATIONAL_DATA_STR + SVC_OPERATION + " [" + vfid + "] vf-module operational-data: "
+ log.info(ADDING_OPERATIONAL_DATA_STR + svcOperation + " [" + vfid + "] vf-module operational-data: "
+ operDataBuilder.build());
VnfSdnUtil.toProperties(parms, OPERATIONAL_DATA, operDataBuilder);
- log.info(ADDING_CONFIG_DATA_STR + SVC_OPERATION + " [" + preloadName + "," + preloadType
+ log.info(ADDING_CONFIG_DATA_STR + svcOperation + " [" + preloadName + "," + preloadType
+ "] vf-module-preload-data: " + vfModulePreloadDataBuilder.build());
VnfSdnUtil.toProperties(parms, "vf-module-preload-data", vfModulePreloadDataBuilder);
- log.info("Adding vnf-instance CONFIG data for " + SVC_OPERATION + " [" + viid + "] vnf-instance-service-data: "
+ log.info("Adding vnf-instance CONFIG data for " + svcOperation + " [" + viid + "] vnf-instance-service-data: "
+ vnfInstanceServiceDataBuilder.build());
VnfSdnUtil.toProperties(parms, "vnf-instance-service-data", vnfInstanceServiceDataBuilder);
- log.info("Adding vnf-instance OPERATIONAL data for " + SVC_OPERATION + " [" + viid
+ log.info("Adding vnf-instance OPERATIONAL data for " + svcOperation + " [" + viid
+ "] vnf-instance operational-data: " + vnfInstanceOperDataBuilder.build());
VnfSdnUtil.toProperties(parms, "vnf-instance-operational-data", vnfInstanceOperDataBuilder);
@@ -1292,19 +1286,19 @@ 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", vfModuleServiceDataBuilder, parms);
+ .execute(VNF_API, svcOperation, null, "sync", vfModuleServiceDataBuilder, parms);
} catch (Exception e) {
- log.error("Caught exception executing service logic on vf-module for " + SVC_OPERATION, e);
+ log.error("Caught exception executing service logic on vf-module 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) {
@@ -1333,9 +1327,9 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
try {
saveVfModuleList(vfModuleListBuilder.build(), true, LogicalDatastoreType.CONFIGURATION);
} catch (Exception e) {
- log.error(CAUGHT_EXCEPTION_STR + SVC_OPERATION + " [" + vfid + "] \n", e);
+ log.error(CAUGHT_EXCEPTION_STR + svcOperation + " [" + vfid + "] \n", e);
}
- log.error(RETURNED_FAILED_STR + SVC_OPERATION + " [" + vfid + "] " + responseBuilder.build());
+ log.error(RETURNED_FAILED_STR + svcOperation + " [" + vfid + "] " + responseBuilder.build());
RpcResult<VfModuleTopologyOperationOutput> rpcResult =
RpcResultBuilder.<VfModuleTopologyOperationOutput>status(true).withResult(responseBuilder.build())
.build();
@@ -1348,7 +1342,7 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
try {
vfModuleServiceData = vfModuleServiceDataBuilder.build();
log.info(
- UPDATING_MD_SAL_STR + SVC_OPERATION + " [" + vfid + "] VfModuleServiceData: " + vfModuleServiceData);
+ UPDATING_MD_SAL_STR + svcOperation + " [" + vfid + "] VfModuleServiceData: " + vfModuleServiceData);
// vf-module-list
VfModuleListBuilder vfModuleListBuilder = new VfModuleListBuilder();
vfModuleListBuilder.setVfModuleServiceData(vfModuleServiceData);
@@ -1368,11 +1362,11 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
responseBuilder.setVfModuleInformation(vfModuleInformationBuilder.build());
responseBuilder.setServiceInformation(vfModuleServiceData.getServiceInformation());
} catch (Exception e) {
- log.error(CAUGHT_EXCEPTION_STR + SVC_OPERATION + " [" + vfid + "] \n", e);
+ log.error(CAUGHT_EXCEPTION_STR + svcOperation + " [" + vfid + "] \n", e);
responseBuilder.setResponseCode("500");
responseBuilder.setResponseMessage(e.toString());
responseBuilder.setAckFinalIndicator("Y");
- log.error(RETURNED_FAILED_STR + SVC_OPERATION + " [" + vfid + "] " + responseBuilder.build());
+ log.error(RETURNED_FAILED_STR + svcOperation + " [" + vfid + "] " + responseBuilder.build());
RpcResult<VfModuleTopologyOperationOutput> rpcResult =
RpcResultBuilder.<VfModuleTopologyOperationOutput>status(true).withResult(responseBuilder.build())
.build();
@@ -1386,8 +1380,8 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
if (errorMessage != null) {
responseBuilder.setResponseMessage(errorMessage);
}
- log.info("Updated vf-module in MD-SAL for " + SVC_OPERATION + " [" + vfid + "] ");
- log.info(RETURNED_SUCCESS_STR + SVC_OPERATION + " [" + vfid + "] " + responseBuilder.build());
+ log.info("Updated vf-module in MD-SAL for " + svcOperation + " [" + vfid + "] ");
+ log.info(RETURNED_SUCCESS_STR + svcOperation + " [" + vfid + "] " + responseBuilder.build());
RpcResult<VfModuleTopologyOperationOutput> rpcResult =
RpcResultBuilder.<VfModuleTopologyOperationOutput>status(true).withResult(responseBuilder.build()).build();
@@ -1397,19 +1391,19 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
@Override
public Future<RpcResult<VnfTopologyOperationOutput>> vnfTopologyOperation(VnfTopologyOperationInput input) {
- final String SVC_OPERATION = "vnf-topology-operation";
+ final String svcOperation = "vnf-topology-operation";
ServiceData serviceData;
ServiceStatusBuilder serviceStatusBuilder = new ServiceStatusBuilder();
Properties parms = new Properties();
- log.info(SVC_OPERATION + " called.");
+ log.info(svcOperation + CALLED_STR);
// create a new response object
VnfTopologyOperationOutputBuilder responseBuilder = new VnfTopologyOperationOutputBuilder();
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_STR + 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");
@@ -1421,7 +1415,7 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
if (input.getVnfRequestInformation() == null || input.getVnfRequestInformation().getVnfId() == null
|| input.getVnfRequestInformation().getVnfId().length() == 0) {
- log.debug("exiting " + SVC_OPERATION + " because of invalid input, null or empty vf-module-id");
+ log.debug(EXITING_STR + svcOperation + " because of invalid input, null or empty vf-module-id");
responseBuilder.setResponseCode("403");
responseBuilder.setResponseMessage("invalid input, null or empty vf-module-id");
responseBuilder.setAckFinalIndicator("Y");
@@ -1467,16 +1461,16 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
// container service-data
// uses oper-status;
- log.info("Adding INPUT data for " + SVC_OPERATION + " [" + siid + "] input: " + input);
+ log.info(ADDING_INPUT_DATA_STR + svcOperation + " [" + siid + INPUT_STR + input);
VnfTopologyOperationInputBuilder inputBuilder = new VnfTopologyOperationInputBuilder(input);
VnfSdnUtil.toProperties(parms, inputBuilder.build());
- log.info("Adding OPERATIONAL data for " + SVC_OPERATION + " [" + siid + "] operational-data: " + operDataBuilder
+ log.info(ADDING_OPERATIONAL_DATA_STR + svcOperation + " [" + siid + OPERATIONAL_DATA_STR + operDataBuilder
.build());
- VnfSdnUtil.toProperties(parms, "operational-data", operDataBuilder);
+ VnfSdnUtil.toProperties(parms, OPERATIONAL_DATA, operDataBuilder);
log.info(
- "Adding CONFIG data for " + SVC_OPERATION + " [" + preloadName + "," + preloadType + "] preload-data: "
+ "Adding CONFIG data for " + svcOperation + " [" + preloadName + "," + preloadType + "] preload-data: "
+ preloadDataBuilder.build());
VnfSdnUtil.toProperties(parms, "preload-data", preloadDataBuilder);
@@ -1488,18 +1482,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", serviceDataBuilder, parms);
+ svcLogicClient.execute(VNF_API, svcOperation, null, "sync", serviceDataBuilder, 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) {
@@ -1528,9 +1522,9 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
try {
saveVnfList(vnfListBuilder.build(), true, LogicalDatastoreType.CONFIGURATION);
} catch (Exception e) {
- log.error("Caught Exception updating MD-SAL for " + SVC_OPERATION + " [" + siid + "] \n", e);
+ log.error(CAUGHT_EXCEPTION_STR + svcOperation + " [" + siid + "] \n", e);
}
- log.error("Returned FAILED for " + SVC_OPERATION + " [" + siid + "] " + responseBuilder.build());
+ log.error(RETURNED_FAILED_STR + svcOperation + " [" + siid + "] " + responseBuilder.build());
RpcResult<VnfTopologyOperationOutput> rpcResult =
RpcResultBuilder.<VnfTopologyOperationOutput>status(true).withResult(responseBuilder.build()).build();
// return error
@@ -1540,7 +1534,7 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
// Got success from SLI
try {
serviceData = serviceDataBuilder.build();
- log.info("Updating MD-SAL for " + SVC_OPERATION + " [" + siid + "] ServiceData: " + serviceData);
+ log.info(UPDATING_MD_SAL_STR + svcOperation + " [" + siid + "] ServiceData: " + serviceData);
// svc-configuration-list
VnfListBuilder vnfListBuilder = new VnfListBuilder();
vnfListBuilder.setServiceData(serviceData);
@@ -1551,7 +1545,7 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
if (input.getSdncRequestHeader() != null && input.getSdncRequestHeader().getSvcAction() != null) {
// Only update operational tree on Delete or Activate
if (input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Activate)) {
- log.info("Updating OPERATIONAL tree.");
+ log.info(UPDATING_OPERATIONAL_TREE_STR);
saveVnfList(vnfListBuilder.build(), false, LogicalDatastoreType.OPERATIONAL);
} else if (input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Delete) || input
.getSdncRequestHeader().getSvcAction().equals(SvcAction.Rollback)) {
@@ -1565,11 +1559,11 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
responseBuilder.setVnfInformation(vnfInformationBuilder.build());
responseBuilder.setServiceInformation(serviceData.getServiceInformation());
} catch (Exception e) {
- log.error("Caught Exception updating MD-SAL for " + SVC_OPERATION + " [" + siid + "] \n", e);
+ log.error(CAUGHT_EXCEPTION_STR + 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_STR + svcOperation + " [" + siid + "] " + responseBuilder.build());
RpcResult<VnfTopologyOperationOutput> rpcResult =
RpcResultBuilder.<VnfTopologyOperationOutput>status(true).withResult(responseBuilder.build()).build();
// return error
@@ -1582,8 +1576,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_STR + svcOperation + " [" + siid + "] ");
+ log.info(RETURNED_SUCCESS_STR + svcOperation + " [" + siid + "] " + responseBuilder.build());
RpcResult<VnfTopologyOperationOutput> rpcResult =
RpcResultBuilder.<VnfTopologyOperationOutput>status(true).withResult(responseBuilder.build()).build();
@@ -1591,7 +1585,8 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
return Futures.immediateFuture(rpcResult);
}
- @Override public Future<RpcResult<NetworkTopologyOperationOutput>> networkTopologyOperation(
+ @Override
+ public Future<RpcResult<NetworkTopologyOperationOutput>> networkTopologyOperation(
NetworkTopologyOperationInput input) {
final String svcOperation = "network-topology-operation";
@@ -1599,14 +1594,14 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
ServiceStatusBuilder serviceStatusBuilder = new ServiceStatusBuilder();
Properties parms = new Properties();
- log.info(svcOperation + " called.");
+ log.info(svcOperation + CALLED_STR);
// 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 " + svcOperation + " because of invalid input, null or empty service-instance-id");
+ log.debug(EXITING_STR + 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");
@@ -1619,7 +1614,7 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
if (input.getNetworkRequestInformation() == null
|| input.getNetworkRequestInformation().getNetworkName() == null) {
- log.debug("exiting " + svcOperation + " because of invalid input, null or empty service-instance-id");
+ log.debug(EXITING_STR + 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");
@@ -1648,7 +1643,7 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
PreloadDataBuilder preloadDataBuilder = new PreloadDataBuilder();
getPreloadData(preloadName, preloadType, preloadDataBuilder);
- log.info("Adding INPUT data for " + svcOperation + " [" + siid + "] input: " + input);
+ log.info(ADDING_INPUT_DATA_STR + svcOperation + " [" + siid + INPUT_STR + input);
NetworkTopologyOperationInputBuilder inputBuilder = new NetworkTopologyOperationInputBuilder(input);
VnfSdnUtil.toProperties(parms, inputBuilder.build());
@@ -1661,11 +1656,11 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
String networkId = "error";
try {
- if (svcLogicClient.hasGraph("VNF-API", svcOperation, null, "sync")) {
+ if (svcLogicClient.hasGraph(VNF_API, svcOperation, null, "sync")) {
try {
respProps =
- svcLogicClient.execute("VNF-API", svcOperation, null, "sync", preloadDataBuilder, parms);
+ svcLogicClient.execute(VNF_API, svcOperation, null, "sync", preloadDataBuilder, parms);
} catch (Exception e) {
log.error("Caught exception executing service logic for " + svcOperation, e);
errorMessage = e.getMessage();
@@ -1693,7 +1688,7 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
responseBuilder.setResponseMessage(errorMessage);
responseBuilder.setAckFinalIndicator(ackFinal);
- log.error("Returned FAILED for " + svcOperation + " [" + siid + "] " + responseBuilder.build());
+ log.error(RETURNED_FAILED_STR + svcOperation + " [" + siid + "] " + responseBuilder.build());
RpcResult<NetworkTopologyOperationOutput> rpcResult =
RpcResultBuilder.<NetworkTopologyOperationOutput>status(true).withResult(responseBuilder.build())
@@ -1709,11 +1704,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 " + svcOperation + " [" + siid + "] \n", e);
+ log.error(CAUGHT_EXCEPTION_STR + svcOperation + " [" + siid + "] \n", e);
responseBuilder.setResponseCode("500");
responseBuilder.setResponseMessage(e.toString());
responseBuilder.setAckFinalIndicator("Y");
- log.error("Returned FAILED for " + svcOperation + " [" + siid + "] " + responseBuilder.build());
+ log.error(RETURNED_FAILED_STR + svcOperation + " [" + siid + "] " + responseBuilder.build());
RpcResult<NetworkTopologyOperationOutput> rpcResult =
RpcResultBuilder.<NetworkTopologyOperationOutput>status(true).withResult(responseBuilder.build())
.build();
@@ -1727,8 +1722,8 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
if (errorMessage != null) {
responseBuilder.setResponseMessage(errorMessage);
}
- log.info("Updated MD-SAL for " + svcOperation + " [" + siid + "] ");
- log.info("Returned SUCCESS for " + svcOperation + " [" + siid + "] " + responseBuilder.build());
+ log.info(UPDATED_MD_SAL_STR + svcOperation + " [" + siid + "] ");
+ log.info(RETURNED_SUCCESS_STR + svcOperation + " [" + siid + "] " + responseBuilder.build());
RpcResult<NetworkTopologyOperationOutput> rpcResult =
RpcResultBuilder.<NetworkTopologyOperationOutput>status(true).withResult(responseBuilder.build()).build();
@@ -1736,14 +1731,15 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
return Futures.immediateFuture(rpcResult);
}
- @Override public Future<RpcResult<PreloadVnfTopologyOperationOutput>> preloadVnfTopologyOperation(
+ @Override
+ public Future<RpcResult<PreloadVnfTopologyOperationOutput>> preloadVnfTopologyOperation(
PreloadVnfTopologyOperationInput input) {
final String svcOperation = "preload-vnf-topology-operation";
PreloadData preloadData;
Properties parms = new Properties();
- log.info(svcOperation + " called.");
+ log.info(svcOperation + CALLED_STR);
// create a new response object
PreloadVnfTopologyOperationOutputBuilder responseBuilder = new PreloadVnfTopologyOperationOutputBuilder();
@@ -1753,7 +1749,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 " + svcOperation + " because of invalid input, null or empty vnf-name or vnf-type");
+ log.debug(EXITING_STR + 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");
@@ -1767,9 +1763,9 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
String preloadName = input.getVnfTopologyInformation().getVnfTopologyIdentifier().getVnfName();
String preloadType = input.getVnfTopologyInformation().getVnfTopologyIdentifier().getVnfType();
- // Make sure we have a preloadName and preloadType
+ // Make sure we have a preload_name and preload_type
if (preloadName == null || preloadName.length() == 0) {
- log.debug("exiting " + svcOperation + " because of invalid preload-name");
+ log.debug(EXITING_STR + svcOperation + " because of invalid preload-name");
responseBuilder.setResponseCode("403");
responseBuilder.setResponseMessage("invalid input, invalid preload-name");
responseBuilder.setAckFinalIndicator("Y");
@@ -1779,7 +1775,7 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
return Futures.immediateFuture(rpcResult);
}
if (preloadType == null || preloadType.length() == 0) {
- log.debug("exiting " + svcOperation + " because of invalid preload-type");
+ log.debug(EXITING_STR + svcOperation + " because of invalid preload-type");
responseBuilder.setResponseCode("403");
responseBuilder.setResponseMessage("invalid input, invalid preload-type");
responseBuilder.setAckFinalIndicator("Y");
@@ -1809,12 +1805,12 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
//
// container preload-data
log.info(
- "Adding INPUT data for " + svcOperation + " [" + preloadName + "," + preloadType + "] input: " + input);
+ ADDING_INPUT_DATA_STR + svcOperation + " [" + preloadName + "," + preloadType + INPUT_STR + input);
PreloadVnfTopologyOperationInputBuilder inputBuilder = new PreloadVnfTopologyOperationInputBuilder(input);
VnfSdnUtil.toProperties(parms, inputBuilder.build());
- log.info("Adding OPERATIONAL data for " + svcOperation + " [" + preloadName + "," + preloadType
- + "] operational-data: " + operDataBuilder.build());
- VnfSdnUtil.toProperties(parms, "operational-data", operDataBuilder);
+ log.info(ADDING_OPERATIONAL_DATA_STR + svcOperation + " [" + preloadName + "," + preloadType
+ + OPERATIONAL_DATA_STR + operDataBuilder.build());
+ VnfSdnUtil.toProperties(parms, OPERATIONAL_DATA, operDataBuilder);
// Call SLI sync method
// Get SvcLogicService reference
@@ -1824,11 +1820,11 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
String ackFinal = "Y";
try {
- if (svcLogicClient.hasGraph("VNF-API", svcOperation, null, "sync")) {
+ if (svcLogicClient.hasGraph(VNF_API, svcOperation, null, "sync")) {
try {
respProps =
- svcLogicClient.execute("VNF-API", svcOperation, null, "sync", preloadDataBuilder, parms);
+ svcLogicClient.execute(VNF_API, svcOperation, null, "sync", preloadDataBuilder, parms);
} catch (Exception e) {
log.error("Caught exception executing service logic for " + svcOperation, e);
errorMessage = e.getMessage();
@@ -1861,13 +1857,13 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
preloadVnfListBuilder.setVnfType(preloadType);
preloadVnfListBuilder.setPreloadData(preloadDataBuilder.build());
log.error(
- "Returned FAILED for " + svcOperation + " [" + preloadName + "," + preloadType + "] error code: '"
+ RETURNED_FAILED_STR + 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 " + svcOperation + " [" + preloadName + "," + preloadType
+ CAUGHT_EXCEPTION_STR + svcOperation + " [" + preloadName + "," + preloadType
+ "] \n", e);
}
log.debug("Sending Success rpc result due to external error");
@@ -1881,7 +1877,7 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
try {
preloadData = preloadDataBuilder.build();
log.info(
- "Updating MD-SAL for " + svcOperation + " [" + preloadName + "," + preloadType + "] preloadData: "
+ UPDATING_MD_SAL_STR + svcOperation + " [" + preloadName + "," + preloadType + "] preloadData: "
+ preloadData);
// svc-configuration-list
VnfPreloadListBuilder preloadVnfListBuilder = new VnfPreloadListBuilder();
@@ -1891,15 +1887,15 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
// SDNGC-989 set merge flag to false
savePreloadList(preloadVnfListBuilder.build(), false, LogicalDatastoreType.CONFIGURATION);
- log.info("Updating OPERATIONAL tree.");
+ log.info(UPDATING_OPERATIONAL_TREE_STR);
savePreloadList(preloadVnfListBuilder.build(), false, LogicalDatastoreType.OPERATIONAL);
} catch (Exception e) {
- log.error("Caught Exception updating MD-SAL for " + svcOperation + " [" + preloadName + "," + preloadType
+ log.error(CAUGHT_EXCEPTION_STR + svcOperation + " [" + preloadName + "," + preloadType
+ "] \n", e);
responseBuilder.setResponseCode("500");
responseBuilder.setResponseMessage(e.toString());
responseBuilder.setAckFinalIndicator("Y");
- log.error("Returned FAILED for " + svcOperation + " [" + preloadName + "," + preloadType + "] "
+ log.error(RETURNED_FAILED_STR + svcOperation + " [" + preloadName + "," + preloadType + "] "
+ responseBuilder.build());
RpcResult<PreloadVnfTopologyOperationOutput> rpcResult =
RpcResultBuilder.<PreloadVnfTopologyOperationOutput>status(false).withResult(responseBuilder.build())
@@ -1913,9 +1909,9 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
if (errorMessage != null) {
responseBuilder.setResponseMessage(errorMessage);
}
- log.info("Updated MD-SAL for " + svcOperation + " [" + preloadName + "," + preloadType + "] ");
+ log.info(UPDATED_MD_SAL_STR + svcOperation + " [" + preloadName + "," + preloadType + "] ");
log.info(
- "Returned SUCCESS for " + svcOperation + " [" + preloadName + "," + preloadType + "] " + responseBuilder
+ RETURNED_SUCCESS_STR + svcOperation + " [" + preloadName + "," + preloadType + "] " + responseBuilder
.build());
RpcResult<PreloadVnfTopologyOperationOutput> rpcResult =
@@ -1925,23 +1921,23 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
}
//1610 preload-vnf-instance-topology-operation
- @Override public Future<RpcResult<PreloadVnfInstanceTopologyOperationOutput>> preloadVnfInstanceTopologyOperation(
+ @Override
+ public Future<RpcResult<PreloadVnfInstanceTopologyOperationOutput>> preloadVnfInstanceTopologyOperation(
PreloadVnfInstanceTopologyOperationInput input) {
final String svcOperation = "preload-vnf-instance-topology-operation";
VnfInstancePreloadData vnfInstancePreloadData;
Properties parms = new Properties();
- log.info(svcOperation + " called.");
+ log.info(svcOperation + CALLED_STR);
// create a new response object
PreloadVnfInstanceTopologyOperationOutputBuilder responseBuilder =
new PreloadVnfInstanceTopologyOperationOutputBuilder();
-
if (input == null || input.getVnfInstanceTopologyInformation() == null
|| input.getVnfInstanceTopologyInformation().getVnfInstanceIdentifiers().getVnfInstanceName() == null
|| input.getVnfInstanceTopologyInformation().getVnfInstanceIdentifiers().getVnfModelId() == null) {
- log.debug("exiting " + svcOperation
+ log.debug(EXITING_STR + 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");
@@ -1959,7 +1955,7 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
// Make sure we have a preloadName and preloadType
if (preloadName == null || preloadName.length() == 0) {
- log.debug("exiting " + svcOperation + " because of invalid preload-name");
+ log.debug(EXITING_STR + svcOperation + " because of invalid preload-name");
responseBuilder.setResponseCode("403");
responseBuilder.setResponseMessage("invalid input, invalid preload-name");
responseBuilder.setAckFinalIndicator("Y");
@@ -1969,7 +1965,7 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
return Futures.immediateFuture(rpcResult);
}
if (preloadType == null || preloadType.length() == 0) {
- log.debug("exiting " + svcOperation + " because of invalid preload-type");
+ log.debug(EXITING_STR + svcOperation + " because of invalid preload-type");
responseBuilder.setResponseCode("403");
responseBuilder.setResponseMessage("invalid input, invalid preload-type");
responseBuilder.setAckFinalIndicator("Y");
@@ -1986,7 +1982,6 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
VnfInstancePreloadDataBuilder vnfInstancePreloadDataBuilder = new VnfInstancePreloadDataBuilder();
getVnfInstancePreloadData(preloadName, preloadType, vnfInstancePreloadDataBuilder);
- //preloadData = preloadDataBuilder.build();
VnfInstancePreloadDataBuilder operDataBuilder = new VnfInstancePreloadDataBuilder();
getVnfInstancePreloadData(preloadName, preloadType, operDataBuilder, LogicalDatastoreType.OPERATIONAL);
@@ -1999,13 +1994,13 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
// OUTPUT:
// container preload-data
log.info(
- "Adding INPUT data for " + svcOperation + " [" + preloadName + "," + preloadType + "] input: " + input);
+ ADDING_CONFIG_DATA_STR + svcOperation + " [" + preloadName + "," + preloadType + INPUT_STR + input);
PreloadVnfInstanceTopologyOperationInputBuilder inputBuilder =
new PreloadVnfInstanceTopologyOperationInputBuilder(input);
VnfSdnUtil.toProperties(parms, inputBuilder.build());
- log.info("Adding OPERATIONAL data for " + svcOperation + " [" + preloadName + "," + preloadType
- + "] operational-data: " + operDataBuilder.build());
- VnfSdnUtil.toProperties(parms, "operational-data", operDataBuilder);
+ log.info(ADDING_OPERATIONAL_DATA_STR + svcOperation + " [" + preloadName + "," + preloadType
+ + OPERATIONAL_DATA_STR + operDataBuilder.build());
+ VnfSdnUtil.toProperties(parms, OPERATIONAL_DATA, operDataBuilder);
// Call SLI sync method
// Get SvcLogicService reference
@@ -2015,11 +2010,11 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
String ackFinal = "Y";
try {
- if (svcLogicClient.hasGraph("VNF-API", svcOperation, null, "sync")) {
+ if (svcLogicClient.hasGraph(VNF_API, svcOperation, null, "sync")) {
try {
respProps = svcLogicClient
- .execute("VNF-API", svcOperation, null, "sync", vnfInstancePreloadDataBuilder, parms);
+ .execute(VNF_API, svcOperation, null, "sync", vnfInstancePreloadDataBuilder, parms);
} catch (Exception e) {
log.error("Caught exception executing service logic for " + svcOperation, e);
errorMessage = e.getMessage();
@@ -2052,14 +2047,14 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
vnfInstancePreloadListBuilder.setVnfModelId(preloadType);
vnfInstancePreloadListBuilder.setVnfInstancePreloadData(vnfInstancePreloadDataBuilder.build());
log.error(
- "Returned FAILED for " + svcOperation + " [" + preloadName + "," + preloadType + "] error code: '"
+ RETURNED_FAILED_STR + 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 " + svcOperation + " [" + preloadName + "," + preloadType
+ CAUGHT_EXCEPTION_STR + svcOperation + " [" + preloadName + "," + preloadType
+ "] \n", e);
}
log.debug("Sending Success rpc result due to external error");
@@ -2073,7 +2068,7 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
try {
vnfInstancePreloadData = vnfInstancePreloadDataBuilder.build();
log.info(
- "Updating MD-SAL for " + svcOperation + " [" + preloadName + "," + preloadType + "] preloadData: "
+ UPDATING_MD_SAL_STR + svcOperation + " [" + preloadName + "," + preloadType + "] preloadData: "
+ vnfInstancePreloadData);
// svc-configuration-list
VnfInstancePreloadListBuilder vnfInstancePreloadListBuilder = new VnfInstancePreloadListBuilder();
@@ -2084,15 +2079,15 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
// SDNGC-989 set merge flag to false
saveVnfInstancePreloadList(vnfInstancePreloadListBuilder.build(), false,
LogicalDatastoreType.CONFIGURATION);
- log.info("Updating OPERATIONAL tree.");
+ log.info(UPDATING_OPERATIONAL_TREE_STR);
saveVnfInstancePreloadList(vnfInstancePreloadListBuilder.build(), false, LogicalDatastoreType.OPERATIONAL);
} catch (Exception e) {
- log.error("Caught Exception updating MD-SAL for " + svcOperation + " [" + preloadName + "," + preloadType
+ log.error(CAUGHT_EXCEPTION_STR + svcOperation + " [" + preloadName + "," + preloadType
+ "] \n", e);
responseBuilder.setResponseCode("500");
responseBuilder.setResponseMessage(e.toString());
responseBuilder.setAckFinalIndicator("Y");
- log.error("Returned FAILED for " + svcOperation + " [" + preloadName + "," + preloadType + "] "
+ log.error(RETURNED_FAILED_STR + svcOperation + " [" + preloadName + "," + preloadType + "] "
+ responseBuilder.build());
RpcResult<PreloadVnfInstanceTopologyOperationOutput> rpcResult =
RpcResultBuilder.<PreloadVnfInstanceTopologyOperationOutput>status(false)
@@ -2106,9 +2101,9 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
if (errorMessage != null) {
responseBuilder.setResponseMessage(errorMessage);
}
- log.info("Updated MD-SAL for " + svcOperation + " [" + preloadName + "," + preloadType + "] ");
+ log.info(UPDATED_MD_SAL_STR + svcOperation + " [" + preloadName + "," + preloadType + "] ");
log.info(
- "Returned SUCCESS for " + svcOperation + " [" + preloadName + "," + preloadType + "] " + responseBuilder
+ RETURNED_SUCCESS_STR + svcOperation + " [" + preloadName + "," + preloadType + "] " + responseBuilder
.build());
RpcResult<PreloadVnfInstanceTopologyOperationOutput> rpcResult =
@@ -2119,14 +2114,15 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
//1610 preload-vf-module-topology-operation
- @Override public Future<RpcResult<PreloadVfModuleTopologyOperationOutput>> preloadVfModuleTopologyOperation(
+ @Override
+ public Future<RpcResult<PreloadVfModuleTopologyOperationOutput>> preloadVfModuleTopologyOperation(
PreloadVfModuleTopologyOperationInput input) {
final String svcOperation = "preload-vf-module-topology-operation";
VfModulePreloadData vfModulePreloadData;
Properties parms = new Properties();
- log.info(svcOperation + " called.");
+ log.info(svcOperation + CALLED_STR);
// create a new response object
PreloadVfModuleTopologyOperationOutputBuilder responseBuilder =
new PreloadVfModuleTopologyOperationOutputBuilder();
@@ -2136,7 +2132,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 " + svcOperation
+ log.debug(EXITING_STR + 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");
@@ -2153,7 +2149,7 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
// Make sure we have a preloadName and preloadType
if (preloadName == null || preloadName.length() == 0) {
- log.debug("exiting " + svcOperation + " because of invalid preload-name");
+ log.debug(EXITING_STR + svcOperation + " because of invalid preload-name");
responseBuilder.setResponseCode("403");
responseBuilder.setResponseMessage("invalid input, invalid preload-name");
responseBuilder.setAckFinalIndicator("Y");
@@ -2163,7 +2159,7 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
return Futures.immediateFuture(rpcResult);
}
if (preloadType == null || preloadType.length() == 0) {
- log.debug("exiting " + svcOperation + " because of invalid preload-type");
+ log.debug(EXITING_STR + svcOperation + " because of invalid preload-type");
responseBuilder.setResponseCode("403");
responseBuilder.setResponseMessage("invalid input, invalid preload-type");
responseBuilder.setAckFinalIndicator("Y");
@@ -2195,13 +2191,13 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
// container preload-data
log.info(
- "Adding INPUT data for " + svcOperation + " [" + preloadName + "," + preloadType + "] input: " + input);
+ ADDING_INPUT_DATA_STR + svcOperation + " [" + preloadName + "," + preloadType + INPUT_STR + input);
PreloadVfModuleTopologyOperationInputBuilder inputBuilder =
new PreloadVfModuleTopologyOperationInputBuilder(input);
VnfSdnUtil.toProperties(parms, inputBuilder.build());
- log.info("Adding OPERATIONAL data for " + svcOperation + " [" + preloadName + "," + preloadType
- + "] operational-data: " + operDataBuilder.build());
- VnfSdnUtil.toProperties(parms, "operational-data", operDataBuilder);
+ log.info(ADDING_OPERATIONAL_DATA_STR + svcOperation + " [" + preloadName + "," + preloadType
+ + OPERATIONAL_DATA_STR + operDataBuilder.build());
+ VnfSdnUtil.toProperties(parms, OPERATIONAL_DATA, operDataBuilder);
// Call SLI sync method
// Get SvcLogicService reference
@@ -2211,10 +2207,10 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
String ackFinal = "Y";
try {
- if (svcLogicClient.hasGraph("VNF-API", svcOperation, null, "sync")) {
+ if (svcLogicClient.hasGraph(VNF_API, svcOperation, null, "sync")) {
try {
respProps = svcLogicClient
- .execute("VNF-API", svcOperation, null, "sync", vfModulePreloadDataBuilder, parms);
+ .execute(VNF_API, svcOperation, null, "sync", vfModulePreloadDataBuilder, parms);
} catch (Exception e) {
log.error("Caught exception executing service logic for " + svcOperation, e);
errorMessage = e.getMessage();
@@ -2247,13 +2243,13 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
vfModulePreloadListBuilder.setVfModuleModelId(preloadType);
vfModulePreloadListBuilder.setVfModulePreloadData(vfModulePreloadDataBuilder.build());
log.error(
- "Returned FAILED for " + svcOperation + " [" + preloadName + "," + preloadType + "] error code: '"
+ RETURNED_FAILED_STR + 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 " + svcOperation + " [" + preloadName + "," + preloadType
+ CAUGHT_EXCEPTION_STR + svcOperation + " [" + preloadName + "," + preloadType
+ "] \n", e);
}
log.debug("Sending Success rpc result due to external error");
@@ -2267,7 +2263,7 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
try {
vfModulePreloadData = vfModulePreloadDataBuilder.build();
log.info(
- "Updating MD-SAL for " + svcOperation + " [" + preloadName + "," + preloadType + "] preloadData: "
+ UPDATING_MD_SAL_STR + svcOperation + " [" + preloadName + "," + preloadType + "] preloadData: "
+ vfModulePreloadData);
// svc-configuration-list
VfModulePreloadListBuilder vfModulePreloadListBuilder = new VfModulePreloadListBuilder();
@@ -2277,15 +2273,15 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
// SDNGC-989 set merge flag to false
saveVfModulePreloadList(vfModulePreloadListBuilder.build(), false, LogicalDatastoreType.CONFIGURATION);
- log.info("Updating OPERATIONAL tree.");
+ log.info(UPDATING_OPERATIONAL_TREE_STR);
saveVfModulePreloadList(vfModulePreloadListBuilder.build(), false, LogicalDatastoreType.OPERATIONAL);
} catch (Exception e) {
- log.error("Caught Exception updating MD-SAL for " + svcOperation + " [" + preloadName + "," + preloadType
+ log.error(CAUGHT_EXCEPTION_STR + svcOperation + " [" + preloadName + "," + preloadType
+ "] \n", e);
responseBuilder.setResponseCode("500");
responseBuilder.setResponseMessage(e.toString());
responseBuilder.setAckFinalIndicator("Y");
- log.error("Returned FAILED for " + svcOperation + " [" + preloadName + "," + preloadType + "] "
+ log.error(RETURNED_FAILED_STR + svcOperation + " [" + preloadName + "," + preloadType + "] "
+ responseBuilder.build());
RpcResult<PreloadVfModuleTopologyOperationOutput> rpcResult =
RpcResultBuilder.<PreloadVfModuleTopologyOperationOutput>status(false)
@@ -2299,9 +2295,9 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
if (errorMessage != null) {
responseBuilder.setResponseMessage(errorMessage);
}
- log.info("Updated MD-SAL for " + svcOperation + " [" + preloadName + "," + preloadType + "] ");
+ log.info(UPDATED_MD_SAL_STR + svcOperation + " [" + preloadName + "," + preloadType + "] ");
log.info(
- "Returned SUCCESS for " + svcOperation + " [" + preloadName + "," + preloadType + "] " + responseBuilder
+ RETURNED_SUCCESS_STR + svcOperation + " [" + preloadName + "," + preloadType + "] " + responseBuilder
.build());
RpcResult<PreloadVfModuleTopologyOperationOutput> rpcResult =
@@ -2311,14 +2307,15 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
}
- @Override public Future<RpcResult<PreloadNetworkTopologyOperationOutput>> preloadNetworkTopologyOperation(
+ @Override
+ public Future<RpcResult<PreloadNetworkTopologyOperationOutput>> preloadNetworkTopologyOperation(
PreloadNetworkTopologyOperationInput input) {
final String svcOperation = "preload-network-topology-operation";
PreloadData preloadData = null;
Properties parms = new Properties();
- log.info(svcOperation + " called.");
+ log.info(svcOperation + CALLED_STR);
// create a new response object
PreloadNetworkTopologyOperationOutputBuilder responseBuilder =
new PreloadNetworkTopologyOperationOutputBuilder();
@@ -2329,8 +2326,8 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
|| input.getNetworkTopologyInformation().getNetworkTopologyIdentifier() == null
|| input.getNetworkTopologyInformation().getNetworkTopologyIdentifier().getNetworkName() == null
|| input.getNetworkTopologyInformation().getNetworkTopologyIdentifier().getNetworkType() == null) {
- log.debug("exiting " + svcOperation + " because of invalid input, null or" +
- " empty network-name or network-type");
+ log.debug(EXITING_STR + 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");
responseBuilder.setAckFinalIndicator("Y");
@@ -2346,7 +2343,7 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
// Make sure we have a preloadName and preloadType
if (preloadName == null || preloadName.length() == 0) {
- log.debug("exiting " + svcOperation + " because of invalid preload-name");
+ log.debug(EXITING_STR + svcOperation + " because of invalid preload-name");
responseBuilder.setResponseCode("403");
responseBuilder.setResponseMessage("input, invalid preload-name");
responseBuilder.setAckFinalIndicator("Y");
@@ -2357,7 +2354,7 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
}
if (preloadType == null || preloadType.length() == 0) {
- log.debug("exiting " + svcOperation + " because of invalid preload-type");
+ log.debug(EXITING_STR + svcOperation + " because of invalid preload-type");
responseBuilder.setResponseCode("403");
responseBuilder.setResponseMessage("input, invalid preload-type");
responseBuilder.setAckFinalIndicator("Y");
@@ -2388,13 +2385,13 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
//
// container preload-data
log.info(
- "Adding INPUT data for " + svcOperation + " [" + preloadName + "," + preloadType + "] input: " + input);
+ ADDING_INPUT_DATA_STR + svcOperation + " [" + preloadName + "," + preloadType + INPUT_STR + input);
PreloadNetworkTopologyOperationInputBuilder inputBuilder =
new PreloadNetworkTopologyOperationInputBuilder(input);
VnfSdnUtil.toProperties(parms, inputBuilder.build());
- log.info("Adding OPERATIONAL data for " + svcOperation + " [" + preloadName + "," + preloadType
- + "] operational-data: " + operDataBuilder.build());
- VnfSdnUtil.toProperties(parms, "operational-data", operDataBuilder);
+ log.info(ADDING_OPERATIONAL_DATA_STR + svcOperation + " [" + preloadName + "," + preloadType
+ + OPERATIONAL_DATA_STR + operDataBuilder.build());
+ VnfSdnUtil.toProperties(parms, OPERATIONAL_DATA, operDataBuilder);
// Call SLI sync method
// Get SvcLogicService reference
@@ -2404,10 +2401,10 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
String ackFinal = "Y";
try {
- if (svcLogicClient.hasGraph("VNF-API", svcOperation, null, "sync")) {
+ if (svcLogicClient.hasGraph(VNF_API, svcOperation, null, "sync")) {
try {
respProps =
- svcLogicClient.execute("VNF-API", svcOperation, null, "sync", preloadDataBuilder, parms);
+ svcLogicClient.execute(VNF_API, svcOperation, null, "sync", preloadDataBuilder, parms);
} catch (Exception e) {
log.error("Caught exception executing service logic for " + svcOperation, e);
errorMessage = e.getMessage();
@@ -2423,7 +2420,6 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
log.error("Caught exception looking for service logic", e);
}
-
if (respProps != null) {
errorCode = respProps.getProperty("error-code");
errorMessage = respProps.getProperty("error-message");
@@ -2440,13 +2436,13 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
preloadVnfListBuilder.setVnfType(preloadType);
preloadVnfListBuilder.setPreloadData(preloadDataBuilder.build());
log.error(
- "Returned FAILED for " + svcOperation + " [" + preloadName + "," + preloadType + "] error code: '"
+ RETURNED_FAILED_STR + 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 " + svcOperation + " [" + preloadName + "," + preloadType
+ CAUGHT_EXCEPTION_STR + svcOperation + " [" + preloadName + "," + preloadType
+ "] \n", e);
}
@@ -2461,7 +2457,7 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
try {
preloadData = preloadDataBuilder.build();
log.info(
- "Updating MD-SAL for " + svcOperation + " [" + preloadName + "," + preloadType + "] preloadData: "
+ UPDATING_MD_SAL_STR + svcOperation + " [" + preloadName + "," + preloadType + "] preloadData: "
+ preloadData);
// svc-configuration-list
VnfPreloadListBuilder preloadVnfListBuilder = new VnfPreloadListBuilder();
@@ -2471,15 +2467,15 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
// SDNGC-989 set merge flag to false
savePreloadList(preloadVnfListBuilder.build(), false, LogicalDatastoreType.CONFIGURATION);
- log.info("Updating OPERATIONAL tree.");
+ log.info(UPDATING_OPERATIONAL_TREE_STR);
savePreloadList(preloadVnfListBuilder.build(), false, LogicalDatastoreType.OPERATIONAL);
} catch (Exception e) {
- log.error("Caught Exception updating MD-SAL for " + svcOperation + " [" + preloadName + "," + preloadType
+ log.error(CAUGHT_EXCEPTION_STR + svcOperation + " [" + preloadName + "," + preloadType
+ "] \n", e);
responseBuilder.setResponseCode("500");
responseBuilder.setResponseMessage(e.toString());
responseBuilder.setAckFinalIndicator("Y");
- log.error("Returned FAILED for " + svcOperation + " [" + preloadName + "," + preloadType + "] "
+ log.error(RETURNED_FAILED_STR + svcOperation + " [" + preloadName + "," + preloadType + "] "
+ responseBuilder.build());
RpcResult<PreloadNetworkTopologyOperationOutput> rpcResult =
RpcResultBuilder.<PreloadNetworkTopologyOperationOutput>status(false)
@@ -2493,9 +2489,9 @@ public class VnfApiProvider implements AutoCloseable, VNFAPIService, DataChangeL
if (errorMessage != null) {
responseBuilder.setResponseMessage(errorMessage);
}
- log.info("Updated MD-SAL for " + svcOperation + " [" + preloadName + "," + preloadType + "] ");
+ log.info(UPDATED_MD_SAL_STR + svcOperation + " [" + preloadName + "," + preloadType + "] ");
log.info(
- "Returned SUCCESS for " + svcOperation + " [" + preloadName + "," + preloadType + "] " + responseBuilder
+ RETURNED_SUCCESS_STR + svcOperation + " [" + preloadName + "," + preloadType + "] " + responseBuilder
.build());
RpcResult<PreloadNetworkTopologyOperationOutput> rpcResult =