Disable optical control mode for temp service 22/106122/5
authorBalagangadhar (Bala) Bathula <bb4341@att.com>
Fri, 19 May 2023 17:37:39 +0000 (13:37 -0400)
committerguillaume.lambert <guillaume.lambert@orange.com>
Mon, 5 Jun 2023 07:09:25 +0000 (09:09 +0200)
- Currently, when a temp-service is created, all
  the interfaces are pushed to the NE.
- If roadm-connections (crossconnets) are created without
  the ingress power-power, it would create alarms.
- For temp-service create, we keep the optical-control-mode
  in "off" state

Signed-off-by: Balagangadhar (Bala) Bathula <bb4341@att.com>
Change-Id: I9ccf6a9da74ff040a988ed86d3089e5b5a38060c

renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/RendererServiceOperations.java
renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/RendererServiceOperationsImpl.java
renderer/src/main/java/org/opendaylight/transportpce/renderer/rpcs/TransportPCEServicePathRPCImpl.java
renderer/src/test/java/org/opendaylight/transportpce/renderer/provisiondevice/RendererServiceOperationsImplTest.java
servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/impl/ServicehandlerImpl.java
servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/listeners/PceListenerImpl.java

index e71e4fce63743f4532a59f28697ba830b641ef52..cea8271574b03f1412faca3e164268f2a7ad028f 100644 (file)
@@ -16,7 +16,8 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service
 
 public interface RendererServiceOperations {
 
-    ListenableFuture<ServiceImplementationRequestOutput> serviceImplementation(ServiceImplementationRequestInput input);
+    ListenableFuture<ServiceImplementationRequestOutput> serviceImplementation(ServiceImplementationRequestInput input,
+                                                                               boolean isTempService);
 
     ListenableFuture<ServiceDeleteOutput> serviceDelete(ServiceDeleteInput input, Services service);
 }
index 0f5df80459e51c6ac3c70b78e527d3c302b82eea..486b321120021d6ead5d672b509f683df3e76195 100644 (file)
@@ -126,8 +126,9 @@ public class RendererServiceOperationsImpl implements RendererServiceOperations
 
     @Override
     public ListenableFuture<ServiceImplementationRequestOutput>
