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 | |
| 24 | import java.util.Optional; |
| 25 | import java.util.Set; |
| 26 | |
| 27 | /** |
| 28 | * A service interface for maintaining multicast information. |
| 29 | */ |
| 30 | @Beta |
| 31 | public interface MulticastRouteService |
| 32 | extends ListenerService<McastEvent, McastListener> { |
| 33 | |
| 34 | /** |
| 35 | * Adds an empty route to the information base for the given group IP. |
| 36 | * |
| 37 | * @param route a multicast route |
| 38 | */ |
| 39 | void add(McastRoute route); |
| 40 | |
| 41 | /** |
| 42 | * Removes a route from the information base. |
| 43 | * |
| 44 | * @param route a multicast route |
| 45 | */ |
| 46 | void remove(McastRoute route); |
| 47 | |
| 48 | /** |
| 49 | * Gets all multicast routes in the system. |
| 50 | * |
| 51 | * @return set of multicast routes |
| 52 | */ |
| 53 | Set<McastRoute> getRoutes(); |
| 54 | |
| 55 | /** |
| 56 | * Gets a multicast route in the system. |
| 57 | * |
| 58 | * @param groupIp multicast group IP address |
| 59 | * @param sourceIp multicasto source Ip address |
| 60 | * @return set of multicast routes |
| 61 | */ |
| 62 | Optional<McastRoute> getRoute(IpAddress groupIp, IpAddress sourceIp); |
| 63 | |
| 64 | /** |
| 65 | * Adds a set of source to the route from where the |
| 66 | * data stream is originating. |
| 67 | * |
| 68 | * @param route the multicast route |
| 69 | * @param sources a set of sources |
| 70 | */ |
| 71 | void addSources(McastRoute route, Set<ConnectPoint> sources); |
| 72 | |
| 73 | /** |
| 74 | * Removes all the sources from the route. |
| 75 | * |
| 76 | * @param route the multicast route |
| 77 | */ |
| 78 | void removeSources(McastRoute route); |
| 79 | |
| 80 | /** |
| 81 | * Removes a set of sources from the route. |
| 82 | * |
| 83 | * @param route the multicast route |
| 84 | * @param sources a set of sources |
| 85 | */ |
| 86 | void removeSources(McastRoute route, Set<ConnectPoint> sources); |
| 87 | |
| 88 | /** |
| 89 | * Adds a set of sink to the route to which a data stream should be |
| 90 | * sent to. |
| 91 | * |
| 92 | * @param route a multicast route |
| 93 | * @param hostId a sink host |
| 94 | */ |
| 95 | void addSink(McastRoute route, HostId hostId); |
| 96 | |
| 97 | /** |
| 98 | * Adds a set of sink to the route to which a data stream should be |
| 99 | * sent to. If this method is used this the connect points will all |
| 100 | * be used a sink for that Mcast Tree. For dual-homed sinks please use |
| 101 | * {@link #addSink(McastRoute route, HostId hostId) addSink}. |
| 102 | * |
| 103 | * @param route a multicast route |
| 104 | * @param sinks a set of sink connect point |
| 105 | */ |
| 106 | void addSink(McastRoute route, Set<ConnectPoint> sinks); |
| 107 | |
| 108 | /** |
| 109 | * Removes all the sinks from the route. |
| 110 | * |
| 111 | * @param route the multicast route |
| 112 | */ |
| 113 | void removeSinks(McastRoute route); |
| 114 | |
| 115 | /** |
| 116 | * Removes a sink host from the route. |
| 117 | * |
| 118 | * @param route the multicast route |
| 119 | * @param hostId a sink host |
| 120 | */ |
| 121 | void removeSink(McastRoute route, HostId hostId); |
| 122 | |
| 123 | /** |
| 124 | * Removes a set of sink connect points for a given host the route. |
| 125 | * |
| 126 | * @param route the multicast route |
| 127 | * @param hostId a sink host |
| 128 | * @param connectPoints a given set of connect points to remove |
| 129 | */ |
| 130 | void removeSinks(McastRoute route, HostId hostId, Set<ConnectPoint> connectPoints); |
| 131 | |
| 132 | /** |
| 133 | * Removes a set of sinks to the route to which a data stream should be |
| 134 | * sent to. If this method is used the mcast tree does not work |
| 135 | * for any other sink until it's added. For dual-homed sinks please use |
| 136 | * {@link #removeSink(McastRoute route, HostId hostId) removeSink}. |
| 137 | * |
| 138 | * @param route a multicast route |
| 139 | * @param sink a sink connect point |
| 140 | */ |
| 141 | void removeSinks(McastRoute route, Set<ConnectPoint> sink); |
| 142 | |
| 143 | /** |
| 144 | * Return the Data for this route. |
| 145 | * |
| 146 | * @param route route |
| 147 | * @return the mcast route data |
| 148 | */ |
| 149 | McastRouteData routeData(McastRoute route); |
| 150 | |
| 151 | /** |
| 152 | * Find the data source association for this multicast route. |
| 153 | * |
| 154 | * @param route a multicast route |
| 155 | * @return a connect point |
| 156 | */ |
| 157 | Set<ConnectPoint> sources(McastRoute route); |
| 158 | |
| 159 | /** |
| 160 | * Find the list of sinks for this route. |
| 161 | * |
| 162 | * @param route a multicast route |
| 163 | * @return a list of connect points |
| 164 | */ |
| 165 | Set<ConnectPoint> sinks(McastRoute route); |
| 166 | |
| 167 | /** |
| 168 | * Find the list of sinks for a given host for this route. |
| 169 | * |
| 170 | * @param route a multicast route |
| 171 | * @param hostId the host |
| 172 | * @return a list of connect points |
| 173 | */ |
| 174 | Set<ConnectPoint> sinks(McastRoute route, HostId hostId); |
| 175 | |
| 176 | /** |
| 177 | * Obtains all the non host specific sinks for a multicast route. |
| 178 | * |
| 179 | * @param route a multicast route |
| 180 | * @return a set of sinks |
| 181 | */ |
| 182 | Set<ConnectPoint> nonHostSinks(McastRoute route); |
| 183 | } |