blob: 3bcae8253b8709f31192992b366de3985fea6beb [file] [log] [blame]
Yuta HIGUCHIb9af6b72016-06-10 10:52:58 -07001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2016-present Open Networking Foundation
Yuta HIGUCHIb9af6b72016-06-10 10:52:58 -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.config;
17
18import org.onosproject.net.ConnectPoint;
19import org.onosproject.net.DeviceId;
20import org.onosproject.net.device.PortDescription;
21
22import com.google.common.annotations.Beta;
23
debmaiti9553ed72019-03-18 14:27:42 +053024import java.util.Optional;
25
Yuta HIGUCHIb9af6b72016-06-10 10:52:58 -070026/**
27 * {@link ConfigOperator} for Port.
28 * <p>
29 * Note: We currently assumes {@link PortConfigOperator}s are commutative.
30 */
31@Beta
32public 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 HIGUCHIb9af6b72016-06-10 10:52:58 -070041 /**
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}
debmaiti9553ed72019-03-18 14:27:42 +053048 * @deprecated onos-2.0
Yuta HIGUCHIb9af6b72016-06-10 10:52:58 -070049 */
debmaiti9553ed72019-03-18 14:27:42 +053050 @Deprecated
Yuta HIGUCHIb9af6b72016-06-10 10:52:58 -070051 PortDescription combine(ConnectPoint cp, PortDescription descr);
52
53 /**
54 * Generates a PortDescription containing fields from a PortDescription and
55 * configuration.
56 *
debmaiti9553ed72019-03-18 14:27:42 +053057 * @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 HIGUCHIb9af6b72016-06-10 10:52:58 -070068 * @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}