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
Showing
1 changed file
with
23 additions
and
3 deletions
| ... | @@ -196,6 +196,13 @@ public class McastHandler { | ... | @@ -196,6 +196,13 @@ public class McastHandler { |
| 196 | ConnectPoint sink = mcastRouteInfo.sink().orElse(null); | 196 | ConnectPoint sink = mcastRouteInfo.sink().orElse(null); |
| 197 | IpAddress mcastIp = mcastRouteInfo.route().group(); | 197 | IpAddress mcastIp = mcastRouteInfo.route().group(); |
| 198 | 198 | ||
| 199 | + // Continue only when this instance is the master of source device | ||
| 200 | + if (!srManager.mastershipService.isLocalMaster(source.deviceId())) { | ||
| 201 | + log.info("Skip {} due to lack of mastership of the source device {}", | ||
| 202 | + mcastIp, source.deviceId()); | ||
| 203 | + return; | ||
| 204 | + } | ||
| 205 | + | ||
| 199 | // When source and sink are on the same device | 206 | // When source and sink are on the same device |
| 200 | if (source.deviceId().equals(sink.deviceId())) { | 207 | if (source.deviceId().equals(sink.deviceId())) { |
| 201 | // Source and sink are on even the same port. There must be something wrong. | 208 | // Source and sink are on even the same port. There must be something wrong. |
| ... | @@ -238,6 +245,13 @@ public class McastHandler { | ... | @@ -238,6 +245,13 @@ public class McastHandler { |
| 238 | */ | 245 | */ |
| 239 | private void processSinkAddedInternal(ConnectPoint source, ConnectPoint sink, | 246 | private void processSinkAddedInternal(ConnectPoint source, ConnectPoint sink, |
| 240 | IpAddress mcastIp) { | 247 | IpAddress mcastIp) { |
| 248 | + // Continue only when this instance is the master of source device | ||
| 249 | + if (!srManager.mastershipService.isLocalMaster(source.deviceId())) { | ||
| 250 | + log.info("Skip {} due to lack of mastership of the source device {}", | ||
| 251 | + source.deviceId()); | ||
| 252 | + return; | ||
| 253 | + } | ||
| 254 | + | ||
| 241 | // Process the ingress device | 255 | // Process the ingress device |
| 242 | addFilterToDevice(source.deviceId(), source.port(), assignedVlan(source)); | 256 | addFilterToDevice(source.deviceId(), source.port(), assignedVlan(source)); |
| 243 | 257 | ||
| ... | @@ -305,6 +319,13 @@ public class McastHandler { | ... | @@ -305,6 +319,13 @@ public class McastHandler { |
| 305 | return; | 319 | return; |
| 306 | } | 320 | } |
| 307 | 321 | ||
| 322 | + // Continue only when this instance is the master of source device | ||
| 323 | + if (!srManager.mastershipService.isLocalMaster(source.deviceId())) { | ||
| 324 | + log.info("Skip {} due to lack of mastership of the source device {}", | ||
| 325 | + source.deviceId()); | ||
| 326 | + return; | ||
| 327 | + } | ||
| 328 | + | ||
| 308 | // Remove entire transit | 329 | // Remove entire transit |
| 309 | removeGroupFromDevice(transitDevice, mcastIp, assignedVlan(null)); | 330 | removeGroupFromDevice(transitDevice, mcastIp, assignedVlan(null)); |
| 310 | 331 | ||
| ... | @@ -612,12 +633,11 @@ public class McastHandler { | ... | @@ -612,12 +633,11 @@ public class McastHandler { |
| 612 | MacAddress.IPV4_MULTICAST_MASK)) | 633 | MacAddress.IPV4_MULTICAST_MASK)) |
| 613 | .addCondition(Criteria.matchVlanId(egressVlan())) | 634 | .addCondition(Criteria.matchVlanId(egressVlan())) |
| 614 | .withPriority(SegmentRoutingService.DEFAULT_PRIORITY); | 635 | .withPriority(SegmentRoutingService.DEFAULT_PRIORITY); |
| 615 | - // vlan assignment is valid only if this instance is master | 636 | + |
| 616 | - if (srManager.mastershipService.isLocalMaster(deviceId)) { | ||
| 617 | TrafficTreatment tt = DefaultTrafficTreatment.builder() | 637 | TrafficTreatment tt = DefaultTrafficTreatment.builder() |
| 618 | .pushVlan().setVlanId(assignedVlan).build(); | 638 | .pushVlan().setVlanId(assignedVlan).build(); |
| 619 | filtBuilder.withMeta(tt); | 639 | filtBuilder.withMeta(tt); |
| 620 | - } | 640 | + |
| 621 | return filtBuilder.permit().fromApp(srManager.appId); | 641 | return filtBuilder.permit().fromApp(srManager.appId); |
| 622 | } | 642 | } |
| 623 | 643 | ... | ... |
-
Please register or login to post a comment