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
8 package org.opendaylight.transportpce.olm;
10 import java.util.concurrent.Future;
11 import org.opendaylight.transportpce.olm.service.OlmPowerService;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.olm.rev170418.CalculateSpanlossBaseInput;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.olm.rev170418.CalculateSpanlossBaseOutput;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.olm.rev170418.CalculateSpanlossCurrentInput;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.olm.rev170418.CalculateSpanlossCurrentOutput;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.olm.rev170418.GetPmInput;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.olm.rev170418.GetPmOutput;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.olm.rev170418.OlmService;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.olm.rev170418.ServicePowerResetInput;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.olm.rev170418.ServicePowerResetOutput;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.olm.rev170418.ServicePowerSetupInput;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.olm.rev170418.ServicePowerSetupOutput;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.olm.rev170418.ServicePowerTurndownInput;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.olm.rev170418.ServicePowerTurndownOutput;
25 import org.opendaylight.yangtools.yang.common.RpcResult;
26 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
29 * The Class OlmPowerServiceRpcImpl.
31 public class OlmPowerServiceRpcImpl implements OlmService {
32 private final OlmPowerService olmPowerService;
34 public OlmPowerServiceRpcImpl(OlmPowerService olmPowerService) {
35 this.olmPowerService = olmPowerService;
39 * This method is the implementation of the 'get-pm' RESTCONF service, which
40 * is one of the external APIs into the olm application.
43 * 1. get-pm This operation traverse through current PM list and gets PM for
44 * given NodeId and Resource name
47 * The signature for this method was generated by yang tools from the
51 * Input parameter from the olm yang model
53 * @return Result of the request
56 public Future<RpcResult<GetPmOutput>> getPm(GetPmInput input) {
57 return RpcResultBuilder.success(olmPowerService.getPm(input)).buildFuture();
61 * This method is the implementation of the 'service-power-setup' RESTCONF service, which
62 * is one of the external APIs into the olm application.
65 * 1. service-power-setup: This operation performs following steps:
66 * Step1: Calculate Spanloss on all links which are part of service.
67 * TODO Step2: Calculate power levels for each Tp-Id
68 * TODO Step3: Post power values on roadm connections
71 * The signature for this method was generated by yang tools from the
75 * Input parameter from the olm yang model
76 * Input will contain nodeId and termination point
78 * @return Result of the request
81 public Future<org.opendaylight.yangtools.yang.common.RpcResult<ServicePowerSetupOutput>> servicePowerSetup(
82 ServicePowerSetupInput input) {
83 return RpcResultBuilder.success(olmPowerService.servicePowerSetup(input)).buildFuture();
87 * This method is the implementation of the 'service-power-trundown' RESTCONF service, which
88 * is one of the external APIs into the olm application.
91 * 1. service-power-turndown: This operation performs following steps:
92 * Step1: For each TP within Node sets interface outofservice .
93 * Step2: For each roam-connection sets power to -60dbm
94 * Step3: Turns power mode off
97 * The signature for this method was generated by yang tools from the
101 * Input parameter from the olm yang model
102 * Input will contain nodeId and termination point
104 * @return Result of the request
107 public Future<RpcResult<ServicePowerTurndownOutput>> servicePowerTurndown(ServicePowerTurndownInput input) {
108 return RpcResultBuilder.success(olmPowerService.servicePowerTurndown(input)).buildFuture();
112 * This method calculates Spanloss for all Roadm to Roadm links,
113 * part of active inventory in Network Model or for newly added links
114 * based on input src-type.
117 * 1. Calculate-Spanloss-Base: This operation performs following steps:
118 * Step1: Read all Roadm-to-Roadm links from network model or get data for given linkID.
119 * Step2: Retrieve PMs for each end point for OTS interface
120 * Step3: Calculates Spanloss
121 * Step4: Posts calculated spanloss in Device and in network model
124 * The signature for this method was generated by yang tools from the
125 * renderer API model.
128 * Input parameter from the olm yang model
129 * Input will contain SourceType and linkId if srcType is Link
131 * @return Result of the request
134 public Future<RpcResult<CalculateSpanlossBaseOutput>> calculateSpanlossBase(CalculateSpanlossBaseInput input) {
135 return RpcResultBuilder.success(olmPowerService.calculateSpanlossBase(input)).buildFuture();
139 public Future<RpcResult<CalculateSpanlossCurrentOutput>> calculateSpanlossCurrent(
140 CalculateSpanlossCurrentInput input) {
141 return RpcResultBuilder.success(olmPowerService.calculateSpanlossCurrent(input)).buildFuture();
145 public Future<RpcResult<ServicePowerResetOutput>> servicePowerReset(ServicePowerResetInput input) {
146 return RpcResultBuilder.success(olmPowerService.servicePowerReset(input)).buildFuture();