Jian Li
Committed by Gerrit Code Review

Remove incoming and outgoing OF message logging from device provider

The OpenFlow incoming and outgoing message logging feature has
been implemented in a separated message provider under openflow
provider. So this WIP feature should be removed from  device
provider.

Change-Id: I5b974c96688a13ea4ee7af309f9522245f61e413
......@@ -142,12 +142,6 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr
private final InternalDeviceProvider listener = new InternalDeviceProvider();
private final IncomingMessageProvider inMsgListener = new IncomingMessageProvider();
private final OutgoingMessageProvider outMsgListener = new OutgoingMessageProvider();
private boolean isCtrlMsgMonitor;
// TODO: We need to make the poll interval configurable.
static final int POLL_INTERVAL = 5;
@Property(name = "PortStatsPollFrequency", intValue = POLL_INTERVAL,
......@@ -273,33 +267,6 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr
LOG.debug("Accepting mastership role change to {} for device {}", newRole, deviceId);
}
/**
* Enable OpenFlow control message monitoring.
*/
public void enableCtrlMsgMonitor() {
isCtrlMsgMonitor = true;
controller.addEventListener(inMsgListener);
controller.monitorAllEvents(isCtrlMsgMonitor);
for (OpenFlowSwitch sw : controller.getSwitches()) {
sw.addEventListener(outMsgListener);
}
LOG.info("Enable control message monitoring.");
}
/**
* Disable OpenFlow control message monitoring.
*/
public void disableCtrlMsgMonitor() {
isCtrlMsgMonitor = false;
controller.monitorAllEvents(isCtrlMsgMonitor);
controller.removeEventListener(inMsgListener);
for (OpenFlowSwitch sw: controller.getSwitches()) {
sw.removeEventListener(outMsgListener);
}
LOG.info("Disable control message monitoring");
}
private void pushPortMetrics(Dpid dpid, List<OFPortStatsEntry> portStatsEntries) {
DeviceId deviceId = DeviceId.deviceId(Dpid.uri(dpid));
Collection<PortStatistics> stats = buildPortStatistics(deviceId, portStatsEntries);
......@@ -340,32 +307,6 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr
}
/**
* A listener for incoming OpenFlow messages.
*/
private class IncomingMessageProvider implements OpenFlowEventListener {
@Override
public void handleMessage(Dpid dpid, OFMessage msg) {
if (isCtrlMsgMonitor) {
// TODO: handle all incoming OF messages
}
}
}
/**
* A listener for outgoing OpenFlow messages.
*/
private class OutgoingMessageProvider implements OpenFlowEventListener {
@Override
public void handleMessage(Dpid dpid, OFMessage msg) {
if (isCtrlMsgMonitor) {
// TODO: handle all outgoing OF messages
}
}
}
private class InternalDeviceProvider implements OpenFlowSwitchListener, OpenFlowEventListener {
private HashMap<Dpid, List<OFPortStatsEntry>> portStatsReplies = new HashMap<>();
......@@ -381,11 +322,6 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr
return;
}
if (isCtrlMsgMonitor) {
// start to monitor the outgoing control messages
sw.addEventListener(outMsgListener);
}
ChassisId cId = new ChassisId(dpid.value());
SparseAnnotations annotations = DefaultAnnotations.builder()
......@@ -426,14 +362,6 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr
if (collector != null) {
collector.stop();
}
OpenFlowSwitch sw = controller.getSwitch(dpid);
if (sw != null) {
if (isCtrlMsgMonitor) {
// stop monitoring the outgoing control messages
sw.removeEventListener(outMsgListener);
}
}
}
@Override
......