Do not send table stats request if unsupported
Change-Id: Ia66447aad1eeb0a01577215e4c5985526dadd274
diff --git a/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/OpenFlowRuleProvider.java b/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/OpenFlowRuleProvider.java
index 47c49bc..ef013b59 100644
--- a/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/OpenFlowRuleProvider.java
+++ b/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/OpenFlowRuleProvider.java
@@ -66,6 +66,7 @@
import org.osgi.service.component.ComponentContext;
import org.projectfloodlight.openflow.protocol.OFBadRequestCode;
import org.projectfloodlight.openflow.protocol.OFBarrierRequest;
+import org.projectfloodlight.openflow.protocol.OFCapabilities;
import org.projectfloodlight.openflow.protocol.OFErrorMsg;
import org.projectfloodlight.openflow.protocol.OFFlowLightweightStatsReply;
import org.projectfloodlight.openflow.protocol.OFFlowMod;
@@ -253,9 +254,11 @@
stopCollectorIfNeeded(simpleCollectors.put(new Dpid(sw.getId()), fsc));
fsc.start();
}
- TableStatisticsCollector tsc = new TableStatisticsCollector(timer, sw, flowPollFrequency);
- stopCollectorIfNeeded(tableStatsCollectors.put(new Dpid(sw.getId()), tsc));
- tsc.start();
+ if (sw.features().getCapabilities().contains(OFCapabilities.TABLE_STATS)) {
+ TableStatisticsCollector tsc = new TableStatisticsCollector(timer, sw, flowPollFrequency);
+ stopCollectorIfNeeded(tableStatsCollectors.put(new Dpid(sw.getId()), tsc));
+ tsc.start();
+ }
}
private void stopCollectorIfNeeded(SwitchDataCollector collector) {