- private DeviceRendererService deviceRenderer;
- private OtnDeviceRendererService otnDeviceRendererService;
-
- public DeviceRendererRPCImpl(DeviceRendererService deviceRenderer,
- OtnDeviceRendererService otnDeviceRendererService) {
- this.deviceRenderer = deviceRenderer;
- this.otnDeviceRendererService = otnDeviceRendererService;
- }
-
- /**
- * This method is the implementation of the 'service-path' RESTCONF service,
- * which is one of the external APIs into the renderer application. The
- * service provides two functions:
- *
- * <p>
- * 1. Create This operation results in provisioning the device for a given
- * wavelength and a list of nodes with each node listing its termination
- * points.
- *
- * <p>
- * 2. Delete This operation results in de-provisioning the device for a
- * given wavelength and a list of nodes with each node listing its
- * termination points.
- *
- * <p>
- * The signature for this method was generated by yang tools from the
- * renderer API model.
- *
- * @param input
- * Input parameter from the service-path yang model
- *
- * @return Result of the request
- */
- @Override
- public ListenableFuture<RpcResult<ServicePathOutput>> servicePath(ServicePathInput input) {
- if (input.getOperation() != null) {
- if (input.getOperation().getIntValue() == 1) {
- LOG.info("Create operation request received");
- return RpcResultBuilder.success(
- this.deviceRenderer.setupServicePath(input, null))
- .buildFuture();
- } else if (input.getOperation().getIntValue() == 2) {
- LOG.info("Delete operation request received");
- return RpcResultBuilder
- .success(this.deviceRenderer.deleteServicePath(input))
- .buildFuture();
- }
- }
- return RpcResultBuilder.success(new ServicePathOutputBuilder().setResult("Invalid operation")).buildFuture();
- }
-
- @Override
- public ListenableFuture<RpcResult<OtnServicePathOutput>> otnServicePath(OtnServicePathInput input) {
- if (input.getOperation() != null && input.getServiceFormat() != null && input.getServiceRate() != null) {
- String serviceType = ServiceTypes.getOtnServiceType(input.getServiceFormat(), input.getServiceRate());
- if (input.getOperation().getIntValue() == 1) {
- LOG.info("Create operation request received");
- return RpcResultBuilder.success(this.otnDeviceRendererService
- .setupOtnServicePath(input, serviceType)).buildFuture();
- } else if (input.getOperation().getIntValue() == 2) {
- LOG.info("Delete operation request received");
- return RpcResultBuilder.success(this.otnDeviceRendererService
- .deleteOtnServicePath(input, serviceType)).buildFuture();
- }
- }
- return RpcResultBuilder.success(new OtnServicePathOutputBuilder().setResult("Invalid operation")).buildFuture();
+ private Registration reg;
+
+ @Activate
+ public DeviceRendererRPCImpl(@Reference RpcProviderService rpcProviderService,
+ @Reference DeviceRendererService deviceRenderer,
+ @Reference OtnDeviceRendererService otnDeviceRendererService) {
+ this.reg = rpcProviderService.registerRpcImplementations(
+ new ServicePathImpl(deviceRenderer),
+ new OtnServicePathImpl(otnDeviceRendererService),
+ new RendererRollbackImpl(deviceRenderer),
+ new CreateOtsOmsImpl(deviceRenderer));
+ LOG.debug("RPC of DeviceRendererRPCImpl instantiated");