sangyun-han
Committed by Gerrit Code Review

Add switch null exception and log

Change-Id: Ibf8d7d05c2e86cd7d7f73c6bcd1eb3575ca5ed4b
...@@ -360,6 +360,7 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr ...@@ -360,6 +360,7 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr
360 DeviceId did = deviceId(uri(dpid)); 360 DeviceId did = deviceId(uri(dpid));
361 OpenFlowSwitch sw = controller.getSwitch(dpid); 361 OpenFlowSwitch sw = controller.getSwitch(dpid);
362 if (sw == null) { 362 if (sw == null) {
363 + LOG.error("Switch {} is not found", dpid);
363 return; 364 return;
364 } 365 }
365 366
...@@ -415,6 +416,7 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr ...@@ -415,6 +416,7 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr
415 DeviceId did = deviceId(uri(dpid)); 416 DeviceId did = deviceId(uri(dpid));
416 OpenFlowSwitch sw = controller.getSwitch(dpid); 417 OpenFlowSwitch sw = controller.getSwitch(dpid);
417 if (sw == null) { 418 if (sw == null) {
419 + LOG.error("Switch {} is not found", dpid);
418 return; 420 return;
419 } 421 }
420 final List<PortDescription> ports = buildPortDescriptions(sw); 422 final List<PortDescription> ports = buildPortDescriptions(sw);
...@@ -835,6 +837,10 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr ...@@ -835,6 +837,10 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr
835 } 837 }
836 } else if (((OFStatsReply) msg).getStatsType() == OFStatsType.EXPERIMENTER) { 838 } else if (((OFStatsReply) msg).getStatsType() == OFStatsType.EXPERIMENTER) {
837 OpenFlowSwitch sw = controller.getSwitch(dpid); 839 OpenFlowSwitch sw = controller.getSwitch(dpid);
840 + if (sw == null) {
841 + LOG.error("Switch {} is not found", dpid);
842 + break;
843 + }
838 if (sw instanceof OpenFlowOpticalSwitch) { 844 if (sw instanceof OpenFlowOpticalSwitch) {
839 // Optical switch uses experimenter stats message to update power 845 // Optical switch uses experimenter stats message to update power
840 List<PortDescription> portDescs = 846 List<PortDescription> portDescs =
......