blob: 516d90120b7f145c20ea1abbdb85b1e8753efd44 [file] [log] [blame]
Thomas Vachuska33979fd2015-07-31 11:41:14 -07001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
Thomas Vachuska33979fd2015-07-31 11:41:14 -07003 *
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.incubator.net.virtual;
17
Brian Stanke7a81b532016-06-14 15:43:51 -040018import org.onlab.packet.IpAddress;
19import org.onlab.packet.MacAddress;
20import org.onlab.packet.VlanId;
Thomas Vachuska33979fd2015-07-31 11:41:14 -070021import org.onosproject.incubator.net.tunnel.TunnelId;
22import org.onosproject.net.ConnectPoint;
23import org.onosproject.net.DeviceId;
Brian Stanke7a81b532016-06-14 15:43:51 -040024import org.onosproject.net.HostId;
25import org.onosproject.net.HostLocation;
Brian Stanke612cebf2016-05-02 10:21:33 -040026import org.onosproject.net.Link;
Thomas Vachuska33979fd2015-07-31 11:41:14 -070027import org.onosproject.net.PortNumber;
Brian Stanke11f6d532016-07-05 16:17:59 -040028import org.onosproject.net.intent.Intent;
29import org.onosproject.net.intent.IntentData;
30import org.onosproject.net.intent.IntentState;
31import org.onosproject.net.intent.Key;
Thomas Vachuska33979fd2015-07-31 11:41:14 -070032import org.onosproject.store.Store;
33
34import java.util.Set;
35
36/**
37 * Mechanism for distributing and storing virtual network model information.
38 */
39public interface VirtualNetworkStore
40 extends Store<VirtualNetworkEvent, VirtualNetworkStoreDelegate> {
41
42 /**
43 * Adds a new tenant ID to the store.
44 *
45 * @param tenantId tenant identifier
46 */
47 void addTenantId(TenantId tenantId);
48
49 /**
50 * Removes the specified tenant ID from the store.
51 *
52 * @param tenantId tenant identifier
53 */
54 void removeTenantId(TenantId tenantId);
55
56 /**
57 * Returns set of registered tenant IDs.
58 *
59 * @return set of tenant identifiers
60 */
61 Set<TenantId> getTenantIds();
62
63 /**
64 * Adds a new virtual network for the specified tenant to the store.
65 *
66 * @param tenantId tenant identifier
67 * @return the virtual network
68 */
69 VirtualNetwork addNetwork(TenantId tenantId);
70
71 /**
72 * Removes the specified virtual network from the store.
73 *
74 * @param networkId network identifier
75 */
76 void removeNetwork(NetworkId networkId);
77
78 /**
79 * Adds a new virtual device to the store. This device will have no ports.
80 *
81 * @param networkId network identifier
82 * @param deviceId device identifier
83 * @return the virtual device
84 */
85 VirtualDevice addDevice(NetworkId networkId, DeviceId deviceId);
86
87 /**
Brian Stanke7a81b532016-06-14 15:43:51 -040088 * Removes the specified virtual device from the given network.
Thomas Vachuska33979fd2015-07-31 11:41:14 -070089 *
90 * @param networkId network identifier
91 * @param deviceId device identifier
92 */
93 void removeDevice(NetworkId networkId, DeviceId deviceId);
94
95 /**
Brian Stanke7a81b532016-06-14 15:43:51 -040096 * Adds a new virtual host to the store.
97 *
98 * @param networkId network identifier
99 * @param hostId host identifier
100 * @param mac mac address
101 * @param vlan vlan identifier
102 * @param location host location
103 * @param ips set of ip addresses
104 * @return the virtual host
105 */
106 VirtualHost addHost(NetworkId networkId, HostId hostId, MacAddress mac,
107 VlanId vlan, HostLocation location, Set<IpAddress> ips);
108
109 /**
110 * Removes the specified virtual host from the store.
111 *
112 * @param networkId network identifier
113 * @param hostId host identifier
114 */
115 void removeHost(NetworkId networkId, HostId hostId);
116
117 /**
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700118 * Adds a new virtual link.
119 *
120 * @param networkId network identifier
121 * @param src source end-point of the link
122 * @param dst destination end-point of the link
Brian Stanke612cebf2016-05-02 10:21:33 -0400123 * @param state link state
Brian Stanke9a108972016-04-11 15:25:17 -0400124 * @param realizedBy underlying tunnel identifier using which this link is realized
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700125 * @return the virtual link
126 */
Brian Stanke612cebf2016-05-02 10:21:33 -0400127 VirtualLink addLink(NetworkId networkId, ConnectPoint src, ConnectPoint dst, Link.State state, TunnelId realizedBy);
Brian Stanke9a108972016-04-11 15:25:17 -0400128
129 /**
130 * Updates the tunnelId in the virtual link.
131 *
Brian Stanke612cebf2016-05-02 10:21:33 -0400132 * @param virtualLink virtual link
133 * @param tunnelId tunnel identifier
134 * @param state link state
Brian Stanke9a108972016-04-11 15:25:17 -0400135 */
Brian Stanke612cebf2016-05-02 10:21:33 -0400136 void updateLink(VirtualLink virtualLink, TunnelId tunnelId, Link.State state);
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700137
138 /**
139 * Removes the specified link from the store.
140 *
141 * @param networkId network identifier
142 * @param src source connection point
143 * @param dst destination connection point
Brian Stanke9a108972016-04-11 15:25:17 -0400144 * @return the virtual link
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700145 */
Brian Stanke9a108972016-04-11 15:25:17 -0400146 VirtualLink removeLink(NetworkId networkId, ConnectPoint src, ConnectPoint dst);
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700147
148 /**
149 * Adds a new virtual port to the network.
150 *
151 * @param networkId network identifier
152 * @param deviceId device identifier
153 * @param portNumber port number
154 * @param realizedBy underlying port which realizes the virtual port
155 * @return the virtual port
156 */
157 VirtualPort addPort(NetworkId networkId, DeviceId deviceId,
Yoonseon Han6c603892016-09-01 11:52:21 -0700158 PortNumber portNumber, ConnectPoint realizedBy);
159
160 /**
161 * Binds an existing virtual port to the network.
162 *
163 * @param networkId network identifier
164 * @param deviceId device identifier
165 * @param portNumber port number
166 * @param realizedBy underlying port which realizes the virtual port
167 */
168 void bindPort(NetworkId networkId, DeviceId deviceId,
169 PortNumber portNumber, ConnectPoint realizedBy);
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700170
171 /**
172 * Removes the specified port from the given device and network.
173 *
174 * @param networkId network identifier
175 * @param deviceId device identifier
176 * @param portNumber port number
177 */
178 void removePort(NetworkId networkId, DeviceId deviceId, PortNumber portNumber);
179
180 /**
181 * Returns the list of networks.
182 *
183 * @param tenantId tenant identifier
184 * @return set of virtual networks
185 */
186 Set<VirtualNetwork> getNetworks(TenantId tenantId);
187
188 /**
Brian Stanke86914282016-05-25 15:36:50 -0400189 * Returns the virtual network for the given network identifier.
190 *
Brian Stanke7a81b532016-06-14 15:43:51 -0400191 * @param networkId network identifier
Brian Stanke86914282016-05-25 15:36:50 -0400192 * @return the virtual network
193 */
194 VirtualNetwork getNetwork(NetworkId networkId);
195
196 /**
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700197 * Returns the list of devices in the specified virtual network.
198 *
199 * @param networkId network identifier
200 * @return set of virtual devices
201 */
202 Set<VirtualDevice> getDevices(NetworkId networkId);
203
204 /**
Brian Stanke7a81b532016-06-14 15:43:51 -0400205 * Returns the list of hosts in the specified virtual network.
206 *
207 * @param networkId network identifier
208 * @return set of virtual hosts
209 */
210 Set<VirtualHost> getHosts(NetworkId networkId);
211
212 /**
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700213 * Returns the list of virtual links in the specified virtual network.
214 *
215 * @param networkId network identifier
216 * @return set of virtual links
217 */
218 Set<VirtualLink> getLinks(NetworkId networkId);
219
220 /**
Brian Stanke612cebf2016-05-02 10:21:33 -0400221 * Returns the virtual link matching the network identifier, source connect point,
222 * and destination connect point.
223 *
224 * @param networkId network identifier
225 * @param src source connect point
226 * @param dst destination connect point
227 * @return virtual link
228 */
229 VirtualLink getLink(NetworkId networkId, ConnectPoint src, ConnectPoint dst);
230
231 /**
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700232 * Returns the list of ports of the specified virtual device.
233 *
234 * @param networkId network identifier
Brian Stanke612cebf2016-05-02 10:21:33 -0400235 * @param deviceId device identifier
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700236 * @return set of virtual networks
237 */
238 Set<VirtualPort> getPorts(NetworkId networkId, DeviceId deviceId);
239
Brian Stanke11f6d532016-07-05 16:17:59 -0400240 /**
241 * Add or update the intent to the store.
242 *
243 * @param intent virtual intent
244 * @param state intent state
245 */
246 void addOrUpdateIntent(Intent intent, IntentState state);
247
248 /**
249 * Remove the virtual intent from the store.
250 *
251 * @param intentKey intent key
252 * @return intent data
253 */
254 IntentData removeIntent(Key intentKey);
255
256 /**
257 * Adds the intent to tunnel identifier mapping to the store.
258 *
259 * @param intent intent
260 * @param tunnelId tunnel identifier
261 */
262 void addTunnelId(Intent intent, TunnelId tunnelId);
263
264 /**
265 * Return the set of tunnel identifiers store against the intent.
266 *
267 * @param intent intent
268 * @return set of tunnel identifiers
269 */
270 Set<TunnelId> getTunnelIds(Intent intent);
271
272 /**
273 * Removes the intent to tunnel identifier mapping from the store.
274 *
275 * @param intent intent
276 * @param tunnelId tunnel identifier
277 */
278 void removeTunnelId(Intent intent, TunnelId tunnelId);
279
280 /**
281 * Return all intents.
282 *
283 * @return set of intents
284 */
285 Set<Intent> getIntents();
286
287 /**
288 * Return the intent for the specified intent key.
289 *
290 * @param key intent key
291 * @return intent
292 */
293 Intent getIntent(Key key);
294
295 /**
296 * Return the set of intent data.
297 *
298 * @return set of intent data
299 */
300 Set<IntentData> getIntentData();
301
302 /**
303 * Return the intent data matching the intent key.
304 *
305 * @param key intent key
306 * @return intent data
307 */
308 IntentData getIntentData(Key key);
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700309}