blob: 2a10a4c1b8082d2611e9edee92a87583a7627517 [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;
Thomas Vachuska42e8cce2015-07-29 19:25:18 -070022import org.onosproject.event.ListenerService;
samuel7a5691a2015-05-23 00:36:32 +080023import org.onosproject.incubator.net.tunnel.Tunnel.Type;
jcc4a20a5f2015-04-30 15:43:39 +080024import org.onosproject.net.Annotations;
cheng fan35dc0f22015-06-10 06:02:47 +080025import org.onosproject.net.DeviceId;
wei wei89ddc322015-03-22 16:29:04 -050026
27/**
jcc4a20a5f2015-04-30 15:43:39 +080028 * Service for interacting with the inventory of tunnels.
wei wei89ddc322015-03-22 16:29:04 -050029 */
Brian O'Connor2bed5ce2015-06-25 15:10:28 -040030@Beta
Thomas Vachuska42e8cce2015-07-29 19:25:18 -070031public interface TunnelService
32 extends ListenerService<TunnelEvent, TunnelListener> {
wei wei89ddc322015-03-22 16:29:04 -050033
34 /**
jcc4a20a5f2015-04-30 15:43:39 +080035 * Borrows a specific tunnel. Annotations parameter is reserved.If there
36 * is no tunnel in the store, returns a "null" object, and record the tunnel subscription.
37 * Where tunnel is created, ONOS notifies this consumer actively.
wei wei89ddc322015-03-22 16:29:04 -050038 *
jcc4a20a5f2015-04-30 15:43:39 +080039 * @param consumerId a tunnel consumer
40 * @param tunnelId tunnel identify generated by onos
41 * @param annotations Annotations
42 * @return Tunnel subscribed tunnel
wei wei89ddc322015-03-22 16:29:04 -050043 */
jcc4a20a5f2015-04-30 15:43:39 +080044 Tunnel borrowTunnel(ApplicationId consumerId, TunnelId tunnelId,
45 Annotations... annotations);
wei wei89ddc322015-03-22 16:29:04 -050046
47 /**
jcc4a20a5f2015-04-30 15:43:39 +080048 * Borrows a specific tunnel by tunnelName. Annotations parameter is reserved.If there
49 * is no tunnel in the store, return a "null" object, and record the tunnel subscription.
50 * Where tunnel is created, ONOS notifies this consumer actively.
wei wei89ddc322015-03-22 16:29:04 -050051 *
jcc4a20a5f2015-04-30 15:43:39 +080052 * @param consumerId a tunnel consumer
53 * @param tunnelName tunnel name
54 * @param annotations Annotations
55 * @return collection of subscribed Tunnels
wei wei89ddc322015-03-22 16:29:04 -050056 */
jcc4a20a5f2015-04-30 15:43:39 +080057 Collection<Tunnel> borrowTunnel(ApplicationId consumerId, TunnelName tunnelName,
58 Annotations... annotations);
wei wei89ddc322015-03-22 16:29:04 -050059
60 /**
jcc4a20a5f2015-04-30 15:43:39 +080061 * Borrows all tunnels between source and destination. Annotations
62 * parameter is reserved.If there is no any tunnel in the store, return a
63 * empty collection,and record the tunnel subscription. Where tunnel is created, ONOS
64 * notifies this consumer actively. Otherwise ONOS core returns all the
65 * tunnels, consumer determined which one to use.
wei wei89ddc322015-03-22 16:29:04 -050066 *
jcc4a20a5f2015-04-30 15:43:39 +080067 * @param consumerId a tunnel consumer
68 * @param src a source point of tunnel.
69 * @param dst a destination point of tunnel
70 * @param annotations Annotations
71 * @return collection of subscribed Tunnels
wei wei89ddc322015-03-22 16:29:04 -050072 */
jcc4a20a5f2015-04-30 15:43:39 +080073 Collection<Tunnel> borrowTunnel(ApplicationId consumerId, TunnelEndPoint src,
74 TunnelEndPoint dst, Annotations... annotations);
wei wei89ddc322015-03-22 16:29:04 -050075
76 /**
jcc4a20a5f2015-04-30 15:43:39 +080077 * Borrows all specified type tunnels between source and destination.
78 * Annotations parameter is reserved.If there is no any tunnel in the store,
79 * return a empty collection, and record the tunnel subscription. Where tunnel is
80 * created, ONOS notifies this consumer actively. Otherwise,ONOS core returns
81 * all available tunnels, consumer determined which one to use.
wei wei89ddc322015-03-22 16:29:04 -050082 *
jcc4a20a5f2015-04-30 15:43:39 +080083 * @param consumerId a tunnel consumer
84 * @param src a source point of tunnel.
85 * @param dst a destination point of tunnel
wei wei89ddc322015-03-22 16:29:04 -050086 * @param type tunnel type
jcc4a20a5f2015-04-30 15:43:39 +080087 * @param annotations Annotations
88 * @return collection of available Tunnels
wei wei89ddc322015-03-22 16:29:04 -050089 */
jcc4a20a5f2015-04-30 15:43:39 +080090 Collection<Tunnel> borrowTunnel(ApplicationId consumerId, TunnelEndPoint src,
samuel7a5691a2015-05-23 00:36:32 +080091 TunnelEndPoint dst, Type type,
jcc4a20a5f2015-04-30 15:43:39 +080092 Annotations... annotations);
wei wei89ddc322015-03-22 16:29:04 -050093
94 /**
jcc4a20a5f2015-04-30 15:43:39 +080095 * Returns back a specific tunnel to store.
wei wei89ddc322015-03-22 16:29:04 -050096 *
jcc4a20a5f2015-04-30 15:43:39 +080097 * @param consumerId a tunnel consumer
98 * @param tunnelId tunnel identify generated by ONOS
99 * @param annotations Annotations
100 * @return success or fail
wei wei89ddc322015-03-22 16:29:04 -0500101 */
jcc4a20a5f2015-04-30 15:43:39 +0800102 boolean returnTunnel(ApplicationId consumerId, TunnelId tunnelId,
103 Annotations... annotations);
wei wei89ddc322015-03-22 16:29:04 -0500104
105 /**
jcc4a20a5f2015-04-30 15:43:39 +0800106 * Returns all specific name tunnel back store. Annotations parameter is reserved.if there
107 * is no tunnel in the store, return a "null" object, and record the tunnel subscription.
108 * Where tunnel is created, ONOS notifies this consumer actively.
wei wei89ddc322015-03-22 16:29:04 -0500109 *
jcc4a20a5f2015-04-30 15:43:39 +0800110 * @param consumerId a tunnel consumer
111 * @param tunnelName tunnel name
112 * @param annotations Annotations
113 * @return boolean
wei wei89ddc322015-03-22 16:29:04 -0500114 */
jcc4a20a5f2015-04-30 15:43:39 +0800115 boolean returnTunnel(ApplicationId consumerId, TunnelName tunnelName,
116 Annotations... annotations);
117
118 /**
119 * Returns all specific type tunnels between source and destination back
120 * store. Annotations parameter is reserved.
121 *
122 * @param consumerId a tunnel consumer
123 * @param src a source point of tunnel.
124 * @param dst a destination point of tunnel
125 * @param type tunnel type
126 * @param annotations Annotations
127 * @return success or fail
128 */
129 boolean returnTunnel(ApplicationId consumerId, TunnelEndPoint src,
samuel7a5691a2015-05-23 00:36:32 +0800130 TunnelEndPoint dst, Type type,
jcc4a20a5f2015-04-30 15:43:39 +0800131 Annotations... annotations);
132
133 /**
134 * Returns all tunnels between source and destination back the store.
135 * Annotations parameter is reserved.
136 *
137 * @param consumerId a tunnel consumer
138 * @param src a source point of tunnel.
139 * @param dst a destination point of tunnel.
140 * @param annotations Annotations
141 * @return success or fail
142 */
143 boolean returnTunnel(ApplicationId consumerId, TunnelEndPoint src,
144 TunnelEndPoint dst, Annotations... annotations);
145
146 /**
147 * Returns a tunnel by a specific tunnel identity.
148 *
149 * @param tunnelId tunnel identify generated by tunnel producer
150 * @return Tunnel
151 */
152 Tunnel queryTunnel(TunnelId tunnelId);
153
154 /**
155 * Returns all tunnel subscription record by consumer.
156 *
157 * @param consumerId consumer identity
158 * @return Collection of TunnelSubscription
159 */
160 Collection<TunnelSubscription> queryTunnelSubscription(ApplicationId consumerId);
161
162 /**
163 * Returns all specified type tunnels.
164 *
165 * @param type tunnel type
166 * @return Collection of tunnels
167 */
samuel7a5691a2015-05-23 00:36:32 +0800168 Collection<Tunnel> queryTunnel(Type type);
jcc4a20a5f2015-04-30 15:43:39 +0800169
170 /**
171 * Returns all tunnels between source point and destination point.
172 *
173 * @param src a source point of tunnel.
174 * @param dst a destination point of tunnel.
175 * @return Collection of tunnels
176 */
177 Collection<Tunnel> queryTunnel(TunnelEndPoint src, TunnelEndPoint dst);
178
179 /**
180 * Returns all tunnels.
181 *
samuel7a5691a2015-05-23 00:36:32 +0800182 * @return Collection of tunnels
183 */
184 Collection<Tunnel> queryAllTunnels();
185
186 /**
187 * Returns all tunnels.
188 *
jcc4a20a5f2015-04-30 15:43:39 +0800189 * @return all tunnels
190 */
191 int tunnelCount();
wei wei89ddc322015-03-22 16:29:04 -0500192
193 /**
cheng fan35dc0f22015-06-10 06:02:47 +0800194 * Returns the collection of tunnels applied on the specified device.
195 *
196 * @param deviceId device identifier
197 * @return collection of tunnels
198 */
199 Iterable<Tunnel> getTunnels(DeviceId deviceId);
200
wei wei89ddc322015-03-22 16:29:04 -0500201}