blob: bd32363e0e6455de8e06770e9161a3648d5a58ec [file] [log] [blame]
Andrea Campanella545edb42018-03-20 16:37:29 -07001/*
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 */
16package org.onosproject.mcast.api;
17
18import com.google.common.annotations.Beta;
19import org.onlab.packet.IpAddress;
20import org.onosproject.event.ListenerService;
21import org.onosproject.net.ConnectPoint;
22import org.onosproject.net.HostId;
23
Andrea Campanella545edb42018-03-20 16:37:29 -070024import java.util.Set;
25
26/**
Andrea Campanella7c8bcdf2018-03-26 23:29:11 -070027 * A service interface for maintaining Multicast information.
Andrea Campanella545edb42018-03-20 16:37:29 -070028 */
29@Beta
30public 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 Campanella7c8bcdf2018-03-26 23:29:11 -070036 * @param route a Multicast route
Andrea Campanella545edb42018-03-20 16:37:29 -070037 */
38 void add(McastRoute route);
39
40 /**
41 * Removes a route from the information base.
42 *
Andrea Campanella7c8bcdf2018-03-26 23:29:11 -070043 * @param route a Multicast route
Andrea Campanella545edb42018-03-20 16:37:29 -070044 */
45 void remove(McastRoute route);
46
47 /**
Andrea Campanella7c8bcdf2018-03-26 23:29:11 -070048 * Gets all Multicast routes in the system.
Andrea Campanella545edb42018-03-20 16:37:29 -070049 *
Andrea Campanella7c8bcdf2018-03-26 23:29:11 -070050 * @return set of Multicast routes
Andrea Campanella545edb42018-03-20 16:37:29 -070051 */
52 Set<McastRoute> getRoutes();
53
54 /**
Andrea Campanella7c8bcdf2018-03-26 23:29:11 -070055 * Gets a Multicast route in the system.
Andrea Campanella545edb42018-03-20 16:37:29 -070056 *
Andrea Campanella644a8a62018-03-21 19:08:21 -070057 * @param groupIp Multicast group IP address
Andrea Campanella7c8bcdf2018-03-26 23:29:11 -070058 * @param sourceIp Multicasto source Ip address
59 * @return set of Multicast routes
Andrea Campanella545edb42018-03-20 16:37:29 -070060 */
Andrea Campanella7c8bcdf2018-03-26 23:29:11 -070061 Set<McastRoute> getRoute(IpAddress groupIp, IpAddress sourceIp);
Andrea Campanella545edb42018-03-20 16:37:29 -070062
63 /**
Andrea Campanella0ddf9b82018-04-27 15:54:42 +020064 * Adds a host as a source to the route from where the
Andrea Campanella545edb42018-03-20 16:37:29 -070065 * data stream is originating.
66 *
Andrea Campanella0ddf9b82018-04-27 15:54:42 +020067 * @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 *
89 * @param route a Multicast route
90 * @param sources a set of source connect points
Andrea Campanella545edb42018-03-20 16:37:29 -070091 */
92 void addSources(McastRoute route, Set<ConnectPoint> sources);
93
94 /**
Andrea Campanella7c8bcdf2018-03-26 23:29:11 -070095 * Removes all the sources connect points from the route.
Andrea Campanella545edb42018-03-20 16:37:29 -070096 *
Andrea Campanella7c8bcdf2018-03-26 23:29:11 -070097 * @param route the Multicast route
Andrea Campanella545edb42018-03-20 16:37:29 -070098 */
99 void removeSources(McastRoute route);
100
101 /**
Andrea Campanella0ddf9b82018-04-27 15:54:42 +0200102 * Removes a source host from the route.
Andrea Campanella545edb42018-03-20 16:37:29 -0700103 *
Andrea Campanella0ddf9b82018-04-27 15:54:42 +0200104 * @param route the Multicast route
105 * @param source a host source
Andrea Campanella545edb42018-03-20 16:37:29 -0700106 */
Andrea Campanella0ddf9b82018-04-27 15:54:42 +0200107 void removeSource(McastRoute route, HostId source);
Andrea Campanella545edb42018-03-20 16:37:29 -0700108
109 /**
Andrea Campanella7c8bcdf2018-03-26 23:29:11 -0700110 * Adds a sink to the route to which a data stream should be
Andrea Campanella545edb42018-03-20 16:37:29 -0700111 * sent to.
112 *
Andrea Campanella7c8bcdf2018-03-26 23:29:11 -0700113 * @param route a Multicast route
Andrea Campanella545edb42018-03-20 16:37:29 -0700114 * @param hostId a sink host
115 */
116 void addSink(McastRoute route, HostId hostId);
117
118 /**
Andrea Campanella644a8a62018-03-21 19:08:21 -0700119 * Adds a set of sink connect points for a given host sink to the route to
120 * which a data stream should be sent to.
121 *
122 * @param route a Multicast route
123 * @param hostId a sink host
124 * @param connectPoints the sink for the specific host
125 */
126 void addSinks(McastRoute route, HostId hostId, Set<ConnectPoint> connectPoints);
127
128 /**
Andrea Campanella545edb42018-03-20 16:37:29 -0700129 * Adds a set of sink to the route to which a data stream should be
Andrea Campanella7c8bcdf2018-03-26 23:29:11 -0700130 * sent to. If this method is used the connect points will all be
131 * used as different sinks for that Mcast Tree. For dual-homed sinks
132 * please use {@link #addSink(McastRoute route, HostId hostId) addSink}.
Andrea Campanella545edb42018-03-20 16:37:29 -0700133 *
Andrea Campanella7c8bcdf2018-03-26 23:29:11 -0700134 * @param route a Multicast route
Andrea Campanella545edb42018-03-20 16:37:29 -0700135 * @param sinks a set of sink connect point
136 */
Andrea Campanella0ddf9b82018-04-27 15:54:42 +0200137 void addSinks(McastRoute route, Set<ConnectPoint> sinks);
Andrea Campanella545edb42018-03-20 16:37:29 -0700138
139 /**
140 * Removes all the sinks from the route.
141 *
Andrea Campanella7c8bcdf2018-03-26 23:29:11 -0700142 * @param route the Multicast route
Andrea Campanella545edb42018-03-20 16:37:29 -0700143 */
144 void removeSinks(McastRoute route);
145
146 /**
Andrea Campanella7c8bcdf2018-03-26 23:29:11 -0700147 * Removes a sink from the route.
Andrea Campanella545edb42018-03-20 16:37:29 -0700148 *
Andrea Campanella7c8bcdf2018-03-26 23:29:11 -0700149 * @param route the Multicast route
Andrea Campanella545edb42018-03-20 16:37:29 -0700150 * @param hostId a sink host
151 */
152 void removeSink(McastRoute route, HostId hostId);
153
154 /**
Andrea Campanella545edb42018-03-20 16:37:29 -0700155 * Removes a set of sinks to the route to which a data stream should be
156 * sent to. If this method is used the mcast tree does not work
157 * for any other sink until it's added. For dual-homed sinks please use
158 * {@link #removeSink(McastRoute route, HostId hostId) removeSink}.
159 *
Andrea Campanella7c8bcdf2018-03-26 23:29:11 -0700160 * @param route a Multicast route
Andrea Campanella545edb42018-03-20 16:37:29 -0700161 * @param sink a sink connect point
162 */
163 void removeSinks(McastRoute route, Set<ConnectPoint> sink);
164
165 /**
Andrea Campanella7c8bcdf2018-03-26 23:29:11 -0700166 * Return the Multicast data for this route.
Andrea Campanella545edb42018-03-20 16:37:29 -0700167 *
168 * @param route route
169 * @return the mcast route data
170 */
171 McastRouteData routeData(McastRoute route);
172
173 /**
Andrea Campanella7c8bcdf2018-03-26 23:29:11 -0700174 * Find the data source association for this Multicast route.
Andrea Campanella545edb42018-03-20 16:37:29 -0700175 *
Andrea Campanella7c8bcdf2018-03-26 23:29:11 -0700176 * @param route a Multicast route
Andrea Campanella545edb42018-03-20 16:37:29 -0700177 * @return a connect point
178 */
179 Set<ConnectPoint> sources(McastRoute route);
180
181 /**
Andrea Campanella0ddf9b82018-04-27 15:54:42 +0200182 * Find the set of connect points for a given source for this route.
183 *
184 * @param route a Multicast route
185 * @param hostId the host
186 * @return a list of connect points
187 */
188 Set<ConnectPoint> sources(McastRoute route, HostId hostId);
189
190 /**
Andrea Campanella545edb42018-03-20 16:37:29 -0700191 * Find the list of sinks for this route.
192 *
Andrea Campanella7c8bcdf2018-03-26 23:29:11 -0700193 * @param route a Multicast route
Andrea Campanella545edb42018-03-20 16:37:29 -0700194 * @return a list of connect points
195 */
196 Set<ConnectPoint> sinks(McastRoute route);
197
198 /**
Andrea Campanella7c8bcdf2018-03-26 23:29:11 -0700199 * Find the set of connect points for a given sink for this route.
Andrea Campanella545edb42018-03-20 16:37:29 -0700200 *
Andrea Campanella7c8bcdf2018-03-26 23:29:11 -0700201 * @param route a Multicast route
Andrea Campanella545edb42018-03-20 16:37:29 -0700202 * @param hostId the host
203 * @return a list of connect points
204 */
205 Set<ConnectPoint> sinks(McastRoute route, HostId hostId);
206
207 /**
Andrea Campanella7c8bcdf2018-03-26 23:29:11 -0700208 * Obtains all the non host specific sinks for a Multicast route.
Andrea Campanella545edb42018-03-20 16:37:29 -0700209 *
Andrea Campanella7c8bcdf2018-03-26 23:29:11 -0700210 * @param route a Multicast route
Andrea Campanella545edb42018-03-20 16:37:29 -0700211 * @return a set of sinks
212 */
213 Set<ConnectPoint> nonHostSinks(McastRoute route);
214}