blob: 1216cc6a3eb87c14ce8fe44d953b6471a4d62ea0 [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
jcc4a20a5f2015-04-30 15:43:39 +080020import org.onosproject.core.ApplicationId;
samuel7a5691a2015-05-23 00:36:32 +080021import org.onosproject.incubator.net.tunnel.Tunnel.Type;
jcc4a20a5f2015-04-30 15:43:39 +080022import org.onosproject.net.Annotations;
cheng fan35dc0f22015-06-10 06:02:47 +080023import org.onosproject.net.DeviceId;
wei wei89ddc322015-03-22 16:29:04 -050024
25/**
jcc4a20a5f2015-04-30 15:43:39 +080026 * Service for interacting with the inventory of tunnels.
wei wei89ddc322015-03-22 16:29:04 -050027 */
28public interface TunnelService {
29
30 /**
jcc4a20a5f2015-04-30 15:43:39 +080031 * Borrows a specific tunnel. Annotations parameter is reserved.If there
32 * is no tunnel in the store, returns a "null" object, and record the tunnel subscription.
33 * Where tunnel is created, ONOS notifies this consumer actively.
wei wei89ddc322015-03-22 16:29:04 -050034 *
jcc4a20a5f2015-04-30 15:43:39 +080035 * @param consumerId a tunnel consumer
36 * @param tunnelId tunnel identify generated by onos
37 * @param annotations Annotations
38 * @return Tunnel subscribed tunnel
wei wei89ddc322015-03-22 16:29:04 -050039 */
jcc4a20a5f2015-04-30 15:43:39 +080040 Tunnel borrowTunnel(ApplicationId consumerId, TunnelId tunnelId,
41 Annotations... annotations);
wei wei89ddc322015-03-22 16:29:04 -050042
43 /**
jcc4a20a5f2015-04-30 15:43:39 +080044 * Borrows a specific tunnel by tunnelName. Annotations parameter is reserved.If there
45 * is no tunnel in the store, return a "null" object, and record the tunnel subscription.
46 * Where tunnel is created, ONOS notifies this consumer actively.
wei wei89ddc322015-03-22 16:29:04 -050047 *
jcc4a20a5f2015-04-30 15:43:39 +080048 * @param consumerId a tunnel consumer
49 * @param tunnelName tunnel name
50 * @param annotations Annotations
51 * @return collection of subscribed Tunnels
wei wei89ddc322015-03-22 16:29:04 -050052 */
jcc4a20a5f2015-04-30 15:43:39 +080053 Collection<Tunnel> borrowTunnel(ApplicationId consumerId, TunnelName tunnelName,
54 Annotations... annotations);
wei wei89ddc322015-03-22 16:29:04 -050055
56 /**
jcc4a20a5f2015-04-30 15:43:39 +080057 * Borrows all tunnels between source and destination. Annotations
58 * parameter is reserved.If there is no any tunnel in the store, return a
59 * empty collection,and record the tunnel subscription. Where tunnel is created, ONOS
60 * notifies this consumer actively. Otherwise ONOS core returns all the
61 * tunnels, consumer determined which one to use.
wei wei89ddc322015-03-22 16:29:04 -050062 *
jcc4a20a5f2015-04-30 15:43:39 +080063 * @param consumerId a tunnel consumer
64 * @param src a source point of tunnel.
65 * @param dst a destination point of tunnel
66 * @param annotations Annotations
67 * @return collection of subscribed Tunnels
wei wei89ddc322015-03-22 16:29:04 -050068 */
jcc4a20a5f2015-04-30 15:43:39 +080069 Collection<Tunnel> borrowTunnel(ApplicationId consumerId, TunnelEndPoint src,
70 TunnelEndPoint dst, Annotations... annotations);
wei wei89ddc322015-03-22 16:29:04 -050071
72 /**
jcc4a20a5f2015-04-30 15:43:39 +080073 * Borrows all specified type tunnels between source and destination.
74 * Annotations parameter is reserved.If there is no any tunnel in the store,
75 * return a empty collection, and record the tunnel subscription. Where tunnel is
76 * created, ONOS notifies this consumer actively. Otherwise,ONOS core returns
77 * all available tunnels, consumer determined which one to use.
wei wei89ddc322015-03-22 16:29:04 -050078 *
jcc4a20a5f2015-04-30 15:43:39 +080079 * @param consumerId a tunnel consumer
80 * @param src a source point of tunnel.
81 * @param dst a destination point of tunnel
wei wei89ddc322015-03-22 16:29:04 -050082 * @param type tunnel type
jcc4a20a5f2015-04-30 15:43:39 +080083 * @param annotations Annotations
84 * @return collection of available Tunnels
wei wei89ddc322015-03-22 16:29:04 -050085 */
jcc4a20a5f2015-04-30 15:43:39 +080086 Collection<Tunnel> borrowTunnel(ApplicationId consumerId, TunnelEndPoint src,
samuel7a5691a2015-05-23 00:36:32 +080087 TunnelEndPoint dst, Type type,
jcc4a20a5f2015-04-30 15:43:39 +080088 Annotations... annotations);
wei wei89ddc322015-03-22 16:29:04 -050089
90 /**
jcc4a20a5f2015-04-30 15:43:39 +080091 * Returns back a specific tunnel to store.
wei wei89ddc322015-03-22 16:29:04 -050092 *
jcc4a20a5f2015-04-30 15:43:39 +080093 * @param consumerId a tunnel consumer
94 * @param tunnelId tunnel identify generated by ONOS
95 * @param annotations Annotations
96 * @return success or fail
wei wei89ddc322015-03-22 16:29:04 -050097 */
jcc4a20a5f2015-04-30 15:43:39 +080098 boolean returnTunnel(ApplicationId consumerId, TunnelId tunnelId,
99 Annotations... annotations);
wei wei89ddc322015-03-22 16:29:04 -0500100
101 /**
jcc4a20a5f2015-04-30 15:43:39 +0800102 * Returns all specific name tunnel back store. Annotations parameter is reserved.if there
103 * is no tunnel in the store, return a "null" object, and record the tunnel subscription.
104 * Where tunnel is created, ONOS notifies this consumer actively.
wei wei89ddc322015-03-22 16:29:04 -0500105 *
jcc4a20a5f2015-04-30 15:43:39 +0800106 * @param consumerId a tunnel consumer
107 * @param tunnelName tunnel name
108 * @param annotations Annotations
109 * @return boolean
wei wei89ddc322015-03-22 16:29:04 -0500110 */
jcc4a20a5f2015-04-30 15:43:39 +0800111 boolean returnTunnel(ApplicationId consumerId, TunnelName tunnelName,
112 Annotations... annotations);
113
114 /**
115 * Returns all specific type tunnels between source and destination back
116 * store. Annotations parameter is reserved.
117 *
118 * @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 success or fail
124 */
125 boolean returnTunnel(ApplicationId consumerId, TunnelEndPoint src,
samuel7a5691a2015-05-23 00:36:32 +0800126 TunnelEndPoint dst, Type type,
jcc4a20a5f2015-04-30 15:43:39 +0800127 Annotations... annotations);
128
129 /**
130 * Returns all tunnels between source and destination back the store.
131 * Annotations parameter is reserved.
132 *
133 * @param consumerId a tunnel consumer
134 * @param src a source point of tunnel.
135 * @param dst a destination point of tunnel.
136 * @param annotations Annotations
137 * @return success or fail
138 */
139 boolean returnTunnel(ApplicationId consumerId, TunnelEndPoint src,
140 TunnelEndPoint dst, Annotations... annotations);
141
142 /**
143 * Returns a tunnel by a specific tunnel identity.
144 *
145 * @param tunnelId tunnel identify generated by tunnel producer
146 * @return Tunnel
147 */
148 Tunnel queryTunnel(TunnelId tunnelId);
149
150 /**
151 * Returns all tunnel subscription record by consumer.
152 *
153 * @param consumerId consumer identity
154 * @return Collection of TunnelSubscription
155 */
156 Collection<TunnelSubscription> queryTunnelSubscription(ApplicationId consumerId);
157
158 /**
159 * Returns all specified type tunnels.
160 *
161 * @param type tunnel type
162 * @return Collection of tunnels
163 */
samuel7a5691a2015-05-23 00:36:32 +0800164 Collection<Tunnel> queryTunnel(Type type);
jcc4a20a5f2015-04-30 15:43:39 +0800165
166 /**
167 * Returns all tunnels between source point and destination point.
168 *
169 * @param src a source point of tunnel.
170 * @param dst a destination point of tunnel.
171 * @return Collection of tunnels
172 */
173 Collection<Tunnel> queryTunnel(TunnelEndPoint src, TunnelEndPoint dst);
174
175 /**
176 * Returns all tunnels.
177 *
samuel7a5691a2015-05-23 00:36:32 +0800178 * @return Collection of tunnels
179 */
180 Collection<Tunnel> queryAllTunnels();
181
182 /**
183 * Returns all tunnels.
184 *
jcc4a20a5f2015-04-30 15:43:39 +0800185 * @return all tunnels
186 */
187 int tunnelCount();
wei wei89ddc322015-03-22 16:29:04 -0500188
189 /**
cheng fan35dc0f22015-06-10 06:02:47 +0800190 * Returns the collection of tunnels applied on the specified device.
191 *
192 * @param deviceId device identifier
193 * @return collection of tunnels
194 */
195 Iterable<Tunnel> getTunnels(DeviceId deviceId);
196
197 /**
wei wei89ddc322015-03-22 16:29:04 -0500198 * Adds the specified tunnel listener.
199 *
200 * @param listener tunnel listener
201 */
202 void addListener(TunnelListener listener);
203
204 /**
205 * Removes the specified tunnel listener.
206 *
207 * @param listener tunnel listener
208 */
209 void removeListener(TunnelListener listener);
wei wei89ddc322015-03-22 16:29:04 -0500210}