[ONOS-7552] Port disabled in ONOS but enabled in switch
Change-Id: I74c33e359073eda0706b2d59946737f053675326
diff --git a/providers/openflow/device/src/main/java/org/onosproject/provider/of/device/impl/OpenFlowDeviceProvider.java b/providers/openflow/device/src/main/java/org/onosproject/provider/of/device/impl/OpenFlowDeviceProvider.java
index fad323e..c9f09e5 100644
--- a/providers/openflow/device/src/main/java/org/onosproject/provider/of/device/impl/OpenFlowDeviceProvider.java
+++ b/providers/openflow/device/src/main/java/org/onosproject/provider/of/device/impl/OpenFlowDeviceProvider.java
@@ -90,6 +90,7 @@
import org.projectfloodlight.openflow.protocol.OFPortDescPropEthernet;
import org.projectfloodlight.openflow.protocol.OFPortDescPropOptical;
import org.projectfloodlight.openflow.protocol.OFPortDescPropOpticalTransport;
+import org.projectfloodlight.openflow.protocol.OFPortDescStatsRequest;
import org.projectfloodlight.openflow.protocol.OFPortFeatures;
import org.projectfloodlight.openflow.protocol.OFPortMod;
import org.projectfloodlight.openflow.protocol.OFPortOptical;
@@ -800,6 +801,10 @@
cId, annotations);
providerService.deviceConnected(did, description);
providerService.updatePorts(did, buildPortDescriptions(sw));
+ //sends port description stats request again if OF version supports
+ if (sw.features().getVersion().compareTo(OFVersion.OF_13) >= 0) {
+ sendPortDescStatsRequest(sw);
+ }
if (sw.features().getCapabilities().contains(OFCapabilities.PORT_STATS)) {
PortStatsCollector psc = new PortStatsCollector(timer, sw, portStatsPollFrequency);
@@ -813,6 +818,18 @@
}
}
+ /**
+ * Sends port description statistic request to switch if supported.
+ */
+ private void sendPortDescStatsRequest(OpenFlowSwitch sw) {
+ if (sw == null) {
+ return;
+ }
+ OFPortDescStatsRequest descStatsRequest = sw.factory().buildPortDescStatsRequest()
+ .build();
+ sw.sendMsg(descStatsRequest);
+ }
+
private void stopCollectorIfNeeded(PortStatsCollector collector) {
if (collector != null) {
collector.stop();