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 | |
| 19 | import java.util.Collection; |
| 20 | |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 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 | |
| 24 | /** |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 25 | * Service for interacting with the inventory of tunnels. |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 26 | */ |
| 27 | public interface TunnelService { |
| 28 | |
| 29 | /** |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 30 | * 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 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 consumerId a tunnel consumer |
| 35 | * @param tunnelId tunnel identify generated by onos |
| 36 | * @param annotations Annotations |
| 37 | * @return Tunnel subscribed tunnel |
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 | Tunnel borrowTunnel(ApplicationId consumerId, TunnelId tunnelId, |
| 40 | Annotations... annotations); |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 41 | |
| 42 | /** |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 43 | * 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 wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 46 | * |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 47 | * @param consumerId a tunnel consumer |
| 48 | * @param tunnelName tunnel name |
| 49 | * @param annotations Annotations |
| 50 | * @return collection of subscribed Tunnels |
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 | Collection<Tunnel> borrowTunnel(ApplicationId consumerId, TunnelName tunnelName, |
| 53 | Annotations... annotations); |
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 | * 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 wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 61 | * |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 62 | * @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 wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 67 | */ |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 68 | Collection<Tunnel> borrowTunnel(ApplicationId consumerId, TunnelEndPoint src, |
| 69 | TunnelEndPoint dst, Annotations... annotations); |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 70 | |
| 71 | /** |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 72 | * 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 wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 77 | * |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 78 | * @param consumerId a tunnel consumer |
| 79 | * @param src a source point of tunnel. |
| 80 | * @param dst a destination point of tunnel |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 81 | * @param type tunnel type |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 82 | * @param annotations Annotations |
| 83 | * @return collection of available Tunnels |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 84 | */ |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 85 | Collection<Tunnel> borrowTunnel(ApplicationId consumerId, TunnelEndPoint src, |
Thomas Vachuska | bf916ea | 2015-05-20 18:24:34 -0700 | [diff] [blame^] | 86 | TunnelEndPoint dst, Tunnel.Type type, |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 87 | Annotations... annotations); |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 88 | |
| 89 | /** |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 90 | * Returns back a specific tunnel to store. |
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 | * @param consumerId a tunnel consumer |
| 93 | * @param tunnelId tunnel identify generated by ONOS |
| 94 | * @param annotations Annotations |
| 95 | * @return success or fail |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 96 | */ |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 97 | boolean returnTunnel(ApplicationId consumerId, TunnelId tunnelId, |
| 98 | Annotations... annotations); |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 99 | |
| 100 | /** |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 101 | * 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 wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 104 | * |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 105 | * @param consumerId a tunnel consumer |
| 106 | * @param tunnelName tunnel name |
| 107 | * @param annotations Annotations |
| 108 | * @return boolean |
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 | 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, |
Thomas Vachuska | bf916ea | 2015-05-20 18:24:34 -0700 | [diff] [blame^] | 125 | TunnelEndPoint dst, Tunnel.Type type, |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 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 | */ |
Thomas Vachuska | bf916ea | 2015-05-20 18:24:34 -0700 | [diff] [blame^] | 163 | Collection<Tunnel> queryTunnel(Tunnel.Type type); |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 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 wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 180 | |
| 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 wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 194 | } |