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 | /** |
rohitsharan | a127ba8 | 2018-01-16 02:17:30 +0530 | [diff] [blame] | 107 | * Returns list of Control Protocol Versions supported on device. |
| 108 | * @return List of Control Protocol Versions enabled on bridge |
| 109 | */ |
| 110 | Optional<List<ControlProtocolVersion>> controlProtocols(); |
| 111 | |
| 112 | /** |
| 113 | |
| 114 | /** |
Hyunsun Moon | 1251e19 | 2016-06-07 16:57:05 -0700 | [diff] [blame] | 115 | * Builder of bridge description entities. |
| 116 | */ |
| 117 | interface Builder { |
| 118 | |
| 119 | /** |
| 120 | * Returns bridge description builder with a given name. |
| 121 | * |
| 122 | * @param name bridge name |
| 123 | * @return bridge description builder |
| 124 | */ |
| 125 | Builder name(String name); |
| 126 | |
| 127 | /** |
| 128 | * Returns bridge description builder with given controllers. |
| 129 | * |
| 130 | * @param controllers set of controllers |
| 131 | * @return bridge description builder |
| 132 | */ |
| 133 | Builder controllers(List<ControllerInfo> controllers); |
| 134 | |
| 135 | /** |
| 136 | * Returns bridge description builder with local controller enabled. |
| 137 | * |
| 138 | * @return bridge description builder |
| 139 | */ |
| 140 | Builder enableLocalController(); |
| 141 | |
| 142 | /** |
| 143 | * Returns bridge description builder with a given fail mode. |
| 144 | * |
| 145 | * @param failMode fail mode |
| 146 | * @return bridge description builder |
| 147 | */ |
| 148 | Builder failMode(FailMode failMode); |
| 149 | |
| 150 | /** |
| 151 | * Returns bridge description builder with a given datapath ID. |
| 152 | * |
| 153 | * @param datapathId datapath id |
| 154 | * @return bridge description builder |
| 155 | */ |
| 156 | Builder datapathId(String datapathId); |
| 157 | |
| 158 | /** |
jaegonkim | 80bee53 | 2017-05-15 15:16:38 +0900 | [diff] [blame] | 159 | * Returns bridge description builder with a given datapath type. |
| 160 | * |
| 161 | * @param datapathType datapath type |
| 162 | * @return bridge description builder |
| 163 | */ |
| 164 | Builder datapathType(String datapathType); |
| 165 | |
| 166 | /** |
rohitsharan | a127ba8 | 2018-01-16 02:17:30 +0530 | [diff] [blame] | 167 | * Returns bridge description builder with given control protocol versions. |
| 168 | * @param controlProtocols List of control protocol |
| 169 | * @return bridge description builder |
| 170 | */ |
| 171 | Builder controlProtocols(List<ControlProtocolVersion> controlProtocols); |
| 172 | |
| 173 | /** |
Hyunsun Moon | 1251e19 | 2016-06-07 16:57:05 -0700 | [diff] [blame] | 174 | * Returns bridge description builder with in-band control disabled. |
| 175 | * |
| 176 | * @return bridge description builder |
| 177 | */ |
| 178 | Builder disableInBand(); |
| 179 | |
| 180 | /** |
| 181 | * Builds an immutable bridge description. |
| 182 | * |
| 183 | * @return bridge description |
| 184 | */ |
| 185 | BridgeDescription build(); |
| 186 | } |
samuel | 8d6b0a9 | 2015-07-11 13:22:57 +0800 | [diff] [blame] | 187 | } |