FlowStatsCollector: collect FlowStats on MASTER sw only
Change-Id: I4a7e808cceeaee209aaf22d85c9fa4dc069d8acc
Showing
1 changed file
with
8 additions
and
0 deletions
... | @@ -8,6 +8,7 @@ import org.jboss.netty.util.HashedWheelTimer; | ... | @@ -8,6 +8,7 @@ import org.jboss.netty.util.HashedWheelTimer; |
8 | import org.jboss.netty.util.Timeout; | 8 | import org.jboss.netty.util.Timeout; |
9 | import org.jboss.netty.util.TimerTask; | 9 | import org.jboss.netty.util.TimerTask; |
10 | import org.onlab.onos.openflow.controller.OpenFlowSwitch; | 10 | import org.onlab.onos.openflow.controller.OpenFlowSwitch; |
11 | +import org.onlab.onos.openflow.controller.RoleState; | ||
11 | import org.onlab.util.Timer; | 12 | import org.onlab.util.Timer; |
12 | import org.projectfloodlight.openflow.protocol.OFFlowStatsRequest; | 13 | import org.projectfloodlight.openflow.protocol.OFFlowStatsRequest; |
13 | import org.projectfloodlight.openflow.types.OFPort; | 14 | import org.projectfloodlight.openflow.types.OFPort; |
... | @@ -48,6 +49,13 @@ public class FlowStatsCollector implements TimerTask { | ... | @@ -48,6 +49,13 @@ public class FlowStatsCollector implements TimerTask { |
48 | } | 49 | } |
49 | 50 | ||
50 | private void sendFlowStatistics() { | 51 | private void sendFlowStatistics() { |
52 | + if (log.isTraceEnabled()) { | ||
53 | + log.trace("sendFlowStatistics {}:{}", sw.getStringId(), sw.getRole()); | ||
54 | + } | ||
55 | + if (sw.getRole() != RoleState.MASTER) { | ||
56 | + // Switch not master. | ||
57 | + return; | ||
58 | + } | ||
51 | OFFlowStatsRequest request = sw.factory().buildFlowStatsRequest() | 59 | OFFlowStatsRequest request = sw.factory().buildFlowStatsRequest() |
52 | .setMatch(sw.factory().matchWildcardAll()) | 60 | .setMatch(sw.factory().matchWildcardAll()) |
53 | .setTableId(TableId.ALL) | 61 | .setTableId(TableId.ALL) | ... | ... |
-
Please register or login to post a comment