blob: 109d98116c95d7acc3daf5c666a0519bfa5859db [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
18import java.util.Collection;
19
jcc4a20a5f2015-04-30 15:43:39 +080020import org.onosproject.core.ApplicationId;
21import org.onosproject.net.Annotations;
22import org.onosproject.net.tunnel.Tunnel.Type;
wei wei89ddc322015-03-22 16:29:04 -050023
24/**
jcc4a20a5f2015-04-30 15:43:39 +080025 * Service for interacting with the inventory of tunnels.
wei wei89ddc322015-03-22 16:29:04 -050026 */
27public interface TunnelService {
28
29 /**
jcc4a20a5f2015-04-30 15:43:39 +080030 * Borrows a specific tunnel. Annotations parameter is reserved.If there
31 * is no tunnel in the store, returns a "null" object, and record the tunnel subscription.
32 * Where tunnel is created, ONOS notifies this consumer actively.
wei wei89ddc322015-03-22 16:29:04 -050033 *
jcc4a20a5f2015-04-30 15:43:39 +080034 * @param consumerId a tunnel consumer
35 * @param tunnelId tunnel identify generated by onos
36 * @param annotations Annotations
37 * @return Tunnel subscribed tunnel
wei wei89ddc322015-03-22 16:29:04 -050038 */
jcc4a20a5f2015-04-30 15:43:39 +080039 Tunnel borrowTunnel(ApplicationId consumerId, TunnelId tunnelId,
40 Annotations... annotations);
wei wei89ddc322015-03-22 16:29:04 -050041
42 /**
jcc4a20a5f2015-04-30 15:43:39 +080043 * Borrows a specific tunnel by tunnelName. Annotations parameter is reserved.If there
44 * is no tunnel in the store, return a "null" object, and record the tunnel subscription.
45 * Where tunnel is created, ONOS notifies this consumer actively.
wei wei89ddc322015-03-22 16:29:04 -050046 *
jcc4a20a5f2015-04-30 15:43:39 +080047 * @param consumerId a tunnel consumer
48 * @param tunnelName tunnel name
49 * @param annotations Annotations
50 * @return collection of subscribed Tunnels
wei wei89ddc322015-03-22 16:29:04 -050051 */
jcc4a20a5f2015-04-30 15:43:39 +080052 Collection<Tunnel> borrowTunnel(ApplicationId consumerId, TunnelName tunnelName,
53 Annotations... annotations);
wei wei89ddc322015-03-22 16:29:04 -050054
55 /**
jcc4a20a5f2015-04-30 15:43:39 +080056 * Borrows all tunnels between source and destination. Annotations
57 * parameter is reserved.If there is no any tunnel in the store, return a
58 * empty collection,and record the tunnel subscription. Where tunnel is created, ONOS
59 * notifies this consumer actively. Otherwise ONOS core returns all the
60 * tunnels, consumer determined which one to use.
wei wei89ddc322015-03-22 16:29:04 -050061 *
jcc4a20a5f2015-04-30 15:43:39 +080062 * @param consumerId a tunnel consumer
63 * @param src a source point of tunnel.
64 * @param dst a destination point of tunnel
65 * @param annotations Annotations
66 * @return collection of subscribed Tunnels
wei wei89ddc322015-03-22 16:29:04 -050067 */
jcc4a20a5f2015-04-30 15:43:39 +080068 Collection<Tunnel> borrowTunnel(ApplicationId consumerId, TunnelEndPoint src,
69 TunnelEndPoint dst, Annotations... annotations);
wei wei89ddc322015-03-22 16:29:04 -050070
71 /**
jcc4a20a5f2015-04-30 15:43:39 +080072 * Borrows all specified type tunnels between source and destination.
73 * Annotations parameter is reserved.If there is no any tunnel in the store,
74 * return a empty collection, and record the tunnel subscription. Where tunnel is
75 * created, ONOS notifies this consumer actively. Otherwise,ONOS core returns
76 * all available tunnels, consumer determined which one to use.
wei wei89ddc322015-03-22 16:29:04 -050077 *
jcc4a20a5f2015-04-30 15:43:39 +080078 * @param consumerId a tunnel consumer
79 * @param src a source point of tunnel.
80 * @param dst a destination point of tunnel
wei wei89ddc322015-03-22 16:29:04 -050081 * @param type tunnel type
jcc4a20a5f2015-04-30 15:43:39 +080082 * @param annotations Annotations
83 * @return collection of available Tunnels
wei wei89ddc322015-03-22 16:29:04 -050084 */
jcc4a20a5f2015-04-30 15:43:39 +080085 Collection<Tunnel> borrowTunnel(ApplicationId consumerId, TunnelEndPoint src,
86 TunnelEndPoint dst, Type type,
87 Annotations... annotations);
wei wei89ddc322015-03-22 16:29:04 -050088
89 /**
jcc4a20a5f2015-04-30 15:43:39 +080090 * Returns back a specific tunnel to store.
wei wei89ddc322015-03-22 16:29:04 -050091 *
jcc4a20a5f2015-04-30 15:43:39 +080092 * @param consumerId a tunnel consumer
93 * @param tunnelId tunnel identify generated by ONOS
94 * @param annotations Annotations
95 * @return success or fail
wei wei89ddc322015-03-22 16:29:04 -050096 */
jcc4a20a5f2015-04-30 15:43:39 +080097 boolean returnTunnel(ApplicationId consumerId, TunnelId tunnelId,
98 Annotations... annotations);
wei wei89ddc322015-03-22 16:29:04 -050099
100 /**
jcc4a20a5f2015-04-30 15:43:39 +0800101 * Returns all specific name tunnel back store. Annotations parameter is reserved.if there
102 * is no tunnel in the store, return a "null" object, and record the tunnel subscription.
103 * Where tunnel is created, ONOS notifies this consumer actively.
wei wei89ddc322015-03-22 16:29:04 -0500104 *
jcc4a20a5f2015-04-30 15:43:39 +0800105 * @param consumerId a tunnel consumer
106 * @param tunnelName tunnel name
107 * @param annotations Annotations
108 * @return boolean
wei wei89ddc322015-03-22 16:29:04 -0500109 */
jcc4a20a5f2015-04-30 15:43:39 +0800110 boolean returnTunnel(ApplicationId consumerId, TunnelName tunnelName,
111 Annotations... annotations);
112
113 /**
114 * Returns all specific type tunnels between source and destination back
115 * store. Annotations parameter is reserved.
116 *
117 * @param consumerId a tunnel consumer
118 * @param src a source point of tunnel.
119 * @param dst a destination point of tunnel
120 * @param type tunnel type
121 * @param annotations Annotations
122 * @return success or fail
123 */
124 boolean returnTunnel(ApplicationId consumerId, TunnelEndPoint src,
125 TunnelEndPoint dst, Type type,
126 Annotations... annotations);
127
128 /**
129 * Returns all tunnels between source and destination back the store.
130 * Annotations parameter is reserved.
131 *
132 * @param consumerId a tunnel consumer
133 * @param src a source point of tunnel.
134 * @param dst a destination point of tunnel.
135 * @param annotations Annotations
136 * @return success or fail
137 */
138 boolean returnTunnel(ApplicationId consumerId, TunnelEndPoint src,
139 TunnelEndPoint dst, Annotations... annotations);
140
141 /**
142 * Returns a tunnel by a specific tunnel identity.
143 *
144 * @param tunnelId tunnel identify generated by tunnel producer
145 * @return Tunnel
146 */
147 Tunnel queryTunnel(TunnelId tunnelId);
148
149 /**
150 * Returns all tunnel subscription record by consumer.
151 *
152 * @param consumerId consumer identity
153 * @return Collection of TunnelSubscription
154 */
155 Collection<TunnelSubscription> queryTunnelSubscription(ApplicationId consumerId);
156
157 /**
158 * Returns all specified type tunnels.
159 *
160 * @param type tunnel type
161 * @return Collection of tunnels
162 */
163 Collection<Tunnel> queryTunnel(Type type);
164
165 /**
166 * Returns all tunnels between source point and destination point.
167 *
168 * @param src a source point of tunnel.
169 * @param dst a destination point of tunnel.
170 * @return Collection of tunnels
171 */
172 Collection<Tunnel> queryTunnel(TunnelEndPoint src, TunnelEndPoint dst);
173
174 /**
175 * Returns all tunnels.
176 *
177 * @return all tunnels
178 */
179 int tunnelCount();
wei wei89ddc322015-03-22 16:29:04 -0500180
181 /**
182 * Adds the specified tunnel listener.
183 *
184 * @param listener tunnel listener
185 */
186 void addListener(TunnelListener listener);
187
188 /**
189 * Removes the specified tunnel listener.
190 *
191 * @param listener tunnel listener
192 */
193 void removeListener(TunnelListener listener);
wei wei89ddc322015-03-22 16:29:04 -0500194}