Sahil Lele
Committed by Gerrit Code Review

ONOS-2432 Fixed blackhole npe by only acting on src and dst hosts that are not null

Change-Id: Iae587a8b873b0d697bb6d723be2afafd9bb56de4
...@@ -698,18 +698,23 @@ public class ReactiveForwarding { ...@@ -698,18 +698,23 @@ public class ReactiveForwarding {
698 698
699 for (SrcDstPair sd : pairs) { 699 for (SrcDstPair sd : pairs) {
700 // get the edge deviceID for the src host 700 // get the edge deviceID for the src host
701 - DeviceId srcId = hostService.getHost(HostId.hostId(sd.src)).location().deviceId(); 701 + Host srcHost = hostService.getHost(HostId.hostId(sd.src));
702 - DeviceId dstId = hostService.getHost(HostId.hostId(sd.dst)).location().deviceId(); 702 + Host dstHost = hostService.getHost(HostId.hostId(sd.dst));
703 - log.trace("SRC ID is " + srcId + ", DST ID is " + dstId); 703 + if (srcHost != null && dstHost != null) {
704 - 704 + DeviceId srcId = srcHost.location().deviceId();
705 - cleanFlowRules(sd, egress.deviceId()); 705 + DeviceId dstId = dstHost.location().deviceId();
706 - 706 + log.trace("SRC ID is " + srcId + ", DST ID is " + dstId);
707 - Set<Path> shortestPaths = srcPaths.get(srcId); 707 +
708 - if (shortestPaths == null) { 708 + cleanFlowRules(sd, egress.deviceId());
709 - shortestPaths = topologyService.getPaths(topologyService.currentTopology(), egress.deviceId(), srcId); 709 +
710 - srcPaths.put(srcId, shortestPaths); 710 + Set<Path> shortestPaths = srcPaths.get(srcId);
711 + if (shortestPaths == null) {
712 + shortestPaths = topologyService.getPaths(topologyService.currentTopology(),
713 + egress.deviceId(), srcId);
714 + srcPaths.put(srcId, shortestPaths);
715 + }
716 + backTrackBadNodes(shortestPaths, dstId, sd);
711 } 717 }
712 - backTrackBadNodes(shortestPaths, dstId, sd);
713 } 718 }
714 } 719 }
715 720
......