blob: 5273b871737616911716d0e0fa619c427608e6df [file] [log] [blame]
samuel8d6b0a92015-07-11 13:22:57 +08001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2015-present Open Networking Foundation
samuel8d6b0a92015-07-11 13:22:57 +08003 *
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.Description;
19import org.onosproject.net.DeviceId;
20
Hyunsun Moon1251e192016-06-07 16:57:05 -070021import java.util.List;
22import java.util.Optional;
23
samuel8d6b0a92015-07-11 13:22:57 +080024/**
Hyunsun Moon1251e192016-06-07 16:57:05 -070025 * The abstraction of a bridge. Bridge represents an Ethernet switch with no or
26 * multiple OpenFlow controllers. Only OVSDB device provides bridge config behavior
27 * now and the bridge description is based on OVSDB schema.
samuel8d6b0a92015-07-11 13:22:57 +080028 */
29public interface BridgeDescription extends Description {
30
Hyunsun Moon1251e192016-06-07 16:57:05 -070031 enum FailMode {
32 /**
33 * The bridge will not set up flows on its own when the controller
34 * connection fails or no controllers are defined.
35 */
36 SECURE,
37 /**
38 * The bridge will take over responsibility of setting up flows.
39 */
40 STANDALONE
41 }
42
samuel8d6b0a92015-07-11 13:22:57 +080043 /**
44 * Returns bridge name.
45 *
46 * @return bridge name
47 */
Hyunsun Moon1251e192016-06-07 16:57:05 -070048 String name();
samuel8d6b0a92015-07-11 13:22:57 +080049
50 /**
Hyunsun Moon1251e192016-06-07 16:57:05 -070051 * Returns OpenFlow controllers of the bridge.
52 * If it's empty, then no OpenFlow controllers are used for the bridge.
samuel8d6b0a92015-07-11 13:22:57 +080053 *
Hyunsun Moon1251e192016-06-07 16:57:05 -070054 * @return set of controllers
samuel8d6b0a92015-07-11 13:22:57 +080055 */
Hyunsun Moon1251e192016-06-07 16:57:05 -070056 List<ControllerInfo> controllers();
samuel8d6b0a92015-07-11 13:22:57 +080057
58 /**
Hyunsun Moon1251e192016-06-07 16:57:05 -070059 * Returns whether to use local controller as an OpenFlow controller of the
60 * bridge if no controllers are specified.
samuel8d6b0a92015-07-11 13:22:57 +080061 *
Hyunsun Moon1251e192016-06-07 16:57:05 -070062 * @return true to set local controller, false otherwise
samuel8d6b0a92015-07-11 13:22:57 +080063 */
Hyunsun Moon1251e192016-06-07 16:57:05 -070064 boolean enableLocalController();
65
66 /**
67 * Returns fail mode of the bridge.
68 * If it's not set, the default setting of the bridge is used.
69 *
70 * @return fail mode
71 */
72 Optional<FailMode> failMode();
73
74 /**
75 * Returns OpenFlow datapath ID of the bridge. Valid only if OpenFlow controller
76 * is configured for the bridge.
77 *
78 * @return datapath id
79 */
80 Optional<String> datapathId();
81
82 /**
jaegonkim80bee532017-05-15 15:16:38 +090083 * Returns OVSDB datapath Type of the bridge.
84 *
85 * @return datapath type
86 */
87 Optional<String> datapathType();
88
89 /**
Hyunsun Moon1251e192016-06-07 16:57:05 -070090 * Returns OpenFlow device ID. Valid only if OpenFlow controller is configured
91 * for the bridge.
92 *
93 * @return device id
94 */
95 Optional<DeviceId> deviceId();
96
97 /**
98 * Returns in band control is enabled or not. If set to true, disable in-band
99 * control on the bridge regardless of controller and manager settings.
100 * If it's not set, the default setting of the bridge is used.
101 *
102 * @return true if in-band is disabled, false if in-band is enabled
103 */
104 Optional<Boolean> disableInBand();
105
106 /**
Jian Li0aed0e62020-12-12 03:54:54 +0900107 * Returns multicast snooping is enabled or not. If set to true, enable multicast
108 * snooping on the bridge.
109 * If it is not set, the multicast snooping is disabled.
110 *
111 * @return true if the multicast snooping is enabled, false otherwise
112 */
113 Optional<Boolean> mcastSnoopingEnable();
114
115 /**
rohitsharana127ba82018-01-16 02:17:30 +0530116 * Returns list of Control Protocol Versions supported on device.
117 * @return List of Control Protocol Versions enabled on bridge
118 */
119 Optional<List<ControlProtocolVersion>> controlProtocols();
120
121 /**
122
123 /**
Hyunsun Moon1251e192016-06-07 16:57:05 -0700124 * Builder of bridge description entities.
125 */
126 interface Builder {
127
128 /**
129 * Returns bridge description builder with a given name.
130 *
131 * @param name bridge name
132 * @return bridge description builder
133 */
134 Builder name(String name);
135
136 /**
137 * Returns bridge description builder with given controllers.
138 *
139 * @param controllers set of controllers
140 * @return bridge description builder
141 */
142 Builder controllers(List<ControllerInfo> controllers);
143
144 /**
145 * Returns bridge description builder with local controller enabled.
146 *
147 * @return bridge description builder
148 */
149 Builder enableLocalController();
150
151 /**
152 * Returns bridge description builder with a given fail mode.
153 *
154 * @param failMode fail mode
155 * @return bridge description builder
156 */
157 Builder failMode(FailMode failMode);
158
159 /**
160 * Returns bridge description builder with a given datapath ID.
161 *
162 * @param datapathId datapath id
163 * @return bridge description builder
164 */
165 Builder datapathId(String datapathId);
166
167 /**
jaegonkim80bee532017-05-15 15:16:38 +0900168 * Returns bridge description builder with a given datapath type.
169 *
170 * @param datapathType datapath type
171 * @return bridge description builder
172 */
173 Builder datapathType(String datapathType);
174
175 /**
rohitsharana127ba82018-01-16 02:17:30 +0530176 * Returns bridge description builder with given control protocol versions.
177 * @param controlProtocols List of control protocol
178 * @return bridge description builder
179 */
180 Builder controlProtocols(List<ControlProtocolVersion> controlProtocols);
181
182 /**
Hyunsun Moon1251e192016-06-07 16:57:05 -0700183 * Returns bridge description builder with in-band control disabled.
184 *
185 * @return bridge description builder
186 */
187 Builder disableInBand();
188
189 /**
Jian Li0aed0e62020-12-12 03:54:54 +0900190 * Returns bridge description builder with mcast snooping enabled.
191 *
192 * @return bridge description builder
193 */
194 Builder mcastSnoopingEnable();
195
196 /**
Hyunsun Moon1251e192016-06-07 16:57:05 -0700197 * Builds an immutable bridge description.
198 *
199 * @return bridge description
200 */
201 BridgeDescription build();
202 }
samuel8d6b0a92015-07-11 13:22:57 +0800203}