Ashlesh Gawande | 501d4d6 | 2017-10-25 13:12:11 -0500 | [diff] [blame] | 1 | from ndn.experiments.experiment import Experiment |
| 2 | |
| 3 | class AbitraryArgumentsExperiment(Experiment): |
| 4 | def __init__(self, args): |
| 5 | Experiment.__init__(self, args) |
| 6 | if "ds" in self.arbArgs: |
| 7 | self.ds = int(self.arbArgs["ds"]) |
| 8 | else: |
| 9 | self.ds = 1000 |
| 10 | |
| 11 | if "logging" in self.arbArgs: |
| 12 | self.logging = self.arbArgs["logging"] |
| 13 | if self.logging == "true": |
| 14 | self.logging = True |
| 15 | else: |
| 16 | self.logging = False |
| 17 | else: |
| 18 | self.logging = False |
| 19 | |
| 20 | def setup(self): |
| 21 | pass |
| 22 | |
| 23 | def run(self): |
| 24 | print("Argument ds: {}".format(self.ds)) |
| 25 | print("Argument logging: {}".format(self.logging)) |
| 26 | |
| 27 | @staticmethod |
| 28 | def arguments(): |
| 29 | ''' This will be printed in sudo minindn --list-experiments''' |
| 30 | return "--ds <num-data-streams> --logging <true/false>" |
| 31 | |
| 32 | Experiment.register("arbitrary-arguments", AbitraryArgumentsExperiment) |