blob: d380ec5ec9be706da16f0d5bf7a173a741707956 [file] [log] [blame]
Hyunsun Moon0d457362017-06-27 17:19:41 +09001/*
2 * Copyright 2017-present Open Networking Laboratory
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 */
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 /**
75 * Returns the router bridge device ID.
76 *
77 * @return device id; null if the node type is compute
78 */
79 DeviceId routerBridge();
80
81 /**
82 * Returns the management network IP address of the node.
83 *
84 * @return ip address
85 */
86 IpAddress managementIp();
87
88 /**
89 * Returns the data network IP address used for tunneling.
90 *
91 * @return ip address; null if vxlan mode is not enabled
92 */
93 IpAddress dataIp();
94
95 /**
96 * Returns the name of the vlan interface.
97 *
98 * @return vlan interface name; null if vlan mode is not enabled
99 */
100 String vlanIntf();
101
102 /**
103 * Returns the initialization state of the node.
104 *
105 * @return node state
106 */
107 NodeState state();
108
109 /**
110 * Returns the gateway group ID of this node.
111 *
112 * @param mode network mode of the group
113 * @return gateway group identifier
114 */
115 GroupId gatewayGroupId(NetworkMode mode);
116
117 /**
118 * Returns the group key of this node.
119 *
120 * @param mode network mode of the group
121 * @return gateway group key
122 */
123 GroupKey gatewayGroupKey(NetworkMode mode);
124
125 /**
126 * Returns the tunnel port number.
127 *
128 * @return port number; null if tunnel port does not exist
129 */
130 PortNumber tunnelPortNum();
131
132 /**
133 * Returns the vlan port nubmer.
134 *
135 * @return port number; null if vlan port does not exist
136 */
137 PortNumber vlanPortNum();
138
139 /**
140 * Returns the patch port number of the integration bridge.
141 *
142 * @return port number; null if the node type is compute
143 */
144 PortNumber patchPortNum();
145
146 /**
147 * Returns the vlan port MAC address.
148 *
149 * @return mac address; null if vlan port does not exist
150 */
151 MacAddress vlanPortMac();
152
153 /**
154 * Returns new openstack node instance with given state.
155 *
156 * @param newState updated state
157 * @return updated openstack node
158 */
159 OpenstackNode updateState(NodeState newState);
160
161 /**
162 * Builder of new node entities.
163 */
164 interface Builder {
165
166 /**
167 * Builds an immutable openstack node instance.
168 *
169 * @return openstack node instance
170 */
171 OpenstackNode build();
172
173 /**
174 * Returns openstack node builder with supplied hostname.
175 *
176 * @param hostname hostname of the node
177 * @return opesntack node builder
178 */
179 Builder hostname(String hostname);
180
181 /**
182 * Returns openstack node builder with supplied type.
183 *
184 * @param type openstack node type
185 * @return openstack node builder
186 */
187 Builder type(NodeType type);
188
189 /**
190 * Returns openstack node builder with supplied integration bridge ID.
191 *
192 * @param intgBridge integration bridge device id
193 * @return openstack node builder
194 */
195 Builder intgBridge(DeviceId intgBridge);
196
197 /**
198 * Returns openstack node builder with supplied router bridge ID.
199 *
200 * @param routerBridge router bridge id
201 * @return openstack node builder
202 */
203 Builder routerBridge(DeviceId routerBridge);
204
205 /**
206 * Returns openstack node builder with supplied management IP address.
207 *
208 * @param managementIp management ip address
209 * @return openstack node builder
210 */
211 Builder managementIp(IpAddress managementIp);
212
213 /**
214 * Returns openstack node builder with supplied data network IP address.
215 *
216 * @param dataIp data network ip address
217 * @return openstack node builder
218 */
219 Builder dataIp(IpAddress dataIp);
220
221 /**
222 * Returns openstack node builder with supplied vlan interface.
223 *
224 * @param vlanIntf vlan interface name
225 * @return openstack node builder
226 */
227 Builder vlanIntf(String vlanIntf);
228
229 /**
230 * Returns openstack node builder with supplied node state.
231 *
232 * @param state node state
233 * @return openstack node builder
234 */
235 Builder state(NodeState state);
236 }
237}
238