nfd: add option to set CS size

Don't append NFD logs b/w runs
Re-factor NFD start from ndn_host.py to bin/minindn

refs: #4469, #4508

Change-Id: I43f594a3353bb92101a0281a4561999cd8406707
This commit is contained in:
Ashlesh Gawande committed 2018-03-29 12:31:03 -05:00
1 parent 5f8c796609
commit 532302bbf2
9 files changed
+31 -17

No files matched your search

+13 -1
View File
@@ -130,6 +130,7 @@ class ProgramOptions:
self.tunnelType = None
self.faceType = "udp"
self.arbArgs = {}
self.csSize = 65536
def createResultsDir(resultDir, faces, rType):
if faces == 0:
@@ -154,7 +155,7 @@ def parse_args():
# nargs='?' required here since optional argument
parser.add_argument('tempfile', nargs='?', default=INSTALL_DIR + 'default-topology.conf',
help="If no template_file is given, ndn_utils/default-topology.conf (given sample file) will be used.")
help="If no template_file is given, topologies/default-topology.conf (given sample file) will be used.")
parser.add_argument("--ctime", type=int, default=60,
help="Specify convergence time for the topology (Default: 60 seconds)")
@@ -215,6 +216,9 @@ def parse_args():
parser.add_argument("--face-type", dest='faceType', default='udp', choices=['udp', 'tcp'])
parser.add_argument("--cs-size", dest='csSize', type=int, default=65536,
help="Set CS size in NFD's conf file")
args, unknownArgs = parser.parse_known_args()
unknownArgsList = []
@@ -245,6 +249,7 @@ def parse_args():
options.tunnelType = args.tunnelType
options.placeList = args.placeList
options.faceType = args.faceType
options.csSize = args.csSize
for k in args.__dict__:
if k in unknownArgsList:
@@ -402,6 +407,12 @@ def execute(options):
node2.setIP(ipStr(ipParse(ndnNetBase) + 2) + '/30', intf=link.intf2)
ndnNetBase = ipStr(ipParse(ndnNetBase) + 4)
time.sleep(2)
info('Starting NFD on nodes\n')
for host in net.hosts:
host.nfd = Nfd(host, options.csSize)
host.nfd.start()
if options.isNlsrEnabled is True:
# NLSR Security
@@ -409,6 +420,7 @@ def execute(options):
Nlsr.createKeysAndCertificates(net, options.workDir)
# NLSR initialization
info('Starting NLSR on nodes\n')
for host in net.hosts:
conf = next(x for x in hosts_conf if x.name == host.name)
host.nlsrParameters = conf.nlsrParameters
+4 -4
View File
@@ -204,10 +204,10 @@ function minindn {
install_dir="/usr/local/etc/mini-ndn/"
sudo mkdir -p "$install_dir"
sudo cp ndn_utils/topologies/default-topology.conf "$install_dir"
sudo cp ndn_utils/topologies/minindn.caida.conf "$install_dir"
sudo cp ndn_utils/topologies/minindn.ucla.conf "$install_dir"
sudo cp ndn_utils/topologies/minindn.testbed.conf "$install_dir"
sudo cp topologies/default-topology.conf "$install_dir"
sudo cp topologies/minindn.caida.conf "$install_dir"
sudo cp topologies/minindn.ucla.conf "$install_dir"
sudo cp topologies/minindn.testbed.conf "$install_dir"
sudo python setup.py clean --all install
}
+2 -2
View File
@@ -43,7 +43,7 @@ class NdnApplication:
self.isRunning = True
def stop(self):
if self.isRunning:
self.node.cmd("sudo kill %s" % self.processId)
if self.isRunning and self.processId != "":
self.node.cmd("sudo kill {}".format(self.processId))
self.isRunning = False
+7 -7
View File
@@ -100,8 +100,7 @@ class NdnHost(Host, NdnHostCommon):
self.cmd("mkdir -p %s" % self.homeFolder)
self.cmd("cd %s" % self.homeFolder)
self.nfd = Nfd(self)
self.nfd.start()
self.nfd = None
self.peerList = {}
@@ -116,7 +115,8 @@ class NdnHost(Host, NdnHostCommon):
def terminate(self):
"Stop node."
self.nfd.stop()
if self.nfd is not None:
self.nfd.stop()
Host.terminate(self)
class CpuLimitedNdnHost(CPULimitedHost, NdnHostCommon):
@@ -134,8 +134,7 @@ class CpuLimitedNdnHost(CPULimitedHost, NdnHostCommon):
self.cmd("mkdir -p %s" % self.homeFolder)
self.cmd("cd %s" % self.homeFolder)
self.nfd = Nfd(self)
self.nfd.start()
self.nfd = None
self.peerList = {}
@@ -150,8 +149,9 @@ class CpuLimitedNdnHost(CPULimitedHost, NdnHostCommon):
def terminate(self):
"Stop node."
self.nfd.stop()
Host.terminate(self)
if self.nfd is not None:
self.nfd.stop()
CPULimitedHost.terminate(self)
class RemoteNdnHost(RemoteMixin, NdnHost):
"A node on a remote server"
+5 -3
View File
@@ -24,12 +24,11 @@
import time, sys, os
from ndn.ndn_application import NdnApplication
class Nfd(NdnApplication):
STRATEGY_BEST_ROUTE = "best-route"
STRATEGY_NCC = "ncc"
def __init__(self, node):
def __init__(self, node, csSize):
NdnApplication.__init__(self, node)
self.logLevel = node.params["params"].get("nfd-log-level", "INFO")
@@ -55,6 +54,9 @@ class Nfd(NdnApplication):
# Open the conf file and change socket file name
node.cmd("infoedit -f {} -s face_system.unix.path -v /var/run/{}.sock".format(self.confFile, node.name))
# Set CS size
node.cmd("infoedit -f {} -s tables.cs_max_packets -v {}".format(self.confFile, csSize))
# Make NDN folder
node.cmd("sudo mkdir {}".format(self.ndnFolder))
@@ -68,7 +70,7 @@ class Nfd(NdnApplication):
node.cmd("ndnsec-keygen /localhost/operator | ndnsec-install-cert -")
def start(self):
NdnApplication.start(self, "setsid nfd --config {} >> {} 2>&1 &".format(self.confFile, self.logFile))
NdnApplication.start(self, "setsid nfd --config {} > {} 2>&1 &".format(self.confFile, self.logFile))
time.sleep(2)
def setStrategy(self, name, strategy):
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.