Yuta HIGUCHI
Committed by Gerrit Code Review

OpenFlowDeviceProvider: tolerate initial switch-add failures

- Initial switch add error should not prevent OFDProvider from activating

Change-Id: Id965aeaf8262a8b6a06c7d3f4af15593660f2f06
...@@ -92,7 +92,14 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr ...@@ -92,7 +92,14 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr
92 providerService = providerRegistry.register(this); 92 providerService = providerRegistry.register(this);
93 controller.addListener(listener); 93 controller.addListener(listener);
94 for (OpenFlowSwitch sw : controller.getSwitches()) { 94 for (OpenFlowSwitch sw : controller.getSwitches()) {
95 - listener.switchAdded(new Dpid(sw.getId())); 95 + try {
96 + listener.switchAdded(new Dpid(sw.getId()));
97 + } catch (Exception e) {
98 + LOG.warn("Failed initially adding {} : {}", sw.getStringId(), e.getMessage());
99 + LOG.debug("Error details:", e);
100 + // disconnect to trigger switch-add later
101 + sw.disconnectSwitch();
102 + }
96 } 103 }
97 LOG.info("Started"); 104 LOG.info("Started");
98 } 105 }
......