blob: 7662626810138f9d57b08d53ad69380eb8bfd4b3 [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;
MaoLu2846b112017-05-15 17:18:55 -070019import org.onosproject.net.ConnectPoint;
Jimmy Yanda878fc2016-09-02 16:32:01 -070020import org.onosproject.net.DeviceId;
Andrea Campanellabdeeda12019-08-02 16:12:05 +020021import org.onosproject.net.ModulationScheme;
Jimmy Yanda878fc2016-09-02 16:32:01 -070022import org.onosproject.net.OchSignal;
23import org.onosproject.net.PortNumber;
MaoLu2846b112017-05-15 17:18:55 -070024import org.onosproject.net.behaviour.protection.ProtectedTransportEndpointState;
Jimmy Yanda878fc2016-09-02 16:32:01 -070025import org.onosproject.net.flow.FlowId;
26
MaoLu2846b112017-05-15 17:18:55 -070027import java.util.Map;
Jimmy Yanda878fc2016-09-02 16:32:01 -070028import java.util.Set;
29
30/**
31 * ROADM service interface. Provides an interface for ROADM power configuration.
32 *
33 * This application relies on the PowerConfig and LambdaQuery behaviours.
34 *
35 * The device's PowerConfig implementation should be parameterized as
36 * {@code PowerConfig<Object>} in order to support both Direction and OchSignal.
37 * For a reference implementation of PowerConfig, please see
38 * OplinkRoadmPowerConfig
39 *
40 * In this application, a "connection" refers to the selection of a channel
41 * to direct from an input to an output port. Connections are implemented
42 * using FlowRules with an input port selector, optical channel selector,
43 * and output port treatment (see RoadmManager#createConnection()).
44 *
45 * This application currently only supports fixed grid channels.
46 */
47public interface RoadmService {
48
49 /**
MaoLu937cf422017-03-03 23:31:46 -080050 * Attempts to manually switch working path to the one specified by {@code index}.
51 *
52 * @param deviceId DeviceId of the device to configure
53 * @param index working path index to switch to
MaoLu2846b112017-05-15 17:18:55 -070054 * @deprecated 1.11.0
MaoLu937cf422017-03-03 23:31:46 -080055 */
MaoLu2846b112017-05-15 17:18:55 -070056 @Deprecated
MaoLu937cf422017-03-03 23:31:46 -080057 void setProtectionSwitchWorkingPath(DeviceId deviceId, int index);
58
59 /**
60 * Retrieves protection switch specified port's service status.
61 *
62 * @param deviceId DeviceId of the device to configure
63 * @param portNumber the port
64 * @return port service status
MaoLu2846b112017-05-15 17:18:55 -070065 * @deprecated 1.11.0
MaoLu937cf422017-03-03 23:31:46 -080066 */
MaoLu2846b112017-05-15 17:18:55 -070067 @Deprecated
MaoLu937cf422017-03-03 23:31:46 -080068 String getProtectionSwitchPortState(DeviceId deviceId, PortNumber portNumber);
69
70 /**
MaoLu2846b112017-05-15 17:18:55 -070071 * Attempts to config protection switch by specified {@code operation} and {@code index}.
72 *
73 * @param deviceId DeviceId of the device to configure
74 * @param operation switch configuration, automatic, force or manual
75 * @param identifier {@link ConnectPoint} for the virtual Port representing protected path endpoint
76 * @param index working path index to switch to
77 */
78 void configProtectionSwitch(DeviceId deviceId, String operation, ConnectPoint identifier, int index);
79
80 /**
81 * Retrieves protection switch endpoint states.
82 * @param deviceId DeviceId of the device to configure
83 * @return map groups of underlying paths
84 */
85 Map<ConnectPoint, ProtectedTransportEndpointState> getProtectionSwitchStates(DeviceId deviceId);
86
87 /**
Jimmy Yanda878fc2016-09-02 16:32:01 -070088 * Set target power for a port if the port has configurable target power.
89 *
90 * @param deviceId DeviceId of the device to configure
91 * @param portNumber PortNumber of the port to configure
92 * @param power value to set target power to
93 */
Andrea Campanelladadf6402019-08-07 15:24:11 +020094 void setTargetPortPower(DeviceId deviceId, PortNumber portNumber, double power);
Jimmy Yanda878fc2016-09-02 16:32:01 -070095
96 /**
Boyuan Yanf3f6a8d2019-05-26 18:35:54 -070097 * Returns the target power stored in storage for a port if the port has configurable target power.
Jimmy Yanda878fc2016-09-02 16:32:01 -070098 *
99 * @param deviceId DeviceId of the device to configure
100 * @param portNumber PortNumber of the port to configure
101 * @return the target power if the port has a target power, null otherwise
102 */
Andrea Campanelladadf6402019-08-07 15:24:11 +0200103 Double getTargetPortPower(DeviceId deviceId, PortNumber portNumber);
Jimmy Yanda878fc2016-09-02 16:32:01 -0700104
105 /**
Boyuan Yanf3f6a8d2019-05-26 18:35:54 -0700106 * Sync-up the target power for a port if the operator want to check the configuration.
107 * @param deviceId DeviceId of the device to configure
108 * @param portNumber PortNumber of the port to configure
109 * @return the target power if the port has a target power, null otherwise
110 */
Andrea Campanelladadf6402019-08-07 15:24:11 +0200111 Double syncTargetPortPower(DeviceId deviceId, PortNumber portNumber);
Boyuan Yanf3f6a8d2019-05-26 18:35:54 -0700112
113 /**
Jimmy Yanda878fc2016-09-02 16:32:01 -0700114 * Sets the attenuation of a connection. This does not check that attenuation
115 * is within the acceptable range.
116 *
117 * @param deviceId DeviceId of the device to configure
118 * @param portNumber PortNumber of either the input or output port
119 * @param ochSignal channel to set attenuation for
120 * @param attenuation attenuation value to set to
121 */
Andrea Campanelladadf6402019-08-07 15:24:11 +0200122 void setAttenuation(DeviceId deviceId, PortNumber portNumber, OchSignal ochSignal, double attenuation);
Jimmy Yanda878fc2016-09-02 16:32:01 -0700123
124 /**
125 * Returns the attenuation of a connection.
126 *
127 * @param deviceId DeviceId of the device
128 * @param portNumber PortNumber of either the input or output port
129 * @param ochSignal channel to search for
130 * @return attenuation if found, null otherwise
131 */
Andrea Campanelladadf6402019-08-07 15:24:11 +0200132 Double getAttenuation(DeviceId deviceId, PortNumber portNumber, OchSignal ochSignal);
Jimmy Yanda878fc2016-09-02 16:32:01 -0700133
134 /**
135 * Returns the current port power.
136 *
137 * @param deviceId DeviceId of the device
138 * @param portNumber PortNumber of the port
139 * @return current power if found, null otherwise
140 */
Andrea Campanelladadf6402019-08-07 15:24:11 +0200141 Double getCurrentPortPower(DeviceId deviceId, PortNumber portNumber);
Jimmy Yanda878fc2016-09-02 16:32:01 -0700142
143 /**
144 * Returns the current channel power.
145 *
146 * @param deviceId DeviceId of the device
147 * @param portNumber PortNumber of either the input or output port of the connection
148 * @param ochSignal channel to search for
149 * @return channel power if found, null otherwise
150 */
Andrea Campanelladadf6402019-08-07 15:24:11 +0200151 Double getCurrentChannelPower(DeviceId deviceId, PortNumber portNumber, OchSignal ochSignal);
Jimmy Yanda878fc2016-09-02 16:32:01 -0700152
153 /**
154 * Returns the channels supported by a port.
155 *
156 * @param deviceId DeviceId of the device
157 * @param portNumber PortNumber of the port
158 * @return the set of supported channels
159 */
160 Set<OchSignal> queryLambdas(DeviceId deviceId, PortNumber portNumber);
161
162 /**
Andrea Campanellabdeeda12019-08-02 16:12:05 +0200163 * Set modulation for a port if the port has configurable modulation.
164 *
165 * @param deviceId DeviceId of the device to configure
166 * @param portNumber PortNumber of the port to configure
167 * @param modulation value to set modulation to
168 */
169 void setModulation(DeviceId deviceId, PortNumber portNumber, String modulation);
170
171 /**
172 * Get modulation for a port if the port has configurable modulation.
173 *
174 * @param deviceId DeviceId of the device to configure
175 * @param portNumber PortNumber of the port to configure
176 * @return modulation scheme
177 */
178 ModulationScheme getModulation(DeviceId deviceId, PortNumber portNumber);
179
180 /**
Jimmy Yanda878fc2016-09-02 16:32:01 -0700181 * Creates a new internal connection on a device without attenuation. This does
182 * not check that the connection is actually valid (e.g. an input port to an
183 * output port).
184 *
185 * Connections are represented as flows with an input port, output port, and
MaoLu937cf422017-03-03 23:31:46 -0800186 * channel.
Jimmy Yanda878fc2016-09-02 16:32:01 -0700187 *
188 * @param deviceId DeviceId of the device to create this connection for
189 * @param priority priority of the flow
190 * @param isPermanent permanence of the flow
191 * @param timeout timeout in seconds
192 * @param inPort input port
193 * @param outPort output port
194 * @param ochSignal channel to use
195 * @return FlowId of the FlowRule representing the connection
196 */
197 FlowId createConnection(DeviceId deviceId, int priority, boolean isPermanent,
MaoLu937cf422017-03-03 23:31:46 -0800198 int timeout, PortNumber inPort, PortNumber outPort, OchSignal ochSignal);
Jimmy Yanda878fc2016-09-02 16:32:01 -0700199
200 /**
201 * Creates a new internal connection on a device with attenuation. This does
202 * not check that the connection is actually valid (e.g. an input port to an
203 * output port, attenuation if within the acceptable range).
204 *
205 * Connections are represented as flows with an input port, output port, and
206 * channel. Implementation of attenuation is up to the vendor.
207 *
208 * @param deviceId DeviceId of the device to create this connection for
209 * @param priority priority of the flow
210 * @param isPermanent permanence of the flow
211 * @param timeout timeout in seconds
212 * @param inPort input port
213 * @param outPort output port
214 * @param ochSignal channel to use
215 * @param attenuation attenuation of the connection
216 * @return FlowId of the FlowRule representing the connection
217 */
218 FlowId createConnection(DeviceId deviceId, int priority, boolean isPermanent,
219 int timeout, PortNumber inPort, PortNumber outPort,
Andrea Campanelladadf6402019-08-07 15:24:11 +0200220 OchSignal ochSignal, Double attenuation);
Jimmy Yanda878fc2016-09-02 16:32:01 -0700221
222 /**
223 * Removes an internal connection from a device by matching the FlowId and
224 * removing the flow representing the connection. This will remove any flow
225 * from any device so FlowId should correspond with a connection flow.
226 *
227 * @param deviceId DeviceId of the device to remove the connection from
228 * @param flowId FlowId of the flow representing the connection to remove
229 */
230 void removeConnection(DeviceId deviceId, FlowId flowId);
231
232 /**
233 * Returns true if the target power for this port can be configured.
234 *
235 * @param deviceId DeviceId of the device
236 * @param portNumber PortNumber of the port to check
237 * @return true if the target power for this port can be configured, false
238 * otherwise
239 */
240 boolean hasPortTargetPower(DeviceId deviceId, PortNumber portNumber);
241
242 /**
243 * Returns true if value is within the acceptable target power range of the port.
244 * Returns false if the port does not have a configurable target
245 * power.
246 *
247 * @param deviceId DeviceId of the device to check
248 * @param portNumber PortNumber of the port to check
249 * @param power value to check
250 * @return true if value is within the acceptable target power range, false
251 * otherwise
252 */
Andrea Campanelladadf6402019-08-07 15:24:11 +0200253 boolean portTargetPowerInRange(DeviceId deviceId, PortNumber portNumber, double power);
Jimmy Yanda878fc2016-09-02 16:32:01 -0700254
255 /**
256 * Returns true if value is within the acceptable attenuation range of a
257 * connection, and always returns false if the connection does not support
258 * attenuation. The attenuation range is determined by either the input
259 * or output port of the connection.
260 *
261 * @param deviceId DeviceId of the device to check
262 * @param portNumber PortNumber of either the input or output port of the connection
263 * @param att value to check
264 * @return true if value is within the acceptable attenuation range, false
265 * otherwise
266 */
Andrea Campanelladadf6402019-08-07 15:24:11 +0200267 boolean attenuationInRange(DeviceId deviceId, PortNumber portNumber, double att);
Jimmy Yanda878fc2016-09-02 16:32:01 -0700268
269 /**
270 * Returns true if the port is an input port.
271 *
272 * @param deviceId DeviceId of the device to check
273 * @param portNumber PortNumber of the port to check
274 * @return true if the port is an input port, false otherwise
275 */
276 boolean validInputPort(DeviceId deviceId, PortNumber portNumber);
277
278 /**
279 * Returns true if the port is an output port.
280 *
281 * @param deviceId DeviceId of the device to check
282 * @param portNumber PortNumber of the port to check
283 * @return true if the port is an output port, false otherwise
284 */
285 boolean validOutputPort(DeviceId deviceId, PortNumber portNumber);
286
287 /**
288 * Returns true if the channel is supported by the port. The port can be either
289 * an input or output port.
290 *
291 * @param deviceId DeviceId of the device to check
292 * @param portNumber PortNumber of the port to check
293 * @param ochSignal channel to check
294 * @return true if the channel is supported by the port, false otherwise
295 */
296 boolean validChannel(DeviceId deviceId, PortNumber portNumber, OchSignal ochSignal);
297
298 /**
299 * Returns true if the channel is not being used by a connection on the
300 * device.
301 *
302 * @param deviceId DeviceId of the device to check
303 * @param ochSignal channel to check
304 * @return true if the channel is not in use, false otherwise
305 */
306 boolean channelAvailable(DeviceId deviceId, OchSignal ochSignal);
307
308 /**
309 * Returns true if the connection from the input port to the output port is
310 * valid. This currently only checks if the given input and output ports are,
311 * respectively, valid input and output ports.
312 *
313 * @param deviceId DeviceId of the device to check
314 * @param inPort input port of the connection
315 * @param outPort output port of the connection
316 * @return true if the connection is valid, false otherwise
317 */
318 boolean validConnection(DeviceId deviceId, PortNumber inPort, PortNumber outPort);
319
320 /**
321 * Returns the acceptable target port power range for a port.
322 *
323 * @param deviceId DeviceId of the device
324 * @param portNumber PortNumber of the port
325 * @return range if found, null otherwise
326 */
Andrea Campanelladadf6402019-08-07 15:24:11 +0200327 Range<Double> targetPortPowerRange(DeviceId deviceId, PortNumber portNumber);
Jimmy Yanda878fc2016-09-02 16:32:01 -0700328
329 /**
330 * Returns the acceptable attenuation range for a connection.
331 *
332 * @param deviceId DeviceId of the device
333 * @param portNumber PortNumber of either the input or output port
334 * @param ochSignal channel to check
335 * @return range if found, null otherwise
336 */
Andrea Campanelladadf6402019-08-07 15:24:11 +0200337 Range<Double> attenuationRange(DeviceId deviceId, PortNumber portNumber, OchSignal ochSignal);
Jimmy Yanda878fc2016-09-02 16:32:01 -0700338
339 /**
340 * Returns the expected input power range for an input port.
341 *
342 * @param deviceId DeviceId of the device
343 * @param portNumber PortNumber of an input port
344 * @return range if found, null otherwise
345 */
Andrea Campanelladadf6402019-08-07 15:24:11 +0200346 Range<Double> inputPortPowerRange(DeviceId deviceId, PortNumber portNumber);
Jimmy Yanda878fc2016-09-02 16:32:01 -0700347}