Fixes for CORD-2910, 2920, 2915

 - When dealing with possible fake links which tend to be unidirectional, do not
   update internal stores until bidirectionality is verified
 - When figuring out ECMPspg, do not use LinkService to figure out bidi egress
   links. Instead use linkHandlers seen-links
 - Prevent NPE in updatedEcmpSpg
 - Improve logic for bringing up downed dual-home host ports: any active uplink,
   not just the first one should re-enable ports

Change-Id: I4412578e72a6d441cacfa2e023870ceb7c7eab04
diff --git a/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java b/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
index 7a857ac..9544172 100644
--- a/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
+++ b/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
@@ -573,6 +573,7 @@
         return l2TunnelHandler.getL2Policies();
     }
 
+    @Override
     @Deprecated
     public L2TunnelHandler.Result addPseudowiresBulk(List<DefaultL2TunnelDescription> bulkPseudowires) {
 
@@ -1223,7 +1224,10 @@
         }
         // Note that a switch going down is associated with all of its links
         // going down as well, but it is treated as a single switch down event
-        // while the link-downs are ignored.
+        // while the link-downs are ignored. We cannot rely on the ordering of
+        // events - i.e we cannot expect all link-downs to come before the
+        // switch down - so we purge all seen-links for the switch before
+        // handling route-path changes for the switch-down
         defaultRoutingHandler
             .populateRoutingRulesForLinkStatusChange(null, null, device.id(), true);
         defaultRoutingHandler.purgeEcmpGraph(device.id());