Do not send table stats request if unsupported

Change-Id: Ia66447aad1eeb0a01577215e4c5985526dadd274
This commit is contained in:
Laszlo Papp 2017-12-14 20:05:49 +00:00 committed by Andrea Campanella
parent c45ede5f1c
commit edadbe2574
3 changed files with 20 additions and 3 deletions

View File

@ -17,6 +17,7 @@ package org.onosproject.openflow.controller;
import org.onosproject.net.Device;
import org.projectfloodlight.openflow.protocol.OFFactory;
import org.projectfloodlight.openflow.protocol.OFFeaturesReply;
import org.projectfloodlight.openflow.protocol.OFMessage;
import org.projectfloodlight.openflow.protocol.OFMeterFeatures;
import org.projectfloodlight.openflow.protocol.OFPortDesc;
@ -80,6 +81,14 @@ public interface OpenFlowSwitch {
*/
OFMeterFeatures getMeterFeatures();
/**
* Fetches the features of this switch.
* @return unmodifiable features
*/
default OFFeaturesReply features() {
return null;
}
/**
* Provides the factory for this OF version.
* @return OF version specific factory.

View File

@ -527,6 +527,11 @@ public abstract class AbstractOpenFlowSwitch extends AbstractHandlerBehaviour
}
}
@Override
public OFFeaturesReply features() {
return this.features;
}
@Override
public String manufacturerDescription() {
return this.desc.getMfrDesc();

View File

@ -66,6 +66,7 @@ import org.onosproject.provider.of.flow.util.FlowEntryBuilder;
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 @@ public class OpenFlowRuleProvider extends AbstractProvider
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) {