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