[CORD-438] Fix Segment Routing application
Changes:
- Discards Link events if one of the switch is down;
- Triggers the paths optimization after device-down event;
Change-Id: I4114f2450401e0d1ff5658d592daf319d977f20e
diff --git a/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java b/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
index fce63fe..72b6401 100644
--- a/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
+++ b/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
@@ -693,6 +693,15 @@
if (event.type() == LinkEvent.Type.LINK_ADDED) {
processLinkAdded((Link) event.subject());
} else if (event.type() == LinkEvent.Type.LINK_REMOVED) {
+ Link linkRemoved = (Link) event.subject();
+ if (linkRemoved.src().elementId() instanceof DeviceId &&
+ !deviceService.isAvailable(linkRemoved.src().deviceId())) {
+ continue;
+ }
+ if (linkRemoved.dst().elementId() instanceof DeviceId &&
+ !deviceService.isAvailable(linkRemoved.dst().deviceId())) {
+ continue;
+ }
processLinkRemoved((Link) event.subject());
} else if (event.type() == DeviceEvent.Type.DEVICE_ADDED ||
event.type() == DeviceEvent.Type.DEVICE_AVAILABILITY_CHANGED ||