blob: 5789deb58210d687a577a1256eeed5486e4b83fb [file] [log] [blame]
Hyunsun Moon0d457362017-06-27 17:19:41 +09001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2017-present Open Networking Foundation
Hyunsun Moon0d457362017-06-27 17:19:41 +09003 *
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 */
16package org.onosproject.openstacknode.api;
17
18import org.onlab.packet.IpAddress;
19import org.onlab.packet.MacAddress;
20import org.onosproject.core.GroupId;
21import org.onosproject.net.DeviceId;
22import org.onosproject.net.PortNumber;
Jian Li789fadb2018-07-10 13:59:47 +090023import org.onosproject.net.behaviour.ControllerInfo;
Hyunsun Moon0d457362017-06-27 17:19:41 +090024import org.onosproject.net.group.GroupKey;
25
Jian Lie6312162018-03-21 21:41:00 +090026import java.util.Collection;
27
Hyunsun Moon0d457362017-06-27 17:19:41 +090028/**
29 * Representation of a node used in OpenstackNetworking service.
30 */
31public interface OpenstackNode {
32
33 /**
Jian Lie6312162018-03-21 21:41:00 +090034 * List of valid network modes.
35 * This includes both physical and virtual network types.
Hyunsun Moon0d457362017-06-27 17:19:41 +090036 */
37 enum NetworkMode {
38 VXLAN,
Jian Lie6312162018-03-21 21:41:00 +090039 VLAN,
40 FLAT
Hyunsun Moon0d457362017-06-27 17:19:41 +090041 }
42
43 /**
44 * List of valid node types.
45 */
46 enum NodeType {
47 COMPUTE,
Jian Li27841662018-04-14 01:59:47 +090048 GATEWAY,
49 CONTROLLER
Hyunsun Moon0d457362017-06-27 17:19:41 +090050 }
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 Moon0d457362017-06-27 17:19:41 +090081 * 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 Li340165f2018-02-27 10:38:17 +0900132 * Returns the vlan port number.
Hyunsun Moon0d457362017-06-27 17:19:41 +0900133 *
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 parkb18424c2018-02-05 15:43:43 +0900153 * 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 parkb5817102018-02-15 00:18:51 +0900160 * Returns the uplink port number.
161 *
162 * @return uplink port number
163 */
164 PortNumber uplinkPortNum();
165
166 /**
Hyunsun Moon0d457362017-06-27 17:19:41 +0900167 * 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 Lie6312162018-03-21 21:41:00 +0900175 * Returns a collection of physical interfaces.
176 *
177 * @return physical interfaces
178 */
179 Collection<OpenstackPhyInterface> phyIntfs();
180
181 /**
daniel park796c2eb2018-03-22 17:01:51 +0900182 * 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 Li27841662018-04-14 01:59:47 +0900190 * Returns the keystone authentication info.
191 *
192 * @return keystone authentication info
193 */
194 OpenstackAuth authentication();
195
196 /**
Jian Li92d42fc2018-05-25 16:23:49 +0900197 * Returns the endpoint URL info.
198 *
199 * @return keystone authentication info
200 */
201 String endPoint();
202
203 /**
Jian Li789fadb2018-07-10 13:59:47 +0900204 * Returns a collection of customized controllers.
205 *
206 * @return customized controllers
207 */
208 Collection<ControllerInfo> controllers();
209
210 /**
Daniel Parkdeefa702018-07-17 17:55:51 +0900211 * Returns the ssh authentication info.
212 *
213 * @return ssh authentication info
214 */
215 OpenstackSshAuth sshAuthInfo();
216
217 /**
Hyunsun Moon0d457362017-06-27 17:19:41 +0900218 * Builder of new node entities.
219 */
220 interface Builder {
221
222 /**
223 * Builds an immutable openstack node instance.
224 *
225 * @return openstack node instance
226 */
227 OpenstackNode build();
228
229 /**
230 * Returns openstack node builder with supplied hostname.
231 *
232 * @param hostname hostname of the node
233 * @return opesntack node builder
234 */
235 Builder hostname(String hostname);
236
237 /**
238 * Returns openstack node builder with supplied type.
239 *
240 * @param type openstack node type
241 * @return openstack node builder
242 */
243 Builder type(NodeType type);
244
245 /**
246 * Returns openstack node builder with supplied integration bridge ID.
247 *
248 * @param intgBridge integration bridge device id
249 * @return openstack node builder
250 */
251 Builder intgBridge(DeviceId intgBridge);
252
253 /**
Hyunsun Moon0d457362017-06-27 17:19:41 +0900254 * Returns openstack node builder with supplied management IP address.
255 *
256 * @param managementIp management ip address
257 * @return openstack node builder
258 */
259 Builder managementIp(IpAddress managementIp);
260
261 /**
262 * Returns openstack node builder with supplied data network IP address.
263 *
264 * @param dataIp data network ip address
265 * @return openstack node builder
266 */
267 Builder dataIp(IpAddress dataIp);
268
269 /**
270 * Returns openstack node builder with supplied vlan interface.
271 *
272 * @param vlanIntf vlan interface name
273 * @return openstack node builder
274 */
275 Builder vlanIntf(String vlanIntf);
276
277 /**
daniel parkb18424c2018-02-05 15:43:43 +0900278 * Returns openstack node builder with supplied uplink port.
279 *
280 * @param uplinkPort uplink port name
281 * @return openstack node builder
282 */
283 Builder uplinkPort(String uplinkPort);
284
285 /**
Hyunsun Moon0d457362017-06-27 17:19:41 +0900286 * Returns openstack node builder with supplied node state.
287 *
288 * @param state node state
289 * @return openstack node builder
290 */
291 Builder state(NodeState state);
Jian Lie6312162018-03-21 21:41:00 +0900292
293 /**
294 * Returns openstack node builder with supplied physical interfaces.
295 *
296 * @param phyIntfs a collection of physical interfaces
297 * @return openstack node builder
298 */
299 Builder phyIntfs(Collection<OpenstackPhyInterface> phyIntfs);
Jian Li27841662018-04-14 01:59:47 +0900300
301 /**
Jian Li789fadb2018-07-10 13:59:47 +0900302 * Returns openstack node builder with supplied customized controllers.
303 *
304 * @param controllers a collection of customized controllers
305 * @return openstack node builder
306 */
307 Builder controllers(Collection<ControllerInfo> controllers);
308
309 /**
Jian Li27841662018-04-14 01:59:47 +0900310 * Returns openstack node builder with supplied authentication info.
311 *
312 * @param auth keystone authentication info
313 * @return openstack node builder
314 */
315 Builder authentication(OpenstackAuth auth);
Jian Li92d42fc2018-05-25 16:23:49 +0900316
317 /**
318 * Returns openstack node builder with supplied endpoint info.
319 *
320 * @param endPoint endpoint info
321 * @return openstack node builder
322 */
323 Builder endPoint(String endPoint);
Daniel Parkdeefa702018-07-17 17:55:51 +0900324
325 /**
326 * Returns openstack node builder with supplied ssh authentication info.
327 *
328 * @param sshAuth ssh authentication info
329 * @return openstack node builder
330 */
331 Builder sshAuthInfo(OpenstackSshAuth sshAuth);
Hyunsun Moon0d457362017-06-27 17:19:41 +0900332 }
333}
334