Check that NFD and NLSR are running in all hosts before running experiments.
Added functionality to prevent minindn from running w/o dependencies.
ref #4562
Change-Id: Ib7a8544c9a981335d05f710023fb55a7995e0864
diff --git a/bin/minindn b/bin/minindn
index 78af1ff..676ae6d 100755
--- a/bin/minindn
+++ b/bin/minindn
@@ -445,6 +445,21 @@
print("Starting " + app + " on node " + host.name)
print(host.cmd(app))
+ # Determine if each host is running NFD and NLSR
+ for host in net.hosts:
+ nfdStatus = host.cmd("ps -g -U root | grep 'nfd --config {}/[n]fd.conf'".format(host.homeFolder))
+ nlsrStatus = host.cmd("ps -g | grep 'nlsr -f {}/[n]lsr.conf'".format(host.homeFolder))
+ if not host.nfd.isRunning or not nfdStatus:
+ print("NFD on host {} is not running. Printing log file and exiting...".format(host.name))
+ print(host.cmd("cat {}/nfd.log".format(host.homeFolder)))
+ net.stop()
+ sys.exit(1)
+ if (not host.nlsr.isRunning or not nlsrStatus) and options.isNlsrEnabled:
+ print("NLSR on host {} is not running. Printing log file and exiting...".format(host.name))
+ print(host.cmd("cat {}/log/nlsr.log".format(host.homeFolder)))
+ net.stop()
+ sys.exit(1)
+
# Load experiment
experimentName = options.experimentName
@@ -494,6 +509,17 @@
call(["sudo", "mn", "--clean"])
sys.exit(1)
+def verify_dependencies():
+ "Prevent MiniNDN from running without necessary dependencies"
+ dependencies = ["nfd", "nlsr", "infoedit", "ndnping", "ndnpingserver"]
+ devnull = open("/dev/null", "w")
+ # Checks that each program is in the system path
+ for program in dependencies:
+ if call(["which", program], stdout=devnull):
+ print("{} is missing from the system path! Exiting...".format(program))
+ sys.exit(1)
+ devnull.close()
+
if __name__ == '__main__':
hosts_conf = []
@@ -504,6 +530,7 @@
options = parse_args()
setLogLevel('info')
+ verify_dependencies()
try:
execute(options)