Allow use of NFD and NLSR PPA with Mini-NDN.
Refs: #3992
Change-Id: I329d0303bb4e03ec2296dfb7f7aa00cac3dadfbd
diff --git a/INSTALL.md b/INSTALL.md
index 69de126..f263972 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -1,40 +1,57 @@
-Mini-NDN Installing Instructions
+Mini-NDN Installation Instructions
================================
### What equipment will I need?
-Basically, you'll need a laptop/desktop with a recent Linux distro (Ubuntu, Fedora).
-We recommend Ubuntu. For this guide, the _Ubuntu 14.04 LTS_ was used.
-Also, note that you'll need administrative privileges in order to download and install
-extra packages and also to execute **Mini-NDN**.
+For this guide, you will need a laptop/desktop with a recent version
+of a Linux distro such as Ubuntu or any of its variants. Fedora is not
+officially supported but has also been reported to work for some
+users. For this guide, the _Ubuntu 18.04 LTS_ release was used.
+Also, note that you'll need administrative privileges in order to
+download and install extra packages and also to execute **Mini-NDN**.
### Installing **Mini-NDN**
+NOTE: Mini-NDN, while providing a high level of emulation of hosts,
+requires programs to be installed onto your computer. It will not work
+if they are not installed. If you do not want NDN software installed
+onto your computer, you can use a virtual machine, which can be quite
+simply set up with the provided vagrantfile.
+
If you have all the dependencies (see sections below) installed simply clone this repository and run:
./install.sh -i
-else if you don't have the dependencies, the following command will install them along with Mini-NDN:
+else if you don't have the dependencies, the following command will install them from source along with Mini-NDN:
./install.sh -a
-else if you want to install the dependencies manually, follow the instructions below:
+If you want to install the dependencies manually or from the Named Data PPA, follow the instructions below:
### Installing NDN
-Each node in **Mini-NDN** will run the official implementation of NDN. The following dependencies are needed:
+Each node in **Mini-NDN** will run the official implementation of NDN installed on your system. The following dependencies are needed:
Mini-NDN uses NFD, NLSR, and ndn-tools.
To install NFD:
-http://named-data.net/doc/NFD/current/INSTALL.html
+https://named-data.net/doc/NFD/current/INSTALL.html
To install NLSR:
-http://named-data.net/doc/NLSR/current/INSTALL.html
+https://named-data.net/doc/NLSR/current/INSTALL.html
To install ndn-tools:
https://github.com/named-data/ndn-tools
+Note that all three of these can be installed from the Named Data PPA. Instructions for setting it up can
+be found in the NFD insallation instructions. Note that PPA and installs from source **cannot** be mixed.
+
+###Special Instructions for PPA Installs
+
+If you are using a custom nfd.conf file in an experiment, you should place it in /usr/local/etc/ndn/
+rather than /etc/ndn/. This is to avoid a bug from the default configuration file for the PPA, which
+is incompatiable with Mini-NDN.
+
### Installing Mininet
**Mini-NDN** is based on Mininet. To install Mininet:
@@ -43,8 +60,8 @@
git clone --depth 1 https://github.com/mininet/mininet.git
-After Mininet source is on your system, run the following command to install
-Mininet core dependencies and Open vSwitch:
+After Mininet source is on your system, run the following command to
+install Mininet core dependencies and Open vSwitch:
./util/install.sh -nv
@@ -52,13 +69,15 @@
sudo mn --test pingall
-This will print out a series of statements that show the test setup and the results of the test. Look
-for `Results:` two-thirds of the way down where it will indicate the percentage of dropped packets.
+This will print out a series of statements that show the test setup
+and the results of the test. Look for `Results:` two-thirds of the way
+down where it will indicate the percentage of dropped packets.
Your results should show "0% dropped (2/2 received)".
### Installing Infoedit
-Infoedit is used to edit configuration files such as NFD configuration file.
+Infoedit is used to edit configuration files such as NFD configuration
+file.
To install infoedit:
https://github.com/NDN-Routing/infoedit
@@ -70,4 +89,4 @@
1. Issue the command: `sudo minindn --experiment=pingall --nPings=50`
2. When the `mini-ndn>` CLI prompt appears, the experiment has finished. On the Mini-NDN CLI, issue the command `exit` to exit the experiment.
3. Issue the command: `grep -c content /tmp/minindn/*/ping-data/*.txt`. Each file should report a count of 50.
-4. Issue the command: `grep -c timeout /tmp/minindn/*/ping-data/*.txt`. Each file should report a count of 0.
+4. Issue the command: `grep -c timeout /tmp/minindn/*/ping-data/*.txt`. Each file should report a count of 0.
\ No newline at end of file
diff --git a/bin/minindn b/bin/minindn
index 626b551..bd7c9fd 100755
--- a/bin/minindn
+++ b/bin/minindn
@@ -505,13 +505,10 @@
setLogLevel('info')
- # No exceptions are raised in ndn presently, and Mininet relies
- # on generic Exception. If this situation changes this may well
- # need to be altered.
try:
execute(options)
except Exception as e:
- print("Mininet Error: {}".format(e))
+ print("Error: {}".format(e))
call(["nfd-stop"])
call(["sudo", "mn", "--clean"])
- sys.exit(1)
+ sys.exit(1)
\ No newline at end of file
diff --git a/ndn/nfd.py b/ndn/nfd.py
index 09e28d5..480e320 100644
--- a/ndn/nfd.py
+++ b/ndn/nfd.py
@@ -23,6 +23,7 @@
import time, sys, os
from ndn.ndn_application import NdnApplication
+from ndn.util import copyExistentFile
class Nfd(NdnApplication):
STRATEGY_BEST_ROUTE = "best-route"
@@ -39,15 +40,11 @@
self.ndnFolder = "{}/.ndn".format(node.homeFolder)
self.clientConf = "{}/client.conf".format(self.ndnFolder)
- # Copy nfd.conf file from /usr/local/etc/ndn to the node's home
-
+ # Copy nfd.conf file from /usr/local/etc/ndn or /etc/ndn to the node's home directory
# Use nfd.conf as default configuration for NFD, else use the sample
- if os.path.isfile("/usr/local/etc/ndn/nfd.conf") == True:
- node.cmd("sudo cp /usr/local/etc/ndn/nfd.conf {}".format(self.confFile))
- elif os.path.isfile("/usr/local/etc/ndn/nfd.conf.sample") == True:
- node.cmd("sudo cp /usr/local/etc/ndn/nfd.conf.sample {}".format(self.confFile))
- else:
- sys.exit("nfd.conf or nfd.conf.sample cannot be found in the expected directory. Exit.")
+ possibleConfPaths = ["/usr/local/etc/ndn/nfd.conf.sample", "/usr/local/etc/ndn/nfd.conf",
+ "/etc/ndn/nfd.conf.sample", "/etc/ndn/nfd.conf"]
+ copyExistentFile(node, possibleConfPaths, self.confFile)
# Set log level
node.cmd("infoedit -f {} -s log.default_level -v {}".format(self.confFile, self.logLevel))
@@ -60,9 +57,11 @@
# Make NDN folder
node.cmd("sudo mkdir {}".format(self.ndnFolder))
- # Copy the client.conf file and change the unix socket
- node.cmd("sudo cp /usr/local/etc/ndn/client.conf.sample {}".format(self.clientConf))
+ # Copy client configuration to host
+ possibleClientConfPaths = ["/usr/local/etc/ndn/client.conf.sample", "/etc/ndn/client.conf.sample"]
+ copyExistentFile(node, possibleClientConfPaths, self.clientConf)
+ # Change the unix socket
node.cmd("sudo sed -i 's|nfd.sock|{}.sock|g' {}".format(node.name, self.clientConf))
# Change home folder
@@ -75,4 +74,4 @@
def setStrategy(self, name, strategy):
self.node.cmd("nfdc strategy set {} ndn:/localhost/nfd/strategy/{}".format(name, strategy))
- time.sleep(0.5)
+ time.sleep(0.5)
\ No newline at end of file
diff --git a/ndn/nlsr.py b/ndn/nlsr.py
index ab3c648..6c5572e 100644
--- a/ndn/nlsr.py
+++ b/ndn/nlsr.py
@@ -25,7 +25,7 @@
from mininet.examples.cluster import RemoteMixin
from ndn.ndn_application import NdnApplication
-from ndn.util import ssh, scp
+from ndn.util import ssh, scp, copyExistentFile
import shutil
import os
@@ -78,7 +78,7 @@
# Create root certificate
rootName = NETWORK
sh("ndnsec-keygen {}".format(rootName)) # Installs a self-signed cert into the system
- sh("ndnsec-cert-dump -i {} > {}/root.cert".format(rootName, securityDir, securityDir))
+ sh("ndnsec-cert-dump -i {} > {}/root.cert".format(rootName, securityDir))
# Create necessary certificates for each site
for host in net.hosts:
@@ -154,7 +154,8 @@
self.hyperRadius = parameters.get("radius", 0.0)
self.hyperAngle = parameters.get("angle", 0.0)
self.neighborIPs = []
- self.node.cmd("sudo cp /usr/local/etc/ndn/nlsr.conf.sample nlsr.conf")
+ possibleConfPaths = ["/usr/local/etc/ndn/nlsr.conf.sample", "/etc/ndn/nlsr.conf.sample"]
+ copyExistentFile(node, possibleConfPaths, "{}/nlsr.conf".format(self.node.homeFolder))
def createConfigFile(self):
diff --git a/ndn/util.py b/ndn/util.py
index 7ccf5d0..0ed570d 100644
--- a/ndn/util.py
+++ b/ndn/util.py
@@ -24,6 +24,7 @@
from subprocess import call
from mininet.cli import CLI
import sys
+from os.path import isfile
sshbase = [ 'ssh', '-q', '-t', '-i/home/mininet/.ssh/id_rsa' ]
scpbase = [ 'scp', '-i', '/home/mininet/.ssh/id_rsa' ]
@@ -40,6 +41,16 @@
rcmd = scpbase + tmp
call(rcmd, stdout=devnull, stderr=devnull)
+def copyExistentFile(node, fileList, destination):
+ for file in fileList:
+ if isfile(file):
+ node.cmd("cp {} {}".format(file, destination))
+ break
+ if not isfile(destination):
+ fileName = destination.split("/")[-1]
+ raise IOError("{} not found in expected directory.".format(fileName))
+
+
class MiniNDNCLI(CLI):
prompt = 'mini-ndn> '
def __init__(self, mininet, stdin=sys.stdin, script=None):