Remove arbitrary arguments in favor of parsing arguments from experiment files.

refs: #4611

Change-Id: Ic668b58766fef8a1e537ccaacf82230b3fb50923
diff --git a/ndn/experiment_manager.py b/ndn/experiment_manager.py
index 5f2a174..d8ec0eb 100644
--- a/ndn/experiment_manager.py
+++ b/ndn/experiment_manager.py
@@ -35,7 +35,6 @@
 
     def __init__(self):
         self.experiments = {}
-        self.expArgs = {}
 
     def loadModules(self):
         currentDir = os.path.dirname(__file__)
@@ -52,12 +51,6 @@
     def register(self, name, experimentClass):
         if name not in self.experiments:
             self.experiments[name] = experimentClass
-            try:
-                helpStr = experimentClass.arguments()
-                if type(helpStr) is str:
-                    self.expArgs[name] = experimentClass.arguments()
-            except:
-                pass
         else:
             raise _ExperimentManager.Error("Experiment '%s' has already been registered" % name)
 
@@ -92,7 +85,9 @@
 
     return experimentNames
 
-def getExperimentArgs():
+def addExperimentArgs(parser):
+    # Find all experiment command line arguments and parse them.
     manager = __getInstance()
-
-    return manager.expArgs
+    for name in manager.experiments:
+        if hasattr(manager.experiments[name], "parseArguments"):
+            manager.experiments[name].parseArguments(parser)
\ No newline at end of file
diff --git a/ndn/experiments/arbitrary_arguments_experiment.py b/ndn/experiments/arbitrary_arguments_experiment.py
deleted file mode 100644
index 159e2a7..0000000
--- a/ndn/experiments/arbitrary_arguments_experiment.py
+++ /dev/null
@@ -1,32 +0,0 @@
-from ndn.experiments.experiment import Experiment
-
-class AbitraryArgumentsExperiment(Experiment):
-    def __init__(self, args):
-        Experiment.__init__(self, args)
-        if "ds" in self.arbArgs:
-            self.ds = int(self.arbArgs["ds"])
-        else:
-            self.ds = 1000
-
-        if "logging" in self.arbArgs:
-            self.logging = self.arbArgs["logging"]
-            if self.logging == "true":
-                self.logging = True
-            else:
-                self.logging = False
-        else:
-            self.logging = False
-
-    def setup(self):
-        pass
-
-    def run(self):
-        print("Argument ds: {}".format(self.ds))
-        print("Argument logging: {}".format(self.logging))
-
-    @staticmethod
-    def arguments():
-        ''' This will be printed in sudo minindn --list-experiments'''
-        return "--ds <num-data-streams> --logging <true/false>"
-
-Experiment.register("arbitrary-arguments", AbitraryArgumentsExperiment)
\ No newline at end of file
diff --git a/ndn/experiments/arguments_experiment.py b/ndn/experiments/arguments_experiment.py
new file mode 100644
index 0000000..e7ed6f9
--- /dev/null
+++ b/ndn/experiments/arguments_experiment.py
@@ -0,0 +1,23 @@
+from ndn.experiments.experiment import Experiment
+
+class ArgumentsExperiment(Experiment):
+    def __init__(self, args):
+        Experiment.__init__(self, args)
+        self.ds = self.arguments.ds
+        self.logging = self.arguments.logging
+
+    def setup(self):
+        pass
+
+    def run(self):
+        print("Argument ds: {}".format(self.ds))
+        print("Argument logging: {}".format(self.logging))
+
+    @staticmethod
+    def parseArguments(parser):
+        parser.add_argument("--ds", dest="ds", default="1000",
+                            help="[Arguments Experiment] Number of data streams")
+        parser.add_argument("--logging", dest="logging", action="store_true",
+                            help="[Arguments Experiment] Enable logging")
+
+Experiment.register("args-exp", ArgumentsExperiment)
\ No newline at end of file
diff --git a/ndn/experiments/experiment.py b/ndn/experiments/experiment.py
index 23efebd..5ada588 100644
--- a/ndn/experiments/experiment.py
+++ b/ndn/experiments/experiment.py
@@ -36,7 +36,7 @@
         self.strategy = args["strategy"]
         self.pctTraffic = args["pctTraffic"]
         self.nlsrSecurity = args["nlsrSecurity"]
-        self.arbArgs = args["arbArgs"]
+        self.arguments = args["arguments"]
 
         # Used to restart pings on the recovered node if any
         self.pingedDict = {}
@@ -148,4 +148,4 @@
 
     @staticmethod
     def register(name, experimentClass):
-        ExperimentManager.register(name, experimentClass)
+        ExperimentManager.register(name, experimentClass)
\ No newline at end of file