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