blob: 9760286dba9398183106aabd399b96089831e73c [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 /**
Daniel Park92abf312018-08-08 17:01:35 +090053 * List of valid data path types.
54 */
55 enum DatapathType {
56 NORMAL,
57 NETDEV
58 }
59
60 /**
Hyunsun Moon0d457362017-06-27 17:19:41 +090061 * 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 Moon0d457362017-06-27 17:19:41 +090089 * 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 Li340165f2018-02-27 10:38:17 +0900140 * Returns the vlan port number.
Hyunsun Moon0d457362017-06-27 17:19:41 +0900141 *
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 parkb18424c2018-02-05 15:43:43 +0900161 * 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 Park92abf312018-08-08 17:01:35 +0900168 * Returns the data path type.
169 *
170 * @return data path type; normal or netdev
171 */
172 DatapathType datapathType();
173
174 /**
Daniel Park7e8c4d82018-08-13 23:47:49 +0900175 * Returns socket directory which dpdk port bound to.
176 *
177 * @return socket directory
178 */
179 String socketDir();
180
181 /**
daniel parkb5817102018-02-15 00:18:51 +0900182 * Returns the uplink port number.
183 *
184 * @return uplink port number
185 */
186 PortNumber uplinkPortNum();
187
188 /**
Hyunsun Moon0d457362017-06-27 17:19:41 +0900189 * 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 Lie3141542018-08-13 18:05:43 +0900197 * 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 Lie6312162018-03-21 21:41:00 +0900205 * Returns a collection of physical interfaces.
206 *
207 * @return physical interfaces
208 */
209 Collection<OpenstackPhyInterface> phyIntfs();
210
211 /**
daniel park796c2eb2018-03-22 17:01:51 +0900212 * 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 Li27841662018-04-14 01:59:47 +0900220 * Returns the keystone authentication info.
221 *
222 * @return keystone authentication info
223 */
224 OpenstackAuth authentication();
225
226 /**
Jian Li92d42fc2018-05-25 16:23:49 +0900227 * Returns the endpoint URL info.
228 *
229 * @return keystone authentication info
230 */
Jian Li6d410362018-08-17 09:41:08 +0900231 String endpoint();
Jian Li92d42fc2018-05-25 16:23:49 +0900232
233 /**
Jian Li789fadb2018-07-10 13:59:47 +0900234 * Returns a collection of customized controllers.
235 *
236 * @return customized controllers
237 */
238 Collection<ControllerInfo> controllers();
239
240 /**
Daniel Parkdeefa702018-07-17 17:55:51 +0900241 * Returns the ssh authentication info.
242 *
243 * @return ssh authentication info
244 */
245 OpenstackSshAuth sshAuthInfo();
246
247 /**
Hyunsun Moon0d457362017-06-27 17:19:41 +0900248 * 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 Moon0d457362017-06-27 17:19:41 +0900284 * 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 parkb18424c2018-02-05 15:43:43 +0900308 * 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 Moon0d457362017-06-27 17:19:41 +0900316 * 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 Lie6312162018-03-21 21:41:00 +0900322
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 Li27841662018-04-14 01:59:47 +0900330
331 /**
Jian Li789fadb2018-07-10 13:59:47 +0900332 * 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 Li27841662018-04-14 01:59:47 +0900340 * 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 Li92d42fc2018-05-25 16:23:49 +0900346
347 /**
348 * Returns openstack node builder with supplied endpoint info.
349 *
Jian Li6d410362018-08-17 09:41:08 +0900350 * @param endpoint endpoint info
Jian Li92d42fc2018-05-25 16:23:49 +0900351 * @return openstack node builder
352 */
Jian Li6d410362018-08-17 09:41:08 +0900353 Builder endpoint(String endpoint);
Daniel Parkdeefa702018-07-17 17:55:51 +0900354
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 Park92abf312018-08-08 17:01:35 +0900362
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 Park7e8c4d82018-08-13 23:47:49 +0900370
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 Moon0d457362017-06-27 17:19:41 +0900378 }
379}
380