2015-01-08 11:04:42 +00:00
|
|
|
from mpTopo import MpTopo
|
|
|
|
from mpParamTopo import MpParamTopo
|
2015-01-08 18:52:45 +00:00
|
|
|
from mpParamXp import MpParamXp
|
2015-01-08 11:04:42 +00:00
|
|
|
from mpMultiInterfaceTopo import MpMultiInterfaceTopo
|
|
|
|
from mpMultiInterfaceConfig import MpMultiInterfaceConfig
|
2015-01-12 11:26:54 +00:00
|
|
|
from mpECMPSingleInterfaceConfig import MpECMPSingleInterfaceConfig
|
2015-01-08 11:04:42 +00:00
|
|
|
from mpMininetBuilder import MpMininetBuilder
|
2015-01-08 18:52:45 +00:00
|
|
|
from mpExperiencePing import MpExperiencePing
|
2015-01-12 15:34:41 +00:00
|
|
|
from mpExperienceNCPV import MpExperienceNCPV
|
2015-02-27 10:16:01 +00:00
|
|
|
from mpExperienceNC import MpExperienceNC
|
2015-08-14 22:34:27 +00:00
|
|
|
from mpExperienceHTTPS import MpExperienceHTTPS
|
2015-12-01 16:48:32 +00:00
|
|
|
from mpExperienceHTTP import MpExperienceHTTP
|
2015-11-05 14:06:30 +00:00
|
|
|
from mpExperienceEpload import MpExperienceEpload
|
2015-12-02 09:22:57 +00:00
|
|
|
from mpExperienceNetperf import MpExperienceNetperf
|
2015-03-05 10:37:50 +00:00
|
|
|
from mpExperienceNone import MpExperienceNone
|
2015-01-08 18:52:45 +00:00
|
|
|
from mpExperience import MpExperience
|
2015-01-12 11:26:54 +00:00
|
|
|
from mpECMPSingleInterfaceTopo import MpECMPSingleInterfaceTopo
|
2015-01-08 11:04:42 +00:00
|
|
|
|
|
|
|
class MpXpRunner:
|
|
|
|
def __init__(self, builderType, topoParamFile, xpParamFile):
|
2015-01-08 18:52:45 +00:00
|
|
|
self.defParamXp(xpParamFile)
|
2015-01-08 11:04:42 +00:00
|
|
|
self.topoParam = MpParamTopo(topoParamFile)
|
|
|
|
self.defBuilder(builderType)
|
|
|
|
self.defTopo()
|
|
|
|
self.defConfig()
|
|
|
|
self.startTopo()
|
2015-01-08 18:52:45 +00:00
|
|
|
self.runXp()
|
2015-01-08 11:04:42 +00:00
|
|
|
self.stopTopo()
|
2015-02-26 16:43:45 +00:00
|
|
|
|
2015-01-08 18:52:45 +00:00
|
|
|
def defParamXp(self, xpParamFile):
|
|
|
|
self.xpParam = MpParamXp(xpParamFile)
|
|
|
|
|
2015-01-08 11:04:42 +00:00
|
|
|
def defBuilder(self, builderType):
|
|
|
|
if builderType == MpTopo.mininetBuilder:
|
|
|
|
self.topoBuilder = MpMininetBuilder()
|
|
|
|
else:
|
2015-02-26 16:43:45 +00:00
|
|
|
raise Exception("I can not find the builder " +
|
2015-01-08 11:04:42 +00:00
|
|
|
builderType)
|
|
|
|
def defTopo(self):
|
|
|
|
t = self.topoParam.getParam(MpTopo.topoAttr)
|
|
|
|
if t == MpTopo.multiIfTopo:
|
|
|
|
self.mpTopo = MpMultiInterfaceTopo(self.topoBuilder,
|
|
|
|
self.topoParam)
|
2015-01-12 11:26:54 +00:00
|
|
|
elif t == MpTopo.ECMPLikeTopo:
|
|
|
|
self.mpTopo = MpECMPSingleInterfaceTopo(
|
|
|
|
self.topoBuilder,
|
|
|
|
self.topoParam)
|
2015-01-08 11:04:42 +00:00
|
|
|
else:
|
|
|
|
raise Exception("Unfound Topo" + t)
|
|
|
|
print(self.mpTopo)
|
|
|
|
|
|
|
|
def defConfig(self):
|
2015-01-12 11:26:54 +00:00
|
|
|
t = self.topoParam.getParam(MpTopo.topoAttr)
|
|
|
|
if t == MpTopo.multiIfTopo:
|
|
|
|
self.mpTopoConfig = MpMultiInterfaceConfig(self.mpTopo,
|
2015-01-08 11:04:42 +00:00
|
|
|
self.topoParam)
|
2015-01-12 11:26:54 +00:00
|
|
|
elif t == MpTopo.ECMPLikeTopo:
|
|
|
|
self.mpTopoConfig = MpECMPSingleInterfaceConfig(
|
|
|
|
self.mpTopo,
|
|
|
|
self.topoParam)
|
|
|
|
else:
|
2015-02-26 16:43:45 +00:00
|
|
|
raise Exception("Unfound Topo" + t)
|
2015-01-08 11:04:42 +00:00
|
|
|
|
|
|
|
def startTopo(self):
|
|
|
|
self.mpTopo.startNetwork()
|
|
|
|
self.mpTopoConfig.configureNetwork()
|
|
|
|
|
2015-01-08 18:52:45 +00:00
|
|
|
def runXp(self):
|
|
|
|
xp = self.xpParam.getParam(MpParamXp.XPTYPE)
|
|
|
|
if xp == MpExperience.PING:
|
|
|
|
MpExperiencePing(self.xpParam, self.mpTopo,
|
|
|
|
self.mpTopoConfig)
|
2015-01-12 15:34:41 +00:00
|
|
|
elif xp == MpExperience.NCPV:
|
|
|
|
MpExperienceNCPV(self.xpParam, self.mpTopo,
|
|
|
|
self.mpTopoConfig)
|
2015-02-27 10:16:01 +00:00
|
|
|
elif xp == MpExperience.NC:
|
|
|
|
MpExperienceNC(self.xpParam, self.mpTopo,
|
|
|
|
self.mpTopoConfig)
|
2015-03-05 10:32:11 +00:00
|
|
|
elif xp == MpExperience.NONE:
|
2015-03-05 10:37:50 +00:00
|
|
|
MpExperienceNone(self.xpParam, self.mpTopo,
|
2015-03-05 10:32:11 +00:00
|
|
|
self.mpTopoConfig)
|
2015-08-14 22:34:27 +00:00
|
|
|
elif xp == MpExperience.HTTPS:
|
|
|
|
MpExperienceHTTPS(self.xpParam, self.mpTopo,
|
|
|
|
self.mpTopoConfig)
|
2015-12-01 16:48:32 +00:00
|
|
|
elif xp == MpExperience.HTTP:
|
|
|
|
MpExperienceHTTP(self.xpParam, self.mpTopo,
|
|
|
|
self.mpTopoConfig)
|
2015-11-05 14:06:30 +00:00
|
|
|
elif xp == MpExperience.EPLOAD:
|
|
|
|
MpExperienceEpload(self.xpParam, self.mpTopo,
|
|
|
|
self.mpTopoConfig)
|
2015-12-02 09:22:57 +00:00
|
|
|
elif xp == MpExperience.NETPERF:
|
|
|
|
MpExperienceNetperf(self.xpParam, self.mpTopo,
|
|
|
|
self.mpTopoConfig)
|
2015-01-08 11:04:42 +00:00
|
|
|
else:
|
2015-01-08 18:52:45 +00:00
|
|
|
print("Unfound xp type..." + xp)
|
2015-02-26 16:43:45 +00:00
|
|
|
|
2015-01-08 11:04:42 +00:00
|
|
|
def stopTopo(self):
|
|
|
|
self.mpTopo.stopNetwork()
|