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 org.onosproject.net.DeviceId; |
| 19 | import org.onosproject.net.PortNumber; |
| 20 | |
| 21 | /** |
| 22 | * Interface for the ROADM store. Currently used to store target power only. |
| 23 | * This should be removed if target power could be read port annotations. |
| 24 | */ |
| 25 | public interface RoadmStore { |
| 26 | |
| 27 | /** |
| 28 | * Adds the device to the store. |
| 29 | * |
| 30 | * <p>The device needs to be added to the store |
| 31 | * before setTargetPower and getTargetPower can be used. This does not initialize |
| 32 | * any of the target powers. |
| 33 | * |
| 34 | * @param deviceId DeviceId of the device to add |
| 35 | */ |
| 36 | void addDevice(DeviceId deviceId); |
| 37 | |
| 38 | /** |
| 39 | * Returns true if the device has been added to the store. |
| 40 | * |
| 41 | * @param deviceId DeviceId of the device to check |
| 42 | * @return true if device has been added to the store, false otherwise |
| 43 | */ |
| 44 | boolean deviceAvailable(DeviceId deviceId); |
| 45 | |
| 46 | /** |
| 47 | * Stores the targetPower for a port on a device. The device needs to be added |
| 48 | * to the store before this can be called. This does nothing if the device is |
| 49 | * not added. |
| 50 | * |
| 51 | * @param deviceId DeviceId of the device |
| 52 | * @param portNumber PortNumber of the port |
| 53 | * @param targetPower target port power to store |
| 54 | */ |
| 55 | void setTargetPower(DeviceId deviceId, PortNumber portNumber, long targetPower); |
| 56 | |
| 57 | /** |
| 58 | * Returns the targetPower for a port on a device. The device needs to be added |
| 59 | * to the store before this can be called. Returns null if the port's target |
| 60 | * power has not yet been initialized using setTargetPower. |
| 61 | * |
| 62 | * @param deviceId DeviceId of the device |
| 63 | * @param portNumber PortNumber of the port |
| 64 | * @return target power if target power has already been set, null otherwise |
| 65 | */ |
| 66 | Long getTargetPower(DeviceId deviceId, PortNumber portNumber); |
| 67 | } |