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 ...@@ -142,12 +142,6 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr
142 142
143 private final InternalDeviceProvider listener = new InternalDeviceProvider(); 143 private final InternalDeviceProvider listener = new InternalDeviceProvider();
144 144
145 - private final IncomingMessageProvider inMsgListener = new IncomingMessageProvider();
146 -
147 - private final OutgoingMessageProvider outMsgListener = new OutgoingMessageProvider();
148 -
149 - private boolean isCtrlMsgMonitor;
150 -
151 // TODO: We need to make the poll interval configurable. 145 // TODO: We need to make the poll interval configurable.
152 static final int POLL_INTERVAL = 5; 146 static final int POLL_INTERVAL = 5;
153 @Property(name = "PortStatsPollFrequency", intValue = POLL_INTERVAL, 147 @Property(name = "PortStatsPollFrequency", intValue = POLL_INTERVAL,
...@@ -273,33 +267,6 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr ...@@ -273,33 +267,6 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr
273 LOG.debug("Accepting mastership role change to {} for device {}", newRole, deviceId); 267 LOG.debug("Accepting mastership role change to {} for device {}", newRole, deviceId);
274 } 268 }
275 269
276 -
277 - /**
278 - * Enable OpenFlow control message monitoring.
279 - */
280 - public void enableCtrlMsgMonitor() {
281 - isCtrlMsgMonitor = true;
282 - controller.addEventListener(inMsgListener);
283 - controller.monitorAllEvents(isCtrlMsgMonitor);
284 - for (OpenFlowSwitch sw : controller.getSwitches()) {
285 - sw.addEventListener(outMsgListener);
286 - }
287 - LOG.info("Enable control message monitoring.");
288 - }
289 -
290 - /**
291 - * Disable OpenFlow control message monitoring.
292 - */
293 - public void disableCtrlMsgMonitor() {
294 - isCtrlMsgMonitor = false;
295 - controller.monitorAllEvents(isCtrlMsgMonitor);
296 - controller.removeEventListener(inMsgListener);
297 - for (OpenFlowSwitch sw: controller.getSwitches()) {
298 - sw.removeEventListener(outMsgListener);
299 - }
300 - LOG.info("Disable control message monitoring");
301 - }
302 -
303 private void pushPortMetrics(Dpid dpid, List<OFPortStatsEntry> portStatsEntries) { 270 private void pushPortMetrics(Dpid dpid, List<OFPortStatsEntry> portStatsEntries) {
304 DeviceId deviceId = DeviceId.deviceId(Dpid.uri(dpid)); 271 DeviceId deviceId = DeviceId.deviceId(Dpid.uri(dpid));
305 Collection<PortStatistics> stats = buildPortStatistics(deviceId, portStatsEntries); 272 Collection<PortStatistics> stats = buildPortStatistics(deviceId, portStatsEntries);
...@@ -340,32 +307,6 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr ...@@ -340,32 +307,6 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr
340 307
341 } 308 }
342 309
343 - /**
344 - * A listener for incoming OpenFlow messages.
345 - */
346 - private class IncomingMessageProvider implements OpenFlowEventListener {
347 -
348 - @Override
349 - public void handleMessage(Dpid dpid, OFMessage msg) {
350 - if (isCtrlMsgMonitor) {
351 - // TODO: handle all incoming OF messages
352 - }
353 - }
354 - }
355 -
356 - /**
357 - * A listener for outgoing OpenFlow messages.
358 - */
359 - private class OutgoingMessageProvider implements OpenFlowEventListener {
360 -
361 - @Override
362 - public void handleMessage(Dpid dpid, OFMessage msg) {
363 - if (isCtrlMsgMonitor) {
364 - // TODO: handle all outgoing OF messages
365 - }
366 - }
367 - }
368 -
369 private class InternalDeviceProvider implements OpenFlowSwitchListener, OpenFlowEventListener { 310 private class InternalDeviceProvider implements OpenFlowSwitchListener, OpenFlowEventListener {
370 311
371 private HashMap<Dpid, List<OFPortStatsEntry>> portStatsReplies = new HashMap<>(); 312 private HashMap<Dpid, List<OFPortStatsEntry>> portStatsReplies = new HashMap<>();
...@@ -381,11 +322,6 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr ...@@ -381,11 +322,6 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr
381 return; 322 return;
382 } 323 }
383 324
384 - if (isCtrlMsgMonitor) {
385 - // start to monitor the outgoing control messages
386 - sw.addEventListener(outMsgListener);
387 - }
388 -
389 ChassisId cId = new ChassisId(dpid.value()); 325 ChassisId cId = new ChassisId(dpid.value());
390 326
391 SparseAnnotations annotations = DefaultAnnotations.builder() 327 SparseAnnotations annotations = DefaultAnnotations.builder()
...@@ -426,14 +362,6 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr ...@@ -426,14 +362,6 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr
426 if (collector != null) { 362 if (collector != null) {
427 collector.stop(); 363 collector.stop();
428 } 364 }
429 -
430 - OpenFlowSwitch sw = controller.getSwitch(dpid);
431 - if (sw != null) {
432 - if (isCtrlMsgMonitor) {
433 - // stop monitoring the outgoing control messages
434 - sw.removeEventListener(outMsgListener);
435 - }
436 - }
437 } 365 }
438 366
439 @Override 367 @Override
......