Add static routes to NFDs in parallel

This allows setting up static routing in large
topologies in a reasonable time. Some timer values
are also reduced, seems to work fine to me

Change-Id: I112cfd216615a100db6dc18182db40ba614d83e6
This commit is contained in:
Varun Patil authored and Saurab Dulal committed 2022-07-28 14:29:12 -07:00
1 parent d8e6b8e508
commit 63a330d317
4 files changed
+19 -6

No files matched your search

+1 -1
View File
@@ -72,4 +72,4 @@ class Nfd(Application):
def start(self): def start(self):
Application.start(self, 'nfd --config {}'.format(self.confFile), logfile=self.logFile) Application.start(self, 'nfd --config {}'.format(self.confFile), logfile=self.logFile)
Minindn.sleep(2) Minindn.sleep(0.5)
+14 -4
View File
@@ -34,6 +34,7 @@ import json
import operator import operator
from collections import defaultdict from collections import defaultdict
from tqdm import tqdm from tqdm import tqdm
from joblib import Parallel, delayed
from mininet.log import info, debug, error, warn from mininet.log import info, debug, error, warn
from minindn.helpers.nfdc import Nfdc as nfdc from minindn.helpers.nfdc import Nfdc as nfdc
@@ -295,13 +296,22 @@ class NdnRoutingHelper(object):
def globalRoutingHelperHandler(self): def globalRoutingHelperHandler(self):
info('Creating faces and adding routes to FIB\n') info('Creating faces and adding routes to FIB\n')
for host in tqdm(self.net.hosts):
neighborIPs = self.getNeighbor(host) res = Parallel(n_jobs=-1, require='sharedmem',
self.createFaces(host, neighborIPs) prefer="threads")(delayed(self.addNodeRoutes)(host) for host in tqdm(self.net.hosts))
self.routeAdd(host, neighborIPs)
info('Processed all the routes to NFD\n') info('Processed all the routes to NFD\n')
def addNodeRoutes(self, node):
"""
Create faces to neighbors and add all routes for one node
:param Node node: Node from net object
"""
neighborIPs = self.getNeighbor(node)
self.createFaces(node, neighborIPs)
self.routeAdd(node, neighborIPs)
def addOrigin(self, nodes, prefix): def addOrigin(self, nodes, prefix):
""" """
Add prefix/s as origin on node/s Add prefix/s as origin on node/s
+3 -1
View File
@@ -24,7 +24,9 @@
from mininet.log import debug from mininet.log import debug
from minindn.minindn import Minindn from minindn.minindn import Minindn
SLEEP_TIME = 0.2 # If needed (e.g. to speed up the process), use a smaller (or larger value)
# based on your machines resource (CPU, memory)
SLEEP_TIME = 0.1
class Nfdc(object): class Nfdc(object):
STRATEGY_ASF = 'asf' STRATEGY_ASF = 'asf'
+1
View File
@@ -1,3 +1,4 @@
python-igraph python-igraph
setuptools setuptools
tqdm tqdm
joblib