Evict pipeliner/driver cache only on DEVICE_REMOVE
- step toward runtime driver reconfig Change-Id: I55a9db9a6c2e54a25ca18bec326f4fb33a013d74
Showing
1 changed file
with
9 additions
and
11 deletions
... | @@ -269,11 +269,6 @@ public class FlowObjectiveManager implements FlowObjectiveService { | ... | @@ -269,11 +269,6 @@ public class FlowObjectiveManager implements FlowObjectiveService { |
269 | */ | 269 | */ |
270 | private Pipeliner initPipelineHandler(DeviceId deviceId) { | 270 | private Pipeliner initPipelineHandler(DeviceId deviceId) { |
271 | start = now(); | 271 | start = now(); |
272 | - // ?? We never use defaultDriverService, do we still need this check? | ||
273 | - if (defaultDriverService == null) { | ||
274 | - // We're not ready to go to work yet. | ||
275 | - return null; | ||
276 | - } | ||
277 | 272 | ||
278 | // Attempt to lookup the handler in the cache | 273 | // Attempt to lookup the handler in the cache |
279 | DriverHandler handler = driverHandlers.get(deviceId); | 274 | DriverHandler handler = driverHandlers.get(deviceId); |
... | @@ -323,19 +318,22 @@ public class FlowObjectiveManager implements FlowObjectiveService { | ... | @@ -323,19 +318,22 @@ public class FlowObjectiveManager implements FlowObjectiveService { |
323 | getDevicePipeliner(event.subject().id()); | 318 | getDevicePipeliner(event.subject().id()); |
324 | } else { | 319 | } else { |
325 | log.debug("Device is no longer available {}", event.subject().id()); | 320 | log.debug("Device is no longer available {}", event.subject().id()); |
326 | - // evict Pipeliner cache. | ||
327 | - // User might restart Device to assign new Driver/Pipeliner | ||
328 | - // loaded afterwards. | ||
329 | - pipeliners.remove(event.subject().id()); | ||
330 | } | 321 | } |
331 | break; | 322 | break; |
332 | case DEVICE_UPDATED: | 323 | case DEVICE_UPDATED: |
333 | break; | 324 | break; |
334 | case DEVICE_REMOVED: | 325 | case DEVICE_REMOVED: |
335 | - case DEVICE_SUSPENDED: | 326 | + // evict Pipeliner and Handler cache, when |
336 | - // evict Pipeliner cache. | 327 | + // the Device was administratively removed. |
328 | + // | ||
329 | + // System expect the user to clear all existing flows, | ||
330 | + // before removing device, especially if they intend to | ||
331 | + // replace driver/pipeliner assigned to the device. | ||
332 | + driverHandlers.remove(event.subject().id()); | ||
337 | pipeliners.remove(event.subject().id()); | 333 | pipeliners.remove(event.subject().id()); |
338 | break; | 334 | break; |
335 | + case DEVICE_SUSPENDED: | ||
336 | + break; | ||
339 | case PORT_ADDED: | 337 | case PORT_ADDED: |
340 | break; | 338 | break; |
341 | case PORT_UPDATED: | 339 | case PORT_UPDATED: | ... | ... |
-
Please register or login to post a comment