add XpRunner
organisation and start for xp Signed-off-by: Benjamin Hesmans <benjamin.hesmans@uclouvain.be>
This commit is contained in:
parent
9f2ce22e96
commit
7e373bbad5
9
src/conf/xp/0_iperf_1
Normal file
9
src/conf/xp/0_iperf_1
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#option to dvlp are commented but already there.
|
||||||
|
#kCommit:aaaa
|
||||||
|
#pmCommit:bbb
|
||||||
|
#sysctl:mem,x y z
|
||||||
|
#sysctl:rmem,x y z
|
||||||
|
#sysctl:wmem,x y z
|
||||||
|
xpType:iperf
|
||||||
|
size:10M
|
||||||
|
|
@ -1,21 +1,21 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
import sys, getopt
|
import sys, getopt
|
||||||
from mpParamTopo import MpParamTopo
|
from mpXpRunner import MpXpRunner
|
||||||
from mpMultiInterfaceTopo import MpMultiInterfaceTopo
|
from mpTopo import MpTopo
|
||||||
from mpMultiInterfaceConfig import MpMultiInterfaceConfig
|
|
||||||
from mpMininetBuilder import MpMininetBuilder
|
|
||||||
|
|
||||||
topoParamFile = None
|
topoParamFile = None
|
||||||
topoType = "mininet"
|
xpParamFile = None
|
||||||
|
topoBuilder = "mininet"
|
||||||
|
|
||||||
def printHelp():
|
def printHelp():
|
||||||
print("Help Menu")
|
print("Help Menu")
|
||||||
|
|
||||||
def parseArgs(argv):
|
def parseArgs(argv):
|
||||||
global topoParamFile
|
global topoParamFile
|
||||||
|
global xpParamFile
|
||||||
try:
|
try:
|
||||||
opts, args = getopt.getopt(argv, "hf:", ["topoParam="])
|
opts, args = getopt.getopt(argv, "ht:x:", ["topoParam=","xp="])
|
||||||
except getopt.GetoptError:
|
except getopt.GetoptError:
|
||||||
printHelp()
|
printHelp()
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
@ -23,28 +23,16 @@ def parseArgs(argv):
|
|||||||
if opt == "-h":
|
if opt == "-h":
|
||||||
printHelp()
|
printHelp()
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
elif opt in ("-f","--topoParam"):
|
elif opt in ("-x","--xp"):
|
||||||
print("hllo", arg);
|
xpParamFile = arg
|
||||||
|
elif opt in ("-t","--topoParam"):
|
||||||
|
print("hey")
|
||||||
topoParamFile = arg
|
topoParamFile = arg
|
||||||
|
if topoParamFile is None:
|
||||||
|
print("Missing the topo...")
|
||||||
|
printHelp()
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
parseArgs(sys.argv[1:])
|
parseArgs(sys.argv[1:])
|
||||||
if topoParamFile is None:
|
MpXpRunner(MpTopo.mininetBuilder, topoParamFile, xpParamFile)
|
||||||
print("Use command line param")
|
|
||||||
else:
|
|
||||||
param = MpParamTopo(topoParamFile)
|
|
||||||
|
|
||||||
if topoType == "mininet":
|
|
||||||
if param.getParam('topoType') == "MultiIf":
|
|
||||||
mpTopo = MpMultiInterfaceTopo(MpMininetBuilder(), param)
|
|
||||||
mpConfig = MpMultiInterfaceConfig(mpTopo, param)
|
|
||||||
mpTopo.startNetwork()
|
|
||||||
mpConfig.configureNetwork()
|
|
||||||
mpConfig.pingAllFromClient()
|
|
||||||
mpTopo.getCLI()
|
|
||||||
mpTopo.stopNetwork()
|
|
||||||
else:
|
|
||||||
print("Unrecognized topo type")
|
|
||||||
print(mpTopo)
|
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
class MpTopo:
|
class MpTopo:
|
||||||
|
mininetBuilder = "mininet"
|
||||||
|
multiIfTopo = "MultiIf"
|
||||||
|
topoAttr = "topoType"
|
||||||
switchNamePrefix = "s"
|
switchNamePrefix = "s"
|
||||||
clientName = "Client"
|
clientName = "Client"
|
||||||
serverName = "Server"
|
serverName = "Server"
|
||||||
|
48
src/mpXpRunner.py
Normal file
48
src/mpXpRunner.py
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
from mpTopo import MpTopo
|
||||||
|
from mpParamTopo import MpParamTopo
|
||||||
|
from mpMultiInterfaceTopo import MpMultiInterfaceTopo
|
||||||
|
from mpMultiInterfaceConfig import MpMultiInterfaceConfig
|
||||||
|
from mpMininetBuilder import MpMininetBuilder
|
||||||
|
|
||||||
|
class MpXpRunner:
|
||||||
|
def __init__(self, builderType, topoParamFile, xpParamFile):
|
||||||
|
self.topoParam = MpParamTopo(topoParamFile)
|
||||||
|
self.defBuilder(builderType)
|
||||||
|
self.defTopo()
|
||||||
|
self.defConfig()
|
||||||
|
self.startTopo()
|
||||||
|
self.runXp(xpParamFile)
|
||||||
|
self.stopTopo()
|
||||||
|
|
||||||
|
def defBuilder(self, builderType):
|
||||||
|
if builderType == MpTopo.mininetBuilder:
|
||||||
|
self.topoBuilder = MpMininetBuilder()
|
||||||
|
else:
|
||||||
|
raise Exception("I can not find the builder " +
|
||||||
|
builderType)
|
||||||
|
def defTopo(self):
|
||||||
|
t = self.topoParam.getParam(MpTopo.topoAttr)
|
||||||
|
if t == MpTopo.multiIfTopo:
|
||||||
|
self.mpTopo = MpMultiInterfaceTopo(self.topoBuilder,
|
||||||
|
self.topoParam)
|
||||||
|
else:
|
||||||
|
raise Exception("Unfound Topo" + t)
|
||||||
|
print(self.mpTopo)
|
||||||
|
|
||||||
|
def defConfig(self):
|
||||||
|
self.mpTopoConfig = MpMultiInterfaceConfig(self.mpTopo,
|
||||||
|
self.topoParam)
|
||||||
|
|
||||||
|
def startTopo(self):
|
||||||
|
self.mpTopo.startNetwork()
|
||||||
|
self.mpTopoConfig.configureNetwork()
|
||||||
|
|
||||||
|
def runXp(self, xpParamFile):
|
||||||
|
if xpParamFile is None:
|
||||||
|
self.mpTopoConfig.pingAllFromClient()
|
||||||
|
self.mpTopo.getCLI()
|
||||||
|
else:
|
||||||
|
raise Exception("TODO")
|
||||||
|
|
||||||
|
def stopTopo(self):
|
||||||
|
self.mpTopo.stopNetwork()
|
Loading…
Reference in New Issue
Block a user