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