Boyuan Yan | a00e3d0 | 2019-04-10 23:43:12 -0700 | [diff] [blame] | 1 | /* |
Sudeep Desai | f0911a7 | 2019-12-09 18:31:37 +0530 | [diff] [blame] | 2 | * Copyright 2019-present Open Networking Foundation |
Boyuan Yan | a00e3d0 | 2019-04-10 23:43:12 -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 | * This work was partially supported by EC H2020 project METRO-HAUL (761727). |
| 17 | */ |
| 18 | |
| 19 | package org.onosproject.drivers.odtn; |
| 20 | |
| 21 | import com.google.common.collect.Range; |
Sudeep Desai | f0911a7 | 2019-12-09 18:31:37 +0530 | [diff] [blame] | 22 | import org.onosproject.drivers.odtn.openconfig.TerminalDevicePowerConfig; |
Boyuan Yan | a00e3d0 | 2019-04-10 23:43:12 -0700 | [diff] [blame] | 23 | import org.onosproject.net.PortNumber; |
| 24 | import org.onosproject.net.behaviour.PowerConfig; |
Boyuan Yan | a00e3d0 | 2019-04-10 23:43:12 -0700 | [diff] [blame] | 25 | |
Boyuan Yan | a00e3d0 | 2019-04-10 23:43:12 -0700 | [diff] [blame] | 26 | import java.util.Optional; |
Boyuan Yan | a00e3d0 | 2019-04-10 23:43:12 -0700 | [diff] [blame] | 27 | |
| 28 | /** |
| 29 | * Driver Implementation of the PowerConfig for OpenConfig terminal devices. |
Boyuan Yan | a00e3d0 | 2019-04-10 23:43:12 -0700 | [diff] [blame] | 30 | */ |
Boyuan Yan | 7bee248 | 2019-05-22 17:15:53 -0700 | [diff] [blame] | 31 | public class CassiniTerminalDevicePowerConfig<T> |
Sudeep Desai | f0911a7 | 2019-12-09 18:31:37 +0530 | [diff] [blame] | 32 | extends TerminalDevicePowerConfig<T> implements PowerConfig<T> { |
Boyuan Yan | a00e3d0 | 2019-04-10 23:43:12 -0700 | [diff] [blame] | 33 | /** |
Sudeep Desai | f0911a7 | 2019-12-09 18:31:37 +0530 | [diff] [blame] | 34 | * Getting target value of output power. |
| 35 | * @param port port |
| 36 | * @param component the component |
| 37 | * @return target output power range |
Boyuan Yan | a00e3d0 | 2019-04-10 23:43:12 -0700 | [diff] [blame] | 38 | */ |
| 39 | @Override |
Sudeep Desai | f0911a7 | 2019-12-09 18:31:37 +0530 | [diff] [blame] | 40 | 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 Yan | 7bee248 | 2019-05-22 17:15:53 -0700 | [diff] [blame] | 44 | } |
| 45 | |
| 46 | @Override |
Sudeep Desai | f0911a7 | 2019-12-09 18:31:37 +0530 | [diff] [blame] | 47 | 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 Yan | 7bee248 | 2019-05-22 17:15:53 -0700 | [diff] [blame] | 51 | } |
| 52 | |
Sudeep Desai | f0911a7 | 2019-12-09 18:31:37 +0530 | [diff] [blame] | 53 | } |