blob: 4cd5fcf2d4ffb79e210b430a2c32f874405b924d [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;
21import org.onosproject.net.OchSignal;
22import org.onosproject.net.PortNumber;
MaoLu2846b112017-05-15 17:18:55 -070023import org.onosproject.net.behaviour.protection.ProtectedTransportEndpointState;
Jimmy Yanda878fc2016-09-02 16:32:01 -070024import org.onosproject.net.flow.FlowId;
25
MaoLu2846b112017-05-15 17:18:55 -070026import java.util.Map;
Jimmy Yanda878fc2016-09-02 16:32:01 -070027import java.util.Set;
28
29/**
30 * ROADM service interface. Provides an interface for ROADM power configuration.
31 *
32 * This application relies on the PowerConfig and LambdaQuery behaviours.
33 *
34 * The device's PowerConfig implementation should be parameterized as
35 * {@code PowerConfig<Object>} in order to support both Direction and OchSignal.
36 * For a reference implementation of PowerConfig, please see
37 * OplinkRoadmPowerConfig
38 *
39 * In this application, a "connection" refers to the selection of a channel
40 * to direct from an input to an output port. Connections are implemented
41 * using FlowRules with an input port selector, optical channel selector,
42 * and output port treatment (see RoadmManager#createConnection()).
43 *
44 * This application currently only supports fixed grid channels.
45 */
46public interface RoadmService {
47
48 /**
MaoLu937cf422017-03-03 23:31:46 -080049 * Attempts to manually switch working path to the one specified by {@code index}.
50 *
51 * @param deviceId DeviceId of the device to configure
52 * @param index working path index to switch to
MaoLu2846b112017-05-15 17:18:55 -070053 * @deprecated 1.11.0
MaoLu937cf422017-03-03 23:31:46 -080054 */
MaoLu2846b112017-05-15 17:18:55 -070055 @Deprecated
MaoLu937cf422017-03-03 23:31:46 -080056 void setProtectionSwitchWorkingPath(DeviceId deviceId, int index);
57
58 /**
59 * Retrieves protection switch specified port's service status.
60 *
61 * @param deviceId DeviceId of the device to configure
62 * @param portNumber the port
63 * @return port service status
MaoLu2846b112017-05-15 17:18:55 -070064 * @deprecated 1.11.0
MaoLu937cf422017-03-03 23:31:46 -080065 */
MaoLu2846b112017-05-15 17:18:55 -070066 @Deprecated
MaoLu937cf422017-03-03 23:31:46 -080067 String getProtectionSwitchPortState(DeviceId deviceId, PortNumber portNumber);
68
69 /**
MaoLu2846b112017-05-15 17:18:55 -070070 * Attempts to config protection switch by specified {@code operation} and {@code index}.
71 *
72 * @param deviceId DeviceId of the device to configure
73 * @param operation switch configuration, automatic, force or manual
74 * @param identifier {@link ConnectPoint} for the virtual Port representing protected path endpoint
75 * @param index working path index to switch to
76 */
77 void configProtectionSwitch(DeviceId deviceId, String operation, ConnectPoint identifier, int index);
78
79 /**
80 * Retrieves protection switch endpoint states.
81 * @param deviceId DeviceId of the device to configure
82 * @return map groups of underlying paths
83 */
84 Map<ConnectPoint, ProtectedTransportEndpointState> getProtectionSwitchStates(DeviceId deviceId);
85
86 /**
Jimmy Yanda878fc2016-09-02 16:32:01 -070087 * Set target power for a port if the port has configurable target power.
88 *
89 * @param deviceId DeviceId of the device to configure
90 * @param portNumber PortNumber of the port to configure
91 * @param power value to set target power to
92 */
93 void setTargetPortPower(DeviceId deviceId, PortNumber portNumber, long power);
94
95 /**
96 * Returns the target power for a port if the port has configurable target power.
97 *
98 * @param deviceId DeviceId of the device to configure
99 * @param portNumber PortNumber of the port to configure
100 * @return the target power if the port has a target power, null otherwise
101 */
102 Long getTargetPortPower(DeviceId deviceId, PortNumber portNumber);
103
104 /**
105 * Sets the attenuation of a connection. This does not check that attenuation
106 * is within the acceptable range.
107 *
108 * @param deviceId DeviceId of the device to configure
109 * @param portNumber PortNumber of either the input or output port
110 * @param ochSignal channel to set attenuation for
111 * @param attenuation attenuation value to set to
112 */
MaoLu937cf422017-03-03 23:31:46 -0800113 void setAttenuation(DeviceId deviceId, PortNumber portNumber, OchSignal ochSignal, long attenuation);
Jimmy Yanda878fc2016-09-02 16:32:01 -0700114
115 /**
116 * Returns the attenuation of a connection.
117 *
118 * @param deviceId DeviceId of the device
119 * @param portNumber PortNumber of either the input or output port
120 * @param ochSignal channel to search for
121 * @return attenuation if found, null otherwise
122 */
123 Long getAttenuation(DeviceId deviceId, PortNumber portNumber, OchSignal ochSignal);
124
125 /**
126 * Returns the current port power.
127 *
128 * @param deviceId DeviceId of the device
129 * @param portNumber PortNumber of the port
130 * @return current power if found, null otherwise
131 */
132 Long getCurrentPortPower(DeviceId deviceId, PortNumber portNumber);
133
134 /**
135 * Returns the current channel power.
136 *
137 * @param deviceId DeviceId of the device
138 * @param portNumber PortNumber of either the input or output port of the connection
139 * @param ochSignal channel to search for
140 * @return channel power if found, null otherwise
141 */
MaoLu937cf422017-03-03 23:31:46 -0800142 Long getCurrentChannelPower(DeviceId deviceId, PortNumber portNumber, OchSignal ochSignal);
Jimmy Yanda878fc2016-09-02 16:32:01 -0700143
144 /**
145 * Returns the channels supported by a port.
146 *
147 * @param deviceId DeviceId of the device
148 * @param portNumber PortNumber of the port
149 * @return the set of supported channels
150 */
151 Set<OchSignal> queryLambdas(DeviceId deviceId, PortNumber portNumber);
152
153 /**
154 * Creates a new internal connection on a device without attenuation. This does
155 * not check that the connection is actually valid (e.g. an input port to an
156 * output port).
157 *
158 * Connections are represented as flows with an input port, output port, and
MaoLu937cf422017-03-03 23:31:46 -0800159 * channel.
Jimmy Yanda878fc2016-09-02 16:32:01 -0700160 *
161 * @param deviceId DeviceId of the device to create this connection for
162 * @param priority priority of the flow
163 * @param isPermanent permanence of the flow
164 * @param timeout timeout in seconds
165 * @param inPort input port
166 * @param outPort output port
167 * @param ochSignal channel to use
168 * @return FlowId of the FlowRule representing the connection
169 */
170 FlowId createConnection(DeviceId deviceId, int priority, boolean isPermanent,
MaoLu937cf422017-03-03 23:31:46 -0800171 int timeout, PortNumber inPort, PortNumber outPort, OchSignal ochSignal);
Jimmy Yanda878fc2016-09-02 16:32:01 -0700172
173 /**
174 * Creates a new internal connection on a device with attenuation. This does
175 * not check that the connection is actually valid (e.g. an input port to an
176 * output port, attenuation if within the acceptable range).
177 *
178 * Connections are represented as flows with an input port, output port, and
179 * channel. Implementation of attenuation is up to the vendor.
180 *
181 * @param deviceId DeviceId of the device to create this connection for
182 * @param priority priority of the flow
183 * @param isPermanent permanence of the flow
184 * @param timeout timeout in seconds
185 * @param inPort input port
186 * @param outPort output port
187 * @param ochSignal channel to use
188 * @param attenuation attenuation of the connection
189 * @return FlowId of the FlowRule representing the connection
190 */
191 FlowId createConnection(DeviceId deviceId, int priority, boolean isPermanent,
192 int timeout, PortNumber inPort, PortNumber outPort,
193 OchSignal ochSignal, long attenuation);
194
195 /**
196 * Removes an internal connection from a device by matching the FlowId and
197 * removing the flow representing the connection. This will remove any flow
198 * from any device so FlowId should correspond with a connection flow.
199 *
200 * @param deviceId DeviceId of the device to remove the connection from
201 * @param flowId FlowId of the flow representing the connection to remove
202 */
203 void removeConnection(DeviceId deviceId, FlowId flowId);
204
205 /**
206 * Returns true if the target power for this port can be configured.
207 *
208 * @param deviceId DeviceId of the device
209 * @param portNumber PortNumber of the port to check
210 * @return true if the target power for this port can be configured, false
211 * otherwise
212 */
213 boolean hasPortTargetPower(DeviceId deviceId, PortNumber portNumber);
214
215 /**
216 * Returns true if value is within the acceptable target power range of the port.
217 * Returns false if the port does not have a configurable target
218 * power.
219 *
220 * @param deviceId DeviceId of the device to check
221 * @param portNumber PortNumber of the port to check
222 * @param power value to check
223 * @return true if value is within the acceptable target power range, false
224 * otherwise
225 */
226 boolean portTargetPowerInRange(DeviceId deviceId, PortNumber portNumber, long power);
227
228 /**
229 * Returns true if value is within the acceptable attenuation range of a
230 * connection, and always returns false if the connection does not support
231 * attenuation. The attenuation range is determined by either the input
232 * or output port of the connection.
233 *
234 * @param deviceId DeviceId of the device to check
235 * @param portNumber PortNumber of either the input or output port of the connection
236 * @param att value to check
237 * @return true if value is within the acceptable attenuation range, false
238 * otherwise
239 */
240 boolean attenuationInRange(DeviceId deviceId, PortNumber portNumber, long att);
241
242 /**
243 * Returns true if the port is an input port.
244 *
245 * @param deviceId DeviceId of the device to check
246 * @param portNumber PortNumber of the port to check
247 * @return true if the port is an input port, false otherwise
248 */
249 boolean validInputPort(DeviceId deviceId, PortNumber portNumber);
250
251 /**
252 * Returns true if the port is an output port.
253 *
254 * @param deviceId DeviceId of the device to check
255 * @param portNumber PortNumber of the port to check
256 * @return true if the port is an output port, false otherwise
257 */
258 boolean validOutputPort(DeviceId deviceId, PortNumber portNumber);
259
260 /**
261 * Returns true if the channel is supported by the port. The port can be either
262 * an input or output port.
263 *
264 * @param deviceId DeviceId of the device to check
265 * @param portNumber PortNumber of the port to check
266 * @param ochSignal channel to check
267 * @return true if the channel is supported by the port, false otherwise
268 */
269 boolean validChannel(DeviceId deviceId, PortNumber portNumber, OchSignal ochSignal);
270
271 /**
272 * Returns true if the channel is not being used by a connection on the
273 * device.
274 *
275 * @param deviceId DeviceId of the device to check
276 * @param ochSignal channel to check
277 * @return true if the channel is not in use, false otherwise
278 */
279 boolean channelAvailable(DeviceId deviceId, OchSignal ochSignal);
280
281 /**
282 * Returns true if the connection from the input port to the output port is
283 * valid. This currently only checks if the given input and output ports are,
284 * respectively, valid input and output ports.
285 *
286 * @param deviceId DeviceId of the device to check
287 * @param inPort input port of the connection
288 * @param outPort output port of the connection
289 * @return true if the connection is valid, false otherwise
290 */
291 boolean validConnection(DeviceId deviceId, PortNumber inPort, PortNumber outPort);
292
293 /**
294 * Returns the acceptable target port power range for a port.
295 *
296 * @param deviceId DeviceId of the device
297 * @param portNumber PortNumber of the port
298 * @return range if found, null otherwise
299 */
300 Range<Long> targetPortPowerRange(DeviceId deviceId, PortNumber portNumber);
301
302 /**
303 * Returns the acceptable attenuation range for a connection.
304 *
305 * @param deviceId DeviceId of the device
306 * @param portNumber PortNumber of either the input or output port
307 * @param ochSignal channel to check
308 * @return range if found, null otherwise
309 */
MaoLu937cf422017-03-03 23:31:46 -0800310 Range<Long> attenuationRange(DeviceId deviceId, PortNumber portNumber, OchSignal ochSignal);
Jimmy Yanda878fc2016-09-02 16:32:01 -0700311
312 /**
313 * Returns the expected input power range for an input port.
314 *
315 * @param deviceId DeviceId of the device
316 * @param portNumber PortNumber of an input port
317 * @return range if found, null otherwise
318 */
319 Range<Long> inputPortPowerRange(DeviceId deviceId, PortNumber portNumber);
320}