From 902d088c4586c4c8ab486370d029189ec0e02aac Mon Sep 17 00:00:00 2001 From: Quentin De Coninck Date: Wed, 24 Jun 2020 17:37:15 +0200 Subject: [PATCH] finalize project structure refactor --- mpPerf.py | 38 -------------------------------------- mpXpRunner.py => runner.py | 20 +++++++++++++++++++- 2 files changed, 19 insertions(+), 39 deletions(-) delete mode 100755 mpPerf.py rename mpXpRunner.py => runner.py (74%) diff --git a/mpPerf.py b/mpPerf.py deleted file mode 100755 index f93433b..0000000 --- a/mpPerf.py +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/python - -import sys, getopt -from mpXpRunner import MpXpRunner -from core.topo import Topo - -topoParamFile = None -xpParamFile = None -topoBuilder = "mininet" - -def printHelp(): - print("Help Menu") - -def parseArgs(argv): - global topoParamFile - global xpParamFile - try: - opts, args = getopt.getopt(argv, "ht:x:", ["topoParam=","xp="]) - except getopt.GetoptError: - printHelp() - sys.exit(1) - for opt, arg in opts: - if opt == "-h": - printHelp() - sys.exit(1) - elif opt in ("-x","--xp"): - xpParamFile = arg - elif opt in ("-t","--topoParam"): - print("hey") - topoParamFile = arg - if topoParamFile is None: - print("Missing the topo...") - printHelp() - sys.exit(1) - -if __name__ == '__main__': - parseArgs(sys.argv[1:]) - MpXpRunner(Topo.mininetBuilder, topoParamFile, xpParamFile) diff --git a/mpXpRunner.py b/runner.py similarity index 74% rename from mpXpRunner.py rename to runner.py index 09879fd..40a4a17 100644 --- a/mpXpRunner.py +++ b/runner.py @@ -1,3 +1,5 @@ +#!/usr/bin/python + from core.experience import Experience, ExperienceParameter, ExperienceParameter from core.topo import Topo, TopoParameter @@ -7,7 +9,7 @@ from experiences import EXPERIENCES from topos import TOPO_CONFIGS, TOPOS -class MpXpRunner: +class Runner(object): def __init__(self, builderType, topoParamFile, xpParamFile): self.defParamXp(xpParamFile) self.topoParam = TopoParameter(topoParamFile) @@ -55,3 +57,19 @@ class MpXpRunner: def stopTopo(self): self.Topo.stopNetwork() + + +if __name__ == '__main__': + import argparse + + parser = argparse.ArgumentParser( + description="Minitopo, a wrapper of Mininet to run multipath experiments") + + parser.add_argument("--topo_param_file", "-t", required=True, + help="path to the topo parameter file") + parser.add_argument("--experience_param_file", "-x", required=True, + help="path to the experience parameter file") + + args = parser.parse_args() + # XXX Currently, there is no alternate topo builder... + Runner(Topo.mininetBuilder, args.topo_param_file, args.experience_param_file) \ No newline at end of file