blob: 21254aa1272be06ab86170f072d921e0f4944bdd [file] [log] [blame]
Marc De Leenheer118f6712015-10-21 16:06:21 -07001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
Marc De Leenheer118f6712015-10-21 16:06:21 -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.net.behaviour;
17
18import org.onosproject.net.PortNumber;
19import org.onosproject.net.driver.HandlerBehaviour;
20
21import 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 */
32public 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}