Pier Ventre
Committed by Charles Chan

[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
(cherry picked from commit 2c51531a)
...@@ -659,6 +659,7 @@ public class DefaultRoutingHandler { ...@@ -659,6 +659,7 @@ public class DefaultRoutingHandler {
659 if (updatedEcmpSpgMap != null) { 659 if (updatedEcmpSpgMap != null) {
660 updatedEcmpSpgMap.remove(deviceId); 660 updatedEcmpSpgMap.remove(deviceId);
661 } 661 }
662 + this.populateRoutingRulesForLinkStatusChange(null);
662 } 663 }
663 664
664 private final class RetryFilters implements Runnable { 665 private final class RetryFilters implements Runnable {
......
...@@ -692,6 +692,15 @@ public class SegmentRoutingManager implements SegmentRoutingService { ...@@ -692,6 +692,15 @@ public class SegmentRoutingManager implements SegmentRoutingService {
692 if (event.type() == LinkEvent.Type.LINK_ADDED) { 692 if (event.type() == LinkEvent.Type.LINK_ADDED) {
693 processLinkAdded((Link) event.subject()); 693 processLinkAdded((Link) event.subject());
694 } else if (event.type() == LinkEvent.Type.LINK_REMOVED) { 694 } else if (event.type() == LinkEvent.Type.LINK_REMOVED) {
695 + Link linkRemoved = (Link) event.subject();
696 + if (linkRemoved.src().elementId() instanceof DeviceId &&
697 + !deviceService.isAvailable(linkRemoved.src().deviceId())) {
698 + continue;
699 + }
700 + if (linkRemoved.dst().elementId() instanceof DeviceId &&
701 + !deviceService.isAvailable(linkRemoved.dst().deviceId())) {
702 + continue;
703 + }
695 processLinkRemoved((Link) event.subject()); 704 processLinkRemoved((Link) event.subject());
696 } else if (event.type() == DeviceEvent.Type.DEVICE_ADDED || 705 } else if (event.type() == DeviceEvent.Type.DEVICE_ADDED ||
697 event.type() == DeviceEvent.Type.DEVICE_AVAILABILITY_CHANGED || 706 event.type() == DeviceEvent.Type.DEVICE_AVAILABILITY_CHANGED ||
......