make sure only one instance pushes default rules
Change-Id: I0953c4db36ab48d7aeec88b940712c2cbe35e415
Showing
1 changed file
with
10 additions
and
0 deletions
... | @@ -30,6 +30,7 @@ import org.onosproject.cfg.ComponentConfigService; | ... | @@ -30,6 +30,7 @@ import org.onosproject.cfg.ComponentConfigService; |
30 | import org.onosproject.core.ApplicationId; | 30 | import org.onosproject.core.ApplicationId; |
31 | import org.onosproject.core.CoreService; | 31 | import org.onosproject.core.CoreService; |
32 | import org.onosproject.event.AbstractListenerManager; | 32 | import org.onosproject.event.AbstractListenerManager; |
33 | +import org.onosproject.mastership.MastershipService; | ||
33 | import org.onosproject.net.ConnectPoint; | 34 | import org.onosproject.net.ConnectPoint; |
34 | import org.onosproject.net.DeviceId; | 35 | import org.onosproject.net.DeviceId; |
35 | import org.onosproject.net.Port; | 36 | import org.onosproject.net.Port; |
... | @@ -99,6 +100,9 @@ public class Olt | ... | @@ -99,6 +100,9 @@ public class Olt |
99 | protected FlowObjectiveService flowObjectiveService; | 100 | protected FlowObjectiveService flowObjectiveService; |
100 | 101 | ||
101 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 102 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
103 | + protected MastershipService mastershipService; | ||
104 | + | ||
105 | + @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | ||
102 | protected DeviceService deviceService; | 106 | protected DeviceService deviceService; |
103 | 107 | ||
104 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 108 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
... | @@ -420,6 +424,9 @@ public class Olt | ... | @@ -420,6 +424,9 @@ public class Olt |
420 | } | 424 | } |
421 | 425 | ||
422 | private void processFilteringObjectives(DeviceId devId, PortNumber port, boolean install) { | 426 | private void processFilteringObjectives(DeviceId devId, PortNumber port, boolean install) { |
427 | + if (!mastershipService.isLocalMaster(devId)) { | ||
428 | + return; | ||
429 | + } | ||
423 | DefaultFilteringObjective.Builder builder = DefaultFilteringObjective.builder(); | 430 | DefaultFilteringObjective.Builder builder = DefaultFilteringObjective.builder(); |
424 | 431 | ||
425 | FilteringObjective eapol = (install ? builder.permit() : builder.deny()) | 432 | FilteringObjective eapol = (install ? builder.permit() : builder.deny()) |
... | @@ -550,6 +557,9 @@ public class Olt | ... | @@ -550,6 +557,9 @@ public class Olt |
550 | } | 557 | } |
551 | 558 | ||
552 | private void provisionDefaultFlows(DeviceId deviceId) { | 559 | private void provisionDefaultFlows(DeviceId deviceId) { |
560 | + if (!mastershipService.isLocalMaster(deviceId)) { | ||
561 | + return; | ||
562 | + } | ||
553 | List<Port> ports = deviceService.getPorts(deviceId); | 563 | List<Port> ports = deviceService.getPorts(deviceId); |
554 | 564 | ||
555 | ports.stream() | 565 | ports.stream() | ... | ... |
-
Please register or login to post a comment