Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Foundation |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 3 | * |
| 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 | */ |
| 16 | package org.onosproject.roadm; |
| 17 | |
| 18 | import com.google.common.collect.Range; |
Andrea Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 19 | import org.onlab.util.Frequency; |
MaoLu | 2846b11 | 2017-05-15 17:18:55 -0700 | [diff] [blame] | 20 | import org.onosproject.net.ConnectPoint; |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 21 | import org.onosproject.net.DeviceId; |
Andrea Campanella | bdeeda1 | 2019-08-02 16:12:05 +0200 | [diff] [blame] | 22 | import org.onosproject.net.ModulationScheme; |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 23 | import org.onosproject.net.OchSignal; |
| 24 | import org.onosproject.net.PortNumber; |
MaoLu | 2846b11 | 2017-05-15 17:18:55 -0700 | [diff] [blame] | 25 | import org.onosproject.net.behaviour.protection.ProtectedTransportEndpointState; |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 26 | import org.onosproject.net.flow.FlowId; |
| 27 | |
MaoLu | 2846b11 | 2017-05-15 17:18:55 -0700 | [diff] [blame] | 28 | import java.util.Map; |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 29 | import java.util.Set; |
| 30 | |
| 31 | /** |
| 32 | * ROADM service interface. Provides an interface for ROADM power configuration. |
Andrea Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 33 | * <p> |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 34 | * This application relies on the PowerConfig and LambdaQuery behaviours. |
Andrea Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 35 | * <p> |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 36 | * 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 Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 40 | * <p> |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 41 | * 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 Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 45 | * <p> |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 46 | * This application currently only supports fixed grid channels. |
| 47 | */ |
| 48 | public interface RoadmService { |
| 49 | |
| 50 | /** |
MaoLu | 937cf42 | 2017-03-03 23:31:46 -0800 | [diff] [blame] | 51 | * Attempts to manually switch working path to the one specified by {@code index}. |
| 52 | * |
| 53 | * @param deviceId DeviceId of the device to configure |
Andrea Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 54 | * @param index working path index to switch to |
MaoLu | 2846b11 | 2017-05-15 17:18:55 -0700 | [diff] [blame] | 55 | * @deprecated 1.11.0 |
MaoLu | 937cf42 | 2017-03-03 23:31:46 -0800 | [diff] [blame] | 56 | */ |
MaoLu | 2846b11 | 2017-05-15 17:18:55 -0700 | [diff] [blame] | 57 | @Deprecated |
MaoLu | 937cf42 | 2017-03-03 23:31:46 -0800 | [diff] [blame] | 58 | void setProtectionSwitchWorkingPath(DeviceId deviceId, int index); |
| 59 | |
| 60 | /** |
| 61 | * Retrieves protection switch specified port's service status. |
| 62 | * |
Andrea Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 63 | * @param deviceId DeviceId of the device to configure |
MaoLu | 937cf42 | 2017-03-03 23:31:46 -0800 | [diff] [blame] | 64 | * @param portNumber the port |
| 65 | * @return port service status |
MaoLu | 2846b11 | 2017-05-15 17:18:55 -0700 | [diff] [blame] | 66 | * @deprecated 1.11.0 |
MaoLu | 937cf42 | 2017-03-03 23:31:46 -0800 | [diff] [blame] | 67 | */ |
MaoLu | 2846b11 | 2017-05-15 17:18:55 -0700 | [diff] [blame] | 68 | @Deprecated |
MaoLu | 937cf42 | 2017-03-03 23:31:46 -0800 | [diff] [blame] | 69 | String getProtectionSwitchPortState(DeviceId deviceId, PortNumber portNumber); |
| 70 | |
| 71 | /** |
MaoLu | 2846b11 | 2017-05-15 17:18:55 -0700 | [diff] [blame] | 72 | * Attempts to config protection switch by specified {@code operation} and {@code index}. |
| 73 | * |
Andrea Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 74 | * @param deviceId DeviceId of the device to configure |
| 75 | * @param operation switch configuration, automatic, force or manual |
MaoLu | 2846b11 | 2017-05-15 17:18:55 -0700 | [diff] [blame] | 76 | * @param identifier {@link ConnectPoint} for the virtual Port representing protected path endpoint |
Andrea Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 77 | * @param index working path index to switch to |
MaoLu | 2846b11 | 2017-05-15 17:18:55 -0700 | [diff] [blame] | 78 | */ |
| 79 | void configProtectionSwitch(DeviceId deviceId, String operation, ConnectPoint identifier, int index); |
| 80 | |
| 81 | /** |
| 82 | * Retrieves protection switch endpoint states. |
Andrea Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 83 | * |
MaoLu | 2846b11 | 2017-05-15 17:18:55 -0700 | [diff] [blame] | 84 | * @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 Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 90 | * Set target power for a port if the port has configurable target power. |
| 91 | * |
Andrea Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 92 | * @param deviceId DeviceId of the device to configure |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 93 | * @param portNumber PortNumber of the port to configure |
Andrea Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 94 | * @param power value to set target power to |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 95 | */ |
Andrea Campanella | dadf640 | 2019-08-07 15:24:11 +0200 | [diff] [blame] | 96 | void setTargetPortPower(DeviceId deviceId, PortNumber portNumber, double power); |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 97 | |
| 98 | /** |
Boyuan Yan | f3f6a8d | 2019-05-26 18:35:54 -0700 | [diff] [blame] | 99 | * Returns the target power stored in storage for a port if the port has configurable target power. |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 100 | * |
Andrea Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 101 | * @param deviceId DeviceId of the device to configure |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 102 | * @param portNumber PortNumber of the port to configure |
| 103 | * @return the target power if the port has a target power, null otherwise |
| 104 | */ |
Andrea Campanella | dadf640 | 2019-08-07 15:24:11 +0200 | [diff] [blame] | 105 | Double getTargetPortPower(DeviceId deviceId, PortNumber portNumber); |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 106 | |
| 107 | /** |
Boyuan Yan | f3f6a8d | 2019-05-26 18:35:54 -0700 | [diff] [blame] | 108 | * Sync-up the target power for a port if the operator want to check the configuration. |
Andrea Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 109 | * |
| 110 | * @param deviceId DeviceId of the device to configure |
Boyuan Yan | f3f6a8d | 2019-05-26 18:35:54 -0700 | [diff] [blame] | 111 | * @param portNumber PortNumber of the port to configure |
| 112 | * @return the target power if the port has a target power, null otherwise |
| 113 | */ |
Andrea Campanella | dadf640 | 2019-08-07 15:24:11 +0200 | [diff] [blame] | 114 | Double syncTargetPortPower(DeviceId deviceId, PortNumber portNumber); |
Boyuan Yan | f3f6a8d | 2019-05-26 18:35:54 -0700 | [diff] [blame] | 115 | |
| 116 | /** |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 117 | * Sets the attenuation of a connection. This does not check that attenuation |
| 118 | * is within the acceptable range. |
| 119 | * |
Andrea Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 120 | * @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 Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 123 | * @param attenuation attenuation value to set to |
| 124 | */ |
Andrea Campanella | dadf640 | 2019-08-07 15:24:11 +0200 | [diff] [blame] | 125 | void setAttenuation(DeviceId deviceId, PortNumber portNumber, OchSignal ochSignal, double attenuation); |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 126 | |
| 127 | /** |
| 128 | * Returns the attenuation of a connection. |
| 129 | * |
Andrea Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 130 | * @param deviceId DeviceId of the device |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 131 | * @param portNumber PortNumber of either the input or output port |
Andrea Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 132 | * @param ochSignal channel to search for |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 133 | * @return attenuation if found, null otherwise |
| 134 | */ |
Andrea Campanella | dadf640 | 2019-08-07 15:24:11 +0200 | [diff] [blame] | 135 | Double getAttenuation(DeviceId deviceId, PortNumber portNumber, OchSignal ochSignal); |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 136 | |
| 137 | /** |
| 138 | * Returns the current port power. |
| 139 | * |
Andrea Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 140 | * @param deviceId DeviceId of the device |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 141 | * @param portNumber PortNumber of the port |
| 142 | * @return current power if found, null otherwise |
| 143 | */ |
Andrea Campanella | dadf640 | 2019-08-07 15:24:11 +0200 | [diff] [blame] | 144 | Double getCurrentPortPower(DeviceId deviceId, PortNumber portNumber); |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 145 | |
| 146 | /** |
| 147 | * Returns the current channel power. |
| 148 | * |
Andrea Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 149 | * @param deviceId DeviceId of the device |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 150 | * @param portNumber PortNumber of either the input or output port of the connection |
Andrea Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 151 | * @param ochSignal channel to search for |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 152 | * @return channel power if found, null otherwise |
| 153 | */ |
Andrea Campanella | dadf640 | 2019-08-07 15:24:11 +0200 | [diff] [blame] | 154 | Double getCurrentChannelPower(DeviceId deviceId, PortNumber portNumber, OchSignal ochSignal); |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 155 | |
| 156 | /** |
| 157 | * Returns the channels supported by a port. |
| 158 | * |
Andrea Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 159 | * @param deviceId DeviceId of the device |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 160 | * @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 Campanella | bdeeda1 | 2019-08-02 16:12:05 +0200 | [diff] [blame] | 166 | * Set modulation for a port if the port has configurable modulation. |
| 167 | * |
Andrea Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 168 | * @param deviceId DeviceId of the device to configure |
Andrea Campanella | bdeeda1 | 2019-08-02 16:12:05 +0200 | [diff] [blame] | 169 | * @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 Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 177 | * @param deviceId DeviceId of the device to configure |
Andrea Campanella | bdeeda1 | 2019-08-02 16:12:05 +0200 | [diff] [blame] | 178 | * @param portNumber PortNumber of the port to configure |
| 179 | * @return modulation scheme |
| 180 | */ |
| 181 | ModulationScheme getModulation(DeviceId deviceId, PortNumber portNumber); |
| 182 | |
| 183 | /** |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 184 | * 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 Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 187 | * <p> |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 188 | * Connections are represented as flows with an input port, output port, and |
MaoLu | 937cf42 | 2017-03-03 23:31:46 -0800 | [diff] [blame] | 189 | * channel. |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 190 | * |
Andrea Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 191 | * @param deviceId DeviceId of the device to create this connection for |
| 192 | * @param priority priority of the flow |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 193 | * @param isPermanent permanence of the flow |
Andrea Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 194 | * @param timeout timeout in seconds |
| 195 | * @param inPort input port |
| 196 | * @param outPort output port |
| 197 | * @param ochSignal channel to use |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 198 | * @return FlowId of the FlowRule representing the connection |
| 199 | */ |
| 200 | FlowId createConnection(DeviceId deviceId, int priority, boolean isPermanent, |
Andrea Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 201 | int timeout, PortNumber inPort, PortNumber outPort, OchSignal ochSignal); |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 202 | |
| 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 Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 207 | * <p> |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 208 | * Connections are represented as flows with an input port, output port, and |
| 209 | * channel. Implementation of attenuation is up to the vendor. |
| 210 | * |
Andrea Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 211 | * @param deviceId DeviceId of the device to create this connection for |
| 212 | * @param priority priority of the flow |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 213 | * @param isPermanent permanence of the flow |
Andrea Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 214 | * @param timeout timeout in seconds |
| 215 | * @param inPort input port |
| 216 | * @param outPort output port |
| 217 | * @param ochSignal channel to use |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 218 | * @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 Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 222 | 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 Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 233 | |
| 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 Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 240 | * @param flowId FlowId of the flow representing the connection to remove |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 241 | */ |
| 242 | void removeConnection(DeviceId deviceId, FlowId flowId); |
| 243 | |
| 244 | /** |
| 245 | * Returns true if the target power for this port can be configured. |
| 246 | * |
Andrea Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 247 | * @param deviceId DeviceId of the device |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 248 | * @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 Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 259 | * @param deviceId DeviceId of the device to check |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 260 | * @param portNumber PortNumber of the port to check |
Andrea Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 261 | * @param power value to check |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 262 | * @return true if value is within the acceptable target power range, false |
| 263 | * otherwise |
| 264 | */ |
Andrea Campanella | dadf640 | 2019-08-07 15:24:11 +0200 | [diff] [blame] | 265 | boolean portTargetPowerInRange(DeviceId deviceId, PortNumber portNumber, double power); |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 266 | |
| 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 Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 273 | * @param deviceId DeviceId of the device to check |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 274 | * @param portNumber PortNumber of either the input or output port of the connection |
Andrea Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 275 | * @param att value to check |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 276 | * @return true if value is within the acceptable attenuation range, false |
| 277 | * otherwise |
| 278 | */ |
Andrea Campanella | dadf640 | 2019-08-07 15:24:11 +0200 | [diff] [blame] | 279 | boolean attenuationInRange(DeviceId deviceId, PortNumber portNumber, double att); |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 280 | |
| 281 | /** |
| 282 | * Returns true if the port is an input port. |
| 283 | * |
Andrea Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 284 | * @param deviceId DeviceId of the device to check |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 285 | * @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 Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 293 | * @param deviceId DeviceId of the device to check |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 294 | * @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 Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 303 | * @param deviceId DeviceId of the device to check |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 304 | * @param portNumber PortNumber of the port to check |
Andrea Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 305 | * @param ochSignal channel to check |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 306 | * @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 Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 314 | * @param deviceId DeviceId of the device to check |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 315 | * @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 Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 326 | * @param inPort input port of the connection |
| 327 | * @param outPort output port of the connection |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 328 | * @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 Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 335 | * @param deviceId DeviceId of the device |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 336 | * @param portNumber PortNumber of the port |
| 337 | * @return range if found, null otherwise |
| 338 | */ |
Andrea Campanella | dadf640 | 2019-08-07 15:24:11 +0200 | [diff] [blame] | 339 | Range<Double> targetPortPowerRange(DeviceId deviceId, PortNumber portNumber); |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 340 | |
| 341 | /** |
| 342 | * Returns the acceptable attenuation range for a connection. |
| 343 | * |
Andrea Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 344 | * @param deviceId DeviceId of the device |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 345 | * @param portNumber PortNumber of either the input or output port |
Andrea Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 346 | * @param ochSignal channel to check |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 347 | * @return range if found, null otherwise |
| 348 | */ |
Andrea Campanella | dadf640 | 2019-08-07 15:24:11 +0200 | [diff] [blame] | 349 | Range<Double> attenuationRange(DeviceId deviceId, PortNumber portNumber, OchSignal ochSignal); |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 350 | |
| 351 | /** |
| 352 | * Returns the expected input power range for an input port. |
| 353 | * |
Andrea Campanella | 7ebfe32 | 2019-08-29 11:46:57 -0700 | [diff] [blame^] | 354 | * @param deviceId DeviceId of the device |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 355 | * @param portNumber PortNumber of an input port |
| 356 | * @return range if found, null otherwise |
| 357 | */ |
Andrea Campanella | dadf640 | 2019-08-07 15:24:11 +0200 | [diff] [blame] | 358 | Range<Double> inputPortPowerRange(DeviceId deviceId, PortNumber portNumber); |
Jimmy Yan | da878fc | 2016-09-02 16:32:01 -0700 | [diff] [blame] | 359 | } |