blob: 3286ef29b6af80442eb3860c7ebeb15559ce81a1 [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 */
Thomas Vachuskabf916ea2015-05-20 18:24:34 -070016
17package org.onosproject.incubator.net.tunnel;
wei wei89ddc322015-03-22 16:29:04 -050018
jcc4a20a5f2015-04-30 15:43:39 +080019import java.util.Collection;
20
21import org.onosproject.core.ApplicationId;
22import org.onosproject.net.Annotations;
wei wei89ddc322015-03-22 16:29:04 -050023import org.onosproject.net.provider.ProviderId;
Thomas Vachuskabf916ea2015-05-20 18:24:34 -070024import org.onosproject.incubator.net.tunnel.Tunnel.Type;
wei wei89ddc322015-03-22 16:29:04 -050025import 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 */
30public interface TunnelStore extends Store<TunnelEvent, TunnelStoreDelegate> {
wei wei89ddc322015-03-22 16:29:04 -050031 /**
jcc4a20a5f2015-04-30 15:43:39 +080032 * Creates or updates a tunnel.
wei wei89ddc322015-03-22 16:29:04 -050033 *
jcc4a20a5f2015-04-30 15:43:39 +080034 * @param tunnel tunnel
35 * @return tunnel identity
wei wei89ddc322015-03-22 16:29:04 -050036 */
jcc4a20a5f2015-04-30 15:43:39 +080037 TunnelId createOrUpdateTunnel(Tunnel tunnel);
wei wei89ddc322015-03-22 16:29:04 -050038
39 /**
jcc4a20a5f2015-04-30 15:43:39 +080040 * Deletes a tunnel by a specific tunnel identifier.
wei wei89ddc322015-03-22 16:29:04 -050041 *
jcc4a20a5f2015-04-30 15:43:39 +080042 * @param tunnelId tunnel unique identifier generated by ONOS
wei wei89ddc322015-03-22 16:29:04 -050043 */
jcc4a20a5f2015-04-30 15:43:39 +080044 void deleteTunnel(TunnelId tunnelId);
wei wei89ddc322015-03-22 16:29:04 -050045
46 /**
jcc4a20a5f2015-04-30 15:43:39 +080047 * Deletes all tunnels between source point and destination point.
wei wei89ddc322015-03-22 16:29:04 -050048 *
jcc4a20a5f2015-04-30 15:43:39 +080049 * @param src a source point of tunnel.
50 * @param dst a destination point of tunnel.
51 * @param producerName producerName
wei wei89ddc322015-03-22 16:29:04 -050052 */
jcc4a20a5f2015-04-30 15:43:39 +080053 void deleteTunnel(TunnelEndPoint src, TunnelEndPoint dst,
54 ProviderId producerName);
wei wei89ddc322015-03-22 16:29:04 -050055
56 /**
jcc4a20a5f2015-04-30 15:43:39 +080057 * Deletes all specific type tunnels between source point and destination
58 * 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.
wei wei89ddc322015-03-22 16:29:04 -050062 * @param type tunnel type
jcc4a20a5f2015-04-30 15:43:39 +080063 * @param producerName producerName
wei wei89ddc322015-03-22 16:29:04 -050064 */
jcc4a20a5f2015-04-30 15:43:39 +080065 void deleteTunnel(TunnelEndPoint src, TunnelEndPoint dst,
66 Tunnel.Type type, ProviderId producerName);
wei wei89ddc322015-03-22 16:29:04 -050067
68 /**
jcc4a20a5f2015-04-30 15:43:39 +080069 * Returns a specific tunnel. Annotations parameter is reserved. If there
70 * is no tunnel in the store, return a "null" object, and record the tunnel subscription.
71 * Where tunnel is created, ONOS notifies this consumer actively.
wei wei89ddc322015-03-22 16:29:04 -050072 *
jcc4a20a5f2015-04-30 15:43:39 +080073 * @param consumerId a tunnel consumer
74 * @param tunnelId tunnel identify generated by onos
75 * @param annotations parameter
76 * @return Tunnel subscribed tunnel
wei wei89ddc322015-03-22 16:29:04 -050077 */
jcc4a20a5f2015-04-30 15:43:39 +080078 Tunnel borrowTunnel(ApplicationId consumerId, TunnelId tunnelId,
79 Annotations... annotations);
wei wei89ddc322015-03-22 16:29:04 -050080
81 /**
jcc4a20a5f2015-04-30 15:43:39 +080082 * Returns a specific tunnel by tunnelName. Annotations parameter is
83 * reserved. If there is no tunnel in the store, return a "null" object,and
84 * record the tunnel subscription. Where tunnel is created, ONOS notifies this consumer
85 * actively.
wei wei89ddc322015-03-22 16:29:04 -050086 *
jcc4a20a5f2015-04-30 15:43:39 +080087 * @param consumerId a tunnel consumer
88 * @param tunnelName tunnel name
89 * @param annotations parameter
90 * @return collection of subscribed Tunnels
wei wei89ddc322015-03-22 16:29:04 -050091 */
jcc4a20a5f2015-04-30 15:43:39 +080092 Collection<Tunnel> borrowTunnel(ApplicationId consumerId,
93 TunnelName tunnelName,
94 Annotations... annotations);
wei wei89ddc322015-03-22 16:29:04 -050095
96 /**
jcc4a20a5f2015-04-30 15:43:39 +080097 * Returns all tunnels between source and destination. Annotations
98 * parameter is reserved. If there is no any tunnel in the store, return a
99 * empty collection, and record the tunnel subscription. Where tunnel is created, ONOS
100 * notifies this consumer actively. Otherwise ONOS core returns all the
101 * tunnels, consumer determined which one to use.
wei wei89ddc322015-03-22 16:29:04 -0500102 *
jcc4a20a5f2015-04-30 15:43:39 +0800103 * @param consumerId a tunnel consumer
104 * @param src a source point of tunnel.
105 * @param dst a destination point of tunnel
106 * @param annotations parameter
107 * @return collection of subscribed Tunnels
wei wei89ddc322015-03-22 16:29:04 -0500108 */
jcc4a20a5f2015-04-30 15:43:39 +0800109 Collection<Tunnel> borrowTunnel(ApplicationId consumerId, TunnelEndPoint src,
110 TunnelEndPoint dst, Annotations... annotations);
wei wei89ddc322015-03-22 16:29:04 -0500111
112 /**
jcc4a20a5f2015-04-30 15:43:39 +0800113 * Returns all specified type tunnels between source and destination.
114 * Annotations parameter is reserved. If there is no any tunnel in the store,
115 * return a empty collection, and record the tunnel subscription. Where tunnel is
116 * created, ONOS notifies this consumer actively. Otherwise,ONOS core returns
117 * all available tunnels, consumer determined which one to use.
wei wei89ddc322015-03-22 16:29:04 -0500118 *
jcc4a20a5f2015-04-30 15:43:39 +0800119 * @param consumerId a tunnel consumer
120 * @param src a source point of tunnel.
121 * @param dst a destination point of tunnel
122 * @param type tunnel type
123 * @param annotations Annotations
124 * @return collection of available Tunnels
wei wei89ddc322015-03-22 16:29:04 -0500125 */
jcc4a20a5f2015-04-30 15:43:39 +0800126 Collection<Tunnel> borrowTunnel(ApplicationId consumerId, TunnelEndPoint src,
127 TunnelEndPoint dst, Type type,
128 Annotations... annotations);
wei wei89ddc322015-03-22 16:29:04 -0500129
130 /**
jcc4a20a5f2015-04-30 15:43:39 +0800131 * Returns back a specific tunnel to store.
wei wei89ddc322015-03-22 16:29:04 -0500132 *
jcc4a20a5f2015-04-30 15:43:39 +0800133 * @param consumerId a tunnel consumer
134 * @param tunnelId tunnel identify generated by ONOS
135 * @param annotations Annotations
136 * @return success or fail
wei wei89ddc322015-03-22 16:29:04 -0500137 */
jcc4a20a5f2015-04-30 15:43:39 +0800138 boolean returnTunnel(ApplicationId consumerId, TunnelId tunnelId,
139 Annotations... annotations);
wei wei89ddc322015-03-22 16:29:04 -0500140
jcc4a20a5f2015-04-30 15:43:39 +0800141 /**
142 * Returns all specific name tunnel back store. Annotations parameter is
143 * reserved.If there is no tunnel in the store, return a "null" object,and
144 * record the tunnel subscription. Where tunnel is created, ONOS notifies this consumer
145 * actively.
146 *
147 * @param consumerId a tunnel consumer
148 * @param tunnelName tunnel name
149 * @param annotations Annotations
150 * @return boolean
151 */
152 boolean returnTunnel(ApplicationId consumerId, TunnelName tunnelName,
153 Annotations... annotations);
154
155 /**
156 * Returns all specific type tunnels between source and destination back
157 * store. Annotations parameter is reserved.
158 *
159 * @param consumerId a tunnel consumer
160 * @param src a source point of tunnel.
161 * @param dst a destination point of tunnel
162 * @param type tunnel type
163 * @param annotations Annotations
164 * @return success or fail
165 */
166 boolean returnTunnel(ApplicationId consumerId, TunnelEndPoint src,
167 TunnelEndPoint dst, Type type,
168 Annotations... annotations);
169
170 /**
171 * Returns all tunnels between source and destination back the store.
172 * Annotations parameter is reserved.
173 *
174 * @param consumerId a tunnel consumer
175 * @param src a source point of tunnel.
176 * @param dst a destination point of tunnel.
177 * @param annotations Annotations
178 * @return success or fail
179 */
180 boolean returnTunnel(ApplicationId consumerId, TunnelEndPoint src,
181 TunnelEndPoint dst, Annotations... annotations);
182
183 /**
184 * Returns a tunnel by a specific tunnel identity.
185 *
186 * @param tunnelId tunnel identify generated by tunnel producer
187 * @return Tunnel
188 */
189 Tunnel queryTunnel(TunnelId tunnelId);
190
191 /**
192 * Returns all tunnel subscription record by consumer.
193 *
194 * @param consumerId consumer identity
195 * @return Collection of TunnelSubscription
196 */
197 Collection<TunnelSubscription> queryTunnelSubscription(ApplicationId consumerId);
198
199 /**
200 * Returns all specified type tunnels.
201 *
202 * @param type tunnel type
203 * @return Collection of tunnels
204 */
205 Collection<Tunnel> queryTunnel(Type type);
206
207 /**
208 * Returns all tunnels between source point and destination point.
209 *
210 * @param src a source point of tunnel.
211 * @param dst a destination point of tunnel.
212 * @return Collection of tunnels
213 */
214 Collection<Tunnel> queryTunnel(TunnelEndPoint src, TunnelEndPoint dst);
215
216 /**
217 * Returns all tunnels.
218 * @return all tunnels
219 */
220 int tunnelCount();
wei wei89ddc322015-03-22 16:29:04 -0500221}