blob: 0b31e71fecd935707ebfb8dbe9046e0c84f8b4e3 [file] [log] [blame]
Jimmy Yanda878fc2016-09-02 16:32:01 -07001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2016-present Open Networking Foundation
Jimmy Yanda878fc2016-09-02 16:32:01 -07003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.roadm;
17
18import com.google.common.collect.Range;
Andrea Campanella7ebfe322019-08-29 11:46:57 -070019import org.onlab.util.Frequency;
MaoLu2846b112017-05-15 17:18:55 -070020import org.onosproject.net.ConnectPoint;
Jimmy Yanda878fc2016-09-02 16:32:01 -070021import org.onosproject.net.DeviceId;
Andrea Campanellabdeeda12019-08-02 16:12:05 +020022import org.onosproject.net.ModulationScheme;
Jimmy Yanda878fc2016-09-02 16:32:01 -070023import org.onosproject.net.OchSignal;
24import org.onosproject.net.PortNumber;
MaoLu2846b112017-05-15 17:18:55 -070025import org.onosproject.net.behaviour.protection.ProtectedTransportEndpointState;
Jimmy Yanda878fc2016-09-02 16:32:01 -070026import org.onosproject.net.flow.FlowId;
27
MaoLu2846b112017-05-15 17:18:55 -070028import java.util.Map;
Jimmy Yanda878fc2016-09-02 16:32:01 -070029import java.util.Set;
30
31/**
32 * ROADM service interface. Provides an interface for ROADM power configuration.
Andrea Campanella7ebfe322019-08-29 11:46:57 -070033 * <p>
Jimmy Yanda878fc2016-09-02 16:32:01 -070034 * This application relies on the PowerConfig and LambdaQuery behaviours.
Andrea Campanella7ebfe322019-08-29 11:46:57 -070035 * <p>
Jimmy Yanda878fc2016-09-02 16:32:01 -070036 * The device's PowerConfig implementation should be parameterized as
37 * {@code PowerConfig<Object>} in order to support both Direction and OchSignal.
38 * For a reference implementation of PowerConfig, please see
39 * OplinkRoadmPowerConfig
Andrea Campanella7ebfe322019-08-29 11:46:57 -070040 * <p>
Jimmy Yanda878fc2016-09-02 16:32:01 -070041 * In this application, a "connection" refers to the selection of a channel
42 * to direct from an input to an output port. Connections are implemented
43 * using FlowRules with an input port selector, optical channel selector,
44 * and output port treatment (see RoadmManager#createConnection()).
Andrea Campanella7ebfe322019-08-29 11:46:57 -070045 * <p>
Jimmy Yanda878fc2016-09-02 16:32:01 -070046 * This application currently only supports fixed grid channels.
47 */
48public interface RoadmService {
49
50 /**
MaoLu937cf422017-03-03 23:31:46 -080051 * Attempts to manually switch working path to the one specified by {@code index}.
52 *
53 * @param deviceId DeviceId of the device to configure
Andrea Campanella7ebfe322019-08-29 11:46:57 -070054 * @param index working path index to switch to
MaoLu2846b112017-05-15 17:18:55 -070055 * @deprecated 1.11.0
MaoLu937cf422017-03-03 23:31:46 -080056 */
MaoLu2846b112017-05-15 17:18:55 -070057 @Deprecated
MaoLu937cf422017-03-03 23:31:46 -080058 void setProtectionSwitchWorkingPath(DeviceId deviceId, int index);
59
60 /**
61 * Retrieves protection switch specified port's service status.
62 *
Andrea Campanella7ebfe322019-08-29 11:46:57 -070063 * @param deviceId DeviceId of the device to configure
MaoLu937cf422017-03-03 23:31:46 -080064 * @param portNumber the port
65 * @return port service status
MaoLu2846b112017-05-15 17:18:55 -070066 * @deprecated 1.11.0
MaoLu937cf422017-03-03 23:31:46 -080067 */
MaoLu2846b112017-05-15 17:18:55 -070068 @Deprecated
MaoLu937cf422017-03-03 23:31:46 -080069 String getProtectionSwitchPortState(DeviceId deviceId, PortNumber portNumber);
70
71 /**
MaoLu2846b112017-05-15 17:18:55 -070072 * Attempts to config protection switch by specified {@code operation} and {@code index}.
73 *
Andrea Campanella7ebfe322019-08-29 11:46:57 -070074 * @param deviceId DeviceId of the device to configure
75 * @param operation switch configuration, automatic, force or manual
MaoLu2846b112017-05-15 17:18:55 -070076 * @param identifier {@link ConnectPoint} for the virtual Port representing protected path endpoint
Andrea Campanella7ebfe322019-08-29 11:46:57 -070077 * @param index working path index to switch to
MaoLu2846b112017-05-15 17:18:55 -070078 */
79 void configProtectionSwitch(DeviceId deviceId, String operation, ConnectPoint identifier, int index);
80
81 /**
82 * Retrieves protection switch endpoint states.
Andrea Campanella7ebfe322019-08-29 11:46:57 -070083 *
MaoLu2846b112017-05-15 17:18:55 -070084 * @param deviceId DeviceId of the device to configure
85 * @return map groups of underlying paths
86 */
87 Map<ConnectPoint, ProtectedTransportEndpointState> getProtectionSwitchStates(DeviceId deviceId);
88
89 /**
Jimmy Yanda878fc2016-09-02 16:32:01 -070090 * Set target power for a port if the port has configurable target power.
91 *
Andrea Campanella7ebfe322019-08-29 11:46:57 -070092 * @param deviceId DeviceId of the device to configure
Jimmy Yanda878fc2016-09-02 16:32:01 -070093 * @param portNumber PortNumber of the port to configure
Andrea Campanella7ebfe322019-08-29 11:46:57 -070094 * @param power value to set target power to
Jimmy Yanda878fc2016-09-02 16:32:01 -070095 */
Andrea Campanelladadf6402019-08-07 15:24:11 +020096 void setTargetPortPower(DeviceId deviceId, PortNumber portNumber, double power);
Jimmy Yanda878fc2016-09-02 16:32:01 -070097
98 /**
Boyuan Yanf3f6a8d2019-05-26 18:35:54 -070099 * Returns the target power stored in storage for a port if the port has configurable target power.
Jimmy Yanda878fc2016-09-02 16:32:01 -0700100 *
Andrea Campanella7ebfe322019-08-29 11:46:57 -0700101 * @param deviceId DeviceId of the device to configure
Jimmy Yanda878fc2016-09-02 16:32:01 -0700102 * @param portNumber PortNumber of the port to configure
103 * @return the target power if the port has a target power, null otherwise
104 */
Andrea Campanelladadf6402019-08-07 15:24:11 +0200105 Double getTargetPortPower(DeviceId deviceId, PortNumber portNumber);
Jimmy Yanda878fc2016-09-02 16:32:01 -0700106
107 /**
Boyuan Yanf3f6a8d2019-05-26 18:35:54 -0700108 * Sync-up the target power for a port if the operator want to check the configuration.
Andrea Campanella7ebfe322019-08-29 11:46:57 -0700109 *
110 * @param deviceId DeviceId of the device to configure
Boyuan Yanf3f6a8d2019-05-26 18:35:54 -0700111 * @param portNumber PortNumber of the port to configure
112 * @return the target power if the port has a target power, null otherwise
113 */
Andrea Campanelladadf6402019-08-07 15:24:11 +0200114 Double syncTargetPortPower(DeviceId deviceId, PortNumber portNumber);
Boyuan Yanf3f6a8d2019-05-26 18:35:54 -0700115
116 /**
Jimmy Yanda878fc2016-09-02 16:32:01 -0700117 * Sets the attenuation of a connection. This does not check that attenuation
118 * is within the acceptable range.
119 *
Andrea Campanella7ebfe322019-08-29 11:46:57 -0700120 * @param deviceId DeviceId of the device to configure
121 * @param portNumber PortNumber of either the input or output port
122 * @param ochSignal channel to set attenuation for
Jimmy Yanda878fc2016-09-02 16:32:01 -0700123 * @param attenuation attenuation value to set to
124 */
Andrea Campanelladadf6402019-08-07 15:24:11 +0200125 void setAttenuation(DeviceId deviceId, PortNumber portNumber, OchSignal ochSignal, double attenuation);
Jimmy Yanda878fc2016-09-02 16:32:01 -0700126
127 /**
128 * Returns the attenuation of a connection.
129 *
Andrea Campanella7ebfe322019-08-29 11:46:57 -0700130 * @param deviceId DeviceId of the device
Jimmy Yanda878fc2016-09-02 16:32:01 -0700131 * @param portNumber PortNumber of either the input or output port
Andrea Campanella7ebfe322019-08-29 11:46:57 -0700132 * @param ochSignal channel to search for
Jimmy Yanda878fc2016-09-02 16:32:01 -0700133 * @return attenuation if found, null otherwise
134 */
Andrea Campanelladadf6402019-08-07 15:24:11 +0200135 Double getAttenuation(DeviceId deviceId, PortNumber portNumber, OchSignal ochSignal);
Jimmy Yanda878fc2016-09-02 16:32:01 -0700136
137 /**
138 * Returns the current port power.
139 *
Andrea Campanella7ebfe322019-08-29 11:46:57 -0700140 * @param deviceId DeviceId of the device
Jimmy Yanda878fc2016-09-02 16:32:01 -0700141 * @param portNumber PortNumber of the port
142 * @return current power if found, null otherwise
143 */
Andrea Campanelladadf6402019-08-07 15:24:11 +0200144 Double getCurrentPortPower(DeviceId deviceId, PortNumber portNumber);
Jimmy Yanda878fc2016-09-02 16:32:01 -0700145
146 /**
147 * Returns the current channel power.
148 *
Andrea Campanella7ebfe322019-08-29 11:46:57 -0700149 * @param deviceId DeviceId of the device
Jimmy Yanda878fc2016-09-02 16:32:01 -0700150 * @param portNumber PortNumber of either the input or output port of the connection
Andrea Campanella7ebfe322019-08-29 11:46:57 -0700151 * @param ochSignal channel to search for
Jimmy Yanda878fc2016-09-02 16:32:01 -0700152 * @return channel power if found, null otherwise
153 */
Andrea Campanelladadf6402019-08-07 15:24:11 +0200154 Double getCurrentChannelPower(DeviceId deviceId, PortNumber portNumber, OchSignal ochSignal);
Jimmy Yanda878fc2016-09-02 16:32:01 -0700155
156 /**
157 * Returns the channels supported by a port.
158 *
Andrea Campanella7ebfe322019-08-29 11:46:57 -0700159 * @param deviceId DeviceId of the device
Jimmy Yanda878fc2016-09-02 16:32:01 -0700160 * @param portNumber PortNumber of the port
161 * @return the set of supported channels
162 */
163 Set<OchSignal> queryLambdas(DeviceId deviceId, PortNumber portNumber);
164
165 /**
Andrea Campanellabdeeda12019-08-02 16:12:05 +0200166 * Set modulation for a port if the port has configurable modulation.
167 *
Andrea Campanella7ebfe322019-08-29 11:46:57 -0700168 * @param deviceId DeviceId of the device to configure
Andrea Campanellabdeeda12019-08-02 16:12:05 +0200169 * @param portNumber PortNumber of the port to configure
170 * @param modulation value to set modulation to
171 */
172 void setModulation(DeviceId deviceId, PortNumber portNumber, String modulation);
173
174 /**
175 * Get modulation for a port if the port has configurable modulation.
176 *
Andrea Campanella7ebfe322019-08-29 11:46:57 -0700177 * @param deviceId DeviceId of the device to configure
Andrea Campanellabdeeda12019-08-02 16:12:05 +0200178 * @param portNumber PortNumber of the port to configure
179 * @return modulation scheme
180 */
181 ModulationScheme getModulation(DeviceId deviceId, PortNumber portNumber);
182
183 /**
Jimmy Yanda878fc2016-09-02 16:32:01 -0700184 * Creates a new internal connection on a device without attenuation. This does
185 * not check that the connection is actually valid (e.g. an input port to an
186 * output port).
Andrea Campanella7ebfe322019-08-29 11:46:57 -0700187 * <p>
Jimmy Yanda878fc2016-09-02 16:32:01 -0700188 * Connections are represented as flows with an input port, output port, and
MaoLu937cf422017-03-03 23:31:46 -0800189 * channel.
Jimmy Yanda878fc2016-09-02 16:32:01 -0700190 *
Andrea Campanella7ebfe322019-08-29 11:46:57 -0700191 * @param deviceId DeviceId of the device to create this connection for
192 * @param priority priority of the flow
Jimmy Yanda878fc2016-09-02 16:32:01 -0700193 * @param isPermanent permanence of the flow
Andrea Campanella7ebfe322019-08-29 11:46:57 -0700194 * @param timeout timeout in seconds
195 * @param inPort input port
196 * @param outPort output port
197 * @param ochSignal channel to use
Jimmy Yanda878fc2016-09-02 16:32:01 -0700198 * @return FlowId of the FlowRule representing the connection
199 */
200 FlowId createConnection(DeviceId deviceId, int priority, boolean isPermanent,
Andrea Campanella7ebfe322019-08-29 11:46:57 -0700201 int timeout, PortNumber inPort, PortNumber outPort, OchSignal ochSignal);
Jimmy Yanda878fc2016-09-02 16:32:01 -0700202
203 /**
204 * Creates a new internal connection on a device with attenuation. This does
205 * not check that the connection is actually valid (e.g. an input port to an
206 * output port, attenuation if within the acceptable range).
Andrea Campanella7ebfe322019-08-29 11:46:57 -0700207 * <p>
Jimmy Yanda878fc2016-09-02 16:32:01 -0700208 * Connections are represented as flows with an input port, output port, and
209 * channel. Implementation of attenuation is up to the vendor.
210 *
Andrea Campanella7ebfe322019-08-29 11:46:57 -0700211 * @param deviceId DeviceId of the device to create this connection for
212 * @param priority priority of the flow
Jimmy Yanda878fc2016-09-02 16:32:01 -0700213 * @param isPermanent permanence of the flow
Andrea Campanella7ebfe322019-08-29 11:46:57 -0700214 * @param timeout timeout in seconds
215 * @param inPort input port
216 * @param outPort output port
217 * @param ochSignal channel to use
Jimmy Yanda878fc2016-09-02 16:32:01 -0700218 * @param attenuation attenuation of the connection
219 * @return FlowId of the FlowRule representing the connection
220 */
221 FlowId createConnection(DeviceId deviceId, int priority, boolean isPermanent,
Andrea Campanella7ebfe322019-08-29 11:46:57 -0700222 int timeout, PortNumber inPort, PortNumber outPort,
223 OchSignal ochSignal, Double attenuation);
224
225 /**
226 * Get wavelength for a port if the port has configurable modulation.
227 *
228 * @param deviceId DeviceId of the device to configure
229 * @param portNumber PortNumber of the port to configure
230 * @return the frequency
231 */
232 Frequency getWavelength(DeviceId deviceId, PortNumber portNumber);
Jimmy Yanda878fc2016-09-02 16:32:01 -0700233
234 /**
235 * Removes an internal connection from a device by matching the FlowId and
236 * removing the flow representing the connection. This will remove any flow
237 * from any device so FlowId should correspond with a connection flow.
238 *
239 * @param deviceId DeviceId of the device to remove the connection from
Andrea Campanella7ebfe322019-08-29 11:46:57 -0700240 * @param flowId FlowId of the flow representing the connection to remove
Jimmy Yanda878fc2016-09-02 16:32:01 -0700241 */
242 void removeConnection(DeviceId deviceId, FlowId flowId);
243
244 /**
245 * Returns true if the target power for this port can be configured.
246 *
Andrea Campanella7ebfe322019-08-29 11:46:57 -0700247 * @param deviceId DeviceId of the device
Jimmy Yanda878fc2016-09-02 16:32:01 -0700248 * @param portNumber PortNumber of the port to check
249 * @return true if the target power for this port can be configured, false
250 * otherwise
251 */
252 boolean hasPortTargetPower(DeviceId deviceId, PortNumber portNumber);
253
254 /**
255 * Returns true if value is within the acceptable target power range of the port.
256 * Returns false if the port does not have a configurable target
257 * power.
258 *
Andrea Campanella7ebfe322019-08-29 11:46:57 -0700259 * @param deviceId DeviceId of the device to check
Jimmy Yanda878fc2016-09-02 16:32:01 -0700260 * @param portNumber PortNumber of the port to check
Andrea Campanella7ebfe322019-08-29 11:46:57 -0700261 * @param power value to check
Jimmy Yanda878fc2016-09-02 16:32:01 -0700262 * @return true if value is within the acceptable target power range, false
263 * otherwise
264 */
Andrea Campanelladadf6402019-08-07 15:24:11 +0200265 boolean portTargetPowerInRange(DeviceId deviceId, PortNumber portNumber, double power);
Jimmy Yanda878fc2016-09-02 16:32:01 -0700266
267 /**
268 * Returns true if value is within the acceptable attenuation range of a
269 * connection, and always returns false if the connection does not support
270 * attenuation. The attenuation range is determined by either the input
271 * or output port of the connection.
272 *
Andrea Campanella7ebfe322019-08-29 11:46:57 -0700273 * @param deviceId DeviceId of the device to check
Jimmy Yanda878fc2016-09-02 16:32:01 -0700274 * @param portNumber PortNumber of either the input or output port of the connection
Andrea Campanella7ebfe322019-08-29 11:46:57 -0700275 * @param att value to check
Jimmy Yanda878fc2016-09-02 16:32:01 -0700276 * @return true if value is within the acceptable attenuation range, false
277 * otherwise
278 */
Andrea Campanelladadf6402019-08-07 15:24:11 +0200279 boolean attenuationInRange(DeviceId deviceId, PortNumber portNumber, double att);
Jimmy Yanda878fc2016-09-02 16:32:01 -0700280
281 /**
282 * Returns true if the port is an input port.
283 *
Andrea Campanella7ebfe322019-08-29 11:46:57 -0700284 * @param deviceId DeviceId of the device to check
Jimmy Yanda878fc2016-09-02 16:32:01 -0700285 * @param portNumber PortNumber of the port to check
286 * @return true if the port is an input port, false otherwise
287 */
288 boolean validInputPort(DeviceId deviceId, PortNumber portNumber);
289
290 /**
291 * Returns true if the port is an output port.
292 *
Andrea Campanella7ebfe322019-08-29 11:46:57 -0700293 * @param deviceId DeviceId of the device to check
Jimmy Yanda878fc2016-09-02 16:32:01 -0700294 * @param portNumber PortNumber of the port to check
295 * @return true if the port is an output port, false otherwise
296 */
297 boolean validOutputPort(DeviceId deviceId, PortNumber portNumber);
298
299 /**
300 * Returns true if the channel is supported by the port. The port can be either
301 * an input or output port.
302 *
Andrea Campanella7ebfe322019-08-29 11:46:57 -0700303 * @param deviceId DeviceId of the device to check
Jimmy Yanda878fc2016-09-02 16:32:01 -0700304 * @param portNumber PortNumber of the port to check
Andrea Campanella7ebfe322019-08-29 11:46:57 -0700305 * @param ochSignal channel to check
Jimmy Yanda878fc2016-09-02 16:32:01 -0700306 * @return true if the channel is supported by the port, false otherwise
307 */
308 boolean validChannel(DeviceId deviceId, PortNumber portNumber, OchSignal ochSignal);
309
310 /**
311 * Returns true if the channel is not being used by a connection on the
312 * device.
313 *
Andrea Campanella7ebfe322019-08-29 11:46:57 -0700314 * @param deviceId DeviceId of the device to check
Jimmy Yanda878fc2016-09-02 16:32:01 -0700315 * @param ochSignal channel to check
316 * @return true if the channel is not in use, false otherwise
317 */
318 boolean channelAvailable(DeviceId deviceId, OchSignal ochSignal);
319
320 /**
321 * Returns true if the connection from the input port to the output port is
322 * valid. This currently only checks if the given input and output ports are,
323 * respectively, valid input and output ports.
324 *
325 * @param deviceId DeviceId of the device to check
Andrea Campanella7ebfe322019-08-29 11:46:57 -0700326 * @param inPort input port of the connection
327 * @param outPort output port of the connection
Jimmy Yanda878fc2016-09-02 16:32:01 -0700328 * @return true if the connection is valid, false otherwise
329 */
330 boolean validConnection(DeviceId deviceId, PortNumber inPort, PortNumber outPort);
331
332 /**
333 * Returns the acceptable target port power range for a port.
334 *
Andrea Campanella7ebfe322019-08-29 11:46:57 -0700335 * @param deviceId DeviceId of the device
Jimmy Yanda878fc2016-09-02 16:32:01 -0700336 * @param portNumber PortNumber of the port
337 * @return range if found, null otherwise
338 */
Andrea Campanelladadf6402019-08-07 15:24:11 +0200339 Range<Double> targetPortPowerRange(DeviceId deviceId, PortNumber portNumber);
Jimmy Yanda878fc2016-09-02 16:32:01 -0700340
341 /**
342 * Returns the acceptable attenuation range for a connection.
343 *
Andrea Campanella7ebfe322019-08-29 11:46:57 -0700344 * @param deviceId DeviceId of the device
Jimmy Yanda878fc2016-09-02 16:32:01 -0700345 * @param portNumber PortNumber of either the input or output port
Andrea Campanella7ebfe322019-08-29 11:46:57 -0700346 * @param ochSignal channel to check
Jimmy Yanda878fc2016-09-02 16:32:01 -0700347 * @return range if found, null otherwise
348 */
Andrea Campanelladadf6402019-08-07 15:24:11 +0200349 Range<Double> attenuationRange(DeviceId deviceId, PortNumber portNumber, OchSignal ochSignal);
Jimmy Yanda878fc2016-09-02 16:32:01 -0700350
351 /**
352 * Returns the expected input power range for an input port.
353 *
Andrea Campanella7ebfe322019-08-29 11:46:57 -0700354 * @param deviceId DeviceId of the device
Jimmy Yanda878fc2016-09-02 16:32:01 -0700355 * @param portNumber PortNumber of an input port
356 * @return range if found, null otherwise
357 */
Andrea Campanelladadf6402019-08-07 15:24:11 +0200358 Range<Double> inputPortPowerRange(DeviceId deviceId, PortNumber portNumber);
Jimmy Yanda878fc2016-09-02 16:32:01 -0700359}