blob: 6940ab288265cf7513f929e3aa4c5809eb6fca2e [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;
samuel7a5691a2015-05-23 00:36:32 +080022import org.onosproject.incubator.net.tunnel.Tunnel.Type;
jcc4a20a5f2015-04-30 15:43:39 +080023import org.onosproject.net.Annotations;
wei wei89ddc322015-03-22 16:29:04 -050024import org.onosproject.net.provider.ProviderId;
25import org.onosproject.store.Store;
26
27/**
jcc4a20a5f2015-04-30 15:43:39 +080028 * Manages inventory of tunnel; not intended for direct use.
wei wei89ddc322015-03-22 16:29:04 -050029 */
Brian O'Connor2bed5ce2015-06-25 15:10:28 -040030@Beta
wei wei89ddc322015-03-22 16:29:04 -050031public interface TunnelStore extends Store<TunnelEvent, TunnelStoreDelegate> {
wei wei89ddc322015-03-22 16:29:04 -050032 /**
jcc4a20a5f2015-04-30 15:43:39 +080033 * Creates or updates a tunnel.
wei wei89ddc322015-03-22 16:29:04 -050034 *
jcc4a20a5f2015-04-30 15:43:39 +080035 * @param tunnel tunnel
36 * @return tunnel identity
wei wei89ddc322015-03-22 16:29:04 -050037 */
jcc4a20a5f2015-04-30 15:43:39 +080038 TunnelId createOrUpdateTunnel(Tunnel tunnel);
wei wei89ddc322015-03-22 16:29:04 -050039
40 /**
jcc4a20a5f2015-04-30 15:43:39 +080041 * Deletes a tunnel by a specific tunnel identifier.
wei wei89ddc322015-03-22 16:29:04 -050042 *
jcc4a20a5f2015-04-30 15:43:39 +080043 * @param tunnelId tunnel unique identifier generated by ONOS
wei wei89ddc322015-03-22 16:29:04 -050044 */
jcc4a20a5f2015-04-30 15:43:39 +080045 void deleteTunnel(TunnelId tunnelId);
wei wei89ddc322015-03-22 16:29:04 -050046
47 /**
jcc4a20a5f2015-04-30 15:43:39 +080048 * Deletes all tunnels between source point and destination point.
wei wei89ddc322015-03-22 16:29:04 -050049 *
jcc4a20a5f2015-04-30 15:43:39 +080050 * @param src a source point of tunnel.
51 * @param dst a destination point of tunnel.
52 * @param producerName producerName
wei wei89ddc322015-03-22 16:29:04 -050053 */
jcc4a20a5f2015-04-30 15:43:39 +080054 void deleteTunnel(TunnelEndPoint src, TunnelEndPoint dst,
55 ProviderId producerName);
wei wei89ddc322015-03-22 16:29:04 -050056
57 /**
jcc4a20a5f2015-04-30 15:43:39 +080058 * Deletes all specific type tunnels between source point and destination
59 * point.
wei wei89ddc322015-03-22 16:29:04 -050060 *
jcc4a20a5f2015-04-30 15:43:39 +080061 * @param src a source point of tunnel.
62 * @param dst a destination point of tunnel.
wei wei89ddc322015-03-22 16:29:04 -050063 * @param type tunnel type
jcc4a20a5f2015-04-30 15:43:39 +080064 * @param producerName producerName
wei wei89ddc322015-03-22 16:29:04 -050065 */
jcc4a20a5f2015-04-30 15:43:39 +080066 void deleteTunnel(TunnelEndPoint src, TunnelEndPoint dst,
67 Tunnel.Type type, ProviderId producerName);
wei wei89ddc322015-03-22 16:29:04 -050068
69 /**
jcc4a20a5f2015-04-30 15:43:39 +080070 * Returns a specific tunnel. Annotations parameter is reserved. If there
71 * is no tunnel in the store, return a "null" object, and record the tunnel subscription.
72 * Where tunnel is created, ONOS notifies this consumer actively.
wei wei89ddc322015-03-22 16:29:04 -050073 *
jcc4a20a5f2015-04-30 15:43:39 +080074 * @param consumerId a tunnel consumer
75 * @param tunnelId tunnel identify generated by onos
76 * @param annotations parameter
77 * @return Tunnel subscribed tunnel
wei wei89ddc322015-03-22 16:29:04 -050078 */
jcc4a20a5f2015-04-30 15:43:39 +080079 Tunnel borrowTunnel(ApplicationId consumerId, TunnelId tunnelId,
80 Annotations... annotations);
wei wei89ddc322015-03-22 16:29:04 -050081
82 /**
jcc4a20a5f2015-04-30 15:43:39 +080083 * Returns a specific tunnel by tunnelName. Annotations parameter is
84 * reserved. If there is no tunnel in the store, return a "null" object,and
85 * record the tunnel subscription. Where tunnel is created, ONOS notifies this consumer
86 * actively.
wei wei89ddc322015-03-22 16:29:04 -050087 *
jcc4a20a5f2015-04-30 15:43:39 +080088 * @param consumerId a tunnel consumer
89 * @param tunnelName tunnel name
90 * @param annotations parameter
91 * @return collection of subscribed Tunnels
wei wei89ddc322015-03-22 16:29:04 -050092 */
jcc4a20a5f2015-04-30 15:43:39 +080093 Collection<Tunnel> borrowTunnel(ApplicationId consumerId,
94 TunnelName tunnelName,
95 Annotations... annotations);
wei wei89ddc322015-03-22 16:29:04 -050096
97 /**
jcc4a20a5f2015-04-30 15:43:39 +080098 * Returns all tunnels between source and destination. Annotations
99 * parameter is reserved. If there is no any tunnel in the store, return a
100 * empty collection, and record the tunnel subscription. Where tunnel is created, ONOS
101 * notifies this consumer actively. Otherwise ONOS core returns all the
102 * tunnels, consumer determined which one to use.
wei wei89ddc322015-03-22 16:29:04 -0500103 *
jcc4a20a5f2015-04-30 15:43:39 +0800104 * @param consumerId a tunnel consumer
105 * @param src a source point of tunnel.
106 * @param dst a destination point of tunnel
107 * @param annotations parameter
108 * @return collection of subscribed Tunnels
wei wei89ddc322015-03-22 16:29:04 -0500109 */
jcc4a20a5f2015-04-30 15:43:39 +0800110 Collection<Tunnel> borrowTunnel(ApplicationId consumerId, TunnelEndPoint src,
111 TunnelEndPoint dst, Annotations... annotations);
wei wei89ddc322015-03-22 16:29:04 -0500112
113 /**
jcc4a20a5f2015-04-30 15:43:39 +0800114 * Returns all specified type tunnels between source and destination.
115 * Annotations parameter is reserved. If there is no any tunnel in the store,
116 * return a empty collection, and record the tunnel subscription. Where tunnel is
117 * created, ONOS notifies this consumer actively. Otherwise,ONOS core returns
118 * all available tunnels, consumer determined which one to use.
wei wei89ddc322015-03-22 16:29:04 -0500119 *
jcc4a20a5f2015-04-30 15:43:39 +0800120 * @param consumerId a tunnel consumer
121 * @param src a source point of tunnel.
122 * @param dst a destination point of tunnel
123 * @param type tunnel type
124 * @param annotations Annotations
125 * @return collection of available Tunnels
wei wei89ddc322015-03-22 16:29:04 -0500126 */
jcc4a20a5f2015-04-30 15:43:39 +0800127 Collection<Tunnel> borrowTunnel(ApplicationId consumerId, TunnelEndPoint src,
128 TunnelEndPoint dst, Type type,
129 Annotations... annotations);
wei wei89ddc322015-03-22 16:29:04 -0500130
131 /**
jcc4a20a5f2015-04-30 15:43:39 +0800132 * Returns back a specific tunnel to store.
wei wei89ddc322015-03-22 16:29:04 -0500133 *
jcc4a20a5f2015-04-30 15:43:39 +0800134 * @param consumerId a tunnel consumer
135 * @param tunnelId tunnel identify generated by ONOS
136 * @param annotations Annotations
137 * @return success or fail
wei wei89ddc322015-03-22 16:29:04 -0500138 */
jcc4a20a5f2015-04-30 15:43:39 +0800139 boolean returnTunnel(ApplicationId consumerId, TunnelId tunnelId,
140 Annotations... annotations);
wei wei89ddc322015-03-22 16:29:04 -0500141
jcc4a20a5f2015-04-30 15:43:39 +0800142 /**
143 * Returns all specific name tunnel back store. Annotations parameter is
144 * reserved.If there is no tunnel in the store, return a "null" object,and
145 * record the tunnel subscription. Where tunnel is created, ONOS notifies this consumer
146 * actively.
147 *
148 * @param consumerId a tunnel consumer
149 * @param tunnelName tunnel name
150 * @param annotations Annotations
151 * @return boolean
152 */
153 boolean returnTunnel(ApplicationId consumerId, TunnelName tunnelName,
154 Annotations... annotations);
155
156 /**
157 * Returns all specific type tunnels between source and destination back
158 * store. Annotations parameter is reserved.
159 *
160 * @param consumerId a tunnel consumer
161 * @param src a source point of tunnel.
162 * @param dst a destination point of tunnel
163 * @param type tunnel type
164 * @param annotations Annotations
165 * @return success or fail
166 */
167 boolean returnTunnel(ApplicationId consumerId, TunnelEndPoint src,
168 TunnelEndPoint dst, Type type,
169 Annotations... annotations);
170
171 /**
172 * Returns all tunnels between source and destination back the store.
173 * Annotations parameter is reserved.
174 *
175 * @param consumerId a tunnel consumer
176 * @param src a source point of tunnel.
177 * @param dst a destination point of tunnel.
178 * @param annotations Annotations
179 * @return success or fail
180 */
181 boolean returnTunnel(ApplicationId consumerId, TunnelEndPoint src,
182 TunnelEndPoint dst, Annotations... annotations);
183
184 /**
185 * Returns a tunnel by a specific tunnel identity.
186 *
187 * @param tunnelId tunnel identify generated by tunnel producer
188 * @return Tunnel
189 */
190 Tunnel queryTunnel(TunnelId tunnelId);
191
192 /**
193 * Returns all tunnel subscription record by consumer.
194 *
195 * @param consumerId consumer identity
196 * @return Collection of TunnelSubscription
197 */
198 Collection<TunnelSubscription> queryTunnelSubscription(ApplicationId consumerId);
199
200 /**
201 * Returns all specified type tunnels.
202 *
203 * @param type tunnel type
204 * @return Collection of tunnels
205 */
206 Collection<Tunnel> queryTunnel(Type type);
207
208 /**
209 * Returns all tunnels between source point and destination point.
210 *
211 * @param src a source point of tunnel.
212 * @param dst a destination point of tunnel.
213 * @return Collection of tunnels
214 */
215 Collection<Tunnel> queryTunnel(TunnelEndPoint src, TunnelEndPoint dst);
216
217 /**
218 * Returns all tunnels.
samuel7a5691a2015-05-23 00:36:32 +0800219 *
220 * @return Collection of tunnels
221 */
222 Collection<Tunnel> queryAllTunnels();
223
224 /**
225 * Returns all tunnels.
jcc4a20a5f2015-04-30 15:43:39 +0800226 * @return all tunnels
227 */
228 int tunnelCount();
wei wei89ddc322015-03-22 16:29:04 -0500229}