Implement PowerConfig for Oplink Devices
Change-Id: I939126580f8d3cdcdbcd9a46f6ee5cacbd25051d
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 1f6a888..177cf1a 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
@@ -547,7 +547,7 @@
private PortDescription buildPortDescription(PortDescPropertyType ptype, OFObject port,
OpenFlowOpticalSwitch opsw) {
- if (port instanceof OFPortOptical) {
+ if (port instanceof OFPortOptical) {
return buildPortDescription(ptype, (OFPortOptical) port, opsw);
}
return buildPortDescription(ptype, (OFExpPort) port);
@@ -833,6 +833,16 @@
statsEntries.clear();
}
}
+ } else if (((OFStatsReply) msg).getStatsType() == OFStatsType.EXPERIMENTER) {
+ OpenFlowSwitch sw = controller.getSwitch(dpid);
+ if (sw instanceof OpenFlowOpticalSwitch) {
+ // Optical switch uses experimenter stats message to update power
+ List<PortDescription> portDescs =
+ ((OpenFlowOpticalSwitch) sw).processExpPortStats(msg);
+ if (!portDescs.isEmpty()) {
+ providerService.updatePorts(DeviceId.deviceId(Dpid.uri(dpid)), portDescs);
+ }
+ }
}
break;
case ERROR: