Evict pipeliner/driver cache only on DEVICE_REMOVE

- step toward runtime driver reconfig

Change-Id: I55a9db9a6c2e54a25ca18bec326f4fb33a013d74
This commit is contained in:
Yuta HIGUCHI 2016-08-23 10:37:32 -07:00
parent 8ffb7759d3
commit ad0c990e6c

View File

@ -269,11 +269,6 @@ public class FlowObjectiveManager implements FlowObjectiveService {
*/ */
private Pipeliner initPipelineHandler(DeviceId deviceId) { private Pipeliner initPipelineHandler(DeviceId deviceId) {
start = now(); start = now();
// ?? We never use defaultDriverService, do we still need this check?
if (defaultDriverService == null) {
// We're not ready to go to work yet.
return null;
}
// Attempt to lookup the handler in the cache // Attempt to lookup the handler in the cache
DriverHandler handler = driverHandlers.get(deviceId); DriverHandler handler = driverHandlers.get(deviceId);
@ -323,19 +318,22 @@ public class FlowObjectiveManager implements FlowObjectiveService {
getDevicePipeliner(event.subject().id()); getDevicePipeliner(event.subject().id());
} else { } else {
log.debug("Device is no longer available {}", event.subject().id()); log.debug("Device is no longer available {}", event.subject().id());
// evict Pipeliner cache.
// User might restart Device to assign new Driver/Pipeliner
// loaded afterwards.
pipeliners.remove(event.subject().id());
} }
break; break;
case DEVICE_UPDATED: case DEVICE_UPDATED:
break; break;
case DEVICE_REMOVED: case DEVICE_REMOVED:
case DEVICE_SUSPENDED: // evict Pipeliner and Handler cache, when
// evict Pipeliner cache. // the Device was administratively removed.
//
// System expect the user to clear all existing flows,
// before removing device, especially if they intend to
// replace driver/pipeliner assigned to the device.
driverHandlers.remove(event.subject().id());
pipeliners.remove(event.subject().id()); pipeliners.remove(event.subject().id());
break; break;
case DEVICE_SUSPENDED:
break;
case PORT_ADDED: case PORT_ADDED:
break; break;
case PORT_UPDATED: case PORT_UPDATED: