samuel | 8d6b0a9 | 2015-07-11 13:22:57 +0800 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Foundation |
samuel | 8d6b0a9 | 2015-07-11 13:22:57 +0800 | [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.behaviour; |
| 17 | |
| 18 | import org.onosproject.net.Description; |
| 19 | import org.onosproject.net.DeviceId; |
| 20 | |
Hyunsun Moon | 1251e19 | 2016-06-07 16:57:05 -0700 | [diff] [blame] | 21 | import java.util.List; |
| 22 | import java.util.Optional; |
| 23 | |
samuel | 8d6b0a9 | 2015-07-11 13:22:57 +0800 | [diff] [blame] | 24 | /** |
Hyunsun Moon | 1251e19 | 2016-06-07 16:57:05 -0700 | [diff] [blame] | 25 | * 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. |
samuel | 8d6b0a9 | 2015-07-11 13:22:57 +0800 | [diff] [blame] | 28 | */ |
| 29 | public interface BridgeDescription extends Description { |
| 30 | |
Hyunsun Moon | 1251e19 | 2016-06-07 16:57:05 -0700 | [diff] [blame] | 31 | 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 | |
samuel | 8d6b0a9 | 2015-07-11 13:22:57 +0800 | [diff] [blame] | 43 | /** |
| 44 | * Returns bridge name. |
| 45 | * |
| 46 | * @return bridge name |
| 47 | */ |
Hyunsun Moon | 1251e19 | 2016-06-07 16:57:05 -0700 | [diff] [blame] | 48 | String name(); |
samuel | 8d6b0a9 | 2015-07-11 13:22:57 +0800 | [diff] [blame] | 49 | |
| 50 | /** |
Hyunsun Moon | 1251e19 | 2016-06-07 16:57:05 -0700 | [diff] [blame] | 51 | * Returns OpenFlow controllers of the bridge. |
| 52 | * If it's empty, then no OpenFlow controllers are used for the bridge. |
samuel | 8d6b0a9 | 2015-07-11 13:22:57 +0800 | [diff] [blame] | 53 | * |
Hyunsun Moon | 1251e19 | 2016-06-07 16:57:05 -0700 | [diff] [blame] | 54 | * @return set of controllers |
samuel | 8d6b0a9 | 2015-07-11 13:22:57 +0800 | [diff] [blame] | 55 | */ |
Hyunsun Moon | 1251e19 | 2016-06-07 16:57:05 -0700 | [diff] [blame] | 56 | List<ControllerInfo> controllers(); |
samuel | 8d6b0a9 | 2015-07-11 13:22:57 +0800 | [diff] [blame] | 57 | |
| 58 | /** |
Hyunsun Moon | 1251e19 | 2016-06-07 16:57:05 -0700 | [diff] [blame] | 59 | * Returns whether to use local controller as an OpenFlow controller of the |
| 60 | * bridge if no controllers are specified. |
samuel | 8d6b0a9 | 2015-07-11 13:22:57 +0800 | [diff] [blame] | 61 | * |
Hyunsun Moon | 1251e19 | 2016-06-07 16:57:05 -0700 | [diff] [blame] | 62 | * @return true to set local controller, false otherwise |
samuel | 8d6b0a9 | 2015-07-11 13:22:57 +0800 | [diff] [blame] | 63 | */ |
Hyunsun Moon | 1251e19 | 2016-06-07 16:57:05 -0700 | [diff] [blame] | 64 | 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 | /** |
jaegonkim | 80bee53 | 2017-05-15 15:16:38 +0900 | [diff] [blame] | 83 | * Returns OVSDB datapath Type of the bridge. |
| 84 | * |
| 85 | * @return datapath type |
| 86 | */ |
| 87 | Optional<String> datapathType(); |
| 88 | |
| 89 | /** |
Hyunsun Moon | 1251e19 | 2016-06-07 16:57:05 -0700 | [diff] [blame] | 90 | * 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 Li | a56dea6 | 2020-12-12 03:54:54 +0900 | [diff] [blame] | 107 | * 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 | /** |
rohitsharan | a127ba8 | 2018-01-16 02:17:30 +0530 | [diff] [blame] | 116 | * 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 Moon | 1251e19 | 2016-06-07 16:57:05 -0700 | [diff] [blame] | 124 | * 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 | /** |
jaegonkim | 80bee53 | 2017-05-15 15:16:38 +0900 | [diff] [blame] | 168 | * 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 | /** |
rohitsharan | a127ba8 | 2018-01-16 02:17:30 +0530 | [diff] [blame] | 176 | * 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 Moon | 1251e19 | 2016-06-07 16:57:05 -0700 | [diff] [blame] | 183 | * Returns bridge description builder with in-band control disabled. |
| 184 | * |
| 185 | * @return bridge description builder |
| 186 | */ |
| 187 | Builder disableInBand(); |
| 188 | |
| 189 | /** |
Jian Li | a56dea6 | 2020-12-12 03:54:54 +0900 | [diff] [blame] | 190 | * Returns bridge description builder with mcast snooping enabled. |
| 191 | * |
| 192 | * @return bridge description builder |
| 193 | */ |
| 194 | Builder mcastSnoopingEnable(); |
| 195 | |
| 196 | /** |
Hyunsun Moon | 1251e19 | 2016-06-07 16:57:05 -0700 | [diff] [blame] | 197 | * Builds an immutable bridge description. |
| 198 | * |
| 199 | * @return bridge description |
| 200 | */ |
| 201 | BridgeDescription build(); |
| 202 | } |
samuel | 8d6b0a9 | 2015-07-11 13:22:57 +0800 | [diff] [blame] | 203 | } |