Skip to content
Snippets Groups Projects
Commit 1563c89a authored by Geddings Barrineau's avatar Geddings Barrineau
Browse files

Added in the routecache. Similar to pathcache, routecache is computed by Yen's...

Added in the routecache. Similar to pathcache, routecache is computed by Yen's algorithm in the compute function. As the name implies, a routecache entry does not need to be built into a route, as it is already built. Future commits will involve replacing patchcache with the new routecache.
parent 903038e6
No related branches found
No related tags found
No related merge requests found
......@@ -106,6 +106,10 @@ public class TopologyInstance {
// in the cache.
private final PathCacheLoader pathCacheLoader = new PathCacheLoader(this);
protected LoadingCache<RouteId, Route> pathcache;
// routecache contains n (specified in floodlightdefault.properties) routes
// in order between every switch. Calculated using Yen's algorithm.
protected Map<RouteId, ArrayList<Route>> routecache;
public TopologyInstance(Map<DatapathId, Set<OFPort>> switchPorts,
Set<NodePortTuple> blockedPorts,
......@@ -196,6 +200,9 @@ public class TopologyInstance {
// Cost for tunnel links and direct links are the same.
calculateAllShortestPaths();
// Step 4.5 YENSSSSS
calculateAllOrderedRoutes();
// Compute the archipelagos (def: cluster of islands). An archipelago will
// simply be a group of connected islands. Each archipelago will have its own
// finiteBroadcastTree which will be randomly chosen.
......@@ -892,6 +899,25 @@ public class TopologyInstance {
// }
}
/*
Calculates and stores n possible routes (specified in floodlightdefault.properties) using Yen's algorithm,
looping through every switch.
These lists of routes are stored in routecache.
*/
protected void calculateAllOrderedRoutes() {
ArrayList<Route> routes;
RouteId routeId;
routecache.clear();
for (DatapathId src : switches) {
for (DatapathId dst : switches) {
routes = getRoutes(src, dst, 5); // Hard coded value needs to be replaced.
routeId = new RouteId(src, dst);
routecache.put(routeId, routes);
}
}
}
protected void calculateShortestPathTreeInClusters() {
pathcache.invalidateAll();
destinationRootedTrees.clear();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment