Set NFD logging level from GUI
refs: #2913
Change-Id: I4255b0467ef8ee6c4a2803ed078256cac9fbfd9c
diff --git a/bin/minindn b/bin/minindn
index e5305e9..2699bfd 100755
--- a/bin/minindn
+++ b/bin/minindn
@@ -110,7 +110,7 @@
for host in hosts_conf:
if host.cpu != None and self.isLimited != True:
self.isLimited = True
- self.addHost(host.name, app=host.app, fib=host.uri_tuples,cpu=host.cpu,cores=host.cores,cache=host.cache)
+ self.addHost(host.name, app=host.app, params=host.uri_tuples, cpu=host.cpu,cores=host.cores,cache=host.cache)
for link in links_conf:
if len(link.linkDict) == 0:
diff --git a/bin/minindnedit b/bin/minindnedit
index 73c1305..c6e4945 100755
--- a/bin/minindnedit
+++ b/bin/minindnedit
@@ -245,6 +245,7 @@
'hostname':self.hostnameEntry.get(),
'startCommand':self.startEntry.get(),
'fibEntries':fibEntries,
+ 'nfd': self.nfdFrame.getValues(),
'nlsr': self.nlsrFrame.getValues()
}
@@ -735,6 +736,10 @@
template.write('site=' + values['site'] + ' ')
template.write('nlsr-log-level=' + values['log-level'] + ' ')
template.write('max-faces-per-prefix=' + values['max-faces-per-prefix'] + ' ')
+ if 'nfd' in hOpts:
+ values = hOpts['nfd']
+
+ template.write('nfd-log-level=' + values['log-level'] + ' ')
template.write('\n')
@@ -1365,6 +1370,7 @@
newHostOpts['fibEntries'] = hostBox.result['fibEntries']
newHostOpts['nlsr'] = hostBox.nlsrFrame.getValues()
+ newHostOpts['nfd'] = hostBox.nfdFrame.getValues()
self.hostOpts[name] = newHostOpts
diff --git a/ndn/conf_parser.py b/ndn/conf_parser.py
index 62cc8fa..395c6d7 100644
--- a/ndn/conf_parser.py
+++ b/ndn/conf_parser.py
@@ -6,6 +6,7 @@
self.name = name
self.app = app
self.uri_tuples = params
+ self.params = params
self.cpu = cpu
self.cores = cores
self.cache = cache
diff --git a/ndn/gui.py b/ndn/gui.py
index c4097e4..653dbbc 100644
--- a/ndn/gui.py
+++ b/ndn/gui.py
@@ -48,6 +48,12 @@
self.logLevel = StringVar(self)
self.addDropDown("Log level:", self.logLevel, LOG_LEVELS, LOG_LEVELS[3])
+ def getValues(self):
+ return {
+ "log-level": self.logLevel.get()
+ }
+
+
class NlsrFrame(GuiFrame):
HYPERBOLIC_STATES = [
diff --git a/ndn/nfd.py b/ndn/nfd.py
index 6fea538..817e8d9 100644
--- a/ndn/nfd.py
+++ b/ndn/nfd.py
@@ -10,6 +10,8 @@
self.node = node
self.isRunning = False
+ self.logLevel = node.params["params"].get("nfd-log-level", "NONE")
+
# Create home directory for a node
node.cmd("cd /tmp && mkdir %s" % node.name)
node.cmd("cd %s" % node.name)
@@ -24,6 +26,9 @@
# Copy nfd.conf file from /usr/local/etc/mini-ndn to the node's home
node.cmd("sudo cp /usr/local/etc/mini-ndn/nfd.conf %s" % self.confFile)
+ # Set log level
+ node.cmd("sudo sed -i \'s|$LOG_LEVEL|%s|g\' %s" % (self.logLevel, self.confFile))
+
# Open the conf file and change socket file name
node.cmd("sudo sed -i 's|nfd.sock|%s.sock|g' %s" % (node.name, self.confFile))
diff --git a/ndn_utils/nfd.conf b/ndn_utils/nfd.conf
index ffb1f5c..246dc78 100644
--- a/ndn_utils/nfd.conf
+++ b/ndn_utils/nfd.conf
@@ -25,7 +25,7 @@
; TRACE ; trace messages (most verbose)
; ALL ; all messages
- default_level NONE
+ default_level $LOG_LEVEL
; You may override default_level by assigning a logging level
; to the desired module name. Module names can be found in two ways: