Marc De Leenheer | 118f671 | 2015-10-21 16:06:21 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Laboratory |
Marc De Leenheer | 118f671 | 2015-10-21 16:06:21 -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.net.behaviour; |
| 17 | |
| 18 | import org.onosproject.net.PortNumber; |
| 19 | import org.onosproject.net.driver.HandlerBehaviour; |
| 20 | |
| 21 | import java.util.Optional; |
| 22 | |
| 23 | /** |
| 24 | * Behavior for handling port power configurations. |
| 25 | * |
| 26 | * Power operations act on a network port and a component thereof. |
| 27 | * Supported components are either the full directed port ({@link org.onosproject.net.Direction}) |
| 28 | * or a wavelength on a port ({@link org.onosproject.net.OchSignal}). |
| 29 | * |
| 30 | * Power levels are specified with a long and unit .01 dBm. |
| 31 | */ |
| 32 | public interface PowerConfig<T> extends HandlerBehaviour { |
| 33 | |
| 34 | /** |
| 35 | * Get the target power on the component. |
| 36 | * |
| 37 | * @param port the port |
| 38 | * @param component the port component |
| 39 | * @return target power in .01 dBm |
| 40 | */ |
| 41 | Optional<Long> getTargetPower(PortNumber port, T component); |
| 42 | |
| 43 | /** |
| 44 | * Set the target power on the component. |
| 45 | * |
| 46 | * |
| 47 | * @param port the port |
| 48 | * @param component the port component |
| 49 | * @param power target power in .01 dBm |
| 50 | */ |
| 51 | void setTargetPower(PortNumber port, T component, long power); |
| 52 | |
| 53 | /** |
| 54 | * Get the current power on the component. |
| 55 | * |
| 56 | * @param port the port |
| 57 | * @param component the port component |
| 58 | * @return power power in .01 dBm |
| 59 | */ |
| 60 | Optional<Long> currentPower(PortNumber port, T component); |
| 61 | } |