Update temp-service-list 68/107068/1
authorBalagangadhar (Bala) Bathula <bb4341@att.com>
Tue, 25 Jul 2023 19:49:40 +0000 (15:49 -0400)
committerBalagangadhar (Bala) Bathula <bb4341@att.com>
Tue, 25 Jul 2023 19:57:14 +0000 (15:57 -0400)
- If a service is implemented using service-create RPC and
  there exists an assoicated temp-service, then the temp-service-list
  needs to updated.
- Using commonId as the key, update the temp-service-list after the
  service is implmented (succeeds and becomes operational).

JIRA: TRNSPRTPCE-749
Signed-off-by: Balagangadhar (Bala) Bathula <bb4341@att.com>
Change-Id: I04b0652779dd620e4e86bcb3ccdd75743f90b177

servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/listeners/RendererListenerImpl.java

index 5ded8540ec39b00527bd865f44237f7c6e697b05..adc23ae083dfd611c8d7bda3667cc47ceb981ac8 100644 (file)
@@ -198,6 +198,17 @@ public class RendererListenerImpl implements TransportpceRendererListener, Rende
         } else {
             OperationResult operationResult = this.serviceDataStoreOperations.modifyService(
                     serviceRpcResultSp.getServiceName(), State.InService, AdminStates.InService);
+            // Here the service is implemented and the tempService has to be deleted if present
+            String commonId = input.getCommonId();
+            if (commonId != null) {
+                if (this.serviceDataStoreOperations.getTempService(commonId).isPresent()) {
+                    LOG.info("Temp-service exists with the common-Id {}", commonId);
+                    // Delete the common-id from this temp-service-list here
+                    OperationResult tempServiceListDelete = serviceDataStoreOperations.deleteTempService(commonId);
+                    LOG.info("Result for temp-service-list with {} is {}", commonId, tempServiceListDelete);
+                }
+            }
+
             if (operationResult.isSuccess()) {
                 sendNbiNotification(nbiNotificationBuilder
                     .setResponseFailed("")