diff options
author | Brandon, Bruce (bb2697) <bb2697@att.com> | 2019-07-31 16:17:27 +0000 |
---|---|---|
committer | Timoney, Dan (dt5972) <dtimoney@att.com> | 2019-07-31 14:27:00 -0400 |
commit | a1f1bbb18ab529649d0a4a006e8ab8a84d3306ae (patch) | |
tree | 449f392f42ebffd878889e683cca221ff4e88ed4 /generic-resource-api/provider/src | |
parent | ff6043832f2e4db5a6a56e8af3d00ef95833d4ec (diff) |
Network concurrency support
Add ability in network GR-API for DG to do the MD-SAL update
Change-Id: I3b94c0cfb31fc915f9c5f85c7b8e04995c446a22
Issue-ID: SDNC-826
Signed-off-by: Brandon, Bruce (bb2697) <bb2697@att.com>
Diffstat (limited to 'generic-resource-api/provider/src')
-rw-r--r-- | generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java b/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java index eedbab87..583c6335 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 @@ -1104,11 +1104,9 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC serviceObjectPath = respProps.getProperty(SERVICE_OBJECT_PATH_PARAM); vnfObjectPath = respProps.getProperty(VNF_OBJECT_PATH_PARAM); skipMdsalUpdate = respProps.getProperty(SKIP_MDSAL_UPDATE_PROP); - log.info("skipMdsalUpdate originally is " + skipMdsalUpdate); if (skipMdsalUpdate == null) { skipMdsalUpdate = "N"; } - log.info("skipMdsalUpdate is " + skipMdsalUpdate); } setServiceStatus(serviceStatusBuilder, responseObject.getStatusCode(), responseObject.getMessage(), ackFinal); @@ -1873,6 +1871,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC String networkId = ERROR_NETWORK_ID; String serviceObjectPath = null; String networkObjectPath = null; + String skipMdsalUpdate = null; Properties respProps = tryGetProperties(svcOperation, parms, serviceDataBuilder, responseObject); if (respProps != null) { @@ -1882,6 +1881,10 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC networkId = respProps.getProperty("networkId"); serviceObjectPath = respProps.getProperty(SERVICE_OBJECT_PATH_PARAM); networkObjectPath = respProps.getProperty(NETWORK_OBJECT_PATH_PARAM); + skipMdsalUpdate = respProps.getProperty(SKIP_MDSAL_UPDATE_PROP); + if (skipMdsalUpdate == null) { + skipMdsalUpdate = "N"; + } } if (failed(responseObject)) { @@ -1899,18 +1902,27 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC // Got success from SLI try { + if (skipMdsalUpdate.equals("N")) { + serviceData = serviceDataBuilder.build(); + log.info(UPDATING_MDSAL_INFO_MESSAGE, svcOperation, siid, serviceData); - 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); + // service object + ServiceBuilder serviceBuilder = new ServiceBuilder(); + serviceBuilder.setServiceData(serviceData); + serviceBuilder.setServiceInstanceId(siid); + serviceBuilder.setServiceStatus(serviceStatusBuilder.build()); + saveService(serviceBuilder.build(), false, LogicalDatastoreType.CONFIGURATION); - trySaveService(input, serviceBuilder); + trySaveService(input, serviceBuilder); + } else { + // Even if we are skipping the MD-SAL update, update the service status object + ServiceBuilder serviceBuilder = new ServiceBuilder(); + serviceBuilder.setServiceInstanceId(siid); + serviceBuilder.setServiceStatus(serviceStatusBuilder.build()); + Service service = serviceBuilder.build(); + log.info(UPDATING_MDSAL_INFO_MESSAGE, svcOperation, siid, service); + saveService(service, true, LogicalDatastoreType.CONFIGURATION); + } NetworkResponseInformationBuilder networkResponseInformationBuilder = new NetworkResponseInformationBuilder(); networkResponseInformationBuilder.setInstanceId(networkId); @@ -1921,7 +1933,6 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC serviceResponseInformationBuilder.setInstanceId(siid); serviceResponseInformationBuilder.setObjectPath(serviceObjectPath); responseBuilder.setServiceResponseInformation(serviceResponseInformationBuilder.build()); - } catch (IllegalStateException e) { log.error(UPDATING_MDSAL_ERROR_MESSAGE, svcOperation, siid, e); responseBuilder.setResponseCode("500"); |