finalize project structure refactor

This commit is contained in:
Quentin De Coninck 2020-06-24 17:37:15 +02:00
parent 8e7e89569b
commit 902d088c45
2 changed files with 19 additions and 39 deletions

View File

@ -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)

View File

@ -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)