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