Add automatic NLSR security configuration

refs: #3050

Change-Id: I218f96a2cb11dd35de99c4a9eab056f0fed890aa
diff --git a/bin/minindn b/bin/minindn
index a9f0e9c..d70cc2f 100755
--- a/bin/minindn
+++ b/bin/minindn
@@ -1,8 +1,8 @@
 # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 #
-# Copyright (C) 2015 The University of Memphis,
-#                    Arizona Board of Regents,
-#                    Regents of the University of California.
+# Copyright (C) 2015-2016, The University of Memphis,
+#                          Arizona Board of Regents,
+#                          Regents of the University of California.
 #
 # This file is part of Mini-NDN.
 # See AUTHORS.md for a complete list of Mini-NDN authors and contributors.
@@ -104,6 +104,7 @@
         self.templateFile = "minindn.conf"
         self.hr = False
         self.isCliEnabled = True
+        self.nlsrSecurity = False
         self.nPings = 300
         self.testbed = False
         self.workDir = "/tmp"
@@ -161,6 +162,9 @@
     parser.add_option("--nPings", action="store", dest="nPings", type="int", default=300,
     help="Number of pings to perform between each node in the experiment")
 
+    parser.add_option("--nlsr-security", action="store_true", dest="nlsrSecurity", default=False,
+    help="Enables NLSR security")
+
     parser.add_option("-t", "--testbed", action="store_true", dest="testbed", default=False,
     help="instantiates NDN Testbed")
 
@@ -184,7 +188,9 @@
     options.nFaces = args.faces
     options.hr = args.hr
     options.isCliEnabled = args.isCliEnabled
+    options.nlsrSecurity = args.nlsrSecurity
     options.nPings = args.nPings
+
     options.testbed = args.testbed
     options.workDir = args.workDir
     options.resultDir = args.resultDir
@@ -308,6 +314,10 @@
 
     nodes = ""    # Used later to check prefix name in checkFIB
 
+    # NLSR Security
+    if options.nlsrSecurity is True:
+        Nlsr.createKeysAndCertificates(net, options.workDir)
+
     # NLSR initialization
     for host in net.hosts:
         nodes += str(host.name) + ","
@@ -322,7 +332,7 @@
             host.nlsrParameters["hyperbolic-state"] = "on"
 
         # Generate NLSR configuration file
-        configGenerator = NlsrConfigGenerator(host)
+        configGenerator = NlsrConfigGenerator(host, options.nlsrSecurity)
         configGenerator.createConfigFile()
 
         # Start NLSR