blob: 5deff3cfac7cce684556e7e504898bc33ac8daac [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.Port;
28import org.onosproject.net.PortNumber;
Brian Stanke11f6d532016-07-05 16:17:59 -040029import org.onosproject.net.intent.Intent;
30import org.onosproject.net.intent.IntentData;
31import org.onosproject.net.intent.IntentState;
32import org.onosproject.net.intent.Key;
Thomas Vachuska33979fd2015-07-31 11:41:14 -070033import org.onosproject.store.Store;
34
35import java.util.Set;
36
37/**
38 * Mechanism for distributing and storing virtual network model information.
39 */
40public interface VirtualNetworkStore
41 extends Store<VirtualNetworkEvent, VirtualNetworkStoreDelegate> {
42
43 /**
44 * Adds a new tenant ID to the store.
45 *
46 * @param tenantId tenant identifier
47 */
48 void addTenantId(TenantId tenantId);
49
50 /**
51 * Removes the specified tenant ID from the store.
52 *
53 * @param tenantId tenant identifier
54 */
55 void removeTenantId(TenantId tenantId);
56
57 /**
58 * Returns set of registered tenant IDs.
59 *
60 * @return set of tenant identifiers
61 */
62 Set<TenantId> getTenantIds();
63
64 /**
65 * Adds a new virtual network for the specified tenant to the store.
66 *
67 * @param tenantId tenant identifier
68 * @return the virtual network
69 */
70 VirtualNetwork addNetwork(TenantId tenantId);
71
72 /**
73 * Removes the specified virtual network from the store.
74 *
75 * @param networkId network identifier
76 */
77 void removeNetwork(NetworkId networkId);
78
79 /**
80 * Adds a new virtual device to the store. This device will have no ports.
81 *
82 * @param networkId network identifier
83 * @param deviceId device identifier
84 * @return the virtual device
85 */
86 VirtualDevice addDevice(NetworkId networkId, DeviceId deviceId);
87
88 /**
Brian Stanke7a81b532016-06-14 15:43:51 -040089 * Removes the specified virtual device from the given network.
Thomas Vachuska33979fd2015-07-31 11:41:14 -070090 *
91 * @param networkId network identifier
92 * @param deviceId device identifier
93 */
94 void removeDevice(NetworkId networkId, DeviceId deviceId);
95
96 /**
Brian Stanke7a81b532016-06-14 15:43:51 -040097 * Adds a new virtual host to the store.
98 *
99 * @param networkId network identifier
100 * @param hostId host identifier
101 * @param mac mac address
102 * @param vlan vlan identifier
103 * @param location host location
104 * @param ips set of ip addresses
105 * @return the virtual host
106 */
107 VirtualHost addHost(NetworkId networkId, HostId hostId, MacAddress mac,
108 VlanId vlan, HostLocation location, Set<IpAddress> ips);
109
110 /**
111 * Removes the specified virtual host from the store.
112 *
113 * @param networkId network identifier
114 * @param hostId host identifier
115 */
116 void removeHost(NetworkId networkId, HostId hostId);
117
118 /**
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700119 * Adds a new virtual link.
120 *
121 * @param networkId network identifier
122 * @param src source end-point of the link
123 * @param dst destination end-point of the link
Brian Stanke612cebf2016-05-02 10:21:33 -0400124 * @param state link state
Brian Stanke9a108972016-04-11 15:25:17 -0400125 * @param realizedBy underlying tunnel identifier using which this link is realized
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700126 * @return the virtual link
127 */
Brian Stanke612cebf2016-05-02 10:21:33 -0400128 VirtualLink addLink(NetworkId networkId, ConnectPoint src, ConnectPoint dst, Link.State state, TunnelId realizedBy);
Brian Stanke9a108972016-04-11 15:25:17 -0400129
130 /**
131 * Updates the tunnelId in the virtual link.
132 *
Brian Stanke612cebf2016-05-02 10:21:33 -0400133 * @param virtualLink virtual link
134 * @param tunnelId tunnel identifier
135 * @param state link state
Brian Stanke9a108972016-04-11 15:25:17 -0400136 */
Brian Stanke612cebf2016-05-02 10:21:33 -0400137 void updateLink(VirtualLink virtualLink, TunnelId tunnelId, Link.State state);
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700138
139 /**
140 * Removes the specified link from the store.
141 *
142 * @param networkId network identifier
143 * @param src source connection point
144 * @param dst destination connection point
Brian Stanke9a108972016-04-11 15:25:17 -0400145 * @return the virtual link
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700146 */
Brian Stanke9a108972016-04-11 15:25:17 -0400147 VirtualLink removeLink(NetworkId networkId, ConnectPoint src, ConnectPoint dst);
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700148
149 /**
150 * Adds a new virtual port to the network.
151 *
152 * @param networkId network identifier
153 * @param deviceId device identifier
154 * @param portNumber port number
155 * @param realizedBy underlying port which realizes the virtual port
156 * @return the virtual port
157 */
158 VirtualPort addPort(NetworkId networkId, DeviceId deviceId,
159 PortNumber portNumber, Port realizedBy);
160
161 /**
162 * Removes the specified port from the given device and network.
163 *
164 * @param networkId network identifier
165 * @param deviceId device identifier
166 * @param portNumber port number
167 */
168 void removePort(NetworkId networkId, DeviceId deviceId, PortNumber portNumber);
169
170 /**
171 * Returns the list of networks.
172 *
173 * @param tenantId tenant identifier
174 * @return set of virtual networks
175 */
176 Set<VirtualNetwork> getNetworks(TenantId tenantId);
177
178 /**
Brian Stanke86914282016-05-25 15:36:50 -0400179 * Returns the virtual network for the given network identifier.
180 *
Brian Stanke7a81b532016-06-14 15:43:51 -0400181 * @param networkId network identifier
Brian Stanke86914282016-05-25 15:36:50 -0400182 * @return the virtual network
183 */
184 VirtualNetwork getNetwork(NetworkId networkId);
185
186 /**
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700187 * Returns the list of devices in the specified virtual network.
188 *
189 * @param networkId network identifier
190 * @return set of virtual devices
191 */
192 Set<VirtualDevice> getDevices(NetworkId networkId);
193
194 /**
Brian Stanke7a81b532016-06-14 15:43:51 -0400195 * Returns the list of hosts in the specified virtual network.
196 *
197 * @param networkId network identifier
198 * @return set of virtual hosts
199 */
200 Set<VirtualHost> getHosts(NetworkId networkId);
201
202 /**
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700203 * Returns the list of virtual links in the specified virtual network.
204 *
205 * @param networkId network identifier
206 * @return set of virtual links
207 */
208 Set<VirtualLink> getLinks(NetworkId networkId);
209
210 /**
Brian Stanke612cebf2016-05-02 10:21:33 -0400211 * Returns the virtual link matching the network identifier, source connect point,
212 * and destination connect point.
213 *
214 * @param networkId network identifier
215 * @param src source connect point
216 * @param dst destination connect point
217 * @return virtual link
218 */
219 VirtualLink getLink(NetworkId networkId, ConnectPoint src, ConnectPoint dst);
220
221 /**
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700222 * Returns the list of ports of the specified virtual device.
223 *
224 * @param networkId network identifier
Brian Stanke612cebf2016-05-02 10:21:33 -0400225 * @param deviceId device identifier
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700226 * @return set of virtual networks
227 */
228 Set<VirtualPort> getPorts(NetworkId networkId, DeviceId deviceId);
229
Brian Stanke11f6d532016-07-05 16:17:59 -0400230 /**
231 * Add or update the intent to the store.
232 *
233 * @param intent virtual intent
234 * @param state intent state
235 */
236 void addOrUpdateIntent(Intent intent, IntentState state);
237
238 /**
239 * Remove the virtual intent from the store.
240 *
241 * @param intentKey intent key
242 * @return intent data
243 */
244 IntentData removeIntent(Key intentKey);
245
246 /**
247 * Adds the intent to tunnel identifier mapping to the store.
248 *
249 * @param intent intent
250 * @param tunnelId tunnel identifier
251 */
252 void addTunnelId(Intent intent, TunnelId tunnelId);
253
254 /**
255 * Return the set of tunnel identifiers store against the intent.
256 *
257 * @param intent intent
258 * @return set of tunnel identifiers
259 */
260 Set<TunnelId> getTunnelIds(Intent intent);
261
262 /**
263 * Removes the intent to tunnel identifier mapping from the store.
264 *
265 * @param intent intent
266 * @param tunnelId tunnel identifier
267 */
268 void removeTunnelId(Intent intent, TunnelId tunnelId);
269
270 /**
271 * Return all intents.
272 *
273 * @return set of intents
274 */
275 Set<Intent> getIntents();
276
277 /**
278 * Return the intent for the specified intent key.
279 *
280 * @param key intent key
281 * @return intent
282 */
283 Intent getIntent(Key key);
284
285 /**
286 * Return the set of intent data.
287 *
288 * @return set of intent data
289 */
290 Set<IntentData> getIntentData();
291
292 /**
293 * Return the intent data matching the intent key.
294 *
295 * @param key intent key
296 * @return intent data
297 */
298 IntentData getIntentData(Key key);
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700299}