Committed by
Gerrit Code Review
Make error messages more accurate when OpenFlow provider can't find a driver for a device
Change-Id: If40f2446fab215950689b6846aadc8024e8eb8e1
Showing
1 changed file
with
19 additions
and
17 deletions
... | @@ -195,7 +195,6 @@ public class Controller { | ... | @@ -195,7 +195,6 @@ public class Controller { |
195 | } catch (Exception ex) { | 195 | } catch (Exception ex) { |
196 | log.error("SSL init failed: {}", ex.getMessage()); | 196 | log.error("SSL init failed: {}", ex.getMessage()); |
197 | } | 197 | } |
198 | - | ||
199 | } | 198 | } |
200 | 199 | ||
201 | private void getTlsParameters() { | 200 | private void getTlsParameters() { |
... | @@ -227,7 +226,6 @@ public class Controller { | ... | @@ -227,7 +226,6 @@ public class Controller { |
227 | } | 226 | } |
228 | 227 | ||
229 | private void initSsl() throws Exception { | 228 | private void initSsl() throws Exception { |
230 | - | ||
231 | TrustManagerFactory tmFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); | 229 | TrustManagerFactory tmFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); |
232 | KeyStore ts = KeyStore.getInstance("JKS"); | 230 | KeyStore ts = KeyStore.getInstance("JKS"); |
233 | ts.load(new FileInputStream(tsLocation), tsPwd); | 231 | ts.load(new FileInputStream(tsLocation), tsPwd); |
... | @@ -240,8 +238,6 @@ public class Controller { | ... | @@ -240,8 +238,6 @@ public class Controller { |
240 | 238 | ||
241 | sslContext = SSLContext.getInstance("TLS"); | 239 | sslContext = SSLContext.getInstance("TLS"); |
242 | sslContext.init(kmf.getKeyManagers(), tmFactory.getTrustManagers(), null); | 240 | sslContext.init(kmf.getKeyManagers(), tmFactory.getTrustManagers(), null); |
243 | - | ||
244 | - | ||
245 | } | 241 | } |
246 | 242 | ||
247 | // ************** | 243 | // ************** |
... | @@ -286,21 +282,27 @@ public class Controller { | ... | @@ -286,21 +282,27 @@ public class Controller { |
286 | driver = driverService.getDriver(desc.getMfrDesc(), desc.getHwDesc(), desc.getSwDesc()); | 282 | driver = driverService.getDriver(desc.getMfrDesc(), desc.getHwDesc(), desc.getSwDesc()); |
287 | } | 283 | } |
288 | 284 | ||
289 | - if (driver != null && driver.hasBehaviour(OpenFlowSwitchDriver.class)) { | 285 | + if (driver == null) { |
290 | - Dpid did = new Dpid(dpid); | 286 | + log.error("No OpenFlow driver for {} : {}", dpid, desc); |
291 | - DefaultDriverHandler handler = | 287 | + return null; |
292 | - new DefaultDriverHandler(new DefaultDriverData(driver, deviceId(uri(did)))); | 288 | + } |
293 | - OpenFlowSwitchDriver ofSwitchDriver = | 289 | + |
294 | - driver.createBehaviour(handler, OpenFlowSwitchDriver.class); | 290 | + log.info("Driver {} assigned to device {}", driver.name(), dpidObj); |
295 | - ofSwitchDriver.init(did, desc, ofv); | 291 | + |
296 | - ofSwitchDriver.setAgent(agent); | 292 | + if (!driver.hasBehaviour(OpenFlowSwitchDriver.class)) { |
297 | - ofSwitchDriver.setRoleHandler(new RoleManager(ofSwitchDriver)); | 293 | + log.error("Driver {} does not support OpenFlowSwitchDriver behaviour", driver.name()); |
298 | - log.info("OpenFlow handshaker found for device {}: {}", dpid, ofSwitchDriver); | 294 | + return null; |
299 | - return ofSwitchDriver; | ||
300 | } | 295 | } |
301 | - log.error("No OpenFlow driver for {} : {}", dpid, desc); | ||
302 | - return null; | ||
303 | 296 | ||
297 | + DefaultDriverHandler handler = | ||
298 | + new DefaultDriverHandler(new DefaultDriverData(driver, deviceId(uri(dpidObj)))); | ||
299 | + OpenFlowSwitchDriver ofSwitchDriver = | ||
300 | + driver.createBehaviour(handler, OpenFlowSwitchDriver.class); | ||
301 | + ofSwitchDriver.init(dpidObj, desc, ofv); | ||
302 | + ofSwitchDriver.setAgent(agent); | ||
303 | + ofSwitchDriver.setRoleHandler(new RoleManager(ofSwitchDriver)); | ||
304 | + log.info("OpenFlow handshaker found for device {}: {}", dpid, ofSwitchDriver); | ||
305 | + return ofSwitchDriver; | ||
304 | } | 306 | } |
305 | 307 | ||
306 | public void start(OpenFlowAgent ag, DriverService driverService) { | 308 | public void start(OpenFlowAgent ag, DriverService driverService) { | ... | ... |
-
Please register or login to post a comment