Bump upstream dependencies to Ca
[transportpce.git] / olm / src / main / java / org / opendaylight / transportpce / olm / rpc / impl / CalculateSpanlossBaseImpl.java
1 /*
2  * Copyright © 2024 Orange, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.transportpce.olm.rpc.impl;
9
10 import static java.util.Objects.requireNonNull;
11
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.CalculateSpanlossBase;
15 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.CalculateSpanlossBaseInput;
16 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.CalculateSpanlossBaseOutput;
17 import org.opendaylight.yangtools.yang.common.RpcResult;
18 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
19
20
21
22 /**
23  * This class calculates Spanloss for all Roadm to Roadm links,
24  * part of active inventory in Network Model or for newly added links
25  * based on input src-type.
26  *
27  * <p>
28  * 1. Calculate-Spanloss-Base: This operation performs following steps:
29  *    Step1: Read all Roadm-to-Roadm links from network model or get data for given linkID.
30  *    Step2: Retrieve PMs for each end point for OTS interface
31  *    Step3: Calculates Spanloss
32  *    Step4: Posts calculated spanloss in Device and in network model
33  *
34  * <p>
35  * The signature for this method was generated by yang tools from the
36  * renderer API model.
37  */
38 public class CalculateSpanlossBaseImpl implements CalculateSpanlossBase {
39     private final OlmPowerService olmPowerService;
40
41     public CalculateSpanlossBaseImpl(final OlmPowerService olmPowerService) {
42         this.olmPowerService = requireNonNull(olmPowerService);
43     }
44
45     @Override
46     public ListenableFuture<RpcResult<CalculateSpanlossBaseOutput>> invoke(CalculateSpanlossBaseInput input) {
47         return RpcResultBuilder.success(this.olmPowerService.calculateSpanlossBase(input)).buildFuture();
48     }
49
50 }