Hyunsun Moon | 0d45736 | 2017-06-27 17:19:41 +0900 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2017-present Open Networking Foundation |
Hyunsun Moon | 0d45736 | 2017-06-27 17:19:41 +0900 | [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.openstacknode.api; |
| 17 | |
| 18 | import org.onlab.packet.IpAddress; |
| 19 | import org.onlab.packet.MacAddress; |
| 20 | import org.onosproject.core.GroupId; |
| 21 | import org.onosproject.net.DeviceId; |
| 22 | import org.onosproject.net.PortNumber; |
Jian Li | 789fadb | 2018-07-10 13:59:47 +0900 | [diff] [blame] | 23 | import org.onosproject.net.behaviour.ControllerInfo; |
Hyunsun Moon | 0d45736 | 2017-06-27 17:19:41 +0900 | [diff] [blame] | 24 | import org.onosproject.net.group.GroupKey; |
| 25 | |
Jian Li | e631216 | 2018-03-21 21:41:00 +0900 | [diff] [blame] | 26 | import java.util.Collection; |
| 27 | |
Hyunsun Moon | 0d45736 | 2017-06-27 17:19:41 +0900 | [diff] [blame] | 28 | /** |
| 29 | * Representation of a node used in OpenstackNetworking service. |
| 30 | */ |
| 31 | public interface OpenstackNode { |
| 32 | |
| 33 | /** |
Jian Li | e631216 | 2018-03-21 21:41:00 +0900 | [diff] [blame] | 34 | * List of valid network modes. |
| 35 | * This includes both physical and virtual network types. |
Hyunsun Moon | 0d45736 | 2017-06-27 17:19:41 +0900 | [diff] [blame] | 36 | */ |
| 37 | enum NetworkMode { |
| 38 | VXLAN, |
Jian Li | e631216 | 2018-03-21 21:41:00 +0900 | [diff] [blame] | 39 | VLAN, |
| 40 | FLAT |
Hyunsun Moon | 0d45736 | 2017-06-27 17:19:41 +0900 | [diff] [blame] | 41 | } |
| 42 | |
| 43 | /** |
| 44 | * List of valid node types. |
| 45 | */ |
| 46 | enum NodeType { |
| 47 | COMPUTE, |
Jian Li | 2784166 | 2018-04-14 01:59:47 +0900 | [diff] [blame] | 48 | GATEWAY, |
| 49 | CONTROLLER |
Hyunsun Moon | 0d45736 | 2017-06-27 17:19:41 +0900 | [diff] [blame] | 50 | } |
| 51 | |
| 52 | /** |
Daniel Park | 92abf31 | 2018-08-08 17:01:35 +0900 | [diff] [blame] | 53 | * List of valid data path types. |
| 54 | */ |
| 55 | enum DatapathType { |
| 56 | NORMAL, |
| 57 | NETDEV |
| 58 | } |
| 59 | |
| 60 | /** |
Hyunsun Moon | 0d45736 | 2017-06-27 17:19:41 +0900 | [diff] [blame] | 61 | * Returns hostname of the node. |
| 62 | * |
| 63 | * @return hostname |
| 64 | */ |
| 65 | String hostname(); |
| 66 | |
| 67 | /** |
| 68 | * Returns the type of the node. |
| 69 | * |
| 70 | * @return node type |
| 71 | */ |
| 72 | NodeType type(); |
| 73 | |
| 74 | /** |
| 75 | * Returns the OVSDB device ID of the node. |
| 76 | * |
| 77 | * @return ovsdb device id |
| 78 | */ |
| 79 | DeviceId ovsdb(); |
| 80 | |
| 81 | /** |
| 82 | * Returns the device ID of the integration bridge at the node. |
| 83 | * |
| 84 | * @return device id |
| 85 | */ |
| 86 | DeviceId intgBridge(); |
| 87 | |
| 88 | /** |
Hyunsun Moon | 0d45736 | 2017-06-27 17:19:41 +0900 | [diff] [blame] | 89 | * Returns the management network IP address of the node. |
| 90 | * |
| 91 | * @return ip address |
| 92 | */ |
| 93 | IpAddress managementIp(); |
| 94 | |
| 95 | /** |
| 96 | * Returns the data network IP address used for tunneling. |
| 97 | * |
| 98 | * @return ip address; null if vxlan mode is not enabled |
| 99 | */ |
| 100 | IpAddress dataIp(); |
| 101 | |
| 102 | /** |
| 103 | * Returns the name of the vlan interface. |
| 104 | * |
| 105 | * @return vlan interface name; null if vlan mode is not enabled |
| 106 | */ |
| 107 | String vlanIntf(); |
| 108 | |
| 109 | /** |
| 110 | * Returns the initialization state of the node. |
| 111 | * |
| 112 | * @return node state |
| 113 | */ |
| 114 | NodeState state(); |
| 115 | |
| 116 | /** |
| 117 | * Returns the gateway group ID of this node. |
| 118 | * |
| 119 | * @param mode network mode of the group |
| 120 | * @return gateway group identifier |
| 121 | */ |
| 122 | GroupId gatewayGroupId(NetworkMode mode); |
| 123 | |
| 124 | /** |
| 125 | * Returns the group key of this node. |
| 126 | * |
| 127 | * @param mode network mode of the group |
| 128 | * @return gateway group key |
| 129 | */ |
| 130 | GroupKey gatewayGroupKey(NetworkMode mode); |
| 131 | |
| 132 | /** |
| 133 | * Returns the tunnel port number. |
| 134 | * |
| 135 | * @return port number; null if tunnel port does not exist |
| 136 | */ |
| 137 | PortNumber tunnelPortNum(); |
| 138 | |
| 139 | /** |
Jian Li | 340165f | 2018-02-27 10:38:17 +0900 | [diff] [blame] | 140 | * Returns the vlan port number. |
Hyunsun Moon | 0d45736 | 2017-06-27 17:19:41 +0900 | [diff] [blame] | 141 | * |
| 142 | * @return port number; null if vlan port does not exist |
| 143 | */ |
| 144 | PortNumber vlanPortNum(); |
| 145 | |
| 146 | /** |
| 147 | * Returns the patch port number of the integration bridge. |
| 148 | * |
| 149 | * @return port number; null if the node type is compute |
| 150 | */ |
| 151 | PortNumber patchPortNum(); |
| 152 | |
| 153 | /** |
| 154 | * Returns the vlan port MAC address. |
| 155 | * |
| 156 | * @return mac address; null if vlan port does not exist |
| 157 | */ |
| 158 | MacAddress vlanPortMac(); |
| 159 | |
| 160 | /** |
daniel park | b18424c | 2018-02-05 15:43:43 +0900 | [diff] [blame] | 161 | * Returns the uplink port name. |
| 162 | * |
| 163 | * @return uplink port name; null if the node type is compute |
| 164 | */ |
| 165 | String uplinkPort(); |
| 166 | |
| 167 | /** |
Daniel Park | 92abf31 | 2018-08-08 17:01:35 +0900 | [diff] [blame] | 168 | * Returns the data path type. |
| 169 | * |
| 170 | * @return data path type; normal or netdev |
| 171 | */ |
| 172 | DatapathType datapathType(); |
| 173 | |
| 174 | /** |
Daniel Park | 7e8c4d8 | 2018-08-13 23:47:49 +0900 | [diff] [blame] | 175 | * Returns socket directory which dpdk port bound to. |
| 176 | * |
| 177 | * @return socket directory |
| 178 | */ |
| 179 | String socketDir(); |
| 180 | |
| 181 | /** |
daniel park | b581710 | 2018-02-15 00:18:51 +0900 | [diff] [blame] | 182 | * Returns the uplink port number. |
| 183 | * |
| 184 | * @return uplink port number |
| 185 | */ |
| 186 | PortNumber uplinkPortNum(); |
| 187 | |
| 188 | /** |
Hyunsun Moon | 0d45736 | 2017-06-27 17:19:41 +0900 | [diff] [blame] | 189 | * Returns new openstack node instance with given state. |
| 190 | * |
| 191 | * @param newState updated state |
| 192 | * @return updated openstack node |
| 193 | */ |
| 194 | OpenstackNode updateState(NodeState newState); |
| 195 | |
| 196 | /** |
Jian Li | e314154 | 2018-08-13 18:05:43 +0900 | [diff] [blame] | 197 | * Returns new openstack node instance with given integration bridge. |
| 198 | * |
| 199 | * @param newIntgBridge updated integration bridge |
| 200 | * @return updated openstack node |
| 201 | */ |
| 202 | OpenstackNode updateIntbridge(DeviceId newIntgBridge); |
| 203 | |
| 204 | /** |
Jian Li | e631216 | 2018-03-21 21:41:00 +0900 | [diff] [blame] | 205 | * Returns a collection of physical interfaces. |
| 206 | * |
| 207 | * @return physical interfaces |
| 208 | */ |
| 209 | Collection<OpenstackPhyInterface> phyIntfs(); |
| 210 | |
| 211 | /** |
daniel park | 796c2eb | 2018-03-22 17:01:51 +0900 | [diff] [blame] | 212 | * Returns the port number of given physical interface. |
| 213 | * |
| 214 | * @param providerPhysnet provider physical network name |
| 215 | * @return port number |
| 216 | */ |
| 217 | PortNumber phyIntfPortNum(String providerPhysnet); |
| 218 | |
| 219 | /** |
Jian Li | 2784166 | 2018-04-14 01:59:47 +0900 | [diff] [blame] | 220 | * Returns the keystone authentication info. |
| 221 | * |
| 222 | * @return keystone authentication info |
| 223 | */ |
| 224 | OpenstackAuth authentication(); |
| 225 | |
| 226 | /** |
Jian Li | 92d42fc | 2018-05-25 16:23:49 +0900 | [diff] [blame] | 227 | * Returns the endpoint URL info. |
| 228 | * |
| 229 | * @return keystone authentication info |
| 230 | */ |
Jian Li | 6d41036 | 2018-08-17 09:41:08 +0900 | [diff] [blame] | 231 | String endpoint(); |
Jian Li | 92d42fc | 2018-05-25 16:23:49 +0900 | [diff] [blame] | 232 | |
| 233 | /** |
Jian Li | 789fadb | 2018-07-10 13:59:47 +0900 | [diff] [blame] | 234 | * Returns a collection of customized controllers. |
| 235 | * |
| 236 | * @return customized controllers |
| 237 | */ |
| 238 | Collection<ControllerInfo> controllers(); |
| 239 | |
| 240 | /** |
Daniel Park | deefa70 | 2018-07-17 17:55:51 +0900 | [diff] [blame] | 241 | * Returns the ssh authentication info. |
| 242 | * |
| 243 | * @return ssh authentication info |
| 244 | */ |
| 245 | OpenstackSshAuth sshAuthInfo(); |
| 246 | |
| 247 | /** |
Hyunsun Moon | 0d45736 | 2017-06-27 17:19:41 +0900 | [diff] [blame] | 248 | * Builder of new node entities. |
| 249 | */ |
| 250 | interface Builder { |
| 251 | |
| 252 | /** |
| 253 | * Builds an immutable openstack node instance. |
| 254 | * |
| 255 | * @return openstack node instance |
| 256 | */ |
| 257 | OpenstackNode build(); |
| 258 | |
| 259 | /** |
| 260 | * Returns openstack node builder with supplied hostname. |
| 261 | * |
| 262 | * @param hostname hostname of the node |
| 263 | * @return opesntack node builder |
| 264 | */ |
| 265 | Builder hostname(String hostname); |
| 266 | |
| 267 | /** |
| 268 | * Returns openstack node builder with supplied type. |
| 269 | * |
| 270 | * @param type openstack node type |
| 271 | * @return openstack node builder |
| 272 | */ |
| 273 | Builder type(NodeType type); |
| 274 | |
| 275 | /** |
| 276 | * Returns openstack node builder with supplied integration bridge ID. |
| 277 | * |
| 278 | * @param intgBridge integration bridge device id |
| 279 | * @return openstack node builder |
| 280 | */ |
| 281 | Builder intgBridge(DeviceId intgBridge); |
| 282 | |
| 283 | /** |
Hyunsun Moon | 0d45736 | 2017-06-27 17:19:41 +0900 | [diff] [blame] | 284 | * Returns openstack node builder with supplied management IP address. |
| 285 | * |
| 286 | * @param managementIp management ip address |
| 287 | * @return openstack node builder |
| 288 | */ |
| 289 | Builder managementIp(IpAddress managementIp); |
| 290 | |
| 291 | /** |
| 292 | * Returns openstack node builder with supplied data network IP address. |
| 293 | * |
| 294 | * @param dataIp data network ip address |
| 295 | * @return openstack node builder |
| 296 | */ |
| 297 | Builder dataIp(IpAddress dataIp); |
| 298 | |
| 299 | /** |
| 300 | * Returns openstack node builder with supplied vlan interface. |
| 301 | * |
| 302 | * @param vlanIntf vlan interface name |
| 303 | * @return openstack node builder |
| 304 | */ |
| 305 | Builder vlanIntf(String vlanIntf); |
| 306 | |
| 307 | /** |
daniel park | b18424c | 2018-02-05 15:43:43 +0900 | [diff] [blame] | 308 | * Returns openstack node builder with supplied uplink port. |
| 309 | * |
| 310 | * @param uplinkPort uplink port name |
| 311 | * @return openstack node builder |
| 312 | */ |
| 313 | Builder uplinkPort(String uplinkPort); |
| 314 | |
| 315 | /** |
Hyunsun Moon | 0d45736 | 2017-06-27 17:19:41 +0900 | [diff] [blame] | 316 | * Returns openstack node builder with supplied node state. |
| 317 | * |
| 318 | * @param state node state |
| 319 | * @return openstack node builder |
| 320 | */ |
| 321 | Builder state(NodeState state); |
Jian Li | e631216 | 2018-03-21 21:41:00 +0900 | [diff] [blame] | 322 | |
| 323 | /** |
| 324 | * Returns openstack node builder with supplied physical interfaces. |
| 325 | * |
| 326 | * @param phyIntfs a collection of physical interfaces |
| 327 | * @return openstack node builder |
| 328 | */ |
| 329 | Builder phyIntfs(Collection<OpenstackPhyInterface> phyIntfs); |
Jian Li | 2784166 | 2018-04-14 01:59:47 +0900 | [diff] [blame] | 330 | |
| 331 | /** |
Jian Li | 789fadb | 2018-07-10 13:59:47 +0900 | [diff] [blame] | 332 | * Returns openstack node builder with supplied customized controllers. |
| 333 | * |
| 334 | * @param controllers a collection of customized controllers |
| 335 | * @return openstack node builder |
| 336 | */ |
| 337 | Builder controllers(Collection<ControllerInfo> controllers); |
| 338 | |
| 339 | /** |
Jian Li | 2784166 | 2018-04-14 01:59:47 +0900 | [diff] [blame] | 340 | * Returns openstack node builder with supplied authentication info. |
| 341 | * |
| 342 | * @param auth keystone authentication info |
| 343 | * @return openstack node builder |
| 344 | */ |
| 345 | Builder authentication(OpenstackAuth auth); |
Jian Li | 92d42fc | 2018-05-25 16:23:49 +0900 | [diff] [blame] | 346 | |
| 347 | /** |
| 348 | * Returns openstack node builder with supplied endpoint info. |
| 349 | * |
Jian Li | 6d41036 | 2018-08-17 09:41:08 +0900 | [diff] [blame] | 350 | * @param endpoint endpoint info |
Jian Li | 92d42fc | 2018-05-25 16:23:49 +0900 | [diff] [blame] | 351 | * @return openstack node builder |
| 352 | */ |
Jian Li | 6d41036 | 2018-08-17 09:41:08 +0900 | [diff] [blame] | 353 | Builder endpoint(String endpoint); |
Daniel Park | deefa70 | 2018-07-17 17:55:51 +0900 | [diff] [blame] | 354 | |
| 355 | /** |
| 356 | * Returns openstack node builder with supplied ssh authentication info. |
| 357 | * |
| 358 | * @param sshAuth ssh authentication info |
| 359 | * @return openstack node builder |
| 360 | */ |
| 361 | Builder sshAuthInfo(OpenstackSshAuth sshAuth); |
Daniel Park | 92abf31 | 2018-08-08 17:01:35 +0900 | [diff] [blame] | 362 | |
| 363 | /** |
| 364 | * Returns openstack node builder with supplied data path type. |
| 365 | * |
| 366 | * @param datapathType data path type |
| 367 | * @return openstack node builder |
| 368 | */ |
| 369 | Builder datapathType(DatapathType datapathType); |
Daniel Park | 7e8c4d8 | 2018-08-13 23:47:49 +0900 | [diff] [blame] | 370 | |
| 371 | /** |
| 372 | * Returns openstack node builder with supplied socket directory. |
| 373 | * |
| 374 | * @param socketDir socket directory |
| 375 | * @return openstack node builder |
| 376 | */ |
| 377 | Builder socketDir(String socketDir); |
Hyunsun Moon | 0d45736 | 2017-06-27 17:19:41 +0900 | [diff] [blame] | 378 | } |
| 379 | } |
| 380 | |