blob: a935e08cf8b07da9fb37da233698c8e8eef8747e [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;
Hyunsun Moon0d457362017-06-27 17:19:41 +090020import org.onosproject.net.DeviceId;
21import org.onosproject.net.PortNumber;
Jian Li789fadb2018-07-10 13:59:47 +090022import org.onosproject.net.behaviour.ControllerInfo;
Hyunsun Moon0d457362017-06-27 17:19:41 +090023
Jian Lie6312162018-03-21 21:41:00 +090024import java.util.Collection;
25
Hyunsun Moon0d457362017-06-27 17:19:41 +090026/**
27 * Representation of a node used in OpenstackNetworking service.
28 */
29public interface OpenstackNode {
30
31 /**
Jian Lie6312162018-03-21 21:41:00 +090032 * List of valid network modes.
33 * This includes both physical and virtual network types.
Hyunsun Moon0d457362017-06-27 17:19:41 +090034 */
35 enum NetworkMode {
36 VXLAN,
Jian Lie6312162018-03-21 21:41:00 +090037 VLAN,
38 FLAT
Hyunsun Moon0d457362017-06-27 17:19:41 +090039 }
40
41 /**
42 * List of valid node types.
43 */
44 enum NodeType {
45 COMPUTE,
Jian Li27841662018-04-14 01:59:47 +090046 GATEWAY,
47 CONTROLLER
Hyunsun Moon0d457362017-06-27 17:19:41 +090048 }
49
50 /**
Daniel Park92abf312018-08-08 17:01:35 +090051 * List of valid data path types.
52 */
53 enum DatapathType {
54 NORMAL,
55 NETDEV
56 }
57
58 /**
Hyunsun Moon0d457362017-06-27 17:19:41 +090059 * Returns hostname of the node.
60 *
61 * @return hostname
62 */
63 String hostname();
64
65 /**
66 * Returns the type of the node.
67 *
68 * @return node type
69 */
70 NodeType type();
71
72 /**
73 * Returns the OVSDB device ID of the node.
74 *
75 * @return ovsdb device id
76 */
77 DeviceId ovsdb();
78
79 /**
80 * Returns the device ID of the integration bridge at the node.
81 *
82 * @return device id
83 */
84 DeviceId intgBridge();
85
86 /**
Hyunsun Moon0d457362017-06-27 17:19:41 +090087 * Returns the management network IP address of the node.
88 *
89 * @return ip address
90 */
91 IpAddress managementIp();
92
93 /**
94 * Returns the data network IP address used for tunneling.
95 *
96 * @return ip address; null if vxlan mode is not enabled
97 */
98 IpAddress dataIp();
99
100 /**
101 * Returns the name of the vlan interface.
102 *
103 * @return vlan interface name; null if vlan mode is not enabled
104 */
105 String vlanIntf();
106
107 /**
108 * Returns the initialization state of the node.
109 *
110 * @return node state
111 */
112 NodeState state();
113
114 /**
Hyunsun Moon0d457362017-06-27 17:19:41 +0900115 * Returns the tunnel port number.
116 *
117 * @return port number; null if tunnel port does not exist
118 */
119 PortNumber tunnelPortNum();
120
121 /**
Jian Li340165f2018-02-27 10:38:17 +0900122 * Returns the vlan port number.
Hyunsun Moon0d457362017-06-27 17:19:41 +0900123 *
124 * @return port number; null if vlan port does not exist
125 */
126 PortNumber vlanPortNum();
127
128 /**
129 * Returns the patch port number of the integration bridge.
130 *
131 * @return port number; null if the node type is compute
132 */
133 PortNumber patchPortNum();
134
135 /**
136 * Returns the vlan port MAC address.
137 *
138 * @return mac address; null if vlan port does not exist
139 */
140 MacAddress vlanPortMac();
141
142 /**
daniel parkb18424c2018-02-05 15:43:43 +0900143 * Returns the uplink port name.
144 *
145 * @return uplink port name; null if the node type is compute
146 */
147 String uplinkPort();
148
149 /**
Daniel Park92abf312018-08-08 17:01:35 +0900150 * Returns the data path type.
151 *
152 * @return data path type; normal or netdev
153 */
154 DatapathType datapathType();
155
156 /**
Daniel Park7e8c4d82018-08-13 23:47:49 +0900157 * Returns socket directory which dpdk port bound to.
158 *
159 * @return socket directory
160 */
161 String socketDir();
162
163 /**
daniel parkb5817102018-02-15 00:18:51 +0900164 * Returns the uplink port number.
165 *
166 * @return uplink port number
167 */
168 PortNumber uplinkPortNum();
169
170 /**
Hyunsun Moon0d457362017-06-27 17:19:41 +0900171 * Returns new openstack node instance with given state.
172 *
173 * @param newState updated state
174 * @return updated openstack node
175 */
176 OpenstackNode updateState(NodeState newState);
177
178 /**
Jian Lie3141542018-08-13 18:05:43 +0900179 * Returns new openstack node instance with given integration bridge.
180 *
181 * @param newIntgBridge updated integration bridge
182 * @return updated openstack node
183 */
184 OpenstackNode updateIntbridge(DeviceId newIntgBridge);
185
186 /**
Jian Lie6312162018-03-21 21:41:00 +0900187 * Returns a collection of physical interfaces.
188 *
189 * @return physical interfaces
190 */
191 Collection<OpenstackPhyInterface> phyIntfs();
192
193 /**
daniel park796c2eb2018-03-22 17:01:51 +0900194 * Returns the port number of given physical interface.
195 *
196 * @param providerPhysnet provider physical network name
197 * @return port number
198 */
199 PortNumber phyIntfPortNum(String providerPhysnet);
200
201 /**
Jian Li27841662018-04-14 01:59:47 +0900202 * Returns the keystone authentication info.
203 *
204 * @return keystone authentication info
205 */
206 OpenstackAuth authentication();
207
208 /**
Jian Li92d42fc2018-05-25 16:23:49 +0900209 * Returns the endpoint URL info.
210 *
211 * @return keystone authentication info
212 */
Jian Li6d410362018-08-17 09:41:08 +0900213 String endpoint();
Jian Li92d42fc2018-05-25 16:23:49 +0900214
215 /**
Jian Li789fadb2018-07-10 13:59:47 +0900216 * Returns a collection of customized controllers.
217 *
218 * @return customized controllers
219 */
220 Collection<ControllerInfo> controllers();
221
222 /**
Daniel Parkdeefa702018-07-17 17:55:51 +0900223 * Returns the ssh authentication info.
224 *
225 * @return ssh authentication info
226 */
227 OpenstackSshAuth sshAuthInfo();
228
229 /**
Hyunsun Moon0d457362017-06-27 17:19:41 +0900230 * 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 Moon0d457362017-06-27 17:19:41 +0900266 * 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 parkb18424c2018-02-05 15:43:43 +0900290 * 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 Moon0d457362017-06-27 17:19:41 +0900298 * 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 Lie6312162018-03-21 21:41:00 +0900304
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 Li27841662018-04-14 01:59:47 +0900312
313 /**
Jian Li789fadb2018-07-10 13:59:47 +0900314 * 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 /**
Jian Li27841662018-04-14 01:59:47 +0900322 * Returns openstack node builder with supplied authentication info.
323 *
324 * @param auth keystone authentication info
325 * @return openstack node builder
326 */
327 Builder authentication(OpenstackAuth auth);
Jian Li92d42fc2018-05-25 16:23:49 +0900328
329 /**
330 * Returns openstack node builder with supplied endpoint info.
331 *
Jian Li6d410362018-08-17 09:41:08 +0900332 * @param endpoint endpoint info
Jian Li92d42fc2018-05-25 16:23:49 +0900333 * @return openstack node builder
334 */
Jian Li6d410362018-08-17 09:41:08 +0900335 Builder endpoint(String endpoint);
Daniel Parkdeefa702018-07-17 17:55:51 +0900336
337 /**
338 * Returns openstack node builder with supplied ssh authentication info.
339 *
340 * @param sshAuth ssh authentication info
341 * @return openstack node builder
342 */
343 Builder sshAuthInfo(OpenstackSshAuth sshAuth);
Daniel Park92abf312018-08-08 17:01:35 +0900344
345 /**
346 * Returns openstack node builder with supplied data path type.
347 *
348 * @param datapathType data path type
349 * @return openstack node builder
350 */
351 Builder datapathType(DatapathType datapathType);
Daniel Park7e8c4d82018-08-13 23:47:49 +0900352
353 /**
354 * Returns openstack node builder with supplied socket directory.
355 *
356 * @param socketDir socket directory
357 * @return openstack node builder
358 */
359 Builder socketDir(String socketDir);
Hyunsun Moon0d457362017-06-27 17:19:41 +0900360 }
361}
362