X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=renderer%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Ftransportpce%2Frenderer%2Fprovisiondevice%2FRendererServiceOperationsImpl.java;h=a449876a3aa12bd3d7457041756b63c7a03c06ac;hb=b1b3bafd549bb501937cea5c976d5344608b6ed3;hp=a4053de0fe45d665c529fa0682e0b34f2277cf0b;hpb=49ce2e7166b83268dd637ada6ba5421cd08cf2a1;p=transportpce.git diff --git a/renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/RendererServiceOperationsImpl.java b/renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/RendererServiceOperationsImpl.java index a4053de0f..a449876a3 100644 --- a/renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/RendererServiceOperationsImpl.java +++ b/renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/RendererServiceOperationsImpl.java @@ -24,6 +24,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.stream.Collectors; import org.opendaylight.mdsal.binding.api.DataBroker; +import org.opendaylight.mdsal.binding.api.RpcService; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.transportpce.common.ResponseCodes; import org.opendaylight.transportpce.common.StringConstants; @@ -48,10 +49,12 @@ import org.opendaylight.transportpce.renderer.provisiondevice.transaction.histor import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.Action; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.OtnServicePathInput; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev220630.OtnLinkType; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.GetPm; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.GetPmInputBuilder; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.GetPmOutput; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.ServicePowerSetup; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.ServicePowerSetupInput; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.TransportpceOlmService; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.ServicePowerTurndown; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.get.pm.output.Measurements; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteInput; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteOutput; @@ -102,25 +105,25 @@ public class RendererServiceOperationsImpl implements RendererServiceOperations private final DeviceRendererService deviceRenderer; private final OtnDeviceRendererService otnDeviceRenderer; - private final TransportpceOlmService olmService; private final DataBroker dataBroker; private final Notification notification; private final PortMapping portMapping; + private final RpcService rpcService; private ListeningExecutorService executor; @Activate public RendererServiceOperationsImpl(@Reference DeviceRendererService deviceRenderer, @Reference OtnDeviceRendererService otnDeviceRenderer, - @Reference TransportpceOlmService olmService, @Reference DataBroker dataBroker, @Reference Notification notification, - @Reference PortMapping portMapping) { + @Reference PortMapping portMapping, + @Reference RpcService rpcService) { this.deviceRenderer = deviceRenderer; this.otnDeviceRenderer = otnDeviceRenderer; - this.olmService = olmService; this.dataBroker = dataBroker; this.notification = notification; this.portMapping = portMapping; + this.rpcService = rpcService; this.executor = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(NUMBER_OF_THREADS)); LOG.debug("RendererServiceOperationsImpl instantiated"); } @@ -487,7 +490,8 @@ public class RendererServiceOperationsImpl implements RendererServiceOperations RpcStatusEx.Pending, "Olm power setup A-Z"); ListenableFuture olmPowerSetupFutureAtoZ = - this.executor.submit(new OlmPowerSetupTask(this.olmService, powerSetupInputAtoZ)); + this.executor.submit( + new OlmPowerSetupTask(rpcService.getRpc(ServicePowerSetup.class), powerSetupInputAtoZ)); LOG.info("OLM power setup Z-A"); sendNotifications( @@ -496,7 +500,8 @@ public class RendererServiceOperationsImpl implements RendererServiceOperations RpcStatusEx.Pending, "Olm power setup Z-A"); ListenableFuture olmPowerSetupFutureZtoA = - this.executor.submit(new OlmPowerSetupTask(this.olmService, powerSetupInputZtoA)); + this.executor.submit( + new OlmPowerSetupTask(rpcService.getRpc(ServicePowerSetup.class), powerSetupInputZtoA)); ListenableFuture> olmFutures = Futures.allAsList(olmPowerSetupFutureAtoZ, olmPowerSetupFutureZtoA); @@ -512,23 +517,19 @@ public class RendererServiceOperationsImpl implements RendererServiceOperations RpcStatusEx.Pending, OLM_ROLL_BACK_MSG); rollbackProcessor.addTask( - new OlmPowerSetupRollbackTask("AtoZOLMTask", true, this.olmService, powerSetupInputAtoZ)); + new OlmPowerSetupRollbackTask("AtoZOLMTask", true, rpcService.getRpc(ServicePowerTurndown.class), + powerSetupInputAtoZ)); rollbackProcessor.addTask( - new OlmPowerSetupRollbackTask("ZtoAOLMTask", true, this.olmService, powerSetupInputZtoA)); + new OlmPowerSetupRollbackTask("ZtoAOLMTask", true, rpcService.getRpc(ServicePowerTurndown.class), + powerSetupInputZtoA)); return; } - rollbackProcessor.addTask( - new OlmPowerSetupRollbackTask( - "AtoZOLMTask", - !olmResults.get(0).isSuccess(), - this.olmService, - powerSetupInputAtoZ)); - rollbackProcessor.addTask( - new OlmPowerSetupRollbackTask( - "ZtoAOLMTask", - !olmResults.get(1).isSuccess(), - this.olmService, - powerSetupInputZtoA)); + rollbackProcessor.addTask(new OlmPowerSetupRollbackTask( + "AtoZOLMTask", !olmResults.get(0).isSuccess(), rpcService.getRpc(ServicePowerTurndown.class), + powerSetupInputAtoZ)); + rollbackProcessor.addTask(new OlmPowerSetupRollbackTask( + "ZtoAOLMTask", !olmResults.get(1).isSuccess(), rpcService.getRpc(ServicePowerTurndown.class), + powerSetupInputZtoA)); } @SuppressFBWarnings( @@ -557,9 +558,7 @@ public class RendererServiceOperationsImpl implements RendererServiceOperations private List getMeasurements(String nodeId, String tp) { try { - GetPmOutput getPmOutput = - this.olmService - .getPm( + GetPmOutput getPmOutput = rpcService.getRpc(GetPm.class).invoke( new GetPmInputBuilder() .setNodeId(nodeId) .setGranularity(PmGranularity._15min) @@ -704,27 +703,11 @@ public class RendererServiceOperationsImpl implements RendererServiceOperations ServicePathInputData servicePathInputDataZtoA = ModelMappingUtils.rendererCreateServiceInputZToA(serviceName, pathDescription, Action.Delete); - ListenableFuture olmPowerTurnDownFutureAtoZ = - this.executor.submit( - new OlmPowerTurnDownTask( - serviceName, - ATOZPATH, - olmService, - servicePathInputDataAtoZ, - notification - ) - ); + ListenableFuture olmPowerTurnDownFutureAtoZ = this.executor.submit( + new OlmPowerTurnDownTask(serviceName, ATOZPATH, servicePathInputDataAtoZ, notification, rpcService)); - ListenableFuture olmPowerTurnDownFutureZtoA = - this.executor.submit( - new OlmPowerTurnDownTask( - serviceName, - ZTOAPATH, - olmService, - servicePathInputDataZtoA, - notification - ) - ); + ListenableFuture olmPowerTurnDownFutureZtoA = this.executor.submit( + new OlmPowerTurnDownTask(serviceName, ZTOAPATH, servicePathInputDataZtoA, notification, rpcService)); ListenableFuture> olmPowerTurnDownFutures = Futures.allAsList(olmPowerTurnDownFutureAtoZ, olmPowerTurnDownFutureZtoA);