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 | /** |
| 53 | * Returns hostname of the node. |
| 54 | * |
| 55 | * @return hostname |
| 56 | */ |
| 57 | String hostname(); |
| 58 | |
| 59 | /** |
| 60 | * Returns the type of the node. |
| 61 | * |
| 62 | * @return node type |
| 63 | */ |
| 64 | NodeType type(); |
| 65 | |
| 66 | /** |
| 67 | * Returns the OVSDB device ID of the node. |
| 68 | * |
| 69 | * @return ovsdb device id |
| 70 | */ |
| 71 | DeviceId ovsdb(); |
| 72 | |
| 73 | /** |
| 74 | * Returns the device ID of the integration bridge at the node. |
| 75 | * |
| 76 | * @return device id |
| 77 | */ |
| 78 | DeviceId intgBridge(); |
| 79 | |
| 80 | /** |
Hyunsun Moon | 0d45736 | 2017-06-27 17:19:41 +0900 | [diff] [blame] | 81 | * Returns the management network IP address of the node. |
| 82 | * |
| 83 | * @return ip address |
| 84 | */ |
| 85 | IpAddress managementIp(); |
| 86 | |
| 87 | /** |
| 88 | * Returns the data network IP address used for tunneling. |
| 89 | * |
| 90 | * @return ip address; null if vxlan mode is not enabled |
| 91 | */ |
| 92 | IpAddress dataIp(); |
| 93 | |
| 94 | /** |
| 95 | * Returns the name of the vlan interface. |
| 96 | * |
| 97 | * @return vlan interface name; null if vlan mode is not enabled |
| 98 | */ |
| 99 | String vlanIntf(); |
| 100 | |
| 101 | /** |
| 102 | * Returns the initialization state of the node. |
| 103 | * |
| 104 | * @return node state |
| 105 | */ |
| 106 | NodeState state(); |
| 107 | |
| 108 | /** |
| 109 | * Returns the gateway group ID of this node. |
| 110 | * |
| 111 | * @param mode network mode of the group |
| 112 | * @return gateway group identifier |
| 113 | */ |
| 114 | GroupId gatewayGroupId(NetworkMode mode); |
| 115 | |
| 116 | /** |
| 117 | * Returns the group key of this node. |
| 118 | * |
| 119 | * @param mode network mode of the group |
| 120 | * @return gateway group key |
| 121 | */ |
| 122 | GroupKey gatewayGroupKey(NetworkMode mode); |
| 123 | |
| 124 | /** |
| 125 | * Returns the tunnel port number. |
| 126 | * |
| 127 | * @return port number; null if tunnel port does not exist |
| 128 | */ |
| 129 | PortNumber tunnelPortNum(); |
| 130 | |
| 131 | /** |
Jian Li | 340165f | 2018-02-27 10:38:17 +0900 | [diff] [blame] | 132 | * Returns the vlan port number. |
Hyunsun Moon | 0d45736 | 2017-06-27 17:19:41 +0900 | [diff] [blame] | 133 | * |
| 134 | * @return port number; null if vlan port does not exist |
| 135 | */ |
| 136 | PortNumber vlanPortNum(); |
| 137 | |
| 138 | /** |
| 139 | * Returns the patch port number of the integration bridge. |
| 140 | * |
| 141 | * @return port number; null if the node type is compute |
| 142 | */ |
| 143 | PortNumber patchPortNum(); |
| 144 | |
| 145 | /** |
| 146 | * Returns the vlan port MAC address. |
| 147 | * |
| 148 | * @return mac address; null if vlan port does not exist |
| 149 | */ |
| 150 | MacAddress vlanPortMac(); |
| 151 | |
| 152 | /** |
daniel park | b18424c | 2018-02-05 15:43:43 +0900 | [diff] [blame] | 153 | * Returns the uplink port name. |
| 154 | * |
| 155 | * @return uplink port name; null if the node type is compute |
| 156 | */ |
| 157 | String uplinkPort(); |
| 158 | |
| 159 | /** |
daniel park | b581710 | 2018-02-15 00:18:51 +0900 | [diff] [blame] | 160 | * Returns the uplink port number. |
| 161 | * |
| 162 | * @return uplink port number |
| 163 | */ |
| 164 | PortNumber uplinkPortNum(); |
| 165 | |
| 166 | /** |
Hyunsun Moon | 0d45736 | 2017-06-27 17:19:41 +0900 | [diff] [blame] | 167 | * Returns new openstack node instance with given state. |
| 168 | * |
| 169 | * @param newState updated state |
| 170 | * @return updated openstack node |
| 171 | */ |
| 172 | OpenstackNode updateState(NodeState newState); |
| 173 | |
| 174 | /** |
Jian Li | e631216 | 2018-03-21 21:41:00 +0900 | [diff] [blame] | 175 | * Returns a collection of physical interfaces. |
| 176 | * |
| 177 | * @return physical interfaces |
| 178 | */ |
| 179 | Collection<OpenstackPhyInterface> phyIntfs(); |
| 180 | |
| 181 | /** |
daniel park | 796c2eb | 2018-03-22 17:01:51 +0900 | [diff] [blame] | 182 | * Returns the port number of given physical interface. |
| 183 | * |
| 184 | * @param providerPhysnet provider physical network name |
| 185 | * @return port number |
| 186 | */ |
| 187 | PortNumber phyIntfPortNum(String providerPhysnet); |
| 188 | |
| 189 | /** |
Jian Li | 2784166 | 2018-04-14 01:59:47 +0900 | [diff] [blame] | 190 | * Returns the keystone authentication info. |
| 191 | * |
| 192 | * @return keystone authentication info |
| 193 | */ |
| 194 | OpenstackAuth authentication(); |
| 195 | |
| 196 | /** |
Jian Li | 92d42fc | 2018-05-25 16:23:49 +0900 | [diff] [blame] | 197 | * Returns the endpoint URL info. |
| 198 | * |
| 199 | * @return keystone authentication info |
| 200 | */ |
| 201 | String endPoint(); |
| 202 | |
| 203 | /** |
Jian Li | 789fadb | 2018-07-10 13:59:47 +0900 | [diff] [blame] | 204 | * Returns a collection of customized controllers. |
| 205 | * |
| 206 | * @return customized controllers |
| 207 | */ |
| 208 | Collection<ControllerInfo> controllers(); |
| 209 | |
| 210 | /** |
Hyunsun Moon | 0d45736 | 2017-06-27 17:19:41 +0900 | [diff] [blame] | 211 | * Builder of new node entities. |
| 212 | */ |
| 213 | interface Builder { |
| 214 | |
| 215 | /** |
| 216 | * Builds an immutable openstack node instance. |
| 217 | * |
| 218 | * @return openstack node instance |
| 219 | */ |
| 220 | OpenstackNode build(); |
| 221 | |
| 222 | /** |
| 223 | * Returns openstack node builder with supplied hostname. |
| 224 | * |
| 225 | * @param hostname hostname of the node |
| 226 | * @return opesntack node builder |
| 227 | */ |
| 228 | Builder hostname(String hostname); |
| 229 | |
| 230 | /** |
| 231 | * Returns openstack node builder with supplied type. |
| 232 | * |
| 233 | * @param type openstack node type |
| 234 | * @return openstack node builder |
| 235 | */ |
| 236 | Builder type(NodeType type); |
| 237 | |
| 238 | /** |
| 239 | * Returns openstack node builder with supplied integration bridge ID. |
| 240 | * |
| 241 | * @param intgBridge integration bridge device id |
| 242 | * @return openstack node builder |
| 243 | */ |
| 244 | Builder intgBridge(DeviceId intgBridge); |
| 245 | |
| 246 | /** |
Hyunsun Moon | 0d45736 | 2017-06-27 17:19:41 +0900 | [diff] [blame] | 247 | * Returns openstack node builder with supplied management IP address. |
| 248 | * |
| 249 | * @param managementIp management ip address |
| 250 | * @return openstack node builder |
| 251 | */ |
| 252 | Builder managementIp(IpAddress managementIp); |
| 253 | |
| 254 | /** |
| 255 | * Returns openstack node builder with supplied data network IP address. |
| 256 | * |
| 257 | * @param dataIp data network ip address |
| 258 | * @return openstack node builder |
| 259 | */ |
| 260 | Builder dataIp(IpAddress dataIp); |
| 261 | |
| 262 | /** |
| 263 | * Returns openstack node builder with supplied vlan interface. |
| 264 | * |
| 265 | * @param vlanIntf vlan interface name |
| 266 | * @return openstack node builder |
| 267 | */ |
| 268 | Builder vlanIntf(String vlanIntf); |
| 269 | |
| 270 | /** |
daniel park | b18424c | 2018-02-05 15:43:43 +0900 | [diff] [blame] | 271 | * Returns openstack node builder with supplied uplink port. |
| 272 | * |
| 273 | * @param uplinkPort uplink port name |
| 274 | * @return openstack node builder |
| 275 | */ |
| 276 | Builder uplinkPort(String uplinkPort); |
| 277 | |
| 278 | /** |
Hyunsun Moon | 0d45736 | 2017-06-27 17:19:41 +0900 | [diff] [blame] | 279 | * Returns openstack node builder with supplied node state. |
| 280 | * |
| 281 | * @param state node state |
| 282 | * @return openstack node builder |
| 283 | */ |
| 284 | Builder state(NodeState state); |
Jian Li | e631216 | 2018-03-21 21:41:00 +0900 | [diff] [blame] | 285 | |
| 286 | /** |
| 287 | * Returns openstack node builder with supplied physical interfaces. |
| 288 | * |
| 289 | * @param phyIntfs a collection of physical interfaces |
| 290 | * @return openstack node builder |
| 291 | */ |
| 292 | Builder phyIntfs(Collection<OpenstackPhyInterface> phyIntfs); |
Jian Li | 2784166 | 2018-04-14 01:59:47 +0900 | [diff] [blame] | 293 | |
| 294 | /** |
Jian Li | 789fadb | 2018-07-10 13:59:47 +0900 | [diff] [blame] | 295 | * Returns openstack node builder with supplied customized controllers. |
| 296 | * |
| 297 | * @param controllers a collection of customized controllers |
| 298 | * @return openstack node builder |
| 299 | */ |
| 300 | Builder controllers(Collection<ControllerInfo> controllers); |
| 301 | |
| 302 | /** |
Jian Li | 2784166 | 2018-04-14 01:59:47 +0900 | [diff] [blame] | 303 | * Returns openstack node builder with supplied authentication info. |
| 304 | * |
| 305 | * @param auth keystone authentication info |
| 306 | * @return openstack node builder |
| 307 | */ |
| 308 | Builder authentication(OpenstackAuth auth); |
Jian Li | 92d42fc | 2018-05-25 16:23:49 +0900 | [diff] [blame] | 309 | |
| 310 | /** |
| 311 | * Returns openstack node builder with supplied endpoint info. |
| 312 | * |
| 313 | * @param endPoint endpoint info |
| 314 | * @return openstack node builder |
| 315 | */ |
| 316 | Builder endPoint(String endPoint); |
Hyunsun Moon | 0d45736 | 2017-06-27 17:19:41 +0900 | [diff] [blame] | 317 | } |
| 318 | } |
| 319 | |