X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=generic-resource-api%2Fprovider%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fsdnc%2Fnorthbound%2FGenericResourceApiProvider.java;h=10ea31dfd432bd408ebda6b17bdd39429bc5b080;hb=eb15e84a42d99490f2cb6fc6c52beb99711713dd;hp=89466008a5c4c6661268f8d2f170172b97addefd;hpb=1d83942404923c3538dd9a5a11e78b506d3ca267;p=sdnc%2Fnorthbound.git diff --git a/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java b/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java index 89466008..10ea31df 100644 --- a/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java +++ b/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java @@ -3,6 +3,8 @@ package org.onap.sdnc.northbound; import com.google.common.base.Optional; import com.google.common.util.concurrent.CheckedFuture; import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.ListenableFuture; + import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; @@ -37,6 +39,7 @@ import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.re import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.GENERICRESOURCEAPIService; import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.GenericConfigurationNotificationInput; import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.GenericConfigurationNotificationInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.GenericConfigurationNotificationOutput; import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.GenericConfigurationTopologyOperationInput; import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.GenericConfigurationTopologyOperationInputBuilder; import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.GenericConfigurationTopologyOperationOutput; @@ -93,6 +96,10 @@ import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.re import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VnfTopologyOperationInputBuilder; import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VnfTopologyOperationOutput; import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VnfTopologyOperationOutputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PnfTopologyOperationInput; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PnfTopologyOperationInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PnfTopologyOperationOutput; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PnfTopologyOperationOutputBuilder; import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.brg.response.information.BrgResponseInformationBuilder; import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.connection.attachment.response.information.ConnectionAttachmentResponseInformationBuilder; import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.contrail.route.response.information.ContrailRouteResponseInformationBuilder; @@ -120,6 +127,7 @@ import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.re import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.tunnelxconn.response.information.TunnelxconnResponseInformationBuilder; import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.response.information.VfModuleResponseInformationBuilder; import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.response.information.VnfResponseInformationBuilder; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.pnf.response.information.PnfResponseInformationBuilder; import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.common.RpcResult; @@ -181,7 +189,9 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC private static final String SERVICE_OBJECT_PATH_PARAM = "service-object-path"; private static final String NETWORK_OBJECT_PATH_PARAM = "network-object-path"; private static final String VNF_OBJECT_PATH_PARAM = "vnf-object-path"; + private static final String PNF_OBJECT_PATH_PARAM = "pnf-object-path"; private static final String VF_MODULE_OBJECT_PATH_PARAM = "vf-module-object-path"; + private static final String VF_MODULE_ID_PARAM = "vf-module-id"; private static final String UPDATING_MDSAL_ERROR_MESSAGE = "Caught Exception updating MD-SAL for {} [{}] \n"; private static final String UPDATING_MDSAL_ERROR_MESSAGE_2 = "Caught Exception updating MD-SAL for {} [{},{}] \n"; private static final String RETURNED_FAILED_MESSAGE = "Returned FAILED for {} [{}] {}"; @@ -400,7 +410,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC // Each entry will be identifiable by a unique key, we have to create that // identifier InstanceIdentifier path = InstanceIdentifier.builder(Services.class) - .child(Service.class, entry.getKey()).build(); + .child(Service.class, entry.key()).build(); trySaveEntry(entry, merge, storeType, path); } @@ -441,7 +451,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC // Each entry will be identifiable by a unique key, we have to create // that identifier InstanceIdentifier path = InstanceIdentifier.builder(Services.class) - .child(Service.class, entry.getKey()).build(); + .child(Service.class, entry.key()).build(); tryDeleteEntry(storeType, path); } @@ -516,7 +526,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC // Each entry will be identifiable by a unique key, we have to create that // identifier InstanceIdentifier.InstanceIdentifierBuilder preloadListBuilder = InstanceIdentifier - .builder(PreloadInformation.class).child(PreloadList.class, entry.getKey()); + .builder(PreloadInformation.class).child(PreloadList.class, entry.key()); InstanceIdentifier path = preloadListBuilder.build(); int tries = 2; while (true) { @@ -549,7 +559,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC // Each entry will be identifiable by a unique key, we have to create // that identifier InstanceIdentifier path = InstanceIdentifier.builder(PreloadInformation.class) - .child(PreloadList.class, entry.getKey()).build(); + .child(PreloadList.class, entry.key()).build(); tryDeletePreloadListEntry(storeType, path); } @@ -582,7 +592,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC } @Override - public Future> serviceTopologyOperation( + public ListenableFuture> serviceTopologyOperation( ServiceTopologyOperationInput input) { final String svcOperation = "service-topology-operation"; @@ -779,8 +789,226 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC return input.getSdncRequestHeader() != null && input.getSdncRequestHeader().getSvcAction() != null; } + @Override - public Future> vnfTopologyOperation(VnfTopologyOperationInput input) { + public ListenableFuture> pnfTopologyOperation(PnfTopologyOperationInput input) { + + final String svcOperation = "pnf-topology-operation"; + ServiceData serviceData; + ServiceStatusBuilder serviceStatusBuilder = new ServiceStatusBuilder(); + Properties properties = new Properties(); + + log.info(CALLED_STR, svcOperation); + // create a new response object + PnfTopologyOperationOutputBuilder responseBuilder = new PnfTopologyOperationOutputBuilder(); + + if (hasInvalidServiceId(input)) { + log.debug(NULL_OR_EMPTY_ERROR_MESSAGE, svcOperation); + responseBuilder.setResponseCode("404"); + responseBuilder.setResponseMessage(NULL_OR_EMPTY_ERROR_PARAM); + responseBuilder.setAckFinalIndicator("Y"); + RpcResult rpcResult = RpcResultBuilder.status(true) + .withResult(responseBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + // Grab the service instance ID from the input buffer + String siid = input.getServiceInformation().getServiceInstanceId(); + + trySetSvcRequestId(input, responseBuilder); + + /* Comment out mandatory check for pnf id for scenario wherein for assign/create request pnf-id is generated by + SDNC itself. + if (hasInvalidPnfId(input)) { + log.debug("exiting {} because of null or empty pnf-id", svcOperation); + responseBuilder.setResponseCode("404"); + responseBuilder.setResponseMessage("invalid input, null or empty pnf-id"); + responseBuilder.setAckFinalIndicator("Y"); + + RpcResult rpcResult = RpcResultBuilder.status(true) + .withResult(responseBuilder.build()).build(); + + return Futures.immediateFuture(rpcResult); + } + */ + + String pnfId = input.getPnfDetails().getPnfId(); + ServiceDataBuilder serviceDataBuilder = new ServiceDataBuilder(); + getServiceData(siid, serviceDataBuilder); + + ServiceDataBuilder operDataBuilder = new ServiceDataBuilder(); + getServiceData(siid, operDataBuilder, LogicalDatastoreType.OPERATIONAL); + + // Set the serviceStatus based on input + setServiceStatus(serviceStatusBuilder, input.getSdncRequestHeader()); + setServiceStatus(serviceStatusBuilder, input.getRequestInformation()); + + // + // setup a service-data object builder + // ACTION pnf-topology-operation + // INPUT: + // USES sdnc-request-header; + // USES request-information; + // USES service-information; + // USES pnf-details + // OUTPUT: + // USES pnf-topology-response-body; + // USES pnf-details + // USES service-information + // + // uses oper-status; + + log.info(ADDING_INPUT_DATA_LOG, svcOperation, siid, input); + PnfTopologyOperationInputBuilder inputBuilder = new PnfTopologyOperationInputBuilder(input); + GenericResourceApiUtil.toProperties(properties, inputBuilder.build()); + + log.info(ADDING_OPERATIONAL_DATA_LOG, svcOperation, siid, operDataBuilder.build()); + GenericResourceApiUtil.toProperties(properties, OPERATIONAL_DATA_PARAM, operDataBuilder); + + // Call SLI sync method + + ResponseObject responseObject = new ResponseObject("200", ""); + String ackFinal = "Y"; + String serviceObjectPath = null; + String pnfObjectPath = null; + Properties respProps = tryGetProperties(svcOperation, properties, serviceDataBuilder, responseObject); + + if (respProps != null) { + responseObject.setMessage(respProps.getProperty(ERROR_MESSAGE_PARAM)); + responseObject.setStatusCode(respProps.getProperty(ERROR_CODE_PARAM)); + ackFinal = respProps.getProperty(ACK_FINAL_PARAM, "Y"); + if (pnfId == null) { + pnfId = respProps.getProperty("pnfId"); + } + serviceObjectPath = respProps.getProperty(SERVICE_OBJECT_PATH_PARAM); + pnfObjectPath = respProps.getProperty(PNF_OBJECT_PATH_PARAM); + } + + setServiceStatus(serviceStatusBuilder, responseObject.getStatusCode(), responseObject.getMessage(), ackFinal); + serviceStatusBuilder.setRequestStatus(RequestStatus.Synccomplete); + serviceStatusBuilder.setRpcName(svcOperation); + + if (failed(responseObject)) { + responseBuilder.setResponseCode(responseObject.getStatusCode()); + responseBuilder.setResponseMessage(responseObject.getMessage()); + responseBuilder.setAckFinalIndicator(ackFinal); + + ServiceBuilder serviceBuilder = new ServiceBuilder(); + serviceBuilder.setServiceInstanceId(siid); + serviceBuilder.setServiceStatus(serviceStatusBuilder.build()); + try { + saveService(serviceBuilder.build(), true, LogicalDatastoreType.CONFIGURATION); + trySaveService(input, serviceBuilder); + } catch (Exception e) { + log.error(UPDATING_MDSAL_ERROR_MESSAGE, svcOperation, siid, e); + } + log.error(RETURNED_FAILED_MESSAGE, svcOperation, siid, responseBuilder.build()); + + RpcResult rpcResult = RpcResultBuilder.status(true) + .withResult(responseBuilder.build()).build(); + + // return error + return Futures.immediateFuture(rpcResult); + } + + // Got success from SLI + try { + serviceData = serviceDataBuilder.build(); + log.info(UPDATING_MDSAL_INFO_MESSAGE, svcOperation, siid, serviceData); + + // service object + ServiceBuilder serviceBuilder = new ServiceBuilder(); + serviceBuilder.setServiceData(serviceData); + serviceBuilder.setServiceInstanceId(siid); + serviceBuilder.setServiceStatus(serviceStatusBuilder.build()); + saveService(serviceBuilder.build(), false, LogicalDatastoreType.CONFIGURATION); + + if (isValidRequest(input) && input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Activate)) { + // Only update operational tree on Assign + log.info(UPDATING_TREE_INFO_MESSAGE); + saveService(serviceBuilder.build(), false, LogicalDatastoreType.OPERATIONAL); + } + + ServiceResponseInformationBuilder serviceResponseInformationBuilder = new ServiceResponseInformationBuilder(); + serviceResponseInformationBuilder.setInstanceId(siid); + serviceResponseInformationBuilder.setObjectPath(serviceObjectPath); + responseBuilder.setServiceResponseInformation(serviceResponseInformationBuilder.build()); + + PnfResponseInformationBuilder pnfResponseInformationBuilder = new PnfResponseInformationBuilder(); + pnfResponseInformationBuilder.setInstanceId(pnfId); + pnfResponseInformationBuilder.setObjectPath(pnfObjectPath); + responseBuilder.setPnfResponseInformation(pnfResponseInformationBuilder.build()); + + } catch (Exception e) { + log.error(UPDATING_MDSAL_ERROR_MESSAGE, svcOperation, siid, e); + responseBuilder.setResponseCode("500"); + responseBuilder.setResponseMessage(e.getMessage()); + responseBuilder.setAckFinalIndicator("Y"); + log.error(RETURNED_FAILED_MESSAGE, svcOperation, siid, responseBuilder.build()); + + RpcResult rpcResult = RpcResultBuilder.status(true) + .withResult(responseBuilder.build()).build(); + + return Futures.immediateFuture(rpcResult); + } + + // Update succeeded + responseBuilder.setResponseCode(responseObject.getStatusCode()); + responseBuilder.setAckFinalIndicator(ackFinal); + trySetResponseMessage(responseBuilder, responseObject); + log.info(UPDATED_MDSAL_INFO_MESSAGE, svcOperation, siid); + log.info(RETURNED_SUCCESS_MESSAGE, svcOperation, siid, responseBuilder.build()); + + RpcResult rpcResult = RpcResultBuilder.status(true) + .withResult(responseBuilder.build()).build(); + + // return success + return Futures.immediateFuture(rpcResult); + } + + private void trySetResponseMessage(PnfTopologyOperationOutputBuilder responseBuilder, + ResponseObject responseObject) { + if (responseObject.getMessage() != null) { + responseBuilder.setResponseMessage(responseObject.getMessage()); + } + } + + private void trySaveService(PnfTopologyOperationInput input, ServiceBuilder serviceBuilder) { + if (isValidRequest(input) && (input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Delete) + || input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Activate))) { + + // Only update operational tree on activate or delete + log.info(UPDATING_TREE_INFO_MESSAGE); + saveService(serviceBuilder.build(), false, LogicalDatastoreType.OPERATIONAL); + } + } + + private boolean hasInvalidPnfId(PnfTopologyOperationInput input) { + return input.getPnfDetails() == null || input.getPnfDetails().getPnfId() == null + || input.getPnfDetails().getPnfId().length() == 0; + } + + private boolean hasInvalidServiceId(PnfTopologyOperationInput input) { + return input == null || input.getServiceInformation() == null + || input.getServiceInformation().getServiceInstanceId() == null + || input.getServiceInformation().getServiceInstanceId().length() == 0; + } + + private void trySetSvcRequestId(PnfTopologyOperationInput input, + PnfTopologyOperationOutputBuilder responseBuilder) { + if (input.getSdncRequestHeader() != null) { + responseBuilder.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId()); + } + } + + private boolean isValidRequest(PnfTopologyOperationInput input) { + return input.getSdncRequestHeader() != null && input.getSdncRequestHeader().getSvcAction() != null; + } + + + @Override + public ListenableFuture> vnfTopologyOperation(VnfTopologyOperationInput input) { final String svcOperation = "vnf-topology-operation"; ServiceData serviceData; @@ -869,6 +1097,9 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC responseObject.setMessage(respProps.getProperty(ERROR_MESSAGE_PARAM)); responseObject.setStatusCode(respProps.getProperty(ERROR_CODE_PARAM)); ackFinal = respProps.getProperty(ACK_FINAL_PARAM, "Y"); + if (vnfId == null) { + vnfId = respProps.getProperty("vnfId"); + } serviceObjectPath = respProps.getProperty(SERVICE_OBJECT_PATH_PARAM); vnfObjectPath = respProps.getProperty(VNF_OBJECT_PATH_PARAM); } @@ -995,7 +1226,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC } @Override - public Future> vfModuleTopologyOperation( + public ListenableFuture> vfModuleTopologyOperation( VfModuleTopologyOperationInput input) { final String svcOperation = "vf-module-topology-operation"; @@ -1030,7 +1261,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC return Futures.immediateFuture(rpcResult); } - if (hasInvalidVfModuleId(input)) { + /*if (hasInvalidVfModuleId(input)) { log.debug("exiting {} because of null or empty vf-module-id", svcOperation); responseBuilder.setResponseCode("403"); responseBuilder.setResponseMessage("invalid input, vf-module-id is null or empty"); @@ -1040,7 +1271,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC .status(true).withResult(responseBuilder.build()).build(); return Futures.immediateFuture(rpcResult); - } + }*/ // Grab the service instance ID from the input buffer String siid = input.getServiceInformation().getServiceInstanceId(); @@ -1096,6 +1327,20 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC responseObject.setStatusCode(respProps.getProperty(ERROR_CODE_PARAM)); responseObject.setMessage(respProps.getProperty(ERROR_MESSAGE_PARAM)); ackFinal = respProps.getProperty(ACK_FINAL_PARAM, "Y"); + if (vfModuleId == null) { + vfModuleId = respProps.getProperty(VF_MODULE_ID_PARAM); + if (vfModuleId == null) { + log.debug("exiting {} because vf-module-id not found in response", svcOperation); + responseBuilder.setResponseCode("403"); + responseBuilder.setResponseMessage("failed to generate vf-module-id"); + responseBuilder.setAckFinalIndicator("Y"); + + RpcResult rpcResult = RpcResultBuilder + .status(true).withResult(responseBuilder.build()).build(); + + return Futures.immediateFuture(rpcResult); + } + } serviceObjectPath = respProps.getProperty(SERVICE_OBJECT_PATH_PARAM); vnfObjectPath = respProps.getProperty(VNF_OBJECT_PATH_PARAM); vfModuleObjectPath = respProps.getProperty(VF_MODULE_OBJECT_PATH_PARAM); @@ -1228,7 +1473,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC } @Override - public Future> networkTopologyOperation( + public ListenableFuture> networkTopologyOperation( NetworkTopologyOperationInput input) { final String svcOperation = "network-topology-operation"; @@ -1374,7 +1619,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC || input.getServiceInformation().getServiceInstanceId().length() == 0; } - private Future> buildRpcResultFuture( + private ListenableFuture> buildRpcResultFuture( NetworkTopologyOperationOutputBuilder responseBuilder, String responseMessage) { responseBuilder.setResponseCode("404"); @@ -1392,7 +1637,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC } @Override - public Future> contrailRouteTopologyOperation( + public ListenableFuture> contrailRouteTopologyOperation( ContrailRouteTopologyOperationInput input) { final String svcOperation = "contrail-route-topology-operation"; @@ -1536,7 +1781,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC || input.getServiceInformation().getServiceInstanceId().length() == 0; } - private Future> buildRpcResultFuture( + private ListenableFuture> buildRpcResultFuture( ContrailRouteTopologyOperationOutputBuilder responseBuilder, String responseMessage) { responseBuilder.setResponseCode("404"); responseBuilder.setResponseMessage(responseMessage); @@ -1553,7 +1798,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC } @Override - public Future> securityZoneTopologyOperation( + public ListenableFuture> securityZoneTopologyOperation( SecurityZoneTopologyOperationInput input) { final String svcOperation = "security-zone-topology-operation"; @@ -1722,7 +1967,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC || input.getServiceInformation().getServiceInstanceId().length() == 0; } - private Future> buildRpcResultFuture( + private ListenableFuture> buildRpcResultFuture( SecurityZoneTopologyOperationOutputBuilder responseBuilder, String responseMessage) { responseBuilder.setResponseCode("404"); @@ -1760,7 +2005,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC } } - private Future> + private ListenableFuture> buildRpcResultFuture(ConnectionAttachmentTopologyOperationOutputBuilder responseBuilder, String responseMessage) { responseBuilder.setResponseCode("404"); @@ -1790,7 +2035,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC } @Override - public Future> connectionAttachmentTopologyOperation(ConnectionAttachmentTopologyOperationInput input) { + public ListenableFuture> connectionAttachmentTopologyOperation(ConnectionAttachmentTopologyOperationInput input) { final String svcOperation = "connection-attachment-topology-operation"; Properties parms = new Properties(); log.info(CALLED_STR, svcOperation); @@ -1813,7 +2058,6 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC ServiceData serviceData; ServiceStatusBuilder serviceStatusBuilder = new ServiceStatusBuilder(); - Properties properties = new Properties(); String siid = input.getServiceInformation().getServiceInstanceId(); log.info(ADDING_INPUT_DATA_LOG, svcOperation, siid, input); @@ -1841,7 +2085,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC String serviceObjectPath = null; String connectionAttachmentObjectPath = null; - Properties respProps = tryGetProperties(svcOperation, properties, serviceDataBuilder, responseObject); + Properties respProps = tryGetProperties(svcOperation, parms, serviceDataBuilder, responseObject); if (respProps != null) { responseObject.setStatusCode(respProps.getProperty(ERROR_CODE_PARAM)); @@ -1923,7 +2167,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC } @Override - public Future> tunnelxconnTopologyOperation( + public ListenableFuture> tunnelxconnTopologyOperation( TunnelxconnTopologyOperationInput input) { final String svcOperation = "tunnelxconn-topology-operation"; @@ -2054,7 +2298,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC } @Override - public Future> brgTopologyOperation(BrgTopologyOperationInput input) { + public ListenableFuture> brgTopologyOperation(BrgTopologyOperationInput input) { final String svcOperation = "brg-topology-operation"; Properties parms = new Properties(); @@ -2173,7 +2417,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC } @Override - public Future> preloadNetworkTopologyOperation( + public ListenableFuture> preloadNetworkTopologyOperation( PreloadNetworkTopologyOperationInput input) { final String svcOperation = "preload-network-topology-operation"; @@ -2274,7 +2518,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC responseBuilder.setAckFinalIndicator("Y"); log.error(RETURNED_FAILED_MESSAGE, svcOperation, preloadId, responseBuilder.build()); RpcResult rpcResult = RpcResultBuilder - .status(false).withResult(responseBuilder.build()).build(); + .status(true).withResult(responseBuilder.build()).build(); return Futures.immediateFuture(rpcResult); } @@ -2348,7 +2592,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC } @Override - public Future> preloadVfModuleTopologyOperation( + public ListenableFuture> preloadVfModuleTopologyOperation( PreloadVfModuleTopologyOperationInput input) { final String svcOperation = "preload-vf-module-topology-operation"; @@ -2453,7 +2697,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC responseBuilder.setAckFinalIndicator("Y"); log.error(RETURNED_FAILED_MESSAGE, svcOperation, preloadId, responseBuilder.build()); RpcResult rpcResult = RpcResultBuilder - .status(false).withResult(responseBuilder.build()).build(); + .status(true).withResult(responseBuilder.build()).build(); return Futures.immediateFuture(rpcResult); } @@ -2503,7 +2747,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC } @Override - public Future> genericConfigurationTopologyOperation( + public ListenableFuture> genericConfigurationTopologyOperation( GenericConfigurationTopologyOperationInput input) { final String svcOperation = "generic-configuration-topology-operation"; @@ -2678,7 +2922,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC } @Override - public Future> genericConfigurationNotification(GenericConfigurationNotificationInput input) { + public ListenableFuture> genericConfigurationNotification(GenericConfigurationNotificationInput input) { final String svcOperation = "generic-configuration-notification"; ServiceData serviceData; @@ -2733,8 +2977,11 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC } catch (Exception e) { log.error(UPDATING_MDSAL_ERROR_MESSAGE, svcOperation, siid, e); } + + + - RpcResult rpcResult = RpcResultBuilder.status(true).build(); + RpcResult rpcResult = RpcResultBuilder.status(true).build(); return Futures.immediateFuture(rpcResult); } @@ -2755,7 +3002,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC } catch (Exception e) { log.error(UPDATING_MDSAL_ERROR_MESSAGE, svcOperation, siid, e); - RpcResult rpcResult = RpcResultBuilder.status(true).build(); + RpcResult rpcResult = RpcResultBuilder.status(true).build(); return Futures.immediateFuture(rpcResult); } @@ -2763,13 +3010,13 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC // Update succeeded log.info(UPDATED_MDSAL_INFO_MESSAGE, svcOperation, siid); - RpcResult rpcResult = RpcResultBuilder.status(true).build(); + RpcResult rpcResult = RpcResultBuilder.status(true).build(); return Futures.immediateFuture(rpcResult); } @Override - public Future> getpathsegmentTopologyOperation( + public ListenableFuture> getpathsegmentTopologyOperation( GetpathsegmentTopologyOperationInput input) { final String svcOperation = "getpathsegment-topology-operation"; @@ -2934,7 +3181,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC } @Override - public Future> policyUpdateNotifyOperation( + public ListenableFuture> policyUpdateNotifyOperation( PolicyUpdateNotifyOperationInput input) { final String svcOperation = "policy-update-notify-operation"; @@ -3000,7 +3247,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC } @Override - public Future> portMirrorTopologyOperation( + public ListenableFuture> portMirrorTopologyOperation( final PortMirrorTopologyOperationInput input) { final String svcOperation = "port-mirror-topology-operation"; @@ -3289,7 +3536,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC } @Override - public Future> vnfGetResourceRequest(VnfGetResourceRequestInput input) { + public ListenableFuture> vnfGetResourceRequest(VnfGetResourceRequestInput input) { final String svcOperation = "vnf-get-resource-request"; ServiceData serviceData;