Charles Chan
Committed by Gerrit Code Review

Bugfix for multicast in multiple instances environment

Only the master of the source device do path calculations

Change-Id: I29f6d49f039d61014f0ff8ddce73db2ad18eb6e4
(cherry picked from commit a7da388b)
......@@ -196,6 +196,13 @@ public class McastHandler {
ConnectPoint sink = mcastRouteInfo.sink().orElse(null);
IpAddress mcastIp = mcastRouteInfo.route().group();
// Continue only when this instance is the master of source device
if (!srManager.mastershipService.isLocalMaster(source.deviceId())) {
log.info("Skip {} due to lack of mastership of the source device {}",
mcastIp, source.deviceId());
return;
}
// When source and sink are on the same device
if (source.deviceId().equals(sink.deviceId())) {
// Source and sink are on even the same port. There must be something wrong.
......@@ -238,6 +245,13 @@ public class McastHandler {
*/
private void processSinkAddedInternal(ConnectPoint source, ConnectPoint sink,
IpAddress mcastIp) {
// Continue only when this instance is the master of source device
if (!srManager.mastershipService.isLocalMaster(source.deviceId())) {
log.info("Skip {} due to lack of mastership of the source device {}",
source.deviceId());
return;
}
// Process the ingress device
addFilterToDevice(source.deviceId(), source.port(), assignedVlan(source));
......@@ -305,6 +319,13 @@ public class McastHandler {
return;
}
// Continue only when this instance is the master of source device
if (!srManager.mastershipService.isLocalMaster(source.deviceId())) {
log.info("Skip {} due to lack of mastership of the source device {}",
source.deviceId());
return;
}
// Remove entire transit
removeGroupFromDevice(transitDevice, mcastIp, assignedVlan(null));
......@@ -612,12 +633,11 @@ public class McastHandler {
MacAddress.IPV4_MULTICAST_MASK))
.addCondition(Criteria.matchVlanId(egressVlan()))
.withPriority(SegmentRoutingService.DEFAULT_PRIORITY);
// vlan assignment is valid only if this instance is master
if (srManager.mastershipService.isLocalMaster(deviceId)) {
TrafficTreatment tt = DefaultTrafficTreatment.builder()
.pushVlan().setVlanId(assignedVlan).build();
filtBuilder.withMeta(tt);
}
TrafficTreatment tt = DefaultTrafficTreatment.builder()
.pushVlan().setVlanId(assignedVlan).build();
filtBuilder.withMeta(tt);
return filtBuilder.permit().fromApp(srManager.appId);
}
......