2 * Copyright © 2017 AT&T 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
9 package org.opendaylight.transportpce.olm;
11 import com.google.common.util.concurrent.ListenableFuture;
12 import org.opendaylight.transportpce.olm.service.OlmPowerService;
13 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev170418.CalculateSpanlossBaseInput;
14 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev170418.CalculateSpanlossBaseOutput;
15 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev170418.CalculateSpanlossCurrentInput;
16 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev170418.CalculateSpanlossCurrentOutput;
17 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev170418.GetPmInput;
18 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev170418.GetPmOutput;
19 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev170418.ServicePowerResetInput;
20 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev170418.ServicePowerResetOutput;
21 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev170418.ServicePowerSetupInput;
22 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev170418.ServicePowerSetupOutput;
23 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev170418.ServicePowerTurndownInput;
24 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev170418.ServicePowerTurndownOutput;
25 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev170418.TransportpceOlmService;
26 import org.opendaylight.yangtools.yang.common.RpcResult;
27 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
30 * The Class OlmPowerServiceRpcImpl.
32 public class OlmPowerServiceRpcImpl implements TransportpceOlmService {
33 private final OlmPowerService olmPowerService;
35 public OlmPowerServiceRpcImpl(OlmPowerService olmPowerService) {
36 this.olmPowerService = olmPowerService;
40 * This method is the implementation of the 'get-pm' RESTCONF service, which
41 * is one of the external APIs into the olm application.
44 * 1. get-pm This operation traverse through current PM list and gets PM for
45 * given NodeId and Resource name
48 * The signature for this method was generated by yang tools from the
52 * Input parameter from the olm yang model
54 * @return Result of the request
57 public ListenableFuture<RpcResult<GetPmOutput>> getPm(GetPmInput input) {
58 return RpcResultBuilder.success(this.olmPowerService.getPm(input)).buildFuture();
62 * This method is the implementation of the 'service-power-setup' RESTCONF service, which
63 * is one of the external APIs into the olm application.
66 * 1. service-power-setup: This operation performs following steps:
67 * Step1: Calculate Spanloss on all links which are part of service.
68 * TODO Step2: Calculate power levels for each Tp-Id
69 * TODO Step3: Post power values on roadm connections
72 * The signature for this method was generated by yang tools from the
76 * Input parameter from the olm yang model
77 * Input will contain nodeId and termination point
79 * @return Result of the request
82 public ListenableFuture<RpcResult<ServicePowerSetupOutput>> servicePowerSetup(
83 ServicePowerSetupInput input) {
84 return RpcResultBuilder.success(this.olmPowerService.servicePowerSetup(input)).buildFuture();
88 * This method is the implementation of the 'service-power-trundown' RESTCONF service, which
89 * is one of the external APIs into the olm application.
92 * 1. service-power-turndown: This operation performs following steps:
93 * Step1: For each TP within Node sets interface outofservice .
94 * Step2: For each roam-connection sets power to -60dbm
95 * Step3: Turns power mode off
98 * The signature for this method was generated by yang tools from the
102 * Input parameter from the olm yang model
103 * Input will contain nodeId and termination point
105 * @return Result of the request
108 public ListenableFuture<RpcResult<ServicePowerTurndownOutput>>
109 servicePowerTurndown(ServicePowerTurndownInput input) {
110 return RpcResultBuilder.success(this.olmPowerService.servicePowerTurndown(input)).buildFuture();
114 * This method calculates Spanloss for all Roadm to Roadm links,
115 * part of active inventory in Network Model or for newly added links
116 * based on input src-type.
119 * 1. Calculate-Spanloss-Base: This operation performs following steps:
120 * Step1: Read all Roadm-to-Roadm links from network model or get data for given linkID.
121 * Step2: Retrieve PMs for each end point for OTS interface
122 * Step3: Calculates Spanloss
123 * Step4: Posts calculated spanloss in Device and in network model
126 * The signature for this method was generated by yang tools from the
127 * renderer API model.
130 * Input parameter from the olm yang model
131 * Input will contain SourceType and linkId if srcType is Link
133 * @return Result of the request
136 public ListenableFuture<RpcResult<CalculateSpanlossBaseOutput>>
137 calculateSpanlossBase(CalculateSpanlossBaseInput input) {
138 return RpcResultBuilder.success(this.olmPowerService.calculateSpanlossBase(input)).buildFuture();
142 public ListenableFuture<RpcResult<CalculateSpanlossCurrentOutput>> calculateSpanlossCurrent(
143 CalculateSpanlossCurrentInput input) {
144 return RpcResultBuilder.success(this.olmPowerService.calculateSpanlossCurrent(input)).buildFuture();
148 public ListenableFuture<RpcResult<ServicePowerResetOutput>> servicePowerReset(ServicePowerResetInput input) {
149 return RpcResultBuilder.success(this.olmPowerService.servicePowerReset(input)).buildFuture();