Pier Ventre

[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
......@@ -662,6 +662,7 @@ public class DefaultRoutingHandler {
if (updatedEcmpSpgMap != null) {
updatedEcmpSpgMap.remove(deviceId);
}
this.populateRoutingRulesForLinkStatusChange(null);
}
private final class RetryFilters implements Runnable {
......
......@@ -693,6 +693,15 @@ public class SegmentRoutingManager implements SegmentRoutingService {
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 ||
......