blob: 0f1936e2bc7b48d1dbf4a2f2af3a468dfc5cd37f [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;
Thomas Vachuska33979fd2015-07-31 11:41:14 -070029import org.onosproject.store.Store;
30
31import java.util.Set;
32
33/**
34 * Mechanism for distributing and storing virtual network model information.
35 */
36public interface VirtualNetworkStore
37 extends Store<VirtualNetworkEvent, VirtualNetworkStoreDelegate> {
38
39 /**
40 * Adds a new tenant ID to the store.
41 *
42 * @param tenantId tenant identifier
43 */
44 void addTenantId(TenantId tenantId);
45
46 /**
47 * Removes the specified tenant ID from the store.
48 *
49 * @param tenantId tenant identifier
50 */
51 void removeTenantId(TenantId tenantId);
52
53 /**
54 * Returns set of registered tenant IDs.
55 *
56 * @return set of tenant identifiers
57 */
58 Set<TenantId> getTenantIds();
59
60 /**
61 * Adds a new virtual network for the specified tenant to the store.
62 *
63 * @param tenantId tenant identifier
64 * @return the virtual network
65 */
66 VirtualNetwork addNetwork(TenantId tenantId);
67
68 /**
69 * Removes the specified virtual network from the store.
70 *
71 * @param networkId network identifier
72 */
73 void removeNetwork(NetworkId networkId);
74
75 /**
76 * Adds a new virtual device to the store. This device will have no ports.
77 *
78 * @param networkId network identifier
79 * @param deviceId device identifier
80 * @return the virtual device
81 */
82 VirtualDevice addDevice(NetworkId networkId, DeviceId deviceId);
83
84 /**
Brian Stanke7a81b532016-06-14 15:43:51 -040085 * Removes the specified virtual device from the given network.
Thomas Vachuska33979fd2015-07-31 11:41:14 -070086 *
87 * @param networkId network identifier
88 * @param deviceId device identifier
89 */
90 void removeDevice(NetworkId networkId, DeviceId deviceId);
91
92 /**
Brian Stanke7a81b532016-06-14 15:43:51 -040093 * Adds a new virtual host to the store.
94 *
95 * @param networkId network identifier
96 * @param hostId host identifier
97 * @param mac mac address
98 * @param vlan vlan identifier
99 * @param location host location
100 * @param ips set of ip addresses
101 * @return the virtual host
102 */
103 VirtualHost addHost(NetworkId networkId, HostId hostId, MacAddress mac,
104 VlanId vlan, HostLocation location, Set<IpAddress> ips);
105
106 /**
107 * Removes the specified virtual host from the store.
108 *
109 * @param networkId network identifier
110 * @param hostId host identifier
111 */
112 void removeHost(NetworkId networkId, HostId hostId);
113
114 /**
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700115 * Adds a new virtual link.
116 *
117 * @param networkId network identifier
118 * @param src source end-point of the link
119 * @param dst destination end-point of the link
Brian Stanke612cebf2016-05-02 10:21:33 -0400120 * @param state link state
Brian Stanke9a108972016-04-11 15:25:17 -0400121 * @param realizedBy underlying tunnel identifier using which this link is realized
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700122 * @return the virtual link
123 */
Brian Stanke612cebf2016-05-02 10:21:33 -0400124 VirtualLink addLink(NetworkId networkId, ConnectPoint src, ConnectPoint dst, Link.State state, TunnelId realizedBy);
Brian Stanke9a108972016-04-11 15:25:17 -0400125
126 /**
127 * Updates the tunnelId in the virtual link.
128 *
Brian Stanke612cebf2016-05-02 10:21:33 -0400129 * @param virtualLink virtual link
130 * @param tunnelId tunnel identifier
131 * @param state link state
Brian Stanke9a108972016-04-11 15:25:17 -0400132 */
Brian Stanke612cebf2016-05-02 10:21:33 -0400133 void updateLink(VirtualLink virtualLink, TunnelId tunnelId, Link.State state);
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700134
135 /**
136 * Removes the specified link from the store.
137 *
138 * @param networkId network identifier
139 * @param src source connection point
140 * @param dst destination connection point
Brian Stanke9a108972016-04-11 15:25:17 -0400141 * @return the virtual link
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700142 */
Brian Stanke9a108972016-04-11 15:25:17 -0400143 VirtualLink removeLink(NetworkId networkId, ConnectPoint src, ConnectPoint dst);
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700144
145 /**
146 * Adds a new virtual port to the network.
147 *
148 * @param networkId network identifier
149 * @param deviceId device identifier
150 * @param portNumber port number
151 * @param realizedBy underlying port which realizes the virtual port
152 * @return the virtual port
153 */
154 VirtualPort addPort(NetworkId networkId, DeviceId deviceId,
Yoonseon Han6c603892016-09-01 11:52:21 -0700155 PortNumber portNumber, ConnectPoint realizedBy);
156
157 /**
158 * Binds an existing virtual port to the network.
159 *
160 * @param networkId network identifier
161 * @param deviceId device identifier
162 * @param portNumber port number
163 * @param realizedBy underlying port which realizes the virtual port
164 */
165 void bindPort(NetworkId networkId, DeviceId deviceId,
166 PortNumber portNumber, ConnectPoint realizedBy);
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700167
168 /**
169 * Removes the specified port from the given device and network.
170 *
171 * @param networkId network identifier
172 * @param deviceId device identifier
173 * @param portNumber port number
174 */
175 void removePort(NetworkId networkId, DeviceId deviceId, PortNumber portNumber);
176
177 /**
178 * Returns the list of networks.
179 *
180 * @param tenantId tenant identifier
181 * @return set of virtual networks
182 */
183 Set<VirtualNetwork> getNetworks(TenantId tenantId);
184
185 /**
Brian Stanke86914282016-05-25 15:36:50 -0400186 * Returns the virtual network for the given network identifier.
187 *
Brian Stanke7a81b532016-06-14 15:43:51 -0400188 * @param networkId network identifier
Brian Stanke86914282016-05-25 15:36:50 -0400189 * @return the virtual network
190 */
191 VirtualNetwork getNetwork(NetworkId networkId);
192
193 /**
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700194 * Returns the list of devices in the specified virtual network.
195 *
196 * @param networkId network identifier
197 * @return set of virtual devices
198 */
199 Set<VirtualDevice> getDevices(NetworkId networkId);
200
201 /**
Brian Stanke7a81b532016-06-14 15:43:51 -0400202 * Returns the list of hosts in the specified virtual network.
203 *
204 * @param networkId network identifier
205 * @return set of virtual hosts
206 */
207 Set<VirtualHost> getHosts(NetworkId networkId);
208
209 /**
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700210 * Returns the list of virtual links in the specified virtual network.
211 *
212 * @param networkId network identifier
213 * @return set of virtual links
214 */
215 Set<VirtualLink> getLinks(NetworkId networkId);
216
217 /**
Brian Stanke612cebf2016-05-02 10:21:33 -0400218 * Returns the virtual link matching the network identifier, source connect point,
219 * and destination connect point.
220 *
221 * @param networkId network identifier
222 * @param src source connect point
223 * @param dst destination connect point
224 * @return virtual link
225 */
226 VirtualLink getLink(NetworkId networkId, ConnectPoint src, ConnectPoint dst);
227
228 /**
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700229 * Returns the list of ports of the specified virtual device.
230 *
231 * @param networkId network identifier
Brian Stanke612cebf2016-05-02 10:21:33 -0400232 * @param deviceId device identifier
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700233 * @return set of virtual networks
234 */
235 Set<VirtualPort> getPorts(NetworkId networkId, DeviceId deviceId);
236
Brian Stanke11f6d532016-07-05 16:17:59 -0400237 /**
Brian Stanke11f6d532016-07-05 16:17:59 -0400238 * Adds the intent to tunnel identifier mapping to the store.
239 *
240 * @param intent intent
241 * @param tunnelId tunnel identifier
242 */
Yoonseon Han356c3712017-05-19 15:22:39 -0700243 @Deprecated
Brian Stanke11f6d532016-07-05 16:17:59 -0400244 void addTunnelId(Intent intent, TunnelId tunnelId);
245
246 /**
247 * Return the set of tunnel identifiers store against the intent.
248 *
249 * @param intent intent
250 * @return set of tunnel identifiers
251 */
Yoonseon Han356c3712017-05-19 15:22:39 -0700252 @Deprecated
Brian Stanke11f6d532016-07-05 16:17:59 -0400253 Set<TunnelId> getTunnelIds(Intent intent);
254
255 /**
256 * Removes the intent to tunnel identifier mapping from the store.
257 *
258 * @param intent intent
259 * @param tunnelId tunnel identifier
260 */
Yoonseon Han356c3712017-05-19 15:22:39 -0700261 @Deprecated
Brian Stanke11f6d532016-07-05 16:17:59 -0400262 void removeTunnelId(Intent intent, TunnelId tunnelId);
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700263}