mininet-sample/src/mpXpRunner.py

145 lines
5.1 KiB
Python
Raw Normal View History

from mpTopo import MpTopo
from mpParamTopo import MpParamTopo
from mpParamXp import MpParamXp
from mpMultiInterfaceTopo import MpMultiInterfaceTopo
from mpMultiInterfaceConfig import MpMultiInterfaceConfig
from mpECMPSingleInterfaceConfig import MpECMPSingleInterfaceConfig
from mpTwoInterfaceCongestionConfig import MpTwoInterfaceCongestionConfig
from mpMininetBuilder import MpMininetBuilder
from mpExperiencePing import MpExperiencePing
from mpExperienceNCPV import MpExperienceNCPV
from mpExperienceNC import MpExperienceNC
from mpExperienceHTTPS import MpExperienceHTTPS
2015-12-01 16:48:32 +00:00
from mpExperienceHTTP import MpExperienceHTTP
from mpExperienceSendFile import MpExperienceSendFile
from mpExperienceEpload import MpExperienceEpload
2015-12-02 09:22:57 +00:00
from mpExperienceNetperf import MpExperienceNetperf
2015-12-02 14:22:51 +00:00
from mpExperienceAb import MpExperienceAb
2016-04-14 14:01:39 +00:00
from mpExperienceSiri import MpExperienceSiri
from mpExperienceVLC import MpExperienceVLC
2016-06-01 09:00:51 +00:00
from mpExperienceIperf import MpExperienceIperf
2016-06-01 12:52:25 +00:00
from mpExperienceDITG import MpExperienceDITG
from mpExperienceMsg import MpExperienceMsg
from mpExperienceSiriHTTP import MpExperienceSiriHTTP
from mpExperienceSiriMsg import MpExperienceSiriMsg
2017-05-05 11:19:03 +00:00
from mpExperienceQUIC import MpExperienceQUIC
from mpExperienceQUICSiri import MpExperienceQUICSiri
from mpExperienceNone import MpExperienceNone
from mpExperience import MpExperience
from mpECMPSingleInterfaceTopo import MpECMPSingleInterfaceTopo
from mpTwoInterfaceCongestionTopo import MpTwoInterfaceCongestionTopo
class MpXpRunner:
def __init__(self, builderType, topoParamFile, xpParamFile):
self.defParamXp(xpParamFile)
self.topoParam = MpParamTopo(topoParamFile)
self.defBuilder(builderType)
self.defTopo()
self.defConfig()
self.startTopo()
self.runXp()
self.stopTopo()
def defParamXp(self, xpParamFile):
self.xpParam = MpParamXp(xpParamFile)
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)
elif t == MpTopo.ECMPLikeTopo:
self.mpTopo = MpECMPSingleInterfaceTopo(
self.topoBuilder,
self.topoParam)
elif t == MpTopo.twoIfCongTopo:
self.mpTopo = MpTwoInterfaceCongestionTopo(
self.topoBuilder, self.topoParam)
else:
raise Exception("Unfound Topo" + t)
print(self.mpTopo)
def defConfig(self):
t = self.topoParam.getParam(MpTopo.topoAttr)
if t == MpTopo.multiIfTopo:
self.mpTopoConfig = MpMultiInterfaceConfig(self.mpTopo,
self.topoParam)
elif t == MpTopo.ECMPLikeTopo:
self.mpTopoConfig = MpECMPSingleInterfaceConfig(
self.mpTopo,
self.topoParam)
elif t == MpTopo.twoIfCongTopo:
self.mpTopoConfig = MpTwoInterfaceCongestionConfig(
self.mpTopo, self.topoParam)
else:
raise Exception("Unfound Topo" + t)
def startTopo(self):
self.mpTopo.startNetwork()
self.mpTopoConfig.configureNetwork()
def runXp(self):
xp = self.xpParam.getParam(MpParamXp.XPTYPE)
if xp == MpExperience.PING:
MpExperiencePing(self.xpParam, self.mpTopo,
self.mpTopoConfig)
elif xp == MpExperience.NCPV:
MpExperienceNCPV(self.xpParam, self.mpTopo,
self.mpTopoConfig)
elif xp == MpExperience.NC:
MpExperienceNC(self.xpParam, self.mpTopo,
self.mpTopoConfig)
elif xp == MpExperience.NONE:
MpExperienceNone(self.xpParam, self.mpTopo,
self.mpTopoConfig)
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)
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-12-02 14:22:51 +00:00
elif xp == MpExperience.AB:
MpExperienceAb(self.xpParam, self.mpTopo,
self.mpTopoConfig)
2016-04-14 14:01:39 +00:00
elif xp == MpExperience.SIRI:
MpExperienceSiri(self.xpParam, self.mpTopo,
self.mpTopoConfig)
elif xp == MpExperience.SENDFILE:
MpExperienceSendFile(self.xpParam, self.mpTopo,
self.mpTopoConfig)
elif xp == MpExperience.VLC:
MpExperienceVLC(self.xpParam, self.mpTopo,
self.mpTopoConfig)
2016-06-01 09:00:51 +00:00
elif xp == MpExperience.IPERF:
MpExperienceIperf(self.xpParam, self.mpTopo,
self.mpTopoConfig)
2016-06-01 12:52:25 +00:00
elif xp == MpExperience.DITG:
MpExperienceDITG(self.xpParam, self.mpTopo, self.mpTopoConfig)
elif xp == MpExperience.MSG:
MpExperienceMsg(self.xpParam, self.mpTopo, self.mpTopoConfig)
elif xp == MpExperience.SIRIHTTP:
MpExperienceSiriHTTP(self.xpParam, self.mpTopo, self.mpTopoConfig)
elif xp == MpExperience.SIRIMSG:
MpExperienceSiriMsg(self.xpParam, self.mpTopo, self.mpTopoConfig)
2017-05-05 11:19:03 +00:00
elif xp == MpExperience.QUIC:
MpExperienceQUIC(self.xpParam, self.mpTopo, self.mpTopoConfig)
elif xp == MpExperience.QUICSIRI:
MpExperienceQUICSiri(self.xpParam, self.mpTopo, self.mpTopoConfig)
else:
print("Unfound xp type..." + xp)
def stopTopo(self):
self.mpTopo.stopNetwork()