Objective tracker doesn't need to react to port events
Ported from onos-1.2 branch.
Change-Id: I73ce4d09a0d8f9ba24d335798187de83f515d5a1
(cherry picked from commit e0ec88bda3e1002a4d27316ea1d01ddf27e68da1)
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/ObjectiveTracker.java b/core/net/src/main/java/org/onosproject/net/intent/impl/ObjectiveTracker.java
index bfbb479..6ec60d7 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/ObjectiveTracker.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/ObjectiveTracker.java
@@ -390,19 +390,27 @@
@Override
public void event(DeviceEvent event) {
DeviceEvent.Type type = event.type();
- if (type == DeviceEvent.Type.PORT_ADDED ||
- type == DeviceEvent.Type.PORT_UPDATED ||
- type == DeviceEvent.Type.PORT_REMOVED) {
- // skip port events for now
- return;
+ switch (type) {
+ case DEVICE_ADDED:
+ case DEVICE_AVAILABILITY_CHANGED:
+ case DEVICE_REMOVED:
+ case DEVICE_SUSPENDED:
+ case DEVICE_UPDATED:
+ DeviceId id = event.subject().id();
+ // TODO we need to check whether AVAILABILITY_CHANGED means up or down
+ boolean available = (type == DeviceEvent.Type.DEVICE_AVAILABILITY_CHANGED ||
+ type == DeviceEvent.Type.DEVICE_ADDED ||
+ type == DeviceEvent.Type.DEVICE_UPDATED);
+ executorService.execute(new DeviceAvailabilityHandler(id, available));
+ break;
+ case PORT_ADDED:
+ case PORT_REMOVED:
+ case PORT_UPDATED:
+ case PORT_STATS_UPDATED:
+ default:
+ // Don't handle port events for now
+ break;
}
- DeviceId id = event.subject().id();
- // TODO we need to check whether AVAILABILITY_CHANGED means up or down
- boolean available = (type == DeviceEvent.Type.DEVICE_AVAILABILITY_CHANGED ||
- type == DeviceEvent.Type.DEVICE_ADDED ||
- type == DeviceEvent.Type.DEVICE_UPDATED);
- executorService.execute(new DeviceAvailabilityHandler(id, available));
-
}
}