-            serviceImplementation(ServiceImplementationRequestInput input) {
+            serviceImplementation(ServiceImplementationRequestInput input, boolean isTempService) {
         LOG.info("Calling service impl request {}", input.getServiceName());
+        LOG.debug("Check if it is temp-service {}", isTempService);
         return executor.submit(new Callable<ServiceImplementationRequestOutput>() {
 
             @Override
@@ -163,7 +164,8 @@ public class RendererServiceOperationsImpl implements RendererServiceOperations
                     case StringConstants.SERVICE_TYPE_OTUC2:
                     case StringConstants.SERVICE_TYPE_OTUC3:
                     case StringConstants.SERVICE_TYPE_OTUC4:
-                        if (!manageServicePathCreation(input, serviceType)) {
+                        LOG.debug("Check temp service {}", isTempService);
+                        if (!manageServicePathCreation(input, serviceType, isTempService)) {
                             return ModelMappingUtils
                                 .createServiceImplResponse(ResponseCodes.RESPONSE_FAILED, OPERATION_FAILED);
                         }
@@ -477,31 +479,35 @@ public class RendererServiceOperationsImpl implements RendererServiceOperations
     private void olmPowerSetup(
             RollbackProcessor rollbackProcessor,
             ServicePowerSetupInput powerSetupInputAtoZ,
-            ServicePowerSetupInput powerSetupInputZtoA) {
+            ServicePowerSetupInput powerSetupInputZtoA, boolean isTempService) {
 
         //TODO olmPowerSetupFutureAtoZ & olmPowerSetupFutureZtoA & olmFutures used only once
         //     Do notifications & LOG.info deserve this ?
         //TODO use constants for LOG.info & notifications common messages
+        // if the service create is a temp-service, OLM will be skipped
+        if (isTempService) {
+            LOG.info("For temp-service create OLM is not computed and skipped");
+            return;
+        }
         LOG.info("Olm power setup A-Z");
         sendNotifications(
-            ServicePathNotificationTypes.ServiceImplementationRequest,
-            powerSetupInputAtoZ.getServiceName(),
-            RpcStatusEx.Pending,
-            "Olm power setup A-Z");
+                ServicePathNotificationTypes.ServiceImplementationRequest,
+                powerSetupInputAtoZ.getServiceName(),
+                RpcStatusEx.Pending,
+                "Olm power setup A-Z");
         ListenableFuture<OLMRenderingResult> olmPowerSetupFutureAtoZ =
-            this.executor.submit(new OlmPowerSetupTask(this.olmService, powerSetupInputAtoZ));
+                this.executor.submit(new OlmPowerSetupTask(this.olmService, powerSetupInputAtoZ));
 
         LOG.info("OLM power setup Z-A");
         sendNotifications(
-            ServicePathNotificationTypes.ServiceImplementationRequest,
-            powerSetupInputAtoZ.getServiceName(),
-            RpcStatusEx.Pending,
-            "Olm power setup Z-A");
+                ServicePathNotificationTypes.ServiceImplementationRequest,
+                powerSetupInputAtoZ.getServiceName(),
+                RpcStatusEx.Pending,
+                "Olm power setup Z-A");
         ListenableFuture<OLMRenderingResult> olmPowerSetupFutureZtoA =
-            this.executor.submit(new OlmPowerSetupTask(this.olmService, powerSetupInputZtoA));
-
+                this.executor.submit(new OlmPowerSetupTask(this.olmService, powerSetupInputZtoA));
         ListenableFuture<List<OLMRenderingResult>> olmFutures =
-            Futures.allAsList(olmPowerSetupFutureAtoZ, olmPowerSetupFutureZtoA);
+                Futures.allAsList(olmPowerSetupFutureAtoZ, olmPowerSetupFutureZtoA);
 
         List<OLMRenderingResult> olmResults;
         try {
@@ -510,29 +516,28 @@ public class RendererServiceOperationsImpl implements RendererServiceOperations
         } catch (InterruptedException | ExecutionException | TimeoutException e) {
             LOG.warn(OLM_ROLL_BACK_MSG, e);
             sendNotifications(
-                ServicePathNotificationTypes.ServiceImplementationRequest,
-                powerSetupInputAtoZ.getServiceName(),
-                RpcStatusEx.Pending,
-                OLM_ROLL_BACK_MSG);
+                    ServicePathNotificationTypes.ServiceImplementationRequest,
+                    powerSetupInputAtoZ.getServiceName(),
+                    RpcStatusEx.Pending,
+                    OLM_ROLL_BACK_MSG);
             rollbackProcessor.addTask(
-                new OlmPowerSetupRollbackTask("AtoZOLMTask", true, this.olmService, powerSetupInputAtoZ));
+                    new OlmPowerSetupRollbackTask("AtoZOLMTask", true, this.olmService, powerSetupInputAtoZ));
             rollbackProcessor.addTask(
-                new OlmPowerSetupRollbackTask("ZtoAOLMTask", true, this.olmService, powerSetupInputZtoA));
+                    new OlmPowerSetupRollbackTask("ZtoAOLMTask", true, this.olmService, powerSetupInputZtoA));
             return;
         }
-
         rollbackProcessor.addTask(
-            new OlmPowerSetupRollbackTask(
-                "AtoZOLMTask",
-                olmResults.get(0).isSuccess(),
-                this.olmService,
-                powerSetupInputAtoZ));
+                new OlmPowerSetupRollbackTask(
+                        "AtoZOLMTask",
+                        !olmResults.get(0).isSuccess(),
+                        this.olmService,
+                        powerSetupInputAtoZ));
         rollbackProcessor.addTask(
-            new OlmPowerSetupRollbackTask(
-                "ZtoAOLMTask",
-                olmResults.get(1).isSuccess(),
-                this.olmService,
-                powerSetupInputZtoA));
+                new OlmPowerSetupRollbackTask(
+                        "ZtoAOLMTask",
+                        !olmResults.get(1).isSuccess(),
+                        this.olmService,
+                        powerSetupInputZtoA));
     }
 
     @edu.umd.cs.findbugs.annotations.SuppressFBWarnings(
@@ -621,7 +626,8 @@ public class RendererServiceOperationsImpl implements RendererServiceOperations
     @edu.umd.cs.findbugs.annotations.SuppressFBWarnings(
         value = "UPM_UNCALLED_PRIVATE_METHOD",
         justification = "call in call() method")
-    private boolean manageServicePathCreation(ServiceImplementationRequestInput input, String serviceType) {
+    private boolean manageServicePathCreation(ServiceImplementationRequestInput input, String serviceType,
+                                              boolean isTempService) {
         ServicePathInputData servicePathInputDataAtoZ =
             ModelMappingUtils
                 .rendererCreateServiceInputAToZ(input.getServiceName(), input.getPathDescription(), Action.Create);
@@ -645,7 +651,7 @@ public class RendererServiceOperationsImpl implements RendererServiceOperations
             //olmPowerSetupInputAtoZ,
             ModelMappingUtils.createServicePowerSetupInput(renderingResults.get(0).getOlmList(), input),
             //olmPowerSetupInputZtoA
-            ModelMappingUtils.createServicePowerSetupInput(renderingResults.get(1).getOlmList(), input));
+            ModelMappingUtils.createServicePowerSetupInput(renderingResults.get(1).getOlmList(), input), isTempService);
         if (rollbackProcessor.rollbackAllIfNecessary() > 0) {
             sendNotifications(
                 ServicePathNotificationTypes.ServiceImplementationRequest,
index f43204df44b584719ad9320b805325d120692236..73629ec779e0cf5d6058fdd3c80af5adc4881792 100644 (file)
@@ -56,7 +56,7 @@ public class TransportPCEServicePathRPCImpl implements TransportpceRendererServi
         LOG.info("Calling RPC service impl request {}", serviceName);
         ServiceImplementationRequestOutput output = null;
         try {
-            output = this.rendererServiceOperations.serviceImplementation(input).get();
+            output = this.rendererServiceOperations.serviceImplementation(input, false).get();
         } catch (InterruptedException | ExecutionException e) {
             LOG.error("RPC service implementation failed !", e);
         }
index 6d1d0f926833202c4d99307e8c566d85ae9d3557..63e347868f6cf6dd6ae3fb91136a1007e0772fbc 100644 (file)
@@ -102,7 +102,8 @@ public class RendererServiceOperationsImplTest extends AbstractTest {
         ServicePathOutputBuilder mockOutputBuilder = new ServicePathOutputBuilder().setResult("success")
             .setSuccess(true);
         doReturn(mockOutputBuilder.build()).when(this.deviceRenderer).setupServicePath(any(), any());
-        ServiceImplementationRequestOutput result = this.rendererServiceOperations.serviceImplementation(input).get();
+        ServiceImplementationRequestOutput result =
+                this.rendererServiceOperations.serviceImplementation(input, false).get();
         assertEquals(ResponseCodes.RESPONSE_OK, result.getConfigurationResponseCommon().getResponseCode());
     }
 
@@ -114,7 +115,8 @@ public class RendererServiceOperationsImplTest extends AbstractTest {
             .setSuccess(true);
         doReturn(mockOutputBuilder.build()).when(this.deviceRenderer).setupServicePath(any(), any());
         doReturn(RpcResultBuilder.failed().buildFuture()).when(this.olmService).servicePowerSetup(any());
-        ServiceImplementationRequestOutput result = this.rendererServiceOperations.serviceImplementation(input).get();
+        ServiceImplementationRequestOutput result =
+                this.rendererServiceOperations.serviceImplementation(input, false).get();
         assertEquals(ResponseCodes.RESPONSE_FAILED, result.getConfigurationResponseCommon().getResponseCode());
     }
 
@@ -125,7 +127,8 @@ public class RendererServiceOperationsImplTest extends AbstractTest {
         ServicePathOutputBuilder mockOutputBuilder = new ServicePathOutputBuilder().setResult("success")
             .setSuccess(true);
         doReturn(mockOutputBuilder.build()).when(this.deviceRenderer).setupServicePath(any(), any());
-        ServiceImplementationRequestOutput result = this.rendererServiceOperations.serviceImplementation(input).get();
+        ServiceImplementationRequestOutput result = this.rendererServiceOperations.serviceImplementation(input,
+                false).get();
         assertEquals(ResponseCodes.RESPONSE_OK, result.getConfigurationResponseCommon().getResponseCode());
     }
 
@@ -136,7 +139,8 @@ public class RendererServiceOperationsImplTest extends AbstractTest {
         ServicePathOutputBuilder mockOutputBuilder = new ServicePathOutputBuilder().setResult("success")
             .setSuccess(true);
         doReturn(mockOutputBuilder.build()).when(this.deviceRenderer).setupServicePath(any(), any());
-        ServiceImplementationRequestOutput result = this.rendererServiceOperations.serviceImplementation(input).get();
+        ServiceImplementationRequestOutput result = this.rendererServiceOperations.serviceImplementation(input,
+                false).get();
         assertEquals(ResponseCodes.RESPONSE_OK, result.getConfigurationResponseCommon().getResponseCode());
     }
 
@@ -147,7 +151,8 @@ public class RendererServiceOperationsImplTest extends AbstractTest {
         ServicePathOutputBuilder mockOutputBuilder = new ServicePathOutputBuilder().setResult("success")
             .setSuccess(true);
         doReturn(mockOutputBuilder.build()).when(this.deviceRenderer).setupServicePath(any(), any());
-        ServiceImplementationRequestOutput result = this.rendererServiceOperations.serviceImplementation(input).get();
+        ServiceImplementationRequestOutput result = this.rendererServiceOperations.serviceImplementation(input,
+                false).get();
         assertEquals(ResponseCodes.RESPONSE_OK, result.getConfigurationResponseCommon().getResponseCode());
     }
 
@@ -167,7 +172,8 @@ public class RendererServiceOperationsImplTest extends AbstractTest {
         for (String tpToken : interfaceTokens) {
             ServiceImplementationRequestInput input = ServiceDataUtils
                 .buildServiceImplementationRequestInputTerminationPointResource(tpToken);
-            ServiceImplementationRequestOutput result = this.rendererServiceOperations.serviceImplementation(input)
+            ServiceImplementationRequestOutput result = this.rendererServiceOperations.serviceImplementation(input,
+                            false)
                 .get();
             assertEquals(ResponseCodes.RESPONSE_FAILED, result.getConfigurationResponseCommon().getResponseCode());
         }
@@ -179,7 +185,8 @@ public class RendererServiceOperationsImplTest extends AbstractTest {
             .buildServiceImplementationRequestInputTerminationPointResource(StringConstants.NETWORK_TOKEN);
 //        writePortMapping(input, StringConstants.NETWORK_TOKEN);
         doReturn(RpcResultBuilder.failed().buildFuture()).when(this.olmService).servicePowerSetup(any());
-        ServiceImplementationRequestOutput result = this.rendererServiceOperations.serviceImplementation(input).get();
+        ServiceImplementationRequestOutput result = this.rendererServiceOperations.serviceImplementation(input,
+                false).get();
         assertEquals(ResponseCodes.RESPONSE_FAILED, result.getConfigurationResponseCommon().getResponseCode());
     }
 
@@ -197,7 +204,8 @@ public class RendererServiceOperationsImplTest extends AbstractTest {
                 .setMeasurements(measurementsList)
                 .build();
         doReturn(RpcResultBuilder.success(getPmOutput).buildFuture()).when(this.olmService).getPm(any());
-        ServiceImplementationRequestOutput result = this.rendererServiceOperations.serviceImplementation(input).get();
+        ServiceImplementationRequestOutput result = this.rendererServiceOperations.serviceImplementation(input,
+                false).get();
         assertEquals(ResponseCodes.RESPONSE_FAILED, result.getConfigurationResponseCommon().getResponseCode());
     }
 
@@ -216,7 +224,8 @@ public class RendererServiceOperationsImplTest extends AbstractTest {
                 .build();
 
         when(this.olmService.getPm(any())).thenReturn(RpcResultBuilder.success(getPmOutput).buildFuture());
-        ServiceImplementationRequestOutput result = this.rendererServiceOperations.serviceImplementation(input).get();
+        ServiceImplementationRequestOutput result = this.rendererServiceOperations.serviceImplementation(input,
+                false).get();
         assertEquals(ResponseCodes.RESPONSE_FAILED, result.getConfigurationResponseCommon().getResponseCode());
     }
 
@@ -241,7 +250,8 @@ public class RendererServiceOperationsImplTest extends AbstractTest {
         doReturn(mockOutputBuilder.build()).when(this.deviceRenderer).setupServicePath(any(), any());
         ServiceImplementationRequestInput input = ServiceDataUtils
             .buildServiceImplementationRequestInputTerminationPointResource(StringConstants.NETWORK_TOKEN);
-        ServiceImplementationRequestOutput result = this.rendererServiceOperations.serviceImplementation(input).get();
+        ServiceImplementationRequestOutput result = this.rendererServiceOperations.serviceImplementation(input,
+                false).get();
         assertEquals(ResponseCodes.RESPONSE_OK, result.getConfigurationResponseCommon().getResponseCode());
     }
 
@@ -254,7 +264,8 @@ public class RendererServiceOperationsImplTest extends AbstractTest {
         ServicePathOutputBuilder mockOutputBuilder = new ServicePathOutputBuilder().setResult("success")
             .setSuccess(true);
         doReturn(mockOutputBuilder.build()).when(this.deviceRenderer).setupServicePath(any(), any());
-        ServiceImplementationRequestOutput result = this.rendererServiceOperations.serviceImplementation(input).get();
+        ServiceImplementationRequestOutput result = this.rendererServiceOperations.serviceImplementation(input,
+                false).get();
         assertEquals(ResponseCodes.RESPONSE_OK, result.getConfigurationResponseCommon().getResponseCode());
     }
 
@@ -267,7 +278,8 @@ public class RendererServiceOperationsImplTest extends AbstractTest {
         ServicePathOutputBuilder mockOutputBuilder = new ServicePathOutputBuilder().setResult("success")
             .setSuccess(true);
         doReturn(mockOutputBuilder.build()).when(this.deviceRenderer).setupServicePath(any(), any());
-        ServiceImplementationRequestOutput result = this.rendererServiceOperations.serviceImplementation(input).get();
+        ServiceImplementationRequestOutput result = this.rendererServiceOperations.serviceImplementation(input,
+                false).get();
         assertEquals(ResponseCodes.RESPONSE_OK, result.getConfigurationResponseCommon().getResponseCode());
     }
 
@@ -289,7 +301,8 @@ public class RendererServiceOperationsImplTest extends AbstractTest {
         doReturn(mockOutputBuilder.build()).when(this.deviceRenderer).setupServicePath(any(), any());
         ServiceImplementationRequestInput input = ServiceDataUtils
             .buildServiceImplementationRequestInputTerminationPointResource(StringConstants.NETWORK_TOKEN);
-        ServiceImplementationRequestOutput result = this.rendererServiceOperations.serviceImplementation(input).get();
+        ServiceImplementationRequestOutput result = this.rendererServiceOperations.serviceImplementation(input,
+                false).get();
         assertEquals(ResponseCodes.RESPONSE_OK, result.getConfigurationResponseCommon().getResponseCode());
     }
 
@@ -308,7 +321,8 @@ public class RendererServiceOperationsImplTest extends AbstractTest {
                 .build();
 
         doReturn(RpcResultBuilder.success(getPmOutput).buildFuture()).when(this.olmService).getPm(any());
-        ServiceImplementationRequestOutput result = this.rendererServiceOperations.serviceImplementation(input).get();
+        ServiceImplementationRequestOutput result = this.rendererServiceOperations.serviceImplementation(input,
+                false).get();
         assertEquals(ResponseCodes.RESPONSE_FAILED, result.getConfigurationResponseCommon().getResponseCode());
     }
 
index 90b7f7a173fbacddad755b0fd6b30c342434f8b8..42d7ed6059541e41a46841560d5e5a87b1dc25a3 100644 (file)
@@ -244,6 +244,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService {
         }
         this.pceListenerImpl.setInput(new ServiceInput(input));
         this.pceListenerImpl.setServiceReconfigure(false);
+        this.pceListenerImpl.setTempService(false);
         this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
         this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
         this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
index 8d1b4a35f226a23511543b5e96269997503013c6..097e258235d2278c3836db85f42de1f8b20a07d4 100644 (file)
@@ -153,7 +153,8 @@ public class PceListenerImpl implements TransportpcePceListener, PceListener {
         ServiceImplementationRequestInput serviceImplementationRequest =
             ModelMappingUtils.createServiceImplementationRequest(input, pathDescription);
         LOG.info("Sending serviceImplementation request : {}", serviceImplementationRequest);
-        this.rendererServiceOperations.serviceImplementation(serviceImplementationRequest);
+        LOG.debug("Temp-service value is {}", tempService);
+        this.rendererServiceOperations.serviceImplementation(serviceImplementationRequest, tempService);
     }
 
     /**