Committed by
Gerrit Code Review
@ONOS-2379 Improve the efficiency of blackhole solution by reusing shortest path…
…s to the same src for each src/dst pair Change-Id: I680c94ce2693000acdd06b5d8d762219eb9a320f
Showing
1 changed file
with
9 additions
and
2 deletions
| ... | @@ -73,7 +73,9 @@ import org.osgi.service.component.ComponentContext; | ... | @@ -73,7 +73,9 @@ import org.osgi.service.component.ComponentContext; |
| 73 | import org.slf4j.Logger; | 73 | import org.slf4j.Logger; |
| 74 | 74 | ||
| 75 | import java.util.Dictionary; | 75 | import java.util.Dictionary; |
| 76 | +import java.util.HashMap; | ||
| 76 | import java.util.List; | 77 | import java.util.List; |
| 78 | +import java.util.Map; | ||
| 77 | import java.util.Objects; | 79 | import java.util.Objects; |
| 78 | import java.util.Set; | 80 | import java.util.Set; |
| 79 | 81 | ||
| ... | @@ -692,6 +694,8 @@ public class ReactiveForwarding { | ... | @@ -692,6 +694,8 @@ public class ReactiveForwarding { |
| 692 | Set<FlowEntry> rules = getFlowRulesFrom(egress); | 694 | Set<FlowEntry> rules = getFlowRulesFrom(egress); |
| 693 | Set<SrcDstPair> pairs = findSrcDstPairs(rules); | 695 | Set<SrcDstPair> pairs = findSrcDstPairs(rules); |
| 694 | 696 | ||
| 697 | + Map<DeviceId, Set<Path>> srcPaths = new HashMap<>(); | ||
| 698 | + | ||
| 695 | for (SrcDstPair sd: pairs) { | 699 | for (SrcDstPair sd: pairs) { |
| 696 | // get the edge deviceID for the src host | 700 | // get the edge deviceID for the src host |
| 697 | DeviceId srcId = hostService.getHost(HostId.hostId(sd.src)).location().deviceId(); | 701 | DeviceId srcId = hostService.getHost(HostId.hostId(sd.src)).location().deviceId(); |
| ... | @@ -700,8 +704,11 @@ public class ReactiveForwarding { | ... | @@ -700,8 +704,11 @@ public class ReactiveForwarding { |
| 700 | 704 | ||
| 701 | cleanFlowRules(sd, egress.deviceId()); | 705 | cleanFlowRules(sd, egress.deviceId()); |
| 702 | 706 | ||
| 703 | - Set<Path> shortestPaths = | 707 | + Set<Path> shortestPaths = srcPaths.get(srcId); |
| 704 | - topologyService.getPaths(topologyService.currentTopology(), egress.deviceId(), srcId); | 708 | + if (shortestPaths == null) { |
| 709 | + shortestPaths = topologyService.getPaths(topologyService.currentTopology(), egress.deviceId(), srcId); | ||
| 710 | + srcPaths.put(srcId, shortestPaths); | ||
| 711 | + } | ||
| 705 | backTrackBadNodes(shortestPaths, dstId, sd); | 712 | backTrackBadNodes(shortestPaths, dstId, sd); |
| 706 | } | 713 | } |
| 707 | } | 714 | } | ... | ... |
-
Please register or login to post a comment