Yuta HIGUCHI | b9af6b7 | 2016-06-10 10:52:58 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Foundation |
Yuta HIGUCHI | b9af6b7 | 2016-06-10 10:52:58 -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.net.config; |
| 17 | |
| 18 | import org.onosproject.net.ConnectPoint; |
| 19 | import org.onosproject.net.DeviceId; |
| 20 | import org.onosproject.net.device.PortDescription; |
| 21 | |
| 22 | import com.google.common.annotations.Beta; |
| 23 | |
debmaiti | 9553ed7 | 2019-03-18 14:27:42 +0530 | [diff] [blame] | 24 | import java.util.Optional; |
| 25 | |
Yuta HIGUCHI | b9af6b7 | 2016-06-10 10:52:58 -0700 | [diff] [blame] | 26 | /** |
| 27 | * {@link ConfigOperator} for Port. |
| 28 | * <p> |
| 29 | * Note: We currently assumes {@link PortConfigOperator}s are commutative. |
| 30 | */ |
| 31 | @Beta |
| 32 | public interface PortConfigOperator extends ConfigOperator { |
| 33 | |
| 34 | /** |
| 35 | * Binds {@link NetworkConfigService} to use for retrieving configuration. |
| 36 | * |
| 37 | * @param networkConfigService the service to use |
| 38 | */ |
| 39 | void bindService(NetworkConfigService networkConfigService); |
| 40 | |
Yuta HIGUCHI | b9af6b7 | 2016-06-10 10:52:58 -0700 | [diff] [blame] | 41 | /** |
| 42 | * Generates a PortDescription containing fields from a PortDescription and |
| 43 | * configuration. |
| 44 | * |
| 45 | * @param cp {@link ConnectPoint} representing the port. |
| 46 | * @param descr input {@link PortDescription} |
| 47 | * @return Combined {@link PortDescription} |
debmaiti | 9553ed7 | 2019-03-18 14:27:42 +0530 | [diff] [blame] | 48 | * @deprecated onos-2.0 |
Yuta HIGUCHI | b9af6b7 | 2016-06-10 10:52:58 -0700 | [diff] [blame] | 49 | */ |
debmaiti | 9553ed7 | 2019-03-18 14:27:42 +0530 | [diff] [blame] | 50 | @Deprecated |
Yuta HIGUCHI | b9af6b7 | 2016-06-10 10:52:58 -0700 | [diff] [blame] | 51 | PortDescription combine(ConnectPoint cp, PortDescription descr); |
| 52 | |
| 53 | /** |
| 54 | * Generates a PortDescription containing fields from a PortDescription and |
| 55 | * configuration. |
| 56 | * |
debmaiti | 9553ed7 | 2019-03-18 14:27:42 +0530 | [diff] [blame] | 57 | * @param cp {@link ConnectPoint} representing the port. |
| 58 | * @param descr input {@link PortDescription} |
| 59 | * @param prevConf previous Config {@link Config} |
| 60 | * @return Combined {@link PortDescription} |
| 61 | */ |
| 62 | PortDescription combine(ConnectPoint cp, PortDescription descr, Optional<Config> prevConf); |
| 63 | |
| 64 | /** |
| 65 | * Generates a PortDescription containing fields from a PortDescription and |
| 66 | * configuration. |
| 67 | * |
Yuta HIGUCHI | b9af6b7 | 2016-06-10 10:52:58 -0700 | [diff] [blame] | 68 | * @param did DeviceId which the port described by {@code descr} resides. |
| 69 | * @param descr input {@link PortDescription} |
| 70 | * @return Combined {@link PortDescription} |
| 71 | */ |
| 72 | default PortDescription combine(DeviceId did, PortDescription descr) { |
| 73 | return combine(new ConnectPoint(did, descr.portNumber()), descr); |
| 74 | } |
| 75 | |
| 76 | } |