wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Laboratory |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 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 Vachuska | bf916ea | 2015-05-20 18:24:34 -0700 | [diff] [blame] | 16 | package org.onosproject.incubator.net.tunnel; |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 17 | |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 18 | import java.util.Collection; |
| 19 | |
Brian O'Connor | 2bed5ce | 2015-06-25 15:10:28 -0400 | [diff] [blame] | 20 | import com.google.common.annotations.Beta; |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 21 | import org.onosproject.core.ApplicationId; |
Avantika-Huawei | 4c3c997 | 2016-04-05 14:51:46 +0530 | [diff] [blame^] | 22 | import org.onosproject.incubator.net.tunnel.Tunnel.State; |
samuel | 7a5691a | 2015-05-23 00:36:32 +0800 | [diff] [blame] | 23 | import org.onosproject.incubator.net.tunnel.Tunnel.Type; |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 24 | import org.onosproject.net.Annotations; |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 25 | import org.onosproject.net.provider.ProviderId; |
| 26 | import org.onosproject.store.Store; |
| 27 | |
| 28 | /** |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 29 | * Manages inventory of tunnel; not intended for direct use. |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 30 | */ |
Brian O'Connor | 2bed5ce | 2015-06-25 15:10:28 -0400 | [diff] [blame] | 31 | @Beta |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 32 | public interface TunnelStore extends Store<TunnelEvent, TunnelStoreDelegate> { |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 33 | /** |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 34 | * Creates or updates a tunnel. |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 35 | * |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 36 | * @param tunnel tunnel |
| 37 | * @return tunnel identity |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 38 | */ |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 39 | TunnelId createOrUpdateTunnel(Tunnel tunnel); |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 40 | |
| 41 | /** |
Avantika-Huawei | 4c3c997 | 2016-04-05 14:51:46 +0530 | [diff] [blame^] | 42 | * Creates a tunnel or updates a tunnel with the new state given in input. |
| 43 | * |
| 44 | * @param tunnel tunnel |
| 45 | * @param state tunnel state |
| 46 | * @return tunnel identity |
| 47 | */ |
| 48 | TunnelId createOrUpdateTunnel(Tunnel tunnel, State state); |
| 49 | |
| 50 | /** |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 51 | * Deletes a tunnel by a specific tunnel identifier. |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 52 | * |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 53 | * @param tunnelId tunnel unique identifier generated by ONOS |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 54 | */ |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 55 | void deleteTunnel(TunnelId tunnelId); |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 56 | |
| 57 | /** |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 58 | * Deletes all tunnels between source point and destination point. |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 59 | * |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 60 | * @param src a source point of tunnel. |
| 61 | * @param dst a destination point of tunnel. |
| 62 | * @param producerName producerName |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 63 | */ |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 64 | void deleteTunnel(TunnelEndPoint src, TunnelEndPoint dst, |
| 65 | ProviderId producerName); |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 66 | |
| 67 | /** |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 68 | * Deletes all specific type tunnels between source point and destination |
| 69 | * point. |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 70 | * |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 71 | * @param src a source point of tunnel. |
| 72 | * @param dst a destination point of tunnel. |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 73 | * @param type tunnel type |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 74 | * @param producerName producerName |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 75 | */ |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 76 | void deleteTunnel(TunnelEndPoint src, TunnelEndPoint dst, |
| 77 | Tunnel.Type type, ProviderId producerName); |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 78 | |
| 79 | /** |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 80 | * Returns a specific tunnel. Annotations parameter is reserved. If there |
| 81 | * is no tunnel in the store, return a "null" object, and record the tunnel subscription. |
| 82 | * Where tunnel is created, ONOS notifies this consumer actively. |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 83 | * |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 84 | * @param consumerId a tunnel consumer |
| 85 | * @param tunnelId tunnel identify generated by onos |
| 86 | * @param annotations parameter |
| 87 | * @return Tunnel subscribed tunnel |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 88 | */ |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 89 | Tunnel borrowTunnel(ApplicationId consumerId, TunnelId tunnelId, |
| 90 | Annotations... annotations); |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 91 | |
| 92 | /** |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 93 | * Returns a specific tunnel by tunnelName. Annotations parameter is |
| 94 | * reserved. If there is no tunnel in the store, return a "null" object,and |
| 95 | * record the tunnel subscription. Where tunnel is created, ONOS notifies this consumer |
| 96 | * actively. |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 97 | * |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 98 | * @param consumerId a tunnel consumer |
| 99 | * @param tunnelName tunnel name |
| 100 | * @param annotations parameter |
| 101 | * @return collection of subscribed Tunnels |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 102 | */ |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 103 | Collection<Tunnel> borrowTunnel(ApplicationId consumerId, |
| 104 | TunnelName tunnelName, |
| 105 | Annotations... annotations); |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 106 | |
| 107 | /** |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 108 | * Returns all tunnels between source and destination. Annotations |
| 109 | * parameter is reserved. If there is no any tunnel in the store, return a |
| 110 | * empty collection, and record the tunnel subscription. Where tunnel is created, ONOS |
| 111 | * notifies this consumer actively. Otherwise ONOS core returns all the |
| 112 | * tunnels, consumer determined which one to use. |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 113 | * |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 114 | * @param consumerId a tunnel consumer |
| 115 | * @param src a source point of tunnel. |
| 116 | * @param dst a destination point of tunnel |
| 117 | * @param annotations parameter |
| 118 | * @return collection of subscribed Tunnels |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 119 | */ |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 120 | Collection<Tunnel> borrowTunnel(ApplicationId consumerId, TunnelEndPoint src, |
| 121 | TunnelEndPoint dst, Annotations... annotations); |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 122 | |
| 123 | /** |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 124 | * Returns all specified type tunnels between source and destination. |
| 125 | * Annotations parameter is reserved. If there is no any tunnel in the store, |
| 126 | * return a empty collection, and record the tunnel subscription. Where tunnel is |
| 127 | * created, ONOS notifies this consumer actively. Otherwise,ONOS core returns |
| 128 | * all available tunnels, consumer determined which one to use. |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 129 | * |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 130 | * @param consumerId a tunnel consumer |
| 131 | * @param src a source point of tunnel. |
| 132 | * @param dst a destination point of tunnel |
| 133 | * @param type tunnel type |
| 134 | * @param annotations Annotations |
| 135 | * @return collection of available Tunnels |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 136 | */ |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 137 | Collection<Tunnel> borrowTunnel(ApplicationId consumerId, TunnelEndPoint src, |
| 138 | TunnelEndPoint dst, Type type, |
| 139 | Annotations... annotations); |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 140 | |
| 141 | /** |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 142 | * Returns back a specific tunnel to store. |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 143 | * |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 144 | * @param consumerId a tunnel consumer |
| 145 | * @param tunnelId tunnel identify generated by ONOS |
| 146 | * @param annotations Annotations |
| 147 | * @return success or fail |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 148 | */ |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 149 | boolean returnTunnel(ApplicationId consumerId, TunnelId tunnelId, |
| 150 | Annotations... annotations); |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 151 | |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 152 | /** |
| 153 | * Returns all specific name tunnel back store. Annotations parameter is |
| 154 | * reserved.If there is no tunnel in the store, return a "null" object,and |
| 155 | * record the tunnel subscription. Where tunnel is created, ONOS notifies this consumer |
| 156 | * actively. |
| 157 | * |
| 158 | * @param consumerId a tunnel consumer |
| 159 | * @param tunnelName tunnel name |
| 160 | * @param annotations Annotations |
| 161 | * @return boolean |
| 162 | */ |
| 163 | boolean returnTunnel(ApplicationId consumerId, TunnelName tunnelName, |
| 164 | Annotations... annotations); |
| 165 | |
| 166 | /** |
| 167 | * Returns all specific type tunnels between source and destination back |
| 168 | * store. Annotations parameter is reserved. |
| 169 | * |
| 170 | * @param consumerId a tunnel consumer |
| 171 | * @param src a source point of tunnel. |
| 172 | * @param dst a destination point of tunnel |
| 173 | * @param type tunnel type |
| 174 | * @param annotations Annotations |
| 175 | * @return success or fail |
| 176 | */ |
| 177 | boolean returnTunnel(ApplicationId consumerId, TunnelEndPoint src, |
| 178 | TunnelEndPoint dst, Type type, |
| 179 | Annotations... annotations); |
| 180 | |
| 181 | /** |
| 182 | * Returns all tunnels between source and destination back the store. |
| 183 | * Annotations parameter is reserved. |
| 184 | * |
| 185 | * @param consumerId a tunnel consumer |
| 186 | * @param src a source point of tunnel. |
| 187 | * @param dst a destination point of tunnel. |
| 188 | * @param annotations Annotations |
| 189 | * @return success or fail |
| 190 | */ |
| 191 | boolean returnTunnel(ApplicationId consumerId, TunnelEndPoint src, |
| 192 | TunnelEndPoint dst, Annotations... annotations); |
| 193 | |
| 194 | /** |
| 195 | * Returns a tunnel by a specific tunnel identity. |
| 196 | * |
| 197 | * @param tunnelId tunnel identify generated by tunnel producer |
| 198 | * @return Tunnel |
| 199 | */ |
| 200 | Tunnel queryTunnel(TunnelId tunnelId); |
| 201 | |
| 202 | /** |
| 203 | * Returns all tunnel subscription record by consumer. |
| 204 | * |
| 205 | * @param consumerId consumer identity |
| 206 | * @return Collection of TunnelSubscription |
| 207 | */ |
| 208 | Collection<TunnelSubscription> queryTunnelSubscription(ApplicationId consumerId); |
| 209 | |
| 210 | /** |
| 211 | * Returns all specified type tunnels. |
| 212 | * |
| 213 | * @param type tunnel type |
| 214 | * @return Collection of tunnels |
| 215 | */ |
| 216 | Collection<Tunnel> queryTunnel(Type type); |
| 217 | |
| 218 | /** |
| 219 | * Returns all tunnels between source point and destination point. |
| 220 | * |
| 221 | * @param src a source point of tunnel. |
| 222 | * @param dst a destination point of tunnel. |
| 223 | * @return Collection of tunnels |
| 224 | */ |
| 225 | Collection<Tunnel> queryTunnel(TunnelEndPoint src, TunnelEndPoint dst); |
| 226 | |
| 227 | /** |
| 228 | * Returns all tunnels. |
samuel | 7a5691a | 2015-05-23 00:36:32 +0800 | [diff] [blame] | 229 | * |
| 230 | * @return Collection of tunnels |
| 231 | */ |
| 232 | Collection<Tunnel> queryAllTunnels(); |
| 233 | |
| 234 | /** |
| 235 | * Returns all tunnels. |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 236 | * @return all tunnels |
| 237 | */ |
| 238 | int tunnelCount(); |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 239 | } |