blob: 6c7abac2f08cb9a889410357223032956a4bcf56 [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 org.onosproject.net.DeviceId;
19import 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 */
25public 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);
Boyuan Yanf3f6a8d2019-05-26 18:35:54 -070067
68 /**
69 * Remove the targetPower for a port on a device. The power value is removed,
70 * however, the device isn't.
71 * @param deviceId DeviceId of the device
72 * @param portNumber PortNumber of the port
73 */
74 void removeTargetPower(DeviceId deviceId, PortNumber portNumber);
Jimmy Yanda878fc2016-09-02 16:32:01 -070075}