diff --git a/src/main/java/net/floodlightcontroller/topology/TopologyInstance.java b/src/main/java/net/floodlightcontroller/topology/TopologyInstance.java index d0e59b33f2c72bcb95cae31a49d1ae4198811f79..51398fd5c386a556af785687f27694ae3560b274 100644 --- a/src/main/java/net/floodlightcontroller/topology/TopologyInstance.java +++ b/src/main/java/net/floodlightcontroller/topology/TopologyInstance.java @@ -110,7 +110,7 @@ public class TopologyInstance { // routecache contains n (specified in floodlightdefault.properties) routes // in order between every switch. Calculated using Yen's algorithm. protected Map<RouteId, ArrayList<Route>> routecache; - protected static volatile int maximumRouteEntriesStored = 10; + protected int maximumRouteEntriesStored = 10; public TopologyInstance(Map<DatapathId, Set<OFPort>> switchPorts, Set<NodePortTuple> blockedPorts, @@ -174,6 +174,7 @@ public class TopologyInstance { }); this.routecache = new HashMap<RouteId, ArrayList<Route>>(); + this.maximumRouteEntriesStored = TopologyManager.maximumRouteEntriesStored; } diff --git a/src/main/java/net/floodlightcontroller/topology/TopologyManager.java b/src/main/java/net/floodlightcontroller/topology/TopologyManager.java index 95868eafd26a8b20a66b991e1702b41f1d40e9a2..a3e392f8dd8a1554afd7fb9ba3ef8b04d67aa65f 100644 --- a/src/main/java/net/floodlightcontroller/topology/TopologyManager.java +++ b/src/main/java/net/floodlightcontroller/topology/TopologyManager.java @@ -68,6 +68,11 @@ public class TopologyManager implements IFloodlightModule, ITopologyService, IRo protected static volatile ROUTE_METRIC routeMetric = ROUTE_METRIC.HOPCOUNT_AVOID_TUNNELS; //default: route on hop count protected static boolean collectStatistics = false; + /** + * Maximum number of route entries stored in memory. + */ + protected static volatile int maximumRouteEntriesStored = 10; + /** * Role of the controller. */ @@ -809,8 +814,13 @@ public class TopologyManager implements IFloodlightModule, ITopologyService, IRo break; } } - log.info("Route Metrics set to {}", routeMetric); + + String maxroutes = configOptions.get("maximumRouteEntriesStored") != null + ? configOptions.get("maximumRouteEntriesStored").trim() : null; + if (maxroutes != null) { + maximumRouteEntriesStored = Integer.parseInt(maxroutes); + } } @Override diff --git a/src/main/resources/floodlightdefault.properties b/src/main/resources/floodlightdefault.properties index 5b63cb1d74c86632bc2f40dbb182c5cfd7db43ac..971e9a0d12d46acbeacec4d89a68a993b48ab438 100644 --- a/src/main/resources/floodlightdefault.properties +++ b/src/main/resources/floodlightdefault.properties @@ -63,4 +63,5 @@ net.floodlightcontroller.restserver.RestApiServer.httpPort=11080 net.floodlightcontroller.restserver.RestApiServer.accessControlAllowAllOrigins=TRUE net.floodlightcontroller.statistics.StatisticsCollector.enable=FALSE net.floodlightcontroller.statistics.StatisticsCollector.collectionIntervalPortStatsSeconds=10 -net.floodlightcontroller.topology.TopologyManager.routeMetric=latency \ No newline at end of file +net.floodlightcontroller.topology.TopologyManager.routeMetric=latency +net.floodlightcontroller.topology.TopologyManager.maximumRouteEntriesStored=10 \ No newline at end of file