blob: a495955c42c47341d97ef9177387728ce4612a8c [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 -070016package org.onosproject.incubator.net.tunnel;
wei wei89ddc322015-03-22 16:29:04 -050017
18import 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;
cheng fan35dc0f22015-06-10 06:02:47 +080024import org.onosproject.net.DeviceId;
wei wei89ddc322015-03-22 16:29:04 -050025
26/**
jcc4a20a5f2015-04-30 15:43:39 +080027 * Service for interacting with the inventory of tunnels.
wei wei89ddc322015-03-22 16:29:04 -050028 */
Brian O'Connor2bed5ce2015-06-25 15:10:28 -040029@Beta
wei wei89ddc322015-03-22 16:29:04 -050030public interface TunnelService {
31
32 /**
jcc4a20a5f2015-04-30 15:43:39 +080033 * Borrows a specific tunnel. Annotations parameter is reserved.If there
34 * is no tunnel in the store, returns a "null" object, and record the tunnel subscription.
35 * Where tunnel is created, ONOS notifies this consumer actively.
wei wei89ddc322015-03-22 16:29:04 -050036 *
jcc4a20a5f2015-04-30 15:43:39 +080037 * @param consumerId a tunnel consumer
38 * @param tunnelId tunnel identify generated by onos
39 * @param annotations Annotations
40 * @return Tunnel subscribed tunnel
wei wei89ddc322015-03-22 16:29:04 -050041 */
jcc4a20a5f2015-04-30 15:43:39 +080042 Tunnel borrowTunnel(ApplicationId consumerId, TunnelId tunnelId,
43 Annotations... annotations);
wei wei89ddc322015-03-22 16:29:04 -050044
45 /**
jcc4a20a5f2015-04-30 15:43:39 +080046 * Borrows a specific tunnel by tunnelName. Annotations parameter is reserved.If there
47 * is no tunnel in the store, return a "null" object, and record the tunnel subscription.
48 * Where tunnel is created, ONOS notifies this consumer actively.
wei wei89ddc322015-03-22 16:29:04 -050049 *
jcc4a20a5f2015-04-30 15:43:39 +080050 * @param consumerId a tunnel consumer
51 * @param tunnelName tunnel name
52 * @param annotations Annotations
53 * @return collection of subscribed Tunnels
wei wei89ddc322015-03-22 16:29:04 -050054 */
jcc4a20a5f2015-04-30 15:43:39 +080055 Collection<Tunnel> borrowTunnel(ApplicationId consumerId, TunnelName tunnelName,
56 Annotations... annotations);
wei wei89ddc322015-03-22 16:29:04 -050057
58 /**
jcc4a20a5f2015-04-30 15:43:39 +080059 * Borrows all tunnels between source and destination. Annotations
60 * parameter is reserved.If there is no any tunnel in the store, return a
61 * empty collection,and record the tunnel subscription. Where tunnel is created, ONOS
62 * notifies this consumer actively. Otherwise ONOS core returns all the
63 * tunnels, consumer determined which one to use.
wei wei89ddc322015-03-22 16:29:04 -050064 *
jcc4a20a5f2015-04-30 15:43:39 +080065 * @param consumerId a tunnel consumer
66 * @param src a source point of tunnel.
67 * @param dst a destination point of tunnel
68 * @param annotations Annotations
69 * @return collection of subscribed Tunnels
wei wei89ddc322015-03-22 16:29:04 -050070 */
jcc4a20a5f2015-04-30 15:43:39 +080071 Collection<Tunnel> borrowTunnel(ApplicationId consumerId, TunnelEndPoint src,
72 TunnelEndPoint dst, Annotations... annotations);
wei wei89ddc322015-03-22 16:29:04 -050073
74 /**
jcc4a20a5f2015-04-30 15:43:39 +080075 * Borrows all specified type tunnels between source and destination.
76 * Annotations parameter is reserved.If there is no any tunnel in the store,
77 * return a empty collection, and record the tunnel subscription. Where tunnel is
78 * created, ONOS notifies this consumer actively. Otherwise,ONOS core returns
79 * all available tunnels, consumer determined which one to use.
wei wei89ddc322015-03-22 16:29:04 -050080 *
jcc4a20a5f2015-04-30 15:43:39 +080081 * @param consumerId a tunnel consumer
82 * @param src a source point of tunnel.
83 * @param dst a destination point of tunnel
wei wei89ddc322015-03-22 16:29:04 -050084 * @param type tunnel type
jcc4a20a5f2015-04-30 15:43:39 +080085 * @param annotations Annotations
86 * @return collection of available Tunnels
wei wei89ddc322015-03-22 16:29:04 -050087 */
jcc4a20a5f2015-04-30 15:43:39 +080088 Collection<Tunnel> borrowTunnel(ApplicationId consumerId, TunnelEndPoint src,
samuel7a5691a2015-05-23 00:36:32 +080089 TunnelEndPoint dst, Type type,
jcc4a20a5f2015-04-30 15:43:39 +080090 Annotations... annotations);
wei wei89ddc322015-03-22 16:29:04 -050091
92 /**
jcc4a20a5f2015-04-30 15:43:39 +080093 * Returns back a specific tunnel to store.
wei wei89ddc322015-03-22 16:29:04 -050094 *
jcc4a20a5f2015-04-30 15:43:39 +080095 * @param consumerId a tunnel consumer
96 * @param tunnelId tunnel identify generated by ONOS
97 * @param annotations Annotations
98 * @return success or fail
wei wei89ddc322015-03-22 16:29:04 -050099 */
jcc4a20a5f2015-04-30 15:43:39 +0800100 boolean returnTunnel(ApplicationId consumerId, TunnelId tunnelId,
101 Annotations... annotations);
wei wei89ddc322015-03-22 16:29:04 -0500102
103 /**
jcc4a20a5f2015-04-30 15:43:39 +0800104 * Returns all specific name tunnel back store. Annotations parameter is reserved.if there
105 * is no tunnel in the store, return a "null" object, and record the tunnel subscription.
106 * Where tunnel is created, ONOS notifies this consumer actively.
wei wei89ddc322015-03-22 16:29:04 -0500107 *
jcc4a20a5f2015-04-30 15:43:39 +0800108 * @param consumerId a tunnel consumer
109 * @param tunnelName tunnel name
110 * @param annotations Annotations
111 * @return boolean
wei wei89ddc322015-03-22 16:29:04 -0500112 */
jcc4a20a5f2015-04-30 15:43:39 +0800113 boolean returnTunnel(ApplicationId consumerId, TunnelName tunnelName,
114 Annotations... annotations);
115
116 /**
117 * Returns all specific type tunnels between source and destination back
118 * store. Annotations parameter is reserved.
119 *
120 * @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 success or fail
126 */
127 boolean returnTunnel(ApplicationId consumerId, TunnelEndPoint src,
samuel7a5691a2015-05-23 00:36:32 +0800128 TunnelEndPoint dst, Type type,
jcc4a20a5f2015-04-30 15:43:39 +0800129 Annotations... annotations);
130
131 /**
132 * Returns all tunnels between source and destination back the store.
133 * Annotations parameter is reserved.
134 *
135 * @param consumerId a tunnel consumer
136 * @param src a source point of tunnel.
137 * @param dst a destination point of tunnel.
138 * @param annotations Annotations
139 * @return success or fail
140 */
141 boolean returnTunnel(ApplicationId consumerId, TunnelEndPoint src,
142 TunnelEndPoint dst, Annotations... annotations);
143
144 /**
145 * Returns a tunnel by a specific tunnel identity.
146 *
147 * @param tunnelId tunnel identify generated by tunnel producer
148 * @return Tunnel
149 */
150 Tunnel queryTunnel(TunnelId tunnelId);
151
152 /**
153 * Returns all tunnel subscription record by consumer.
154 *
155 * @param consumerId consumer identity
156 * @return Collection of TunnelSubscription
157 */
158 Collection<TunnelSubscription> queryTunnelSubscription(ApplicationId consumerId);
159
160 /**
161 * Returns all specified type tunnels.
162 *
163 * @param type tunnel type
164 * @return Collection of tunnels
165 */
samuel7a5691a2015-05-23 00:36:32 +0800166 Collection<Tunnel> queryTunnel(Type type);
jcc4a20a5f2015-04-30 15:43:39 +0800167
168 /**
169 * Returns all tunnels between source point and destination point.
170 *
171 * @param src a source point of tunnel.
172 * @param dst a destination point of tunnel.
173 * @return Collection of tunnels
174 */
175 Collection<Tunnel> queryTunnel(TunnelEndPoint src, TunnelEndPoint dst);
176
177 /**
178 * Returns all tunnels.
179 *
samuel7a5691a2015-05-23 00:36:32 +0800180 * @return Collection of tunnels
181 */
182 Collection<Tunnel> queryAllTunnels();
183
184 /**
185 * Returns all tunnels.
186 *
jcc4a20a5f2015-04-30 15:43:39 +0800187 * @return all tunnels
188 */
189 int tunnelCount();
wei wei89ddc322015-03-22 16:29:04 -0500190
191 /**
cheng fan35dc0f22015-06-10 06:02:47 +0800192 * Returns the collection of tunnels applied on the specified device.
193 *
194 * @param deviceId device identifier
195 * @return collection of tunnels
196 */
197 Iterable<Tunnel> getTunnels(DeviceId deviceId);
198
199 /**
wei wei89ddc322015-03-22 16:29:04 -0500200 * Adds the specified tunnel listener.
201 *
202 * @param listener tunnel listener
203 */
204 void addListener(TunnelListener listener);
205
206 /**
207 * Removes the specified tunnel listener.
208 *
209 * @param listener tunnel listener
210 */
211 void removeListener(TunnelListener listener);
wei wei89ddc322015-03-22 16:29:04 -0500212}