blob: aa0955e7a4cf79ad45a816d2c7478692b5323d67 [file] [log] [blame]
Boyuan Yana00e3d02019-04-10 23:43:12 -07001/*
Sudeep Desaif0911a72019-12-09 18:31:37 +05302 * Copyright 2019-present Open Networking Foundation
Boyuan Yana00e3d02019-04-10 23:43:12 -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 *
16 * This work was partially supported by EC H2020 project METRO-HAUL (761727).
17 */
18
19package org.onosproject.drivers.odtn;
20
21import com.google.common.collect.Range;
Sudeep Desaif0911a72019-12-09 18:31:37 +053022import org.onosproject.drivers.odtn.openconfig.TerminalDevicePowerConfig;
Boyuan Yana00e3d02019-04-10 23:43:12 -070023import org.onosproject.net.PortNumber;
24import org.onosproject.net.behaviour.PowerConfig;
Boyuan Yana00e3d02019-04-10 23:43:12 -070025
Boyuan Yana00e3d02019-04-10 23:43:12 -070026import java.util.Optional;
Boyuan Yana00e3d02019-04-10 23:43:12 -070027
28/**
29 * Driver Implementation of the PowerConfig for OpenConfig terminal devices.
Boyuan Yana00e3d02019-04-10 23:43:12 -070030 */
Boyuan Yan7bee2482019-05-22 17:15:53 -070031public class CassiniTerminalDevicePowerConfig<T>
Sudeep Desaif0911a72019-12-09 18:31:37 +053032 extends TerminalDevicePowerConfig<T> implements PowerConfig<T> {
Boyuan Yana00e3d02019-04-10 23:43:12 -070033 /**
Sudeep Desaif0911a72019-12-09 18:31:37 +053034 * Getting target value of output power.
35 * @param port port
36 * @param component the component
37 * @return target output power range
Boyuan Yana00e3d02019-04-10 23:43:12 -070038 */
39 @Override
Sudeep Desaif0911a72019-12-09 18:31:37 +053040 public Optional<Range<Double>> getTargetPowerRange(PortNumber port, Object component) {
41 double targetMin = -30;
42 double targetMax = 1;
43 return Optional.of(Range.open(targetMin, targetMax));
Boyuan Yan7bee2482019-05-22 17:15:53 -070044 }
45
46 @Override
Sudeep Desaif0911a72019-12-09 18:31:37 +053047 public Optional<Range<Double>> getInputPowerRange(PortNumber port, Object component) {
48 double targetMin = -30;
49 double targetMax = 1;
50 return Optional.of(Range.open(targetMin, targetMax));
Boyuan Yan7bee2482019-05-22 17:15:53 -070051 }
52
Sudeep Desaif0911a72019-12-09 18:31:37 +053053}