blob: 2ecfefe1b427639679a3e90125be1ba7c0c294a9 [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;
23import org.onosproject.net.group.GroupKey;
24
25/**
26 * Representation of a node used in OpenstackNetworking service.
27 */
28public interface OpenstackNode {
29
30 /**
31 * List of valid virtual network modes.
32 */
33 enum NetworkMode {
34 VXLAN,
35 VLAN
36 }
37
38 /**
39 * List of valid node types.
40 */
41 enum NodeType {
42 COMPUTE,
43 GATEWAY
44 }
45
46 /**
47 * Returns hostname of the node.
48 *
49 * @return hostname
50 */
51 String hostname();
52
53 /**
54 * Returns the type of the node.
55 *
56 * @return node type
57 */
58 NodeType type();
59
60 /**
61 * Returns the OVSDB device ID of the node.
62 *
63 * @return ovsdb device id
64 */
65 DeviceId ovsdb();
66
67 /**
68 * Returns the device ID of the integration bridge at the node.
69 *
70 * @return device id
71 */
72 DeviceId intgBridge();
73
74 /**
Hyunsun Moon0d457362017-06-27 17:19:41 +090075 * Returns the management network IP address of the node.
76 *
77 * @return ip address
78 */
79 IpAddress managementIp();
80
81 /**
82 * Returns the data network IP address used for tunneling.
83 *
84 * @return ip address; null if vxlan mode is not enabled
85 */
86 IpAddress dataIp();
87
88 /**
89 * Returns the name of the vlan interface.
90 *
91 * @return vlan interface name; null if vlan mode is not enabled
92 */
93 String vlanIntf();
94
95 /**
96 * Returns the initialization state of the node.
97 *
98 * @return node state
99 */
100 NodeState state();
101
102 /**
103 * Returns the gateway group ID of this node.
104 *
105 * @param mode network mode of the group
106 * @return gateway group identifier
107 */
108 GroupId gatewayGroupId(NetworkMode mode);
109
110 /**
111 * Returns the group key of this node.
112 *
113 * @param mode network mode of the group
114 * @return gateway group key
115 */
116 GroupKey gatewayGroupKey(NetworkMode mode);
117
118 /**
119 * Returns the tunnel port number.
120 *
121 * @return port number; null if tunnel port does not exist
122 */
123 PortNumber tunnelPortNum();
124
125 /**
126 * Returns the vlan port nubmer.
127 *
128 * @return port number; null if vlan port does not exist
129 */
130 PortNumber vlanPortNum();
131
132 /**
133 * Returns the patch port number of the integration bridge.
134 *
135 * @return port number; null if the node type is compute
136 */
137 PortNumber patchPortNum();
138
139 /**
140 * Returns the vlan port MAC address.
141 *
142 * @return mac address; null if vlan port does not exist
143 */
144 MacAddress vlanPortMac();
145
146 /**
daniel parkb18424c2018-02-05 15:43:43 +0900147 * Returns the uplink port name.
148 *
149 * @return uplink port name; null if the node type is compute
150 */
151 String uplinkPort();
152
153 /**
daniel parkb5817102018-02-15 00:18:51 +0900154 * Returns the uplink port number.
155 *
156 * @return uplink port number
157 */
158 PortNumber uplinkPortNum();
159
160 /**
Hyunsun Moon0d457362017-06-27 17:19:41 +0900161 * 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 /**
169 * Builder of new node entities.
170 */
171 interface Builder {
172
173 /**
174 * Builds an immutable openstack node instance.
175 *
176 * @return openstack node instance
177 */
178 OpenstackNode build();
179
180 /**
181 * Returns openstack node builder with supplied hostname.
182 *
183 * @param hostname hostname of the node
184 * @return opesntack node builder
185 */
186 Builder hostname(String hostname);
187
188 /**
189 * Returns openstack node builder with supplied type.
190 *
191 * @param type openstack node type
192 * @return openstack node builder
193 */
194 Builder type(NodeType type);
195
196 /**
197 * Returns openstack node builder with supplied integration bridge ID.
198 *
199 * @param intgBridge integration bridge device id
200 * @return openstack node builder
201 */
202 Builder intgBridge(DeviceId intgBridge);
203
204 /**
Hyunsun Moon0d457362017-06-27 17:19:41 +0900205 * Returns openstack node builder with supplied management IP address.
206 *
207 * @param managementIp management ip address
208 * @return openstack node builder
209 */
210 Builder managementIp(IpAddress managementIp);
211
212 /**
213 * Returns openstack node builder with supplied data network IP address.
214 *
215 * @param dataIp data network ip address
216 * @return openstack node builder
217 */
218 Builder dataIp(IpAddress dataIp);
219
220 /**
221 * Returns openstack node builder with supplied vlan interface.
222 *
223 * @param vlanIntf vlan interface name
224 * @return openstack node builder
225 */
226 Builder vlanIntf(String vlanIntf);
227
228 /**
daniel parkb18424c2018-02-05 15:43:43 +0900229 * Returns openstack node builder with supplied uplink port.
230 *
231 * @param uplinkPort uplink port name
232 * @return openstack node builder
233 */
234 Builder uplinkPort(String uplinkPort);
235
236 /**
Hyunsun Moon0d457362017-06-27 17:19:41 +0900237 * Returns openstack node builder with supplied node state.
238 *
239 * @param state node state
240 * @return openstack node builder
241 */
242 Builder state(NodeState state);
243 }
244}
245