blob: ed63eff227e6bc752b0380b3aaced3a4bf6c0397 [file] [log] [blame]
Pierb0328e42018-03-27 11:29:42 -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 */
16
17package org.onosproject.segmentrouting.mcast;
18
Pier96f63cb2018-04-17 16:29:56 +020019import com.google.common.collect.ImmutableMap;
Pierb0328e42018-03-27 11:29:42 -070020import com.google.common.collect.ImmutableSet;
Charles Chand5814aa2018-08-19 19:21:46 -070021import com.google.common.collect.Lists;
Pier96f63cb2018-04-17 16:29:56 +020022import com.google.common.collect.Maps;
Charles Chand5814aa2018-08-19 19:21:46 -070023import com.google.common.collect.Sets;
Pier96f63cb2018-04-17 16:29:56 +020024import com.google.common.hash.HashFunction;
25import com.google.common.hash.Hashing;
Pierb0328e42018-03-27 11:29:42 -070026import org.onlab.packet.Ethernet;
27import org.onlab.packet.IpAddress;
28import org.onlab.packet.MacAddress;
29import org.onlab.packet.VlanId;
30import org.onosproject.cluster.NodeId;
31import org.onosproject.core.ApplicationId;
32import org.onosproject.mcast.api.McastRoute;
33import org.onosproject.net.ConnectPoint;
34import org.onosproject.net.DeviceId;
35import org.onosproject.net.HostId;
Charles Chand5814aa2018-08-19 19:21:46 -070036import org.onosproject.net.Link;
Pierb0328e42018-03-27 11:29:42 -070037import org.onosproject.net.PortNumber;
38import org.onosproject.net.config.basics.McastConfig;
39import org.onosproject.net.flow.DefaultTrafficSelector;
40import org.onosproject.net.flow.DefaultTrafficTreatment;
41import org.onosproject.net.flow.TrafficSelector;
42import org.onosproject.net.flow.TrafficTreatment;
43import org.onosproject.net.flow.criteria.Criteria;
Pierb0328e42018-03-27 11:29:42 -070044import org.onosproject.net.flow.instructions.Instructions;
45import org.onosproject.net.flowobjective.DefaultFilteringObjective;
46import org.onosproject.net.flowobjective.DefaultForwardingObjective;
47import org.onosproject.net.flowobjective.DefaultNextObjective;
48import org.onosproject.net.flowobjective.DefaultObjectiveContext;
49import org.onosproject.net.flowobjective.FilteringObjective;
50import org.onosproject.net.flowobjective.ForwardingObjective;
51import org.onosproject.net.flowobjective.NextObjective;
52import org.onosproject.net.flowobjective.ObjectiveContext;
53import org.onosproject.segmentrouting.SegmentRoutingManager;
54import org.onosproject.segmentrouting.SegmentRoutingService;
55import org.onosproject.segmentrouting.config.DeviceConfigNotFoundException;
56import org.onosproject.segmentrouting.config.SegmentRoutingAppConfig;
57import org.slf4j.Logger;
58
59import java.util.Collection;
Charles Chand5814aa2018-08-19 19:21:46 -070060import java.util.List;
Pierb0328e42018-03-27 11:29:42 -070061import java.util.Map;
62import java.util.Set;
63import java.util.stream.Collectors;
64
Pierb0328e42018-03-27 11:29:42 -070065/**
66 * Utility class for Multicast Handler.
67 */
68class McastUtils {
69
70 // Internal reference to the log
71 private final Logger log;
72 // Internal reference to SR Manager
73 private SegmentRoutingManager srManager;
74 // Internal reference to the app id
75 private ApplicationId coreAppId;
Pier96f63cb2018-04-17 16:29:56 +020076 // Hashing function for the multicast hasher
77 private static final HashFunction HASH_FN = Hashing.md5();
78 // Read only cache of the Mcast leader
79 private Map<IpAddress, NodeId> mcastLeaderCache;
Pierb0328e42018-03-27 11:29:42 -070080
81 /**
82 * Builds a new McastUtils object.
83 *
84 * @param srManager the SR manager
85 * @param coreAppId the core application id
86 * @param log log reference of the McastHandler
87 */
88 McastUtils(SegmentRoutingManager srManager, ApplicationId coreAppId, Logger log) {
89 this.srManager = srManager;
90 this.coreAppId = coreAppId;
91 this.log = log;
Pier96f63cb2018-04-17 16:29:56 +020092 this.mcastLeaderCache = Maps.newConcurrentMap();
Pierb0328e42018-03-27 11:29:42 -070093 }
94
95 /**
Pier477e0062018-04-20 14:14:34 +020096 * Clean up when deactivating the application.
97 */
98 public void terminate() {
99 mcastLeaderCache.clear();
100 }
101
102 /**
Pierb0328e42018-03-27 11:29:42 -0700103 * Get router mac using application config and the connect point.
104 *
105 * @param deviceId the device id
106 * @param port the port number
107 * @return the router mac if the port is configured, otherwise null
108 */
109 private MacAddress getRouterMac(DeviceId deviceId, PortNumber port) {
110 // Do nothing if the port is configured as suppressed
111 ConnectPoint connectPoint = new ConnectPoint(deviceId, port);
112 SegmentRoutingAppConfig appConfig = srManager.cfgService
113 .getConfig(srManager.appId(), SegmentRoutingAppConfig.class);
114 if (appConfig != null && appConfig.suppressSubnet().contains(connectPoint)) {
115 log.info("Ignore suppressed port {}", connectPoint);
116 return MacAddress.NONE;
117 }
118 // Get the router mac using the device configuration
119 MacAddress routerMac;
120 try {
121 routerMac = srManager.deviceConfiguration().getDeviceMac(deviceId);
122 } catch (DeviceConfigNotFoundException dcnfe) {
Esin Karamandd26b212019-07-24 11:26:39 +0000123 log.warn("Failed to get device MAC since the device {} is not configured", deviceId);
124 return null;
Pierb0328e42018-03-27 11:29:42 -0700125 }
126 return routerMac;
127 }
128
129 /**
130 * Adds filtering objective for given device and port.
131 *
132 * @param deviceId device ID
133 * @param port ingress port number
134 * @param assignedVlan assigned VLAN ID
135 * @param mcastIp the group address
136 * @param mcastRole the role of the device
137 */
138 void addFilterToDevice(DeviceId deviceId, PortNumber port, VlanId assignedVlan,
139 IpAddress mcastIp, McastRole mcastRole) {
140
Vignesh Ethirajaeecd042019-08-26 12:18:42 +0000141 if (!srManager.deviceConfiguration().isConfigured(deviceId)) {
142 log.debug("skip update of fitering objective for unconfigured device: {}", deviceId);
143 return;
144 }
Pierb0328e42018-03-27 11:29:42 -0700145 MacAddress routerMac = getRouterMac(deviceId, port);
Esin Karamandd26b212019-07-24 11:26:39 +0000146
147 if (MacAddress.NONE.equals(routerMac)) {
Pierb0328e42018-03-27 11:29:42 -0700148 return;
149 }
150
151 FilteringObjective.Builder filtObjBuilder = filterObjBuilder(port, assignedVlan, mcastIp,
152 routerMac, mcastRole);
153 ObjectiveContext context = new DefaultObjectiveContext(
154 (objective) -> log.debug("Successfully add filter on {}/{}, vlan {}",
155 deviceId, port.toLong(), assignedVlan),
156 (objective, error) ->
157 log.warn("Failed to add filter on {}/{}, vlan {}: {}",
158 deviceId, port.toLong(), assignedVlan, error));
159 srManager.flowObjectiveService.filter(deviceId, filtObjBuilder.add(context));
160 }
161
162 /**
163 * Removes filtering objective for given device and port.
164 *
165 * @param deviceId device ID
166 * @param port ingress port number
167 * @param assignedVlan assigned VLAN ID
168 * @param mcastIp multicast IP address
169 * @param mcastRole the multicast role of the device
170 */
171 void removeFilterToDevice(DeviceId deviceId, PortNumber port, VlanId assignedVlan,
172 IpAddress mcastIp, McastRole mcastRole) {
173
Vignesh Ethirajaeecd042019-08-26 12:18:42 +0000174 if (!srManager.deviceConfiguration().isConfigured(deviceId)) {
175 log.debug("skip update of fitering objective for unconfigured device: {}", deviceId);
176 return;
177 }
Pierb0328e42018-03-27 11:29:42 -0700178 MacAddress routerMac = getRouterMac(deviceId, port);
Esin Karamandd26b212019-07-24 11:26:39 +0000179
180 if (MacAddress.NONE.equals(routerMac)) {
Pierb0328e42018-03-27 11:29:42 -0700181 return;
182 }
183
184 FilteringObjective.Builder filtObjBuilder =
185 filterObjBuilder(port, assignedVlan, mcastIp, routerMac, mcastRole);
186 ObjectiveContext context = new DefaultObjectiveContext(
187 (objective) -> log.debug("Successfully removed filter on {}/{}, vlan {}",
188 deviceId, port.toLong(), assignedVlan),
189 (objective, error) ->
190 log.warn("Failed to remove filter on {}/{}, vlan {}: {}",
191 deviceId, port.toLong(), assignedVlan, error));
192 srManager.flowObjectiveService.filter(deviceId, filtObjBuilder.remove(context));
193 }
194
195 /**
Pierb0328e42018-03-27 11:29:42 -0700196 * Gets ingress VLAN from McastConfig.
197 *
198 * @return ingress VLAN or VlanId.NONE if not configured
199 */
200 private VlanId ingressVlan() {
201 McastConfig mcastConfig =
202 srManager.cfgService.getConfig(coreAppId, McastConfig.class);
203 return (mcastConfig != null) ? mcastConfig.ingressVlan() : VlanId.NONE;
204 }
205
206 /**
207 * Gets egress VLAN from McastConfig.
208 *
209 * @return egress VLAN or VlanId.NONE if not configured
210 */
211 private VlanId egressVlan() {
212 McastConfig mcastConfig =
213 srManager.cfgService.getConfig(coreAppId, McastConfig.class);
214 return (mcastConfig != null) ? mcastConfig.egressVlan() : VlanId.NONE;
215 }
216
217 /**
218 * Gets assigned VLAN according to the value of egress VLAN.
219 * If connect point is specified, try to reuse the assigned VLAN on the connect point.
220 *
221 * @param cp connect point; Can be null if not specified
222 * @return assigned VLAN ID
223 */
224 VlanId assignedVlan(ConnectPoint cp) {
225 // Use the egressVlan if it is tagged
226 if (!egressVlan().equals(VlanId.NONE)) {
227 return egressVlan();
228 }
229 // Reuse unicast VLAN if the port has subnet configured
230 if (cp != null) {
231 VlanId untaggedVlan = srManager.getInternalVlanId(cp);
Saurav Das09c2c4d2018-08-13 15:34:26 -0700232 return (untaggedVlan != null) ? untaggedVlan
233 : srManager.getDefaultInternalVlan();
Pierb0328e42018-03-27 11:29:42 -0700234 }
235 // Use DEFAULT_VLAN if none of the above matches
Saurav Das09c2c4d2018-08-13 15:34:26 -0700236 return srManager.getDefaultInternalVlan();
Pierb0328e42018-03-27 11:29:42 -0700237 }
238
239 /**
Pierb1fe7382018-04-17 17:25:22 +0200240 * Gets sources connect points of given multicast group.
241 *
242 * @param mcastIp multicast IP
243 * @return sources connect points or empty set if not found
244 */
245 Set<ConnectPoint> getSources(IpAddress mcastIp) {
Pier3e793752018-04-19 16:47:06 +0200246 // TODO we should support different types of routes
Pierb1fe7382018-04-17 17:25:22 +0200247 McastRoute mcastRoute = srManager.multicastRouteService.getRoutes().stream()
248 .filter(mcastRouteInternal -> mcastRouteInternal.group().equals(mcastIp))
249 .findFirst().orElse(null);
250 return mcastRoute == null ? ImmutableSet.of() :
251 srManager.multicastRouteService.sources(mcastRoute);
252 }
253
254 /**
Pierb0328e42018-03-27 11:29:42 -0700255 * Gets sinks of given multicast group.
256 *
257 * @param mcastIp multicast IP
258 * @return map of sinks or empty map if not found
259 */
260 Map<HostId, Set<ConnectPoint>> getSinks(IpAddress mcastIp) {
Pier3e793752018-04-19 16:47:06 +0200261 // TODO we should support different types of routes
Pierb0328e42018-03-27 11:29:42 -0700262 McastRoute mcastRoute = srManager.multicastRouteService.getRoutes().stream()
263 .filter(mcastRouteInternal -> mcastRouteInternal.group().equals(mcastIp))
264 .findFirst().orElse(null);
265 return mcastRoute == null ?
Pierb1fe7382018-04-17 17:25:22 +0200266 ImmutableMap.of() :
Pierb0328e42018-03-27 11:29:42 -0700267 srManager.multicastRouteService.routeData(mcastRoute).sinks();
268 }
269
270 /**
271 * Get sinks affected by this egress device.
272 *
273 * @param egressDevice the egress device
274 * @param mcastIp the mcast ip address
275 * @return the map of the sinks affected
276 */
277 Map<HostId, Set<ConnectPoint>> getAffectedSinks(DeviceId egressDevice,
Pier3e793752018-04-19 16:47:06 +0200278 IpAddress mcastIp) {
Pierb0328e42018-03-27 11:29:42 -0700279 return getSinks(mcastIp).entrySet()
280 .stream()
281 .filter(hostIdSetEntry -> hostIdSetEntry.getValue().stream()
282 .map(ConnectPoint::deviceId)
283 .anyMatch(deviceId -> deviceId.equals(egressDevice))
284 ).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
285 }
286
287 /**
288 * Creates a next objective builder for multicast.
289 *
290 * @param mcastIp multicast group
291 * @param assignedVlan assigned VLAN ID
292 * @param outPorts set of output port numbers
293 * @param nextId the next id
294 * @return next objective builder
295 */
296 NextObjective.Builder nextObjBuilder(IpAddress mcastIp, VlanId assignedVlan,
297 Set<PortNumber> outPorts, Integer nextId) {
298 // If nextId is null allocate a new one
299 if (nextId == null) {
300 nextId = srManager.flowObjectiveService.allocateNextId();
301 }
302 // Build the meta selector with the fwd objective info
303 TrafficSelector metadata =
304 DefaultTrafficSelector.builder()
305 .matchVlanId(assignedVlan)
306 .matchIPDst(mcastIp.toIpPrefix())
307 .build();
308 // Define the nextobjective type
309 NextObjective.Builder nextObjBuilder = DefaultNextObjective
310 .builder().withId(nextId)
311 .withType(NextObjective.Type.BROADCAST)
312 .fromApp(srManager.appId())
313 .withMeta(metadata);
314 // Add the output ports
315 outPorts.forEach(port -> {
316 TrafficTreatment.Builder tBuilder = DefaultTrafficTreatment.builder();
317 if (egressVlan().equals(VlanId.NONE)) {
318 tBuilder.popVlan();
319 }
320 tBuilder.setOutput(port);
321 nextObjBuilder.addTreatment(tBuilder.build());
322 });
323 // Done return the complete builder
324 return nextObjBuilder;
325 }
326
327 /**
328 * Creates a forwarding objective builder for multicast.
329 *
330 * @param mcastIp multicast group
331 * @param assignedVlan assigned VLAN ID
332 * @param nextId next ID of the L3 multicast group
333 * @return forwarding objective builder
334 */
335 ForwardingObjective.Builder fwdObjBuilder(IpAddress mcastIp,
336 VlanId assignedVlan, int nextId) {
337 TrafficSelector.Builder sbuilder = DefaultTrafficSelector.builder();
338 // Let's the matching on the group address
339 // TODO SSM support in future
340 if (mcastIp.isIp6()) {
341 sbuilder.matchEthType(Ethernet.TYPE_IPV6);
342 sbuilder.matchIPv6Dst(mcastIp.toIpPrefix());
343 } else {
344 sbuilder.matchEthType(Ethernet.TYPE_IPV4);
345 sbuilder.matchIPDst(mcastIp.toIpPrefix());
346 }
347 // Then build the meta selector
348 TrafficSelector.Builder metabuilder = DefaultTrafficSelector.builder();
349 metabuilder.matchVlanId(assignedVlan);
350 // Finally return the completed builder
351 ForwardingObjective.Builder fwdBuilder = DefaultForwardingObjective.builder();
352 fwdBuilder.withSelector(sbuilder.build())
353 .withMeta(metabuilder.build())
354 .nextStep(nextId)
355 .withFlag(ForwardingObjective.Flag.SPECIFIC)
356 .fromApp(srManager.appId())
357 .withPriority(SegmentRoutingService.DEFAULT_PRIORITY);
358 return fwdBuilder;
359 }
360
361 /**
362 * Creates a filtering objective builder for multicast.
363 *
364 * @param ingressPort ingress port of the multicast stream
365 * @param assignedVlan assigned VLAN ID
366 * @param mcastIp the group address
367 * @param routerMac router MAC. This is carried in metadata and used from some switches that
368 * need to put unicast entry before multicast entry in TMAC table.
369 * @param mcastRole the Multicast role
370 * @return filtering objective builder
371 */
372 private FilteringObjective.Builder filterObjBuilder(PortNumber ingressPort, VlanId assignedVlan,
Charles Chan056e0c12018-05-10 22:19:49 +0000373 IpAddress mcastIp, MacAddress routerMac, McastRole mcastRole) {
Pierb0328e42018-03-27 11:29:42 -0700374 FilteringObjective.Builder filtBuilder = DefaultFilteringObjective.builder();
375 // Let's add the in port matching and the priority
376 filtBuilder.withKey(Criteria.matchInPort(ingressPort))
377 .withPriority(SegmentRoutingService.DEFAULT_PRIORITY);
378 // According to the mcast role we match on the proper vlan
379 // If the role is null we are on the transit or on the egress
380 if (mcastRole == null) {
381 filtBuilder.addCondition(Criteria.matchVlanId(egressVlan()));
382 } else {
383 filtBuilder.addCondition(Criteria.matchVlanId(ingressVlan()));
384 }
385 // According to the IP type we set the proper match on the mac address
386 if (mcastIp.isIp4()) {
387 filtBuilder.addCondition(Criteria.matchEthDstMasked(MacAddress.IPV4_MULTICAST,
Charles Chan056e0c12018-05-10 22:19:49 +0000388 MacAddress.IPV4_MULTICAST_MASK));
Pierb0328e42018-03-27 11:29:42 -0700389 } else {
390 filtBuilder.addCondition(Criteria.matchEthDstMasked(MacAddress.IPV6_MULTICAST,
Charles Chan056e0c12018-05-10 22:19:49 +0000391 MacAddress.IPV6_MULTICAST_MASK));
Pierb0328e42018-03-27 11:29:42 -0700392 }
393 // We finally build the meta treatment
Esin Karamandd26b212019-07-24 11:26:39 +0000394 TrafficTreatment.Builder tBuilder = DefaultTrafficTreatment.builder();
395 tBuilder.pushVlan().setVlanId(assignedVlan);
396
397 if (routerMac != null && !routerMac.equals(MacAddress.NONE)) {
398 tBuilder.setEthDst(routerMac);
399 }
400
401 filtBuilder.withMeta(tBuilder.build());
Pierb0328e42018-03-27 11:29:42 -0700402 // Done, we return a permit filtering objective
403 return filtBuilder.permit().fromApp(srManager.appId());
404 }
405
406 /**
407 * Gets output ports information from treatments.
408 *
409 * @param treatments collection of traffic treatments
410 * @return set of output port numbers
411 */
412 Set<PortNumber> getPorts(Collection<TrafficTreatment> treatments) {
413 ImmutableSet.Builder<PortNumber> builder = ImmutableSet.builder();
414 treatments.forEach(treatment -> treatment.allInstructions().stream()
415 .filter(instr -> instr instanceof Instructions.OutputInstruction)
416 .forEach(instr -> builder.add(((Instructions.OutputInstruction) instr).port())));
417 return builder.build();
418 }
Pier96f63cb2018-04-17 16:29:56 +0200419
420 /**
421 * Returns the hash of the group address.
422 *
423 * @param ipAddress the ip address
424 * @return the hash of the address
425 */
426 private Long hasher(IpAddress ipAddress) {
427 return HASH_FN.newHasher()
428 .putBytes(ipAddress.toOctets())
429 .hash()
430 .asLong();
431 }
432
433 /**
434 * Given a multicast group define a leader for it.
435 *
436 * @param mcastIp the group address
437 * @return true if the instance is the leader of the group
438 */
439 boolean isLeader(IpAddress mcastIp) {
440 // Get our id
441 final NodeId currentNodeId = srManager.clusterService.getLocalNode().id();
442 // Get the leader for this group using the ip address as key
443 final NodeId leader = srManager.workPartitionService.getLeader(mcastIp, this::hasher);
444 // If there is not a leader, let's send an error
445 if (leader == null) {
446 log.error("Fail to elect a leader for {}.", mcastIp);
447 return false;
448 }
449 // Update cache and return operation result
450 mcastLeaderCache.put(mcastIp, leader);
451 return currentNodeId.equals(leader);
452 }
453
454 /**
455 * Given a multicast group withdraw its leader.
456 *
457 * @param mcastIp the group address
458 */
459 void withdrawLeader(IpAddress mcastIp) {
460 // For now just update the cache
461 mcastLeaderCache.remove(mcastIp);
462 }
463
464 Map<IpAddress, NodeId> getMcastLeaders(IpAddress mcastIp) {
465 // If mcast ip is present
466 if (mcastIp != null) {
467 return mcastLeaderCache.entrySet().stream()
468 .filter(entry -> entry.getKey().equals(mcastIp))
469 .collect(Collectors.toMap(Map.Entry::getKey,
470 Map.Entry::getValue));
471 }
472 // Otherwise take all the groups
473 return ImmutableMap.copyOf(mcastLeaderCache);
474 }
Charles Chand5814aa2018-08-19 19:21:46 -0700475
476 /**
477 * Build recursively the mcast paths.
478 *
479 * @param mcastNextObjStore mcast next obj store
480 * @param toVisit the node to visit
481 * @param visited the visited nodes
482 * @param mcastPaths the current mcast paths
483 * @param currentPath the current path
484 * @param mcastIp the group ip
485 * @param source the source
486 */
487 void buildMcastPaths(Map<McastStoreKey, NextObjective> mcastNextObjStore,
488 DeviceId toVisit, Set<DeviceId> visited,
489 Map<ConnectPoint, List<ConnectPoint>> mcastPaths,
490 List<ConnectPoint> currentPath, IpAddress mcastIp,
491 ConnectPoint source) {
pier000af642020-02-03 13:50:53 +0100492 log.debug("Building Multicast paths recursively for {} - next device to visit is {}",
493 mcastIp, toVisit);
Charles Chand5814aa2018-08-19 19:21:46 -0700494 // If we have visited the node to visit there is a loop
495 if (visited.contains(toVisit)) {
496 return;
497 }
498 // Visit next-hop
499 visited.add(toVisit);
500 VlanId assignedVlan = assignedVlan(toVisit.equals(source.deviceId()) ? source : null);
501 McastStoreKey mcastStoreKey = new McastStoreKey(mcastIp, toVisit, assignedVlan);
502 // Looking for next-hops
503 if (mcastNextObjStore.containsKey(mcastStoreKey)) {
504 // Build egress connect points, get ports and build relative cps
505 NextObjective nextObjective = mcastNextObjStore.get(mcastStoreKey);
506 Set<PortNumber> outputPorts = getPorts(nextObjective.next());
507 ImmutableSet.Builder<ConnectPoint> cpBuilder = ImmutableSet.builder();
508 outputPorts.forEach(portNumber -> cpBuilder.add(new ConnectPoint(toVisit, portNumber)));
509 Set<ConnectPoint> egressPoints = cpBuilder.build();
510 Set<Link> egressLinks;
511 List<ConnectPoint> newCurrentPath;
512 Set<DeviceId> newVisited;
513 DeviceId newToVisit;
514 for (ConnectPoint egressPoint : egressPoints) {
515 egressLinks = srManager.linkService.getEgressLinks(egressPoint);
516 // If it does not have egress links, stop
517 if (egressLinks.isEmpty()) {
518 // Add the connect points to the path
519 newCurrentPath = Lists.newArrayList(currentPath);
520 newCurrentPath.add(0, egressPoint);
521 mcastPaths.put(egressPoint, newCurrentPath);
522 } else {
523 newVisited = Sets.newHashSet(visited);
524 // Iterate over the egress links for the next hops
525 for (Link egressLink : egressLinks) {
526 newToVisit = egressLink.dst().deviceId();
527 newCurrentPath = Lists.newArrayList(currentPath);
528 newCurrentPath.add(0, egressPoint);
529 newCurrentPath.add(0, egressLink.dst());
530 buildMcastPaths(mcastNextObjStore, newToVisit, newVisited, mcastPaths, newCurrentPath, mcastIp,
531 source);
532 }
533 }
534 }
535 }
536 }
Pierb0328e42018-03-27 11:29:42 -0700537}