2 * Copyright © 2024 Orange, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.transportpce.olm.rpc.impl;
10 import static java.util.Objects.requireNonNull;
12 import com.google.common.util.concurrent.ListenableFuture;
13 import org.opendaylight.transportpce.olm.service.OlmPowerService;
14 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.ServicePowerSetup;
15 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.ServicePowerSetupInput;
16 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.ServicePowerSetupOutput;
17 import org.opendaylight.yangtools.yang.common.RpcResult;
18 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
21 * This class is the implementation of the 'service-power-setup' RESTCONF service, which
22 * is one of the external APIs into the olm application.
25 * 1. service-power-setup: This operation performs following steps:
26 * Step1: Calculate Spanloss on all links which are part of service.
27 * TODO Step2: Calculate power levels for each Tp-Id
28 * TODO Step3: Post power values on roadm connections
31 * The signature for this method was generated by yang tools from the
34 public class ServicePowerSetupImpl implements ServicePowerSetup {
35 private final OlmPowerService olmPowerService;
37 public ServicePowerSetupImpl(final OlmPowerService olmPowerService) {
38 this.olmPowerService = requireNonNull(olmPowerService);
42 public ListenableFuture<RpcResult<ServicePowerSetupOutput>> invoke(ServicePowerSetupInput input) {
43 return RpcResultBuilder.success(this.olmPowerService.servicePowerSetup(input)).buildFuture();