blob: 107dea3ed5df8695ab7acbee69895c3890a22a81 [file] [log] [blame]
wei wei89ddc322015-03-22 16:29:04 -05001/*
2 * Copyright 2015 Open Networking Laboratory
3 *
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.net.tunnel;
17
jcc4a20a5f2015-04-30 15:43:39 +080018import java.util.Collection;
19
20import org.onosproject.core.ApplicationId;
21import org.onosproject.net.Annotations;
wei wei89ddc322015-03-22 16:29:04 -050022import org.onosproject.net.provider.ProviderId;
jcc4a20a5f2015-04-30 15:43:39 +080023import org.onosproject.net.tunnel.Tunnel.Type;
wei wei89ddc322015-03-22 16:29:04 -050024import org.onosproject.store.Store;
25
26/**
jcc4a20a5f2015-04-30 15:43:39 +080027 * Manages inventory of tunnel; not intended for direct use.
wei wei89ddc322015-03-22 16:29:04 -050028 */
29public interface TunnelStore extends Store<TunnelEvent, TunnelStoreDelegate> {
wei wei89ddc322015-03-22 16:29:04 -050030 /**
jcc4a20a5f2015-04-30 15:43:39 +080031 * Creates or updates a tunnel.
wei wei89ddc322015-03-22 16:29:04 -050032 *
jcc4a20a5f2015-04-30 15:43:39 +080033 * @param tunnel tunnel
34 * @return tunnel identity
wei wei89ddc322015-03-22 16:29:04 -050035 */
jcc4a20a5f2015-04-30 15:43:39 +080036 TunnelId createOrUpdateTunnel(Tunnel tunnel);
wei wei89ddc322015-03-22 16:29:04 -050037
38 /**
jcc4a20a5f2015-04-30 15:43:39 +080039 * Deletes a tunnel by a specific tunnel identifier.
wei wei89ddc322015-03-22 16:29:04 -050040 *
jcc4a20a5f2015-04-30 15:43:39 +080041 * @param tunnelId tunnel unique identifier generated by ONOS
wei wei89ddc322015-03-22 16:29:04 -050042 */
jcc4a20a5f2015-04-30 15:43:39 +080043 void deleteTunnel(TunnelId tunnelId);
wei wei89ddc322015-03-22 16:29:04 -050044
45 /**
jcc4a20a5f2015-04-30 15:43:39 +080046 * Deletes all tunnels between source point and destination point.
wei wei89ddc322015-03-22 16:29:04 -050047 *
jcc4a20a5f2015-04-30 15:43:39 +080048 * @param src a source point of tunnel.
49 * @param dst a destination point of tunnel.
50 * @param producerName producerName
wei wei89ddc322015-03-22 16:29:04 -050051 */
jcc4a20a5f2015-04-30 15:43:39 +080052 void deleteTunnel(TunnelEndPoint src, TunnelEndPoint dst,
53 ProviderId producerName);
wei wei89ddc322015-03-22 16:29:04 -050054
55 /**
jcc4a20a5f2015-04-30 15:43:39 +080056 * Deletes all specific type tunnels between source point and destination
57 * point.
wei wei89ddc322015-03-22 16:29:04 -050058 *
jcc4a20a5f2015-04-30 15:43:39 +080059 * @param src a source point of tunnel.
60 * @param dst a destination point of tunnel.
wei wei89ddc322015-03-22 16:29:04 -050061 * @param type tunnel type
jcc4a20a5f2015-04-30 15:43:39 +080062 * @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 Tunnel.Type type, ProviderId producerName);
wei wei89ddc322015-03-22 16:29:04 -050066
67 /**
jcc4a20a5f2015-04-30 15:43:39 +080068 * Returns a specific tunnel. Annotations parameter is reserved. If there
69 * is no tunnel in the store, return a "null" object, and record the tunnel subscription.
70 * Where tunnel is created, ONOS notifies this consumer actively.
wei wei89ddc322015-03-22 16:29:04 -050071 *
jcc4a20a5f2015-04-30 15:43:39 +080072 * @param consumerId a tunnel consumer
73 * @param tunnelId tunnel identify generated by onos
74 * @param annotations parameter
75 * @return Tunnel subscribed tunnel
wei wei89ddc322015-03-22 16:29:04 -050076 */
jcc4a20a5f2015-04-30 15:43:39 +080077 Tunnel borrowTunnel(ApplicationId consumerId, TunnelId tunnelId,
78 Annotations... annotations);
wei wei89ddc322015-03-22 16:29:04 -050079
80 /**
jcc4a20a5f2015-04-30 15:43:39 +080081 * Returns a specific tunnel by tunnelName. Annotations parameter is
82 * reserved. If there is no tunnel in the store, return a "null" object,and
83 * record the tunnel subscription. Where tunnel is created, ONOS notifies this consumer
84 * actively.
wei wei89ddc322015-03-22 16:29:04 -050085 *
jcc4a20a5f2015-04-30 15:43:39 +080086 * @param consumerId a tunnel consumer
87 * @param tunnelName tunnel name
88 * @param annotations parameter
89 * @return collection of subscribed Tunnels
wei wei89ddc322015-03-22 16:29:04 -050090 */
jcc4a20a5f2015-04-30 15:43:39 +080091 Collection<Tunnel> borrowTunnel(ApplicationId consumerId,
92 TunnelName tunnelName,
93 Annotations... annotations);
wei wei89ddc322015-03-22 16:29:04 -050094
95 /**
jcc4a20a5f2015-04-30 15:43:39 +080096 * Returns all tunnels between source and destination. Annotations
97 * parameter is reserved. If there is no any tunnel in the store, return a
98 * empty collection, and record the tunnel subscription. Where tunnel is created, ONOS
99 * notifies this consumer actively. Otherwise ONOS core returns all the
100 * tunnels, consumer determined which one to use.
wei wei89ddc322015-03-22 16:29:04 -0500101 *
jcc4a20a5f2015-04-30 15:43:39 +0800102 * @param consumerId a tunnel consumer
103 * @param src a source point of tunnel.
104 * @param dst a destination point of tunnel
105 * @param annotations parameter
106 * @return collection of subscribed Tunnels
wei wei89ddc322015-03-22 16:29:04 -0500107 */
jcc4a20a5f2015-04-30 15:43:39 +0800108 Collection<Tunnel> borrowTunnel(ApplicationId consumerId, TunnelEndPoint src,
109 TunnelEndPoint dst, Annotations... annotations);
wei wei89ddc322015-03-22 16:29:04 -0500110
111 /**
jcc4a20a5f2015-04-30 15:43:39 +0800112 * Returns all specified type tunnels between source and destination.
113 * Annotations parameter is reserved. If there is no any tunnel in the store,
114 * return a empty collection, and record the tunnel subscription. Where tunnel is
115 * created, ONOS notifies this consumer actively. Otherwise,ONOS core returns
116 * all available tunnels, consumer determined which one to use.
wei wei89ddc322015-03-22 16:29:04 -0500117 *
jcc4a20a5f2015-04-30 15:43:39 +0800118 * @param consumerId a tunnel consumer
119 * @param src a source point of tunnel.
120 * @param dst a destination point of tunnel
121 * @param type tunnel type
122 * @param annotations Annotations
123 * @return collection of available Tunnels
wei wei89ddc322015-03-22 16:29:04 -0500124 */
jcc4a20a5f2015-04-30 15:43:39 +0800125 Collection<Tunnel> borrowTunnel(ApplicationId consumerId, TunnelEndPoint src,
126 TunnelEndPoint dst, Type type,
127 Annotations... annotations);
wei wei89ddc322015-03-22 16:29:04 -0500128
129 /**
jcc4a20a5f2015-04-30 15:43:39 +0800130 * Returns back a specific tunnel to store.
wei wei89ddc322015-03-22 16:29:04 -0500131 *
jcc4a20a5f2015-04-30 15:43:39 +0800132 * @param consumerId a tunnel consumer
133 * @param tunnelId tunnel identify generated by ONOS
134 * @param annotations Annotations
135 * @return success or fail
wei wei89ddc322015-03-22 16:29:04 -0500136 */
jcc4a20a5f2015-04-30 15:43:39 +0800137 boolean returnTunnel(ApplicationId consumerId, TunnelId tunnelId,
138 Annotations... annotations);
wei wei89ddc322015-03-22 16:29:04 -0500139
jcc4a20a5f2015-04-30 15:43:39 +0800140 /**
141 * Returns all specific name tunnel back store. Annotations parameter is
142 * reserved.If there is no tunnel in the store, return a "null" object,and
143 * record the tunnel subscription. Where tunnel is created, ONOS notifies this consumer
144 * actively.
145 *
146 * @param consumerId a tunnel consumer
147 * @param tunnelName tunnel name
148 * @param annotations Annotations
149 * @return boolean
150 */
151 boolean returnTunnel(ApplicationId consumerId, TunnelName tunnelName,
152 Annotations... annotations);
153
154 /**
155 * Returns all specific type tunnels between source and destination back
156 * store. Annotations parameter is reserved.
157 *
158 * @param consumerId a tunnel consumer
159 * @param src a source point of tunnel.
160 * @param dst a destination point of tunnel
161 * @param type tunnel type
162 * @param annotations Annotations
163 * @return success or fail
164 */
165 boolean returnTunnel(ApplicationId consumerId, TunnelEndPoint src,
166 TunnelEndPoint dst, Type type,
167 Annotations... annotations);
168
169 /**
170 * Returns all tunnels between source and destination back the store.
171 * Annotations parameter is reserved.
172 *
173 * @param consumerId a tunnel consumer
174 * @param src a source point of tunnel.
175 * @param dst a destination point of tunnel.
176 * @param annotations Annotations
177 * @return success or fail
178 */
179 boolean returnTunnel(ApplicationId consumerId, TunnelEndPoint src,
180 TunnelEndPoint dst, Annotations... annotations);
181
182 /**
183 * Returns a tunnel by a specific tunnel identity.
184 *
185 * @param tunnelId tunnel identify generated by tunnel producer
186 * @return Tunnel
187 */
188 Tunnel queryTunnel(TunnelId tunnelId);
189
190 /**
191 * Returns all tunnel subscription record by consumer.
192 *
193 * @param consumerId consumer identity
194 * @return Collection of TunnelSubscription
195 */
196 Collection<TunnelSubscription> queryTunnelSubscription(ApplicationId consumerId);
197
198 /**
199 * Returns all specified type tunnels.
200 *
201 * @param type tunnel type
202 * @return Collection of tunnels
203 */
204 Collection<Tunnel> queryTunnel(Type type);
205
206 /**
207 * Returns all tunnels between source point and destination point.
208 *
209 * @param src a source point of tunnel.
210 * @param dst a destination point of tunnel.
211 * @return Collection of tunnels
212 */
213 Collection<Tunnel> queryTunnel(TunnelEndPoint src, TunnelEndPoint dst);
214
215 /**
216 * Returns all tunnels.
217 * @return all tunnels
218 */
219 int tunnelCount();
wei wei89ddc322015-03-22 16:29:04 -0500220}