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