blob: 519c9f7c711553a061e3e84f82ad875369d7eddb [file] [log] [blame]
wei wei89ddc322015-03-22 16:29:04 -05001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
wei wei89ddc322015-03-22 16:29:04 -05003 *
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 */
Thomas Vachuskabf916ea2015-05-20 18:24:34 -070016package org.onosproject.incubator.net.tunnel;
wei wei89ddc322015-03-22 16:29:04 -050017
jcc4a20a5f2015-04-30 15:43:39 +080018import java.util.Collection;
19
Brian O'Connor2bed5ce2015-06-25 15:10:28 -040020import com.google.common.annotations.Beta;
jcc4a20a5f2015-04-30 15:43:39 +080021import org.onosproject.core.ApplicationId;
Avantika-Huawei4c3c9972016-04-05 14:51:46 +053022import org.onosproject.incubator.net.tunnel.Tunnel.State;
samuel7a5691a2015-05-23 00:36:32 +080023import org.onosproject.incubator.net.tunnel.Tunnel.Type;
jcc4a20a5f2015-04-30 15:43:39 +080024import org.onosproject.net.Annotations;
wei wei89ddc322015-03-22 16:29:04 -050025import org.onosproject.net.provider.ProviderId;
26import org.onosproject.store.Store;
27
28/**
jcc4a20a5f2015-04-30 15:43:39 +080029 * Manages inventory of tunnel; not intended for direct use.
wei wei89ddc322015-03-22 16:29:04 -050030 */
Brian O'Connor2bed5ce2015-06-25 15:10:28 -040031@Beta
wei wei89ddc322015-03-22 16:29:04 -050032public interface TunnelStore extends Store<TunnelEvent, TunnelStoreDelegate> {
wei wei89ddc322015-03-22 16:29:04 -050033 /**
jcc4a20a5f2015-04-30 15:43:39 +080034 * Creates or updates a tunnel.
wei wei89ddc322015-03-22 16:29:04 -050035 *
jcc4a20a5f2015-04-30 15:43:39 +080036 * @param tunnel tunnel
37 * @return tunnel identity
wei wei89ddc322015-03-22 16:29:04 -050038 */
jcc4a20a5f2015-04-30 15:43:39 +080039 TunnelId createOrUpdateTunnel(Tunnel tunnel);
wei wei89ddc322015-03-22 16:29:04 -050040
41 /**
Avantika-Huawei4c3c9972016-04-05 14:51:46 +053042 * Creates a tunnel or updates a tunnel with the new state given in input.
43 *
44 * @param tunnel tunnel
45 * @param state tunnel state
46 * @return tunnel identity
47 */
48 TunnelId createOrUpdateTunnel(Tunnel tunnel, State state);
49
50 /**
jcc4a20a5f2015-04-30 15:43:39 +080051 * Deletes a tunnel by a specific tunnel identifier.
wei wei89ddc322015-03-22 16:29:04 -050052 *
jcc4a20a5f2015-04-30 15:43:39 +080053 * @param tunnelId tunnel unique identifier generated by ONOS
wei wei89ddc322015-03-22 16:29:04 -050054 */
jcc4a20a5f2015-04-30 15:43:39 +080055 void deleteTunnel(TunnelId tunnelId);
wei wei89ddc322015-03-22 16:29:04 -050056
57 /**
jcc4a20a5f2015-04-30 15:43:39 +080058 * Deletes all tunnels between source point and destination point.
wei wei89ddc322015-03-22 16:29:04 -050059 *
jcc4a20a5f2015-04-30 15:43:39 +080060 * @param src a source point of tunnel.
61 * @param dst a destination point of tunnel.
62 * @param producerName producerName
wei wei89ddc322015-03-22 16:29:04 -050063 */
jcc4a20a5f2015-04-30 15:43:39 +080064 void deleteTunnel(TunnelEndPoint src, TunnelEndPoint dst,
65 ProviderId producerName);
wei wei89ddc322015-03-22 16:29:04 -050066
67 /**
jcc4a20a5f2015-04-30 15:43:39 +080068 * Deletes all specific type tunnels between source point and destination
69 * point.
wei wei89ddc322015-03-22 16:29:04 -050070 *
jcc4a20a5f2015-04-30 15:43:39 +080071 * @param src a source point of tunnel.
72 * @param dst a destination point of tunnel.
wei wei89ddc322015-03-22 16:29:04 -050073 * @param type tunnel type
jcc4a20a5f2015-04-30 15:43:39 +080074 * @param producerName producerName
wei wei89ddc322015-03-22 16:29:04 -050075 */
jcc4a20a5f2015-04-30 15:43:39 +080076 void deleteTunnel(TunnelEndPoint src, TunnelEndPoint dst,
77 Tunnel.Type type, ProviderId producerName);
wei wei89ddc322015-03-22 16:29:04 -050078
79 /**
jcc4a20a5f2015-04-30 15:43:39 +080080 * Returns a specific tunnel. Annotations parameter is reserved. If there
81 * is no tunnel in the store, return a "null" object, and record the tunnel subscription.
82 * Where tunnel is created, ONOS notifies this consumer actively.
wei wei89ddc322015-03-22 16:29:04 -050083 *
jcc4a20a5f2015-04-30 15:43:39 +080084 * @param consumerId a tunnel consumer
85 * @param tunnelId tunnel identify generated by onos
86 * @param annotations parameter
87 * @return Tunnel subscribed tunnel
wei wei89ddc322015-03-22 16:29:04 -050088 */
jcc4a20a5f2015-04-30 15:43:39 +080089 Tunnel borrowTunnel(ApplicationId consumerId, TunnelId tunnelId,
90 Annotations... annotations);
wei wei89ddc322015-03-22 16:29:04 -050091
92 /**
jcc4a20a5f2015-04-30 15:43:39 +080093 * Returns a specific tunnel by tunnelName. Annotations parameter is
94 * reserved. If there is no tunnel in the store, return a "null" object,and
95 * record the tunnel subscription. Where tunnel is created, ONOS notifies this consumer
96 * actively.
wei wei89ddc322015-03-22 16:29:04 -050097 *
jcc4a20a5f2015-04-30 15:43:39 +080098 * @param consumerId a tunnel consumer
99 * @param tunnelName tunnel name
100 * @param annotations parameter
101 * @return collection of subscribed Tunnels
wei wei89ddc322015-03-22 16:29:04 -0500102 */
jcc4a20a5f2015-04-30 15:43:39 +0800103 Collection<Tunnel> borrowTunnel(ApplicationId consumerId,
104 TunnelName tunnelName,
105 Annotations... annotations);
wei wei89ddc322015-03-22 16:29:04 -0500106
107 /**
jcc4a20a5f2015-04-30 15:43:39 +0800108 * Returns all tunnels between source and destination. Annotations
109 * parameter is reserved. If there is no any tunnel in the store, return a
110 * empty collection, and record the tunnel subscription. Where tunnel is created, ONOS
111 * notifies this consumer actively. Otherwise ONOS core returns all the
112 * tunnels, consumer determined which one to use.
wei wei89ddc322015-03-22 16:29:04 -0500113 *
jcc4a20a5f2015-04-30 15:43:39 +0800114 * @param consumerId a tunnel consumer
115 * @param src a source point of tunnel.
116 * @param dst a destination point of tunnel
117 * @param annotations parameter
118 * @return collection of subscribed Tunnels
wei wei89ddc322015-03-22 16:29:04 -0500119 */
jcc4a20a5f2015-04-30 15:43:39 +0800120 Collection<Tunnel> borrowTunnel(ApplicationId consumerId, TunnelEndPoint src,
121 TunnelEndPoint dst, Annotations... annotations);
wei wei89ddc322015-03-22 16:29:04 -0500122
123 /**
jcc4a20a5f2015-04-30 15:43:39 +0800124 * Returns all specified type tunnels between source and destination.
125 * Annotations parameter is reserved. If there is no any tunnel in the store,
126 * return a empty collection, and record the tunnel subscription. Where tunnel is
127 * created, ONOS notifies this consumer actively. Otherwise,ONOS core returns
128 * all available tunnels, consumer determined which one to use.
wei wei89ddc322015-03-22 16:29:04 -0500129 *
jcc4a20a5f2015-04-30 15:43:39 +0800130 * @param consumerId a tunnel consumer
131 * @param src a source point of tunnel.
132 * @param dst a destination point of tunnel
133 * @param type tunnel type
134 * @param annotations Annotations
135 * @return collection of available Tunnels
wei wei89ddc322015-03-22 16:29:04 -0500136 */
jcc4a20a5f2015-04-30 15:43:39 +0800137 Collection<Tunnel> borrowTunnel(ApplicationId consumerId, TunnelEndPoint src,
138 TunnelEndPoint dst, Type type,
139 Annotations... annotations);
wei wei89ddc322015-03-22 16:29:04 -0500140
141 /**
jcc4a20a5f2015-04-30 15:43:39 +0800142 * Returns back a specific tunnel to store.
wei wei89ddc322015-03-22 16:29:04 -0500143 *
jcc4a20a5f2015-04-30 15:43:39 +0800144 * @param consumerId a tunnel consumer
145 * @param tunnelId tunnel identify generated by ONOS
146 * @param annotations Annotations
147 * @return success or fail
wei wei89ddc322015-03-22 16:29:04 -0500148 */
jcc4a20a5f2015-04-30 15:43:39 +0800149 boolean returnTunnel(ApplicationId consumerId, TunnelId tunnelId,
150 Annotations... annotations);
wei wei89ddc322015-03-22 16:29:04 -0500151
jcc4a20a5f2015-04-30 15:43:39 +0800152 /**
153 * Returns all specific name tunnel back store. Annotations parameter is
154 * reserved.If there is no tunnel in the store, return a "null" object,and
155 * record the tunnel subscription. Where tunnel is created, ONOS notifies this consumer
156 * actively.
157 *
158 * @param consumerId a tunnel consumer
159 * @param tunnelName tunnel name
160 * @param annotations Annotations
161 * @return boolean
162 */
163 boolean returnTunnel(ApplicationId consumerId, TunnelName tunnelName,
164 Annotations... annotations);
165
166 /**
167 * Returns all specific type tunnels between source and destination back
168 * store. Annotations parameter is reserved.
169 *
170 * @param consumerId a tunnel consumer
171 * @param src a source point of tunnel.
172 * @param dst a destination point of tunnel
173 * @param type tunnel type
174 * @param annotations Annotations
175 * @return success or fail
176 */
177 boolean returnTunnel(ApplicationId consumerId, TunnelEndPoint src,
178 TunnelEndPoint dst, Type type,
179 Annotations... annotations);
180
181 /**
182 * Returns all tunnels between source and destination back the store.
183 * Annotations parameter is reserved.
184 *
185 * @param consumerId a tunnel consumer
186 * @param src a source point of tunnel.
187 * @param dst a destination point of tunnel.
188 * @param annotations Annotations
189 * @return success or fail
190 */
191 boolean returnTunnel(ApplicationId consumerId, TunnelEndPoint src,
192 TunnelEndPoint dst, Annotations... annotations);
193
194 /**
195 * Returns a tunnel by a specific tunnel identity.
196 *
197 * @param tunnelId tunnel identify generated by tunnel producer
198 * @return Tunnel
199 */
200 Tunnel queryTunnel(TunnelId tunnelId);
201
202 /**
203 * Returns all tunnel subscription record by consumer.
204 *
205 * @param consumerId consumer identity
206 * @return Collection of TunnelSubscription
207 */
208 Collection<TunnelSubscription> queryTunnelSubscription(ApplicationId consumerId);
209
210 /**
211 * Returns all specified type tunnels.
212 *
213 * @param type tunnel type
214 * @return Collection of tunnels
215 */
216 Collection<Tunnel> queryTunnel(Type type);
217
218 /**
219 * Returns all tunnels between source point and destination point.
220 *
221 * @param src a source point of tunnel.
222 * @param dst a destination point of tunnel.
223 * @return Collection of tunnels
224 */
225 Collection<Tunnel> queryTunnel(TunnelEndPoint src, TunnelEndPoint dst);
226
227 /**
228 * Returns all tunnels.
samuel7a5691a2015-05-23 00:36:32 +0800229 *
230 * @return Collection of tunnels
231 */
232 Collection<Tunnel> queryAllTunnels();
233
234 /**
235 * Returns all tunnels.
jcc4a20a5f2015-04-30 15:43:39 +0800236 * @return all tunnels
237 */
238 int tunnelCount();
wei wei89ddc322015-03-22 16:29:04 -0500239}