Andrea Campanella | 545edb4 | 2018-03-20 16:37:29 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2018-present Open Networking Foundation |
| 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.mcast.api; |
| 17 | |
| 18 | import com.google.common.annotations.Beta; |
| 19 | import org.onlab.packet.IpAddress; |
| 20 | import org.onosproject.event.ListenerService; |
| 21 | import org.onosproject.net.ConnectPoint; |
| 22 | import org.onosproject.net.HostId; |
| 23 | |
Andrea Campanella | 545edb4 | 2018-03-20 16:37:29 -0700 | [diff] [blame] | 24 | import java.util.Set; |
| 25 | |
| 26 | /** |
Andrea Campanella | 7c8bcdf | 2018-03-26 23:29:11 -0700 | [diff] [blame] | 27 | * A service interface for maintaining Multicast information. |
Andrea Campanella | 545edb4 | 2018-03-20 16:37:29 -0700 | [diff] [blame] | 28 | */ |
| 29 | @Beta |
| 30 | public interface MulticastRouteService |
| 31 | extends ListenerService<McastEvent, McastListener> { |
| 32 | |
| 33 | /** |
| 34 | * Adds an empty route to the information base for the given group IP. |
| 35 | * |
Andrea Campanella | 7c8bcdf | 2018-03-26 23:29:11 -0700 | [diff] [blame] | 36 | * @param route a Multicast route |
Andrea Campanella | 545edb4 | 2018-03-20 16:37:29 -0700 | [diff] [blame] | 37 | */ |
| 38 | void add(McastRoute route); |
| 39 | |
| 40 | /** |
| 41 | * Removes a route from the information base. |
| 42 | * |
Andrea Campanella | 7c8bcdf | 2018-03-26 23:29:11 -0700 | [diff] [blame] | 43 | * @param route a Multicast route |
Andrea Campanella | 545edb4 | 2018-03-20 16:37:29 -0700 | [diff] [blame] | 44 | */ |
| 45 | void remove(McastRoute route); |
| 46 | |
| 47 | /** |
Andrea Campanella | 7c8bcdf | 2018-03-26 23:29:11 -0700 | [diff] [blame] | 48 | * Gets all Multicast routes in the system. |
Andrea Campanella | 545edb4 | 2018-03-20 16:37:29 -0700 | [diff] [blame] | 49 | * |
Andrea Campanella | 7c8bcdf | 2018-03-26 23:29:11 -0700 | [diff] [blame] | 50 | * @return set of Multicast routes |
Andrea Campanella | 545edb4 | 2018-03-20 16:37:29 -0700 | [diff] [blame] | 51 | */ |
| 52 | Set<McastRoute> getRoutes(); |
| 53 | |
| 54 | /** |
Andrea Campanella | 7c8bcdf | 2018-03-26 23:29:11 -0700 | [diff] [blame] | 55 | * Gets a Multicast route in the system. |
Andrea Campanella | 545edb4 | 2018-03-20 16:37:29 -0700 | [diff] [blame] | 56 | * |
Andrea Campanella | 644a8a6 | 2018-03-21 19:08:21 -0700 | [diff] [blame] | 57 | * @param groupIp Multicast group IP address |
Andrea Campanella | 7c8bcdf | 2018-03-26 23:29:11 -0700 | [diff] [blame] | 58 | * @param sourceIp Multicasto source Ip address |
| 59 | * @return set of Multicast routes |
Andrea Campanella | 545edb4 | 2018-03-20 16:37:29 -0700 | [diff] [blame] | 60 | */ |
Andrea Campanella | 7c8bcdf | 2018-03-26 23:29:11 -0700 | [diff] [blame] | 61 | Set<McastRoute> getRoute(IpAddress groupIp, IpAddress sourceIp); |
Andrea Campanella | 545edb4 | 2018-03-20 16:37:29 -0700 | [diff] [blame] | 62 | |
| 63 | /** |
Andrea Campanella | 0ddf9b8 | 2018-04-27 15:54:42 +0200 | [diff] [blame] | 64 | * Adds a host as a source to the route from where the |
Andrea Campanella | 545edb4 | 2018-03-20 16:37:29 -0700 | [diff] [blame] | 65 | * data stream is originating. |
| 66 | * |
Andrea Campanella | 0ddf9b8 | 2018-04-27 15:54:42 +0200 | [diff] [blame] | 67 | * @param route the Multicast route |
| 68 | * @param source a source host |
| 69 | */ |
| 70 | void addSource(McastRoute route, HostId source); |
| 71 | |
| 72 | |
| 73 | /** |
| 74 | * Adds a set of source connect points for a given host source to the route to |
| 75 | * which a data stream should be sent to. |
| 76 | * |
| 77 | * @param route a Multicast route |
| 78 | * @param hostId a source host |
| 79 | * @param connectPoints the source for the specific host |
| 80 | */ |
| 81 | void addSources(McastRoute route, HostId hostId, Set<ConnectPoint> connectPoints); |
| 82 | |
| 83 | /** |
| 84 | * Adds a set of sources to the route from which a data stream should be |
| 85 | * sent to. If this method is used the connect points will all be |
| 86 | * used as different sources for that Mcast Tree. For dual-homed sources |
| 87 | * please use {@link #addSource(McastRoute route, HostId hostId) addSource}. |
| 88 | * |
Ilayda Ozdemir | 69a93c4 | 2020-06-10 08:31:27 +0000 | [diff] [blame] | 89 | * @param route a Multicast route |
Andrea Campanella | 0ddf9b8 | 2018-04-27 15:54:42 +0200 | [diff] [blame] | 90 | * @param sources a set of source connect points |
Andrea Campanella | 545edb4 | 2018-03-20 16:37:29 -0700 | [diff] [blame] | 91 | */ |
| 92 | void addSources(McastRoute route, Set<ConnectPoint> sources); |
| 93 | |
| 94 | /** |
Andrea Campanella | 7c8bcdf | 2018-03-26 23:29:11 -0700 | [diff] [blame] | 95 | * Removes all the sources connect points from the route. |
Andrea Campanella | 545edb4 | 2018-03-20 16:37:29 -0700 | [diff] [blame] | 96 | * |
Andrea Campanella | 7c8bcdf | 2018-03-26 23:29:11 -0700 | [diff] [blame] | 97 | * @param route the Multicast route |
Andrea Campanella | 545edb4 | 2018-03-20 16:37:29 -0700 | [diff] [blame] | 98 | */ |
| 99 | void removeSources(McastRoute route); |
| 100 | |
| 101 | /** |
Andrea Campanella | 0ddf9b8 | 2018-04-27 15:54:42 +0200 | [diff] [blame] | 102 | * Removes a source host from the route. |
Andrea Campanella | 545edb4 | 2018-03-20 16:37:29 -0700 | [diff] [blame] | 103 | * |
Andrea Campanella | 0ddf9b8 | 2018-04-27 15:54:42 +0200 | [diff] [blame] | 104 | * @param route the Multicast route |
| 105 | * @param source a host source |
Andrea Campanella | 545edb4 | 2018-03-20 16:37:29 -0700 | [diff] [blame] | 106 | */ |
Andrea Campanella | 0ddf9b8 | 2018-04-27 15:54:42 +0200 | [diff] [blame] | 107 | void removeSource(McastRoute route, HostId source); |
Andrea Campanella | 545edb4 | 2018-03-20 16:37:29 -0700 | [diff] [blame] | 108 | |
| 109 | /** |
Ilayda Ozdemir | 69a93c4 | 2020-06-10 08:31:27 +0000 | [diff] [blame] | 110 | * Removes a set of sources from the route. |
| 111 | * If this method is used the connect points will all be |
| 112 | * used as different sources for that Mcast Tree. For dual-homed sources |
| 113 | * please use {@link #removeSource(McastRoute, HostId)}. |
| 114 | * |
| 115 | * @param route the multicast route |
| 116 | * @param sources set of sources |
| 117 | */ |
| 118 | void removeSources(McastRoute route, Set<ConnectPoint> sources); |
| 119 | |
| 120 | /** |
| 121 | * Removes a set of source connect points for a given host source from the route. |
| 122 | * |
| 123 | * @param route a multicast route |
| 124 | * @param hostId a source host |
| 125 | * @param connectPoints the source for the specific connect points |
| 126 | */ |
| 127 | void removeSources(McastRoute route, HostId hostId, Set<ConnectPoint> connectPoints); |
| 128 | |
| 129 | /** |
Andrea Campanella | 7c8bcdf | 2018-03-26 23:29:11 -0700 | [diff] [blame] | 130 | * Adds a sink to the route to which a data stream should be |
Andrea Campanella | 545edb4 | 2018-03-20 16:37:29 -0700 | [diff] [blame] | 131 | * sent to. |
| 132 | * |
Andrea Campanella | 7c8bcdf | 2018-03-26 23:29:11 -0700 | [diff] [blame] | 133 | * @param route a Multicast route |
Andrea Campanella | 545edb4 | 2018-03-20 16:37:29 -0700 | [diff] [blame] | 134 | * @param hostId a sink host |
| 135 | */ |
| 136 | void addSink(McastRoute route, HostId hostId); |
| 137 | |
| 138 | /** |
Andrea Campanella | 644a8a6 | 2018-03-21 19:08:21 -0700 | [diff] [blame] | 139 | * Adds a set of sink connect points for a given host sink to the route to |
| 140 | * which a data stream should be sent to. |
| 141 | * |
| 142 | * @param route a Multicast route |
| 143 | * @param hostId a sink host |
| 144 | * @param connectPoints the sink for the specific host |
| 145 | */ |
| 146 | void addSinks(McastRoute route, HostId hostId, Set<ConnectPoint> connectPoints); |
| 147 | |
| 148 | /** |
Andrea Campanella | 545edb4 | 2018-03-20 16:37:29 -0700 | [diff] [blame] | 149 | * Adds a set of sink to the route to which a data stream should be |
Andrea Campanella | 7c8bcdf | 2018-03-26 23:29:11 -0700 | [diff] [blame] | 150 | * sent to. If this method is used the connect points will all be |
| 151 | * used as different sinks for that Mcast Tree. For dual-homed sinks |
| 152 | * please use {@link #addSink(McastRoute route, HostId hostId) addSink}. |
Andrea Campanella | 545edb4 | 2018-03-20 16:37:29 -0700 | [diff] [blame] | 153 | * |
Andrea Campanella | 7c8bcdf | 2018-03-26 23:29:11 -0700 | [diff] [blame] | 154 | * @param route a Multicast route |
Andrea Campanella | 545edb4 | 2018-03-20 16:37:29 -0700 | [diff] [blame] | 155 | * @param sinks a set of sink connect point |
| 156 | */ |
Andrea Campanella | 0ddf9b8 | 2018-04-27 15:54:42 +0200 | [diff] [blame] | 157 | void addSinks(McastRoute route, Set<ConnectPoint> sinks); |
Andrea Campanella | 545edb4 | 2018-03-20 16:37:29 -0700 | [diff] [blame] | 158 | |
| 159 | /** |
| 160 | * Removes all the sinks from the route. |
| 161 | * |
Andrea Campanella | 7c8bcdf | 2018-03-26 23:29:11 -0700 | [diff] [blame] | 162 | * @param route the Multicast route |
Andrea Campanella | 545edb4 | 2018-03-20 16:37:29 -0700 | [diff] [blame] | 163 | */ |
| 164 | void removeSinks(McastRoute route); |
| 165 | |
| 166 | /** |
Andrea Campanella | 7c8bcdf | 2018-03-26 23:29:11 -0700 | [diff] [blame] | 167 | * Removes a sink from the route. |
Andrea Campanella | 545edb4 | 2018-03-20 16:37:29 -0700 | [diff] [blame] | 168 | * |
Andrea Campanella | 7c8bcdf | 2018-03-26 23:29:11 -0700 | [diff] [blame] | 169 | * @param route the Multicast route |
Andrea Campanella | 545edb4 | 2018-03-20 16:37:29 -0700 | [diff] [blame] | 170 | * @param hostId a sink host |
| 171 | */ |
| 172 | void removeSink(McastRoute route, HostId hostId); |
| 173 | |
| 174 | /** |
Andrea Campanella | 545edb4 | 2018-03-20 16:37:29 -0700 | [diff] [blame] | 175 | * Removes a set of sinks to the route to which a data stream should be |
| 176 | * sent to. If this method is used the mcast tree does not work |
| 177 | * for any other sink until it's added. For dual-homed sinks please use |
| 178 | * {@link #removeSink(McastRoute route, HostId hostId) removeSink}. |
| 179 | * |
Andrea Campanella | 7c8bcdf | 2018-03-26 23:29:11 -0700 | [diff] [blame] | 180 | * @param route a Multicast route |
Andrea Campanella | 545edb4 | 2018-03-20 16:37:29 -0700 | [diff] [blame] | 181 | * @param sink a sink connect point |
| 182 | */ |
| 183 | void removeSinks(McastRoute route, Set<ConnectPoint> sink); |
| 184 | |
| 185 | /** |
Andrea Campanella | 7c8bcdf | 2018-03-26 23:29:11 -0700 | [diff] [blame] | 186 | * Return the Multicast data for this route. |
Andrea Campanella | 545edb4 | 2018-03-20 16:37:29 -0700 | [diff] [blame] | 187 | * |
| 188 | * @param route route |
| 189 | * @return the mcast route data |
| 190 | */ |
| 191 | McastRouteData routeData(McastRoute route); |
| 192 | |
| 193 | /** |
Andrea Campanella | 7c8bcdf | 2018-03-26 23:29:11 -0700 | [diff] [blame] | 194 | * Find the data source association for this Multicast route. |
Andrea Campanella | 545edb4 | 2018-03-20 16:37:29 -0700 | [diff] [blame] | 195 | * |
Andrea Campanella | 7c8bcdf | 2018-03-26 23:29:11 -0700 | [diff] [blame] | 196 | * @param route a Multicast route |
Andrea Campanella | 545edb4 | 2018-03-20 16:37:29 -0700 | [diff] [blame] | 197 | * @return a connect point |
| 198 | */ |
| 199 | Set<ConnectPoint> sources(McastRoute route); |
| 200 | |
| 201 | /** |
Andrea Campanella | 0ddf9b8 | 2018-04-27 15:54:42 +0200 | [diff] [blame] | 202 | * Find the set of connect points for a given source for this route. |
| 203 | * |
| 204 | * @param route a Multicast route |
| 205 | * @param hostId the host |
| 206 | * @return a list of connect points |
| 207 | */ |
| 208 | Set<ConnectPoint> sources(McastRoute route, HostId hostId); |
| 209 | |
| 210 | /** |
Andrea Campanella | 545edb4 | 2018-03-20 16:37:29 -0700 | [diff] [blame] | 211 | * Find the list of sinks for this route. |
| 212 | * |
Andrea Campanella | 7c8bcdf | 2018-03-26 23:29:11 -0700 | [diff] [blame] | 213 | * @param route a Multicast route |
Andrea Campanella | 545edb4 | 2018-03-20 16:37:29 -0700 | [diff] [blame] | 214 | * @return a list of connect points |
| 215 | */ |
| 216 | Set<ConnectPoint> sinks(McastRoute route); |
| 217 | |
| 218 | /** |
Andrea Campanella | 7c8bcdf | 2018-03-26 23:29:11 -0700 | [diff] [blame] | 219 | * Find the set of connect points for a given sink for this route. |
Andrea Campanella | 545edb4 | 2018-03-20 16:37:29 -0700 | [diff] [blame] | 220 | * |
Andrea Campanella | 7c8bcdf | 2018-03-26 23:29:11 -0700 | [diff] [blame] | 221 | * @param route a Multicast route |
Andrea Campanella | 545edb4 | 2018-03-20 16:37:29 -0700 | [diff] [blame] | 222 | * @param hostId the host |
| 223 | * @return a list of connect points |
| 224 | */ |
| 225 | Set<ConnectPoint> sinks(McastRoute route, HostId hostId); |
| 226 | |
| 227 | /** |
Andrea Campanella | 7c8bcdf | 2018-03-26 23:29:11 -0700 | [diff] [blame] | 228 | * Obtains all the non host specific sinks for a Multicast route. |
Andrea Campanella | 545edb4 | 2018-03-20 16:37:29 -0700 | [diff] [blame] | 229 | * |
Andrea Campanella | 7c8bcdf | 2018-03-26 23:29:11 -0700 | [diff] [blame] | 230 | * @param route a Multicast route |
Andrea Campanella | 545edb4 | 2018-03-20 16:37:29 -0700 | [diff] [blame] | 231 | * @return a set of sinks |
| 232 | */ |
| 233 | Set<ConnectPoint> nonHostSinks(McastRoute route); |
| 234 | } |